【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】

【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】

一、在github下载pclALLINone的安装包

1、github搜索pcl,找到 PointCloudLibrary / pcl

【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第1张图片

2、选择master->Tags->View all Tags

【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第2张图片

3、选择pcl-1.12.1

【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第3张图片

4、下载AllInOne的.exe和pdb文件

【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第4张图片

二、安装

1、用管理员权限打开.exe文件

【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第5张图片
根据引导安装即可
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第6张图片

【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第7张图片
这里选择如下

【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第8张图片
选择路径
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第9张图片
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第10张图片
PCL和第三方库
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第11张图片

【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第12张图片
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第13张图片

2、复制pdb文件到PCL安装目录下的bin文件夹

解压zip
在这里插入图片描述
全选文件,复制到C:\Program Files\PCL 1.12.1\bin
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第14张图片

3、OpenNI2 重新安装

在安装目录下会有pcl的文件夹还有依赖库OpenNI2的文件夹,这是OpenNI2 没装好

【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第15张图片
进到这个目录下面C:\Program Files\PCL 1.12.1\3rdParty\OpenNI2,找OpenNI-Windows-x64-2.2.msi
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第16张图片
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第17张图片

先remove一下 然后再打开一次 OpenNI-Windows-x64-2.2.msi
重新安装到进到这个目录下面C:\Program Files\PCL 1.12.1\3rdParty\OpenNI2 的这个目录下面

三、系统环境变量的配置

我以前安装的时候做了关于环境变量的配置,但是这次安装之前,我把系统变量path的空间 腾出来了之后
参考这条经验
发现只要在安装pcl的时候选择了 自动加入系统变量path 就可以了
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第18张图片
OPENNI2的变量也是安装的时候自己添加到系统变量中的;
然后pcl的变量是在path里面
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第19张图片
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第20张图片
红色的是安装自己添加的 蓝色的是我自己添加的 还是在后面的测试中发现了一些问题 然后考虑加进来的
这个视情况而定

四、Visual Studio 2019相关的配置

新建一个项目叫pcl_test吧 然后要做的工作是配置Debug和release的属性表(都是x64的)
然后新建一个cpp 用一段demo测试一下能不能读取点云

新建 属性表

   分别新建两个属性表,一个pcl_debug 一个pcl_release 这样以后每次配环境  都只要把他们按照需求加进来就好了

方法如下:

右键选择“添加新项目属性表”
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第21张图片
分别添加这两个新的属性表
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第22张图片
然后右键新建的属性表,选择属性
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第23张图片
新建的属性表属性要添加是包含目录、库目录,以及链接器中输入里面的附加依赖项
其中 debug、release的包含目录还有库目录添加的东西都是一样的,但是附加依赖项有区别 我在后面给出
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第24张图片
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第25张图片

包含目录

C:\Program Files\PCL 1.12.1\3rdParty\Eigen\eigen3;C:\Program Files\PCL 1.12.1\3rdParty\FLANN\include;C:\Program Files\PCL 1.12.1\3rdParty\VTK\include\vtk-9.1;C:\Program Files\PCL 1.12.1\3rdParty\Qhull\include;C:\Program Files\PCL 1.12.1\include\pcl-1.12;C:\Program Files\PCL 1.12.1\3rdParty\Boost\include\boost-1_78;C:\Program Files\PCL 1.12.1\3rdParty\OpenNI2\Include

库目录

C:\Program Files\PCL 1.12.1\3rdParty\Boost\lib;C:\Program Files\PCL 1.12.1\3rdParty\FLANN\lib;C:\Program Files\PCL 1.12.1\3rdParty\OpenNI2\Lib;C:\Program Files\PCL 1.12.1\3rdParty\Qhull\lib;C:\Program Files\PCL 1.12.1\3rdParty\VTK\lib;C:\Program Files\PCL 1.12.1\lib

debug lib文件表

