win7/win10+vs2015+pcl1.8.0配置方案详解

来自:网络
时间:2022-05-02
阅读:
目录

一、下载相关文件

1.下载PCL-1.8.0-AllInOne-msvc2015-win64.exe、属性表和PDB和测试pcd文件rabbit.pcd,其中,属性表可以不下载。

链接: https://pan.baidu.com/s/1aDvkLxAcvOdVQWqXu1pPlA?pwd=27fa

提取码: 27fa

二、Windows7下安装步骤:

1.点击PCL-1.8.0-AllInOne-msvc2015-win64.exe一键安装,可以默认也可以自己选择安装路径,如本文所选择的路径为默认安装路径C:\Program Files;

2.在安装过程中,OpenNI2在安装时会弹出界面,选择目录C:\Program Files\PCL 1.8.0\3rdParty\OpenNI2;

3.等待一段时间,则安装完成。

注意事项:在安装点击“我接收(I)”之后弹出来的对话框中一定要选择第二项AddPCL to the system PATH for all users:(如图)

win7/win10+vs2015+pcl1.8.0配置方案详解

三、系统配置步骤

1.点击win7的控制面板->系统->高级系统设置->在系统属性的“高级选项”卡下点击“环境变量”;

2.在系统子菜单里面找到“Path”,如图:

win7/win10+vs2015+pcl1.8.0配置方案详解

3.点击编辑,添加如下:

C:\Program Files\PCL 1.8.0\bin;C:\Program Files\PCL 1.8.0\3rdParty\FLANN\bin;C:\Program Files\PCL 1.8.0\3rdParty\Qhull\bin;C:\Program Files\PCL 1.8.0\3rdParty\OpenNI2\Tools;C:\Program Files\PCL 1.8.0\3rdParty\VTK\bin

注意这里的“ ; ”分号;

注意,第一项在“一键安装”时就已经添加。

4.重启电脑

四、VS2015工程配置步骤

1.打开VS2015,创建新的win32控制台工程,建好后将平台改成X64;

2.点击项目菜单的属性,如图:

win7/win10+vs2015+pcl1.8.0配置方案详解

3.在弹出的对话框中,

win7/win10+vs2015+pcl1.8.0配置方案详解

①点击“包含目录”下拉箭头->编辑,添加文件路径:

win7/win10+vs2015+pcl1.8.0配置方案详解

完成后点击确定;

②点击“库目录”下拉箭头->编辑,添加文件路径:

win7/win10+vs2015+pcl1.8.0配置方案详解

完成后点击确定;

4.点击连接器->输入->附加依赖项:

win7/win10+vs2015+pcl1.8.0配置方案详解

点击下拉箭头->编辑,添加下列文件:

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_61.lib

libboost_chrono-vc140-mt-1_61.lib

libboost_container-vc140-mt-1_61.lib

libboost_context-vc140-mt-1_61.lib

libboost_coroutine-vc140-mt-1_61.lib

libboost_date_time-vc140-mt-1_61.lib

libboost_exception-vc140-mt-1_61.lib

libboost_filesystem-vc140-mt-1_61.lib

libboost_graph-vc140-mt-1_61.lib

libboost_iostreams-vc140-mt-1_61.lib

libboost_locale-vc140-mt-1_61.lib

libboost_log-vc140-mt-1_61.lib

libboost_log_setup-vc140-mt-1_61.lib

libboost_math_c99-vc140-mt-1_61.lib

libboost_math_c99f-vc140-mt-1_61.lib

libboost_math_c99l-vc140-mt-1_61.lib

libboost_math_tr1-vc140-mt-1_61.lib

libboost_math_tr1f-vc140-mt-1_61.lib

libboost_math_tr1l-vc140-mt-1_61.lib

libboost_mpi-vc140-mt-1_61.lib

libboost_prg_exec_monitor-vc140-mt-1_61.lib

libboost_program_options-vc140-mt-1_61.lib

libboost_random-vc140-mt-1_61.lib

libboost_regex-vc140-mt-1_61.lib

libboost_serialization-vc140-mt-1_61.lib

libboost_signals-vc140-mt-1_61.lib

libboost_system-vc140-mt-1_61.lib

libboost_test_exec_monitor-vc140-mt-1_61.lib

libboost_thread-vc140-mt-1_61.lib

libboost_timer-vc140-mt-1_61.lib

libboost_unit_test_framework-vc140-mt-1_61.lib

