【PCL】mac下安装PCL的安装与配置

这篇具有很好参考价值的文章主要介绍了【PCL】mac下安装PCL的安装与配置。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

【PCL】mac下安装PCL的安装与配置

PCL

PCL官方文档

PCL(Point Cloud Library)是在吸收了前人点云相关研究基础上建立起来的大型跨平台开源C++编程库,它实现了大量点云相关的通用算法和高效数据结构,涉及到点云获取、滤波、分割、配准、检索、特征提取、识别、追踪、曲面重建、可视化等。支持多种操作系统平台,可在Windows、Linux、Android、Mac OS X、部分嵌入式实时系统上运行。如果说OpenCV是2D信息获取与处理的结晶,那么PCL就在3D信息获取与处理上具有同等地位,PCL是BSD授权方式,可以免费进行商业和学术应用。

通常在 windows 平台下安装 PCL 算是比较简单的,他的每一个版本都有一个 pcl 对应的的 AllInOne的一个安装的exe 软件 。或者也可以用 vcpkg 直接集成,但是mac下 安装的话更为简单。
PCL Download
github Download
mac pcl,pcl,mac,macos,c++,几何学

第一步:安装homebrew

打开终端 输入

ruby -e "$(curl --insecure -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

接下来等待安装完毕即可

第二步:使用homebrew安装pcl

也很简单,打开终端,输入:

brew install pcl

首先会安装PCL的相关依赖库,如vtk,glew等,最后安装pcl

第三步: PCL的编译

这一步是最麻烦的,由于之前更多地在Windows上进行开发,更没有接触过cmake,所以碰到了许多稀奇古怪的问题。

1. 在工程目录下(如Desktop/PCLtest/)新建文件CMakeLists.txt,在该文件中写入:

cmake_minimum_required(VERSION 3.0 FATAL_ERROR) # 选择cmake版本

project(PCLtest) # 给工程命名

find_package(PCL 1.4 REQUIRED COMPONENTS common io) # 使用find_package寻找指定版本PCL的指定模块,如果想导入全部模块,也可以写为 find_package(PCL REQUIRED) 

include_directories(${PCL_INCLUDE_DIRS})

link_directories(${PCL_LIBRARY_DIRS})

add_definitions(${PCL_DEFINITIONS})

add_executable(PCLtest main.cpp)

target_link_libraries(PCLtest ${PCL_LIBRARIES})

2. 在工程目录下新建文件main.cpp,并写入:

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
 
int
  main (int argc, char** argv)
{
  pcl::PointCloud<pcl::PointXYZ> cloud;
 
  // Fill in the cloud data
  cloud.width    = 5;
  cloud.height   = 1;
  cloud.is_dense = false;
  cloud.points.resize (cloud.width * cloud.height);
 
  for (size_t i = 0; i < cloud.points.size (); ++i)
  {
    cloud.points[i].x = 1024 * rand () / (RAND_MAX + 1.0f);
    cloud.points[i].y = 1024 * rand () / (RAND_MAX + 1.0f);
    cloud.points[i].z = 1024 * rand () / (RAND_MAX + 1.0f);
  }
 
  pcl::io::savePCDFileASCII ("test_pcd.pcd", cloud);
  std::cerr << "Saved " << cloud.points.size () << " data points to test_pcd.pcd." << std::endl;
 
  for (size_t i = 0; i < cloud.points.size (); ++i)
    std::cerr << "    " << cloud.points[i].x << " " << cloud.points[i].y << " " << cloud.points[i].z << std::endl;
 
  return (0);
}

3. 生成Cmake工程

在 CMakeLists.txt 同级目录下 (如Desktop/PCLtest)下 打开终端或者进入从家目录下进到这个目录

cmake -S . -B build

4. 打开终端,进行编译

同样 同级目录

cmake --build build

cmake后屏幕输出:

