PLY點雲資料在PCL中讀取與顯示

2021-08-28 13:53:57 字數 1085 閱讀 8366

今天開始著手處理ply資料,由於之前沒有接觸過pcl,所以連最簡單的資料讀取與顯示都搞了半天,現在將**公布出來以供參考。

使用的環境是:vs2015+pcl1.8.1

#include "stdafx.h"

#include #include #include #include #include #include #include using namespace pcl;

using namespace pcl::io;

using namespace std;

int main()

pcl::visualization::cloudviewer viewer("cloud viewer");

viewer.showcloud(cloud);

system("pause");

return(0);

}

值得注意的幾點是:

1)cloud智慧型指標物件在定義的時候記得要初始化;一開始我沒有初始化,結果程式報錯:

assertion failed: px!=0  file ..\boost\smart_ptr\shared_ptr.hpp, line 704.

2)pointcloud的格式有很多種,如pointxyz, pointxyzrgb,...。這裡我這使用的是pointxyz,是因為使用的資料pointcloud.ply中只包含每個點的三維座標,這裡的格式需要根據自己的資料來確定。

pointcloud.ply資料格式如下:

plyformat ascii 1.0

element vertex 43200

property float x

property float y

property float z

end_header

-125 -95 232

-241 -109 456

-247 -169 462

3)資料顯示的時候,一開始的介面是上面一條綠色,下面左邊是黑色,右邊是紅色,我還以為資料出問題了,用滑鼠縮放才發現這代表的是座標軸。通過滑鼠左右鍵與滑輪可以調節資料的縮放、旋轉角度等。

PCL開啟大型ply點雲檔案

學習使用pcl點雲庫內置的點雲讀取方法的時候,查到的方法很多都是不能直接開啟大型點雲的,只適用於小型點雲的顯示。include stdafx.h include include include include include include include 這個只能讀取小檔案 intdisplayp...

點雲 PCL點雲濾波與實現

目錄 直通濾波器 passthrough 條件濾波 conditional removal 球半徑濾波器 radiusoutlinerremoval 4 統計濾波器 statisticaloutlierremoval 5 體素降取樣 voxelgrid 均勻取樣 uniform sampling i...

PCL點雲的基本讀取和顯示

廢話不多說,直接上 這是最基本的讀取與顯示,皆是利用pcl庫 include 標準輸入輸出流 include pcl的pcd格式檔案的輸入輸出標頭檔案 include pcl對各種格式的點的支援標頭檔案 include int main int argc,char argv std cout loa...