在ubuntu下安装pcl点云库时,网上给出的教程,大多是分了几个步骤,安装pcl和其依赖库,未免过于麻烦,其实有很简单的方法,一行就可以搞定。

sudo apt-get install libpcl-dev

这样,对应的依赖项和pcl库都被安装编译好了,然后使用pcl_viewer测试下吧!

where options are:-bc r,g,b                = background color-fc r,g,b                = foreground color-ps X                    = point size (1..64) -opaque X                = rendered point cloud opacity (0..1)-shading X               = rendered surface shading ('flat' (default), 'gouraud', 'phong')-position x,y,z          = absolute point cloud position in metres-orientation r,p,y       = absolute point cloud orientation (roll, pitch, yaw) in radians-ax n                    = enable on-screen display of XYZ axes and scale them to n-ax_pos X,Y,Z            = if axes are enabled, set their X,Y,Z position in space (default 0,0,0)-cam (*)                 = use given camera settings as initial view(*) [Clipping Range / Focal Point / Position / ViewUp / Distance / Field of View Y / Window Size / Window Pos] or use a <filename.cam> that contains the same information.-multiview 0/1           = enable/disable auto-multi viewport rendering (default disabled)-normals 0/X             = disable/enable the display of every Xth point's surface normal as lines (default disabled)-normals_scale X         = resize the normal unit vector size to X (default 0.02)-pc 0/X                  = disable/enable the display of every Xth point's principal curvatures as lines (default disabled)-pc_scale X              = resize the principal curvatures vectors size to X (default 0.02)-immediate_rendering 0/1 = use immediate mode rendering to draw the data (default: disabled)Note: the use of immediate rendering will enable the visualization of larger datasets at the expense of extra RAM.See http://en.wikipedia.org/wiki/Immediate_mode for more information.-vbo_rendering 0/1       = use OpenGL 1.4+ Vertex Buffer Objects for rendering (default: disabled)Note: the use of VBOs will enable the visualization of larger datasets at the expense of extra RAM.See http://en.wikipedia.org/wiki/Vertex_Buffer_Object for more information.-use_point_picking       = enable the usage of picking points on screen (default disabled)-optimal_label_colors    = maps existing labels to the optimal sequential glasbey colors, label_ids will not be mapped to fixed colors (default disabled)(Note: for multiple .pcd files, provide multiple -{fc,ps,opaque,position,orientation} parameters; they will be automatically assigned to the right file)

可以了,只是没有对应的.pcd文件,显示不出来。

接着:pcl_viewer fragment.pcd 可以对.pcd文件进行可视化,具体显示图像,如下所示。

> Loading fragment.pcd [done, 85 ms : 113662 points]
Available dimensions: x y z rgb normal_x normal_y normal_z curvature


在命令框中可以完成该工作,但是操作不方便,使用QT作为IDE吧,PCL在QT中稍微配置下就好:

QT += core
QT -= guiCONFIG += c++11TARGET = test
CONFIG += console
CONFIG -= app_bundleTEMPLATE = appSOURCES += main.cpp# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0#Opencv的配置
INCLUDEPATH += /usr/local/include\
/usr/local/include/opencv\
/usr/local/include/opencv2LIBS += /usr/local/lib/libopencv_highgui.so \/usr/local/lib/libopencv_core.so    \/usr/local/lib/libopencv_imgproc.so \/usr/local/lib/libopencv_imgcodecs.so#PCL的配置
#Eigen
INCLUDEPATH += /usr/include/eigen3#Vtk
INCLUDEPATH += /usr/include/vtk-6.3LIBS += /usr/lib/x86_64-linux-gnu/libvtk*.so#Boost
INCLUDEPATH += /usr/include/boostLIBS += /usr/lib/x86_64-linux-gnu/libboost_*.so#PCL Header
INCLUDEPATH += /usr/include/pcl-1.8#PCL Lib
LIBS        += /usr/lib/x86_64-linux-gnu/libpcl*.so

这里我还使用了opencv,所以会有opencv的配置,不需要的话,直接把opencv库的配置去掉即可。

测试代码:

#include <iostream>
#include <pcl/visualization/cloud_viewer.h>
#include <iostream>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
using namespace std;int user_data;void
viewerOneOff (pcl::visualization::PCLVisualizer& viewer)
{viewer.setBackgroundColor (1.0, 0.5, 1.0);pcl::PointXYZ o;o.x = 1.0;o.y = 0;o.z = 0;viewer.addSphere (o, 0.25, "sphere", 0);std::cout << "i only run once" << std::endl;}void
viewerPsycho (pcl::visualization::PCLVisualizer& viewer)
{static unsigned count = 0;std::stringstream ss;ss << "Once per viewer loop: " << count++;viewer.removeShape ("text", 0);viewer.addText (ss.str(), 200, 300, "text", 0);//FIXME: possible race condition here:user_data++;
}int
main ()
{pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGBA>);pcl::io::loadPCDFile ("five_people.pcd", *cloud);pcl::visualization::CloudViewer viewer("Cloud Viewer");//blocks until the cloud is actually renderedviewer.showCloud(cloud);//use the following functions to get access to the underlying more advanced/powerful//PCLVisualizer//This will only get called onceviewer.runOnVisualizationThreadOnce (viewerOneOff);//This will get called once per visualization iterationviewer.runOnVisualizationThread (viewerPsycho);while (!viewer.wasStopped ()){//you can also do cool processing here//FIXME: Note that this is running in a separate thread from viewerPsycho//and you should guard against race conditions yourself...user_data++;}return 0;
}

