[Part 3] 在Ubuntu 16.04源码编译PCL 1.8.1支持VTK和QT
本文首发于个人博客https://kezunlin.me/post/137aa5fc/,欢迎阅读!
Part-3: Install and Configure PCL 1.8.1 with vtk qt support on Ubuntu 16.04 from source
Series
- Part-1: Install and Configure Qt5 on Ubuntu 16.04
- Part-2: Install and Configure VTK 8.1.0 from source with Qt5 on Ubuntu 16.04
- Part-3: Install and Configure PCL 1.8.1 with vtk qt support on Ubuntu 16.04 from source
- Part-4: Install and Configure PCL 1.8.1 with vtk qt support on windows 10 from source
Guide
- qt: 5.7.0
- qmake: 3.0
- qtcreator: 3.5.1
- vtk: 8.1.0 (source)
- pcl :1.8.1 (source)
Setup Prerequisites
sudo apt-get update
sudo apt-get install git build-essential linux-libc-dev
sudo apt-get install cmake cmake-gui
sudo apt-get install libusb-dev libudev-dev
sudo apt-get install mpi-default-dev openmpi-bin openmpi-common
sudo apt-get install libpcap-dev
sudo apt-get install libflann1.8 libflann-dev
sudo apt-get install libeigen3-dev
sudo apt-get install libopenni2-dev
sudo apt-get install libqhull7 libqhull-dev
sudo apt-get install freeglut3-dev pkg-config
sudo apt-get install libxmu-dev libxi-dev
sudo apt-get install mono-complete
sudo apt-get install openjdk-8-jdk openjdk-8-jre
dropped
sudo apt-get install qt-sdk
sudo apt-get install libvtk5.10-qt4 libvtk5.10 libvtk5-dev
sudo apt-get install vtk6 libvtk6-dev libvtk6-qt-dev
Notice for vtk version.
metslib
for cmake error:
no metslib found.
fix by
wget https://www.coin-or.org/download/source/metslib/metslib-0.5.3.tgz
tar xzvf metslib-0.5.3.tgz
cd metslib-0.5.3
./configure
make
sudo make install
glxinfo
install
sudo apt-get install mesa-utils
glxinfo
possible error
X Error of failed request: BadRequest (invalid request code or no such operation)
Major opcode of failed request: 154 (GLX)
Minor opcode of failed request: 34 ()
Serial number of failed request: 34
Current serial number in output stream: 33
fix,make sure NVIDIA drivers are installed successfully and no conflict.
check display OpenGL info
$ glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 1060/PCIe/SSE2
OpenGL core profile version string: 4.5.0 NVIDIA 384.90
OpenGL core profile shading language version string: 4.50 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.5.0 NVIDIA 384.90
OpenGL shading language version string: 4.50 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 384.90
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:
It means we use OpenGL version 4.5.0 for NVIDIA display.
Or by nvidia-settings, NVIDIA X Server Settings--> X Screen 0 --> OpenGL/GLX Information.
compile
wget https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.1.tar.gz
cd pcl
mkdir build
cd build
cmake-gui ..
with options
QT_USE_FILE /home/kezunlin/program/pcl-1.8.1/build/use-qt5.cmake
VTK_DIR /usr/local/lib/cmake/vtk-8.1
CMAKE_BUILD_TYPE Release
CMAKE_CONFIGURATION_TYPES Release
CMAKE_INSTALL_PREFIX /usr/local
PCL_SHARED_LIBS ON
PCL_QT_VERSION 5
PCL_ENABLE_SSE ON
Build_visualization ON
Build_apps ON
Build_examples OFF # error may occur
Using CPU native flags for SSE optimization: -march=native
make and install
# it may take several minutes, wait ...
make -j8
sudo make -j8 install
cmake install to
/usr/local/bin,/usr/local/lib/,/usr/local/include/pcl-1.8
PCL_DIRwill be/usr/local/share/pcl-1.8
error for example
/home/kezunlin/program/pcl-1.8.1/examples/segmentation/example_cpc_segmentation.cpp:493:17: error: ‘class vtkUnsignedCharArray’ has no member named ‘InsertNextTupleValue’
colors->InsertNextTupleValue (color);
so cmake with options
Build_examples OFF
Test pcl_viewer
test pcl_viewer
/usr/local/bin/pcl_viewer ~/program/pcl-1.8.1/test/car6.pcd
Success.

