点云PCL安装与环境配置 win10 VS2017 PCL1.9.1

文章目录

  • 1 PCL的安装
  • 2 PCL环境配置
    • 2.1 VS项目属性
      • 2.1.1 源代码
    • 2.2 CMake配置
      • 2.2.1 CMakeList.txt的书写

  • 回顾与总结,温故而知新

1 PCL的安装

  • <官网> 下载与VS版本对应的PCL

  • win下如果没有特殊需求建议直接下载ALLInOne

  • 示例:win10+VS2017+1.9.1


  • 点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第1张图片

  • 下载好后双击打开基本上一直下一步就行,然后就是PCL环境的配置
    点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第2张图片
    点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第3张图片
    点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第4张图片

  • 保存路径最好不要有中文和空格,不过有好像也没什么关系

在这里插入图片描述

点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第5张图片

点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第6张图片

点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第7张图片

  • 安装过程中会弹出OpenNI2的安装
    点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第8张图片

点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第9张图片

  • 如果上方没能成功安装OpenNI2,也可以去到D:\PCL\PCL1.9.1\3rdParty\OpenNI2路径下双击.msi文件安装
  • 记得更改安装路径为\3rdParty\OpenNI2下
    点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第10张图片
  • 安装完成
    点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第11张图片
  • 安装完可以看到PCL部分环境变量已经被设置

2 PCL环境配置

  • 主要的方法有两种:
      1. 设置系统环境变量在VS项目属性中设置库目录/链接器等
      • 优点:不用每次将dll复制进项目中
      • 缺点:安装多版本PCL时管理不便/需要每次添加属性表
      1. 利用cmake进行配置
      • 通过书写CMakeLists.txt利用cmake-gui配置
      • 优点:可指定PCL版本/可跨平台使用
      • 缺点:需要将dll复制到项目路径下(如果设置了环境变量也可以不用复制,但环境变量容易产生干扰且长度有限,能少设还是少设吧)

2.1 VS项目属性

  • 环境变量的设置
  • 如果选择用VS来设置项目属性为了避免每次都手动添加一堆库目录和链接器等,可以通过新建一个空项目,在属性管理器中新建属性表,这样别的项目需要配置PCL时,直接在属性管理器右键添加现有属性表即可。
     
  • 此电脑右键属性
    点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第12张图片

点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第13张图片

  • 在path环境变量中加上以下路径
    点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第14张图片

  • 为了方便下次复用,可以将空项目放在常用的目录下起一个简洁的名字,比如我给这个空项目起名00,这样下次使用时也比较方便寻找。

  • 点击项目管理器

  • 如果找不到属性管理器可以如下添加

  • 在项目的属性管理器下在对应release或debug版下右键添加新项目属性表
    点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第15张图片

  • 为新建的属性表取一个简洁明了的名字,如releasex64,debugwin32等等

  • 在刚刚新建的属性表右键属性
    点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第16张图片

  • VC++目录设置包含目录和库目录

  • 设置包含目录

  • 可以顺便把opencv也配置上(配不配置opencv都可以)

  • 设置库目录


  • 预处理器定义:_CRT_SECURE_NO_WARNINGS
    _SCL_SECURE_NO_WARNINGS
    _SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING


  • 以下为release版对应附加依赖项

