每个点计算法向量
给定输入点云,为每个点云中的点估计法向量,估计法向量需要指定每个点搜索周边几个点范围作为计算法向量的单位。
此时计算得到的法向量个数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::

这篇博客介绍了如何在PCL1.8.1库中为点云中的每个点或选定点计算法向量。通过设置搜索半径和使用KdTree搜索方法,可以估计点云的法向量。示例代码展示了如何计算全部点的法向量以及如何仅对点云的一部分进行计算。
最低0.47元/天 解锁文章

1151

被折叠的 条评论
为什么被折叠?



