本教程以vs2013,windows10 64位为例。PCL安装分为两种方法,第一种,直接从PCL源代码编译,后安装;第二种,使用PCL的All-in-one已经编译好的安装包安装,本文属于第二种方法。
- 1.pcl下载地址:http://pan.baidu.com/s/1qW1nkYg。
- 2.按照自己的需求选择安装版本,比如我这里选的就是vs2013 64位的版本。
在系统环境变量后面添加:;C:\Program Files\PCL 1.7.2\bin;C:\Program Files\PCL 1.7.2\3rdParty\FLANN\bin;C:\Program Files\PCL 1.7.2\3rdParty\VTK\bin;C:\Program Files\PCL 1.7.2\3rdParty\Qhull\bin
请不要复制上面的,根据自己的安装路径修改,另外要注意;在英文下输入,同时注意别少加;了。找不到path在哪里设置的自行百度。配置完path后,重启电脑让它生效。
如果你的安装环境跟我的一样,可以直接在属性管理器里面添加现有属性表,将我的pcl属性添加进去即可使用了:我的pcl属性配置
- 1.由于我安装的是64为版本的pcl,需要把win32改成x64(再属性管理器或者debug那里更改)。
- 2.创建一个vs2013 c++程序,然后对vs进行配置(以下都是根据自己的路径进行修改)。
- 1.右键项目属性,点C/C++,再点常规,找到附加包含目录,添加如下:
C:\Program Files\PCL 1.7.2\include\pcl-1.7
C:\Program Files\PCL 1.7.2\3rdParty\Boost\include\boost-1_57
C:\Program Files\PCL 1.7.2\3rdParty\Eigen\eigen3
C:\Program Files\PCL 1.7.2\3rdParty\FLANN\include
C:\Program Files\PCL 1.7.2\3rdParty\Qhull\include
C:\Program Files\PCL 1.7.2\3rdParty\VTK\include\vtk-6.22.点链接器,再点常规,找到附加库目录,添加如下:
C:\Program Files\PCL 1.7.2\lib
C:\Program Files\PCL 1.7.2\3rdParty\Boost\lib
C:\Program Files\PCL 1.7.2\3rdParty\FLANN\lib
C:\Program Files\PCL 1.7.2\3rdParty\Qhull\lib
C:\Program Files\PCL 1.7.2\3rdParty\VTK\lib3.点链接器,再点输入,找到附加依赖项,添加如下:
pcl_common_debug.lib
pcl_features_debug.lib
pcl_filters_debug.lib
pcl_io_debug.lib
pcl_io_ply_debug.lib
pcl_kdtree_debug.lib
pcl_keypoints_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_surface_debug.lib
pcl_tracking_debug.lib
pcl_visualization_debug.lib
libboost_atomic-vc120-mt-gd-1_57.lib
libboost_chrono-vc120-mt-gd-1_57.lib
libboost_container-vc120-mt-gd-1_57.lib
libboost_context-vc120-mt-gd-1_57.lib
libboost_coroutine-vc120-mt-gd-1_57.lib
libboost_date_time-vc120-mt-gd-1_57.lib
libboost_exception-vc120-mt-gd-1_57.lib
libboost_filesystem-vc120-mt-gd-1_57.lib
libboost_graph-vc120-mt-gd-1_57.lib
libboost_iostreams-vc120-mt-gd-1_57.lib
libboost_locale-vc120-mt-gd-1_57.lib
libboost_log-vc120-mt-gd-1_57.lib
libboost_log_setup-vc120-mt-gd-1_57.lib
libboost_math_c99-vc120-mt-gd-1_57.lib
libboost_math_c99f-vc120-mt-gd-1_57.lib
libboost_math_c99l-vc120-mt-gd-1_57.lib
libboost_math_tr1-vc120-mt-gd-1_57.lib
libboost_math_tr1f-vc120-mt-gd-1_57.lib
libboost_math_tr1l-vc120-mt-gd-1_57.lib
libboost_mpi-vc120-mt-gd-1_57.lib
libboost_prg_exec_monitor-vc120-mt-gd-1_57.lib
libboost_program_options-vc120-mt-gd-1_57.lib
libboost_random-vc120-mt-gd-1_57.lib
libboost_regex-vc120-mt-gd-1_57.lib
libboost_serialization-vc120-mt-gd-1_57.lib
libboost_signals-vc120-mt-gd-1_57.lib
libboost_system-vc120-mt-gd-1_57.lib
libboost_test_exec_monitor-vc120-mt-gd-1_57.lib
libboost_thread-vc120-mt-gd-1_57.lib
libboost_timer-vc120-mt-gd-1_57.lib
libboost_unit_test_framework-vc120-mt-gd-1_57.lib
libboost_wave-vc120-mt-gd-1_57.lib
libboost_wserialization-vc120-mt-gd-1_57.lib
flann_cpp_s-gd.lib
qhullstatic_d.lib
vtkalglib-6.2-gd.lib
vtkChartsCore-6.2-gd.lib
vtkCommonCore-6.2-gd.lib
vtkCommonColor-6.2-gd.lib
vtkCommonComputationalGeometry-6.2-gd.lib
vtkCommonDataModel-6.2-gd.lib
vtkCommonExecutionModel-6.2-gd.lib
vtkCommonMath-6.2-gd.lib
vtkCommonMisc-6.2-gd.lib
vtkCommonSystem-6.2-gd.lib
vtkCommonTransforms-6.2-gd.lib
vtkDICOMParser-6.2-gd.lib
vtkDomainsChemistry-6.2-gd.lib
vtkexoIIc-6.2-gd.lib
vtkexpat-6.2-gd.lib
vtkFiltersAMR-6.2-gd.lib
vtkFiltersCore-6.2-gd.lib
vtkFiltersExtraction-6.2-gd.lib
vtkFiltersFlowPaths-6.2-gd.lib
vtkFiltersGeneral-6.2-gd.lib
vtkFiltersGeneric-6.2-gd.lib
vtkFiltersGeometry-6.2-gd.lib
vtkFiltersHybrid-6.2-gd.lib
vtkFiltersHyperTree-6.2-gd.lib
vtkFiltersImaging-6.2-gd.lib
vtkFiltersModeling-6.2-gd.lib
vtkFiltersParallel-6.2-gd.lib
vtkFiltersParallelImaging-6.2-gd.lib
vtkFiltersProgrammable-6.2-gd.lib
vtkFiltersSelection-6.2-gd.lib
vtkFiltersSMP-6.2-gd.lib
vtkFiltersSources-6.2-gd.lib
vtkFiltersStatistics-6.2-gd.lib
vtkFiltersTexture-6.2-gd.lib
vtkFiltersVerdict-6.2-gd.lib
vtkfreetype-6.2-gd.lib
vtkftgl-6.2-gd.lib
vtkGeovisCore-6.2-gd.lib
vtkgl2ps-6.2-gd.lib
vtkhdf5-6.2-gd.lib
vtkhdf5_hl-6.2-gd.lib
vtkImagingColor-6.2-gd.lib
vtkImagingCore-6.2-gd.lib
vtkImagingFourier-6.2-gd.lib
vtkImagingGeneral-6.2-gd.lib
vtkImagingHybrid-6.2-gd.lib
vtkImagingMath-6.2-gd.lib
vtkImagingMorphological-6.2-gd.lib
vtkImagingSources-6.2-gd.lib
vtkImagingStatistics-6.2-gd.lib
vtkImagingStencil-6.2-gd.lib
vtkInfovisCore-6.2-gd.lib
vtkInfovisLayout-6.2-gd.lib
vtkInteractionImage-6.2-gd.lib
vtkInteractionStyle-6.2-gd.lib
vtkInteractionWidgets-6.2-gd.lib
vtkIOAMR-6.2-gd.lib
vtkIOCore-6.2-gd.lib
vtkIOEnSight-6.2-gd.lib
vtkIOExodus-6.2-gd.lib
vtkIOExport-6.2-gd.lib
vtkIOGeometry-6.2-gd.lib
vtkIOImage-6.2-gd.lib
vtkIOImport-6.2-gd.lib
vtkIOInfovis-6.2-gd.lib
vtkIOLegacy-6.2-gd.lib
vtkIOLSDyna-6.2-gd.lib
vtkIOMINC-6.2-gd.lib
vtkIOMovie-6.2-gd.lib
vtkIONetCDF-6.2-gd.lib
vtkIOParallel-6.2-gd.lib
vtkIOParallelXML-6.2-gd.lib
vtkIOPLY-6.2-gd.lib
vtkIOSQL-6.2-gd.lib
vtkIOVideo-6.2-gd.lib
vtkIOXML-6.2-gd.lib
vtkIOXMLParser-6.2-gd.lib
vtkjpeg-6.2-gd.lib
vtkjsoncpp-6.2-gd.lib
vtklibxml2-6.2-gd.lib
vtkmetaio-6.2-gd.lib
vtkNetCDF-6.2-gd.lib
vtkNetCDF_cxx-6.2-gd.lib
vtkoggtheora-6.2-gd.lib
vtkParallelCore-6.2-gd.lib
vtkpng-6.2-gd.lib
vtkproj4-6.2-gd.lib
vtkRenderingAnnotation-6.2-gd.lib
vtkRenderingContext2D-6.2-gd.lib
vtkRenderingContextOpenGL-6.2-gd.lib
vtkRenderingCore-6.2-gd.lib
vtkRenderingFreeType-6.2-gd.lib
vtkRenderingFreeTypeOpenGL-6.2-gd.lib
vtkRenderingGL2PS-6.2-gd.lib
vtkRenderingImage-6.2-gd.lib
vtkRenderingLabel-6.2-gd.lib
vtkRenderingLIC-6.2-gd.lib
vtkRenderingLOD-6.2-gd.lib
vtkRenderingOpenGL-6.2-gd.lib
vtkRenderingVolume-6.2-gd.lib
vtkRenderingVolumeOpenGL-6.2-gd.lib
vtksqlite-6.2-gd.lib
vtksys-6.2-gd.lib
vtktiff-6.2-gd.lib
vtkverdict-6.2-gd.lib
vtkViewsContext2D-6.2-gd.lib
vtkViewsCore-6.2-gd.lib
vtkViewsInfovis-6.2-gd.lib
vtkzlib-6.2-gd.lib
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib
odbccp32.lib
vs版本是2013的可以直接复制到附加依赖项里。注意vs2012,vs2015版的依赖库不一样,不能直接复制上面的,把上面的的复制到记事本里,然后,查看pcl安装路径下boost库的lib文件夹,里面的lib名字里会带有vc***,这个是编译器版本号,例如vs2013版的pcl是上面的vc***是vc120,然后利用记事本的替换功能,把vc120,替换为上面你找到的编译器版本号vc***,再拷贝到附加依赖项里。
将下面代码拷贝到vs里,点运行,出现控制台窗口后,提示未找到点云文件,这个可以不管,不报错误,即成功配置pcl。
#include "stdafx.h"
#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;
}
安装常见错误解决方法
1.提示未找到pcl的头文件等,该问题是附加包含目录里库路径设置不正确导致的,修改或添加相关路径。
2.配置64位pcl出现无法解析的外部符号错误,该错误是解决方案平台未修改导致的,把win32换成x64。
3.有个别人添加了上述路径后发生,还是提示dll找不到的情况,有可能是你在path里少添加相关dll的路径了。还有一个原因是path有长度限制,超出长度的部分就不认了,这时,可以把上面所有bin文件夹下的dll拷贝到C:WindowsSystem32文件夹里。
参考:pcl 1.7.2简单安装教程