PCL PCLVisualizer 点云实时显示

#include 
#include 
#include 
#include 
#include 
 
using namespace pcl;

boost::shared_ptr viewer(new pcl::visualization::PCLVisualizer("3D Viewer"));

int main()

{

    //定义点云数据
    pcl::PointCloud::Ptr cloud (new pcl::PointCloud);

    // 定义读取对象
    pcl::PCDReader reader;

    // 读取点云文件
    reader.read ("test.pcd", *cloud);

    while(true)
    {

        viewer1->removeAllPointClouds();  // 移除当前所有点云
        viewer1->addPointCloud(cloud, "test");  
        viewer1->updatePointCloud(cloud, "test"); 
        viewer1->spinOnce(0.0000000000001);
    }

}

 

你可能感兴趣的:(PCL)