opencv_world455.lib
pcl_common_release.lib
pcl_features_release.lib
pcl_filters_release.lib
pcl_io_ply_release.lib
pcl_io_release.lib
pcl_kdtree_release.lib
pcl_keypoints_release.lib
pcl_ml_release.lib
pcl_octree_release.lib
pcl_outofcore_release.lib
pcl_people_release.lib
pcl_recognition_release.lib
pcl_registration_release.lib
pcl_sample_consensus_release.lib
pcl_search_release.lib
pcl_segmentation_release.lib
pcl_stereo_release.lib
pcl_surface_release.lib
pcl_tracking_release.lib
pcl_visualization_release.lib
libboost_atomic-vc141-mt-x64-1_68.lib
libboost_bzip2-vc141-mt-x64-1_68.lib
libboost_chrono-vc141-mt-x64-1_68.lib
libboost_container-vc141-mt-x64-1_68.lib
libboost_context-vc141-mt-x64-1_68.lib
libboost_contract-vc141-mt-x64-1_68.lib
libboost_coroutine-vc141-mt-x64-1_68.lib
libboost_date_time-vc141-mt-x64-1_68.lib
libboost_exception-vc141-mt-x64-1_68.lib
libboost_fiber-vc141-mt-x64-1_68.lib
libboost_filesystem-vc141-mt-x64-1_68.lib
libboost_graph-vc141-mt-x64-1_68.lib
libboost_graph_parallel-vc141-mt-x64-1_68.lib
libboost_iostreams-vc141-mt-x64-1_68.lib
libboost_locale-vc141-mt-x64-1_68.lib
libboost_log-vc141-mt-x64-1_68.lib
libboost_log_setup-vc141-mt-x64-1_68.lib
libboost_math_c99-vc141-mt-x64-1_68.lib
libboost_math_c99f-vc141-mt-x64-1_68.lib
libboost_math_c99l-vc141-mt-x64-1_68.lib
libboost_math_tr1-vc141-mt-x64-1_68.lib
libboost_math_tr1f-vc141-mt-x64-1_68.lib
libboost_math_tr1l-vc141-mt-x64-1_68.lib
libboost_mpi-vc141-mt-x64-1_68.lib
libboost_numpy27-vc141-mt-x64-1_68.lib
libboost_numpy37-vc141-mt-x64-1_68.lib
libboost_prg_exec_monitor-vc141-mt-x64-1_68.lib
libboost_program_options-vc141-mt-x64-1_68.lib
libboost_python27-vc141-mt-x64-1_68.lib
libboost_python37-vc141-mt-x64-1_68.lib
libboost_random-vc141-mt-x64-1_68.lib
libboost_regex-vc141-mt-x64-1_68.lib
libboost_serialization-vc141-mt-x64-1_68.lib
libboost_signals-vc141-mt-x64-1_68.lib
libboost_stacktrace_noop-vc141-mt-x64-1_68.lib
libboost_stacktrace_windbg-vc141-mt-x64-1_68.lib
libboost_stacktrace_windbg_cached-vc141-mt-x64-1_68.lib
libboost_system-vc141-mt-x64-1_68.lib
libboost_test_exec_monitor-vc141-mt-x64-1_68.lib
libboost_thread-vc141-mt-x64-1_68.lib
libboost_timer-vc141-mt-x64-1_68.lib
libboost_type_erasure-vc141-mt-x64-1_68.lib
libboost_unit_test_framework-vc141-mt-x64-1_68.lib
libboost_wave-vc141-mt-x64-1_68.lib
libboost_wserialization-vc141-mt-x64-1_68.lib
libboost_zlib-vc141-mt-x64-1_68.lib
OpenNI2.lib
flann.lib
flann_cpp.lib
flann_cpp_s.lib
flann_s.lib
qhull.lib
qhullcpp.lib
qhullstatic.lib
qhullstatic_r.lib
qhull_p.lib
qhull_r.lib
vtkalglib-8.1.lib
vtkChartsCore-8.1.lib
vtkCommonColor-8.1.lib
vtkCommonComputationalGeometry-8.1.lib
vtkCommonCore-8.1.lib
vtkCommonDataModel-8.1.lib
vtkCommonExecutionModel-8.1.lib
vtkCommonMath-8.1.lib
vtkCommonMisc-8.1.lib
vtkCommonSystem-8.1.lib
vtkCommonTransforms-8.1.lib
vtkDICOMParser-8.1.lib
vtkDomainsChemistry-8.1.lib
vtkexoIIc-8.1.lib
vtkexpat-8.1.lib
vtkFiltersAMR-8.1.lib
vtkFiltersCore-8.1.lib
vtkFiltersExtraction-8.1.lib
vtkFiltersFlowPaths-8.1.lib
vtkFiltersGeneral-8.1.lib
vtkFiltersGeneric-8.1.lib
vtkFiltersGeometry-8.1.lib
vtkFiltersHybrid-8.1.lib
vtkFiltersHyperTree-8.1.lib
vtkFiltersImaging-8.1.lib
vtkFiltersModeling-8.1.lib
vtkFiltersParallel-8.1.lib
vtkFiltersParallelImaging-8.1.lib
vtkFiltersPoints-8.1.lib
vtkFiltersProgrammable-8.1.lib
vtkFiltersSelection-8.1.lib
vtkFiltersSMP-8.1.lib
vtkFiltersSources-8.1.lib
vtkFiltersStatistics-8.1.lib
vtkFiltersTexture-8.1.lib
vtkFiltersTopology-8.1.lib
vtkFiltersVerdict-8.1.lib
vtkfreetype-8.1.lib
vtkGeovisCore-8.1.lib
vtkgl2ps-8.1.lib
vtkhdf5-8.1.lib
vtkhdf5_hl-8.1.lib
vtkImagingColor-8.1.lib
vtkImagingCore-8.1.lib
vtkImagingFourier-8.1.lib
vtkImagingGeneral-8.1.lib
vtkImagingHybrid-8.1.lib
vtkImagingMath-8.1.lib
vtkImagingMorphological-8.1.lib
vtkImagingSources-8.1.lib
vtkImagingStatistics-8.1.lib
vtkImagingStencil-8.1.lib
vtkInfovisCore-8.1.lib
vtkInfovisLayout-8.1.lib
vtkInteractionImage-8.1.lib
vtkInteractionStyle-8.1.lib
vtkInteractionWidgets-8.1.lib
vtkIOAMR-8.1.lib
vtkIOCore-8.1.lib
vtkIOEnSight-8.1.lib
vtkIOExodus-8.1.lib
vtkIOExport-8.1.lib
vtkIOExportOpenGL-8.1.lib
vtkIOGeometry-8.1.lib
vtkIOImage-8.1.lib
vtkIOImport-8.1.lib
vtkIOInfovis-8.1.lib
vtkIOLegacy-8.1.lib
vtkIOLSDyna-8.1.lib
vtkIOMINC-8.1.lib
vtkIOMovie-8.1.lib
vtkIONetCDF-8.1.lib
vtkIOParallel-8.1.lib
vtkIOParallelXML-8.1.lib
vtkIOPLY-8.1.lib
vtkIOSQL-8.1.lib
vtkIOTecplotTable-8.1.lib
vtkIOVideo-8.1.lib
vtkIOXML-8.1.lib
vtkIOXMLParser-8.1.lib
vtkjpeg-8.1.lib
vtkjsoncpp-8.1.lib
vtklibharu-8.1.lib
vtklibxml2-8.1.lib
vtklz4-8.1.lib
vtkmetaio-8.1.lib
vtkNetCDF-8.1.lib
vtknetcdfcpp-8.1.lib
vtkoggtheora-8.1.lib
vtkParallelCore-8.1.lib
vtkpng-8.1.lib
vtkproj4-8.1.lib
vtkRenderingAnnotation-8.1.lib
vtkRenderingContext2D-8.1.lib
vtkRenderingContextOpenGL-8.1.lib
vtkRenderingCore-8.1.lib
vtkRenderingFreeType-8.1.lib
vtkRenderingGL2PS-8.1.lib
vtkRenderingImage-8.1.lib
vtkRenderingLabel-8.1.lib
vtkRenderingLIC-8.1.lib
vtkRenderingLOD-8.1.lib
vtkRenderingOpenGL-8.1.lib
vtkRenderingVolume-8.1.lib
vtkRenderingVolumeOpenGL-8.1.lib
vtksqlite-8.1.lib
vtksys-8.1.lib
vtktiff-8.1.lib
vtkverdict-8.1.lib
vtkViewsContext2D-8.1.lib
vtkViewsCore-8.1.lib
vtkViewsInfovis-8.1.lib
vtkzlib-8.1.lib
  • debug和release版基本就这里不同,上面的步骤基本和release一致
  • 以下为debug版对应附加依赖项
