PCL函数库摘要——k-d tree与八叉树

15 篇文章 7 订阅

1.Class pcl::KdTree< PointT >

类KdTree是kd-tree数据结构的实现,并且是具有最近邻搜索实现的类KdTreeeFLANN的基类。

#include <pcl/kdtree/kdtree.h>
KdTree (bool sorted=true) 
//  空的构造函数  
virtual void  setInputCloud (const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr()) 
//  设置输入点云,参数cloud为输入点云的共享指针引用, indices为在 kd-tree中使用的点对应的索引,如果不设置,则默认使用整个点云填充kd-tree。  
IndicesConstPtr  getIndices () const 
//  获取指向所用索引向量的指针。
PointCloudConstPtr  getInputCloud () const 
//  设置指向输入点云数据集的指针。
void  setPointRepresentation (const PointRepresentationConstPtr &point_representation) 
//  提供指向点表示的指针,以用于将点转换为k-d矢量。  
PointRepresentationConstPtr  getPointRepresentation () const 
//  获取指向将点转换为k维向量时使用的点表示形式的指针。  
virtual  ~KdTree () 
//  析构函数    
virtual int  nearestKSearch (const PointT &p_q, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const =0 
//  纯虚函数,具体实现在其子类KdTreeFLANN中,其用来进行K邻域搜索,参数p_q为需要查询的点,k为K邻域个数,k_indices为搜索完的邻域点对应的索引,k_sqr_distances为搜索完的每个邻域点与查询点之间的欧氏距离。  
virtual int  nearestKSearch (const PointCloud &cloud, int index, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const 
//  纯虚函数,具体实现在其子类KdTreeFLANN 中,参数cloud 为需要查询的点集合, index 为点集合中需要查询点的索引,其他参数同上。
virtual int  nearestKSearch (int index, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const 
//  纯虚函数,具体实现在其子类KdTreeFLANN中,其用来进行k邻域搜索,参数index为点云中需要查询点的索引,其他参数同上。  
template<typename PointTDiff >  
int  nearestKSearchT (const PointTDiff &point, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const 
// 用来进行k邻域搜索,参数point为需要查询的一个类别不同的点,其他参数同上。
virtual int  radiusSearch (const PointT &p_q, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const =0 
//  纯虚函数,具体实现在其子类KdTreeFLANN中,其用来进行r半径内的邻域搜索,参数 p_q为需要查询的点, radius为需要查询的半径大小, k_indices为搜索完的邻域点对应的索引,k_sqr_distances为搜索完的每个邻域点与查询点之间的欧氏距离, max_nn为设置返回的邻域个数上限,如果为0或者大于返回的邻域个数,其返回全部查询结果。
virtual int  radiusSearch (int index, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const 
//  纯虚函数,具体实现在其子类KdTreeFLANN中,其用来进行r半径内的邻域搜索,参数index为需要查询的点的索引,其他同上。 
virtual int  radiusSearch (const PointCloud &cloud, int index, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const 
//  纯虚函数,具体实现在其子类KdTreeFLANN中,其用来进行r半径内的邻域搜索,参数cloud 为需要查询的点集合,index 为点集合中需要查询点的索引,其他同上。  
template<typename PointTDiff >  
int  radiusSearchT (const PointTDiff &point, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const 
//  来进行r半径内的邻域搜索,参数point为需要查询的一个类别不同的点,其他同上。    
virtual void  setEpsilon (float eps) 
//  设置误差限。
float  getEpsilon () const 
//  获取误差限。 
void  setMinPts (int min_pts) 
//  设置k近邻搜索中可行结果的最小数目。
int  getMinPts () const 
//  获取k近邻搜索中可行结果的最小数目。

2.Class pcl::KdTreeFLANN< PointT, Dist >

类KdTreeFLANN是继承了kd-tree数据结构的具有3D空间检索功能实现的KdTree子类。

#include <pcl/kdtree/kdtree_flann.h>
KdTreeFLANN (bool sorted=true) 
//  KdTreeFLANN类的默认构造函数。  
KdTreeFLANN (const KdTreeFLANN< PointT > &k) 
//  复制构造函数  
KdTreeFLANN< PointT > &  operator= (const KdTreeFLANN< PointT > &k) 
//  复制运算符重载函数  
void  setEpsilon (float eps) 
//  设置搜索精度 
void  setSortedResults (bool sorted) 
//  设置是否对结果进行排序   
Ptr  makeShared () 
//  
virtual  ~KdTreeFLANN () 
//  KdTreeFLANN的析构函数。
void  setInputCloud (const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr()) 
//  设置输入点云,参数cloud为输入点云的共享指针引用, indices为在kd-tree 中使用的点对应的索引,如果不设置,则默认使用整个点云填充kd-tree。  
int  nearestKSearch (const PointT &point, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const 
//  实现父类的纯虚函数k近邻搜索,参数说明见父类。  
int  radiusSearch (const PointT &point, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const 
// 实现父类的纯虚函数k近邻搜索,参数说明见父类。

3.Class pcl::octree::Octree2BufBase < LeafContainerT, BranchContainerT >

#include <pcl/octree/octree2buf_base.h>
Iterator  begin (unsigned int max_depth_arg=0) 
  
const Iterator  end () 
  
LeafNodeIterator  leaf_begin (unsigned int max_depth_arg=0) 
  
const LeafNodeIterator  leaf_end () 
  
DepthFirstIterator  depth_begin (unsigned int maxDepth_arg=0) 
  
const DepthFirstIterator  depth_end () 
  
BreadthFirstIterator  breadth_begin (unsigned int max_depth_arg=0) 
  
const BreadthFirstIterator  breadth_end () 
  
Octree2BufBase () 
//  空的析构函数
virtual  ~Octree2BufBase () 
//  空的构造函数
Octree2BufBase (const Octree2BufBase &source) 
//  复制构造函数
Octree2BufBase &  operator= (const Octree2BufBase &source) 
//  复制运算符重载函数  
void  setMaxVoxelIndex (unsigned int max_voxel_index_arg) 
//  设置在各个维度上最大的体素个数。
void  setTreeDepth (unsigned int depth_arg) 
//  设置八叉树的深度,需要在初始化八叉树时设置。
unsigned int  getTreeDepth () const 
//  Get the maximum depth of the octree. More...
LeafContainerT *  createLeaf (unsigned int idx_x_arg, unsigned int idx_y_arg, unsigned int idx_z_arg) 
//  在(idx_x_arg, idx_y_arg, idx_z_arg)位置创建新的叶节点。  
LeafContainerT *  findLeaf (unsigned int idx_x_arg, unsigned int idx_y_arg, unsigned int idx_z_arg) 
//  在(idx_x_arg、idx_y_arg、idx_z_arg)处查找叶节点。  
bool  existLeaf (unsigned int idx_x_arg, unsigned int idx_y_arg, unsigned int idx_z_arg) const 
//  判断在(idx_x_arg、idx_y_arg、idx_z_arg)对应的叶子节点是否存在,如果存在返回true,否则返回false。  
void  removeLeaf (unsigned int idx_x_arg, unsigned int idx_y_arg, unsigned int idx_z_arg) 
// 删除(idx_x_arg、idx_y_arg、idx_z_arg)处的叶节点。  
std::size_t  getLeafCount () const 
//  返回在该八叉树中的叶子数目。  
std::size_t  getBranchCount () const 
//  返回在该八叉树中的分支数目。  
void  deleteTree () 
//  删除八叉树的结构及其叶子节点。  
void  deletePreviousBuffer () 
//  删除另一个缓冲区中对应八叉树的结构及其叶子节点。  
void  deleteCurrentBuffer () 
//  删除当前缓冲区中对应八叉树的结构和其叶子节点。  
void  switchBuffers () 
//  交换缓冲区,并重设八叉树结构。
void  serializeTree (std::vector< char > &binary_tree_out_arg, bool do_XOR_encoding_arg=false) 
 // 串行化输出八叉树结构到binaryTreeOut_arg向量, doXOREncoding_arg设置输出时是否将当前缓冲区与后台缓冲区中数据进行异或操作后再输出,异或操作是两个八叉树结构之间差异数据的输出。  
void  serializeTree (std::vector< char > &binary_tree_out_arg, std::vector< LeafContainerT *> &leaf_container_vector_arg, bool do_XOR_encoding_arg=false) 
//  串行化重载函数,其中参数dleaf_container_vector_arg存储八叉树中叶子节点上的数据,其他两个参数同上。  
void  serializeLeafs (std::vector< LeafContainerT *> &leaf_container_vector_arg) 
//  参数leaf_container_vector_arg存储八叉树中叶子节点上的数据,该函数只串行化八叉树中的数据。  
void  deserializeTree (std::vector< char > &binary_tree_in_arg, bool do_XOR_decoding_arg=false) 
//  反串行化,参数意义同上面对应的串行化函数。 O
void  serializeNewLeafs (std::vector< LeafContainerT *> &leaf_container_vector_arg) 
//  参数leaf_container_vector_arg存储八叉树中叶子节点上的数据,该函数串行化八叉树缓冲区中不存在中的数据。
void  deserializeTree (std::vector< char > &binary_tree_in_arg, std::vector< LeafContainerT *> &leaf_container_vector_arg, bool do_XOR_decoding_arg=false) 
//  反串行化,参数意义同上面对应的串行化函数。

4.Class pcl::octree::OctreeBase< LeafContainerT, BranchContainerT >

类OctreeBase为八叉树基类,其关键成员函数参考其他类介绍。

5.Class pcl::octree::OctreeIteratorBase< OctreeT >

类OctreeIteratorBase为八叉树迭代器的基类,用于深度优先或广度优先遍历八叉树时使用。

#include <pcl/octree/octree_iterator.h>
OctreeIteratorBase (unsigned int max_depth_arg=0) 
//  空构造函数  
OctreeIteratorBase (OctreeT *octree_arg, unsigned int max_depth_arg=0) 
//  构造函数
OctreeIteratorBase (const OctreeIteratorBase &src, unsigned int max_depth_arg=0) 
//  复制构造函数  
OctreeIteratorBase &  operator= (const OctreeIteratorBase &src) 
//  复制运算符重载函数    
virtual  ~OctreeIteratorBase () 
//  空析构函数  
bool  operator== (const OctreeIteratorBase &other) const 
//  相等比较运算符。  
bool  operator!= (const OctreeIteratorBase &other) const 
//  不等比较运算符。  
void  reset () 
//  初始化迭代器  
const OctreeKey &  getCurrentOctreeKey () const 
//  获取当前八叉树节点对应迭代器的键值。  
unsigned int  getCurrentOctreeDepth () const 
//  获取当前八叉树迭代器对应节点所在的深度值。  
OctreeNode *  getCurrentOctreeNode () const 
//  获取当前八叉树节点。 
bool  isBranchNode () const 
//  判断当前节点是否为分支节点,是返回true,否则返回false。  
bool  isLeafNode () const 
//  判断当前节点是否为叶子节点,是返回true,否则返回false。  
OctreeNode *  operator* () const 
//  *运算符。    
char  getNodeConfiguration () const 
//  获取当前节点的设置对应的比特位值。  
const LeafContainer &  getLeafContainer () const 
//  用于从八叉树叶节点检索单个叶容器的方法。
LeafContainer &  getLeafContainer () 
//   用于从八叉树叶节点检索单个叶容器的方法。
const BranchContainer &  getBranchContainer () const 
//  用于从八叉树分支节点检索容器的方法。更
BranchContainer &  getBranchContainer () 
// 用于从八叉树分支节点检索容器的方法。
virtual unsigned long  getNodeID () const 
//  获取当前节点对应的整数ID 

6.Class pcl::octree::OctreeDepthFirstIterator< OctreeT >

7.Class pcl::octree::OctreeBreadthFirstIterator< OctreeT >

8.Class pcl::octree::OctreeLeafNodeIterator< OctreeT >

以上3个类都继承于OctreeIteratorBase,分别实现深度优先遍历、广度优先遍历、叶子节点迭代器,关键函数参考其基类。

9.Class pcl::octree::OctreePointCloud< PointT, LeafContainerT, BranchContainerT, OctreeT >

类OctreePointCloud为针对点云实现的八叉树数据结构与相关算法,基于该类继承出多个子类,实现不同的点云处理或操作。

#include <pcl/octree/octree_pointcloud.h>
OctreePointCloud (const double resolution_arg) 
//  八叉树点云构造函数。
virtual  ~OctreePointCloud () 
//  空析构函数
void  setInputCloud (const PointCloudConstPtr &cloud_arg, const IndicesConstPtr &indices_arg=IndicesConstPtr()) 
//  设置八叉树管理的点云,其中 cloud_arg 为指向点云对象的指针, indices_arg为真正需要输入的点云的索引序列。  
IndicesConstPtr const  getIndices () const 
//  获取指向所用索引向量的指针。  
PointCloudConstPtr  getInputCloud () const 
//  获取指向输入点云数据集的指针。  
void  setEpsilon (double eps) 
//  设置近邻搜索时的误差限。  
double  getEpsilon () const 
//  获取设置近邻搜索时的误差限。  
void  setResolution (double resolution_arg) 
//  设置为点云建立的八叉树结构的分辨率,即体素的大小。 
double  getResolution () const 
//  获得为点云建立的八叉树结构的分辨率,即体素的大小。   
unsigned int  getTreeDepth () const 
//  获得八叉树的最大深度。 
void  addPointsFromInputCloud () 
//  显示调用将点云添加到八叉树管理结构中。  
void  addPointFromCloud (const int point_idx_arg, IndicesPtr indices_arg) 
//  添加对应索引中的点到八叉树中,其中 point_idx_arg为索引, indices_arg 索引序列的指针。  
void  addPointToCloud (const PointT &point_arg, PointCloudPtr cloud_arg) 
//  添加点point_arg 到点云 cloud_arg 中,同时添加到八叉树中。  
void  addPointToCloud (const PointT &point_arg, PointCloudPtr cloud_arg, IndicesPtr indices_arg) 
//  添加点point_arg 到点云 cloud_arg 的indices_arg 索引下,同时添加到八叉树中。  
bool  isVoxelOccupiedAtPoint (const PointT &point_arg) const 
//  判断点 point_arg所处的空间是否存在八叉树体素中。  
void  deleteTree () 
//  删除八叉树结构及其叶节点。
bool  isVoxelOccupiedAtPoint (const double point_x_arg, const double point_y_arg, const double point_z_arg) const 
//  判断点( pointX_arg,pointY _arg,pointZ_arg)所处的空间是否存在八叉树体素中。  
bool  isVoxelOccupiedAtPoint (const int &point_idx_arg) const 
//  判断索引为point_idx_arg的点所处的空间是否存在八叉树体素中。  
int  getOccupiedVoxelCenters (AlignedPointTVector &voxel_center_list_arg) const 
//  获取所有被点云占据的体素的中心并存储在voxelCenterList_arg 中,返回值为被占据的体素的个数。  
int  getApproxIntersectedVoxelCentersBySegment (const Eigen::Vector3f &origin, const Eigen::Vector3f &end, AlignedPointTVector &voxel_center_list, float precision=0.2) 
//  用参数origin和 end给定空间一线段,该函数求得与该线段相交的体素中心,存储在voxel_center_list,并返回相交体素的个数。  
void  deleteVoxelAtPoint (const PointT &point_arg) 
//  删除指定点所在的八叉树所管理的体素或叶子节点。  
void  deleteVoxelAtPoint (const int &point_idx_arg) 
//  删除索引为point_idx_arg的点所在的八叉树所管理的体素或叶子节点。  
void  defineBoundingBox () 
//  调查点云数据集的维度,并为八叉树定义相应的包围盒。  
void  defineBoundingBox (const double min_x_arg, const double min_y_arg, const double min_z_arg, const double max_x_arg, const double max_y_arg, const double max_z_arg) 
//  指定八叉树的包围盒,参数为三个维度的上下限,八叉树中一旦存储管理元素了,则包围盒大小就不能再改变。
void  defineBoundingBox (const double max_x_arg, const double max_y_arg, const double max_z_arg) 
//  指定八叉树的包围盒,参数为三个维度的上限,八叉树中一旦存储管理元素了,则包围盒大小就不能再改变,下边界坐标为(0.0.0)。  
void  defineBoundingBox (const double cubeLen_arg) 
//  指定八叉树的正方体包围盒,参数为包围盒的棱长,八叉树中一旦存储管理元素了,则包围盒大小就不能再改变,下边界坐标为(0.0.0)。  
void  getBoundingBox (double &min_x_arg, double &min_y_arg, double &min_z_arg, double &max_x_arg, double &max_y_arg, double &max_z_arg) const 
//  获取包围盒3个维度的上下限。  
double  getVoxelSquaredDiameter (unsigned int tree_depth_arg) const 
//  获取八叉树中指定深度对应体素的内切圆的直径。  
double  getVoxelSquaredDiameter () const 
//  获取八叉树中指定深度对应体素的内切圆的直径。  
double  getVoxelSquaredSideLen (unsigned int tree_depth_arg) const 
//  获取八叉树中指定深度对应体素的立方体的棱长。  
  
double  getVoxelSquaredSideLen () const 
//  获取八叉树中指定深度对应体素的立方体的棱长。    
void  getVoxelBounds (const OctreeIteratorBase< OctreeT > &iterator, Eigen::Vector3f &min_pt, Eigen::Vector3f &max_pt) const 
//生成八叉树迭代器的当前体素的边界。  
void  enableDynamicDepth (size_t maxObjsPerLeaf) 
//  启用动态八叉树结构。

10.Class pcl::octree::OctreePointCloudChangeDetector< PointT, LeafContainerT, BranchContainerT >

类OctreePointCloudChangeDetector实现了创建一八叉树,该八叉树由新增加的叶子节点组成,该八叉树分辨率需要初始化,包围盒可自适应调整。

#include <pcl/octree/octree_pointcloud_changedetector.h>
OctreePointCloudChangeDetector (const double resolution_arg) 
//  构造函数  
virtual  ~OctreePointCloudChangeDetector () 
//  空类构造函数
std::size_t  getPointIndicesFromNewVoxels (std::vector< int > &indicesVector_arg, const int minPointsPerLeaf_arg=0) 
// 获取缓存区中新添加的叶子节点, indicesVector_arg 为新添加的叶子的索引向量, int minPointsPerLeaf_arg 设置需要串行化的叶子中应该包含点的最小数目。
void  setEpsilon (double eps) 
//  设置近邻搜索时的误差限。  
void  setResolution (double resolution_arg) 
//  设置为点云建立的八叉树结构的分辨率,即体素的大小。 
void  setInputCloud (const PointCloudConstPtr &cloud_arg, const IndicesConstPtr &indices_arg=IndicesConstPtr()) 
//  设置八叉树管理的点云,其中 cloud_arg 为指向点云对象的指针, indices_arg为真正需要输入的点云的索引向量。  

11.Class pcl::octree::OctreePointCloudDensity< PointT, LeafContainerT, BranchContainerT >

类OctreePointCloudDensity实现了管理一八叉树,其叶子节点并非存储点云,只是对处于其叶子体素中的点云个数进行存储,即整个八叉树的叶子节点存储了输入点云的密度空间分布。

#include <pcl/octree/octree_pointcloud_density.h>
OctreePointCloudDensity (const double resolution_arg) 
//  OctreePointCloudDensity 类构造函数  
virtual  ~OctreePointCloudDensity () 
//  空类析构函数  
unsigned int  getVoxelDensityAtPoint (const PointT &point_arg) const 
//  返回point_arg 点所在的叶子节点体素的密度,即该点所处的体素中包含点的个数。

12.Class pcl::octree::OctreePointCloudOccupancy< PointT, LeafContainerT, BranchContainerT >

类OctreePointCloudOccupancy实现了管理一八叉树,其叶子节点不存储任何数据,只是对输入点云所占据的空间通过叶子所处的体素来进行标志,这样就可以对点云所占据空间的情况进行评估和检测。

#include <pcl/octree/octree_pointcloud_occupancy.h>
OctreePointCloudOccupancy (const double resolution_arg) 
//  构造函数  
virtual  ~OctreePointCloudOccupancy () 
//  空类析构函数   
void  setOccupiedVoxelAtPoint (const PointT &point_arg) 
//  在点point_arg所在空间为八叉树添加叶子节点,标识其有点云占据该节点所在体素空间。  
void  setOccupiedVoxelsAtPointsFromCloud (PointCloudPtr cloud_arg) 
//  在点集cloud_arg所在空间为八叉树添加叶子节点,标识其有点云占据该节点所在体素空间。

13.Class pcl::octree::OctreePointCloudPointVector< PointT, LeafContainerT, BranchContainerT, OctreeT >

类OctreePointCloudPointVecto管理一八叉树,该八叉树叶子节点,存储在该节点体素中的点对应的索引向量。

#include <pcl/octree/octree_pointcloud_pointvector.h>
void  setEpsilon (double eps) 
//  设置近邻搜索时的误差限。  
void  setResolution (double resolution_arg) 
//  设置为点云建立的八叉树结构的分辨率,即体素的大小。 
void  setInputCloud (const PointCloudConstPtr &cloud_arg, const IndicesConstPtr &indices_arg=IndicesConstPtr()) 
//  设置八叉树管理的点云,其中 cloud_arg 为指向点云对象的指针, indices_arg为真正需要输入的点集的索引索引向量。  

14.Class pcl::octree::OctreePointCloudSinglePoint< PointT, LeafContainerT, BranchContainerT, OctreeT >

类OctreePointCloudSinglePoint管理一八叉树,该八叉树叶子节点,存储在该节点体素中的单个点的索引。

15.Class pcl::octree::OctreePointCloudVoxelCentroid< PointT, LeafContainerT, BranchContainerT >

类OctreePointCloudVoxelCentroid管理一八叉树,可提供被点云占据节点对应体素的中心点坐标。

#include <pcl/octree/octree_pointcloud_voxelcentroid.h>
OctreePointCloudVoxelCentroid (const double resolution_arg) 
//  OctreePointCloudVoxelCentroids 类构造函数  
virtual  ~OctreePointCloudVoxelCentroid () 
//  空类析构函数  
virtual void  addPointIdx (const int pointIdx_arg) 
//  将数据对象添加到八叉树关键字的叶节点。  
bool  getVoxelCentroidAtPoint (const PointT &point_arg, PointT &voxel_centroid_arg) const 
//  返回点 point_arg对应的节点体素的中心点,存储在voxelCentroid_arg中,返回值为true表示操作成功,否则表示操作失败。
bool  getVoxelCentroidAtPoint (const int &point_idx_arg, PointT &voxel_centroid_arg) const 
//  返回索引 pointIdx_arg对应点所代表的节点体素中心点,存储在voxelCentroid_arg 中,返回值为true表示成功,否则表示操作失败。  
size_t  getVoxelCentroids (typename OctreePointCloud< PointT, LeafContainerT, BranchContainerT >::AlignedPointTVector &voxel_centroid_list_arg) const 
//  返回所有被点云占据的叶子节点的中心点组成的向量,存储在voxelCentroi-dList_arg中,返回值为返回中心的个数。  
void  getVoxelCentroidsRecursive (const BranchNode *branch_arg, OctreeKey &key_arg, typename OctreePointCloud< PointT, LeafContainerT, BranchContainerT >::AlignedPointTVector &voxel_centroid_list_arg) const 
//  递归地探索八叉树,并为所有占用的体素输出质心的PointT 矢量。

16.Class pcl::octree::OctreePointCloudSearch< PointT, LeafContainerT, BranchContainerT >

类OctreePointCloudSearch实现了基于八叉树的点云近邻高级搜索。

#include <pcl/octree/octree_search.h>
OctreePointCloudSearch (const double resolution) 
//  构造函数  
virtual  ~OctreePointCloudSearch () 
//  空类析构函数  
bool  voxelSearch (const PointT &point, std::vector< int > &point_idx_data) 
//  给定查询点point,通过point确定其所在的体素,返回体素中所有点的索引存储在pointIdx_data。
bool  voxelSearch (const int index, std::vector< int > &point_idx_data) 
//  功能同上函数,区别是查询点通过index指定。
int  nearestKSearch (const PointCloud &cloud, int index, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) 
//  近邻搜索,cloud为搜索的点云对象, index为查询点的索引,k为搜索返回的近邻个数,k_indices为返回近邻索引向量,k_sqr_distances存储近邻点对应的距离平方向量。
int  nearestKSearch (const PointT &p_q, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) 
//  功能同上,p_q为指定的查询点,其他参数类似。
int  nearestKSearch (int index, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) 
//  功能同上,index为指定的查询点索引,其他参数类似。  
void  approxNearestSearch (const PointCloud &cloud, int query_index, int &result_index, float &sqr_distance) 
//  近似近邻搜索,其他参数同上。  
void  approxNearestSearch (const PointT &p_q, int &result_index, float &sqr_distance) 
//  近似近邻搜索,其他参数同上。  
void  approxNearestSearch (int query_index, int &result_index, float &sqr_distance) 
//  近似近邻搜索,其他参数同上。
int  radiusSearch (const PointCloud &cloud, int index, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) 
//  获取查询点radius半径内的近邻点集,cloud为搜索的点云对象,index为查询点的索引,k为搜索返回的近邻个数,k_ indices 为返回近邻索引向量,k_ sqr_ distances存储近邻点对应的距离平方向量,max_nn默认为0,如果设置就返回半径内邻域个数上限,返回值为返回邻域点的个数。
int  radiusSearch (const PointT &p_q, const double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const 
//  获取查询点radius半径内的近邻点集,p_q为指定的查询点,k为搜索返回的近邻个数,k_ indices 为返回近邻索引向量,k_ sqr_ distances存储近邻点对应的距离平方向量,max_nn默认为0,如果设置就返回半径内邻域个数上限,返回值为返回邻域点的个数。  
int  radiusSearch (int index, const double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const 
//  获取查询点radius半径内的近邻点集,index为指定的查询点索引,k为搜索返回的近邻个数,k_ indices 为返回近邻索引向量,k_ sqr_ distances存储近邻点对应的距离平方向量,max_nn默认为0,如果设置就返回半径内邻域个数上限,返回值为返回邻域点的个数。   
int  getIntersectedVoxelCenters (Eigen::Vector3f origin, Eigen::Vector3f direction, AlignedPointTVector &voxel_center_list, int max_voxel_count=0) const 
// 给定经过点origin指向direction 的直线,返回与该直线相交的点云对应八叉树的体素中心点组成的向量,并存储在voxelCenterList中,返回值为相交体素个数。
int  getIntersectedVoxelIndices (Eigen::Vector3f origin, Eigen::Vector3f direction, std::vector< int > &k_indices, int max_voxel_count=0) const 
 //给定经过点origin指向direction 的直线,返回与该直线相交的点云对应八叉树的体素中心点组成的向量,k_ indices 存储点的索引,返回值为相交体素个数。  
int  boxSearch (const Eigen::Vector3f &min_pt, const Eigen::Vector3f &max_pt, std::vector< int > &k_indices) const 
//  搜索处于指定立方体内的点集,min_ pt、max_ pt 指定立方体的左前下角坐标及右后上角坐标来定义立方体,k_indices存储落在立方体内的点的索引。
void  setEpsilon (double eps) 
//  设置近邻搜索时的误差限。  
void  setResolution (double resolution_arg) 
//  设置为点云建立的八叉树结构的分辨率,即体素的大小。 
void  addPointsFromInputCloud () 
//  显示调用将点云添加到八叉树管理结构中。  
void  addPointFromCloud (const int point_idx_arg, IndicesPtr indices_arg) 
//  添加对应索引中的点到八叉树中,其中 point_idx_arg为索引, indices_arg 索引序列的指针。  
void  addPointToCloud (const PointT &point_arg, PointCloudPtr cloud_arg) 
//  添加点point_arg 到点云 cloud_arg 中,同时添加到八叉树中。  
void  addPointToCloud (const PointT &point_arg, PointCloudPtr cloud_arg, IndicesPtr indices_arg) 
//  添加点point_arg 到点云 cloud_arg 的indices_arg 索引下,同时添加到八叉树中。  
bool  isVoxelOccupiedAtPoint (const PointT &point_arg) const 
//  判断点 point_arg所处的空间是否存在八叉树体素中。  
bool  isVoxelOccupiedAtPoint (const double point_x_arg, const double point_y_arg, const double point_z_arg) const 
//  判断点( pointX_arg,pointY _arg,pointZ_arg)所处的空间是否存在八叉树体素中。  
bool  isVoxelOccupiedAtPoint (const int &point_idx_arg) const 
//  判断索引为point_idx_arg的点所处的空间是否存在八叉树体素中。  
int  getOccupiedVoxelCenters (AlignedPointTVector &voxel_center_list_arg) const 
//  获取所有被点云占据的体素的中心并存储在voxelCenterList_arg 中,返回值为被占据的体素的个数。  
int  getApproxIntersectedVoxelCentersBySegment (const Eigen::Vector3f &origin, const Eigen::Vector3f &end, AlignedPointTVector &voxel_center_list, float precision=0.2) 
//  用参数origin和 end给定空间一线段,该函数求得与该线段相交的体素中心,存储在voxel_center_list,并返回相交体素的个数。  
void  deleteVoxelAtPoint (const PointT &point_arg) 
//  删除指定点所在的八叉树所管理的体素或叶子节点。  
void  deleteVoxelAtPoint (const int &point_idx_arg) 
//  删除索引为point_idx_arg的点所在的八叉树所管理的体素或叶子节点。    
void  defineBoundingBox (const double min_x_arg, const double min_y_arg, const double min_z_arg, const double max_x_arg, const double max_y_arg, const double max_z_arg) 
//  指定八叉树的包围盒,参数为三个维度的上下限,八叉树中一旦存储管理元素了,则包围盒大小就不能再改变。
void  defineBoundingBox (const double max_x_arg, const double max_y_arg, const double max_z_arg) 
//  指定八叉树的包围盒,参数为三个维度的上限,八叉树中一旦存储管理元素了,则包围盒大小就不能再改变,下边界坐标为(0.0.0)。  
void  defineBoundingBox (const double cubeLen_arg) 
//  指定八叉树的正方体包围盒,参数为包围盒的棱长,八叉树中一旦存储管理元素了,则包围盒大小就不能再改变,下边界坐标为(0.0.0)。  
void  getBoundingBox (double &min_x_arg, double &min_y_arg, double &min_z_arg, double &max_x_arg, double &max_y_arg, double &max_z_arg) const 
//  获取包围盒3个维度的上下限。  
double  getVoxelSquaredDiameter (unsigned int tree_depth_arg) const 
//  获取八叉树中指定深度对应体素的内切圆的直径。   
double  getVoxelSquaredSideLen (unsigned int tree_depth_arg) const 
//  获取八叉树中指定深度对应体素的立方体的棱长。      


  • 1
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值