[done, 599.439 ms : 307200 points]
Available dimensions: x y z rgb
原始点云
PointCloud after filtering has: 139656 data points.
PointCloud after segmentation has: 123727 inliers.
PointCloud after projection has: 139656 data points.
Concave hull has: 457 data points.
[done, 438.018 ms : 457 points]
Available dimensions: x y z
投影后点云凸包
该段代码是一个使用PCL(Point Cloud Library,点云库)进行点云处理的完整程序。程序的主要过程如下:
首先,初始化三个
pcl::PointCloud<pcl::PointXYZ>
智能指针,cloud
用于存储原始点云数据,cloud_filtered
用于存储过滤后的点云数据,cloud_projected
用于存储投影后的点云数据。使用
pcl::PCDReader
对象读取名为"table_scene_mug_stereo_textured.pcd"
的PCD文件到cloud
中。使用
pcl::PassThrough<pcl::PointXYZ>
过滤器来移除点云中的NaN值,同时根据z
字段的范围(0到1.1)来裁剪点云,以移除场景背景,结果存入cloud_filtered
。初始化
pcl::ModelCoefficients
和pcl::PointIndices
,以存储模型系数和分割得到的内点索引。创建
pcl::SACSegmentation<pcl::PointXYZ>
对象进行分割操作,设置模型类型为平面(pcl::SACMODEL_PLANE
),方法类型为RANSAC(pcl::SAC_RANSAC
),并设定距离阈值为0.01。将cloud_filtered
作为输入进行分割,并将内点索引存入inliers