PCL問題整理

1、在聲明一個顯示點雲時必須這麼寫:

pcl::PointCloud<pcl::PointXYZ>::Ptr cloudPoints(new pcl::PointCloud<pcl::PointXYZ>);
而這樣寫時,程序會出現bug:

pcl::PointCloud<pcl::PointXYZ>::Ptr cloudPoints;

這是內存的問題;

但有時要在類裏定義pcl::PointCloud<pcl::PointXYZ>::Ptr cloudPoints;類定義中不能進行內存申請,所以只能寫在構造函數中,

正確書寫格式爲:

類定義:

pcl::PointCloud<pcl::PointXYZ>::Ptr cloudPoints;

構造函數:

cloudPoints = pcl::PointCloud<pcl::PointXYZ>::Ptr(new pcl::PointCloud<pcl::PointXYZ>);



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章