• Ubuntu16.04PCL安装


    1.依赖项安装

    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-1.0-0-dev libusb-dev libudev-dev   sudo apt-get install mpi-default-dev openmpi-bin openmpi-common     
    sudo apt-get install libflann1.8 libflann-dev   
    sudo apt-get install libeigen3-dev   sudo apt-get install libboost-all-dev   
    sudo apt-get install libvtk6.2 libvtk6.2-qt libvtk6-dev sudo apt-get install libqhull* libgtest-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 qt-sdk openjdk-8-jdk openjdk-8-jre

      2.下载源码

    地址:https://github.com/PointCloudLibrary/pcl/

     3.编译

    mkdir build
    cd build
    cmake-gui //source code 指的是源码的位置 build binaries//指的是编译文件的存放位置
    先点击configure 变成红色之后,看看需要添加那些模块,有些模块如果没有添加,以后使用就会有问题
    然后generate make sudo make install

       

           注意:在cmake-gui的时候,勾选需要编译的模块,不然在使用的时候会出现类似下面这样的问题,注意看cmake的报告,

       fatal error: pcl/visualization/pcl_visualizer.h: 没有那个文件或目录

         第一次cmake的时候没有勾选可视化模块,下面的cmake的报告写的很明白,visualization手动禁止,进行修改,成功包含可视化模块

         

     

    4. 测试

     

    #include <iostream>
    #include <pcl/common/common_headers.h>
    #include <pcl/io/pcd_io.h>
    #include <pcl/visualization/pcl_visualizer.h>
    #include <pcl/visualization/cloud_viewer.h>
    #include <pcl/console/parse.h>
     
     
    int main(int argc, char **argv) {
        std::cout << "Test PCL !!!" << std::endl;
        
        pcl::PointCloud<pcl::PointXYZRGB>::Ptr point_cloud_ptr (new pcl::PointCloud<pcl::PointXYZRGB>);
        uint8_t r(255), g(15), b(15);
        for (float z(-1.0); z <= 1.0; z += 0.05)
        {
          for (float angle(0.0); angle <= 360.0; angle += 5.0)
          {
        pcl::PointXYZRGB point;
        point.x = 0.5 * cosf (pcl::deg2rad(angle));
        point.y = sinf (pcl::deg2rad(angle));
        point.z = z;
        uint32_t rgb = (static_cast<uint32_t>(r) << 16 |
            static_cast<uint32_t>(g) << 8 | static_cast<uint32_t>(b));
        point.rgb = *reinterpret_cast<float*>(&rgb);
        point_cloud_ptr->points.push_back (point);
          }
          if (z < 0.0)
          {
        r -= 12;
        g += 12;
          }
          else
          {
        g -= 12;
        b += 12;
          }
        }
        point_cloud_ptr->width = (int) point_cloud_ptr->points.size ();
        point_cloud_ptr->height = 1;
        
        pcl::visualization::CloudViewer viewer ("test");
        viewer.showCloud(point_cloud_ptr);
        while (!viewer.wasStopped()){ };
        return 0;
    }

     

           CMakeLists.txt

    cmake_minimum_required(VERSION 2.6)
    project(pcl_test)
    
    find_package(PCL 1.2 REQUIRED)
    
    include_directories(${PCL_INCLUDE_DIRS})
    link_directories(${PCL_LIBRARY_DIRS})
    add_definitions(${PCL_DEFINITIONS})
    add_executable(TestComplie TestComplie.cpp)
    target_link_libraries (TestComplie ${PCL_LIBRARIES})

     

            成功!

     

     

    知识的二道贩子,此博客仅仅是个人学习总结!
  • 相关阅读:
    perl system和exec 调用
    perl hash 根据键访问相应值
    perl unless循环
    perl hash数组
    Flex中利用单选按钮切换柱状图横纵坐标以及描述
    ReferenceError: Error #1069: 在 spark.components.RadioButtonGroup 上找不到属性 label,且没有默认值
    perl utf8 转gbk
    Oracle根据数据块ITL查找UNDO前镜像
    集团管控的历史读本——Leo鉴书76
    1067: spark.components:NavigatorContent 类型值的隐式强制指令的目标是非相关类型 String
  • 原文地址:https://www.cnblogs.com/xiangdongBig1/p/12391385.html
Copyright © 2020-2023  润新知