其他分享
首页 > 其他分享> > PCL点云库安装及学习(2021.7.28)

PCL点云库安装及学习(2021.7.28)

作者:互联网

PCL点云库学习 2021.7.28

1、PCL简介

        点云库PCL英文全称为Point Cloud Library,它是一个独立的、大规模的、开放的项目,用于2D和3D图像和点云处理,同时还可免费用于商业和科学研究。PCL支持的操作系统有Linux、Windows、MacOS等,它所支持的开发语言有C++和Python,内部所调用的第三方依赖库有BoostEigenFLANNVTKQHullOpenNI2这六个依赖库特别重要!!!PCL可分为一系列的模块库,包含滤波器filters特征features特征keypoints配准registrationkd树kdtreeoc树octree分割segmentation采样一致性sample_consensus表面surface识别recognition输入输出io可视化visualization

        在三维激光扫描点云数据处理中,PCL可作为一款强大的工具帮助企业和科研人员开展大量的研究工作,具体PCL的细节可参考PCL帮助文档PCL论文下载PCL的Github地址


2、Win10系统下PCL环境配置

2.1 前提环境(Win10 64位+Visual Studio 2015)

        这里电脑的操作系统为64位Windows10系统,同时需要电脑安装Visual Studio

Win10 x64
VS 2015

        在Windows系统上配置PCL环境通常有两种方式方式一:源码编译方式二:安装包安装。在很多情况下,我们可以使用All-in-one Installer安装包来使用PCL;但是如果用户想要使用其他编译器来使用PCL点云库的功能,就需要自己编译PCL及其依赖的第三方库。

2.2 方式一:源码编译(过程繁琐但通用性强)

        PCL 1.8.1源码编译英文教程

        如果从源码编译更新版本的PCL点云库,则需要从帮助文档出发。首先参考Building PCL’s dependencies from source on Windows来编译所需的第三方依赖库,然后下载PCL源代码并参考Compiling PCL from source on Windows编译为二进制binaries库可供其他项目调用,这里不再赘述。

2.3 方式二:安装包安装(简单易懂,推荐使用)

        PCL All-in-one Installer是一个包含预编译好的PCL及其第三方库的安装包,由于电脑安装了VS 2015,通过查找发现安装包PCL-1.8.1-AllInOne-msvc2015-win64.exe和调试数据库文件pcl-1.8.1-pdb-msvc2015-win64.zip比较适合自己的电脑环境。PCL1.8.1安装包下载链接


        第一步,双击安装包PCL-1.8.1-AllInOne-msvc2015-win64.exe,一直点击下一步即可;安装的过程中会弹出OpenNI的安装程序,将OpenNI的安装路径设置为PCL安装路径下的3rdParty\OpenNI2文件夹。










OpenNI 2
PCL 1.8.1

        安装程序结束后,PCL安装目录结构如下图所示,其中第三方库3rdParty文件夹下包含BoostEigenFLANNOpenNI2QhullVTK六个文件夹,各个文件夹目录结构见下图。

PCL 1.8.1 安装目录
第三方库3rdParty文件夹
Boost文件夹
eigen3文件夹
FLANN文件夹
OpenNI 2文件夹
Qhull文件夹
VTK文件夹

        第二步pcl-1.8.1-pdb-msvc2015-win64.zip解压后文件夹下的文件如下图所示,安装程序执行完成后,将pcl-1.8.1-pdb-msvc2015-win64.zip解压后的pdb文件全部拷贝到PCL安装目录下的bin文件夹中。

        第三步,对系统的环境变量进行设置,设置PCL_ROOTD:\Program Files (x86)\PCL 1.8.1,并在Path文本后添加;%PCL_ROOT%\bin;%PCL_ROOT%\3rdParty\OpenNI2\Tools;%PCL_ROOT%\3rdParty\FLANN\bin;%PCL_ROOT%\3rdParty\Qhull\bin;%PCL_ROOT%\3rdParty\VTK\bin;


        最终设置好的系统环境变量如下图所示,至此,PCL环境配置完成。

3、PCL项目实战(VS 2015)

3.1 VS 2015 新建项目进行配置

        第一步,打开Visual Studio 2015后新建一个Visual C++下的Win32控制台应用程序,项目名称输入MyPCL并选择项目保存位置后点击确定,进入Win32应用程序向导窗口后点击下一步后,接下来选择控制台应用程序和空项目后点击完成,



        第二步,在解决方案PCL项目的源文件上右键选择新建项->添加,在弹出的添加新项窗口中选择C++文件(.cpp)后,输入文件名为main.cpp后点击添加


        第三步,在打开的main.cpp文件中输入以下C++代码开始调试运行,运行结果如下图所示,说明程序能够正常运行。

