【发布时间】:2017-03-27 05:02:48
【问题描述】:
我正在使用名为点云库 (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>::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 个条目,每个条目对应一个 bin。 (假设 3 个特征和 5 个分区 5^3 = 125)
这篇文章帮助了一些人:PCL Point Feature Histograms - binning
很遗憾,我还有几个问题:
1) 为什么每点有 125 个直方图?是不是因为它测量了K-最近邻域中的点与当前点具有相似特征的点的百分比是多少,然后每个点都有自己的邻域?
2) 在某些方面,我看到所有 125 个条目都是零。为什么?
3) 绘制点特征直方图值如论文和网站所示:
网站: http://pointclouds.org/documentation/tutorials/pfh_estimation.php#pfh-estimation
纸张: https://pdfs.semanticscholar.org/5aee/411f0b4228ba63c85df0e8ed64cab5844aed.pdf
所显示的图表的 X 轴是 bin 的数量(在我的例子中是 125 个 bin)所以自然的问题是我们如何将每个点的 125 个值合并到一个图表中? 我尝试对适当的列进行简单的求和,并将它们按常数缩放,但我认为这是不对的。求和是指为每个点添加所有 bin[0],然后为每个点求和所有 bin[1],依此类推,直到 bin[124]。
我非常感谢任何帮助澄清这一点。 谢谢。
【问题讨论】: