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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

Pcl:Normal的定义结构及输出

發布時間:2023/11/27 生活经验 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Pcl:Normal的定义结构及输出 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1. pcl::Normal在pcl官網中的定義
?/*brief A point structure representing normal coordinates and the surface curvature estimate. (SSE friendly)ingroup common*/

struct Normal : public _Normal
{
? ? inline Normal (const _Normal &p)
? ? {
? ? ?normal_x = p.normal_x;?
? ? ?normal_y = p.normal_y;?
? ? ?normal_z = p.normal_z;
? ? ?data_n[3] = 0.0f;
? ? ?curvature = p.curvature;
? ? }

? ? inline Normal ()
? ? {
? ? ?normal_x = normal_y = normal_z = data_n[3] = 0.0f;
? ? ?curvature = 0;
? ? }

? ? inline Normal (float n_x, float n_y, float n_z)
? ? {
? ? ?normal_x = n_x; normal_y = n_y; normal_z = n_z;
? ? ?curvature = 0;
? ? ?data_n[3] = 0.0f;
? ? }

? ? friend std::ostream& operator << (std::ostream& os, const Normal& p);
? ? EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};

2. 官網 tutorial中的資料
union{
float data_n[4]
float normal[3];
struct
{
float normal_x;
float normal_y;
float normal_z;
};
};
union{
struct{
float curvature;
};
float data_c[4];
};

看出,pcl::Normals normal的四個值表示(normal_x, normal_y, normal_z, curvature);

3. 表示pcl::Normal的幾種方式:
?

pcl::PointCloud<pcl::Normal>::Ptr normals (new pcl::PointCloud<pcl::Normal>); 
std::cout<<normals->points[100]<<std::endl;
std::cout<<"["<<normals->points[100].normal_x<<" "<<normals->points[100].normal_y<<" "<<normals->points[100].normal_z<<" "<<normals->points[100].curvature<<"]"<<endl;
std::cout<<"["<<normals->points[100].normal[0]<<" "<<normals->points[100].normal[1]<<" "<<normals->points[100].normal[2]<<" "<<normals->points[100].curvature<<"]"<<endl;
//此種顯示方式不帶曲率,只有XYZ
std::cout<<"["<<normals->points[100].data_n[0]<<" "<<normals->points[100].data_n[1]<<" "<<normals->points[100].data_n[2]<<" "<<normals->points[100].curvature<<"]"<<endl;

帶曲率的輸出方式:

//計算法線
pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> n;
pcl::PointCloud<pcl::Normal>::Ptr normals(new pcl::PointCloud<pcl::Normal>);
//建立kdtree來進行近鄰點集搜索
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree(nepcl::search::KdTree<pcl::PointXYZ>);
n.setInputCloud(cloud);
n.setSearchMethod(tree);
//點云法向計算時,需要所搜的近鄰點大小
n.setKSearch(3);
//開始進行法向計算
n.compute(*normals);
cout << "point normal size = " << normals->points.size() << endl;cout << "point normal" << normals->points[i] << endl;
cout << " k point normal " << normals->points[pointIdxNKNSearch[m]]<< endl;

結果如下:(這是法向量用坐標X,Y,Z表示的結果,最后一個應該是曲率???)

?

總結

以上是生活随笔為你收集整理的Pcl:Normal的定义结构及输出的全部內容,希望文章能夠幫你解決所遇到的問題。

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