使用C++编程语言进行Easy3D点云数据的读取与写入
点云(PCL)是在三维空间中被采集的点集合,是三维扫描仪输出的常见形式。Easy3D点云数据是一种常见的点云数据格式。
本文将介绍如何使用C++编程语言实现Easy3D点云数据的读取与写入。
- 点云数据的读取:
下面的代码展示了如何使用C++语言读取Easy3D点云数据文件:
#include <pcl/io/io.h>
#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> ("file.pcd", *cloud) == -1) //* load the file
{
PCL_ERROR ("Couldn't read file.pcd \n");
return (-1);
}
std::cout << "Loaded "
<< cloud->width * cloud->height
<< " data points from file.pcd with the following fields: "
<