pcl_commond.lib
pcl_featuresd.lib
pcl_filtersd.lib
pcl_iod.lib
pcl_io_plyd.lib
pcl_kdtreed.lib
pcl_keypointsd.lib
pcl_mld.lib
pcl_octreed.lib
pcl_outofcored.lib
pcl_peopled.lib
pcl_recognitiond.lib
pcl_registrationd.lib
pcl_sample_consensusd.lib
pcl_searchd.lib
pcl_segmentationd.lib
pcl_stereod.lib
pcl_surfaced.lib
pcl_trackingd.lib
pcl_visualizationd.lib
libboost_atomic-vc142-mt-gd-x64-1_78.lib
libboost_bzip2-vc142-mt-gd-x64-1_78.lib
libboost_chrono-vc142-mt-gd-x64-1_78.lib
libboost_container-vc142-mt-gd-x64-1_78.lib
libboost_context-vc142-mt-gd-x64-1_78.lib
libboost_contract-vc142-mt-gd-x64-1_78.lib
libboost_coroutine-vc142-mt-gd-x64-1_78.lib
libboost_date_time-vc142-mt-gd-x64-1_78.lib
libboost_exception-vc142-mt-gd-x64-1_78.lib
libboost_filesystem-vc142-mt-gd-x64-1_78.lib
libboost_graph-vc142-mt-gd-x64-1_78.lib
libboost_graph_parallel-vc142-mt-gd-x64-1_78.lib
libboost_iostreams-vc142-mt-gd-x64-1_78.lib
libboost_json-vc142-mt-gd-x64-1_78.lib
libboost_locale-vc142-mt-gd-x64-1_78.lib
libboost_log-vc142-mt-gd-x64-1_78.lib
libboost_log_setup-vc142-mt-gd-x64-1_78.lib
libboost_math_c99-vc142-mt-gd-x64-1_78.lib
libboost_math_c99f-vc142-mt-gd-x64-1_78.lib
libboost_math_c99l-vc142-mt-gd-x64-1_78.lib
libboost_math_tr1-vc142-mt-gd-x64-1_78.lib
libboost_math_tr1f-vc142-mt-gd-x64-1_78.lib
libboost_math_tr1l-vc142-mt-gd-x64-1_78.lib
libboost_mpi-vc142-mt-gd-x64-1_78.lib
libboost_nowide-vc142-mt-gd-x64-1_78.lib
libboost_numpy38-vc142-mt-gd-x64-1_78.lib
libboost_prg_exec_monitor-vc142-mt-gd-x64-1_78.lib
libboost_program_options-vc142-mt-gd-x64-1_78.lib
libboost_python38-vc142-mt-gd-x64-1_78.lib
libboost_random-vc142-mt-gd-x64-1_78.lib
libboost_regex-vc142-mt-gd-x64-1_78.lib
libboost_serialization-vc142-mt-gd-x64-1_78.lib
libboost_system-vc142-mt-gd-x64-1_78.lib
libboost_test_exec_monitor-vc142-mt-gd-x64-1_78.lib
libboost_thread-vc142-mt-gd-x64-1_78.lib
libboost_timer-vc142-mt-gd-x64-1_78.lib
libboost_type_erasure-vc142-mt-gd-x64-1_78.lib
libboost_unit_test_framework-vc142-mt-gd-x64-1_78.lib
libboost_wave-vc142-mt-gd-x64-1_78.lib
libboost_wserialization-vc142-mt-gd-x64-1_78.lib
libboost_zlib-vc142-mt-gd-x64-1_78.lib
flann-gd.lib
flann_cpp-gd.lib
flann_cpp_s-gd.lib
flann_s-gd.lib
OpenNI2.lib
qhullcpp_d.lib
qhullstatic_d.lib
qhullstatic_rd.lib
qhull_rd.lib
vtkcgns-9.1d.lib
vtkChartsCore-9.1d.lib
vtkCommonColor-9.1d.lib
vtkCommonComputationalGeometry-9.1d.lib
vtkCommonCore-9.1d.lib
vtkCommonDataModel-9.1d.lib
vtkCommonExecutionModel-9.1d.lib
vtkCommonMath-9.1d.lib
vtkCommonMisc-9.1d.lib
vtkCommonSystem-9.1d.lib
vtkCommonTransforms-9.1d.lib
vtkDICOMParser-9.1d.lib
vtkDomainsChemistry-9.1d.lib
vtkDomainsChemistryOpenGL2-9.1d.lib
vtkdoubleconversion-9.1d.lib
vtkexodusII-9.1d.lib
vtkexpat-9.1d.lib
vtkFiltersAMR-9.1d.lib
vtkFiltersCore-9.1d.lib
vtkFiltersExtraction-9.1d.lib
vtkFiltersFlowPaths-9.1d.lib
vtkFiltersGeneral-9.1d.lib
vtkFiltersGeneric-9.1d.lib
vtkFiltersGeometry-9.1d.lib
vtkFiltersHybrid-9.1d.lib
vtkFiltersHyperTree-9.1d.lib
vtkFiltersImaging-9.1d.lib
vtkFiltersModeling-9.1d.lib
vtkFiltersParallel-9.1d.lib
vtkFiltersParallelImaging-9.1d.lib
vtkFiltersPoints-9.1d.lib
vtkFiltersProgrammable-9.1d.lib
vtkFiltersSelection-9.1d.lib
vtkFiltersSMP-9.1d.lib
vtkFiltersSources-9.1d.lib
vtkFiltersStatistics-9.1d.lib
vtkFiltersTexture-9.1d.lib
vtkFiltersTopology-9.1d.lib
vtkFiltersVerdict-9.1d.lib
vtkfmt-9.1d.lib
vtkfreetype-9.1d.lib
vtkGeovisCore-9.1d.lib
vtkgl2ps-9.1d.lib
vtkglew-9.1d.lib
vtkhdf5-9.1d.lib
vtkhdf5_hl-9.1d.lib
vtkImagingColor-9.1d.lib
vtkImagingCore-9.1d.lib
vtkImagingFourier-9.1d.lib
vtkImagingGeneral-9.1d.lib
vtkImagingHybrid-9.1d.lib
vtkImagingMath-9.1d.lib
vtkImagingMorphological-9.1d.lib
vtkImagingSources-9.1d.lib
vtkImagingStatistics-9.1d.lib
vtkImagingStencil-9.1d.lib
vtkInfovisCore-9.1d.lib
vtkInfovisLayout-9.1d.lib
vtkInteractionImage-9.1d.lib
vtkInteractionStyle-9.1d.lib
vtkInteractionWidgets-9.1d.lib
vtkIOAMR-9.1d.lib
vtkIOAsynchronous-9.1d.lib
vtkIOCGNSReader-9.1d.lib
vtkIOChemistry-9.1d.lib
vtkIOCityGML-9.1d.lib
vtkIOCONVERGECFD-9.1d.lib
vtkIOCore-9.1d.lib
vtkIOEnSight-9.1d.lib
vtkIOExodus-9.1d.lib
vtkIOExport-9.1d.lib
vtkIOExportGL2PS-9.1d.lib
vtkIOExportPDF-9.1d.lib
vtkIOGeometry-9.1d.lib
vtkIOHDF-9.1d.lib
vtkIOImage-9.1d.lib
vtkIOImport-9.1d.lib
vtkIOInfovis-9.1d.lib
vtkIOIOSS-9.1d.lib
vtkIOLegacy-9.1d.lib
vtkIOLSDyna-9.1d.lib
vtkIOMINC-9.1d.lib
vtkIOMotionFX-9.1d.lib
vtkIOMovie-9.1d.lib
vtkIONetCDF-9.1d.lib
vtkIOOggTheora-9.1d.lib
vtkIOParallel-9.1d.lib
vtkIOParallelXML-9.1d.lib
vtkIOPLY-9.1d.lib
vtkIOSegY-9.1d.lib
vtkIOSQL-9.1d.lib
vtkioss-9.1d.lib
vtkIOTecplotTable-9.1d.lib
vtkIOVeraOut-9.1d.lib
vtkIOVideo-9.1d.lib
vtkIOXML-9.1d.lib
vtkIOXMLParser-9.1d.lib
vtkjpeg-9.1d.lib
vtkjsoncpp-9.1d.lib
vtkkissfft-9.1d.lib
vtklibharu-9.1d.lib
vtklibproj-9.1d.lib
vtklibxml2-9.1d.lib
vtkloguru-9.1d.lib
vtklz4-9.1d.lib
vtklzma-9.1d.lib
vtkmetaio-9.1d.lib
vtknetcdf-9.1d.lib
vtkogg-9.1d.lib
vtkParallelCore-9.1d.lib
vtkParallelDIY-9.1d.lib
vtkpng-9.1d.lib
vtkpugixml-9.1d.lib
vtkRenderingAnnotation-9.1d.lib
vtkRenderingContext2D-9.1d.lib
vtkRenderingContextOpenGL2-9.1d.lib
vtkRenderingCore-9.1d.lib
vtkRenderingFreeType-9.1d.lib
vtkRenderingGL2PSOpenGL2-9.1d.lib
vtkRenderingImage-9.1d.lib
vtkRenderingLabel-9.1d.lib
vtkRenderingLOD-9.1d.lib
vtkRenderingOpenGL2-9.1d.lib
vtkRenderingSceneGraph-9.1d.lib
vtkRenderingUI-9.1d.lib
vtkRenderingVolume-9.1d.lib
vtkRenderingVolumeOpenGL2-9.1d.lib
vtkRenderingVtkJS-9.1d.lib
vtksqlite-9.1d.lib
vtksys-9.1d.lib
vtkTestingRendering-9.1d.lib
vtktheora-9.1d.lib
vtktiff-9.1d.lib
vtkverdict-9.1d.lib
vtkViewsContext2D-9.1d.lib
vtkViewsCore-9.1d.lib
vtkViewsInfovis-9.1d.lib
vtkWrappingTools-9.1d.lib
vtkzlib-9.1d.lib

