日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

pcl里面的RoPs特征(Rotational Projection Statistics)

發布時間:2025/3/15 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 pcl里面的RoPs特征(Rotational Projection Statistics) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

這次我們將使用pcl::ROPSEstimation這個類來導出點的特征。

下面是這個方法的特征提取方式。有一個網格和一個點集可以讓我們來執行一些簡單的操作。第一步,對于一個給定的興趣點局部的表面將會被削平。局部表面包含了在半徑內的點和三角形。對于給定的局部表面LRF將被計算。LRF是向量的3個組之一。真正重要的是使用那些具有旋轉不變的向量。為了做到這一點,我們把感興趣的點作為原點來做轉換,再這之后我們旋轉局部表面,以至于LRF向量關于Ox,Oy,Oz坐標軸對稱。完成這些后,我們開始了特征導出。對于每個Ox,Oy,Oz坐標軸,我們會把這些這些坐標軸作為當前的坐標軸。

1.局部表面通過一個給定的角度在當前的坐標軸進行旋轉。

2.把局部表面投影成3個平面XY,XZ和YZ.

3.對于每個投影分布矩陣,這個矩陣將展示怎么樣把把點分到不同的容器里面。容器的數量代表了矩陣的維度和算法的參數。

4.每個分布矩陣的中心矩將會被計算。M11,M12,M21,M22,E。E是信息熵。

5.計算值將會組成子特征。

?

我們把上面這些步驟進行多次迭代。不同坐標軸的子特征將組成RoPS描述器。

下面是代碼

我們首先要找到目標模型

points 包含點云

indices 點的下標

triangles包含了多邊形

#include <pcl/features/rops_estimation.h> #include <pcl/io/pcd_io.h>int main (int argc, char** argv) {if (argc != 4)return (-1);pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ> ());if (pcl::io::loadPCDFile (argv[1], *cloud) == -1)return (-1);pcl::PointIndicesPtr indices = boost::shared_ptr <pcl::PointIndices> (new pcl::PointIndices ());std::ifstream indices_file;indices_file.open (argv[2], std::ifstream::in);for (std::string line; std::getline (indices_file, line);){std::istringstream in (line);unsigned int index = 0;in >> index;indices->indices.push_back (index - 1);}indices_file.close ();std::vector <pcl::Vertices> triangles;std::ifstream triangles_file;triangles_file.open (argv[3], std::ifstream::in);for (std::string line; std::getline (triangles_file, line);){pcl::Vertices triangle;std::istringstream in (line);unsigned int vertex = 0;in >> vertex;triangle.vertices.push_back (vertex - 1);in >> vertex;triangle.vertices.push_back (vertex - 1);in >> vertex;triangle.vertices.push_back (vertex - 1);triangles.push_back (triangle);}float support_radius = 0.0285f;unsigned int number_of_partition_bins = 5;unsigned int number_of_rotations = 3;pcl::search::KdTree<pcl::PointXYZ>::Ptr search_method (new pcl::search::KdTree<pcl::PointXYZ>);search_method->setInputCloud (cloud);pcl::ROPSEstimation <pcl::PointXYZ, pcl::Histogram <135> > feature_estimator;feature_estimator.setSearchMethod (search_method);feature_estimator.setSearchSurface (cloud);feature_estimator.setInputCloud (cloud);feature_estimator.setIndices (indices);feature_estimator.setTriangles (triangles);feature_estimator.setRadiusSearch (support_radius);feature_estimator.setNumberOfPartitionBins (number_of_partition_bins);feature_estimator.setNumberOfRotations (number_of_rotations);feature_estimator.setSupportRadius (support_radius);pcl::PointCloud<pcl::Histogram <135> >::Ptr histograms (new pcl::PointCloud <pcl::Histogram <135> > ());feature_estimator.compute (*histograms);return (0); }

?

上面是指定下標點的RoPS特征計算的地方

std::vector <pcl::Vertices> triangles;std::ifstream triangles_file;triangles_file.open (argv[3], std::ifstream::in);for (std::string line; std::getline (triangles_file, line);){pcl::Vertices triangle;std::istringstream in (line);unsigned int vertex = 0;in >> vertex;triangle.vertices.push_back (vertex - 1);in >> vertex;triangle.vertices.push_back (vertex - 1);in >> vertex;triangle.vertices.push_back (vertex - 1);triangles.push_back (triangle);}

上面是加載關于多邊形的信息的。你可以取代信息用下面的代碼來進行三角劃分,如果你只有點云沒有網格圖。

float support_radius = 0.0285f;unsigned int number_of_partition_bins = 5;unsigned int number_of_rotations = 3;

上面的這些代碼定義了重要的算法參數,局部表面裁剪支持的半徑,以及用于組成分布矩陣的容器的數量和旋轉的次數。最后的參數將影響描述器的長度。

pcl::search::KdTree<pcl::PointXYZ>::Ptr search_method (new pcl::search::KdTree<pcl::PointXYZ>);search_method->setInputCloud (cloud);


上面設置了搜索方法。

pcl::ROPSEstimation <pcl::PointXYZ, pcl::Histogram <135> > feature_estimator;feature_estimator.setSearchMethod (search_method);feature_estimator.setSearchSurface (cloud);feature_estimator.setInputCloud (cloud);feature_estimator.setIndices (indices);feature_estimator.setTriangles (triangles);feature_estimator.setRadiusSearch (support_radius);feature_estimator.setNumberOfPartitionBins (number_of_partition_bins);feature_estimator.setNumberOfRotations (number_of_rotations);feature_estimator.setSupportRadius (support_radius);

上面是實例化類的地方。它包含了兩個參數

PointInT:輸入點的類型

PointOutT:輸出點的類型

最終我們需要進行特征計算

pcl::PointCloud<pcl::Histogram <135> >::Ptr histograms (new pcl::PointCloud <pcl::Histogram <135> > ());feature_estimator.compute (*histograms);

然后運行

./rops_feature points.pcd indices.txt triangles.txt

?

總結

以上是生活随笔為你收集整理的pcl里面的RoPs特征(Rotational Projection Statistics)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。