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 > &