为pcl :: PointCloud数据指定一个区域并获取可用点

时间:2019-07-16 08:35:41

标签: c++ point-cloud-library

我正在寻找pcl :: PointCloud对象的方法或算法,该对象根据像素坐标接受矩形甚至圆形区域,并依次返回该区域中的所有可用点。

例如:

  1. 输入:100像素
  2. 输出:XYZ中的点

1 个答案:

答案 0 :(得分:0)

对于像素级切片,只需在生成点云之前裁剪图像即可。例如在OpenCV中:

cv::Rect myROI(100, 240, 20, 120); 
cv::Mat croppedImage = image(myROI);

如果要在欧几里得坐标上切片数据,可以使用PassThrough过滤器:

pcl::PassThrough<PointType> ptfilter (true); // Initializing with true will allow us to extract the removed indices
ptfilter.setInputCloud (cloud_in);
ptfilter.setFilterFieldName ("x");
ptfilter.setFilterLimits (0.0, 1000.0);
ptfilter.filter (*indices_x);

对于原点周围的球形区域,请使用Kdtree对象中的radiusSearch方法并查询哪些点位于原点周围的半径之内。

相关问题