Lidar Labeler loads point clouds in the order returned by the dir function? How to sort the files?
이전 댓글 표시
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];
%player
player=pcplayer(xLimit,yLimit,zLimit);
xlabel(player.Axes,'X(m)');
ylabel(player.Axes,'Y(m)');
zlabel(player.Axes,'Z(m)');
%PointClouds.CurrentTime=PointClouds.StartTime+seconds(1);
veloReader.CurrentTime=veloReader.StartTime;
%Use a loop to play and save the point clouds as .pcd
a=0;
filename="PointClouds%d.pcd";
while(hasFrame(veloReader) && isOpen(player) && (veloReader.CurrentTime < veloReader.StartTime + seconds(2)))
a=a+1
%extract point clouds frame by frame from Velodyne scans
PtCloud = readFrame(veloReader, a); % veloReader is 1x1 velodyneROSMessageReader
%save point clouds as struct
PointClouds(a)=PtCloud;
timeDuration(a)=veloReader.Timestamps(a);
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
pause(0.1);
veloReader.CurrentTime
end
Thank you very much for your time.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Filtering, Conversion, and Geometric Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