#include <iostream>
using namespace std;
int main()
{
	cout<<"hello,world"<<endl;
	system("pause");
	return 0;
}

3.2 PCL项目头文件、库文件配置

        MyPCL项目上右键选择属性进入属性页窗口,配置选择Release或者Debug,平台选择x64
        对于一个C++项目而言,尤其是像包含第三方库(如OpenCV、OSG、PCL等)的项目,尤其要注意对三个部分的设置:1、头文件include包含目录用来指明.h文件的目录位置;2、库文件lib库目录用来指明.lib文件的目录位置;3、链接器中输入下的附加依赖项输入所有项目需要链接到的lib文件名。

3.2.1 PCL项目配置 Include包含目录(.h)

        在属性页窗口中选择VC++目录,点击右侧的包含目录,向其中添加 .h文件所在目录 后点击确定。

D:\Program Files (x86)\PCL 1.8.1\3rdParty\FLANN\include
D:\Program Files (x86)\PCL 1.8.1\3rdParty\Qhull\include
D:\Program Files (x86)\PCL 1.8.1\3rdParty\OpenNI2\Include
D:\Program Files (x86)\PCL 1.8.1\3rdParty\VTK\include\vtk-8.0
D:\Program Files (x86)\PCL 1.8.1\3rdParty\Eigen\eigen3
D:\Program Files (x86)\PCL 1.8.1\3rdParty\Boost\include\boost-1_64
D:\Program Files (x86)\PCL 1.8.1\include\pcl-1.8

3.2.2 PCL项目配置 Lib库目录(.lib)

        在属性页窗口中选择VC++目录,点击右侧的库目录,向其中添加 .lib文件所在目录 后点击确定。

D:\Program Files (x86)\PCL 1.8.1\3rdParty\Qhull\lib
D:\Program Files (x86)\PCL 1.8.1\3rdParty\OpenNI2\Lib
D:\Program Files (x86)\PCL 1.8.1\3rdParty\FLANN\lib
D:\Program Files (x86)\PCL 1.8.1\3rdParty\VTK\lib
D:\Program Files (x86)\PCL 1.8.1\3rdParty\Boost\lib
D:\Program Files (x86)\PCL 1.8.1\lib

3.2.3 PCL项目配置 链接器->输入(使用Eclipse+Java来获取lib下的lib文件名)

        由于项目运行时需要链接到其他lib库文件,所以需要向链接器指定项目运行需要链接到的lib文件名称,因此需要获取PCL安装目录下lib文件夹以及第三方库3rdParty文件夹下所有的lib文件名称,具体的lib文件夹包含:(1)D:\Program Files (x86)\PCL 1.8.1\lib;(2)D:\Program Files (x86)\PCL 1.8.1\3rdParty\Boost\lib;(3)D:\Program Files (x86)\PCL 1.8.1\3rdParty\FLANN\lib;(4)D:\Program Files (x86)\PCL 1.8.1\3rdParty\OpenNI2\Lib;(5)D:\Program Files (x86)\PCL 1.8.1\3rdParty\Qhull\lib;(6)D:\Program Files (x86)\PCL 1.8.1\3rdParty\VTK\lib由于MyPCL项目配置为Release,所以获取的lib就是release类型的lib;如果项目配置为Debug,则需要获取debug类型的lib

PCL的lib
Boost的lib
FLANN的lib
OpenNI 2的lib
Qhull的lib
VTK的lib
        因为lib文件数量较多,手动逐个复制lib文件名较为繁琐耗时,因此采用`Java`和`Eclipse IDE`来批量获取相应目录下的lib文件名称。
Java 1.8
Eclipse IDE

        获取文件夹下所有文件名的java代码如下

package com.test;

import java.io.File;
import java.text.*;
 
public class BianliFolderFile
{
	public static void main(String[] args) 
	{
		String path = "D:\\Program Files (x86)\\PCL 1.8.1\\3rdParty\\VTK\\lib";
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		System.out.println(path+ "路径下的所有文件");
		File file = new File(path);		//获取其file对象
		File[] fs = file.listFiles();
		
		for(File f:fs)
		{
			if(f.isFile())
				{				
				    String f1 = f.getName();
				    if(!f1.contains("-gd"))
				    	System.out.println(f.getName());
				}
		}
	}
}

        运行结果如下图所示,将控制台运行的结果手动复制出来

        将六个lib文件夹字符串分别赋值给上述java代码中的path变量执行六次,同时通过根据条件过滤(lib文件名含有_debug、-gd、_d的均代表Debug项目下的lib其余的则代表Release项目下的lib)可得到每个lib文件夹下的lib文件名。

