PCL库学习笔记(Octree寻找邻近点及其应用) 您所在的位置:网站首页 寻找最近点算法 PCL库学习笔记(Octree寻找邻近点及其应用)

PCL库学习笔记(Octree寻找邻近点及其应用)

2023-09-10 10:23| 来源: 网络整理| 查看: 265

上文我们利用了kdtree进行邻近点的提取。在点云pcl库中,还有一个重要的点查找方法就是octree。其原理和应用在这篇博文中有了比较详细的介绍: PCL中八叉树理论 octree有三种寻找最近邻的方式分别为: 1、neighbors within voxel search 就是返回该点所在的voxel中的所有其他点的索引; 2、K nearest Neighbor search 就是返回该点最近的K个点; 3、Neighbors within radius search 就是返回限定半径范围内的所有点; 下面代码只输出了三种情况的前10个点,可以发现其实找的点还是有存在差异的。具体哪种情况用哪一种方式,还是需要具体分析。后期可能会补充三种方式在邻近点寻找上的可视化展示,方便更好理解。

#include #include #include #include #include #include using namespace std; int main() { pcl::PointCloud::Ptr cloud(new pcl::PointCloud); cloud->height = 100000; cloud->width = 1; cloud->is_dense = true; cloud->resize(cloud->width*cloud->height); for (size_t i = 0; i size(); i++) { cloud->points[i].x = 1024.0f*rand() / (RAND_MAX + 1.0f); cloud->points[i].y = 1024.0f*rand() / (RAND_MAX + 1.0f); cloud->points[i].z = 1024.0f*rand() / (RAND_MAX + 1.0f); } // construct octree float resolution = 128.0f; pcl::octree::OctreePointCloudSearch octree(resolution); octree.setInputCloud(cloud); octree.addPointsFromInputCloud(); // set search point pcl::PointXYZ searchPoint; searchPoint = cloud->points[10]; // neighbors within voxel search vector Idx1; octree.voxelSearch(searchPoint, Idx1); cout cout


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有