Preview and Read Point Clouds from Ouster Lidar Sensor
You can preview and read point clouds from the supported Ouster® lidar sensors by using the preview
and the read
functions of the ousterlidar
object.
Preview Point Clouds
Create an ousterlidar
object, ousterObj
, for the OS0-64
sensor model. Specify the file path to the corresponding calibration file.
ousterObj = ousterlidar("OS1-64","C:/ouster/OS0-64G_sample.json");
Preview the point cloud data by using the preview
function. The preview window opens. Note that you must close
the preview figure before using the read
function.
preview(ousterObj)
After you preview the data, close the window by using the closePreview
function.
closePreview(ousterObj)
Read Point Clouds
After you create an ousterlidar
object, you can read point clouds from the object buffer
with or without first using the start
function to stream data.
If you use the start
function, you can read the data available in the object
buffer.
If you do not use the start
function, the read
function internally starts data streaming, reads the specified
point clouds, and then stops streaming.
You can use the pcplayer
function to visualize the
point clouds.
Read Point Clouds Without Buffering
Create an ousterlidar
object, ousterObj
, for the OS0-64
sensor model. Specify the file path to the corresponding calibration
file.
ousterObj = ousterlidar("OS1-64","C:/ouster/OS0-64G_sample.json");
Preview the point cloud data by using the preview
function. The preview window opens. Note that you must
close the preview figure before using the read
function.
preview(ousterObj)
After you preview the data, close the window by using the closePreview
function. You must close the preview window before
using the read
function.
closePreview(ousterObj);
Read the most recent point cloud from the buffer.
[ptCloud,timestamp] = read(ousterObj,"latest");
Display the point cloud using the pcshow
function.
pcshow(ptCloud)
Read Point Clouds from Buffer
Create an ousterlidar
object, ousterObj
, for the OS0-64
sensor model.
ousterObj = ousterlidar("OS0-64","OS0-64G_sample.json");
Start streaming point clouds into the object buffer by using the start
function. The function continues streaming in the
background.
start(ousterObj)
You can now select which data to read from the buffer using the read
function.
Read the oldest point cloud in the buffer.
[ptCloud,timestamp] = read(ousterObj,"Oldest");
Read all point clouds available in the buffer.
[ptCloud,timestamp] = read(ousterObj,"all");
Read the latest point cloud in the buffer. When you read the latest point cloud, the function discards all the older point clouds in the buffer.
[ptCloud,timestamp] = read(ousterObj,"latest");
Read Specified Number of Point Clouds
You can specify the number of point clouds to read from the object buffer when
using "oldest"
or "latest"
mode of the
read function. For example:
read(ousterObj,10)
reads the 10 oldest point clouds from the buffer. If you do not specify a read mode, the function uses"oldest"
by default.read(ousterObj,10,"oldest")
reads the 10 oldest point clouds from the buffer.read(ousterObj,20,"latest")
reads the 20 most recent point clouds from the buffer. The function deletes all older point clouds from the buffer.
See Also
ousterlidar
| preview
| closePreview
| start
| flush
| read
| stop