Main Content


Read Velodyne point cloud from file


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.


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

[ptCloud,pointTimestamps] = readFrame(___) returns the timestamps for all points in the point cloud using any combination of input arguments from previous syntaxes.


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 one second after the first point cloud reading.

timeDuration = veloReader.StartTime + duration(0,0,1,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.


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.

Timestamps for all points in the point cloud, returned as a duration vector or a matrix.

The function returns timestamps as:

  • An M-element vector for unorganized point clouds. M is the total number of points in the point cloud.

  • An M-by-N matrix for organized point clouds. M and N are the number of rows and columns in the organized point cloud, respectively.

These values are between the values of the StartTime and the EndTime properties of the velodyneFileReader object.

Version History

Introduced in R2018a

expand all