Main Content

hasFrame

Determine if another Ouster point cloud is available

Since R2022a

Description

example

isAvailable = hasFrame(ousterReader) determines if another point cloud is available in the packet capture (PCAP) file of the input Ouster® file reader. As you read point clouds using readFrame, the point clouds are read sequentially until this function returns false.

Examples

collapse all

Download a ZIP file containing an Ouster packet capture (PCAP) file and the corresponding calibration file, and then unzip the file.

zipFile = matlab.internal.examples.downloadSupportFile("lidar","data/ouster_RoadIntersection.zip");
saveFolder = fileparts(zipFile);
pcapFileName = [saveFolder filesep 'ouster_RoadIntersection' filesep 'ouster_RoadIntersection.pcap'];
calibFileName = [saveFolder filesep 'ouster_RoadIntersection' filesep 'OS1-128U.json'];
if ~(exist(pcapFileName,"file") && exist(calibFileName,"file"))
    unzip(zipFile,saveFolder);
end

Create an ousterFileReader object.

ousterReader = ousterFileReader(pcapFileName,calibFileName);

Check if the file reader has a point cloud to read using hasFrame.

disp(hasFrame(ousterReader))
   1

Read the last point cloud frame of the file.

ptCloud = readFrame(ousterReader,ousterReader.NumberOfFrames);

Check if ousterReader has a next point cloud available to read.

disp(hasFrame(ousterReader))
   0

Input Arguments

collapse all

Ouster file reader, specified as ousterFileReader object.

Output Arguments

collapse all

Frame is available, returned as 1 (true) or 0 (false). This argument returns true if the Ouster file reader contains one or more point cloud frames to read after the current frame. Otherwise, it returns false.

Version History

Introduced in R2022a