这个类可以用来对一个二维多边形加上一个高度限定的区域内部点进行提取。
ExtractPolygonalPrismData uses a set of point indices that represent a planar model, and together with a given height, generates a 3D polygonal prism. The polygonal prism is then used to segment all points lying inside it. An example of its usage is to extract the data lying within a set of 3D boundaries (e.g., objects supported by a plane). Example usage: double z_min = 0., z_max = 0.05; // we want the points above the plane, no farther than 5 cm from the surface
pcl::PointCloud<pcl::PointXYZ>::Ptr hull_points (new pcl::PointCloud<pcl::PointXYZ> ());
pcl::ConvexHull<pcl::PointXYZ> hull;
// hull.setDimension (2); // not necessarily needed, but we need to check the dimensionality of the output
hull.setInputCloud (cloud);
hull.reconstruct (hull_points);
if (hull.getDimension () == 2)
{
pcl::ExtractPolygonalPrismData<pcl::PointXYZ> prism;
prism.setInputCloud (point_cloud);
prism.setInputPlanarHull (hull_points);
prism.setHeightLimits (z_min, z_max);
prism.segment (cloud_indices);
}
else
PCL_ERROR ("The input cloud does not represent a planar surface.\n");
|