opencv_world455d.lib
pcl_common_debug.lib
pcl_features_debug.lib
pcl_filters_debug.lib
pcl_io_debug.lib
pcl_io_ply_debug.lib
pcl_kdtree_debug.lib
pcl_keypoints_debug.lib
pcl_ml_debug.lib
pcl_octree_debug.lib
pcl_outofcore_debug.lib
pcl_people_debug.lib
pcl_recognition_debug.lib
pcl_registration_debug.lib
pcl_sample_consensus_debug.lib
pcl_search_debug.lib
pcl_segmentation_debug.lib
pcl_stereo_debug.lib
pcl_surface_debug.lib
pcl_tracking_debug.lib
pcl_visualization_debug.lib
libboost_atomic-vc141-mt-gd-x64-1_68.lib
libboost_bzip2-vc141-mt-gd-x64-1_68.lib
libboost_chrono-vc141-mt-gd-x64-1_68.lib
libboost_container-vc141-mt-gd-x64-1_68.lib
libboost_context-vc141-mt-gd-x64-1_68.lib
libboost_contract-vc141-mt-gd-x64-1_68.lib
libboost_coroutine-vc141-mt-gd-x64-1_68.lib
libboost_date_time-vc141-mt-gd-x64-1_68.lib
libboost_exception-vc141-mt-gd-x64-1_68.lib
libboost_fiber-vc141-mt-gd-x64-1_68.lib
libboost_filesystem-vc141-mt-gd-x64-1_68.lib
libboost_graph_parallel-vc141-mt-gd-x64-1_68.lib
libboost_graph-vc141-mt-gd-x64-1_68.lib
libboost_iostreams-vc141-mt-gd-x64-1_68.lib
libboost_locale-vc141-mt-gd-x64-1_68.lib
libboost_log_setup-vc141-mt-gd-x64-1_68.lib
libboost_log-vc141-mt-gd-x64-1_68.lib
libboost_math_c99f-vc141-mt-gd-x64-1_68.lib
libboost_math_c99l-vc141-mt-gd-x64-1_68.lib
libboost_math_c99-vc141-mt-gd-x64-1_68.lib
libboost_math_tr1f-vc141-mt-gd-x64-1_68.lib
libboost_math_tr1l-vc141-mt-gd-x64-1_68.lib
libboost_math_tr1-vc141-mt-gd-x64-1_68.lib
libboost_mpi-vc141-mt-gd-x64-1_68.lib
libboost_numpy27-vc141-mt-gd-x64-1_68.lib
libboost_numpy37-vc141-mt-gd-x64-1_68.lib
libboost_program_options-vc141-mt-gd-x64-1_68.lib
libboost_prg_exec_monitor-vc141-mt-gd-x64-1_68.lib
libboost_python27-vc141-mt-gd-x64-1_68.lib
libboost_python37-vc141-mt-gd-x64-1_68.lib
libboost_random-vc141-mt-gd-x64-1_68.lib
libboost_regex-vc141-mt-gd-x64-1_68.lib
libboost_serialization-vc141-mt-gd-x64-1_68.lib
libboost_signals-vc141-mt-gd-x64-1_68.lib
libboost_stacktrace_noop-vc141-mt-gd-x64-1_68.lib
libboost_stacktrace_windbg_cached-vc141-mt-gd-x64-1_68.lib
libboost_stacktrace_windbg-vc141-mt-gd-x64-1_68.lib
libboost_system-vc141-mt-gd-x64-1_68.lib
libboost_test_exec_monitor-vc141-mt-gd-x64-1_68.lib
libboost_thread-vc141-mt-gd-x64-1_68.lib
libboost_timer-vc141-mt-gd-x64-1_68.lib
libboost_type_erasure-vc141-mt-gd-x64-1_68.lib
libboost_unit_test_framework-vc141-mt-gd-x64-1_68.lib
libboost_wave-vc141-mt-gd-x64-1_68.lib
libboost_wserialization-vc141-mt-gd-x64-1_68.lib
libboost_zlib-vc141-mt-gd-x64-1_68.lib
flann.lib
flann_cpp.lib
flann_cpp_s.lib
flann_cpp_s-gd.lib
flann_cpp-gd.lib
flann_s.lib
flann_s-gd.lib
flann-gd.lib
OpenNI2.lib
qhull.lib
qhull_d.lib
qhull_p.lib
qhull_p_d.lib
qhull_r.lib
qhull_r_d.lib
qhullcpp.lib
qhullcpp_d.lib
qhullstatic.lib
qhullstatic_d.lib
qhullstatic_r.lib
qhullstatic_r_d.lib
vtkalglib-8.1-gd.lib
vtkalglib-8.1.lib
vtkChartsCore-8.1-gd.lib
vtkChartsCore-8.1.lib
vtkCommonColor-8.1-gd.lib
vtkCommonColor-8.1.lib
vtkCommonComputationalGeometry-8.1-gd.lib
vtkCommonComputationalGeometry-8.1.lib
vtkCommonCore-8.1-gd.lib
vtkCommonCore-8.1.lib
vtkCommonDataModel-8.1-gd.lib
vtkCommonDataModel-8.1.lib
vtkCommonExecutionModel-8.1-gd.lib
vtkCommonExecutionModel-8.1.lib
vtkCommonMath-8.1-gd.lib
vtkCommonMath-8.1.lib
vtkCommonMisc-8.1-gd.lib
vtkCommonMisc-8.1.lib
vtkCommonSystem-8.1-gd.lib
vtkCommonSystem-8.1.lib
vtkCommonTransforms-8.1-gd.lib
vtkCommonTransforms-8.1.lib
vtkDICOMParser-8.1-gd.lib
vtkDICOMParser-8.1.lib
vtkDomainsChemistry-8.1-gd.lib
vtkDomainsChemistry-8.1.lib
vtkexoIIc-8.1-gd.lib
vtkexoIIc-8.1.lib
vtkexpat-8.1-gd.lib
vtkexpat-8.1.lib
vtkFiltersAMR-8.1-gd.lib
vtkFiltersAMR-8.1.lib
vtkFiltersCore-8.1-gd.lib
vtkFiltersCore-8.1.lib
vtkFiltersExtraction-8.1-gd.lib
vtkFiltersExtraction-8.1.lib
vtkFiltersFlowPaths-8.1-gd.lib
vtkFiltersFlowPaths-8.1.lib
vtkFiltersGeneral-8.1-gd.lib
vtkFiltersGeneral-8.1.lib
vtkFiltersGeneric-8.1-gd.lib
vtkFiltersGeneric-8.1.lib
vtkFiltersGeometry-8.1-gd.lib
vtkFiltersGeometry-8.1.lib
vtkFiltersHybrid-8.1-gd.lib
vtkFiltersHybrid-8.1.lib
vtkFiltersHyperTree-8.1-gd.lib
vtkFiltersHyperTree-8.1.lib
vtkFiltersImaging-8.1-gd.lib
vtkFiltersImaging-8.1.lib
vtkFiltersModeling-8.1-gd.lib
vtkFiltersModeling-8.1.lib
vtkFiltersParallel-8.1-gd.lib
vtkFiltersParallel-8.1.lib
vtkFiltersParallelImaging-8.1-gd.lib
vtkFiltersParallelImaging-8.1.lib
vtkFiltersPoints-8.1-gd.lib
vtkFiltersPoints-8.1.lib
vtkFiltersProgrammable-8.1-gd.lib
vtkFiltersProgrammable-8.1.lib
vtkFiltersSelection-8.1-gd.lib
vtkFiltersSelection-8.1.lib
vtkFiltersSMP-8.1-gd.lib
vtkFiltersSMP-8.1.lib
vtkFiltersSources-8.1-gd.lib
vtkFiltersSources-8.1.lib
vtkFiltersStatistics-8.1-gd.lib
vtkFiltersStatistics-8.1.lib
vtkFiltersTexture-8.1-gd.lib
vtkFiltersTexture-8.1.lib
vtkFiltersTopology-8.1-gd.lib
vtkFiltersTopology-8.1.lib
vtkFiltersVerdict-8.1-gd.lib
vtkFiltersVerdict-8.1.lib
vtkfreetype-8.1-gd.lib
vtkfreetype-8.1.lib
vtkGeovisCore-8.1-gd.lib
vtkGeovisCore-8.1.lib
vtkgl2ps-8.1-gd.lib
vtkgl2ps-8.1.lib
vtkhdf5-8.1-gd.lib
vtkhdf5-8.1.lib
vtkhdf5_hl-8.1-gd.lib
vtkhdf5_hl-8.1.lib
vtkImagingColor-8.1-gd.lib
vtkImagingColor-8.1.lib
vtkImagingCore-8.1-gd.lib
vtkImagingCore-8.1.lib
vtkImagingFourier-8.1-gd.lib
vtkImagingFourier-8.1.lib
vtkImagingGeneral-8.1-gd.lib
vtkImagingGeneral-8.1.lib
vtkImagingHybrid-8.1-gd.lib
vtkImagingHybrid-8.1.lib
vtkImagingMath-8.1-gd.lib
vtkImagingMath-8.1.lib
vtkImagingMorphological-8.1-gd.lib
vtkImagingMorphological-8.1.lib
vtkImagingSources-8.1-gd.lib
vtkImagingSources-8.1.lib
vtkImagingStatistics-8.1-gd.lib
vtkImagingStatistics-8.1.lib
vtkImagingStencil-8.1-gd.lib
vtkImagingStencil-8.1.lib
vtkInfovisCore-8.1-gd.lib
vtkInfovisCore-8.1.lib
vtkInfovisLayout-8.1-gd.lib
vtkInfovisLayout-8.1.lib
vtkInteractionImage-8.1-gd.lib
vtkInteractionImage-8.1.lib
vtkInteractionStyle-8.1-gd.lib
vtkInteractionStyle-8.1.lib
vtkInteractionWidgets-8.1-gd.lib
vtkInteractionWidgets-8.1.lib
vtkIOAMR-8.1-gd.lib
vtkIOAMR-8.1.lib
vtkIOCore-8.1-gd.lib
vtkIOCore-8.1.lib
vtkIOEnSight-8.1-gd.lib
vtkIOEnSight-8.1.lib
vtkIOExodus-8.1-gd.lib
vtkIOExodus-8.1.lib
vtkIOExport-8.1-gd.lib
vtkIOExport-8.1.lib
vtkIOExportOpenGL-8.1-gd.lib
vtkIOExportOpenGL-8.1.lib
vtkIOGeometry-8.1-gd.lib
vtkIOGeometry-8.1.lib
vtkIOImage-8.1-gd.lib
vtkIOImage-8.1.lib
vtkIOImport-8.1-gd.lib
vtkIOImport-8.1.lib
vtkIOInfovis-8.1-gd.lib
vtkIOInfovis-8.1.lib
vtkIOLegacy-8.1-gd.lib
vtkIOLegacy-8.1.lib
vtkIOLSDyna-8.1-gd.lib
vtkIOLSDyna-8.1.lib
vtkIOMINC-8.1-gd.lib
vtkIOMINC-8.1.lib
vtkIOMovie-8.1-gd.lib
vtkIOMovie-8.1.lib
vtkIONetCDF-8.1-gd.lib
vtkIONetCDF-8.1.lib
vtkIOParallel-8.1-gd.lib
vtkIOParallel-8.1.lib
vtkIOParallelXML-8.1-gd.lib
vtkIOParallelXML-8.1.lib
vtkIOPLY-8.1-gd.lib
vtkIOPLY-8.1.lib
vtkIOSQL-8.1-gd.lib
vtkIOSQL-8.1.lib
vtkIOTecplotTable-8.1-gd.lib
vtkIOTecplotTable-8.1.lib
vtkIOVideo-8.1-gd.lib
vtkIOVideo-8.1.lib
vtkIOXML-8.1-gd.lib
vtkIOXML-8.1.lib
vtkIOXMLParser-8.1-gd.lib
vtkIOXMLParser-8.1.lib
vtkjpeg-8.1-gd.lib
vtkjpeg-8.1.lib
vtkjsoncpp-8.1-gd.lib
vtkjsoncpp-8.1.lib
vtklibharu-8.1-gd.lib
vtklibharu-8.1.lib
vtklibxml2-8.1-gd.lib
vtklibxml2-8.1.lib
vtklz4-8.1-gd.lib
vtklz4-8.1.lib
vtkmetaio-8.1-gd.lib
vtkmetaio-8.1.lib
vtkNetCDF-8.1-gd.lib
vtkNetCDF-8.1.lib
vtknetcdfcpp-8.1-gd.lib
vtknetcdfcpp-8.1.lib
vtkoggtheora-8.1-gd.lib
vtkoggtheora-8.1.lib
vtkParallelCore-8.1-gd.lib
vtkParallelCore-8.1.lib
vtkpng-8.1-gd.lib
vtkpng-8.1.lib
vtkproj4-8.1-gd.lib
vtkproj4-8.1.lib
vtkRenderingAnnotation-8.1-gd.lib
vtkRenderingAnnotation-8.1.lib
vtkRenderingContext2D-8.1-gd.lib
vtkRenderingContext2D-8.1.lib
vtkRenderingContextOpenGL-8.1-gd.lib
vtkRenderingContextOpenGL-8.1.lib
vtkRenderingCore-8.1-gd.lib
vtkRenderingCore-8.1.lib
vtkRenderingFreeType-8.1-gd.lib
vtkRenderingFreeType-8.1.lib
vtkRenderingGL2PS-8.1-gd.lib
vtkRenderingGL2PS-8.1.lib
vtkRenderingImage-8.1-gd.lib
vtkRenderingImage-8.1.lib
vtkRenderingLabel-8.1-gd.lib
vtkRenderingLabel-8.1.lib
vtkRenderingLIC-8.1-gd.lib
vtkRenderingLIC-8.1.lib
vtkRenderingLOD-8.1-gd.lib
vtkRenderingLOD-8.1.lib
vtkRenderingOpenGL-8.1-gd.lib
vtkRenderingOpenGL-8.1.lib
vtkRenderingVolume-8.1-gd.lib
vtkRenderingVolume-8.1.lib
vtkRenderingVolumeOpenGL-8.1-gd.lib
vtkRenderingVolumeOpenGL-8.1.lib
vtksqlite-8.1-gd.lib
vtksqlite-8.1.lib
vtksys-8.1-gd.lib
vtksys-8.1.lib
vtktiff-8.1-gd.lib
vtktiff-8.1.lib
vtkverdict-8.1-gd.lib
vtkverdict-8.1.lib
vtkViewsContext2D-8.1-gd.lib
vtkViewsContext2D-8.1.lib
vtkViewsCore-8.1-gd.lib
vtkViewsCore-8.1.lib
vtkViewsInfovis-8.1-gd.lib
vtkViewsInfovis-8.1.lib
vtkzlib-8.1-gd.lib
vtkzlib-8.1.lib
  • 在自己的项目下添加对应属性表
    点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第17张图片
    点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第18张图片