libboost_wave-vc140-mt-1_61.lib

libboost_wserialization-vc140-mt-1_61.lib

flann.lib

flann_s.lib

flann-gd.lib

flann_cpp_s.lib

flann_cpp_s-gd.lib

flann_s-gd.lib

qhull.lib

qhull_d.lib

qhullcpp_d.lib

qhullstatic.lib

qhullstatic_d.lib

qhullstatic_r.lib

qhullstatic_r_d.lib

qhull_p.lib

qhull_p_d.lib

qhull_r.lib

qhull_r_d.lib

vtkalglib-7.0.lib

vtkChartsCore-7.0.lib

vtkCommonColor-7.0.lib

vtkCommonComputationalGeometry-7.0.lib

vtkCommonCore-7.0.lib

vtkCommonDataModel-7.0.lib

vtkCommonExecutionModel-7.0.lib

vtkCommonMath-7.0.lib

vtkCommonMisc-7.0.lib

vtkCommonSystem-7.0.lib

vtkCommonTransforms-7.0.lib

vtkDICOMParser-7.0.lib

vtkDomainsChemistry-7.0.lib

vtkexoIIc-7.0.lib

vtkexpat-7.0.lib

vtkFiltersAMR-7.0.lib

vtkFiltersCore-7.0.lib

vtkFiltersExtraction-7.0.lib

vtkFiltersFlowPaths-7.0.lib

vtkFiltersGeneral-7.0.lib

vtkFiltersGeneric-7.0.lib

vtkFiltersGeometry-7.0.lib

vtkFiltersHybrid-7.0.lib

vtkFiltersHyperTree-7.0.lib

vtkFiltersImaging-7.0.lib

vtkFiltersModeling-7.0.lib

vtkFiltersParallel-7.0.lib

vtkFiltersParallelImaging-7.0.lib

vtkFiltersProgrammable-7.0.lib

vtkFiltersSelection-7.0.lib

vtkFiltersSMP-7.0.lib

vtkFiltersSources-7.0.lib

vtkFiltersStatistics-7.0.lib

vtkFiltersTexture-7.0.lib

vtkFiltersVerdict-7.0.lib

vtkfreetype-7.0.lib

vtkGeovisCore-7.0.lib

vtkhdf5-7.0.lib

vtkhdf5_hl-7.0.lib

vtkImagingColor-7.0.lib

vtkImagingCore-7.0.lib

vtkImagingFourier-7.0.lib

vtkImagingGeneral-7.0.lib

vtkImagingHybrid-7.0.lib

vtkImagingMath-7.0.lib

vtkImagingMorphological-7.0.lib

vtkImagingSources-7.0.lib

vtkImagingStatistics-7.0.lib

vtkImagingStencil-7.0.lib

vtkInfovisCore-7.0.lib

vtkInfovisLayout-7.0.lib

vtkInteractionImage-7.0.lib

vtkInteractionStyle-7.0.lib

vtkInteractionWidgets-7.0.lib

vtkIOAMR-7.0.lib

vtkIOCore-7.0.lib

vtkIOEnSight-7.0.lib

vtkIOExodus-7.0.lib

vtkIOExport-7.0.lib

vtkIOGeometry-7.0.lib

vtkIOImage-7.0.lib

vtkIOImport-7.0.lib

vtkIOInfovis-7.0.lib

vtkIOLegacy-7.0.lib

vtkIOLSDyna-7.0.lib

vtkIOMINC-7.0.lib

vtkIOMovie-7.0.lib

vtkIONetCDF-7.0.lib

vtkIOParallel-7.0.lib

vtkIOParallelXML-7.0.lib

vtkIOPLY-7.0.lib

vtkIOSQL-7.0.lib

vtkIOVideo-7.0.lib

vtkIOXML-7.0.lib

vtkIOXMLParser-7.0.lib

vtkjpeg-7.0.lib

vtkjsoncpp-7.0.lib

vtklibxml2-7.0.lib

vtkmetaio-7.0.lib

vtkNetCDF-7.0.lib

vtkNetCDF_cxx-7.0.lib

vtkoggtheora-7.0.lib

vtkParallelCore-7.0.lib

vtkpng-7.0.lib

vtkproj4-7.0.lib

vtkRenderingAnnotation-7.0.lib

vtkRenderingContext2D-7.0.lib

vtkRenderingContextOpenGL-7.0.lib

vtkRenderingCore-7.0.lib

vtkRenderingFreeType-7.0.lib

