Lidar Labeler loads point clouds in the order returned by the dir function? How to sort the files?
2 views (last 30 days)
Hi everyone. I have saved Point Clouds as .pcd files in the directory with names e.g. PointClouds1.pcd .......... PointClouds20.pcd.
However the lidar labeler reads them in the order returned by dir function. The order returned by dir function, is as follows,
PointClouds11.pcd PointClouds15.pcd PointClouds19.pcd PointClouds4.pcd PointClouds8.pcd PointClouds12.pcd PointClouds16.pcd PointClouds2.pcd PointClouds5.pcd PointClouds9.pcd PointClouds1.pcd PointClouds13.pcd PointClouds17.pcd PointClouds20.pcd PointClouds6.pcd PointClouds10.pcd PointClouds14.pcd PointClouds18.pcd PointClouds3.pcd PointClouds7.pcd.
How do I make sure that labeler app loads file in correct order (e.g starting from 1 upto 20). Or how do I make sure that files are saved in the correct order?
I think, I am making a mistake while saving the files as .pcd. Here is the code that I used to display the point clouds in pc player as well as save them as .pcd.
% Define pointcloud player
xLimit = [-50,50];
yLimit = [-50,50];
zLimit = [-3,15];
%Use a loop to play and save the point clouds as .pcd
while(hasFrame(veloReader) && isOpen(player) && (veloReader.CurrentTime < veloReader.StartTime + seconds(2)))
%extract point clouds frame by frame from Velodyne scans
PtCloud = readFrame(veloReader, a); % veloReader is 1x1 velodyneROSMessageReader
%save point clouds as struct
pcdfile=sprintf(filename,a); %Generate file name
pcwrite(PointClouds(a),pcdfile,'Encoding','ascii') % save points clouds as .pcd
view(player,PtCloud.Location,PtCloud.Intensity); %view pointclouds in the pc player
Thank you very much for your time.
Cam Salzberger on 1 Apr 2022
I'm not sure about getting Lidar Labeler to load in a different order, or if this is the best way to generate point clouds for use with it. But I can at least answer how to save them in order:
This will result in filenames like "PointClouds01.pcd", "PointClouds02.pcd", etc.
The "2" is the precision before the decimal point, and the preceding "0" pads out the value with zeros to reach "2" places. If you wanted to have three-digit numbers instead, use "03" instead of "02". See here for more information.