第一部分: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_80
C:\Program Files\PCL 1.13.1\3rdParty\Eigen\eigen3
C:\Program Files\PCL 1.13.1\3rdParty\FLANN\include
C:\Program Files\PCL 1.13.1\3rdParty\Qhull\include
C:\Program Files\PCL 1.13.1\3rdParty\VTK\include\vtk-9.2
C:\Program Files\PCL 1.13.1\include\pcl-1.13
C:\Program Files\PCL 1.13.1\3rdParty\OpenNI2\Include # OpenNI2安装地址可以自行更改
加入内容:
C:\Program Files\PCL 1.13.1\3rdParty\Boost\lib
C:\Program Files\PCL 1.13.1\lib
C:\Program Files\PCL 1.13.1\3rdParty\FLANN\lib
C:\Program Files\PCL 1.13.1\3rdParty\Qhull\lib
C:\Program Files\PCL 1.13.1\3rdParty\VTK\lib
C:\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 os
def 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.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-vc143-mt-gd-x64-1_80.lib
libboost_bzip2-vc143-mt-gd-x64-1_80.lib
libboost_chrono-vc143-mt-gd-x64-1_80.lib
libboost_container-vc143-mt-gd-x64-1_80.lib
libboost_context-vc143-mt-gd-x64-1_80.lib
libboost_contract-vc143-mt-gd-x64-1_80.lib
libboost_coroutine-vc143-mt-gd-x64-1_80.lib
libboost_date_time-vc143-mt-gd-x64-1_80.lib
libboost_exception-vc143-mt-gd-x64-1_80.lib
libboost_fiber-vc143-mt-gd-x64-1_80.lib
libboost_filesystem-vc143-mt-gd-x64-1_80.lib
libboost_graph-vc143-mt-gd-x64-1_80.lib
libboost_graph_parallel-vc143-mt-gd-x64-1_80.lib
libboost_iostreams-vc143-mt-gd-x64-1_80.lib
libboost_json-vc143-mt-gd-x64-1_80.lib
libboost_locale-vc143-mt-gd-x64-1_80.lib
libboost_log-vc143-mt-gd-x64-1_80.lib
libboost_log_setup-vc143-mt-gd-x64-1_80.lib
libboost_math_c99-vc143-mt-gd-x64-1_80.lib
libboost_math_c99f-vc143-mt-gd-x64-1_80.lib
libboost_math_c99l-vc143-mt-gd-x64-1_80.lib
libboost_math_tr1-vc143-mt-gd-x64-1_80.lib
libboost_math_tr1f-vc143-mt-gd-x64-1_80.lib
libboost_math_tr1l-vc143-mt-gd-x64-1_80.lib
libboost_mpi-vc143-mt-gd-x64-1_80.lib
libboost_nowide-vc143-mt-gd-x64-1_80.lib
libboost_numpy310-vc143-mt-gd-x64-1_80.lib
libboost_prg_exec_monitor-vc143-mt-gd-x64-1_80.lib
libboost_program_options-vc143-mt-gd-x64-1_80.lib
libboost_python310-vc143-mt-gd-x64-1_80.lib
libboost_random-vc143-mt-gd-x64-1_80.lib
libboost_regex-vc143-mt-gd-x64-1_80.lib
libboost_serialization-vc143-mt-gd-x64-1_80.lib
libboost_stacktrace_noop-vc143-mt-gd-x64-1_80.lib
libboost_stacktrace_windbg-vc143-mt-gd-x64-1_80.lib
libboost_stacktrace_windbg_cached-vc143-mt-gd-x64-1_80.lib
libboost_system-vc143-mt-gd-x64-1_80.lib
libboost_test_exec_monitor-vc143-mt-gd-x64-1_80.lib
libboost_thread-vc143-mt-gd-x64-1_80.lib
libboost_timer-vc143-mt-gd-x64-1_80.lib
libboost_type_erasure-vc143-mt-gd-x64-1_80.lib
libboost_unit_test_framework-vc143-mt-gd-x64-1_80.lib
libboost_wave-vc143-mt-gd-x64-1_80.lib
libboost_wserialization-vc143-mt-gd-x64-1_80.lib
libboost_zlib-vc143-mt-gd-x64-1_80.lib
flann-gd.lib
flann_cpp-gd.lib
flann_cpp_s-gd.lib
flann_s-gd.lib
qhullcpp_d.lib
qhullstatic_d.lib
qhullstatic_rd.lib
qhull_rd.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
OpenNI2.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进行编程啦!!!