/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /Users/zhi/Desktop/PCLtest
-- The C compiler identification is AppleClang 10.0.1.10010046
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Checking for module 'eigen3'
--   Found eigen3, version 3.3.7
-- Found Eigen: /usr/local/include/eigen3  
-- Eigen found (include: /usr/local/include/eigen3, version: 3.3.7)
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
-- Boost version: 1.70.0
-- Found the following Boost libraries:
--   system
--   filesystem
--   thread
--   date_time
--   iostreams
--   serialization
--   chrono
--   atomic
--   regex
-- Checking for module 'flann'
--   Found flann, version 1.9.1
-- FLANN found (include: /usr/local/Cellar/flann/1.9.1_7/include, lib: flann;flann_cpp)
-- FLANN found (include: /usr/local/Cellar/flann/1.9.1_7/include, lib: flann;flann_cpp)
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled
-- Found libusb-1.0: /usr/local/include  
** WARNING ** io features related to libusb-1.0 will be disabled
-- Found Qhull: optimized;/usr/local/lib/libqhull_p.dylib;debug;/usr/local/lib/libqhull_p.dylib  
-- QHULL found (include: /usr/local/include, lib: optimized;/usr/local/lib/libqhull_p.dylib;debug;/usr/local/lib/libqhull_p.dylib)
-- Found OpenGL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework   
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2") 
-- Checking for module 'glew'
--   Found glew, version 2.1.0
-- Found Glew: GLEW;-framework Cocoa
-- looking for PCL_COMMON
-- Found PCL_COMMON: /usr/local/lib/libpcl_common.dylib  
-- looking for PCL_KDTREE
-- Found PCL_KDTREE: /usr/local/lib/libpcl_kdtree.dylib  
-- looking for PCL_OCTREE
-- Found PCL_OCTREE: /usr/local/lib/libpcl_octree.dylib  
-- looking for PCL_SEARCH
-- Found PCL_SEARCH: /usr/local/lib/libpcl_search.dylib  
-- looking for PCL_SAMPLE_CONSENSUS
-- Found PCL_SAMPLE_CONSENSUS: /usr/local/lib/libpcl_sample_consensus.dylib  
-- looking for PCL_FILTERS
-- Found PCL_FILTERS: /usr/local/lib/libpcl_filters.dylib  
-- looking for PCL_2D
-- Found PCL_2D: /usr/local/include/pcl-1.9  
-- looking for PCL_GEOMETRY
-- Found PCL_GEOMETRY: /usr/local/include/pcl-1.9  
-- looking for PCL_IO
-- Found PCL_IO: /usr/local/lib/libpcl_io.dylib  
-- looking for PCL_FEATURES
-- Found PCL_FEATURES: /usr/local/lib/libpcl_features.dylib  
-- looking for PCL_ML
-- Found PCL_ML: /usr/local/lib/libpcl_ml.dylib  
-- looking for PCL_SEGMENTATION
-- Found PCL_SEGMENTATION: /usr/local/lib/libpcl_segmentation.dylib  
-- looking for PCL_VISUALIZATION
-- Found PCL_VISUALIZATION: /usr/local/lib/libpcl_visualization.dylib  
-- looking for PCL_SURFACE
-- Found PCL_SURFACE: /usr/local/lib/libpcl_surface.dylib  
-- looking for PCL_REGISTRATION
-- Found PCL_REGISTRATION: /usr/local/lib/libpcl_registration.dylib  
-- looking for PCL_KEYPOINTS
-- Found PCL_KEYPOINTS: /usr/local/lib/libpcl_keypoints.dylib  
-- looking for PCL_TRACKING
-- Found PCL_TRACKING: /usr/local/lib/libpcl_tracking.dylib  
-- looking for PCL_RECOGNITION
-- Found PCL_RECOGNITION: /usr/local/lib/libpcl_recognition.dylib  
-- looking for PCL_STEREO
-- Found PCL_STEREO: /usr/local/lib/libpcl_stereo.dylib  
-- looking for PCL_APPS
-- Found PCL_APPS: /usr/local/lib/libpcl_apps.dylib  
-- looking for PCL_OUTOFCORE
-- Found PCL_OUTOFCORE: /usr/local/lib/libpcl_outofcore.dylib  
-- looking for PCL_PEOPLE
-- Found PCL_PEOPLE: /usr/local/lib/libpcl_people.dylib  
-- looking for PCL_SIMULATION
-- Found PCL_SIMULATION: /usr/local/lib/libpcl_simulation.dylib  
-- Found PCL: pcl_common;pcl_kdtree;pcl_octree;pcl_search;pcl_sample_consensus;pcl_filters;pcl_io;pcl_features;pcl_ml;pcl_segmentation;pcl_visualization;pcl_surface;pcl_registration;pcl_keypoints;pcl_tracking;pcl_recognition;pcl_stereo;pcl_apps;pcl_outofcore;pcl_people;pcl_simulation;/usr/local/lib/libboost_system-mt.dylib;/usr/local/lib/libboost_filesystem-mt.dylib;/usr/local/lib/libboost_thread-mt.dylib;/usr/local/lib/libboost_date_time-mt.dylib;/usr/local/lib/libboost_iostreams-mt.dylib;/usr/local/lib/libboost_serialization-mt.dylib;/usr/local/lib/libboost_chrono-mt.dylib;/usr/local/lib/libboost_atomic-mt.dylib;/usr/local/lib/libboost_regex-mt.dylib;optimized;/usr/local/lib/libqhull_p.dylib;debug;/usr/local/lib/libqhull_p.dylib;flann;flann_cpp;vtksys;vtkCommonCore;vtkCommonMath;vtkCommonMisc;vtkCommonSystem;vtkCommonTransforms;vtkCommonDataModel;vtkCommonColor;vtkCommonExecutionModel;vtkCommonComputationalGeometry;vtkFiltersCore;vtkFiltersGeneral;vtkImagingCore;vtkImagingFourier;vtkFiltersStatistics;vtkFiltersExtraction;vtkInfovisCore;vtkFiltersGeometry;vtkFiltersSources;vtkRenderingCore;/usr/lib/libz.dylib;vtkfreetype;vtkRenderingFreeType;vtkRenderingContext2D;vtkChartsCore;vtkDICOMParser;vtkdoubleconversion;vtklz4;vtklzma;vtkIOCore;vtkIOLegacy;/usr/lib/libexpat.dylib;vtkIOXMLParser;vtkDomainsChemistry;vtkglew;vtkRenderingOpenGL2;vtkDomainsChemistryOpenGL2;vtkIOXML;vtkParallelCore;vtkFiltersAMR;vtkFiltersFlowPaths;vtkFiltersGeneric;vtkImagingSources;vtkFiltersHybrid;vtkFiltersHyperTree;vtkImagingGeneral;vtkFiltersImaging;vtkFiltersModeling;vtkFiltersParallel;vtkFiltersParallelImaging;vtkFiltersPoints;vtkFiltersProgrammable;/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/Python;vtkPythonInterpreter;vtkWrappingTools;vtkWrappingPythonCore;vtkFiltersPython;vtkFiltersSMP;vtkFiltersSelection;vtkFiltersTexture;vtkFiltersTopology;verdict;vtkFiltersVerdict;vtkInteractionStyle;vtkGUISupportQt;vtksqlite;vtkIOSQL;vtkGUISupportQtSQL;vtkmetaio;/usr/local/lib/libjpeg.dylib;/usr/local/lib/libpng.dylib;/usr/local/lib/libtiff.dylib;vtkIOImage;vtkImagingHybrid;vtkInfovisLayout;vtkImagingColor;vtkRenderingAnnotation;vtkRenderingVolume;vtkInteractionWidgets;vtkViewsCore;vtklibproj;vtkGeovisCore;/usr/local/lib/libhdf5.dylib;/usr/local/lib/libsz.dylib;/usr/lib/libdl.dylib;/usr/lib/libm.dylib;/usr/local/lib/libhdf5_hl.dylib;vtkIOAMR;vtkIOAsynchronous;vtkpugixml;vtkIOCityGML;vtkIOEnSight;/usr/local/lib/libnetcdf.dylib;vtkexodusII;vtkIOExodus;vtkgl2ps;vtkRenderingGL2PSOpenGL2;vtkIOExport;vtkIOExportOpenGL2;vtklibharu;vtkIOExportPDF;vtkIOGeometry;vtkIOImport;/usr/lib/libxml2.dylib;vtkIOInfovis;vtkIOLSDyna;vtkIOMINC;vtkogg;vtktheora;vtkIOMovie;vtkIONetCDF;vtkIOPLY;vtkjsoncpp;vtkIOParallel;vtkIOParallelXML;vtkIOSegY;vtkIOTecplotTable;vtkIOVeraOut;vtkIOVideo;vtkImagingMath;vtkImagingMorphological;vtkImagingStatistics;vtkImagingStencil;vtkInfovisBoostGraphAlgorithms;vtkInteractionImage;vtkPythonContext2D;vtkRenderingContextOpenGL2;vtkRenderingFreeTypeFontConfig;vtkRenderingImage;vtkRenderingLOD;vtkRenderingLabel;vtkRenderingQt;vtkRenderingVolumeOpenGL2;vtkViewsContext2D;vtkViewsInfovis;vtkViewsQt  
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/zhi/Desktop/PCLtest/cmake-build-debug

