版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Linear_Luo/article/details/52674860
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
int main(int argc, char ** argv)
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
if (pcl::io::loadPCDFile<pcl::PointXYZ>("E:/vsprojects/PCL-learn/io/read_pcd/src/test_pcd.pcd", *cloud) == -1)
{
PCL_ERROR("Could not read the file\n ");
return -1;
}
std::cout
<< "Loaded "
<< cloud->width * cloud->height
<< " data points from test_pcd.pcd with the following fields: "
<< std::endl;
for (size_t i = 0; i < cloud->points.size();++i)
{
std::cout
<< " " << cloud->points[i].x
<< " " << cloud->points[i].y
<< " " << cloud->points[i].z << std::endl;
}
return (0);
}