learn pcl 04

Extracting indices from a PointCloud


After the data has been loaded from the input .PCD file, we create a VoxelGrid filter, to downsample the data. The rationale behind data downsampling here is just to speed things up – less points means less time needed to spend within the segmentation loop.

  pcl::VoxelGrid<sensor_msgs::PointCloud2> sor;
  sor.setInputCloud (cloud_blob);
  sor.setLeafSize (0.01f, 0.01f, 0.01f);
  sor.filter (*cloud_filtered_blob);
从.pcd文件读取数据后 创建了一个voxelgrid filter 去减少采样数据,加速segmentation loop所需的时间,更少的点意味着更少的循环。

The next block of code deals with the parametric segmentation. To keep the tutorial simple, its its explanation will be skipped for now. Please see the segmentation tutorials (in particular Plane model segmentation) for more information.

  pcl::ModelCoefficients::Ptr coefficients (new pcl::ModelCoefficients ());
  pcl::PointIndices::Ptr inliers (new pcl::PointIndices ());
  // Create the segmentation object
  pcl::SACSegmentation<pcl::PointXYZ> seg;
  // Optional
  seg.setOptimizeCoefficients (true);
  // Mandatory
  seg.setModelType (pcl::SACMODEL_PLANE);
  seg.setMethodType (pcl::SAC_RANSAC);
  seg.setMaxIterations (1000);
  seg.setDistanceThreshold (0.01);
我晕,为了使tutorial简单,平面分割的部分居然跳过了, 需要到另外的文档看。那就跳到Plane model segmentation

上一篇learn pcl 03
想对作者说点什么? 我来说一句


2012年10月17日 2KB 下载