写在前面
在计算特征向量descriptors的时候,需要只对关键点keypoints计算关键点在其原始点云处的邻域特征,那么就会用到setSearchSurface这个函数。
四种计算特征的方法
1. !indices & !isurface
无索引,搜索原点云上的每一个点的邻域。
2. indices & !isurface
有索引,搜索原点云上的每一个点的邻域。
3. !indices & isurface
无索引,搜索指定的点云上的每一个点的邻域。
4. indices & isurface
有索引,搜索指定的点云上的每一个点的邻域。
三个接口辨析
1. setInputCloud(PointCloudConstPtr &)
设置搜索的点云
2. setIndices(IndicesConstPtr &)
设置cloud的索引,类似于下采样
3. setSearchSurface(PointCloudConstPtr &)
具体计算某一个点处的特征时,设置需要考虑的哪个点云上对应于该点的邻域特征。
例子
下面例子中具体考虑哪个点云集合的邻域,是取决于tree的,看程序注释可以发现是优先考虑 search surface。
1. 直接计算全部的点云的法向量,每一个点邻域考虑本身的邻域。
#include <pcl/point_types.h>
#include <pcl/features/normal_3d.h>
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
... read, pass in or create a point cloud ...
// Create the normal estimation class, and pass the input dataset to it
pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne;
ne.setInputCloud (cloud);
// Create an empty kdtree representation, and pass it to the normal estimation object.
// Its content will be filled inside the object, based on the given input dataset (as no other search surface is given).
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ> ());
ne.setSearchMeth