#include<iostream>#include<pcl/io/pcd_io.h>//PCD I/O operations#include<pcl/point_types.h>//several point type structuresintmain(){
pcl::PointCloud<pcl::PointXYZ> cloud;// Fill in the cloud data
cloud.width =5;
cloud.height =1;
cloud.is_dense =false;
cloud.resize(cloud.width * cloud.height);//fill in the PointCloud structure with random point valuesfor(auto& point : cloud){
point.x =1024*rand()/(RAND_MAX +1.0f);
point.y =1024*rand()/(RAND_MAX +1.0f);
point.z =1024*rand()/(RAND_MAX +1.0f);}//保存PCD文件操作
pcl::io::savePCDFileASCII("test_pcd.pcd", cloud);
std::cerr <<"Saved "<< cloud.size()<<" data points to test_pcd.pcd."<< std::endl;for(constauto& point : cloud)
std::cerr <<" "<< point.x <<" "<< point.y <<" "<< point.z << std::endl;system("Pause");return(0);}