Main Content

readFrame

Read Velodyne point cloud from file

Description

ptCloud = readFrame(veloReader) reads the next point cloud in sequence from the Velodyne® PCAP file and returns a pointCloud object.

ptCloud = readFrame(veloReader,frameNumber) reads the point cloud with the specific frame number from the file.

example

ptCloud = readFrame(veloReader,frameTime) reads the first point cloud recorded at or after the given frameTime.

Examples

collapse all

Create a velodyneFileReader object to read a Velodyne® packet capture (PCAP) file and select specific point clouds using a duration scalar.

Read in point clouds by using a Velodyne® file reader. Specify the PCAP file to read and the Velodyne® device model.

veloReader = velodyneFileReader('lidarData_ConstructionRoad.pcap','HDL32E');

Create a duration scalar that represents three seconds after the first point cloud reading.

timeDuration = veloReader.StartTime + duration(0,0,3,'Format','s');

Read the first point cloud recorded at or after the given time duration.

ptCloudObj   = readFrame(veloReader,timeDuration);

Display the point cloud using pcshow.

figure
pcshow(ptCloudObj)

Figure contains an axes object. The axes object contains an object of type scatter.

Input Arguments

collapse all

Velodyne file reader, specified as a velodyneFileReader object.

Frame number of the desired point cloud in file, specified as a positive integer. Frame numbers are sequential.

Frame time of the desired point cloud in the file, specified as a duration scalar in seconds. The first frame available at or after frameTime is given.

Output Arguments

collapse all

Point cloud, returned as a pointCloud object.

Introduced in R2018a