三维彩色点云显示PCL库有两种方式
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGB>); // 创建点云(指针)
if(pcl::io::loadPLYFile<pcl::PointXYZRGB>("cartman.ply", *cloud) == -1)
//if (pcl::io::loadPLYFile<pcl::PointXYZRGB>("2012-Jun-28_17.44.05.966.ply", *cloud) == -1) //* 读入PCD格式的文件,如果文件不存在,返回-1
{
PCL_ERROR("Couldn't read file test_pcd.pcd \n"); //文件不存在时,返回错误,终止程序。
return (-1);
}
//一个面显示
pcl::visualization::CloudViewer viewer("Viewer");
viewer.showCloud(cloud);
while (!viewer.wasStopped())
{
}
三维点云可视化
本文介绍使用PCL库进行三维彩色点云的加载与显示的方法。通过示例代码展示了如何创建点云对象,从PLY文件中读取数据,并利用PCL提供的可视化工具进行点云展示。
606





