- 输入ply格式,输出带XYZI信息的pcd点云,如果需要XYZRGB信息的pcd点云,可以将pcl::PointCloud<pcl::PointXYZI> point_cloud;改为pcl::PointCloud<pcl::PointXYZRGB> point_cloud;
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/console/print.h>
#include <pcl/console/parse.h>
#include <pcl/console/time.h>
#include <pcl/io/vtk_lib_io.h>
#include <pcl/io/vtk_io.h>
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/conversions.h>
using namespace pcl;
using namespace pcl::io;
using namespace pcl::console;
int main()
{
pcl::PCLPointCloud2 point_cloud2;
pcl::PLYReader reader;
reader.read("data.ply", point_cloud2);
pcl::PointCloud<pcl::PointXYZI> point_cloud;
pcl::fromPCLPointCloud2( point_cloud2, point_cloud);
pcl::PCDWriter writer;
writer.writeASCII("data.pcd", point_cloud);
return 0;
}