当前位置: 代码迷 >> 综合 >> PCL安装与配置(win10+VS2015)手把手非常详细
  详细解决方案

PCL安装与配置(win10+VS2015)手把手非常详细

热度:22   发布时间:2023-12-04 04:53:02.0

前言:第一次配置pcl是在考研结束的暑假,当时花了很长时间,最近电脑重装系统之后又配置了一次,记录一下VS配置pcl过程,这是我的第一篇文章,希望能够帮助需要的朋友。

一、安装VS

这里默认Visual Studio已经安装完毕。

在这个网址下载:下载 Visual Studio Tools - 免费安装 Windows、Mac、Linux

VS2015安装包:链接:https://pan.baidu.com/s/1emr1Ll21iyi8ZzeQC_MnGg 
提取码:ihsd

二、PCL1.8.1安装

1、下载

下载两个包AllInOnepdb文件,网盘链接:https://pan.baidu.com/s/1d6BAJHhIoAlnXcB1ylU1jQ  提取码:8anp;也可以在官网找到对应版本下载。

 2、安装步骤

右击AllInOne,以管理员身份运行,我把它安装在d:\pcl1.8.1路径下;

 注意:会跳出来如下界面,安装OpenNI时要选择你PCL安装路径的的3rdParty文件夹下,我的是d:\PCL 1.8.1\3rdParty,然后完成安装,如果有窗口有路径太长的错误提示,点击确定没关系的。

 解压pdb文件,把文件的内容全部选中复制到d:\pcl1.8.1\bin路径下;

 下面配置环境变量:“此电脑”右击点击“属性”--->"高级系统设置"---->"环境变量"---->选中Path点击“编辑”----->“编辑文本”,跳出弹窗就点击确定----->在变量值后面补上如下变量:d:\PCL1.8.1\bin;d:\PCL1.8.1\3rdParty\VTK\bin;d:\PCL1.8.1\3rdParty\FLANN\bin;d:\PCL1.8.1\3rdParty\Qhull\bin;d:\PCL1.8.1\3rdParty\OpenNI2\Tools;D:\PCL1.8.1\3rdParty\OpenNI2\Redist

重启电脑。

 打开VS2015,新建项目test01------>属性管理器------>打开“Release | x64”------>打开Microsoft.cpp.x64.users属性页------>在“包含目录”添加:

d:\PCL1.8.1\3rdParty\OpenNI2\Include;d:\PCL1.8.1\include\pcl-1.8;d:\PCL1.8.1\3rdParty\VTK\include\vtk-8.0;d:\PCL1.8.1\3rdParty\Qhull\include;d:\PCL1.8.1\3rdParty\FLANN\include;d:\PCL1.8.1\3rdParty\Eigen\eigen3;d:\PCL1.8.1\3rdParty\Boost\include\boost-1_64;

在“库目录”添加:

d:\PCL1.8.1\3rdParty\OpenNI2\Lib;d:\PCL1.8.1\3rdParty\VTK\lib;d:\PCL1.8.1\3rdParty\Qhull\lib;d:\PCL1.8.1\3rdParty\FLANN\lib;d:\PCL1.8.1\3rdParty\Boost\lib;d:\PCL1.8.1\lib;

 在“预处理器定义”添加:
_SCL_SECURE_NO_WARNINGS
_CRT_SECURE_NO_WARNINGS
_SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING

Release版本(建议)添加附加依赖项:

