我是 PCL 新手。我正在使用 PCL 库,并且正在寻找一种从点云中提取点或将特定点复制到新点的方法。我想验证每个点是否符合条件,并且我想获得仅包含优点的点云。谢谢!
使用 ExtractIndices 类:
- 将要删除的点添加到 PointIndices 变量中
- 将这些索引传递给 ExtractIndices
- “负向”运行 filter() 方法以获得原始云减去您的点
example:
pcl::PointCloud<pcl::PointXYZ>::Ptr p_obstacles(new pcl::PointCloud<pcl::PointXYZ>);
pcl::PointIndices::Ptr inliers(new pcl::PointIndices());
pcl::ExtractIndices<pcl::PointXYZ> extract;
for (int i = 0; i < (*p_obstacles).size(); i++)
{
pcl::PointXYZ pt(p_obstacles->points[i].x, p_obstacles->points[i].y, p_obstacles->points[i].z);
float zAvg = 0.5f;
if (abs(pt.z - zAvg) < THRESHOLD) // e.g. remove all pts below zAvg
{
inliers->indices.push_back(i);
}
}
extract.setInputCloud(p_obstacles);
extract.setIndices(inliers);
extract.setNegative(true);
extract.filter(*p_obstacles);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)