首页 > 其他 > 详细

点云密度计算

时间:2016-05-19 16:29:41      阅读:1007      评论:0      收藏:0      [点我收藏+]

1.计算点云最近点的平均距离(点云的平均距离)http://pointclouds.org/documentation/tutorials/correspondence_grouping.php

 1 double computeCloudResolution (const pcl::PointCloud<PointType>::ConstPtr &cloud)
 2 {
 3   double res = 0.0;
 4   int n_points = 0;
 5   int nres;
 6   std::vector<int> indices (2);
 7   std::vector<float> sqr_distances (2);
 8   pcl::search::KdTree<PointType> tree;
 9   tree.setInputCloud (cloud);
10 
11   for (size_t i = 0; i < cloud->size (); ++i)
12   {
13     if (! pcl_isfinite ((*cloud)[i].x))
14     {
15       continue;
16     }
17     //Considering the second neighbor since the first is the point itself.
18     nres = tree.nearestKSearch (i, 2, indices, sqr_distances);
19     if (nres == 2)
20     {
21       res += sqrt (sqr_distances[1]);
22       ++n_points;
23     }
24   }
25   if (n_points != 0)
26   {
27     res /= n_points;
28   }
29   return res;
30 }

 

点云密度计算

原文:http://www.cnblogs.com/yhlx125/p/5509041.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!