C++ PCL库输出解释中的点特征直方图
我正在使用名为点云库PCL的库。特别是我试图计算点特征直方图。我在网站上遵循了以下代码:C++ PCL库输出解释中的点特征直方图,c++,point-cloud-library,C++,Point Cloud Library,我正在使用名为点云库PCL的库。特别是我试图计算点特征直方图。我在网站上遵循了以下代码: #include <pcl/point_types.h> #include <pcl/features/pfh.h> { pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>); pcl::PointCloud<pcl::Normal>:
#include <pcl/point_types.h>
#include <pcl/features/pfh.h>
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
pcl::PointCloud<pcl::Normal>::Ptr normals (new pcl::PointCloud<pcl::Normal> ());
... read, pass in or create a point cloud with normals ...
... (note: you can create a single PointCloud<PointNormal> if you want) ...
// Create the PFH estimation class, and pass the input dataset+normals to it
pcl::PFHEstimation<pcl::PointXYZ, pcl::Normal, pcl::PFHSignature125> pfh;
pfh.setInputCloud (cloud);
pfh.setInputNormals (normals);
// alternatively, if cloud is of tpe PointNormal, do pfh.setInputNormals (cloud);
// Create an empty kdtree representation, and pass it to the PFH 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> ());
//pcl::KdTreeFLANN<pcl::PointXYZ>::Ptr tree (new pcl::KdTreeFLANN<pcl::PointXYZ> ()); -- older call for PCL 1.5-
pfh.setSearchMethod (tree);
// Output datasets
pcl::PointCloud<pcl::PFHSignature125>::Ptr pfhs (new pcl::PointCloud<pcl::PFHSignature125> ());
// Use all neighbors in a sphere of radius 5cm
// IMPORTANT: the radius used here has to be larger than the radius used to estimate the surface normals!!!
pfh.setRadiusSearch (0.05);
// Compute the features
pfh.compute (*pfhs);
// pfhs->points.size () should have the same size as the input cloud->points.size ()*
}
我得到的输出是原始点云中每个点125个值的数组。例如,如果我有一个包含1000个点的点云,其中每个点都包含XYZ,那么将有1000*125个值。我能够理解为什么我有125个条目,每个条目对应一个箱子。假设3个特征和5个分区5^3=125
这篇文章帮助了一些人:
不幸的是,我还有几个问题:
1为什么每个点有125个直方图?是因为它测量的是距离当前点最近的K邻域中具有相似特征的点的百分比,然后每个点都有自己的邻域吗
2我看到,对于某些点,所有125个条目都是零。为什么?
3图纸和网站上显示的图形点特征直方图值:
网站:
论文:
图中显示的X轴为箱数,在我的例子中为125箱,因此自然的问题是如何将每个点的125个值合并到一个图中?
我尝试对适当的列进行简单的求和,并将它们按常量缩放,但我认为这是不对的。通过求和,我的意思是为每个点添加所有bin[0],然后为每个点添加所有bin[1],依此类推,直到bin[124]
我真的非常感谢任何帮助来澄清这一点。
谢谢。PFH描述符是一个局部描述符,因此会为给定的每个点计算直方图。您可能只想使用一个关键点或一组关键点 如果直方图在半径搜索中没有最近邻,则其条目将为0 至于图形,请尝试一次查看一个点的直方图。我认为把它合并成一个图表是没有意义的 如果您对考虑所有点的全局描述符感兴趣,请查看CVFH描述符聚集视点特征直方图或其他全局描述符