vtkRenderingImage-7.0.lib

vtkRenderingLabel-7.0.lib

vtkRenderingLOD-7.0.lib

vtkRenderingOpenGL-7.0.lib

vtkRenderingVolume-7.0.lib

vtkRenderingVolumeOpenGL-7.0.lib

vtksqlite-7.0.lib

vtksys-7.0.lib

vtktiff-7.0.lib

vtkverdict-7.0.lib

vtkViewsContext2D-7.0.lib

vtkViewsCore-7.0.lib

vtkViewsInfovis-7.0.lib

vtkzlib-7.0.lib

完成后点击确定;

注意:上面为在release下运行的文件,如果想在debug下运行,则将其中的release改成debug;

5.点击配置属性下的调试,右边有个环境项,把值设置为

PATH=$(PCL_ROOT)bin;$(PCL_ROOT)3rdPartyFLANNbin;$(PCL_ROOT)3rdPartyVTKbin;$(PCL_ROOT)Qhullbin;$(PCL_ROOT)3rdPartyOpenNI2Tools;$(PATH)

win7/win10+vs2015+pcl1.8.0配置方案详解

6.点击配置属性下的CC++,点击它的子项预处理器,右边有个预处理器定义,添加上_SCL_SECURE_NO_WARNINGS 和 _CRT_SECURE_NO_WARNINGS。

win7/win10+vs2015+pcl1.8.0配置方案详解

7.点击配置属性下的CC++,常规

win7/win10+vs2015+pcl1.8.0配置方案详解

在附加包含目录中添加:C:\Program Files\PCL 1.8.0\3rdParty\Boost\include\boost-1_61

win7/win10+vs2015+pcl1.8.0配置方案详解

8.在属性管理器里点击项目,展开子项。

win7/win10+vs2015+pcl1.8.0配置方案详解

如果安装的是32位,点击选中开头为Debug的子项里右键,点击添加现有属性表,然后找到你下载的文件夹里的PCLDebug.props,添加上。点击选中开头为Release的子项里右键,点击添加现有属性表,然后找到你下载的文件夹里的PCLRelease.props,添加上。
如果安装的是64位,点击选中开头为Debug的子项里右键,点击添加现有属性表,然后找到你下载的文件夹里的PCLDebug.props,添加上。点击选中开头为Release的子项里右键,点击添加现有属性表,然后找到你下载的文件夹里的PCLRelease.props,添加上。
注意在这里,64位的会有2个开头为Debug的子项,都要添加上PCLDebug.props,并且2个开头为Release的子项,也要添加上PCLRelease.props。

win7/win10+vs2015+pcl1.8.0配置方案详解

关于PCLRelease.props文件和PCLDebug.props文件在网盘的链接里面有;

9.注意:如果出现以下这种问题:

win7/win10+vs2015+pcl1.8.0配置方案详解

解决方案:

win7/win10+vs2015+pcl1.8.0配置方案详解

win7/win10+vs2015+pcl1.8.0配置方案详解

win7/win10+vs2015+pcl1.8.0配置方案详解

从上图中的箭头中,将问题中提示的.lib文件删除即可;

五、程序实际测试

将rabbit.pcd(在网盘中)放到与工程中的主.cpp同一位置的文件夹下(工程文件夹)

程序代码:

#include<pcl/visualization/cloud_viewer.h>
#include<iostream>//标准C++库中的输入输出类相关头文件。
#include<pcl/io/io.h>
#include<pcl/io/pcd_io.h>//pcd 读写类相关的头文件。
#include<pcl/io/ply_io.h>
#include<pcl/point_types.h> //PCL中支持的点类型头文件。
int user_data;
using std::cout;

void viewerOneOff(pcl::visualization::PCLVisualizer& viewer) {
    viewer.setBackgroundColor(1.0, 0.5, 1.0);   //设置背景颜色
}
int main() {
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
    char strfilepath[256] = "rabbit.pcd";
    if (-1 == pcl::io::loadPCDFile(strfilepath, *cloud)) {
        cout << "error input!" << endl;
        return -1;
    }
    cout << cloud->points.size() << endl;
    pcl::visualization::CloudViewer viewer("Cloud Viewer");     //创建viewer对象
    viewer.showCloud(cloud);
    viewer.runOnVisualizationThreadOnce(viewerOneOff);
    system("pause");
    return 0;

效果图:

win7/win10+vs2015+pcl1.8.0配置方案详解

返回顶部
顶部