Tips: screen snapshot by gnome-screenshot -a.
Cloud Viewer
cloud_viewer.cpp
#include <pcl/visualization/cloud_viewer.h>
#include <iostream>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
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 ()
{
// car6 x y z
// colored_cloud x y z rbga
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::io::loadPCDFile ("colored_cloud.pcd", *cloud);
pcl::visualization::CloudViewer viewer("Cloud Viewer");
//blocks until the cloud is actually rendered
viewer.showCloud(cloud);
//use the following functions to get access to the underlying more advanced/powerful
//PCLVisualizer
//This will only get called once
viewer.runOnVisualizationThreadOnce (viewerOneOff);
//This will get called once per visualization iteration
viewer.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;
}
/*
http://pointclouds.org/documentation/tutorials/cloud_viewer.php
http://pointclouds.org/documentation/tutorials/pcl_visualizer.php
http://docs.pointclouds.org/1.7.0/structpcl_1_1_point_x_y_z_r_g_b.html
*/
CMakeLists.txt
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(cloud_viewer)
# set bin folder
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
find_package(PCL 1.8.1 REQUIRED)
#message( [***] ${PCL_INCLUDE_DIRS})
#message( [***] ${PCL_LIBRARY_DIRS})
#message( [***] ${PCL_DEFINITIONS})
#message( [***] ${PCL_LIBRARIES})
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable (cloud_viewer cloud_viewer.cpp)
target_link_libraries (cloud_viewer ${PCL_LIBRARIES})
compile
mkdir build
cd build
cmake ..
make
run demo
bin folder
$ tree bin/
bin/
├── cloud_viewer
└── colored_cloud.pcd
0 directories, 2 files
run demo
./cloud_viewer
Code Example
Pcd write
see Part-4: Install and Configure PCL 1.8.1 with vtk qt support on windows 10 from source
Reference
for windows
History
- 20180105: created.
- 20180227: rewrite pcl compile part.
Copyright
- Post author: kezunlin
- Post link: https://kezunlin.me/post/137aa5fc/
- Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 3.0 unless stating additionally.
[Part 3] 在Ubuntu 16.04源码编译PCL 1.8.1支持VTK和QT的更多相关文章
- [Part 4] 在Windows 10上源码编译PCL 1.8.1支持VTK和QT,可视化三维点云
本文首发于个人博客https://kezunlin.me/post/2d809f92/,欢迎阅读! Part-4: Compile pcl with vtk qt5 support from sour ...
- Ubuntu 16.04 源码编译安装PHP7+swoole
备注: Ubuntu 16.04 Server 版安装过程图文详解 Ubuntu16镜像地址: 链接:https://pan.baidu.com/s/1XTVS6BdwPPmSsF-cYF6B7Q 密 ...
- ubuntu 16.04源码编译OpenCV教程 | compile opencv on ubuntu 16.04
本文首发于个人博客https://kezunlin.me/post/15f5c3e8/,欢迎阅读! compile opencv on ubuntu 16.04 Series Part 1: comp ...
- ubuntu 16.04源码编译和配置caffe详细教程 | Install and Configure Caffe on ubuntu 16.04
本文首发于个人博客https://kezunlin.me/post/b90033a9/,欢迎阅读! Install and Configure Caffe on ubuntu 16.04 Series ...
- Ubuntu 16.04源码编译boost库 编写CMakeLists.txt | compile boost 1.66.0 from source on ubuntu 16.04
本文首发于个人博客https://kezunlin.me/post/d5d4a460/,欢迎阅读! compile boost 1.66.0 from source on ubuntu 16.04 G ...
- Ubuntu 16.04 源码编译安装PHP7
一.下载PHP7的最新版源码 php7.0.9 下载地址 http://php.net/get/php-7.0.9.tar.gz/from/a/mirror 二.解压 tar -zxf /tmp/p ...
- Ubuntu 16.04源码编译安装nginx 1.10.0
一.下载相关的依赖库 pcre 下载地址 http://120.52.73.43/jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.t ...
- [环境配置]Ubuntu 16.04 源码编译安装OpenCV-3.2.0+OpenCV_contrib-3.2.0及产生的问题
1.OpenCV-3.2.0+OpenCV_contrib-3.2.0编译安装过程 1)下载官方要求的依赖包 GCC 4.4.x or later CMake 2.6 or higher Git GT ...
- [笔记] Ubuntu 18.04源码编译安装OpenCV 4.0流程
标准常规安装方法安装的OpenCV版本比较低,想尝鲜使用4.0版本,只好源码安装. 安装环境 OS:Ubuntu 18.04 64 bit 显卡:NVidia GTX 1080 CUDA:10.0 c ...
随机推荐
- Docker学习3-简单shell脚本安装mysql5.7与docker小技巧
前言 玩过Windows中的 .bat 的小伙伴是不是觉得很有意思呢,github中一键推送.同步拉取等等操作,哈哈,当然shell脚本也是很类似,可以运行一个脚本就可以自动给我们部署好环境啦!但是这 ...
- 使用 Helm Chart 部署及卸载 istio
部署 istio 1.添加 istio 官方的 helm 仓库 helm repo add istio https://storage.googleapis.com/istio-release/rel ...
- MyBatisCodeHelper-Pro插件破解
MyBatisCodeHelper-Pro: MyBatisCodeHelper-Pro是IDEA下的一个插件,功能类似mybatis plugin. 但是是收费的,我们可以对他进行破解 转载出处:h ...
- Mybaits 源码解析 (五)----- 面试源码系列:Mapper接口底层原理(为什么Mapper不用写实现类就能访问到数据库?)
刚开始使用Mybaits的同学有没有这样的疑惑,为什么我们没有编写Mapper的实现类,却能调用Mapper的方法呢?本篇文章我带大家一起来解决这个疑问 上一篇文章我们获取到了DefaultSqlSe ...
- (day29) 进程互斥锁 + 线程
目录 进程互斥锁 队列和堆栈 进程间通信(IPC) 生产者和消费者模型 线程 什么是线程 为什么使用线程 怎么开启线程 线程对象的属性 线程互斥锁 进程互斥锁 进程间数据不共享,但是共享同一套文件系统 ...
- ESP8266 打造一款物联网产品---搭建环境编译及烧录
一 前记 作为一个在wifi领域耕耘了多年的人,以前一直在外企和大公司做芯片,没有怎么使用过国内的芯片公司做出来的芯片.最近正好有一个项目需要用到一款低成本的wifi芯片,找来找去,发现乐鑫的最适合. ...
- NetworkManager网络通讯_问题汇总(四)
此篇来填坑,有些坑是unet自身问题,而大部分则是理解不准确造成的(或者unity定义太复杂) 问题一: isLocalPlayer 值一直是false 出现场景:NetworkLobbyPlayer ...
- Blazor之ABC
.net core正式推出了Blazor, 正好在一个小项目里试用一下. 建立项目 因为基于WebAssemble的客户端Blazor还不是正式版, 为了避免不必要的麻烦,我试用服务端的Blazor. ...
- kali linux 开启配置ssh服务
1. 一.配置SSH参数 修改sshd_config文件,命令为: vi /etc/ssh/sshd_config 将#PasswordAuthentication no的注释去掉,并且将NO修 ...
- ORCLE 创建表空间,用户,赋予角色以及授权
1.创建表空间MMS_DATA --创建表空间和数据库文件dbf CREATE TABLESPACE MMS_DATA DATAFILE 'D:\ORADATA\ORCL\MMS_DATA.DBF' ...