快速特征点直方图描述器(FPFH)
PFH的理論上的時(shí)間復(fù)雜度是O(nk的平方),n是點(diǎn)的數(shù)量,k是最近鄰的個數(shù)。對于實(shí)時(shí)系統(tǒng)來說,這壓根就是不行的,所以作為PFH規(guī)劃的簡化版本,FPFH把計(jì)算復(fù)雜度減少成O(nk),但是還具有很好的和PFH差不多的區(qū)分能力。
第一步我們先計(jì)算了每個查詢點(diǎn)Pq的一系列值,并把它叫做SPFH(Simplified Point Feature Histgram)
第二步每個點(diǎn)的最近鄰是重新分配,SPFH值將用來權(quán)衡FPFH的值:
這里的Wk代表了兩點(diǎn)的距離。權(quán)重(weight)的組合是非常重要的,下面的圖顯示了這一點(diǎn):
可以看到越近的權(quán)重越大,線越粗。
因此,給定一個點(diǎn)Pq,這個算法第一步評估了SPFH的值,通過創(chuàng)造它和它的近鄰的匹配。這個過程將一直重復(fù),通過近鄰SPFH的值不停的改變權(quán)重,最終生成了Pq的FPFH。
PFH與FPFH之間的差異
1.FPFH沒有和它所有的近鄰有著聯(lián)系,因此可能會丟失一些值的匹配。
2.PFH模型可以更精確的描述表面,而FPFH則包括了額外的點(diǎn)的配對在半徑為r的圓的外面(最多不會超過2r)
3.因?yàn)闄?quán)重的組合,FPFH結(jié)合了SPFH的值并且重新獲取了一些點(diǎn)的近鄰。
4.FPFH復(fù)雜度大大降低,計(jì)算更快。
5.最終的直方圖是簡化了。
?
預(yù)估FPFH的特征值
FPFH的執(zhí)行使用了11個分發(fā)的子區(qū)間,和一個非相關(guān)的組合(33位的數(shù)組),把它存在pcl::FPFHSignature33這個點(diǎn)類型里面。
下面的代碼段,預(yù)估了一個所有點(diǎn)的FPFH的特征集合
#include <pcl/point_types.h> #include <pcl/features/fpfh.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 FPFH estimation class, and pass the input dataset+normals to itpcl::FPFHEstimation<pcl::PointXYZ, pcl::Normal, pcl::FPFHSignature33> fpfh;fpfh.setInputCloud (cloud);fpfh.setInputNormals (normals);// alternatively, if cloud is of tpe PointNormal, do fpfh.setInputNormals (cloud);// Create an empty kdtree representation, and pass it to the FPFH 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>);fpfh.setSearchMethod (tree);// Output datasetspcl::PointCloud<pcl::FPFHSignature33>::Ptr fpfhs (new pcl::PointCloud<pcl::FPFHSignature33> ());// 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!!!fpfh.setRadiusSearch (0.05);// Compute the featuresfpfh.compute (*fpfhs);// fpfhs->points.size () should have the same size as the input cloud->points.size ()* }調(diào)用FPFHEstimation時(shí)實(shí)際做了這么幾步
1.PFH的步驟
2.使用每個SPFH,通過一個權(quán)重組合來賦值給FPFH。
類似于PFH我們可以把這段代碼反正compute()函數(shù)前,進(jìn)行優(yōu)化
for (int i = 0; i < normals->points.size(); i++) {if (!pcl::isFinite<pcl::Normal>(normals->points[i])){PCL_WARN("normals[%d] is not finite\n", i);} }我們可以用OpenMP進(jìn)行優(yōu)化
使用OpenMP可以進(jìn)行多線程計(jì)算。類名叫做pcl::FPFHEstimationOMP,
?
總結(jié)
以上是生活随笔為你收集整理的快速特征点直方图描述器(FPFH)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Mac下配置sublime实现LaTeX
- 下一篇: 【OpenCV 例程200篇】66. 图