Visual Studio配置PCL库
- Debug和Release
- 配置新建项目
- 配置属性表
- 测试
- 参考
Debug和Release
Debug和Release的配置过程一模一样,唯一区别就在于最后一步插入的附加依赖项不同,因此下面以debug为例。
配置新建项目
1、新建一个C++空项目,模式设置为Debug,X64
2、在源文件内新建一个c++文件,后缀是cpp。
3、右键刚刚新建的项目(注意不是源文件),选择:属性–配置属性–调试–环境–编辑,添加如下的环境
PATH=D:/Windows/softwares/PCL 1.13.1/bin;D:/Windows/softwares/PCL 1.13.1/3rdParty/FLANN/bin;D:/Windows/softwares/PCL 1.13.1/3rdParty/VTK/bin;D:/Windows/softwares/PCL 1.13.1/3rdParty/OpenNI2/Tools
4、选择 C/C+±-语言–符合模式–设置为否
5、选择 C/C+±-所有选项–SDL检查–设置为否
5、点击应用和确定
配置属性表
1、找到属性管理器:视图–其他窗口–属性管理器
2、在属性管理器里找到Debug|x64(如果配置release,就找到release|x64),右键打开后选择新建新的项目属性表,名称自定义
3、右键新建的属性表,打开属性:C/C++ – 所有选项 – SDL检查 – 设置为否:
4、选择VC++目录 – 包含目录 – 编辑 --添加新的目录如下
内容如下:
D:/Windows/softwares/PCL 1.13.1/include/pcl-1.13
D:/Windows/softwares/PCL 1.13.1/3rdParty/Boost/include/boost-1_82
D:/Windows/softwares/PCL 1.13.1/3rdParty/Eigen/eigen3
D:/Windows/softwares/PCL 1.13.1/3rdParty/FLANN/include
D:/Windows/softwares/PCL 1.13.1/3rdParty/Qhull/include
D:/Windows/softwares/PCL 1.13.1/3rdParty/VTK/include/vtk-9.2
D:/Windows/softwares/PCL 1.13.1/3rdParty/OpenNI2/Include```
5、选择VC++目录 – 库目录 – 编辑 --添加新的目录如下
内容如下:
D:/Windows/softwares/PCL 1.13.1/lib
D:/Windows/softwares/PCL 1.13.1/3rdParty/Boost/lib
D:/Windows/softwares/PCL 1.13.1/3rdParty/FLANN/lib
D:/Windows/softwares/PCL 1.13.1/3rdParty/Qhull/lib
D:/Windows/softwares/PCL 1.13.1/3rdParty/VTK/lib
D:/Windows/softwares/PCL 1.13.1/3rdParty/OpenNI2/Lib
6、选择C/C++ – 预处理器 – 预处理器定义 – 编辑 --添加预处理器定义如下
内容如下:
BOOST_USE_WINDOWS_H
NOMINMAX
_SCL_SECURE_NO_WARNINGS
_CRT_SECURE_NO_WARNINGS
7、接着点击属性页中的链接器下的输入,点击右侧的附加依赖项右侧的下拉菜单,选择编辑,将链接库名填入:
链接库名可以自动生成,在pcl文件夹的lib目录、3rdParty中Boost、FLANN、Qhull、VTK、OpenNI2的lib目录下分别新建txt文件:get.txt,并写入如下内容,随后改为get.bat运行生成相应文件。读取出来的链接库是包含了release版本和Debug版本(名字后面带d或者gd的)两种。
pcl的,这里自动读出来debug版本链接库名和全部链接库名,手动从liblist-all.txt中删除liblist-debug.txt中出现的文件名就生成了release版本
DIR *d.lib /B >liblist-debug.txt
DIR *.lib /B >liblist-all.txt
Boost的,这里自动生成debug和release版本
DIR *mt-gd-x64-1_82.lib /B >aboost-debug.txt
DIR *mt-x64-1_82.lib /B >aboost-rel.txt
DIR *.lib /B >aboost-all.txt
FLANN的,这里自动读出来debug版本和全部链接库名,手动从aflann-all.txt中删除aflann-debug.txt中出现的文件名就生成了release版本
DIR *gd.lib /B >aflann-debug.txt
DIR *.lib /B >aflann-all.txt
Qhull的,这里自动读出来debug版本和全部链接库名,手动从aqhull-all.txt中删除aqhull-debug.txt中出现的文件名就生成了release版本
DIR *d.lib /B >aqhull-debug.txt
DIR *.lib /B >aqhull-rel.txt
DIR *.lib /B >aqhull-all.txt
VTK的,这里自动生成debug和release版本
DIR *gd.lib /B >vtk-debug.txt
DIR *9.2.lib /B >vtk-rel.txt
DIR *.lib /B >vtk-all.txt
OpenNI2的Lib目录下只有一个lib文件,直接复制文件名(带扩展名)即可。这一个既放入debug中也放入release中。
PCL1.13.1版本汇总如下,如果PCL版本和我一样,可以直接复制我下面汇总好的。
debug版本:
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
vtkcgns-9.2-gd.lib
vtkChartsCore-9.2-gd.lib
vtkCommonColor-9.2-gd.lib
vtkCommonComputationalGeometry-9.2-gd.lib
vtkCommonCore-9.2-gd.lib
vtkCommonDataModel-9.2-gd.lib
vtkCommonExecutionModel-9.2-gd.lib
vtkCommonMath-9.2-gd.lib
vtkCommonMisc-9.2-gd.lib
vtkCommonSystem-9.2-gd.lib
vtkCommonTransforms-9.2-gd.lib
vtkDICOMParser-9.2-gd.lib
vtkDomainsChemistry-9.2-gd.lib
vtkDomainsChemistryOpenGL2-9.2-gd.lib
vtkdoubleconversion-9.2-gd.lib
vtkexodusII-9.2-gd.lib
vtkexpat-9.2-gd.lib
vtkFiltersAMR-9.2-gd.lib
vtkFiltersCore-9.2-gd.lib
vtkFiltersExtraction-9.2-gd.lib
vtkFiltersFlowPaths-9.2-gd.lib
vtkFiltersGeneral-9.2-gd.lib
vtkFiltersGeneric-9.2-gd.lib
vtkFiltersGeometry-9.2-gd.lib
vtkFiltersHybrid-9.2-gd.lib
vtkFiltersHyperTree-9.2-gd.lib
vtkFiltersImaging-9.2-gd.lib
vtkFiltersModeling-9.2-gd.lib
vtkFiltersParallel-9.2-gd.lib
vtkFiltersParallelImaging-9.2-gd.lib
vtkFiltersPoints-9.2-gd.lib
vtkFiltersProgrammable-9.2-gd.lib
vtkFiltersSelection-9.2-gd.lib
vtkFiltersSMP-9.2-gd.lib
vtkFiltersSources-9.2-gd.lib
vtkFiltersStatistics-9.2-gd.lib
vtkFiltersTexture-9.2-gd.lib
vtkFiltersTopology-9.2-gd.lib
vtkFiltersVerdict-9.2-gd.lib
vtkfmt-9.2-gd.lib
vtkfreetype-9.2-gd.lib
vtkGeovisCore-9.2-gd.lib
vtkgl2ps-9.2-gd.lib
vtkglew-9.2-gd.lib
vtkhdf5-9.2-gd.lib
vtkhdf5_hl-9.2-gd.lib
vtkImagingColor-9.2-gd.lib
vtkImagingCore-9.2-gd.lib
vtkImagingFourier-9.2-gd.lib
vtkImagingGeneral-9.2-gd.lib
vtkImagingHybrid-9.2-gd.lib
vtkImagingMath-9.2-gd.lib
vtkImagingMorphological-9.2-gd.lib
vtkImagingSources-9.2-gd.lib
vtkImagingStatistics-9.2-gd.lib
vtkImagingStencil-9.2-gd.lib
vtkInfovisCore-9.2-gd.lib
vtkInfovisLayout-9.2-gd.lib
vtkInteractionImage-9.2-gd.lib
vtkInteractionStyle-9.2-gd.lib
vtkInteractionWidgets-9.2-gd.lib
vtkIOAMR-9.2-gd.lib
vtkIOAsynchronous-9.2-gd.lib
vtkIOCesium3DTiles-9.2-gd.lib
vtkIOCGNSReader-9.2-gd.lib
vtkIOChemistry-9.2-gd.lib
vtkIOCityGML-9.2-gd.lib
vtkIOCONVERGECFD-9.2-gd.lib
vtkIOCore-9.2-gd.lib
vtkIOEnSight-9.2-gd.lib
vtkIOExodus-9.2-gd.lib
vtkIOExport-9.2-gd.lib
vtkIOExportGL2PS-9.2-gd.lib
vtkIOExportPDF-9.2-gd.lib
vtkIOGeometry-9.2-gd.lib
vtkIOHDF-9.2-gd.lib
vtkIOImage-9.2-gd.lib
vtkIOImport-9.2-gd.lib
vtkIOInfovis-9.2-gd.lib
vtkIOIOSS-9.2-gd.lib
vtkIOLegacy-9.2-gd.lib
vtkIOLSDyna-9.2-gd.lib
vtkIOMINC-9.2-gd.lib
vtkIOMotionFX-9.2-gd.lib
vtkIOMovie-9.2-gd.lib
vtkIONetCDF-9.2-gd.lib
vtkIOOggTheora-9.2-gd.lib
vtkIOParallel-9.2-gd.lib
vtkIOParallelXML-9.2-gd.lib
vtkIOPLY-9.2-gd.lib
vtkIOSegY-9.2-gd.lib
vtkIOSQL-9.2-gd.lib
vtkioss-9.2-gd.lib
vtkIOTecplotTable-9.2-gd.lib
vtkIOVeraOut-9.2-gd.lib
vtkIOVideo-9.2-gd.lib
vtkIOXML-9.2-gd.lib
vtkIOXMLParser-9.2-gd.lib
vtkjpeg-9.2-gd.lib
vtkjsoncpp-9.2-gd.lib
vtkkissfft-9.2-gd.lib
vtklibharu-9.2-gd.lib
vtklibproj-9.2-gd.lib
vtklibxml2-9.2-gd.lib
vtkloguru-9.2-gd.lib
vtklz4-9.2-gd.lib
vtklzma-9.2-gd.lib
vtkmetaio-9.2-gd.lib
vtknetcdf-9.2-gd.lib
vtkogg-9.2-gd.lib
vtkParallelCore-9.2-gd.lib
vtkParallelDIY-9.2-gd.lib
vtkpng-9.2-gd.lib
vtkpugixml-9.2-gd.lib
vtkRenderingAnnotation-9.2-gd.lib
vtkRenderingContext2D-9.2-gd.lib
vtkRenderingContextOpenGL2-9.2-gd.lib
vtkRenderingCore-9.2-gd.lib
vtkRenderingFreeType-9.2-gd.lib
vtkRenderingGL2PSOpenGL2-9.2-gd.lib
vtkRenderingHyperTreeGrid-9.2-gd.lib
vtkRenderingImage-9.2-gd.lib
vtkRenderingLabel-9.2-gd.lib
vtkRenderingLICOpenGL2-9.2-gd.lib
vtkRenderingLOD-9.2-gd.lib
vtkRenderingOpenGL2-9.2-gd.lib
vtkRenderingSceneGraph-9.2-gd.lib
vtkRenderingUI-9.2-gd.lib
vtkRenderingVolume-9.2-gd.lib
vtkRenderingVolumeOpenGL2-9.2-gd.lib
vtkRenderingVtkJS-9.2-gd.lib
vtksqlite-9.2-gd.lib
vtksys-9.2-gd.lib
vtkTestingRendering-9.2-gd.lib
vtktheora-9.2-gd.lib
vtktiff-9.2-gd.lib
vtkverdict-9.2-gd.lib
vtkViewsContext2D-9.2-gd.lib
vtkViewsCore-9.2-gd.lib
vtkViewsInfovis-9.2-gd.lib
vtkWrappingTools-9.2-gd.lib
vtkzlib-9.2-gd.lib
qhullcpp_d.lib
qhullstatic_d.lib
qhullstatic_rd.lib
qhull_rd.lib
flann-gd.lib
flann_cpp-gd.lib
flann_cpp_s-gd.lib
flann_s-gd.lib
libboost_atomic-vc143-mt-gd-x64-1_82.lib
libboost_bzip2-vc143-mt-gd-x64-1_82.lib
libboost_chrono-vc143-mt-gd-x64-1_82.lib
libboost_container-vc143-mt-gd-x64-1_82.lib
libboost_context-vc143-mt-gd-x64-1_82.lib
libboost_contract-vc143-mt-gd-x64-1_82.lib
libboost_coroutine-vc143-mt-gd-x64-1_82.lib
libboost_date_time-vc143-mt-gd-x64-1_82.lib
libboost_exception-vc143-mt-gd-x64-1_82.lib
libboost_fiber-vc143-mt-gd-x64-1_82.lib
libboost_filesystem-vc143-mt-gd-x64-1_82.lib
libboost_graph-vc143-mt-gd-x64-1_82.lib
libboost_graph_parallel-vc143-mt-gd-x64-1_82.lib
libboost_iostreams-vc143-mt-gd-x64-1_82.lib
libboost_json-vc143-mt-gd-x64-1_82.lib
libboost_locale-vc143-mt-gd-x64-1_82.lib
libboost_log-vc143-mt-gd-x64-1_82.lib
libboost_log_setup-vc143-mt-gd-x64-1_82.lib
libboost_math_c99-vc143-mt-gd-x64-1_82.lib
libboost_math_c99f-vc143-mt-gd-x64-1_82.lib
libboost_math_c99l-vc143-mt-gd-x64-1_82.lib
libboost_math_tr1-vc143-mt-gd-x64-1_82.lib
libboost_math_tr1f-vc143-mt-gd-x64-1_82.lib
libboost_math_tr1l-vc143-mt-gd-x64-1_82.lib
libboost_mpi-vc143-mt-gd-x64-1_82.lib
libboost_nowide-vc143-mt-gd-x64-1_82.lib
libboost_numpy310-vc143-mt-gd-x64-1_82.lib
libboost_prg_exec_monitor-vc143-mt-gd-x64-1_82.lib
libboost_program_options-vc143-mt-gd-x64-1_82.lib
libboost_python310-vc143-mt-gd-x64-1_82.lib
libboost_random-vc143-mt-gd-x64-1_82.lib
libboost_regex-vc143-mt-gd-x64-1_82.lib
libboost_serialization-vc143-mt-gd-x64-1_82.lib
libboost_stacktrace_noop-vc143-mt-gd-x64-1_82.lib
libboost_stacktrace_windbg-vc143-mt-gd-x64-1_82.lib
libboost_stacktrace_windbg_cached-vc143-mt-gd-x64-1_82.lib
libboost_system-vc143-mt-gd-x64-1_82.lib
libboost_test_exec_monitor-vc143-mt-gd-x64-1_82.lib
libboost_thread-vc143-mt-gd-x64-1_82.lib
libboost_timer-vc143-mt-gd-x64-1_82.lib
libboost_type_erasure-vc143-mt-gd-x64-1_82.lib
libboost_unit_test_framework-vc143-mt-gd-x64-1_82.lib
libboost_url-vc143-mt-gd-x64-1_82.lib
libboost_wave-vc143-mt-gd-x64-1_82.lib
libboost_wserialization-vc143-mt-gd-x64-1_82.lib
libboost_zlib-vc143-mt-gd-x64-1_82.lib
OpenNI2.lib
release版本:
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
vtkcgns-9.2.lib
vtkChartsCore-9.2.lib
vtkCommonColor-9.2.lib
vtkCommonComputationalGeometry-9.2.lib
vtkCommonCore-9.2.lib
vtkCommonDataModel-9.2.lib
vtkCommonExecutionModel-9.2.lib
vtkCommonMath-9.2.lib
vtkCommonMisc-9.2.lib
vtkCommonSystem-9.2.lib
vtkCommonTransforms-9.2.lib
vtkDICOMParser-9.2.lib
vtkDomainsChemistry-9.2.lib
vtkDomainsChemistryOpenGL2-9.2.lib
vtkdoubleconversion-9.2.lib
vtkexodusII-9.2.lib
vtkexpat-9.2.lib
vtkFiltersAMR-9.2.lib
vtkFiltersCore-9.2.lib
vtkFiltersExtraction-9.2.lib
vtkFiltersFlowPaths-9.2.lib
vtkFiltersGeneral-9.2.lib
vtkFiltersGeneric-9.2.lib
vtkFiltersGeometry-9.2.lib
vtkFiltersHybrid-9.2.lib
vtkFiltersHyperTree-9.2.lib
vtkFiltersImaging-9.2.lib
vtkFiltersModeling-9.2.lib
vtkFiltersParallel-9.2.lib
vtkFiltersParallelImaging-9.2.lib
vtkFiltersPoints-9.2.lib
vtkFiltersProgrammable-9.2.lib
vtkFiltersSelection-9.2.lib
vtkFiltersSMP-9.2.lib
vtkFiltersSources-9.2.lib
vtkFiltersStatistics-9.2.lib
vtkFiltersTexture-9.2.lib
vtkFiltersTopology-9.2.lib
vtkFiltersVerdict-9.2.lib
vtkfmt-9.2.lib
vtkfreetype-9.2.lib
vtkGeovisCore-9.2.lib
vtkgl2ps-9.2.lib
vtkglew-9.2.lib
vtkhdf5-9.2.lib
vtkhdf5_hl-9.2.lib
vtkImagingColor-9.2.lib
vtkImagingCore-9.2.lib
vtkImagingFourier-9.2.lib
vtkImagingGeneral-9.2.lib
vtkImagingHybrid-9.2.lib
vtkImagingMath-9.2.lib
vtkImagingMorphological-9.2.lib
vtkImagingSources-9.2.lib
vtkImagingStatistics-9.2.lib
vtkImagingStencil-9.2.lib
vtkInfovisCore-9.2.lib
vtkInfovisLayout-9.2.lib
vtkInteractionImage-9.2.lib
vtkInteractionStyle-9.2.lib
vtkInteractionWidgets-9.2.lib
vtkIOAMR-9.2.lib
vtkIOAsynchronous-9.2.lib
vtkIOCesium3DTiles-9.2.lib
vtkIOCGNSReader-9.2.lib
vtkIOChemistry-9.2.lib
vtkIOCityGML-9.2.lib
vtkIOCONVERGECFD-9.2.lib
vtkIOCore-9.2.lib
vtkIOEnSight-9.2.lib
vtkIOExodus-9.2.lib
vtkIOExport-9.2.lib
vtkIOExportGL2PS-9.2.lib
vtkIOExportPDF-9.2.lib
vtkIOGeometry-9.2.lib
vtkIOHDF-9.2.lib
vtkIOImage-9.2.lib
vtkIOImport-9.2.lib
vtkIOInfovis-9.2.lib
vtkIOIOSS-9.2.lib
vtkIOLegacy-9.2.lib
vtkIOLSDyna-9.2.lib
vtkIOMINC-9.2.lib
vtkIOMotionFX-9.2.lib
vtkIOMovie-9.2.lib
vtkIONetCDF-9.2.lib
vtkIOOggTheora-9.2.lib
vtkIOParallel-9.2.lib
vtkIOParallelXML-9.2.lib
vtkIOPLY-9.2.lib
vtkIOSegY-9.2.lib
vtkIOSQL-9.2.lib
vtkioss-9.2.lib
vtkIOTecplotTable-9.2.lib
vtkIOVeraOut-9.2.lib
vtkIOVideo-9.2.lib
vtkIOXML-9.2.lib
vtkIOXMLParser-9.2.lib
vtkjpeg-9.2.lib
vtkjsoncpp-9.2.lib
vtkkissfft-9.2.lib
vtklibharu-9.2.lib
vtklibproj-9.2.lib
vtklibxml2-9.2.lib
vtkloguru-9.2.lib
vtklz4-9.2.lib
vtklzma-9.2.lib
vtkmetaio-9.2.lib
vtknetcdf-9.2.lib
vtkogg-9.2.lib
vtkParallelCore-9.2.lib
vtkParallelDIY-9.2.lib
vtkpng-9.2.lib
vtkpugixml-9.2.lib
vtkRenderingAnnotation-9.2.lib
vtkRenderingContext2D-9.2.lib
vtkRenderingContextOpenGL2-9.2.lib
vtkRenderingCore-9.2.lib
vtkRenderingFreeType-9.2.lib
vtkRenderingGL2PSOpenGL2-9.2.lib
vtkRenderingHyperTreeGrid-9.2.lib
vtkRenderingImage-9.2.lib
vtkRenderingLabel-9.2.lib
vtkRenderingLICOpenGL2-9.2.lib
vtkRenderingLOD-9.2.lib
vtkRenderingOpenGL2-9.2.lib
vtkRenderingSceneGraph-9.2.lib
vtkRenderingUI-9.2.lib
vtkRenderingVolume-9.2.lib
vtkRenderingVolumeOpenGL2-9.2.lib
vtkRenderingVtkJS-9.2.lib
vtksqlite-9.2.lib
vtksys-9.2.lib
vtkTestingRendering-9.2.lib
vtktheora-9.2.lib
vtktiff-9.2.lib
vtkverdict-9.2.lib
vtkViewsContext2D-9.2.lib
vtkViewsCore-9.2.lib
vtkViewsInfovis-9.2.lib
vtkWrappingTools-9.2.lib
vtkzlib-9.2.lib
qhullcpp.lib
qhullstatic.lib
qhullstatic_r.lib
qhull_r.lib
flann.lib
flann_cpp.lib
flann_cpp_s.lib
flann_s.lib
libboost_atomic-vc143-mt-x64-1_82.lib
libboost_bzip2-vc143-mt-x64-1_82.lib
libboost_chrono-vc143-mt-x64-1_82.lib
libboost_container-vc143-mt-x64-1_82.lib
libboost_context-vc143-mt-x64-1_82.lib
libboost_contract-vc143-mt-x64-1_82.lib
libboost_coroutine-vc143-mt-x64-1_82.lib
libboost_date_time-vc143-mt-x64-1_82.lib
libboost_exception-vc143-mt-x64-1_82.lib
libboost_fiber-vc143-mt-x64-1_82.lib
libboost_filesystem-vc143-mt-x64-1_82.lib
libboost_graph-vc143-mt-x64-1_82.lib
libboost_graph_parallel-vc143-mt-x64-1_82.lib
libboost_iostreams-vc143-mt-x64-1_82.lib
libboost_json-vc143-mt-x64-1_82.lib
libboost_locale-vc143-mt-x64-1_82.lib
libboost_log-vc143-mt-x64-1_82.lib
libboost_log_setup-vc143-mt-x64-1_82.lib
libboost_math_c99-vc143-mt-x64-1_82.lib
libboost_math_c99f-vc143-mt-x64-1_82.lib
libboost_math_c99l-vc143-mt-x64-1_82.lib
libboost_math_tr1-vc143-mt-x64-1_82.lib
libboost_math_tr1f-vc143-mt-x64-1_82.lib
libboost_math_tr1l-vc143-mt-x64-1_82.lib
libboost_mpi-vc143-mt-x64-1_82.lib
libboost_nowide-vc143-mt-x64-1_82.lib
libboost_numpy310-vc143-mt-x64-1_82.lib
libboost_prg_exec_monitor-vc143-mt-x64-1_82.lib
libboost_program_options-vc143-mt-x64-1_82.lib
libboost_python310-vc143-mt-x64-1_82.lib
libboost_random-vc143-mt-x64-1_82.lib
libboost_regex-vc143-mt-x64-1_82.lib
libboost_serialization-vc143-mt-x64-1_82.lib
libboost_stacktrace_noop-vc143-mt-x64-1_82.lib
libboost_stacktrace_windbg-vc143-mt-x64-1_82.lib
libboost_stacktrace_windbg_cached-vc143-mt-x64-1_82.lib
libboost_system-vc143-mt-x64-1_82.lib
libboost_test_exec_monitor-vc143-mt-x64-1_82.lib
libboost_thread-vc143-mt-x64-1_82.lib
libboost_timer-vc143-mt-x64-1_82.lib
libboost_type_erasure-vc143-mt-x64-1_82.lib
libboost_unit_test_framework-vc143-mt-x64-1_82.lib
libboost_url-vc143-mt-x64-1_82.lib
libboost_wave-vc143-mt-x64-1_82.lib
libboost_wserialization-vc143-mt-x64-1_82.lib
libboost_zlib-vc143-mt-x64-1_82.lib
OpenNI2.lib
测试
在源文件内的cpp文件中,拷贝如下内容,运行成功即配置成功。代码需要的test.pcd文件,详见
https://blog.csdn.net/weixin_43464623/article/details/117172725?spm=1001.2014.3001.5506
#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <pcl/ModelCoefficients.h>
#include <pcl/filters/extract_indices.h>
#include <pcl/features/normal_3d.h>
#include <pcl/sample_consensus/method_types.h>
#include <pcl/sample_consensus/model_types.h>
#include <pcl/segmentation/sac_segmentation.h>
#include <pcl/visualization/cloud_viewer.h>int main(int argc, char* argv[])
{pcl::PCDReader reader;pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);reader.read("test.pcd", *cloud); //读取点云std::cerr << "test point cloud has: " << cloud->size() << " points." << std::endl;pcl::PointCloud<pcl::Normal>::Ptr cloud_normals(new pcl::PointCloud<pcl::Normal>);pcl::search::KdTree<pcl::PointXYZ>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZ>());pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne; //计算点云法向量ne.setSearchMethod(tree); //使用kdtree搜索方法ne.setInputCloud(cloud);ne.setKSearch(5); //使用邻近5个点计算法向量ne.compute(*cloud_normals);pcl::ModelCoefficients::Ptr coefficients_cylinder(new pcl::ModelCoefficients);pcl::PointIndices::Ptr inliers_cylinder(new pcl::PointIndices);pcl::SACSegmentationFromNormals<pcl::PointXYZ, pcl::Normal> seg; //使用ransac分割圆柱体seg.setOptimizeCoefficients(true);seg.setModelType(pcl::SACMODEL_CYLINDER); //分割模型设置为圆柱体seg.setMethodType(pcl::SAC_RANSAC);seg.setNormalDistanceWeight(0.05);seg.setMaxIterations(10000); //迭代次数设置这么大是因为圆柱体不好分割,因此项目中慎用seg.setDistanceThreshold(0.03);seg.setRadiusLimits(0, 0.1); //半径都要设置的很精确,因此此算法鲁棒性并不高,项目中慎用seg.setInputCloud(cloud);seg.setInputNormals(cloud_normals);seg.segment(*inliers_cylinder, *coefficients_cylinder); std::cerr << "cylinder coefficients: " << *coefficients_cylinder << std::endl; //打印圆柱体几何模型系数pcl::ExtractIndices<pcl::PointXYZ> extract;extract.setInputCloud(cloud);extract.setIndices(inliers_cylinder);extract.setNegative(false);pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_cylinder(new pcl::PointCloud<pcl::PointXYZ>());extract.filter(*cloud_cylinder); //抽取圆柱体点云if (cloud_cylinder->points.empty()){std::cerr << "Can't find the cylindrical component." << std::endl;}pcl::visualization::PCLVisualizer viewer("Cloud Viewer");int v1(0); //创建左窗口显式cloud1(原始点云)viewer.createViewPort(0, 0, 0.5, 1.0, v1); //左右窗口大小划分,1:1viewer.setBackgroundColor(0, 0, 0, v1);viewer.addText("Cloud1", 2, 2, "Cloud1", v1); //窗口下的标题pcl::visualization::PointCloudColorHandlerGenericField<pcl::PointXYZ> rgb1(cloud, "z");viewer.addPointCloud<pcl::PointXYZ>(cloud, rgb1, "cloud1", v1);viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "cloud1", v1);int v2(1); //创建右窗口显示cloud2(圆柱体点云)viewer.createViewPort(0.5, 0, 1.0, 1.0, v2); //左右窗口大小划分,1:1viewer.setBackgroundColor(0, 0, 0, v2);viewer.addText("Cloud2", 2, 2, "Cloud2", v2); //窗口下的标题pcl::visualization::PointCloudColorHandlerGenericField<pcl::PointXYZ> rgb2(cloud_cylinder, "z");viewer.addPointCloud<pcl::PointXYZ>(cloud_cylinder, rgb2, "cloud2", v2);viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "cloud2", v2);viewer.spin();return (0);
}
参考
【1】: https://blog.csdn.net/qq_45006390/article/details/118928500?spm=1001.2014.3001.5506
【2】: https://blog.csdn.net/qq_42676511/article/details/126054136?spm=1001.2014.3001.5506
【3】: https://blog.csdn.net/weixin_43464623/article/details/117172725?spm=1001.2014.3001.5506