make后输出:

Scanning dependencies of target PCLtest
[ 50%] Building CXX object CMakeFiles/PCLtest.dir/main.cpp.o
[100%] Linking CXX executable PCLtest
[100%] Built target PCLtest

编译成功后,运行工程:

./pcd_write_test

运行结果:

Saved 5 data points to test_pcd.pcd.
    0.0080142 0.694695 -0.26015
    -0.342265 -0.446349 0.214207
    0.173687 -0.84253 -0.400481
    -0.874475 0.706127 -0.117635
    0.908514 -0.598159 0.744714

使用CLion配置PCL

打开CLion新建工程,工程自动给出CMakeLists.txt和main.cpp,在对应文件中写入内容后运行即可

配置过程中出现的各种奇怪问题

  1. 在编译前检查是否安装cmake,若没有安装,直接brew install cmake即可
  2. 尽量使用gcc进行编译,若没有安装,直接brew install gcc(亲身验证,使用clang也可以。。。在编译过程中一直出现错误,病急乱投医,一度认为是编译器的问题)
  3. 由于mac默认c编译器为clang,如果想使用gcc编译,参考:CMake 指定gcc编译版本
export CC=/usr/local/bin/gcc #你的gcc编译器路径
export CXX=/usr/local/bin/g++
cmake /path/to/your/project
make 
  1. 整个过程中最烦心的错误出现了,搜索全网都没有找到与我出现相同错误的同学!!此时cmake是成功的,但是在make时提示出现错误:
