PCL1.11.0下载安装(Windows)
PCL安装需要的几个模块如下图所示:
一、PCL1.11.0下载
PCL以1.11.0版本为例,打开下载连接(PCL下载)
下载PCL-1.11.0-AllInOne-msvc2019-win64.exe和pcl-1.11.0-pdb-msvc2019-win64.zip
二、PCL安装
点击PCL-1.11.0-AllInOne-msvc2019-win64.exe文件,通过管理员权限,开始安装。
安装完成后,我们可以再安装文件夹下,看到安装的内容:
三、安装OpenNI
在3rdParty\OpenNI2文件夹下安装OpenNI-Windows-x64-2.2.msi。
移除完成后,我们重新安装,安装路径选择pcl按章的目录:D:\Soft_Install\pcl1_11_0\PCL 1.11.0\3rdParty\OpenNI2\
可以看到安装之后的内容
四、添加环境变量
安装完成之后,我们打开环境变量,可以看到环境变量变化如下:
增加了四个环境变量。
五、拷贝pdb文件
安装完成后,解压下载的pcl-1.11.0-pdb-msvc2019-win64.zip文件。
解压的内容为:
把解压的内容拷贝到pcl安装路径下的bin文件夹内:
六、VTK替换
VTK8.2.0的编译(参见:VTK8.2.0编译(Qt 5.14.2+VS2017)),如果你用其他的vs编译的过程类似。
我们把编译好的VTK内容,如下所示
替换掉PCL中安装的VTK
七、注意事项
注意:
在把上面的步骤执行完成后,我们还需要操作一步,如果不操作跳过我这一步,在最后Qt Creator在调用pcl的时候会报错。可以先看我的报错:
boost库和Eigen库加载的不识别,究其原因是我在pro文件中使用INCLUDEPATH添加头文件时没有识别,所以问题就出现在pcl的安装路径上,看下面的图,PCL 1.11.0中间有个空格。
所以,我们把这个空格删掉就可以了。
设置环境变量
先在新建一个变量PCL_ROOT,变量值为我们pcl的安装目录:
然后双击Path中增加环境变量。
然后我们新建以下的环境变量
%PCL_ROOT%\bin
%PCL_ROOT%\3rdParty\FLANN\bin
%PCL_ROOT%\3rdParty\VTK\bin
%PCL_ROOT%\3rdParty\Qhull\bin
%PCL_ROOT%\3rdParty\OpenNI2\Tools%OPENNI2_REDIST64%
%OPENNI2_LIB64%
%OPENNI2_INCLUDE64%
然后重启电脑。
八、创建一个点云项目
使用Qt Creator创建点云程序
1、使用Qt 创建一个MSVC 64位的程序,命名pcltest001,然后再pro文件中配置pcl相关的内容:
INCLUDEPATH += D:/Soft_Install/pcl1_11_0/PCL1.11.0/3rdParty/Boost/include/boost-1_73 \INCLUDEPATH += D:/Soft_Install/pcl1_11_0/PCL1.11.0/3rdParty/Eigen/eigen3 \INCLUDEPATH += D:/Soft_Install/pcl1_11_0/PCL1.11.0/3rdParty/FLANN/include/flann \INCLUDEPATH += D:/Soft_Install/pcl1_11_0/PCL1.11.0/3rdParty/OpenNI2/Include \INCLUDEPATH += D:/Soft_Install/pcl1_11_0/PCL1.11.0/3rdParty/Qhull/include \INCLUDEPATH += D:/Soft_Install/pcl1_11_0/PCL1.11.0/3rdParty/VTK/include/vtk-8.2 \INCLUDEPATH += D:/Soft_Install/pcl1_11_0/PCL1.11.0/include/pcl-1.11/pcl \INCLUDEPATH += D:/Soft_Install/pcl1_11_0/PCL1.11.0/include/pcl-1.11 \LIBS += -LD:/Soft_Install/pcl1_11_0/PCL1.11.0/lib \-lpcl_common \-lpcl_features \-lpcl_filters \-lpcl_io \-lpcl_io_ply \-lpcl_kdtree \-lpcl_keypoints \-lpcl_ml \-lpcl_octree \-lpcl_outofcore \-lpcl_people \-lpcl_recognition \-lpcl_registration \-lpcl_sample_consensus \-lpcl_search \-lpcl_segmentation \-lpcl_stereo \-lpcl_surface \-lpcl_tracking \-lpcl_visualizationLIBS += -LD:/Soft_Install/pcl1_11_0/PCL1.11.0/3rdParty/Boost/lib/ \-llibboost_atomic-vc142-mt-x64-1_73\-llibboost_bzip2-vc142-mt-x64-1_73\-llibboost_chrono-vc142-mt-x64-1_73\-llibboost_container-vc142-mt-x64-1_73\-llibboost_context-vc142-mt-x64-1_73\-llibboost_contract-vc142-mt-x64-1_73\-llibboost_coroutine-vc142-mt-x64-1_73\-llibboost_date_time-vc142-mt-x64-1_73\-llibboost_exception-vc142-mt-x64-1_73\-llibboost_fiber-vc142-mt-x64-1_73\-llibboost_filesystem-vc142-mt-x64-1_73\-llibboost_graph-vc142-mt-x64-1_73\-llibboost_graph_parallel-vc142-mt-x64-1_73\-llibboost_iostreams-vc142-mt-x64-1_73\-llibboost_locale-vc142-mt-x64-1_73\-llibboost_log-vc142-mt-x64-1_73\-llibboost_log_setup-vc142-mt-x64-1_73\-llibboost_math_c99-vc142-mt-x64-1_73\-llibboost_math_c99f-vc142-mt-x64-1_73\-llibboost_math_c99l-vc142-mt-x64-1_73\-llibboost_math_tr1-vc142-mt-x64-1_73\-llibboost_math_tr1f-vc142-mt-x64-1_73\-llibboost_math_tr1l-vc142-mt-x64-1_73\-llibboost_mpi-vc142-mt-x64-1_73\-llibboost_nowide-vc142-mt-x64-1_73\-llibboost_numpy38-vc142-mt-x64-1_73\-llibboost_prg_exec_monitor-vc142-mt-x64-1_73\-llibboost_program_options-vc142-mt-x64-1_73\-llibboost_python38-vc142-mt-x64-1_73\-llibboost_random-vc142-mt-x64-1_73\-llibboost_regex-vc142-mt-x64-1_73\-llibboost_serialization-vc142-mt-x64-1_73\-llibboost_stacktrace_noop-vc142-mt-x64-1_73\-llibboost_stacktrace_windbg-vc142-mt-x64-1_73\-llibboost_stacktrace_windbg_cached-vc142-mt-x64-1_73\-llibboost_system-vc142-mt-x64-1_73\-llibboost_test_exec_monitor-vc142-mt-x64-1_73\-llibboost_thread-vc142-mt-x64-1_73\-llibboost_timer-vc142-mt-x64-1_73\-llibboost_type_erasure-vc142-mt-x64-1_73\-llibboost_unit_test_framework-vc142-mt-x64-1_73\-llibboost_wave-vc142-mt-x64-1_73\-llibboost_wserialization-vc142-mt-x64-1_73\-llibboost_zlib-vc142-mt-x64-1_73LIBS += -LD:/Soft_Install/pcl1_11_0/PCL1.11.0/3rdParty/FLANN/lib\-lflann\-lflann_cpp\-lflann_cpp_s\-lflann_s\LIBS += -LD:/Soft_Install/pcl1_11_0/PCL1.11.0/3rdParty/OpenNI2/Lib\-lOpenNI2LIBS += -LD:/Soft_Install/pcl1_11_0/PCL1.11.0/3rdParty/Qhull/lib\-lqhull\-lqhullcpp\-lqhullstatic\-lqhullstatic_r\-lqhull_p\-lqhull_rLIBS += -LD:/Soft_Install/pcl1_11_0/PCL1.11.0/3rdParty/VTK/lib \-lvtkChartsCore-8.2 \-lvtkCommonColor-8.2 \-lvtkCommonComputationalGeometry-8.2 \-lvtkCommonCore-8.2 \-lvtkCommonDataModel-8.2 \-lvtkCommonExecutionModel-8.2 \-lvtkCommonMath-8.2 \-lvtkCommonMisc-8.2 \-lvtkCommonSystem-8.2 \-lvtkCommonTransforms-8.2 \-lvtkDICOMParser-8.2 \-lvtkDomainsChemistry-8.2 \-lvtkDomainsChemistryOpenGL2-8.2 \-lvtkdoubleconversion-8.2 \-lvtkexodusII-8.2 \-lvtkexpat-8.2 \-lvtkFiltersAMR-8.2 \-lvtkFiltersCore-8.2 \-lvtkFiltersExtraction-8.2 \-lvtkFiltersFlowPaths-8.2 \-lvtkFiltersGeneral-8.2 \-lvtkFiltersGeneric-8.2 \-lvtkFiltersGeometry-8.2 \-lvtkFiltersHybrid-8.2 \-lvtkFiltersHyperTree-8.2 \-lvtkFiltersImaging-8.2 \-lvtkFiltersModeling-8.2 \-lvtkFiltersParallel-8.2 \-lvtkFiltersParallelImaging-8.2 \-lvtkFiltersPoints-8.2 \-lvtkFiltersProgrammable-8.2 \-lvtkFiltersSelection-8.2 \-lvtkFiltersSMP-8.2 \-lvtkFiltersSources-8.2 \-lvtkFiltersStatistics-8.2 \-lvtkFiltersTexture-8.2 \-lvtkFiltersTopology-8.2 \-lvtkFiltersVerdict-8.2 \-lvtkfreetype-8.2 \-lvtkGeovisCore-8.2 \-lvtkgl2ps-8.2 \-lvtkglew-8.2 \-lvtkGUISupportQt-8.2 \-lvtkGUISupportQtOpenGL-8.2 \-lvtkGUISupportQtSQL-8.2 \-lvtkhdf5-8.2 \-lvtkhdf5_hl-8.2 \-lvtkImagingColor-8.2 \-lvtkImagingCore-8.2 \-lvtkImagingFourier-8.2 \-lvtkImagingGeneral-8.2 \-lvtkImagingHybrid-8.2 \-lvtkImagingMath-8.2 \-lvtkImagingMorphological-8.2 \-lvtkImagingSources-8.2 \-lvtkImagingStatistics-8.2 \-lvtkImagingStencil-8.2 \-lvtkInfovisCore-8.2 \-lvtkInfovisLayout-8.2 \-lvtkInteractionImage-8.2 \-lvtkInteractionStyle-8.2 \-lvtkInteractionWidgets-8.2 \-lvtkIOAMR-8.2 \-lvtkIOAsynchronous-8.2 \-lvtkIOCityGML-8.2 \-lvtkIOCore-8.2 \-lvtkIOEnSight-8.2 \-lvtkIOExodus-8.2 \-lvtkIOExport-8.2 \-lvtkIOExportOpenGL2-8.2 \-lvtkIOExportPDF-8.2 \-lvtkIOGeometry-8.2 \-lvtkIOImage-8.2 \-lvtkIOImport-8.2 \-lvtkIOInfovis-8.2 \-lvtkIOLegacy-8.2 \-lvtkIOLSDyna-8.2 \-lvtkIOMINC-8.2 \-lvtkIOMovie-8.2 \-lvtkIONetCDF-8.2 \-lvtkIOParallel-8.2 \-lvtkIOParallelXML-8.2 \-lvtkIOPLY-8.2 \-lvtkIOSegY-8.2 \-lvtkIOSQL-8.2 \-lvtkIOTecplotTable-8.2 \-lvtkIOVeraOut-8.2 \-lvtkIOVideo-8.2 \-lvtkIOXML-8.2 \-lvtkIOXMLParser-8.2 \-lvtkjpeg-8.2 \-lvtkjsoncpp-8.2 \-lvtklibharu-8.2 \-lvtklibxml2-8.2 \-lvtkLocalExample-8.2 \-lvtklz4-8.2 \-lvtklzma-8.2 \-lvtkmetaio-8.2 \-lvtkNetCDF-8.2 \-lvtkogg-8.2 \-lvtkParallelCore-8.2 \-lvtkpng-8.2 \-lvtkproj-8.2 \-lvtkpugixml-8.2 \-lvtkRenderingAnnotation-8.2 \-lvtkRenderingContext2D-8.2 \-lvtkRenderingContextOpenGL2-8.2 \-lvtkRenderingCore-8.2 \-lvtkRenderingFreeType-8.2 \-lvtkRenderingGL2PSOpenGL2-8.2 \-lvtkRenderingImage-8.2 \-lvtkRenderingLabel-8.2 \-lvtkRenderingLOD-8.2 \-lvtkRenderingOpenGL2-8.2 \-lvtkRenderingQt-8.2 \-lvtkRenderingVolume-8.2 \-lvtkRenderingVolumeOpenGL2-8.2 \-lvtksqlite-8.2 \-lvtksys-8.2 \-lvtktheora-8.2 \-lvtktiff-8.2 \-lvtkverdict-8.2 \-lvtkViewsContext2D-8.2 \-lvtkViewsCore-8.2 \-lvtkViewsInfovis-8.2 \-lvtkViewsQt-8.2 \-lvtkzlib-8.2
然后,在mian文件中编程:
#include "mainwindow.h"#include <QApplication>#include <iostream> //标准输入输出流
#include<pcl/io/io.h>
#include<pcl/io/pcd_io.h>
#include<pcl/io/ply_io.h>
#include <pcl/point_types.h> //PCL对各种格式的点的支持头文件
#include <pcl/visualization/cloud_viewer.h>//点云查看窗口头文件
#include <pcl/point_cloud.h>
#include <QDebug>
#include <QDir>typedef pcl::PointXYZ PointT;using namespace std;int main(int argc, char *argv[])
{QApplication a(argc, argv);
// MainWindow w;
// w.show();std::cout<<"start"<<std::endl;pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);QString file = "E:/Project_Data/PCL_Data/rabbit.pcd";// 读取点云,失败返回-1if (pcl::io::loadPCDFile<PointT>(file.toStdString(), *cloud) == -1){PCL_ERROR("couldn't read file\n");std::cout<<"error"<<std::endl;return (-1);}std::cout << cloud->points.size() << std::endl;// 点云可视化pcl::visualization::CloudViewer viewer("Cloud Viewer");viewer.showCloud(cloud);// 循环判断是否退出while (!viewer.wasStopped()) {// 后续也可以在这里对点云做很多处理}std::cout<<"end"<<std::endl;return a.exec();
}
最后,以release模式编译我们的项目,因为我的vtk只编译了releas的,所以这个项目编译了release的。顺便把所需要的dll都拷贝到项目release文件夹中。
运行程序,如下图所示:
我们的PCL配置,到这里就结束了。
文章未经授权,禁止转载!