來自點雲pcl庫到精通到入們
查詢
kdtree.nearestksearch (searchpoint, k, pointindex, pointsquaredistance)
//searchpoint 查詢點
//k 最臨近點的個數
//pointindex 查詢到的臨近值
//pointsquaredistance 儲存的臨近距離
//return 搜尋到的點的個數
kdtree.
radiussearch
(searchpoint,r,rpointindex,rpointsquaredistance,20)
)//建立kd樹物件
kdtreeflann kdtree;
//建立搜尋空間
kdtree.
setinputcloud
(cloud)
;//查詢點,瀆職隨機
pointxyz searchpoint;
searchpoint.x=
1024.0f
*rand()
/(rand_max+
1.0f);
searchpoint.y=
1024.0f
*rand()
/(rand_max+
1.0f);
searchpoint.z=
1024.0f
*rand()
/(rand_max+
1.0f);
//k臨近搜尋
int k=10;
vector<
int>
pointindex
(k);
//儲存查詢點的k臨近索引
vector<
float
>
pointsquaredistance
(k);
//儲存臨近點的平方距離
//輸出查詢點的資訊
cout<<
"x :"
<";y:"
<";z:"
/k臨近搜尋
cout<<
" k臨近搜尋"
"k"
>0)
}//r半徑搜尋
float r=
256.0f
* rand ()/
(rand_max +
1.0f);
vector<
int> rpointindex;
//儲存查詢點的r半徑索引
vector<
float
> rpointsquaredistance;
//儲存臨近點的平方距離
cout<<
" r半徑搜尋"
"r"
radiussearch
(searchpoint,r,rpointindex,rpointsquaredistance,20)
)}return0;
}
壓縮
#include
#include
#include
#include
#include
#include
#include
#include
using
namespace std;
using
namespace pcl;
intmain
(int argc,
const
char
** ar**)
octree
#include
#include
#include
#include
using
namespace std;
;using
namespace pcl;
intmain
(int argc,
const
char
** ar**)
float resolution=
128.0f
;//resolution octree最低的解析度
octree::octreepointcloudsearch
octree
(resolution)
;//設定點雲輸出
octree.
setinputcloud
(cloud)
;//構建八叉樹
octree.
addpointsfrominputcloud()
; pointxyz searchpoint;
//查詢點
searchpoint.x=
1024.0f
*rand()
/(rand_max+
1.0f);
searchpoint.y=
1024.0f
*rand()
/(rand_max+
1.0f);
searchpoint.z=
1024.0f
*rand()
/(rand_max+
1.0f);
vector<
int>pointidexvec;
//查詢序號值
//體素臨近搜尋
if(octree.
voxelsearch
(searchpoint,pointidexvec))}
//k搜尋
vector<
int> pointksearchidl;
vector<
float
> pointksquare;
int k=10;
if(octree.
nearestksearch
(searchpoint,k,pointksearchidl,pointksquare)
>0)
}//r搜尋
vector<
int> pointrsearchidl;
vector<
float
> pointrsquare;
int r=
256.0f
* rand ()/
(rand_max +
1.0f);
if(octree.
radiussearch
(searchpoint,r,pointrsearchidl,pointrsquare,20)
>0)
} return0;
}
雷射雷達點雲PCL庫學習(一)
分類專欄 雷射雷達pcl庫學習 pcl point cloud library 是在吸收了前人點雲相關研究基礎上建立起來的大型跨平台開源c 程式設計庫,它實現了大量點雲相關的通用演算法和高效資料結構,涉及到點雲獲取 濾波 分割 配準 檢索 特徵提取 識別 追蹤 曲面重建 視覺化等。支援多種作業系統平...
PCL庫學習筆記 連線兩個點雲
本篇將展示如何串聯兩個不同點雲的點。此處強加的約束是兩個資料集中的字段型別和數量必須相等。後面還將展示如何連線兩個不同點雲的字段 例如,維度 此處強加的約束是兩個資料集中的點數必須相等。include include include int main int argc,char argv 定義三個輸...
點雲庫PCL學習 pcd檔案及其開啟顯示
pcd檔案 檔案頭格式 1 version 指定pcd檔案版本。2 fields 指定乙個點可以有的每乙個維度和字段的名字。3 size 用位元組數指定每乙個維度的大小。unsigned char char 1byte unsigned short short 2bytes unsigned int...