激光雷达贴标签机加载点云的顺序返回的dir函数?如何对文件进行排序?

2视图(30天)
大家好!我有保存点云.pcd文件目录名称例如PointClouds1。pcd ..........PointClouds20.pcd。
然而,激光雷达贴标签机在dir函数返回的顺序读取它们。dir函数,返回的订单如下,
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。
如何确保在正确的顺序贴标签机应用程序加载文件(e。g从1到20)。或者我如何确保文件保存在正确的顺序?
我想我犯了一个错误,而作为.pcd保存文件。下面是我的代码用于显示点云在pc玩家以及.pcd拯救他们。
% %
%定义pointcloud球员
xLimit =(-50年,50);
yLimit =(-50年,50);
zLimit = (3、15);
%的球员
球员= pcplayer (xLimit yLimit zLimit);
包含(player.Axes“X (m)”);
ylabel (player.Axes“Y (m)”);
zlabel (player.Axes“Z (m)”);
% PointClouds.CurrentTime = PointClouds.StartTime +秒(1);
veloReader.CurrentTime = veloReader.StartTime;
%使用循环播放并保存.pcd点云
= 0;
文件名=“PointClouds % d.pcd”;
(hasFrame (veloReader) & & isOpen(球员)& & (veloReader。CurrentTime < veloReader。开始时间+秒(2)))
= + 1
%从调速发电机提取点云逐帧扫描
PtCloud = readFrame (veloReader);% 1 x1 velodyneROSMessageReader veloReader
%保存点云结构
PointClouds (a) = PtCloud;
timeDuration (a) = veloReader.Timestamps(一个);
pcdfile = sprintf(文件名);%生成文件名
pcdfile pcwrite (PointClouds (a),“编码”,“ascii”)%保存.pcd点云
视图(球员,PtCloud.Location PtCloud.Intensity);%视图pointclouds在pc的球员
暂停(0.1);
veloReader.CurrentTime
结束
非常感谢你的时间。

接受的答案

凸轮扎尔茨贝格
凸轮扎尔茨贝格 2022年4月1日
你好Sarang,
我不确定对激光雷达贴标签机加载在一个不同的顺序,或者如果这是最好的方式来生成使用点云。但我至少可以回答如何拯救他们:
文件名=“PointClouds % 02 d.pcd”;
这将导致像“PointClouds01文件名。纤毛运动”、“PointClouds02。纤毛运动”等等。
“2”是小数点前的精度,和前面的“0”垫与零值达到“2”的地方。如果你想要3位数的认识相反,使用“03”而不是“02”。 有关更多信息,请参见这里
凸轮
2的评论
凸轮扎尔茨贝格
凸轮扎尔茨贝格 2022年4月5日
嘿,Sarang,
我认为你混淆显示订单与实际订单。我有一个与PointClouds001.pcd…PointClouds020.pcd目录设置。如果我只做“dir”,我得到了这个:
但是如果你这样做,您可以看到文件以正确的顺序:
> >信息= dir;
> > arrayfun (@ (x) disp (x.name),信息)
. .
PointClouds001.pcd
PointClouds002.pcd
PointClouds003.pcd
PointClouds004.pcd
PointClouds005.pcd
再一次,不太确定激光雷达贴标签机。但这至少应该解决“dir”做什么。
凸轮

登录置评。

更多的答案(0)

社区寻宝

找到宝藏在MATLAB中央,发现社区如何帮助你!

开始狩猎!