我正在使用稱爲點雲庫(PCL)的庫。特別是我試圖計算點特徵直方圖。我跟着這個代碼從網站:點特徵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個條目,每個條目對應一個分檔。 (假設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軸爲圍框的數目(在我的情況下是125箱)所以很自然的問題我們如何將每個點的125個值合併到一個圖中? 我嘗試了一個簡單的總結適當的列和按比例縮放他們,但我不認爲這是正確的。通過總結,我的意思是爲每個點添加所有bin [0],然後爲每個點添加所有bin [1],然後等到bin [124]。
我真的很感謝任何幫助澄清這一點。 謝謝。