2.1.1 源代码

  • 安装了PCL后在安装路径的\share\doc\pcl-1.9\tutorials\sources下有许多官方提供的源码,尝试复制运行
  • 如share\doc\pcl-1.9\tutorials\sources\pcd_read文件
#include 
#include 
#include 

int
main (int argc, char** argv)
{
  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);

  if (pcl::io::loadPCDFile<pcl::PointXYZ> ("test_pcd.pcd", *cloud) == -1) //* load the file
  {
    PCL_ERROR ("Couldn't read file test_pcd.pcd \n");
    return (-1);
  }
  std::cout << "Loaded "
            << cloud->width * cloud->height
            << " data points from test_pcd.pcd with the following fields: "
            << std::endl;
  for (size_t i = 0; i < cloud->points.size (); ++i)
    std::cout << "    " << cloud->points[i].x
              << " "    << cloud->points[i].y
              << " "    << cloud->points[i].z << std::endl;

  return (0);
}
  • 能运行出结果配置就基本成功了

2.2 CMake配置

2.2.1 CMakeList.txt的书写

  • 以pcd_read文件为例,主要包含以下几个部分
# 指定cmake的最低版本
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

# 设置项目工程名称
project(pcd_read)

# 查找指定的库文件 如这里是PCL库最低可使用版本为1.2
find_package(PCL 1.2 REQUIRED)

