当前位置: 首页 > news >正文

Ubuntu16.04安装编译pcl点云库

在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;
}

测试结果:
在这里插入图片描述


http://www.taodudu.cc/news/show-1782137.html

相关文章:

  • el-select 点击按钮滚动到选择框顶部
  • 【陀螺仪JY61P维特智能】通过单片机修改波特率和角度参考的方法
  • Android getevent命令详细分析
  • Opecv-Python常用算子库(总结)
  • 怎样选择IT外包公司?需要注意什么?
  • TypeScript 基础学习笔记:interface 与 type 的异同
  • Ubuntu18.04下安装配置darknet
  • Ubuntu18.04下C++编译tensorflow并在QT中使用
  • Opencv3.4.2调用yolov2进行物体检测源代码
  • C++调用yolov3模型-opencv3.4.2
  • Ubuntu18.04 + anaconda3 +python3.6+ 安装labelImg 标注
  • pcl学习之kd-tree
  • PCL中的点云ICP配准(附源代码和数据)
  • PCL对点云进行滤波处理并进行颜色可视化
  • PCL中的关键点
  • PCL点云参数估计算法之RANSAC和LMEDS
  • PCL计算点云的法线
  • PCL中的点云分割算法
  • PCL中把点云拟合成曲面(附源代码)
  • 环形链表 II
  • C++调用caffe分类模型-Opencv3.4.3
  • C++调用SSD caffe模型进行物体检测-Opencv3.4.3
  • C++调用tensorflow训练好的SSD物体检测模型-opencv3.4.3
  • C++调用mask rcnn进行实时检测--opencv4.0
  • tensorflow线下训练SSD深度学习物体检测模型,C++线上调用模型进行识别定位(干货满满)
  • python训练Faster RCNNC++调用训练好的模型进行物体检测-基于opencv3.4.3(超详细)
  • mask rcnn数据转换为tfrecord数据
  • opencv3.4.2调用训练好的Openpose模型
  • python训练mask rcnn模型C++调用训练好的模型--基于opencv4.0(干货满满)
  • leetcode之移除链表的元素
  • leetcode之奇偶链表
  • leetcode之回文链表
  • ubuntu16.04下安装配置caffe2和detectron(亲测有效,非常简单)
  • leetcode之字符串中的第一个唯一字符
  • 哈希表中处理冲突的方法
  • SENet算法解析