文章目录
说明
- 欢迎进群探讨 PCL 的更多问题
QQ群号:190162198
QQ群名:PCL点云部落
PCL1.8.0+VS2013+Win10 配置
配置环境前需要准备的工具有:
- PCL-1.8.0-AllInOne-msvc2013-win32 或者 PCL-1.8.0-AllInOne-msvc2013-win64
- VS2013
- Qt(可选)
注:本文是在 64 位操作系统下进行安装操作的!包括PCL的安装也是 64 位的!
注:以上软件均可在QQ群获取
下载完成后开始安装吧~~~
第一步:PCL 的安装
注意事项:
- 安装位置
默认安装在C盘,修改位置到其他盘符,作者使用 D:\PCL1.8\ 进行安装
- 中途弹出安装OpenNI的安装选项
安装到 D:\PCL1.8\PCL 1.8.0\3rdParty\OpenNI2 目录下
- 直到安装完成 …
第二步:环境变量的配置
首先打开环境变量设置界面:此电脑->右键属性->高级系统变量->环境变量->系统变量:
该3项是在安装完成后自动生成的,同理:
该项也是自动生成的。我们需要做的是:选中系统变量中的Path,选择编辑,然后添加以下5条:
在这里直接给出,防止出现错误(依次添加):
%PCL_ROOT%\3rdParty\FLANN\bin
%PCL_ROOT%\3rdParty\VTK\bin
%OPENNI2_REDIST64%
%OPENNI2_LIB64%
%OPENNI2_INCLUDE64%
到此,环境变量的配置完成。
第三步:新建一个 x64 的控制台项目
首先,新建一个空项目:打开VS2013->文件>新建>项目。
新建一个空 Win 32 项目:注意是Win 32 控制台项目。
将项目属性切换为 64 位:项目右键->属性->配置管理器->下拉菜单选择新建。
然后选择 x64 ,单击确定后,在配置管理器界面点击确定,退出配置管理器。
至此,完成 64 位平台的更改。
第四步:包含目录、库目录、附加依赖项的配置
首先,打开属性管理器:视图->*其他窗口->属性管理器。
然后选择 Debug | x64 :右键->添加新项目属性表,命名为 PCL ,最终结果如黄色椭圆形所示。
包含目录的编辑:选择新建的PCL->右键属性->通用属性->VC++目录->包含目录,添加如下:
还是,为了方便,将包含目录添加项贴出:
D:\PCL1.8\PCL 1.8.0\include\pcl-1.8
D:\PCL1.8\PCL 1.8.0\3rdParty\Boost\include\boost-1_59
D:\PCL1.8\PCL 1.8.0\3rdParty\Qhull\include
D:\PCL1.8\PCL 1.8.0\3rdParty\FLANN\include
D:\PCL1.8\PCL 1.8.0\3rdParty\VTK\include\vtk-7.0
D:\PCL1.8\PCL 1.8.0\3rdParty\Eigen\eigen3
库目录的编辑:选择新建的PCL->右键属性->通用属性->VC++目录->库目录,添加如下:
将库目录的添加项贴出:
D:\PCL1.8\PCL 1.8.0\3rdParty\VTK\lib
D:\PCL1.8\PCL 1.8.0\3rdParty\FLANN\lib
D:\PCL1.8\PCL 1.8.0\3rdParty\Qhull\lib
D:\PCL1.8\PCL 1.8.0\3rdParty\Boost\lib
D:\PCL1.8\PCL 1.8.0\lib
附加依赖项的编辑:选择新建的PCL->右键属性->通用属性->链接器->输入->附加依赖项,添加如下:
将附加依赖项的添加项贴出(略多):
pcl_apps_debug.lib
pcl_common_debug.lib
pcl_features_debug.lib
pcl_filters_debug.lib
pcl_io_ply_debug.lib
pcl_io_debug.lib
pcl_kdtree_debug.lib
pcl_keypoints_debug.lib
pcl_ml_debug.lib
pcl_octree_debug.lib
pcl_outofcore_debug.lib
pcl_people_debug.lib
pcl_recognition_debug.lib
pcl_registration_debug.lib
pcl_sample_consensus_debug.lib
pcl_search_debug.lib
pcl_segmentation_debug.lib
pcl_simulation_debug.lib
pcl_stereo_debug.lib
pcl_surface_debug.lib
pcl_tracking_debug.lib
pcl_visualization_debug.lib
libboost_atomic-vc120-mt-gd-1_59.lib
libboost_chrono-vc120-mt-gd-1_59.lib
libboost_container-vc120-mt-gd-1_59.lib
libboost_context-vc120-mt-gd-1_59.lib
libboost_coroutine-vc120-mt-gd-1_59.lib
libboost_date_time-vc120-mt-gd-1_59.lib
libboost_exception-vc120-mt-gd-1_59.lib
libboost_filesystem-vc120-mt-gd-1_59.lib
libboost_graph-vc120-mt-gd-1_59.lib
libboost_iostreams-vc120-mt-gd-1_59.lib
libboost_locale-vc120-mt-gd-1_59.lib
libboost_log-vc120-mt-gd-1_59.lib
libboost_log_setup-vc120-mt-gd-1_59.lib
libboost_math_c99-vc120-mt-gd-1_59.lib
libboost_math_c99f-vc120-mt-gd-1_59.lib
libboost_math_c99l-vc120-mt-gd-1_59.lib
libboost_math_tr1-vc120-mt-gd-1_59.lib
libboost_math_tr1f-vc120-mt-gd-1_59.lib
libboost_math_tr1l-vc120-mt-gd-1_59.lib
libboost_mpi-vc120-mt-gd-1_59.lib
libboost_prg_exec_monitor-vc120-mt-gd-1_59.lib
libboost_program_options-vc120-mt-gd-1_59.lib
libboost_random-vc120-mt-gd-1_59.lib
libboost_regex-vc120-mt-gd-1_59.lib
libboost_serialization-vc120-mt-gd-1_59.lib
libboost_signals-vc120-mt-gd-1_59.lib
libboost_system-vc120-mt-gd-1_59.lib
libboost_test_exec_monitor-vc120-mt-gd-1_59.lib
libboost_thread-vc120-mt-gd-1_59.lib
libboost_timer-vc120-mt-gd-1_59.lib
libboost_unit_test_framework-vc120-mt-gd-1_59.lib
libboost_wave-vc120-mt-gd-1_59.lib
libboost_wserialization-vc120-mt-gd-1_59.lib
flann-gd.lib
flann_cpp_s-gd.lib
flann_s-gd.lib
qhull-gd.lib
qhullcpp-gd.lib
qhullstatic-gd.lib
qhullstatic_r-gd.lib
qhull_p-gd.lib
qhull_r-gd.lib
vtkalglib-7.0-gd.lib
vtkChartsCore-7.0-gd.lib
vtkCommonColor-7.0-gd.lib
vtkCommonComputationalGeometry-7.0-gd.lib
vtkCommonCore-7.0-gd.lib
vtkCommonDataModel-7.0-gd.lib
vtkCommonExecutionModel-7.0-gd.lib
vtkCommonMath-7.0-gd.lib
vtkCommonMisc-7.0-gd.lib
vtkCommonSystem-7.0-gd.lib
vtkCommonTransforms-7.0-gd.lib
vtkDICOMParser-7.0-gd.lib
vtkDomainsChemistry-7.0-gd.lib
vtkDomainsChemistryOpenGL2-7.0-gd.lib
vtkexoIIc-7.0-gd.lib
vtkexpat-7.0-gd.lib
vtkFiltersAMR-7.0-gd.lib
vtkFiltersCore-7.0-gd.lib
vtkFiltersExtraction-7.0-gd.lib
vtkFiltersFlowPaths-7.0-gd.lib
vtkFiltersGeneral-7.0-gd.lib
vtkFiltersGeneric-7.0-gd.lib
vtkFiltersGeometry-7.0-gd.lib
vtkFiltersHybrid-7.0-gd.lib
vtkFiltersHyperTree-7.0-gd.lib
vtkFiltersImaging-7.0-gd.lib
vtkFiltersModeling-7.0-gd.lib
vtkFiltersParallel-7.0-gd.lib
vtkFiltersParallelImaging-7.0-gd.lib
vtkFiltersProgrammable-7.0-gd.lib
vtkFiltersSelection-7.0-gd.lib
vtkFiltersSMP-7.0-gd.lib
vtkFiltersSources-7.0-gd.lib
vtkFiltersStatistics-7.0-gd.lib
vtkFiltersTexture-7.0-gd.lib
vtkFiltersVerdict-7.0-gd.lib
vtkfreetype-7.0-gd.lib
vtkGeovisCore-7.0-gd.lib
vtkglew-7.0-gd.lib
vtkGUISupportQt-7.0-gd.lib
vtkGUISupportQtSQL-7.0-gd.lib
vtkhdf5-7.0-gd.lib
vtkhdf5_hl-7.0-gd.lib
vtkImagingColor-7.0-gd.lib
vtkImagingCore-7.0-gd.lib
vtkImagingFourier-7.0-gd.lib
vtkImagingGeneral-7.0-gd.lib
vtkImagingHybrid-7.0-gd.lib
vtkImagingMath-7.0-gd.lib
vtkImagingMorphological-7.0-gd.lib
vtkImagingSources-7.0-gd.lib
vtkImagingStatistics-7.0-gd.lib
vtkImagingStencil-7.0-gd.lib
vtkInfovisCore-7.0-gd.lib
vtkInfovisLayout-7.0-gd.lib
vtkInteractionImage-7.0-gd.lib
vtkInteractionStyle-7.0-gd.lib
vtkInteractionWidgets-7.0-gd.lib
vtkIOAMR-7.0-gd.lib
vtkIOCore-7.0-gd.lib
vtkIOEnSight-7.0-gd.lib
vtkIOExodus-7.0-gd.lib
vtkIOExport-7.0-gd.lib
vtkIOGeometry-7.0-gd.lib
vtkIOImage-7.0-gd.lib
vtkIOImport-7.0-gd.lib
vtkIOInfovis-7.0-gd.lib
vtkIOLegacy-7.0-gd.lib
vtkIOLSDyna-7.0-gd.lib
vtkIOMINC-7.0-gd.lib
vtkIOMovie-7.0-gd.lib
vtkIONetCDF-7.0-gd.lib
vtkIOParallel-7.0-gd.lib
vtkIOParallelXML-7.0-gd.lib
vtkIOPLY-7.0-gd.lib
vtkIOSQL-7.0-gd.lib
vtkIOVideo-7.0-gd.lib
vtkIOXML-7.0-gd.lib
vtkIOXMLParser-7.0-gd.lib
vtkjpeg-7.0-gd.lib
vtkjsoncpp-7.0-gd.lib
vtklibxml2-7.0-gd.lib
vtkmetaio-7.0-gd.lib
vtkNetCDF-7.0-gd.lib
vtkNetCDF_cxx-7.0-gd.lib
vtkoggtheora-7.0-gd.lib
vtkParallelCore-7.0-gd.lib
vtkpng-7.0-gd.lib
vtkproj4-7.0-gd.lib
vtkRenderingAnnotation-7.0-gd.lib
vtkRenderingContext2D-7.0-gd.lib
vtkRenderingContextOpenGL2-7.0-gd.lib
vtkRenderingCore-7.0-gd.lib
vtkRenderingFreeType-7.0-gd.lib
vtkRenderingImage-7.0-gd.lib
vtkRenderingLabel-7.0-gd.lib
vtkRenderingLOD-7.0-gd.lib
vtkRenderingOpenGL2-7.0-gd.lib
vtkRenderingQt-7.0-gd.lib
vtkRenderingVolume-7.0-gd.lib
vtkRenderingVolumeOpenGL2-7.0-gd.lib
vtksqlite-7.0-gd.lib
vtksys-7.0-gd.lib
vtktiff-7.0-gd.lib
vtkverdict-7.0-gd.lib
vtkViewsContext2D-7.0-gd.lib
vtkViewsCore-7.0-gd.lib
vtkViewsInfovis-7.0-gd.lib
vtkViewsQt-7.0-gd.lib
vtkzlib-7.0-gd.lib
注:以上附加依赖项只针对 PCL1.8.0 !
第五步:项目环境目录配置
项目->右键->属性->配置属性->调试->环境:
贴出环境目录配置:
PATH=$(PCL_ROOT)\bin;$(PCL_ROOT)\3rdParty\FLANN\bin;$(PCL_ROOT)\3rdParty\VTK\bin;$(PCL_ROOT)\Qhull\bin;$(PCL_ROOT)\3rdParty\OpenNI2\Tools;$(PATH)
第六步:测试是否配置成功
新建一个 main.cpp ,输入以下代码:
#include <pcl/visualization/cloud_viewer.h>
#include <iostream>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
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::PointCloud<pcl::PointXYZRGBA>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::io::loadPCDFile("my_point_cloud.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;
}
Ctrl + F5 进行调试,若出现如下界面,则表示配置成功,其中:通过鼠标移动可以调整圆球方位,滚轮可以进行放大缩小操作。
第七步:导出配置
如果测试成功,那么就恭喜了~~~然后将我们配置的 PCL.props 上右键,保存PCL,将其导出到本地,以后在做相关工程时,直接在 Debug | x64 下将 PCL.props 添加进来即可。
至此,配置完成~~~
个人心得体会:PCL 程序还是很耗CPU的,博主用的 Intel i7-7700 CPU,8G 内存,运行该程序时,CPU 占到40%,CPU 温度 50℃,内存55%,清大家注意,配置一款强悍的独立显卡还是必要的!
常见问题汇总
-
问题1:
VS 安装失败?
- 方案一:之前是否安装过其他VS版本?如果是,清先卸载其他版本,重新安装
- 方案二:其他未知原因?清重装系统(哈哈) 问题2: PCL 安装失败?
- 方案:这个就很尴尬了,解决方法:未知。。。 问题3: 提示缺少 pcl_common_debug.dll、pcl_io_debug.dll、pcl_visualization_debug.dll、vtkCommonCore-7.0-gd.dll?
- 方案一:重启VS
- 方案二:重启电脑 问题4: 其他
- …
参考博客
-
Summit_Yue:Windows10下VS2013+PCL1.8环境配置
-
lvei_jenny:vs +pcl 配置问题
-
ideallic:PCL1.8.0+VS2013配置教程
-
…