博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
3、PCL 加载自己的点云数据集并显示出来
阅读量:4167 次
发布时间:2019-05-26

本文共 1564 字,大约阅读时间需要 5 分钟。

建立一个文件夹pclfirst

在pclfirst文件夹下建立pclfirst.cpp,写入

/*    任何点云格式均可,不要求点云带有RGB字段*/#include 
#include
#include
#include
//pcd 读写类相关的头文件。#include
#include
using namespace std;using namespace pcl;using namespace io;int main() { PointCloud
::Ptr cloud(new PointCloud
); char strfilepath[256] = "/home/tianchengyuan/exercise/pclfirst/twoDroneLocalization.pcd";//将自己的点云数据集的路径放在这里就可以了,我这里是一个校使馆的点云集 if (-1 == io::loadPCDFile(strfilepath, *cloud)) { // 读取.pcd文件 cerr << "can't read file bunny.pcd" << endl;//如果未找到 return -1; } boost::shared_ptr
viewer(new pcl::visualization::PCLVisualizer("3D Viewer")); pcl::visualization::PointCloudColorHandlerCustom
single_color(cloud, 0,205,205 ); // green viewer->addPointCloud
(cloud, single_color, "sample cloud"); while (!viewer->wasStopped()) { viewer->spinOnce(100); boost::this_thread::sleep(boost::posix_time::microseconds(100000)); } return 0;}

在pclfirst文件夹下建立配置文件CMakeLists.txt,写入:

cmake_minimum_required(VERSION 2.6)project(pclfirst) find_package(PCL 1.2 REQUIRED) include_directories(${
PCL_INCLUDE_DIRS})link_directories(${
PCL_LIBRARY_DIRS})add_definitions(${
PCL_DEFINITIONS}) add_executable(pclfirst pclfirst.cpp) target_link_libraries (pclfirst ${
PCL_LIBRARIES}) install(TARGETS pclfirst RUNTIME DESTINATION bin)

然后再在pclfirst文件夹下建一个build文件夹。

开始编译:
1、在build文件夹中打开终端(在文件夹下右键+T)
2、终端输入

cmake ..

3、终端输入

make

4、终端输入

./pclfirst

在这里插入图片描述

至此,显示成功!

2020.12.20

今天发现来更加简单的方法:
可用pcl_viewer 查看:

pcl_viewer xxxx.pcd                #xxxx.pcd 为文件名

转载地址:http://kjexi.baihongyu.com/

你可能感兴趣的文章
商务智能-基本方法-特征与角度
查看>>
软件项目管理系统-项目管理-模块定义-开发笔记
查看>>
工作流审批平台-业务申请-申请书一览
查看>>
商务智能-基本方法-数据钻取
查看>>
C++程序员技术需求规划(发展方向)
查看>>
哈希表(Hash Table)-哈希概述
查看>>
Filebench的安装及使用
查看>>
Ubuntu下 E: Could not get lock /var/lib/apt/lists/lock - open (11: Recource temporarily unavailable)
查看>>
Linux-mmap映射物理内存到用户空间
查看>>
Ext4文件系统三种日志模式——journal、ordered、writeback
查看>>
Linux挂载ext4根文件系统为journal模式
查看>>
linux内核引导参数解析及添加
查看>>
长短期记忆人工神经网络(LSTM)及其tensorflow代码应用
查看>>
长短期记忆人工神经网络(LSTM)网络学习资料
查看>>
运行网络中搜寻到的python程序代码——以长短期记忆人工神经网络(lstm)python代码为例
查看>>
闪存文件系统(Flash File System)
查看>>
WinMIPS64工具进行MIPS指令集实验(一)
查看>>
WinMIPS64工具进行MIPS指令集实验(二)
查看>>
Linux上快速入门英特尔Optane DC Persistent Memory Module的配置与使用
查看>>
Intel Optane DC Persistent Memory Module (PMM)详解
查看>>