Scanning dependencies of target pcd_write_test
[ 50%] Building CXX object CMakeFiles/pcd_write_test.dir/pcd_write.cpp.o
make[2]: *** No rule to make target `/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/Python', needed by `pcd_write_test'.  Stop.
make[1]: *** [CMakeFiles/pcd_write_test.dir/all] Error 2
make: *** [all] Error 2

解决方案(非常粗暴)找到文件夹/usr/local/Cellar/python/,发现里面只有一个文件夹3.7.4,直接将其文件夹名称改为3.7.3,问题解决文章来源地址https://www.toymoban.com/news/detail-861804.html

到了这里,关于【PCL】mac下安装PCL的安装与配置的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 【PCL】mac下安装PCL的安装与配置

    PCL官方文档 PCL(Point Cloud Library)是在吸收了前人点云相关研究基础上建立起来的大型跨平台开源C++编程库,它实现了大量点云相关的通用算法和高效数据结构,涉及到点云获取、滤波、分割、配准、检索、特征提取、识别、追踪、曲面重建、可视化等。支持多种操作系统平

    2024年04月29日
    浏览(6)
  • Core Animation实战三(图层几何学),【一步教学,一步到位

    //calculate hour hand angle //calculate minute hand angle CGFloat minsAngle = (components.minute / 60.0) * M_PI * 2.0; //calculate second hand angle CGFloat secsAngle = (components.second / 60.0) * M_PI * 2.0; //设置锚点 self.hourLabel.layer.anchorPoint =self.minuteLabel.layer.anchorPoint =self.secondLabel.layer.anchorPoint = CGPointMake(0.5f, 0.9f); //r

    2024年04月25日
    浏览(9)
  • CGAL的三角网格曲面脊线和脐点的近似计算(需要微分几何学的知识)

             脊线(Ridges) :在光滑曲面上,脊线是一种特殊的曲线。沿着这条曲线,曲面的一个主曲率在其曲率线上达到极值(最大或最小)。这意味着脊线是那些曲率发生突变的区域,它们在形状感知、物体识别和计算机图形学中都有重要的应用。         脐点(U

    2024年02月03日
    浏览(13)
  • 【生物力学】《人体骨肌系统生物力学》- 王成焘老师 - 第2章 - 人体几何学测量与仿真建模

    第1章 回到目录 第3章 人体测量学 (anthropometry) 是人类学的一个分支学科,旨在通过对人体整体和局部测量,探讨人体的类型、特征、变异和发展规律。人体几何仿真建模是通过数字化技术构建数字化的人体模型,数字化的人体模型能够精确地再现人体复杂的三维结构,其应用

    2024年02月10日
    浏览(15)
  • 【python中对点云PCL库的下载安装与配置】

    需要的资料: python_pcl-0.3.1-cp36-cp36m-win_amd64.whl 压缩包:pcl-1.12.1-pdb-msvc2019-win64 pcl程序:PCL-1.12.1-AllInOne-msvc2019-win64 网盘链接:https://pan.baidu.com/s/184yY7fc5rqwwd9F4cMncDw 提取码:qaqa 用来检验安装是否成功的PCD文件:rabbit.pcd 文件先进行提取,提取完毕之后开始安装: 第一步:双击

    2024年02月12日
    浏览(15)
  • Windows环境下pcl点云库 安装配置全流程(精简、有效)

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 本文链接: https://blog.csdn.net/zaibeijixing/article/details/130770476 ————————————————  本文为Windows配置点云库pcl步骤,具体 win10、visual studio 2019、pcl1.11.1 。 目录 【

    2024年02月15日
    浏览(14)
  • 【Ubuntu】Ubuntu安装PCL(安装PCL/卸载PCL/查看PCL版本/PCL报错处理相关操作)(史上最详细)

    👉博__主👈:米码收割机 👉技__能👈:C++/Python语言 👉公众号👈:测试开发自动化 👉专__注👈:专注主流机器人、人工智能等相关领域的开发、测试技术 注意:执行的上述命令行,不同版本的Ubuntu,默认安装的PCL版本不同,区别如下: ubuntu版本 PCL版本 Ubuntu 20.04 1.10.0

    2024年02月12日
    浏览(12)
  • 【PCL】ubuntu20.04安装 VTK7.1与PCL1.8(PCL依赖VTK,要先装且最好源码安装)

    Ref: 源码安装 (apt安装的方式会出现.so文件缺失的情况!!!)) ubuntu16.04 安装Qt5 + VTK7.1.1 + PCL1.8.0 第二部分 Ubuntu20.04安装VTK 下载 下载地址 依赖安装 VTK安装 方法一出现的错误: make过程中出现的 错误: Could not find  a package configuration file provided by \\\"Qt5X11Extras\\\" with any of the followi

    2024年02月03日
    浏览(17)
  • Qt Creato配置PCL库

    Qt Creator中使用PCL库_业务不精er的博客-CSDN博客 Qt6.1.0中配置pcl1.11.1_qt6导入pcl库_朽一的博客-CSDN博客 VS2017 中配置QT+PCL显示点云或3D图形_pcl显示3d图tiff_桂林巡山的博客-CSDN博客 Windows10下QT+VTK+PCL环境配置(一次成功)_qt pcl_v俊逸的博客-CSDN博客 Qt配置PCL_pcl qt_Pandamahu的博客-CSDN博客

    2024年02月09日
    浏览(15)
  • Visual Studio配置PCL库

    Debug和Release的配置过程一模一样,唯一区别就在于最后一步插入的 附加依赖项不同 ,因此下面以debug为例。 1、新建一个C++空项目,模式设置为Debug,X64 2、在 源文件 内新建一个c++文件,后缀是cpp。 3、右键刚刚新建的项目(注意不是源文件),选择:属性–配置属性–调试

    2024年02月14日
    浏览(11)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包