1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| #include <iostream> //标准输入输出流 #include <pcl/io/pcd_io.h> //PCL的PCD格式文件的输入输出头文件 #include <pcl/point_types.h> //PCL对各种格式的点的支持头文件
int main (int argc, char** argv) { pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
if (pcl::io::loadPCDFile<pcl::PointXYZ> ("test_pcd.pcd", *cloud) == -1) { PCL_ERROR ("Couldn't read file test_pcd.pcd \n"); return (-1); } std::cout << "Loaded " << cloud->width * cloud->height << " data points from test_file.pcd with the following fields: " << std::endl; for (size_t i = 0; i < 5; ++i) std::cout << " " << cloud->points[i].x << " " << cloud->points[i].y << " " << cloud->points[i].z << std::endl;
return (0); }
|