PointCloudLibrary (PCL) - Octree - 获取*分支*节点内所有点的索引

PointCloudLibrary (PCL) - Octree - get indices of all points within a *branch* node

本文关键字:索引 节点 分支 Octree 获取 PointCloudLibrary PCL      更新时间:2023-10-16

我是 PCL 的新手,我想从 pcl::octree 中的分支节点获取所有索引。因此,例如,根节点应为每个索引和每个子分支节点提供此分支节点中所有叶节点的点的索引。实现这一目标的最佳方法是什么?

我正在使用

pcl::octree::OctreePointCloudSearch<pcl::PointXYZ, pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerPointIndices>

并希望将BranchContainerT的第三个模板参数也设置为pcl::octree::OctreeContainerPointIndices,以便能够调用类似的东西

std::vector<int> indices;
auto it = m_octree->breadth_begin();
it.getBranchContainer().getPointIndices(indices)

但是,索引向量为空。当然,我可以手动迭代所有节点,获取叶子并插入索引,但也许我在这里缺少一些东西......?

好的,我缺少的是设置为 pcl::octree::OctreeContainerPointIndicesBranchContainerT 的模板参数仅为您提供将索引存储在此类容器中的选项。但是,添加这些索引是您必须手动完成的操作。

鉴于只需检查每个节点的类型并从叶中收集索引并将它们添加到分支节点即可。