release lib文件列表

pcl_common.lib
pcl_features.lib
pcl_filters.lib
pcl_io.lib
pcl_io_ply.lib
pcl_kdtree.lib
pcl_keypoints.lib
pcl_ml.lib
pcl_octree.lib
pcl_outofcore.lib
pcl_people.lib
pcl_recognition.lib
pcl_registration.lib
pcl_sample_consensus.lib
pcl_search.lib
pcl_segmentation.lib
pcl_stereo.lib
pcl_surface.lib
pcl_tracking.lib
pcl_visualization.lib
libboost_atomic-vc142-mt-x64-1_78.lib
libboost_bzip2-vc142-mt-x64-1_78.lib
libboost_chrono-vc142-mt-x64-1_78.lib
libboost_container-vc142-mt-x64-1_78.lib
libboost_context-vc142-mt-x64-1_78.lib
libboost_contract-vc142-mt-x64-1_78.lib
libboost_coroutine-vc142-mt-x64-1_78.lib
libboost_date_time-vc142-mt-x64-1_78.lib
libboost_exception-vc142-mt-x64-1_78.lib
libboost_filesystem-vc142-mt-x64-1_78.lib
libboost_graph-vc142-mt-x64-1_78.lib
libboost_graph_parallel-vc142-mt-x64-1_78.lib
libboost_iostreams-vc142-mt-x64-1_78.lib
libboost_json-vc142-mt-x64-1_78.lib
libboost_locale-vc142-mt-x64-1_78.lib
libboost_log-vc142-mt-x64-1_78.lib
libboost_log_setup-vc142-mt-x64-1_78.lib
libboost_math_c99-vc142-mt-x64-1_78.lib
libboost_math_c99f-vc142-mt-x64-1_78.lib
libboost_math_c99l-vc142-mt-x64-1_78.lib
libboost_math_tr1-vc142-mt-x64-1_78.lib
libboost_math_tr1f-vc142-mt-x64-1_78.lib
libboost_math_tr1l-vc142-mt-x64-1_78.lib
libboost_mpi-vc142-mt-x64-1_78.lib
libboost_nowide-vc142-mt-x64-1_78.lib
libboost_numpy38-vc142-mt-x64-1_78.lib
libboost_prg_exec_monitor-vc142-mt-x64-1_78.lib
libboost_program_options-vc142-mt-x64-1_78.lib
libboost_python38-vc142-mt-x64-1_78.lib
libboost_random-vc142-mt-x64-1_78.lib
libboost_regex-vc142-mt-x64-1_78.lib
libboost_serialization-vc142-mt-x64-1_78.lib
libboost_system-vc142-mt-x64-1_78.lib
libboost_test_exec_monitor-vc142-mt-x64-1_78.lib
libboost_thread-vc142-mt-x64-1_78.lib
libboost_timer-vc142-mt-x64-1_78.lib
libboost_type_erasure-vc142-mt-x64-1_78.lib
libboost_unit_test_framework-vc142-mt-x64-1_78.lib
libboost_wave-vc142-mt-x64-1_78.lib
libboost_wserialization-vc142-mt-x64-1_78.lib
libboost_zlib-vc142-mt-x64-1_78.lib
flann.lib
flann_cpp.lib
flann_cpp_s.lib
flann_s.lib
OpenNI2.lib
qhullcpp.lib
qhullstatic.lib
qhullstatic_r.lib
qhull_r.lib
vtkcgns-9.1.lib
vtkChartsCore-9.1.lib
vtkCommonColor-9.1.lib
vtkCommonComputationalGeometry-9.1.lib
vtkCommonCore-9.1.lib
vtkCommonDataModel-9.1.lib
vtkCommonExecutionModel-9.1.lib
vtkCommonMath-9.1.lib
vtkCommonMisc-9.1.lib
vtkCommonSystem-9.1.lib
vtkCommonTransforms-9.1.lib
vtkDICOMParser-9.1.lib
vtkDomainsChemistry-9.1.lib
vtkDomainsChemistryOpenGL2-9.1.lib
vtkdoubleconversion-9.1.lib
vtkexodusII-9.1.lib
vtkexpat-9.1.lib
vtkFiltersAMR-9.1.lib
vtkFiltersCore-9.1.lib
vtkFiltersExtraction-9.1.lib
vtkFiltersFlowPaths-9.1.lib
vtkFiltersGeneral-9.1.lib
vtkFiltersGeneric-9.1.lib
vtkFiltersGeometry-9.1.lib
vtkFiltersHybrid-9.1.lib
vtkFiltersHyperTree-9.1.lib
vtkFiltersImaging-9.1.lib
vtkFiltersModeling-9.1.lib
vtkFiltersParallel-9.1.lib
vtkFiltersParallelImaging-9.1.lib
vtkFiltersPoints-9.1.lib
vtkFiltersProgrammable-9.1.lib
vtkFiltersSelection-9.1.lib
vtkFiltersSMP-9.1.lib
vtkFiltersSources-9.1.lib
vtkFiltersStatistics-9.1.lib
vtkFiltersTexture-9.1.lib
vtkFiltersTopology-9.1.lib
vtkFiltersVerdict-9.1.lib
vtkfmt-9.1.lib
vtkfreetype-9.1.lib
vtkGeovisCore-9.1.lib
vtkgl2ps-9.1.lib
vtkglew-9.1.lib
vtkhdf5-9.1.lib
vtkhdf5_hl-9.1.lib
vtkImagingColor-9.1.lib
vtkImagingCore-9.1.lib
vtkImagingFourier-9.1.lib
vtkImagingGeneral-9.1.lib
vtkImagingHybrid-9.1.lib
vtkImagingMath-9.1.lib
vtkImagingMorphological-9.1.lib
vtkImagingSources-9.1.lib
vtkImagingStatistics-9.1.lib
vtkImagingStencil-9.1.lib
vtkInfovisCore-9.1.lib
vtkInfovisLayout-9.1.lib
vtkInteractionImage-9.1.lib
vtkInteractionStyle-9.1.lib
vtkInteractionWidgets-9.1.lib
vtkIOAMR-9.1.lib
vtkIOAsynchronous-9.1.lib
vtkIOCGNSReader-9.1.lib
vtkIOChemistry-9.1.lib
vtkIOCityGML-9.1.lib
vtkIOCONVERGECFD-9.1.lib
vtkIOCore-9.1.lib
vtkIOEnSight-9.1.lib
vtkIOExodus-9.1.lib
vtkIOExport-9.1.lib
vtkIOExportGL2PS-9.1.lib
vtkIOExportPDF-9.1.lib
vtkIOGeometry-9.1.lib
vtkIOHDF-9.1.lib
vtkIOImage-9.1.lib
vtkIOImport-9.1.lib
vtkIOInfovis-9.1.lib
vtkIOIOSS-9.1.lib
vtkIOLegacy-9.1.lib
vtkIOLSDyna-9.1.lib
vtkIOMINC-9.1.lib
vtkIOMotionFX-9.1.lib
vtkIOMovie-9.1.lib
vtkIONetCDF-9.1.lib
vtkIOOggTheora-9.1.lib
vtkIOParallel-9.1.lib
vtkIOParallelXML-9.1.lib
vtkIOPLY-9.1.lib
vtkIOSegY-9.1.lib
vtkIOSQL-9.1.lib
vtkioss-9.1.lib
vtkIOTecplotTable-9.1.lib
vtkIOVeraOut-9.1.lib
vtkIOVideo-9.1.lib
vtkIOXML-9.1.lib
vtkIOXMLParser-9.1.lib
vtkjpeg-9.1.lib
vtkjsoncpp-9.1.lib
vtkkissfft-9.1.lib
vtklibharu-9.1.lib
vtklibproj-9.1.lib
vtklibxml2-9.1.lib
vtkloguru-9.1.lib
vtklz4-9.1.lib
vtklzma-9.1.lib
vtkmetaio-9.1.lib
vtknetcdf-9.1.lib
vtkogg-9.1.lib
vtkParallelCore-9.1.lib
vtkParallelDIY-9.1.lib
vtkpng-9.1.lib
vtkpugixml-9.1.lib
vtkRenderingAnnotation-9.1.lib
vtkRenderingContext2D-9.1.lib
vtkRenderingContextOpenGL2-9.1.lib
vtkRenderingCore-9.1.lib
vtkRenderingFreeType-9.1.lib
vtkRenderingGL2PSOpenGL2-9.1.lib
vtkRenderingImage-9.1.lib
vtkRenderingLabel-9.1.lib
vtkRenderingLOD-9.1.lib
vtkRenderingOpenGL2-9.1.lib
vtkRenderingSceneGraph-9.1.lib
vtkRenderingUI-9.1.lib
vtkRenderingVolume-9.1.lib
vtkRenderingVolumeOpenGL2-9.1.lib
vtkRenderingVtkJS-9.1.lib
vtksqlite-9.1.lib
vtksys-9.1.lib
vtkTestingRendering-9.1.lib
vtktheora-9.1.lib
vtktiff-9.1.lib
vtkverdict-9.1.lib
vtkViewsContext2D-9.1.lib
vtkViewsCore-9.1.lib
vtkViewsInfovis-9.1.lib
vtkWrappingTools-9.1.lib
vtkzlib-9.1.lib

五,测试Demo

项目下新建cpp文件,使用以下的代码测试
代码中使用的点云数据我分享在百度云盘中
链接:https://pan.baidu.com/s/1kJ3sYM7szXmU2xAW4Uerpw
提取码:a5vg
文件放到项目下面的文件夹就好
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第26张图片

#include 
#include 
#include 
#include 
#include 
#include 

using namespace pcl;
using namespace pcl::io;

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::PLYReader reader;
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud1(new pcl::PointCloud<pcl::PointXYZ>);
    reader.read<pcl::PointXYZ>("bunny.ply", *cloud1);
    pcl::io::savePCDFile("pointcloud.pcd", *cloud1);

    pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGBA>);
    pcl::io::loadPCDFile("pointcloud.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;
}

问题:OpenNI2.dll找不到

如果编译后说OpenNI2.dll找不到或者打不开,到这个目录下面找到,然后复制到项目下面
或者复制到C:\Windows\System32 这个路径下面,这样的话以后都不用在项目里面加了

【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第27张图片

【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第28张图片
F5调试之后,点云数据就读出来了
【win10+visual studio 2019 + pcl 1.12.1安装与环境配置】_第29张图片
安装配置完成

你可能感兴趣的:(安装的日常,visual,studio,经验分享)