# 设置包含的目录
include_directories(${PCL_INCLUDE_DIRS})
# 设置链接库搜索目录
link_directories(${PCL_LIBRARY_DIRS})
# 设置C++预编译选项
add_definitions(${PCL_DEFINITIONS})

# 生成可执行文件
add_executable (pcd_read pcd_read.cpp)
# 设置目标需要链接的库 win下系统会根据链接库目录,搜索xxx.lib 文件
target_link_libraries (pcd_read ${PCL_LIBRARIES})

关于cmakelist的书写可以参考这位博主的博客讲得很详细

# 1. 指定 cmake 的最小版本
cmake_minimum_required(VERSION 3.4.1)
# 2. 设置项目名称
project(demo)
# 引入两个变量 demo_BINARY_DIR 和 demo_SOURCE_DIR
# 两个等价变量 PROJECT_BINARY_DIR 和 PROJECT_SOURCE_DIR
# 3. 设置编译类型
add_executable(demo demo.cpp) # 生成可执行文件
add_library(common STATIC util.cpp) # 生成静态库
add_library(common SHARED util.cpp) # 生成动态库或共享库
# 4. 指定编译包含的源文件
# 4.1 明确指定包含哪些源文件
add_library(demo demo.cpp test.cpp util.cpp)
# 4.2 搜索所有的 cpp 文件
aux_source_directory(. SRC_LIST) # 搜索当前目录下的所有.cpp文件
add_library(demo ${SRC_LIST})
# 4.3 自定义搜索规则
file(GLOB SRC_LIST "*.cpp" "protocol/*.cpp")
add_library(demo ${SRC_LIST})
# 或者
file(GLOB SRC_LIST "*.cpp")
file(GLOB SRC_PROTOCOL_LIST "protocol/*.cpp")
add_library(demo ${SRC_LIST} ${SRC_PROTOCOL_LIST})
# 或者
file(GLOB_RECURSE SRC_LIST "*.cpp") #递归搜索
FILE(GLOB SRC_PROTOCOL RELATIVE "protocol" "*.cpp") # 相对protocol目录下搜索
add_library(demo ${SRC_LIST} ${SRC_PROTOCOL_LIST})
# 或者
aux_source_directory(. SRC_LIST)
aux_source_directory(protocol SRC_PROTOCOL_LIST)
add_library(demo ${SRC_LIST} ${SRC_PROTOCOL_LIST})
# 5. 查找指定的库文件
# 类似的命令find_file()find_path()find_program()find_package()
find_library( # Sets the name of the path variable.
              log-lib
 
              # Specifies the name of the NDK library that
              # you want CMake to locate.
              log )
