matlab(对点云的简单处理)

虽然用pcl比较多,但是pcl运行比较慢,我很多时候还是喜欢用matlab做一个算法的验证;

项目主要是做一个物体的分割处理。

1.对物体做去噪处理

clc;
clear;
B=pcread('test(1).ply');
figure(1);
pcshow(B);
C=pcdenoise(B,'NumNeighbors',90,'Threshold',1);
figure(2);
pcshow(C);

效果如下:(主要就是一个基于最近邻+距离的去噪,类似pcl的统计滤波)

                          

2.做一个roi提取

roi = [-inf,+inf;-inf,inf;-10,inf];
indices = findPointsInROI(C, roi);

ptCloudC = select(C,indices);
figure(3);
pcshow(ptCloudC);

roi1 = [-inf,-8;-inf,inf;-10,inf];
indices1 = findPointsInROI(ptCloudC, roi1);
ptCloudB = select(ptCloudC,indices1);
figure(4);
pcshow(ptCloudB);

 

3.想要得到上面的包,在做一个平面分割

maxDistance = 0.9;
referenceVector = [0,0,-1];
maxAngularDistance = 7;
[model1,inlierIndices,outlierIndices] = pcfitplane(ptCloudB,...
            maxDistance,referenceVector,maxAngularDistance);
plane1 = select(ptCloudB,inlierIndices);
remainPtCloud = select(ptCloudB,outlierIndices);
figure
pcshow(plane1)
title('First Plane')
figure
pcshow(remainPtCloud)
title('remainPtCloud Plane')

          

4.再做roi+滤波

          

5.聚类

 

 

minDistance = 0.9;
[labels,numClusters] = pcsegdist(E,minDistance);
pcshow(E.Location,labels)
colormap(hsv(numClusters))
title('Point Cloud Clusters')
disp(" the number of an jian:")
disp(numClusters)

效果不是特别好,存在一些问题。先验证一下思路是可行的。 

5.长宽高的提取

都在matlab 的文件家中。不想复制了。。。 

  • 29
    点赞
  • 199
    收藏
    觉得还不错? 一键收藏
  • 37
    评论
评论 37
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值