测试结果:

Ubuntu16.04安装编译pcl点云库相关推荐

  1. Kinectfusion开源实现_配置Kinfu环境_Cmake编译PCL点云库_Kinect3D重建

    Kinectfusion开源实现-配置Kinfu环境-Cmake编译PCL点云库 注: 1.此教程在win10_x64.VS2010_x86环境下,配置运行Kinfu.编译PCL点云库成功,其他环境也 ...

  2. ubuntu16.04安装docker(阿里云镜像)

    一.查看docker安装环境要求 uname -a ls -l /sys/class/misc/device-mapper 二.安装docker # step 1: 安装必要的一些系统工具 sudo ...

  3. 编译安装PCL点云库,Kinect2驱动,乐视Astra相机驱动

    编译安装PCL点云库 安装方法一 3d点云安装 apt-cache cearch pcl 安装 sudo apt install 上面查出来的 opencv不建议用以上方法因为需要 安装 opencv ...

  4. PCL之Ubuntu16.04下编译libfreenect2和PCL以支持KinectV2点云处理

    转载于: https://shenxiaohai.me/2018/04/26/Ubuntu-freenect2-PCL/ 原因就是由于 OpenNI2.2 不支持 Kinect V2,导致我没法在 P ...

  5. Linux ubuntu16.04 安装opencv4教程(源码编译)

    参考文章1:Ubuntu 安装 OpenCV(亲测有效) 参考文章2:OpenCV - Linux(Ubuntu 16.04)中安装OpenCV + OpenCV_Contrib 参考文章3:ubun ...

  6. Ubuntu16.04安装armadillo库

    1. armadillo说明 armadillo是目前使用比较广的C++矩阵运算库之一,相当于Matlab的C++替代库.许多Matlab的矩阵操作函数都可以找到对应,这对习惯了Matlab的人来说实 ...

  7. PCL点云库安装及学习(2021.7.28)

    PCL点云库学习 2021.7.28 1.PCL简介 2.Win10系统下PCL环境配置 2.1 前提环境(Win10 64位+Visual Studio 2015) 2.2 方式一:源码编译(过程繁 ...

  8. 阿里云服务器Ubuntu16.04安装Anaconda(python3.6)和本地远程连接jupyter

    一.ubuntu16.04安装Anaconda(python3.6) 1.上传Anaconda 我选择的是在本地下载了anaconda的linux版本,之后用xftp上传到服务器上 下载地址:http ...

  9. ubuntu16.04安装opencv3.4.1教程

    最近opencv3.4.1发布了,想换个新的试试鲜,于是把配置的过程通过博文的方式记录下来,方便查阅.  本教程原为3.3.0,但经过博主亲测,3.4.0.3.4.1皆适用 1.去官网下载opencv ...

  10. Ubuntu16.04 安装 OpenMPI4.0.0

    Ubuntu16.04 安装 OpenMPI4.0.0 文章目录 OpenMPI 简介 一.OpenMPI 1.0.0版本下载 二.OpenMPI 安装步骤 1.解压并进行配置 2.Build 并安装 ...

最新文章

  1. 使用Python,OpenCV进行去水印,图像修复
  2. [原创] Debian9上配置Samba
  3. webpack+react多页面开发架构
  4. 第二次作业#include stdio.h int main() { int a,b,c,d,e; printf(请输入一个不多于五位的整数:\n); scanf(%...
  5. 程序员每天到底可以写几行代码?
  6. python画椭圆turtle_Python turtle画图库画姓名实例
  7. SPOJ- QTREE+HDU 3966(树链剖分裸题
  8. 企业微信_读取成员(获取用户详情)
  9. el 能否定义作用域变量_python命名空间和作用域
  10. GO、Rust 这些新一代高并发编程语言为何都极其讨厌共享内存?
  11. cocos2dx游戏开发简单入门视频教程 (cocos2d-x)- 第5天
  12. Atitit 引流矩阵与矩阵引流 推广方法 attilax总结
  13. [ 服务器 ] ___ Linux : Tftpd
  14. QTcpSocket使用发现的问题
  15. [架构之美]一款APP从想法-开发-上线-产品的全过程
  16. cuda编程思想和opencv_gpu图像处理
  17. matlab的trial,Free Product Trial - MATLAB Simulink
  18. 关于linux中socket阻塞与非阻塞
  19. Correcting Chinese Spelling Errors with Phonetic Pre-training
  20. 获取指定日期所在月的最后一个工作日

热门文章

  1. 内置函数dict()字典
  2. js右下角广告[兼容]
  3. String 尺取法
  4. 介绍 JavaScript 中的闭包、局部变量(局部作用域)和私有变量等内容
  5. 字符串转换的UnicodeDecodeError—— ‘\xa0’问题
  6. web.config点滴:更改login控件对密码安全性的要求
  7. 如何在MyEclipse 中将工程已经删除的文件恢复过来
  8. mac搜索不到wifi wtg_如何设置隐藏wifi 防止蹭网隐藏wifi方法【详解】
  9. 应该如何理解mobx_MobX入门
  10. 15. Django基础:cookies和sesseion