PCL读取ply文件
PCL读取ply文件
以下是利用PCL库读取ply文件代码
int readcloud(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, string filename) {
// PointXYZ表示三维坐标信息
// 读取ply文件
if (pcl::io::loadPLYFile<pcl::PointXYZ>(filename, *cloud) == -1) {
//PCL_ERROR("Couldnot read file.\n");
cout << "Couldnot read file." << endl;
system("pause");
return -1;
}
cout << "已读取并显示"<<filename<<"原始点云数据" << endl;
cout << filename<<"原始点云数据点数:" << cloud->points.size() << endl;
return 0;
}