win10系统VS2019配置点云库PCL1.12.1的详细流程
0 写在最前
这是本人昨天在VS2019上配置PCL点云库的一些基本流程以及一些问题的总结,有些问题我的解决办法不一定是最优的,仅供大家参考,当然这里也记录了我这个小白在配置过程中踩过的一些小坑,希望能为大家带来方便。
本文参考博文:https://www.jb51.net/article/256389.htm
1 PCL的下载安装
1.1 PCL下载
下载版本:PCL 1.12.1
下载网址:Https://GitHub.com/PointCloudLibrary/pcl/releases
进入界面后下载如下两个文件:
1.2 PCL安装
下载完成后,运行PCL-1.12.1-rc1-AllInOne-msvc2019-win64.exe,开始安装
这里有两个小点需要注意:
一是选择Add PCL to the system PATH for all users
二是要安装到非系统盘,且路径全英文
1.3 bin文件拷贝
我们将刚刚下载的pcl-1.12.1-rc1-pdb-msvc2019-win64.zip解压
可以看到里面都是.pdb文件
再找到刚才下载好的PCL 1.12.1文件夹,打开,将这些.pdb文件拷贝到PCL 1.12.1\bin目录中
1.4 其他问题
这时,打开PCL 1.12.1文件夹检查一下
可以看到,这时我的PCL 1.12.1\3rdParty\OpenNI2文件夹中只有一个安装文件,空空如也,我们打开这个安装文件,要先选择remove执行一次卸载,然后再打开安装文件进行安装,安装路径就是这个PCL 1.12.1\3rdParty\OpenNI2文件夹
安装好就可以看到OpenNI2文件夹下出现了我们后面需要用到的include文件和Lib文件等
至此,PCL 的安装准备过程已经完成。
2 在VS中配置PCL
2.1 前期工作
首先用VS 2019打开一个项目
这里有这么几步:
1.我这里原先是x86,要改成x64
2.右键点击项目
3.选择属性
进入项目属性页后,也有很重要的一步:将平台改为x64
我当时就是漏掉了这一步导致后面代码一直出错
2.1 添加包含目录
选择Vc++目录 -> 包含目录 -> 点击右列,出现一个下拉列表,点击后出现编辑,点击进入。
将7个包含目录复制粘贴进去就好。
我的包含目录如下,大家可以打开自己的PCL 1.12.1文件夹核对,如果版本或者路径不一样,按照自己的来
D:\PCL 1.12.1\3rdParty\Eigen\eigen3
D:\PCL 1.12.1\3rdParty\FLANN\include
D:\PCL 1.12.1\3rdParty\VTK\include\vtk-9.1
D:\PCL 1.12.1\3rdParty\Qhull\include
D:\PCL 1.12.1\include\pcl-1.12
D:\PCL 1.12.1\3rdParty\Boost\include\boost-1_78
D:\PCL 1.12.1\3rdParty\OpenNI2\Include
2.2 添加库目录
步骤同上,选择VC++目录 -> 库目录 -> 点击右列编辑
我的库目录如下,注意这里也是要根据自己的路径和版本号来
D:\PCL 1.12.1\3rdParty\Boost\lib
D:\PCL 1.12.1\3rdParty\FLANN\lib
D:\PCL 1.12.1\3rdParty\OpenNI2\Lib
D:\PCL 1.12.1\3rdParty\Qhull\lib
D:\PCL 1.12.1\3rdParty\VTK\lib
D:\PCL 1.12.1\lib
2.3 添加依赖项
同样的方法进入添加依赖项界面,选择链接器 ->输入 -> 点击右列,出现一个下拉列表,点击后出现编辑,点击进入。
附加依赖项太多,对于不同版本的PCL可能附加依赖项就会略有不同,全盘复制很有可能导致link error,有些依赖项找不到有些又缺失。因此如果版本与我相同可直接复制下面我的依赖项,如果版本不是1.12.1可以利用bat文件自己分一下,这个工程看似很大,实则不难。
我们可以在每个库目录中找到所需要的.lib文件,也就是依赖项,根据不同库目录下的.lib文件名,可以区分出debug模式和release模式各自的.lib文件。
也可以参考这篇文章,写的很详细:https://www.jb51.net/article/256395.htm
在不同的lib文件夹下新建.txt文本文档,以我这里的D:\PCL 1.12.1\3rdParty\VTK为例,可以看出VTK中的每一对.lib文件就差一个字母d,因此我们在.txt中把带d的和不带d的区分出来。编辑好.txt文档后将后缀改成.bat,点击运行。
@echo off
for %%I in (*.lib) do echo %%I>>all.txt
for %%I in (*d.lib) do echo %%I>>adebug.txt
for %%I in (*9.1.lib) do echo %%I>>arelease.txt
pause
同理,将这一堆文件夹中凡是带lib的,都用上述方法提取区分一下,别忘了D:\PCL 1.12.1\lib也要。PCL 1.12.1 提取总结好的.lib文件集合如下:
PCL1.12.1 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
PCL1.12.1 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
至此,PCL的配置完成,下面就是尝试运行程序检查一下配置是否成功。
3 PCL运行验证
首先要下载点云模型
下载网址:https://www.cc.gatech.edu/projects/large_models/
不过网络真的很慢,我至今也没成功下载过,因此我选择的方法是找学长要了一下点云模型的数据。。
这里的代码我也是使用了原博主的代码,注意要自己更改一下点云数据的路径:
#include <pcl/visualization/cloud_viewer.h>
#include <iostream>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/point_types.h>
#pragma warning(disable:4996)
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\\reconstruction\\bun_zipper.ply", *cloud1);
pcl::io::savePCDFile("bunny\\pointcloud.pcd", *cloud1);
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::io::loadPCDFile("bunny\\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;
}
运行后会发现出现了这样的问题:找不到dll文件
上网查了一下,选择如下方法:
打开属性页,选择配置属性 -> 调试 -> 环境,将下面环境粘贴进去
PATH=$(PCL_ROOT)\bin;$(PCL_ROOT)\3rdParty\FLANN\bin;$(PCL_ROOT)\3rdParty\VTK\bin;$(PCL_ROOT)\Qhull\bin;$(PCL_ROOT)\3rdParty\OpenNI2\Tools;$(PATH)
然后再运行,不会报错,出现配准结果
4 写在最后
说实话在这整个配置纠错的过程中还有许多许多小细节有些记不清了,另外我的全过程都有参考开头博文的链接,我觉得那位博主写的是非常清晰正确的,也欢迎大家对我的过程批评指正。
到此这篇关于win10系统VS2019配置点云库PCL1.12.1的教程与经验总结的文章就介绍到这了,更多相关win10 VS2019 PCL1.12.1配置内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!
相关文章