Windows11+VS2022+PCL1.13.0 安装配置记录
- 下载PCL AllInOne 安装包
- 安装 PCL
- OpenNI2 安装确认
- 系统环境变量配置
- Visual Studio环境配置
- 1. C/C++ — 所有选项 — SDL检查 — 设置为**否**
- 2. VC++目录 — 包含目录 — 编辑 –添加新的目录如下
- 3. VC++目录 — 库目录 — 编辑 –添加新的目录如下
- 4. C/C++ — 预处理器 — 预处理器定义 — 编辑 –添加预处理器定义如下
- 5. 链接器 — 输入 — 附加依赖项 — 编辑
- 6. C/C++ – 代码生成 – 启用增强指令集 – 选择高级矢量扩展
- 7. 项目–属性–调试–环境–编辑—添加环境如下
- PCL 测试
下载PCL AllInOne 安装包
在release页面下载和自己电脑上VS版本对应的AllInOne exe
安装 PCL
双击下载的AllInOne exe
这里选择给所有用户添加环境变量
老规矩,安装目录改到D盘。
所有依赖都装。
waiting…几分钟的样子
win11还有这玩意儿
环境变量写入失败,无所谓,等会儿自己加。
完成。
OpenNI2 安装确认
进入安装目录下的3rdParty检查OpenNI2有没有安装,一般都会安装到C盘,打开C盘的Program Files文件夹,果然,它直接安装到了C盘,并且还自动写入了环境变量。
由于强迫症的关系,决定把它重装在D盘。在该PCL安装路径下的3rdParty/OpenNI2可以看到安装包,双击打开。
remove卸载掉原有安装
卸载完成,重新双击安装,更改安装位置
很快就安装完成了。
系统环境变量配置
首先是OpenNI2的环境变量,因为在安装时已经写入了PCL_ROOT这个环境变量,所以OpenNI2环境变量可以改为如下形式
然后打开Path,添加
%PCL_ROOT%\bin
%PCL_ROOT%\3rdParty\VTK\bin
%PCL_ROOT%\3rdParty\FLANN\bin
%PCL_ROOT%\3rdParty\OpenNI2\Tools
%PCL_ROOT%\3rdParty\Qhull\bin
%OPENNI2_REDIST64%
%OPENNI2_LIB64%
%OPENNI2_INCLUDE64%
Visual Studio环境配置
创建一个新项目PCL_test,打开属性管理器,先配置x64 的Release,新建属性表,命名为 PCL1.13_Release_x64.props。
双击该属性表,开始配置
1. C/C++ – 所有选项 – SDL检查 – 设置为否
2. VC++目录 – 包含目录 – 编辑 –添加新的目录如下
D:\Program Files (x86)\PCL 1.13.0\include\pcl-1.13
D:\Program Files (x86)\PCL 1.13.0\3rdParty\Boost\include\boost-1_80
D:\Program Files (x86)\PCL 1.13.0\3rdParty\Eigen\eigen3
D:\Program Files (x86)\PCL 1.13.0\3rdParty\FLANN\include
D:\Program Files (x86)\PCL 1.13.0\3rdParty\OpenNI2\Include
D:\Program Files (x86)\PCL 1.13.0\3rdParty\Qhull\include
D:\Program Files (x86)\PCL 1.13.0\3rdParty\VTK\include\vtk-9.2
3. VC++目录 – 库目录 – 编辑 –添加新的目录如下
D:\Program Files (x86)\PCL 1.13.0\lib
D:\Program Files (x86)\PCL 1.13.0\3rdParty\Boost\lib
D:\Program Files (x86)\PCL 1.13.0\3rdParty\FLANN\lib
D:\Program Files (x86)\PCL 1.13.0\3rdParty\OpenNI2\Lib
D:\Program Files (x86)\PCL 1.13.0\3rdParty\Qhull\lib
D:\Program Files (x86)\PCL 1.13.0\3rdParty\VTK\lib
4. C/C++ – 预处理器 – 预处理器定义 – 编辑 –添加预处理器定义如下
BOOST_USE_WINDOWS_H
NOMINMAX
_CRT_SECURE_NO_DEPRECATE
5. 链接器 – 输入 – 附加依赖项 – 编辑
这里需要对PCL和VTK的lib进行提取,Release和Debug所需的lib不一样,Debug是 **d.lib 类型,Release是 *.lib 类型。之前我写了一个简单的小脚本来自动提取两种lib。(当然也可以通过手动输入或其他方式获取相应lib。)脚本代码如下
# File :Extract_lib_to_txt.py
# Auther :WooChi
# Time :2022/06/08
# Version :1.0
# Function :自动提取lib文件夹下的.lib文件,根据文件名分别导出到release_lib.txt和debug_lib.txt中
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)
先提取VTK的lib,结果如下
vtk_debug_lib.txt
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
vtk_release_lib.txt
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
再提取PCL的lib,结果如下
pcl_debug_lib.txt
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
pcl_release_lib.txt
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
现在在附加依赖项里输入Release版的lib(Debug版属性表主要在这一步不一样,可以通过复制Release版属性表的方式添加现有属性表修改或者新建属性表重新配置,我就不再啰嗦了)
6. C/C++ – 代码生成 – 启用增强指令集 – 选择高级矢量扩展
这一步与Eigen库相关,不加上的话程序在使用Eigen库时可能出现中断。
点击右下角应用,确定保存属性表
然后,还有重要的一步,亲测如果没有这一步,会出现找不到 pcl_***.dll 的报错信息
7. 项目–属性–调试–环境–编辑—添加环境如下
PATH=$(PCL_ROOT)\bin;$(PCL_ROOT)\3rdParty\FLANN\bin;$(PCL_ROOT)\3rdParty\VTK\bin;$(PCL_ROOT)\3rdParty\Qhull\bin;$(PCL_ROOT)\3rdParty\OpenNI2\Tools;$(PATH)
小伙伴说找不到环境位置,补了一个图在这儿。
接下来可以开始测试了。
PCL 测试
随便找一份测试代码
#include <iostream>
#include <pcl/common/common_headers.h>
#include <pcl/io/pcd_io.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/console/parse.h>
int main(int argc, char **argv) {
std::cout << "Test PCL !!!" << std::endl;
pcl::PointCloud<pcl::PointXYZRGB>::Ptr point_cloud_ptr (new pcl::PointCloud<pcl::PointXYZRGB>);
uint8_t r(255), g(15), b(15);
for (float z(-1.0); z <= 1.0; z += 0.05)
{
for (float angle(0.0); angle <= 360.0; angle += 5.0)
{
pcl::PointXYZRGB point;
point.x = 0.5 * cosf (pcl::deg2rad(angle));
point.y = sinf (pcl::deg2rad(angle));
point.z = z;
uint32_t rgb = (static_cast<uint32_t>(r) << 16 |
static_cast<uint32_t>(g) << 8 | static_cast<uint32_t>(b));
point.rgb = *reinterpret_cast<float*>(&rgb);
point_cloud_ptr->points.push_back (point);
}
if (z < 0.0)
{
r -= 12;
g += 12;
}
else
{
g -= 12;
b += 12;
}
}
point_cloud_ptr->width = (int) point_cloud_ptr->points.size ();
point_cloud_ptr->height = 1;
pcl::visualization::CloudViewer viewer ("test");
viewer.showCloud(point_cloud_ptr);
while (!viewer.wasStopped()){ };
return 0;
}
执行成功
打完收工。
文章出处登录后可见!