每个点计算法向量
给定输入点云,为每个点云中的点估计法向量,估计法向量需要指定每个点搜索周边几个点范围作为计算法向量的单位。
此时计算得到的法向量个数cloud_normals->points.size () 与点云个数cloud->points.size ()相等。
#include
#include
{
pcl::PointCloud<:pointxyz>::Ptr cloud (new pcl::PointCloud<:pointxyz>);
... read, pass in or create a point cloud ...
// Create the normal estimation class, and pass the input dataset to it
pcl::NormalEstimation<: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<:pointxyz>::Ptr tree (new pcl::search::KdTree<:pointxyz> ());
ne.setSearchMethod (tree);
// Output datasets
pcl::