赞
踩
入手pcl点云库,发现网上的教程很多不太全,或者比较简单的描述,记录下来,防止换电脑又花大把时间在查教程上。
一。准备工作
vs2015 +PCL-1.8.1-AllInOne-msvc2015-win64.exe、属性表和PDB其中,属性表可以不下载。
注:1.pcl用1.8还是1.9取决于你电脑装的vs版本
2.pcl具体用的1.8几要注意后面(*)处不同版本的不同
二。win10下的安装步骤
1.点击PCL-1.8.1-AllInOne-msvc2015-win64.exe一键安装,可以默认也可以自己选择安装路径,如本文所选择的路径为默认安装路径H:\BaiduNetdiskDownload\pcl;
2.在安装过程中,OpenNI2在安装时会弹出界面,选择目录H:\BaiduNetdiskDownload\pcl\PCL 1.8.1\3rdParty\OpenNI2;
3.等待一段时间,则安装完成。
注意事项:在安装点击“我接收(I)”之后弹出来的对话框中一定要选择第二项AddPCL to the system PATH for all users:
三。系统配置步骤
1.点击win7的控制面板->系统->高级系统设置->在系统属性的“高级选项”卡下点击“环境变量”;
2.在系统子菜单里面找到“Path”,如图:
3.点击编辑,添加如下:
注意:1.第一项在“一键安装”时就已经添加。
4.重启电脑
四、VS2015工程配置步骤(以下所有H:\BaiduNetdiskDownload\pcl取决于你的安装目录,每步完成后都要点击应用)
1.打开VS2015,创建新的win32控制台工程,建好后将平台改成X64;
2.点击视图-属性管理器-Debug|x64添加新项目属性表,如图:
3.在弹出的对话框中,修改配置属性-vc++目录-包含目录-编辑,完成后点击应用
4.在弹出的对话框中,修改配置属性-常规-库目录-编辑,完成后点击应用
5.点击连接器->输入->附加依赖项,编辑,添加下列文件名,完成后点击应用
添加文件名:
注:上传的为debug模式下的依赖文件;需要release版本,只需将下列文件名中的debug替换成release即可;
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_64.lib
libboost_bzip2-vc140-mt-gd-1_64.lib
libboost_chrono-vc140-mt-gd-1_64.lib
libboost_container-vc140-mt-gd-1_64.lib
libboost_context-vc140-mt-gd-1_64.lib
libboost_coroutine-vc140-mt-gd-1_64.lib
libboost_date_time-vc140-mt-gd-1_64.lib
libboost_exception-vc140-mt-gd-1_64.lib
libboost_fiber-vc140-mt-gd-1_64.lib
libboost_filesystem-vc140-mt-gd-1_64.lib
libboost_graph_parallel-vc140-mt-gd-1_64.lib
libboost_graph-vc140-mt-gd-1_64.lib
libboost_iostreams-vc140-mt-gd-1_64.lib
libboost_locale-vc140-mt-gd-1_64.lib
libboost_log-vc140-mt-gd-1_64.lib
libboost_log_setup-vc140-mt-gd-1_64.lib
libboost_math_c99-vc140-mt-gd-1_64.lib
libboost_math_c99f-vc140-mt-gd-1_64.lib
libboost_math_c99l-vc140-mt-gd-1_64.lib
libboost_math_tr1-vc140-mt-gd-1_64.lib
libboost_math_tr1f-vc140-mt-gd-1_64.lib
libboost_math_tr1l-vc140-mt-gd-1_64.lib
libboost_mpi-vc140-mt-gd-1_64.lib
libboost_numpy3-vc140-mt-gd-1_64.lib
libboost_numpy-vc140-mt-gd-1_64.lib
libboost_prg_exec_monitor-vc140-mt-gd-1_64.lib
libboost_program_options-vc140-mt-gd-1_64.lib
libboost_python3-vc140-mt-gd-1_64.lib
libboost_python-vc140-mt-gd-1_64.lib
libboost_random-vc140-mt-gd-1_64.lib
libboost_regex-vc140-mt-gd-1_64.lib
libboost_serialization-vc140-mt-gd-1_64.lib
libboost_signals-vc140-mt-gd-1_64.lib
libboost_system-vc140-mt-gd-1_64.lib
libboost_test_exec_monitor-vc140-mt-gd-1_64.lib
libboost_thread-vc140-mt-gd-1_64.lib
libboost_timer-vc140-mt-gd-1_64.lib
libboost_type_erasure-vc140-mt-gd-1_64.lib
libboost_unit_test_framework-vc140-mt-gd-1_64.lib
libboost_wave-vc140-mt-gd-1_64.lib
libboost_wserialization-vc140-mt-gd-1_64.lib
libboost_zlib-vc140-mt-gd-1_64.lib
vtkzlib-8.0-gd.lib
vtkViewsContext2D-8.0-gd.lib
vtkhdf5_hl-8.0-gd.lib
vtkFiltersProgrammable-8.0-gd.lib
vtkIOMovie-8.0-gd.lib
vtkexpat-8.0-gd.lib
vtkRenderingLOD-8.0-gd.lib
vtkIOPLY-8.0-gd.lib
vtkpng-8.0-gd.lib
vtkIOVideo-8.0-gd.lib
vtkRenderingImage-8.0-gd.lib
vtkFiltersVerdict-8.0-gd.lib
vtkjpeg-8.0-gd.lib
vtkInteractionImage-8.0-gd.lib
vtkverdict-8.0-gd.lib
vtkoggtheora-8.0-gd.lib
vtkImagingStatistics-8.0-gd.lib
vtkCommonSystem-8.0-gd.lib
vtkFiltersParallelImaging-8.0-gd.lib
vtkFiltersTexture-8.0-gd.lib
vtkCommonMisc-8.0-gd.lib
vtkCommonMath-8.0-gd.lib
vtkFiltersSelection-8.0-gd.lib
vtkImagingFourier-8.0-gd.lib
vtkIOXMLParser-8.0-gd.lib
vtkproj4-8.0-gd.lib
vtkalglib-8.0-gd.lib
vtktiff-8.0-gd.lib
vtksqlite-8.0-gd.lib
vtkImagingSources-8.0-gd.lib
vtkCommonTransforms-8.0-gd.lib
vtkImagingMath-8.0-gd.lib
vtkFiltersGeneric-8.0-gd.lib
vtkexoIIc-8.0-gd.lib
vtkfreetype-8.0-gd.lib
vtkImagingColor-8.0-gd.lib
vtknetcdf_c++-gd.lib
vtkNetCDF-8.0-gd.lib
vtkFiltersImaging-8.0-gd.lib
vtkFiltersHyperTree-8.0-gd.lib
vtkImagingMorphological-8.0-gd.lib
vtkImagingStencil-8.0-gd.lib
vtkRenderingFreeType-8.0-gd.lib
vtkCommonColor-8.0-gd.lib
vtkjsoncpp-8.0-gd.lib
vtkRenderingContext2D-8.0-gd.lib
vtkFiltersAMR-8.0-gd.lib
vtkRenderingContextOpenGL-8.0-gd.lib
vtkIOParallelXML-8.0-gd.lib
vtkViewsCore-8.0-gd.lib
vtkImagingHybrid-8.0-gd.lib
vtkIOExport-8.0-gd.lib
vtkRenderingVolumeOpenGL-8.0-gd.lib
vtkIOImport-8.0-gd.lib
vtkDomainsChemistry-8.0-gd.lib
vtkInteractionStyle-8.0-gd.lib
vtkCommonComputationalGeometry-8.0-gd.lib
vtkDICOMParser-8.0-gd.lib
vtklibxml2-8.0-gd.lib
vtkIOMINC-8.0-gd.lib
vtkIOSQL-8.0-gd.lib
vtkFiltersModeling-8.0-gd.lib
vtkParallelCore-8.0-gd.lib
vtkIOAMR-8.0-gd.lib
vtkGeovisCore-8.0-gd.lib
vtksys-8.0-gd.lib
vtkIOEnSight-8.0-gd.lib
vtkImagingGeneral-8.0-gd.lib
vtkFiltersFlowPaths-8.0-gd.lib
vtkIOLSDyna-8.0-gd.lib
vtkFiltersSMP-8.0-gd.lib
vtkIOParallel-8.0-gd.lib
vtkFiltersGeometry-8.0-gd.lib
vtkInfovisLayout-8.0-gd.lib
vtkIOCore-8.0-gd.lib
vtkFiltersSources-8.0-gd.lib
vtkIOLegacy-8.0-gd.lib
vtkFiltersHybrid-8.0-gd.lib
vtkIONetCDF-8.0-gd.lib
vtkFiltersExtraction-8.0-gd.lib
vtkFiltersParallel-8.0-gd.lib
vtkRenderingLabel-8.0-gd.lib
vtkIOInfovis-8.0-gd.lib
vtkRenderingAnnotation-8.0-gd.lib
vtkImagingCore-8.0-gd.lib
vtkCommonExecutionModel-8.0-gd.lib
vtkhdf5-8.0-gd.lib
vtkViewsInfovis-8.0-gd.lib
vtkIOGeometry-8.0-gd.lib
vtkmetaio-8.0-gd.lib
vtkIOImage-8.0-gd.lib
vtkIOXML-8.0-gd.lib
vtkIOExodus-8.0-gd.lib
vtkRenderingVolume-8.0-gd.lib
vtkChartsCore-8.0-gd.lib
vtkFiltersStatistics-8.0-gd.lib
vtkInfovisCore-8.0-gd.lib
vtkRenderingCore-8.0-gd.lib
vtkInteractionWidgets-8.0-gd.lib
vtkRenderingOpenGL-8.0-gd.lib
vtkFiltersGeneral-8.0-gd.lib
vtkFiltersCore-8.0-gd.lib
vtkCommonDataModel-8.0-gd.lib
vtkCommonCore-8.0-gd.lib
flann_cpp_s-gd.lib
qhullstatic_d.lib
OpenNI2.lib
至此配置初步完毕,用网上例子检测运行。
- #include <iostream>
- #include <pcl/io/pcd_io.h>
- #include <pcl/point_types.h>
- #include <pcl/ModelCoefficients.h>
- #include <pcl/filters/project_inliers.h>
-
- int main(int argc, char** argv)
- {
- pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
- pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_projected(new pcl::PointCloud<pcl::PointXYZ>);
-
- // Fill in the cloud data
- cloud->width = 5;
- cloud->height = 1;
- cloud->points.resize(cloud->width * cloud->height);
-
- for (size_t i = 0; i < cloud->points.size(); ++i)
- {
- cloud->points[i].x = 1024 * rand() / (RAND_MAX + 1.0f);
- cloud->points[i].y = 1024 * rand() / (RAND_MAX + 1.0f);
- cloud->points[i].z = 1024 * rand() / (RAND_MAX + 1.0f);
- }
-
- std::cerr << "Cloud before projection: " << std::endl;
- for (size_t i = 0; i < cloud->points.size(); ++i)
- std::cerr << " " << cloud->points[i].x << " "
- << cloud->points[i].y << " "
- << cloud->points[i].z << std::endl;
-
- // Create a set of planar coefficients with X=Y=0,Z=1
- pcl::ModelCoefficients::Ptr coefficients(new pcl::ModelCoefficients());
- coefficients->values.resize(4);
- coefficients->values[0] = coefficients->values[1] = 0;
- coefficients->values[2] = 1.0;
- coefficients->values[3] = 0;
-
- // Create the filtering object
- pcl::ProjectInliers<pcl::PointXYZ> proj;
- proj.setModelType(pcl::SACMODEL_PLANE);
- proj.setInputCloud(cloud);
- proj.setModelCoefficients(coefficients);
- proj.filter(*cloud_projected);
-
- std::cerr << "Cloud after projection: " << std::endl;
- for (size_t i = 0; i < cloud_projected->points.size(); ++i)
- std::cerr << " " << cloud_projected->points[i].x << " "
- << cloud_projected->points[i].y << " "
- << cloud_projected->points[i].z << std::endl;
-
- system("pause");
- return (0);
- }
结果如下:
注:以上形成的props文件放在一个易于记住的地方以后就不用再配
问题:
一 。遇到问题 无法打开所有以pcl开头的源文件
解决方案:1.点击项目(ConsoleApplication4),双击在弹出对话框里选择配置:debug,平台(x64);
点击配置属性下的调试,右边有个环境项,把值设置为:PATH=$(PCL_ROOT)bin;$(PCL_ROOT)3rdPartyFLANNbin;$(PCL_ROOT)3rdPartyVTKbin;$(PCL_ROOT)Qhullbin;$(PCL_ROOT)3rdPartyOpenNI2Tools;$(PATH)
2.点击配置属性下的CC++,点击它的子项预处理器,右边有个预处理器定义,添加上_SCL_SECURE_NO_WARNINGS 和 _CRT_SECURE_NO_WARNINGS。
3.点击配置属性下的CC++,常规-附加包含目录中添加:H:\BaiduNetdiskDownload\pcl\PCL 1.8.1\3rdParty\Boost\include\boost-1_61
4.点击vc++目录-包含目录,编辑,添加如下目录,解决
二。找不到libboost_atomic-vc140-mt-1_61.lib
解决方案:用错了依赖库,这是pcl1.8.0的依赖库
三。H:\BaiduNetdiskDownload\pcl\PCL 1.8.1\3rdParty\OpenNI2目录下,只有OpenNI-Windows-x64-2.2.msi,无其他文件夹
解决方案:将OpenNI2卸了,重装在上文指定目录下。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。