其他分享
首页 > 其他分享> > 06-点云的读取与显示

06-点云的读取与显示

作者:互联网

点云数据的读取与显示:

  desk.pcd 数据百度链接:

  链接:https://pan.baidu.com/s/1mYleYemNmizXZGLQbUC59A
  提取码:atma

#include <iostream>
#include <pcl\io\pcd_io.h>
#include <pcl\point_types.h>
#include <pcl\visualization\cloud_viewer.h>

int main() 
{
    
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);


    if (pcl::io::loadPCDFile<pcl::PointXYZ>("F:\\BaiduNetdiskDownload\\pcl\\desk.pcd", *cloud) == -1) 
    {
        PCL_ERROR("Couldn't read file rabbit.pcd\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;
    }*/

    pcl::visualization::CloudViewer        viewer("cloud viewer");

    viewer.showCloud(cloud);

    while (!viewer.wasStopped()) {

    }

    system("pause");

    return 0;
}
View Code

 

标签:06,读取,points,pcd,pcl,点云,include,cloud,cout
来源: https://www.cnblogs.com/zhaopengpeng/p/15568705.html