c++ - PointCloudLibrary (PCL) - 八叉树 - 获取 *branch* 节点内所有点的索引

标签 c++ c++11 data-structures computer-vision point-cloud-library

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

我正在使用一个

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)

但是,索引 vector 是空的。 当然,我可以手动遍历所有节点,获取叶子并插入索引,但也许我在这里遗漏了一些东西......?

最佳答案

好的,我缺少的是 BranchContainerT 的模板参数设置为 pcl::octree::OctreeContainerPointIndices为您提供在这种容器中存储索引的选项。 但是您必须手动添加这些索引。

鉴于这只是检查每个节点的类型并从叶子收集索引并将它们添加到分支节点的问题。

关于c++ - PointCloudLibrary (PCL) - 八叉树 - 获取 *branch* 节点内所有点的索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47138356/

相关文章:

c++ - 将分配器分配给字段 - 我应该将默认分配器创建为全局变量吗?

C++11 初始化语法问题(使用 gcc 4.5/4.6)

c++ - 非法使用已删除的函数

C++11 initializer_list 构造函数标记为 "explicit"

javascript - 在 Javascript 中查找两个数组的交集

c++ - 读一个大文件统计单词重复K次的次数

c++ - 使用 std::count 计算一对数组中的相等值

C++ 从 SQL 到 XML?

c++ - 为什么 std::weak_ptr 没有 operator->?

algorithm - 远离点集的查询点的 3D 最近邻