D:\Program Files (x86)\PCL 1.8.1\lib
D:\Program Files (x86)\PCL 1.8.1\3rdParty\Boost\lib
D:\Program Files (x86)\PCL 1.8.1\3rdParty\FLANN\lib
D:\Program Files (x86)\PCL 1.8.1\3rdParty\OpenNI2\Lib
D:\Program Files (x86)\PCL 1.8.1\3rdParty\Qhull\lib
D:\Program Files (x86)\PCL 1.8.1\3rdParty\VTK\lib

        各个lib文件夹汇总后的适用于Release项目的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_numpy-vc140-mt-1_64.lib
libboost_numpy3-vc140-mt-1_64.lib
libboost_prg_exec_monitor-vc140-mt-1_64.lib
libboost_program_options-vc140-mt-1_64.lib
libboost_python-vc140-mt-1_64.lib
libboost_python3-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
OpenNI2.lib
qhull.lib
qhullcpp.lib
qhullstatic.lib
qhullstatic_r.lib
qhull_p.lib
qhull_r.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
vtknetcdf_c++.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

        在属性页窗口中选择链接器->输入,点击右侧的附加依赖项,向其中添加 .lib文件名 后点击确定。

        (如果配置的项目属性为Debug调试项目,则Debug项目下的lib文件名参考如下所示)

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-vc140-mt-gd-1_64.lib
libboost_graph_parallel-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_numpy-vc140-mt-gd-1_64.lib
libboost_numpy3-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_python-vc140-mt-gd-1_64.lib
libboost_python3-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
flann-gd.lib
flann_cpp-gd.lib
flann_cpp_s-gd.lib
flann_s-gd.lib
OpenNI2.lib
qhullcpp_d.lib
qhullstatic_d.lib
qhullstatic_r_d.lib
qhull_d.lib
qhull_p_d.lib
qhull_r_d.lib
vtkalglib-8.0-gd.lib
vtkChartsCore-8.0-gd.lib
vtkCommonColor-8.0-gd.lib
vtkCommonComputationalGeometry-8.0-gd.lib
vtkCommonCore-8.0-gd.lib
vtkCommonDataModel-8.0-gd.lib
vtkCommonExecutionModel-8.0-gd.lib
vtkCommonMath-8.0-gd.lib
vtkCommonMisc-8.0-gd.lib
vtkCommonSystem-8.0-gd.lib
vtkCommonTransforms-8.0-gd.lib
vtkDICOMParser-8.0-gd.lib
vtkDomainsChemistry-8.0-gd.lib
vtkexoIIc-8.0-gd.lib
vtkexpat-8.0-gd.lib
vtkFiltersAMR-8.0-gd.lib
vtkFiltersCore-8.0-gd.lib
vtkFiltersExtraction-8.0-gd.lib
vtkFiltersFlowPaths-8.0-gd.lib
vtkFiltersGeneral-8.0-gd.lib
vtkFiltersGeneric-8.0-gd.lib
vtkFiltersGeometry-8.0-gd.lib
vtkFiltersHybrid-8.0-gd.lib
vtkFiltersHyperTree-8.0-gd.lib
vtkFiltersImaging-8.0-gd.lib
vtkFiltersModeling-8.0-gd.lib
vtkFiltersParallel-8.0-gd.lib
vtkFiltersParallelImaging-8.0-gd.lib
vtkFiltersPoints-8.0-gd.lib
vtkFiltersProgrammable-8.0-gd.lib
vtkFiltersSelection-8.0-gd.lib
vtkFiltersSMP-8.0-gd.lib
vtkFiltersSources-8.0-gd.lib
vtkFiltersStatistics-8.0-gd.lib
vtkFiltersTexture-8.0-gd.lib
vtkFiltersTopology-8.0-gd.lib
vtkFiltersVerdict-8.0-gd.lib
vtkfreetype-8.0-gd.lib
vtkGeovisCore-8.0-gd.lib
vtkgl2ps-8.0-gd.lib
vtkhdf5-8.0-gd.lib
vtkhdf5_hl-8.0-gd.lib
vtkImagingColor-8.0-gd.lib
vtkImagingCore-8.0-gd.lib
vtkImagingFourier-8.0-gd.lib
vtkImagingGeneral-8.0-gd.lib
vtkImagingHybrid-8.0-gd.lib
vtkImagingMath-8.0-gd.lib
vtkImagingMorphological-8.0-gd.lib
vtkImagingSources-8.0-gd.lib
vtkImagingStatistics-8.0-gd.lib
vtkImagingStencil-8.0-gd.lib
vtkInfovisCore-8.0-gd.lib
vtkInfovisLayout-8.0-gd.lib
vtkInteractionImage-8.0-gd.lib
vtkInteractionStyle-8.0-gd.lib
vtkInteractionWidgets-8.0-gd.lib
vtkIOAMR-8.0-gd.lib
vtkIOCore-8.0-gd.lib
vtkIOEnSight-8.0-gd.lib
vtkIOExodus-8.0-gd.lib
vtkIOExport-8.0-gd.lib
vtkIOExportOpenGL-8.0-gd.lib
vtkIOGeometry-8.0-gd.lib
vtkIOImage-8.0-gd.lib
vtkIOImport-8.0-gd.lib
vtkIOInfovis-8.0-gd.lib
vtkIOLegacy-8.0-gd.lib
vtkIOLSDyna-8.0-gd.lib
vtkIOMINC-8.0-gd.lib
vtkIOMovie-8.0-gd.lib
vtkIONetCDF-8.0-gd.lib
vtkIOParallel-8.0-gd.lib
vtkIOParallelXML-8.0-gd.lib
vtkIOPLY-8.0-gd.lib
vtkIOSQL-8.0-gd.lib
vtkIOTecplotTable-8.0-gd.lib
vtkIOVideo-8.0-gd.lib
vtkIOXML-8.0-gd.lib
vtkIOXMLParser-8.0-gd.lib
vtkjpeg-8.0-gd.lib
vtkjsoncpp-8.0-gd.lib
vtklibharu-8.0-gd.lib
vtklibxml2-8.0-gd.lib
vtklz4-8.0-gd.lib
vtkmetaio-8.0-gd.lib
vtkNetCDF-8.0-gd.lib
vtknetcdf_c++-gd.lib
vtkoggtheora-8.0-gd.lib
vtkParallelCore-8.0-gd.lib
vtkpng-8.0-gd.lib
vtkproj4-8.0-gd.lib
vtkRenderingAnnotation-8.0-gd.lib
vtkRenderingContext2D-8.0-gd.lib
vtkRenderingContextOpenGL-8.0-gd.lib
vtkRenderingCore-8.0-gd.lib
vtkRenderingFreeType-8.0-gd.lib
vtkRenderingGL2PS-8.0-gd.lib
vtkRenderingImage-8.0-gd.lib
vtkRenderingLabel-8.0-gd.lib
vtkRenderingLIC-8.0-gd.lib
vtkRenderingLOD-8.0-gd.lib
vtkRenderingOpenGL-8.0-gd.lib
vtkRenderingVolume-8.0-gd.lib
vtkRenderingVolumeOpenGL-8.0-gd.lib
vtksqlite-8.0-gd.lib
vtksys-8.0-gd.lib
vtktiff-8.0-gd.lib
vtkverdict-8.0-gd.lib
vtkViewsContext2D-8.0-gd.lib
vtkViewsCore-8.0-gd.lib
vtkViewsInfovis-8.0-gd.lib
vtkzlib-8.0-gd.lib

