第一部分:visual studio2022 安装
vs官网网址如下:https://visualstudio.microsoft.com/zh-hans/vs/
第一步:我们打开官网链接,按如下操作点击下载免费版本的exe文件
第二步:打开下载目录下的安装文件进行安装,安装步骤如下:
按流程安装完成后创建桌面快捷方式
选择完成会弹出快捷方式文件,直接拷贝此文件然后复制粘贴桌面即可
第三步:创建新项目
双击快捷方式,打开vs界面,按下面操作进行
按照要求位置填写项目名称及挂载位置
打开项目后右边会有一个解决方案资源管理器,在此处的源文件下右键点击并选择:添加——模块——C++文件(.cpp)
设置完文件名和位置后点击添加,完成项目创建
第二部分:安装配置PCL
由于我们安装的是vs2022版本,此处在网站上选择vs2022对应的pcl版本【旧版本可以下拉页面选择】
安装网址:https://github.com/PointCloudLibrary/pcl/releases
第一步:此处选择前两个文件点击安装:
1、点击下载对应的AllInOne的exe文件:PCL-1.13.1-AllInOne-msvc2022-win64.exe
2、点击下载对应的pdb文件:pcl-1.13.1-pdb-msvc2022-win64.zip
下载完成后点击下载文件的文件夹,选择刚刚下载的.exe后缀文件,按下面步骤进行安装
点击安装,安装期间会弹出确认安装文件框,点击安装就可以
安装完成PCL后,我们还需要确认一下C:\Program Files路径下有没有OpenNI2文件夹,如果没有的话按照下面方法进行安装,如果有的话建议删除重装OpenNI2,实测没有重装后续会出问题,没重装的朋友也记得后期配置环境变量的时候自行更改环境变量的路径
第二步:卸载重装OpenNI2
【此处引用其他博客内容,图片可能会有些奇怪,大家按正常理解进行操作就行,也可以打开此博客查看(14条消息) Windows11+VS2022+PCL1.13.0 安装配置记录_WoooChi的博客-CSDN博客】
下面进行OpenNI2卸载操作
下面是OpenNI2安装操作
安装完成,安装路径下就会有如下内容,并且原来的OpenNI2文件已删除
第三步:安装pcl-1.13.1-pdb-msvc2022-win64.zip
到下载目录下,将我们下载的第二个文件:pcl-1.13.0-pdb-msvc2022-win64.zip打开,这里边有很多.pdb文件,全选复制所有文件
打开下载的PCL文件目录C:\Program Files\PCL 1.13.0\bin,将全部文件粘贴进去,完成安装
第四步:配置PCL环境变量
配置步骤如下
我的环境配置如下:【大家可根据自己下载路径更改】
OPENNI2_INCLUDE64 C:\Program Files\PCL 1.13.1\3rdParty\OpenNI2\Include\OPENNI2_LIB64 C:\Program Files\PCL 1.13.1\3rdParty\OpenNI2\Lib\OPENNI2_REDIST64 C:\Program Files\PCL 1.13.1\3rdParty\OpenNI2\Redist\PCL_ROOT C:\Program Files\PCL 1.13.1
确认此处无误后按如下操作
添加内容如下:
%PCL_ROOT%\bin%PCL_ROOT%\3rdParty\VTK\bin%PCL_ROOT%\3rdParty\FLANN\bin%PCL_ROOT%\3rdParty\Qhull\bin%PCL_ROOT%\3rdParty\OpenNI2\Tools%OPENNI2_REDIST64%%OPENNI2_LIB64%%OPENNI2_INCLUDE64%
添加完点击确定完成系统环境变量配置
第三部分:在vs里面设置PCL环境变量
第一步:打开vs2022并创建一个新项目【前面有了】
第二步:打开属性管理器
【可以在最上面的那行菜单栏里面找到视图——打开视图下的属性管理器】
出现下面窗口,右键点击Debug|x64【由于我是Debug的需求,且电脑是x64】
按下面操作:
加入内容
C:\Program Files\PCL 1.13.1\3rdParty\Boost\include\boost-1_80C:\Program Files\PCL 1.13.1\3rdParty\Eigen\eigen3C:\Program Files\PCL 1.13.1\3rdParty\FLANN\includeC:\Program Files\PCL 1.13.1\3rdParty\Qhull\includeC:\Program Files\PCL 1.13.1\3rdParty\VTK\include\vtk-9.2C:\Program Files\PCL 1.13.1\include\pcl-1.13C:\Program Files\PCL 1.13.1\3rdParty\OpenNI2\Include # OpenNI2安装地址可以自行更改
加入内容:
C:\Program Files\PCL 1.13.1\3rdParty\Boost\libC:\Program Files\PCL 1.13.1\libC:\Program Files\PCL 1.13.1\3rdParty\FLANN\libC:\Program Files\PCL 1.13.1\3rdParty\Qhull\libC:\Program Files\PCL 1.13.1\3rdParty\VTK\libC:\Program Files\PCL 1.13.1\3rdParty\OpenNI2\Lib
加入内容如下
_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;
这里加入一个博主获取PCL和VTK的lib文件的代码,这些文件大家可以用这份代码获取,获取完全部集合在一起然后放到指定路径下就行
【链接:(14条消息) Windows11+VS2022+PCL1.13.0 安装配置记录_WoooChi的博客-CSDN博客】
import osdef Extract_lib(path):release = open("release_lib.txt", 'w')debug = open("debug_lib.txt", 'w')for file in os.listdir(path):if file[-5:] == 'd.lib':debug.write(file)debug.write('\n')elif file[-4:] == '.lib':release.write(file)release.write('\n')debug.close()release.close()if __name__ == '__main__':path = r"D:\Program Files (x86)\OPenCV\x64\vc16\lib"Extract_lib(path)
lib文件名放置位置在这里
我的文件集合如下:【Denug版本】
pcl_commond.libpcl_featuresd.libpcl_filtersd.libpcl_iod.libpcl_io_plyd.libpcl_kdtreed.libpcl_keypointsd.libpcl_mld.libpcl_octreed.libpcl_outofcored.libpcl_peopled.libpcl_recognitiond.libpcl_registrationd.libpcl_sample_consensusd.libpcl_searchd.libpcl_segmentationd.libpcl_stereod.libpcl_surfaced.libpcl_trackingd.libpcl_visualizationd.liblibboost_atomic-vc143-mt-gd-x64-1_80.liblibboost_bzip2-vc143-mt-gd-x64-1_80.liblibboost_chrono-vc143-mt-gd-x64-1_80.liblibboost_container-vc143-mt-gd-x64-1_80.liblibboost_context-vc143-mt-gd-x64-1_80.liblibboost_contract-vc143-mt-gd-x64-1_80.liblibboost_coroutine-vc143-mt-gd-x64-1_80.liblibboost_date_time-vc143-mt-gd-x64-1_80.liblibboost_exception-vc143-mt-gd-x64-1_80.liblibboost_fiber-vc143-mt-gd-x64-1_80.liblibboost_filesystem-vc143-mt-gd-x64-1_80.liblibboost_graph-vc143-mt-gd-x64-1_80.liblibboost_graph_parallel-vc143-mt-gd-x64-1_80.liblibboost_iostreams-vc143-mt-gd-x64-1_80.liblibboost_json-vc143-mt-gd-x64-1_80.liblibboost_locale-vc143-mt-gd-x64-1_80.liblibboost_log-vc143-mt-gd-x64-1_80.liblibboost_log_setup-vc143-mt-gd-x64-1_80.liblibboost_math_c99-vc143-mt-gd-x64-1_80.liblibboost_math_c99f-vc143-mt-gd-x64-1_80.liblibboost_math_c99l-vc143-mt-gd-x64-1_80.liblibboost_math_tr1-vc143-mt-gd-x64-1_80.liblibboost_math_tr1f-vc143-mt-gd-x64-1_80.liblibboost_math_tr1l-vc143-mt-gd-x64-1_80.liblibboost_mpi-vc143-mt-gd-x64-1_80.liblibboost_nowide-vc143-mt-gd-x64-1_80.liblibboost_numpy310-vc143-mt-gd-x64-1_80.liblibboost_prg_exec_monitor-vc143-mt-gd-x64-1_80.liblibboost_program_options-vc143-mt-gd-x64-1_80.liblibboost_python310-vc143-mt-gd-x64-1_80.liblibboost_random-vc143-mt-gd-x64-1_80.liblibboost_regex-vc143-mt-gd-x64-1_80.liblibboost_serialization-vc143-mt-gd-x64-1_80.liblibboost_stacktrace_noop-vc143-mt-gd-x64-1_80.liblibboost_stacktrace_windbg-vc143-mt-gd-x64-1_80.liblibboost_stacktrace_windbg_cached-vc143-mt-gd-x64-1_80.liblibboost_system-vc143-mt-gd-x64-1_80.liblibboost_test_exec_monitor-vc143-mt-gd-x64-1_80.liblibboost_thread-vc143-mt-gd-x64-1_80.liblibboost_timer-vc143-mt-gd-x64-1_80.liblibboost_type_erasure-vc143-mt-gd-x64-1_80.liblibboost_unit_test_framework-vc143-mt-gd-x64-1_80.liblibboost_wave-vc143-mt-gd-x64-1_80.liblibboost_wserialization-vc143-mt-gd-x64-1_80.liblibboost_zlib-vc143-mt-gd-x64-1_80.libflann-gd.libflann_cpp-gd.libflann_cpp_s-gd.libflann_s-gd.libqhullcpp_d.libqhullstatic_d.libqhullstatic_rd.libqhull_rd.libvtkcgns-9.2-gd.libvtkChartsCore-9.2-gd.libvtkCommonColor-9.2-gd.libvtkCommonComputationalGeometry-9.2-gd.libvtkCommonCore-9.2-gd.libvtkCommonDataModel-9.2-gd.libvtkCommonExecutionModel-9.2-gd.libvtkCommonMath-9.2-gd.libvtkCommonMisc-9.2-gd.libvtkCommonSystem-9.2-gd.libvtkCommonTransforms-9.2-gd.libvtkDICOMParser-9.2-gd.libvtkDomainsChemistry-9.2-gd.libvtkDomainsChemistryOpenGL2-9.2-gd.libvtkdoubleconversion-9.2-gd.libvtkexodusII-9.2-gd.libvtkexpat-9.2-gd.libvtkFiltersAMR-9.2-gd.libvtkFiltersCore-9.2-gd.libvtkFiltersExtraction-9.2-gd.libvtkFiltersFlowPaths-9.2-gd.libvtkFiltersGeneral-9.2-gd.libvtkFiltersGeneric-9.2-gd.libvtkFiltersGeometry-9.2-gd.libvtkFiltersHybrid-9.2-gd.libvtkFiltersHyperTree-9.2-gd.libvtkFiltersImaging-9.2-gd.libvtkFiltersModeling-9.2-gd.libvtkFiltersParallel-9.2-gd.libvtkFiltersParallelImaging-9.2-gd.libvtkFiltersPoints-9.2-gd.libvtkFiltersProgrammable-9.2-gd.libvtkFiltersSelection-9.2-gd.libvtkFiltersSMP-9.2-gd.libvtkFiltersSources-9.2-gd.libvtkFiltersStatistics-9.2-gd.libvtkFiltersTexture-9.2-gd.libvtkFiltersTopology-9.2-gd.libvtkFiltersVerdict-9.2-gd.libvtkfmt-9.2-gd.libvtkfreetype-9.2-gd.libvtkGeovisCore-9.2-gd.libvtkgl2ps-9.2-gd.libvtkglew-9.2-gd.libvtkhdf5-9.2-gd.libvtkhdf5_hl-9.2-gd.libvtkImagingColor-9.2-gd.libvtkImagingCore-9.2-gd.libvtkImagingFourier-9.2-gd.libvtkImagingGeneral-9.2-gd.libvtkImagingHybrid-9.2-gd.libvtkImagingMath-9.2-gd.libvtkImagingMorphological-9.2-gd.libvtkImagingSources-9.2-gd.libvtkImagingStatistics-9.2-gd.libvtkImagingStencil-9.2-gd.libvtkInfovisCore-9.2-gd.libvtkInfovisLayout-9.2-gd.libvtkInteractionImage-9.2-gd.libvtkInteractionStyle-9.2-gd.libvtkInteractionWidgets-9.2-gd.libvtkIOAMR-9.2-gd.libvtkIOAsynchronous-9.2-gd.libvtkIOCesium3DTiles-9.2-gd.libvtkIOCGNSReader-9.2-gd.libvtkIOChemistry-9.2-gd.libvtkIOCityGML-9.2-gd.libvtkIOCONVERGECFD-9.2-gd.libvtkIOCore-9.2-gd.libvtkIOEnSight-9.2-gd.libvtkIOExodus-9.2-gd.libvtkIOExport-9.2-gd.libvtkIOExportGL2PS-9.2-gd.libvtkIOExportPDF-9.2-gd.libvtkIOGeometry-9.2-gd.libvtkIOHDF-9.2-gd.libvtkIOImage-9.2-gd.libvtkIOImport-9.2-gd.libvtkIOInfovis-9.2-gd.libvtkIOIOSS-9.2-gd.libvtkIOLegacy-9.2-gd.libvtkIOLSDyna-9.2-gd.libvtkIOMINC-9.2-gd.libvtkIOMotionFX-9.2-gd.libvtkIOMovie-9.2-gd.libvtkIONetCDF-9.2-gd.libvtkIOOggTheora-9.2-gd.libvtkIOParallel-9.2-gd.libvtkIOParallelXML-9.2-gd.libvtkIOPLY-9.2-gd.libvtkIOSegY-9.2-gd.libvtkIOSQL-9.2-gd.libvtkioss-9.2-gd.libvtkIOTecplotTable-9.2-gd.libvtkIOVeraOut-9.2-gd.libvtkIOVideo-9.2-gd.libvtkIOXML-9.2-gd.libvtkIOXMLParser-9.2-gd.libvtkjpeg-9.2-gd.libvtkjsoncpp-9.2-gd.libvtkkissfft-9.2-gd.libvtklibharu-9.2-gd.libvtklibproj-9.2-gd.libvtklibxml2-9.2-gd.libvtkloguru-9.2-gd.libvtklz4-9.2-gd.libvtklzma-9.2-gd.libvtkmetaio-9.2-gd.libvtknetcdf-9.2-gd.libvtkogg-9.2-gd.libvtkParallelCore-9.2-gd.libvtkParallelDIY-9.2-gd.libvtkpng-9.2-gd.libvtkpugixml-9.2-gd.libvtkRenderingAnnotation-9.2-gd.libvtkRenderingContext2D-9.2-gd.libvtkRenderingContextOpenGL2-9.2-gd.libvtkRenderingCore-9.2-gd.libvtkRenderingFreeType-9.2-gd.libvtkRenderingGL2PSOpenGL2-9.2-gd.libvtkRenderingHyperTreeGrid-9.2-gd.libvtkRenderingImage-9.2-gd.libvtkRenderingLabel-9.2-gd.libvtkRenderingLICOpenGL2-9.2-gd.libvtkRenderingLOD-9.2-gd.libvtkRenderingOpenGL2-9.2-gd.libvtkRenderingSceneGraph-9.2-gd.libvtkRenderingUI-9.2-gd.libvtkRenderingVolume-9.2-gd.libvtkRenderingVolumeOpenGL2-9.2-gd.libvtkRenderingVtkJS-9.2-gd.libvtksqlite-9.2-gd.libvtksys-9.2-gd.libvtkTestingRendering-9.2-gd.libvtktheora-9.2-gd.libvtktiff-9.2-gd.libvtkverdict-9.2-gd.libvtkViewsContext2D-9.2-gd.libvtkViewsCore-9.2-gd.libvtkViewsInfovis-9.2-gd.libvtkWrappingTools-9.2-gd.libvtkzlib-9.2-gd.libOpenNI2.lib
确定完成后右键点击项目文件,进入属性页面,进行下面操作
添加内容如下
PATH=C:\Program Files\PCL 1.13.1\bin;C:\Program Files\PCL 1.13.1\3rdParty\FLANN\bin;C:\Program Files\PCL 1.13.1\3rdParty\VTK\bin;C:\Program Files\PCL 1.13.1\3rdParty\Qhull\bin;C:\Program Files\PCL 1.13.1\3rdParty\OpenNI2\Tools;
至此,完成全部安装配置,大家关闭项目,重启下电脑就可以用PCL进行编程啦!!!