PCL 1.8.0 +VS2015配置
因为要做三维重建,所以想用三维点云处理库Point Cloud Library(PCL),找了几篇博文按照要求装了一下午的依赖库,后来发现已经出了PCL 1.8.0的all-in-one,
下载链接:http://pointclouds.org/downloads/windows.html
上面有各种版本:
PCL 1.8.0 All-in-one Installer MSVC2015 Win64
PCL 1.8.0 All-in-one Installer MSVC2015 Win32
PCL 1.8.0 All-in-one Installer MSVC2013 Win32
PCL 1.8.0 All-in-one Installer MSVC2013 Win64
还提供了各自的PDB调试文件,大家可以根据自己的需要下载,下载后解压到pcl_all_in_one 1.8.0安装目录的bin文件夹下。
配置过程如下:
安装的版本是PCL-1.8.0-AllInOne-msvc2015-win64
配置过程可参考博客:http://blog.csdn.net/u014283958/article/details/52599457
1.下载安装
下载并安装PCL 1.8.0 All-in-one Installer MSVC2015 Win64
安装时选择好自己的安装路径,如本文用的是:D:\Program Files\PCL 1.8.0
然后一直点下一步即可,注意在安装openni时要选择你之前PCL安装路径的的3rdParty文件夹下,在这里就是D:\Program Files\PCL 1.8.0\3rdParty
最后完成安装
2、配置环境变量
安装完成后在系统变量中会出现:(如果没有可以手动添加)
然后在系统变量Path里加入:;%PCL_ROOT%\bin;%OPENNI2_REDIST64% (or %OPENNI2_REDIST%要根据自己系统)
3.设置包含目录
在VS里新建项目并在属性管理器中的VC++的包含目录中添加:
D:\Program Files\PCL 1.8.0\include\pcl-1.8
D:\Program Files\PCL 1.8.0\3rdParty\Boost\include\boost-1_61
D:\Program Files\PCL 1.8.0\3rdParty\Qhull\include
D:\Program Files\PCL 1.8.0\3rdParty\FLANN\include\flann
D:\Program Files\PCL 1.8.0\3rdParty\VTK\include\vtk-7.0
D:\Program Files\PCL 1.8.0\3rdParty\Eigen\eigen3
4.设置库目录
在VC++的库目录中添加:
D:\Program Files\PCL 1.8.0\3rdParty\VTK\lib
D:\Program Files\PCL 1.8.0\3rdParty\FLANN\lib
D:\Program Files\PCL 1.8.0\3rdParty\Qhull\lib
D:\Program Files\PCL 1.8.0\3rdParty\Boost\lib
D:\Program Files\PCL 1.8.0\lib
5.设置附加依赖项(PCL 1.8.0 All-in-one Installer MSVC2015 Win64版本的原博客的附加项编译通不过)
后来找个这个博客的附加列表是可以的 http://blog.csdn.net/zpp13hao1/article/details/61916222
附加项的列表如下:
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_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_stereo_debug.lib
pcl_surface_debug.lib
pcl_tracking_debug.lib
pcl_visualization_debug.lib
libboost_atomic-vc140-mt-gd-1_61.lib
libboost_chrono-vc140-mt-gd-1_61.lib
libboost_container-vc140-mt-gd-1_61.lib
libboost_context-vc140-mt-gd-1_61.lib
libboost_coroutine-vc140-mt-gd-1_61.lib
libboost_date_time-vc140-mt-gd-1_61.lib
libboost_exception-vc140-mt-gd-1_61.lib
libboost_filesystem-vc140-mt-gd-1_61.lib
libboost_graph-vc140-mt-gd-1_61.lib
libboost_iostreams-vc140-mt-gd-1_61.lib
libboost_locale-vc140-mt-gd-1_61.lib
libboost_log-vc140-mt-gd-1_61.lib
libboost_log_setup-vc140-mt-gd-1_61.lib
libboost_math_c99-vc140-mt-gd-1_61.lib
libboost_math_c99f-vc140-mt-gd-1_61.lib
libboost_math_c99l-vc140-mt-gd-1_61.lib
libboost_math_tr1-vc140-mt-gd-1_61.lib
libboost_math_tr1f-vc140-mt-gd-1_61.lib
libboost_math_tr1l-vc140-mt-gd-1_61.lib
libboost_mpi-vc140-mt-gd-1_61.lib
libboost_prg_exec_monitor-vc140-mt-gd-1_61.lib
libboost_program_options-vc140-mt-gd-1_61.lib
libboost_random-vc140-mt-gd-1_61.lib
libboost_regex-vc140-mt-gd-1_61.lib
libboost_serialization-vc140-mt-gd-1_61.lib
libboost_signals-vc140-mt-gd-1_61.lib
libboost_system-vc140-mt-gd-1_61.lib
libboost_test_exec_monitor-vc140-mt-gd-1_61.lib
libboost_thread-vc140-mt-gd-1_61.lib
libboost_timer-vc140-mt-gd-1_61.lib
libboost_type_erasure-vc140-mt-gd-1_61.lib
libboost_unit_test_framework-vc140-mt-gd-1_61.lib
libboost_wave-vc140-mt-gd-1_61.lib
libboost_wserialization-vc140-mt-gd-1_61.lib
vtkzlib-7.0-gd.lib
vtkViewsContext2D-7.0-gd.lib
vtkhdf5_hl-7.0-gd.lib
vtkFiltersProgrammable-7.0-gd.lib
vtkIOMovie-7.0-gd.lib
vtkexpat-7.0-gd.lib
vtkRenderingLOD-7.0-gd.lib
vtkIOPLY-7.0-gd.lib
vtkpng-7.0-gd.lib
vtkIOVideo-7.0-gd.lib
vtkRenderingImage-7.0-gd.lib
vtkFiltersVerdict-7.0-gd.lib
vtkNetCDF_cxx-7.0-gd.lib
vtkjpeg-7.0-gd.lib
vtkInteractionImage-7.0-gd.lib
vtkverdict-7.0-gd.lib
vtkoggtheora-7.0-gd.lib
vtkImagingStatistics-7.0-gd.lib
vtkCommonSystem-7.0-gd.lib
vtkFiltersParallelImaging-7.0-gd.lib
vtkFiltersTexture-7.0-gd.lib
vtkCommonMisc-7.0-gd.lib
vtkCommonMath-7.0-gd.lib
vtkFiltersSelection-7.0-gd.lib
vtkImagingFourier-7.0-gd.lib
vtkIOXMLParser-7.0-gd.lib
vtkproj4-7.0-gd.lib
vtkalglib-7.0-gd.lib
vtktiff-7.0-gd.lib
vtksqlite-7.0-gd.lib
vtkImagingSources-7.0-gd.lib
vtkCommonTransforms-7.0-gd.lib
vtkImagingMath-7.0-gd.lib
vtkFiltersGeneric-7.0-gd.lib
vtkexoIIc-7.0-gd.lib
vtkfreetype-7.0-gd.lib
vtkImagingColor-7.0-gd.lib
vtkNetCDF-7.0-gd.lib
vtkFiltersImaging-7.0-gd.lib
vtkFiltersHyperTree-7.0-gd.lib
vtkImagingMorphological-7.0-gd.lib
vtkImagingStencil-7.0-gd.lib
vtkRenderingFreeType-7.0-gd.lib
vtkCommonColor-7.0-gd.lib
vtkjsoncpp-7.0-gd.lib
vtkRenderingContext2D-7.0-gd.lib
vtkFiltersAMR-7.0-gd.lib
vtkRenderingContextOpenGL-7.0-gd.lib
vtkIOParallelXML-7.0-gd.lib
vtkViewsCore-7.0-gd.lib
vtkImagingHybrid-7.0-gd.lib
vtkIOExport-7.0-gd.lib
vtkRenderingVolumeOpenGL-7.0-gd.lib
vtkIOImport-7.0-gd.lib
vtkDomainsChemistry-7.0-gd.lib
vtkInteractionStyle-7.0-gd.lib
vtkCommonComputationalGeometry-7.0-gd.lib
vtkDICOMParser-7.0-gd.lib
vtklibxml2-7.0-gd.lib
vtkIOMINC-7.0-gd.lib
vtkIOSQL-7.0-gd.lib
vtkFiltersModeling-7.0-gd.lib
vtkParallelCore-7.0-gd.lib
vtkIOAMR-7.0-gd.lib
vtkGeovisCore-7.0-gd.lib
vtksys-7.0-gd.lib
vtkIOEnSight-7.0-gd.lib
vtkImagingGeneral-7.0-gd.lib
vtkFiltersFlowPaths-7.0-gd.lib
vtkIOLSDyna-7.0-gd.lib
vtkFiltersSMP-7.0-gd.lib
vtkIOParallel-7.0-gd.lib
vtkFiltersGeometry-7.0-gd.lib
vtkInfovisLayout-7.0-gd.lib
vtkIOCore-7.0-gd.lib
vtkFiltersSources-7.0-gd.lib
vtkIOLegacy-7.0-gd.lib
vtkFiltersHybrid-7.0-gd.lib
vtkIONetCDF-7.0-gd.lib
vtkFiltersExtraction-7.0-gd.lib
vtkFiltersParallel-7.0-gd.lib
vtkRenderingLabel-7.0-gd.lib
vtkIOInfovis-7.0-gd.lib
vtkRenderingAnnotation-7.0-gd.lib
vtkImagingCore-7.0-gd.lib
vtkCommonExecutionModel-7.0-gd.lib
vtkhdf5-7.0-gd.lib
vtkViewsInfovis-7.0-gd.lib
vtkIOGeometry-7.0-gd.lib
vtkmetaio-7.0-gd.lib
vtkIOImage-7.0-gd.lib
vtkIOXML-7.0-gd.lib
vtkIOExodus-7.0-gd.lib
vtkRenderingVolume-7.0-gd.lib
vtkChartsCore-7.0-gd.lib
vtkFiltersStatistics-7.0-gd.lib
vtkInfovisCore-7.0-gd.lib
vtkRenderingCore-7.0-gd.lib
vtkInteractionWidgets-7.0-gd.lib
vtkRenderingOpenGL-7.0-gd.lib
vtkFiltersGeneral-7.0-gd.lib
vtkFiltersCore-7.0-gd.lib
vtkCommonDataModel-7.0-gd.lib
vtkCommonCore-7.0-gd.lib
flann_cpp_s-gd.lib
qhullstatic_d.lib
OpenNI2.lib
至此配置完成
配置的文件见:链接: https://pan.baidu.com/s/1gfaghVl 密码: 3ank
配置完成之后的测试
新建一个VC的控制台程序,代码如下:
#include "stdafx.h"
#include <pcl/io/io.h>
#include <pcl/io/ply_io.h>
#include <pcl/io/pcd_io.h>
#include <pcl/visualization/cloud_viewer.h>
int main()
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cl_model(new pcl::PointCloud<pcl::PointXYZ>);
if (pcl::io::loadPLYFile("model_1.ply", *cl_model) == -1)
{
PCL_ERROR("Could not read ply file!\n");
return -1;
}
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer(new pcl::visualization::PCLVisualizer("PointsCloud Recognition"));
viewer->addPointCloud(cl_model, "model_cloud");
viewer->addCoordinateSystem(1.0);
viewer->initCameraParameters();
while (!viewer->wasStopped())
{
viewer->spinOnce(100);
boost::this_thread::sleep(boost::posix_time::microseconds(100000));
}
return 0;
}
代码中的model_1.ply见:链接: https://pan.baidu.com/s/1pL5DSs7 密码: hjgd
效果如***意,图中红框