3.2.4 PCL项目配置 预处理器定义

        在属性页窗口中选择C/C+±>预处理器,点击右侧的预处理器定义,向其中添加_CRT_SECURE_NO_WARNINGS;后点击确定。

3.3 pcd文件简介

        PCD文件格式并不是为了重新发明轮子,而是为了补充现有的文件格式,这些文件格式由于某种原因不支持PCL为n维点云处理带来的某些扩展。PCD不是第一个支持三维点云数据的文件类型。特别是计算机图形学和计算几何界,已经创建了许多格式来描述使用激光扫描仪获取的任意多边形点云点云数据文件(.pcd)下载:githubsourceforge

3.4 编写C++PCL代码

        PCL点云可视化的C++代码如下,将其复制到main.cpp源文件中即可运行。

#include<pcl/visualization/cloud_viewer.h>
#include<iostream>
#include<pcl/io/io.h>
#include<pcl/io/pcd_io.h>
#include<pcl/io/ply_io.h>
#include<pcl/point_types.h>


using namespace std;
using namespace pcl;



void viewerOneOff(visualization::PCLVisualizer& viewer) {
	viewer.setBackgroundColor(0, 0, 0); //设置背景颜色为黑色
}

int main() {

	PointCloud<PointXYZ>::Ptr cloud(new PointCloud<PointXYZ>);

	char strfilepath[256] = "rabbit.pcd";
	if (-1 == io::loadPCDFile(strfilepath, *cloud)) {
		cout << "error input!" << endl;
		return -1;
	}

	cout << cloud->points.size() << endl;
	visualization::CloudViewer viewer("Cloud Viewer: Rabbit");

	viewer.showCloud(cloud);
	viewer.runOnVisualizationThreadOnce(viewerOneOff);
	system("pause");
	return 0;
}

3.5 运行结果(点云可视化)

3.5.1 附图

        利用下载的其他点云数据可视化后的部分结果如下图所示。

标签:8.0,vc140,lib,2021.7,28,gd,64,PCL
来源: https://blog.csdn.net/jing_zhong/article/details/118696089