shell32.lib
vtknetcdf_c++.lib
pcl_common_release.lib
pcl_features_release.lib
pcl_filters_release.lib
pcl_io_ply_release.lib
pcl_io_release.lib
pcl_kdtree_release.lib
pcl_keypoints_release.lib
pcl_ml_release.lib
pcl_octree_release.lib
pcl_outofcore_release.lib
pcl_people_release.lib
pcl_recognition_release.lib
pcl_registration_release.lib
pcl_sample_consensus_release.lib
pcl_search_release.lib
pcl_segmentation_release.lib
pcl_stereo_release.lib
pcl_surface_release.lib
pcl_tracking_release.lib
pcl_visualization_release.lib
libboost_atomic-vc140-mt-1_64.lib
libboost_bzip2-vc140-mt-1_64.lib
libboost_chrono-vc140-mt-1_64.lib
libboost_container-vc140-mt-1_64.lib
libboost_context-vc140-mt-1_64.lib
libboost_coroutine-vc140-mt-1_64.lib
libboost_date_time-vc140-mt-1_64.lib
libboost_exception-vc140-mt-1_64.lib
libboost_fiber-vc140-mt-1_64.lib
libboost_filesystem-vc140-mt-1_64.lib
libboost_graph-vc140-mt-1_64.lib
libboost_graph_parallel-vc140-mt-1_64.lib
libboost_iostreams-vc140-mt-1_64.lib
libboost_locale-vc140-mt-1_64.lib
libboost_log-vc140-mt-1_64.lib
libboost_log_setup-vc140-mt-1_64.lib
libboost_math_c99-vc140-mt-1_64.lib
libboost_math_c99f-vc140-mt-1_64.lib
libboost_math_c99l-vc140-mt-1_64.lib
libboost_math_tr1-vc140-mt-1_64.lib
libboost_math_tr1f-vc140-mt-1_64.lib
libboost_math_tr1l-vc140-mt-1_64.lib
libboost_mpi-vc140-mt-1_64.lib
libboost_numpy3-vc140-mt-1_64.lib
libboost_numpy-vc140-mt-1_64.lib
libboost_prg_exec_monitor-vc140-mt-1_64.lib
libboost_program_options-vc140-mt-1_64.lib
libboost_python3-vc140-mt-1_64.lib
libboost_python-vc140-mt-1_64.lib
libboost_random-vc140-mt-1_64.lib
libboost_regex-vc140-mt-1_64.lib
libboost_serialization-vc140-mt-1_64.lib
libboost_signals-vc140-mt-1_64.lib
libboost_system-vc140-mt-1_64.lib
libboost_test_exec_monitor-vc140-mt-1_64.lib
libboost_thread-vc140-mt-1_64.lib
libboost_timer-vc140-mt-1_64.lib
libboost_type_erasure-vc140-mt-1_64.lib
libboost_unit_test_framework-vc140-mt-1_64.lib
libboost_wave-vc140-mt-1_64.lib
libboost_wserialization-vc140-mt-1_64.lib
libboost_zlib-vc140-mt-1_64.lib
flann.lib
flann_cpp.lib
flann_cpp_s.lib
flann_s.lib
qhull_d.lib
qhullcpp_d.lib
qhullstatic_d.lib
qhullstatic_r_d.lib
qhull_p_d.lib
qhull_r_d.lib
vtkalglib-8.0.lib
vtkChartsCore-8.0.lib
vtkCommonColor-8.0.lib
vtkCommonComputationalGeometry-8.0.lib
vtkCommonCore-8.0.lib
vtkCommonDataModel-8.0.lib
vtkCommonExecutionModel-8.0.lib
vtkCommonMath-8.0.lib
vtkCommonMisc-8.0.lib
vtkCommonSystem-8.0.lib
vtkCommonTransforms-8.0.lib
vtkDICOMParser-8.0.lib
vtkDomainsChemistry-8.0.lib
vtkexoIIc-8.0.lib
vtkexpat-8.0.lib
vtkFiltersAMR-8.0.lib
vtkFiltersCore-8.0.lib
vtkFiltersExtraction-8.0.lib
vtkFiltersFlowPaths-8.0.lib
vtkFiltersGeneral-8.0.lib
vtkFiltersGeneric-8.0.lib
vtkFiltersGeometry-8.0.lib
vtkFiltersHybrid-8.0.lib
vtkFiltersHyperTree-8.0.lib
vtkFiltersImaging-8.0.lib
vtkFiltersModeling-8.0.lib
vtkFiltersParallel-8.0.lib
vtkFiltersParallelImaging-8.0.lib
vtkFiltersPoints-8.0.lib
vtkFiltersProgrammable-8.0.lib
vtkFiltersSelection-8.0.lib
vtkFiltersSMP-8.0.lib
vtkFiltersSources-8.0.lib
vtkFiltersStatistics-8.0.lib
vtkFiltersTexture-8.0.lib
vtkFiltersTopology-8.0.lib
vtkFiltersVerdict-8.0.lib
vtkfreetype-8.0.lib
vtkGeovisCore-8.0.lib
vtkgl2ps-8.0.lib
vtkhdf5-8.0.lib
vtkhdf5_hl-8.0.lib
vtkImagingColor-8.0.lib
vtkImagingCore-8.0.lib
vtkImagingFourier-8.0.lib
vtkImagingGeneral-8.0.lib
vtkImagingHybrid-8.0.lib
vtkImagingMath-8.0.lib
vtkImagingMorphological-8.0.lib
vtkImagingSources-8.0.lib
vtkImagingStatistics-8.0.lib
vtkImagingStencil-8.0.lib
vtkInfovisCore-8.0.lib
vtkInfovisLayout-8.0.lib
vtkInteractionImage-8.0.lib
vtkInteractionStyle-8.0.lib
vtkInteractionWidgets-8.0.lib
vtkIOAMR-8.0.lib
vtkIOCore-8.0.lib
vtkIOEnSight-8.0.lib
vtkIOExodus-8.0.lib
vtkIOExport-8.0.lib
vtkIOExportOpenGL-8.0.lib
vtkIOGeometry-8.0.lib
vtkIOImage-8.0.lib
vtkIOImport-8.0.lib
vtkIOInfovis-8.0.lib
vtkIOLegacy-8.0.lib
vtkIOLSDyna-8.0.lib
vtkIOMINC-8.0.lib
vtkIOMovie-8.0.lib
vtkIONetCDF-8.0.lib
vtkIOParallel-8.0.lib
vtkIOParallelXML-8.0.lib
vtkIOPLY-8.0.lib
vtkIOSQL-8.0.lib
vtkIOTecplotTable-8.0.lib
vtkIOVideo-8.0.lib
vtkIOXML-8.0.lib
vtkIOXMLParser-8.0.lib
vtkjpeg-8.0.lib
vtkjsoncpp-8.0.lib
vtklibharu-8.0.lib
vtklibxml2-8.0.lib
vtklz4-8.0.lib
vtkmetaio-8.0.lib
vtkNetCDF-8.0.lib
vtkoggtheora-8.0.lib
vtkParallelCore-8.0.lib
vtkpng-8.0.lib
vtkproj4-8.0.lib
vtkRenderingAnnotation-8.0.lib
vtkRenderingContext2D-8.0.lib
vtkRenderingContextOpenGL-8.0.lib
vtkRenderingCore-8.0.lib
vtkRenderingFreeType-8.0.lib
vtkRenderingGL2PS-8.0.lib
vtkRenderingImage-8.0.lib
vtkRenderingLabel-8.0.lib
vtkRenderingLIC-8.0.lib
vtkRenderingLOD-8.0.lib
vtkRenderingOpenGL-8.0.lib
vtkRenderingVolume-8.0.lib
vtkRenderingVolumeOpenGL-8.0.lib
vtksqlite-8.0.lib
vtksys-8.0.lib
vtktiff-8.0.lib
vtkverdict-8.0.lib
vtkViewsContext2D-8.0.lib
vtkViewsCore-8.0.lib
vtkViewsInfovis-8.0.lib
vtkzlib-8.0.lib
opengl32.lib

