PCL 1.7.2(vtk6.2) + VS2013 + win10_x64 配置及常见问题
写在前面:
1.系统win10,win7应该问题不大,主要区分32或者64位操作系统
2.同样的PCL 1.7.2 安装后可能vtk版本不同,因此附加依赖项也会不同。
步骤一:pcl安装
1. 安装路径:没有要求,尽量在英文文件夹下。以我的路径为例:
D:\pcl---安装后该文件下 D:\pcl\PCL 1.7.2
步骤二:PCL环境配置
1. 电脑系统环境配置
电脑右键---属性---环境变量---
1.1 点击path添加(4个bin路径即包含dll,exe文件夹): (win10直接一行一行添加,win7;隔开)
D:\pcl\PCL 1.7.2\bin
D:\pcl\PCL 1.7.2\3rdParty\FLANN\bin
D:\pcl\PCL 1.7.2\3rdParty\Qhull\bin
D:\pcl\PCL 1.7.2\3rdParty\VTK\bin
备注:有的博客提到OPENNI,根据需要自己单独配置
1.2新建 PCL_ROOT:(PCL安装路径)
D:\pcl\PCL 1.7.2\
2. 工程属性配置
2.1 右键项目属性(或者新建属性文件下次直接加载),
2.1.1VC++目录,包含目录添加:
D:\pcl\PCL1.7.2\include\pcl-1.7
D:\pcl\PCL1.7.2\3rdParty\Boost\include\boost-1_57
D:\pcl\PCL1.7.2\3rdParty\Eigen\eigen3
D:\pcl\PCL1.7.2\3rdParty\FLANN\include
D:\pcl\PCL1.7.2\3rdParty\QHull\include
D:\pcl\PCL1.7.2\3rdParty\VTK\include\vtk-6.2
2.1.2链接器\常规\ 附加库目录
D:\pcl\PCL 1.7.2\lib
D:\pcl\PCL1.7.2\3rdParty\Boost\lib
D:\pcl\PCL1.7.2\3rdParty\FLANN\lib
D:\pcl\PCL1.7.2\3rdParty\Qhull\lib
D:\pcl\PCL 1.7.2\3rdParty\VTK\lib
2.1.3链接器\输入\附加依赖项 (注意vtk6.2版本和debug模式)
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
备注:release 自己添加,PCL1.7.2可能vtk版本不同,以上的debug,vtk6.2
2.1.4C/C++ 预处理器
_SCL_SECURE_NO_WARNINGS
_CRT_SECURE_NO_WARNINGS
步骤三 常见错误
3.1编码方式:Unicode(不一定)
3.2Debug :win64,win32选择
3.3配置一样但是依然显示 各种 .h 错误(包含目录路径错误)
点开.h 文件看看,里面有的头文件路径写的<flann/flann.h>此时包含目录为:D:\pcl\PCL1.7.2\3rdParty\FLANN\include
如果写的<flann.h> 此时包含目录添加为:
D:\pcl\PCL1.7.2\3rdParty\FLANN\include\flann
3.4.lib 错误 :确认版本lib文件路径
步骤四 测试
#include<pcl/io/pcd_io.h>
#include<pcl/features/integral_image_normal.h>
#include<boost/thread/thread.hpp>
#include<pcl/visualization/pcl_visualizer.h>
int
main(intargc, char** argv)
{
// 点云数据对象
pcl::PointCloud<pcl::PointXYZ>::Ptrcloud(new pcl::PointCloud<pcl::PointXYZ>);
// 法线对象
pcl::PointCloud<pcl::Normal>::Ptrnormals(new pcl::PointCloud<pcl::Normal>);
// 读取文件
if(pcl::io::loadPCDFile<pcl::PointXYZ>(argv[1], *cloud) != 0)
{
return -1;
}
// 法线估计对象
pcl::IntegralImageNormalEstimation<pcl::PointXYZ,pcl::Normal> normalEstimation;
normalEstimation.setInputCloud(cloud);
// 法线估计方法: COVARIANCE_MATRIX,AVERAGE_DEPTH_CHANGE, SIMPLE_3D_GRADIENT.
normalEstimation.setNormalEstimationMethod(normalEstimation.AVERAGE_3D_GRADIENT);
//设置深度变化的阀值
normalEstimation.setMaxDepthChangeFactor(0.02f);
// 设置计算法线的区域
normalEstimation.setNormalSmoothingSize(10.0f);
// 计算
normalEstimation.compute(*normals);
// 可视化
boost::shared_ptr<pcl::visualization::PCLVisualizer>viewer(new pcl::visualization::PCLVisualizer("Normals"));
viewer->addPointCloud<pcl::PointXYZ>(cloud, "cloud");
viewer->addPointCloudNormals<pcl::PointXYZ, pcl::Normal>(cloud,normals, 20, 0.03, "normals");
while (!viewer->wasStopped())
{
viewer->spinOnce(100);
boost::this_thread::sleep(boost::posix_time::microseconds(100000));
}
}
//备注自己加载一个 pcd 点云文件,要是没有报错说明配置成功,有时候点云数目过多导致加载很慢并不代表环境配置错误