点云预处理-matlab

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

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

1.对物体做去噪处理


 
 
  1. clc ;
  2. clear ;
  3. B=pcread('test( 1).ply') ;
  4. figure( 1) ;
  5. pcshow( B) ;
  6. C=pcdenoise( B,'NumNeighbors', 90,'Threshold', 1) ;
  7. figure( 2) ;
  8. pcshow( C) ;

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

                          

2.做一个roi提取


 
 
  1. roi = [-inf,+inf ;-inf,inf;-10,inf];
  2. indices = findPointsInROI(C, roi) ;
  3. ptCloudC = select(C,indices) ;
  4. figure( 3) ;
  5. pcshow(ptCloudC) ;
  6. roi1 = [-inf,- 8 ;-inf,inf;-10,inf];
  7. indices1 = findPointsInROI(ptCloudC, roi1) ;
  8. ptCloudB = select(ptCloudC,indices1) ;
  9. figure( 4) ;
  10. pcshow(ptCloudB) ;

 

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


 
 
  1. maxDistance = 0.9;
  2. referenceVector = [0,0,-1];
  3. maxAngularDistance = 7;
  4. [model1,inlierIndices,outlierIndices] = pcfitplane(ptCloudB,...
  5. maxDistance,referenceVector,maxAngularDistance);
  6. plane1 = select(ptCloudB,inlierIndices);
  7. remainPtCloud = select(ptCloudB,outlierIndices);
  8. figure
  9. pcshow(plane1)
  10. title('First Plane')
  11. figure
  12. pcshow(remainPtCloud)
  13. title('remainPtCloud Plane')

          

4.再做roi+滤波

          

5.聚类

 

 


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

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

5.长宽高的提取

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

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值