sampling_surface_normal关键点介绍
/** \brief @b SamplingSurfaceNormal divides the input space into grids until each grid contains a maximum of N points,
* and samples points randomly within each grid. Normal is computed using the N points of each grid. All points
* sampled within a grid are assigned the same normal.
*
* \author Aravindhan K Krishnan. This code is ported from libpointmatcher (https://github.com/ethz-asl/libpointmatcher)
* \ingroup filters
*/
SamplingSurfaceNormal将输入空间划分为多个网格,直到每个网格最多包含N个点,并在每个网格中随机采样点。 使用每个网格的N个点计算法线。 在网格内采样的所有点都分配有相同的法线。
作者:Aravindhan K Krishnan。
此代码从libpointmatcher(https://github.com/ethz-asl/libpointmatcher)分组过滤器中移植
主要函数
/** \brief Set maximum number of samples in each grid 设置每个网格中的最大样本数
* \param[in] sample maximum number of samples in each grid
*/
inline void
setSample (unsigned int sample)
{
sample_ = sample;
}
/** \brief Set seed of random function.设置随机函数的种子。
* \param[in] seed the input seed
*/
inline void
setSeed (unsigned int seed)
{
seed_ = seed;
srand (seed_);
}
/** \brief Set ratio of points to be sampled in each grid设置每个网格中要采样的点的比例
* \param[in] ratio sample the ratio of points to be sampled in each grid
*/
inline void
setRatio (float ratio)
{
ratio_ = ratio;
}
完整代码
# include "../include/sd_descriptors_bit.h"
typedef pcl::PointXYZ PointType;
typedef pcl::PointNormal PointNormalType;
typedef pcl::Normal NormalType;
class keypoints {
public:
pcl::PointCloud<PointType> cloud1, cloud2;
pcl::PointCloud<NormalType> cloud1_normals, cloud2_normals;
pcl::PointCloud<PointNormalType> cloud1_point_normals, cloud2_point_normals;
pcl::PointCloud<PointType> cloud1_keypoi