1. vtkPolyData 显示点云
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
pcl::io::loadPLYFile("F:\\upper1.ply", *cloud);
pcl::io::savePCDFileBinary("F:\\upper1.pcd", *cloud);
//pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
if (pcl::io::loadPCDFile<pcl::PointXYZ>("F:\\upper1.pcd", *cloud) == -1) //* load the file
{
PCL_ERROR("Couldn't read file upper1.pcd \n");
return;
}
std::cout << "Loaded "
<< cloud->width * cloud->height
<< " data points from upper1.pcd with the following fields: "
<< std::endl;
vtkSmartPointer<vtkPoints> m_Points = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkCellArray> vertices = vtkSmartPointer<vtkCellArray>::New(); //_存放细胞顶点,用于渲染(显示点云所必须的)
int index = 0;
for (const auto& point : *cloud)