到这里配置pcl已经结束了,可以再建一个项目打开Microsoft.cpp.x64.users属性页,查一下是不是自己设置的目录;最后,可以用一段代码测试一下是否成功:

#include <iostream>
#include <pcl/common/common_headers.h>
#include <pcl/io/pcd_io.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/console/parse.h>
using namespace std;int main(int argc, char **argv) {//柱型点云测试cout << "Test PCL !" << endl;pcl::PointCloud<pcl::PointXYZRGB>::Ptr point_cloud_ptr(new pcl::PointCloud<pcl::PointXYZRGB>);uint8_t r(255), g(15), b(15);for (float z(-1.0); z <= 1.0; z += 0.05) {//制作柱型点云集for (float angle(0.0); angle <= 360.0; angle += 5.0) {pcl::PointXYZRGB point;point.x = cos(pcl::deg2rad(angle));point.y = sin(pcl::deg2rad(angle));point.z = z;uint32_t rgb = (static_cast<uint32_t>(r) << 16 | static_cast<uint32_t>(g) << 8 | static_cast<uint32_t>(b));point.rgb = *reinterpret_cast<float*>(&rgb);point_cloud_ptr->points.push_back(point);}if (z < 0.0) {//颜色渐变r -= 12;g += 12;}else {g -= 12;b += 12;}}point_cloud_ptr->width = (int)point_cloud_ptr->points.size();point_cloud_ptr->height = 1;pcl::visualization::CloudViewer viewer("pcl—test测试");viewer.showCloud(point_cloud_ptr);while (!viewer.wasStopped()) {};return 0;
}

 测试结果:

  相关解决方案