每个点计算法向量 Http://pointclouds.org/documentation/tutorials/how_features_work.PHP#how-3D-features-work 给定输入点云,为每个点云中的点估计
Http://pointclouds.org/documentation/tutorials/how_features_work.PHP#how-3D-features-work
给定输入点云,为每个点云中的点估计法向量,估计法向量需要指定每个点搜索周边几个点范围作为计算法向量的单位。
此时计算得到的法向量个数cloud_normals->points.size () 与点云个数cloud->points.size ()相等。
#include
#include
{
pcl::PointCloud::Ptr cloud (new pcl::PointCloud);
... read, pass in or create a point cloud ...
// Create the nORMal estimation class, and pass the input dataset to it
pcl::NormalEstimation 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::Ptr tree (new pcl::search::KdTree ());
ne.setSearchMethod (tree);
// Output datasets
pcl::PointCloud::Ptr cloud_normals (new pcl::PointCloud);
// Use all neighbors in a sphere of radius 3cm
ne.setRadiusSearch (0.03);
// Compute the features
ne.compute (*cloud_normals);
// cloud_normals->points.size () should have the same size as the input cloud->points.size ()
}
取其中10%的点进行法向量计算:std::vector
#include
#include
{
pcl::PointCloud::Ptr cloud (new pcl::PointCloud);
... read, pass in or create a point cloud ...
// Create a set of indices to be used. For simplicity, we"re Going to be using the first 10% of the points in cloud
std::vector indices (std::floor (cloud->points.size () / 10));
for (std::size_t i = 0; i < indices.size (); ++i) indices[i] = i;
// Create the normal estimation class, and pass the input dataset to it
pcl::NormalEstimation ne;
ne.setInputCloud (cloud);
// Pass the indices
boost::shared_ptr > indicesptr (new std::vector (indices));
ne.setIndices (indicesptr);
// 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::Ptr tree (new pcl::search::KdTree ());
ne.setSearchMethod (tree);
// Output datasets
pcl::PointCloud::Ptr cloud_normals (new pcl::PointCloud);
// Use all neighbors in a sphere of radius 3cm
ne.setRadiusSearch (0.03);
// Compute the features
ne.compute (*cloud_normals);
// cloud_normals->points.size () should have the same size as the input indicesptr->size ()
}
--结束END--
本文标题: PCL1.8.1 点的法向量
本文链接: https://lsjlt.com/news/2740.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0