# 6. 设置包含的目录
include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_BINARY_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/include
)
# Linux下还可以
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}")
# 7. 设置链接库搜索目录
link_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}/libs
)
# 8. 设置 target 需要链接的库
target_link_libraries( # 目标库
                       demo
 
                       # 目标库需要链接的库
                       # log-lib 是上面 find_library 指定的变量名
                       ${log-lib} )
# 8.1 指定链接动态库或静态库
target_link_libraries(demo libface.a) # 链接libface.a
target_link_libraries(demo libface.so) # 链接libface.so
# 8.2 指定全路径
target_link_libraries(demo ${CMAKE_CURRENT_SOURCE_DIR}/libs/libface.a)
target_link_libraries(demo ${CMAKE_CURRENT_SOURCE_DIR}/libs/libface.so)
# 8.3 指定链接多个库
target_link_libraries(demo
    ${CMAKE_CURRENT_SOURCE_DIR}/libs/libface.a
    boost_system.a
    boost_thread
    pthread)
# 9 设置变量
# 9.1 set 直接设置变量的值
set(SRC_LIST main.cpp test.cpp)
add_executable(demo ${SRC_LIST})
# 9.2 set 追加设置变量的值
set(SRC_LIST main.cpp)
set(SRC_LIST ${SRC_LIST} test.cpp)
add_executable(demo ${SRC_LIST})
# 9.3 list 追加或者删除变量的值
set(SRC_LIST main.cpp)
list(APPEND SRC_LIST test.cpp)
list(REMOVE_ITEM SRC_LIST main.cpp)
add_executable(demo ${SRC_LIST})
  • 以PCL1.8.1\share\doc\pcl-1.8\tutorials\sources\bspline_fitting为例(我安装了多个版本的PCL)


点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第19张图片



点云PCL安装与环境配置 win10 VS2017 PCL1.9.1_第20张图片

你可能感兴趣的:(点云,c++,windows,计算机视觉)