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>);