经验分享vs2019 pcl 点云处理开发环境搭建教程
Posted 极智视界
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了经验分享vs2019 pcl 点云处理开发环境搭建教程相关的知识,希望对你有一定的参考价值。
欢迎关注我的公众号 [极智视界],获取我的更多笔记分享
大家好,我是极智视界。本文详细记录了在 win10 下 vs2019 + pcl 3D点云处理开发环境搭建方法。
PCL (Point Cloud Library) 是点云处理的大型跨平台开源 C++ 编程库,地位类似与 图像处理领域的 Opencv。同 Opencv 一样,PCL 实现了大量点云相关的通用算法和高效数据结构,涉及到点云获取、滤波、分割、配准、检索、特征提取、识别、追踪、曲面重建、可视化等。
好了,下面开始。这里默认你已经安装好了 vs2019。
文章目录
1、PCL 安装
下载 PCL,传送:https://github.com/PointCloudLibrary/pcl/releases
这里我们下载目前最新版的 pcl,如下,下载这两个文件:
双击 PCL-1.12.1-ALLnOne-msvc2019-win64.exe 进行安装
选择 Add PCL to the system PATH for all users
我这里的安装目录在 C:\\Program Files,会有如下安装文件:
解压前面下载的 pcl-1.12.1-pdb.msvc2019-win64.zip,将里面的文件拷贝到 C:\\Program Files\\PCL 1.12.1\\bin 下。然后配置一下系统环境:此电脑 -> 属性 -> 高级系统属性 -> 环境变量 -> path,添加环境变量:
C:\\Program Files\\PCL 1.12.1\\bin
C:\\Program Files\\PCL 1.12.1\\lib
C:\\Program Files\\OpenNI2\\Tools
C:\\Program Files\\OpenNI2\\Redist
C:\\Program Files\\OpenNI2\\Lib
C:\\Program Files\\PCL 1.12.1\\3rdParty\\FLANN\\bin
C:\\Program Files\\PCL 1.12.1\\3rdParty\\FLANN\\lib
C:\\Program Files\\PCL 1.12.1\\3rdParty\\Qhull\\bin
C:\\Program Files\\PCL 1.12.1\\3rdParty\\Qhull\\lib
C:\\Program Files\\PCL 1.12.1\\3rdParty\\VTK\\bin
C:\\Program Files\\PCL 1.12.1\\3rdParty\\VTK\\lib
C:\\Program Files\\PCL 1.12.1\\3rdParty\\Boost\\lib
2、vs2019 配置
vs2019 创建新项目
配置头路径
配置库路径
在 C/C++ -> 预处理器 -> 预处理器定义中添加:
_CRT_SECURE_NO_WARNINGS
_SCL_SECURE_NO_WARNINGS
_SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING
然后将 C/C++ -> 所有选项 -> SDL检查改为 否
添加依赖库:
pcl_commond.lib
pcl_featuresd.lib
pcl_filtersd.lib
pcl_io.lib
pcl_io_plyd.lib
pcl_iod.lib
pcl_kdtreed.lib
pcl_keypointsd.lib
pcl_mld.lib
pcl_octreed.lib
pcl_outofcored.lib
pcl_peopled.lib
pcl_recognitiond.lib
pcl_registrationd.lib
pcl_sample_consensusd.lib
pcl_searchd.lib
pcl_segmentationd.lib
pcl_stereod.lib
pcl_surfaced.lib
pcl_trackingd.lib
pcl_visualizationd.lib
vtkcgns-9.1d.lib
vtkChartsCore-9.1d.lib
vtkCommonColor-9.1d.lib
vtkCommonComputationalGeometry-9.1d.lib
vtkCommonCore-9.1d.lib
vtkCommonDataModel-9.1d.lib
vtkCommonExecutionModel-9.1d.lib
vtkCommonMath-9.1d.lib
vtkCommonMisc-9.1d.lib
vtkCommonSystem-9.1d.lib
vtkCommonTransforms-9.1d.lib
vtkDICOMParser-9.1d.lib
vtkDomainsChemistry-9.1d.lib
vtkDomainsChemistryOpenGL2-9.1d.lib
vtkdoubleconversion-9.1d.lib
vtkexodusII-9.1d.lib
vtkexpat-9.1d.lib
vtkFiltersAMR-9.1d.lib
vtkFiltersCore-9.1d.lib
vtkFiltersExtraction-9.1d.lib
vtkFiltersFlowPaths-9.1d.lib
vtkFiltersGeneral-9.1d.lib
vtkFiltersGeneric-9.1d.lib
vtkFiltersGeometry-9.1d.lib
vtkFiltersHybrid-9.1d.lib
vtkFiltersHyperTree-9.1d.lib
vtkFiltersImaging-9.1d.lib
vtkFiltersModeling-9.1d.lib
vtkFiltersParallel-9.1d.lib
vtkFiltersParallelImaging-9.1d.lib
vtkFiltersPoints-9.1d.lib
vtkFiltersProgrammable-9.1d.lib
vtkFiltersSelection-9.1d.lib
vtkFiltersSMP-9.1d.lib
vtkFiltersSources-9.1d.lib
vtkFiltersStatistics-9.1d.lib
vtkFiltersTexture-9.1d.lib
vtkFiltersTopology-9.1d.lib
vtkFiltersVerdict-9.1d.lib
vtkfmt-9.1d.lib
vtkfreetype-9.1d.lib
vtkGeovisCore-9.1d.lib
vtkgl2ps-9.1d.lib
vtkglew-9.1d.lib
vtkhdf5_hl-9.1d.lib
vtkhdf5-9.1d.lib
vtkImagingColor-9.1d.lib
vtkImagingCore-9.1d.lib
vtkImagingFourier-9.1d.lib
vtkImagingGeneral-9.1d.lib
vtkImagingHybrid-9.1d.lib
vtkImagingMath-9.1d.lib
vtkImagingMorphological-9.1d.lib
vtkImagingSources-9.1d.lib
vtkImagingStatistics-9.1d.lib
vtkImagingStencil-9.1d.lib
vtkInfovisCore-9.1d.lib
vtkInfovisLayout-9.1d.lib
vtkInteractionImage-9.1d.lib
vtkInteractionStyle-9.1d.lib
vtkInteractionWidgets-9.1d.lib
vtkIOAMR-9.1d.lib
vtkIOAsynchronous-9.1d.lib
vtkIOCGNSReader-9.1d.lib
vtkIOChemistry-9.1d.lib
vtkIOCityGML-9.1d.lib
vtkIOCONVERGECFD-9.1d.lib
vtkIOCore-9.1d.lib
vtkIOEnSight-9.1d.lib
vtkIOExodus-9.1d.lib
vtkIOExport-9.1d.lib
vtkIOExportGL2PS-9.1d.lib
vtkIOExportPDF-9.1d.lib
vtkIOGeometry-9.1d.lib
vtkIOHDF-9.1d.lib
vtkIOImage-9.1d.lib
vtkIOImport-9.1d.lib
vtkIOInfovis-9.1d.lib
vtkIOiosS-9.1d.lib
vtkIOLegacy-9.1d.lib
vtkIOLSDyna-9.1d.lib
vtkIOMINC-9.1d.lib
vtkIOMotionFX-9.1d.lib
vtkIOMovie-9.1d.lib
vtkIONetCDF-9.1d.lib
vtkIOOggTheora-9.1d.lib
vtkIOParallel-9.1d.lib
vtkIOParallelXML-9.1d.lib
vtkIOPLY-9.1d.lib
vtkIOSegY-9.1d.lib
vtkIOSQL-9.1d.lib
vtkioss-9.1d.lib
vtkIOTecplotTable-9.1d.lib
vtkIOVeraOut-9.1d.lib
vtkIOVideo-9.1d.lib
vtkIOXML-9.1d.lib
vtkIOXMLParser-9.1d.lib
vtkjpeg-9.1d.lib
vtkjsoncpp-9.1d.lib
vtkkissfft-9.1d.lib
vtklibharu-9.1d.lib
vtklibproj-9.1d.lib
vtklibxml2-9.1d.lib
vtkloguru-9.1d.lib
vtklz4-9.1d.lib
vtklzma-9.1d.lib
vtkmetaio-9.1d.lib
vtknetcdf-9.1d.lib
vtkogg-9.1d.lib
vtkParallelCore-9.1d.lib
vtkParallelDIY-9.1d.lib
vtkpng-9.1d.lib
vtkpugixml-9.1d.lib
vtkRenderingAnnotation-9.1d.lib
vtkRenderingContext2D-9.1d.lib
vtkRenderingContextOpenGL2-9.1d.lib
vtkRenderingCore-9.1d.lib
vtkRenderingFreeType-9.1d.lib
vtkRenderingGL2PSOpenGL2-9.1d.lib
vtkRenderingImage-9.1d.lib
vtkRenderingLabel-9.1d.lib
vtkRenderingLOD-9.1d.lib
vtkRenderingOpenGL2-9.1d.lib
vtkRenderingSceneGraph-9.1d.lib
vtkRenderingUI-9.1d.lib
vtkRenderingVolume-9.1d.lib
vtkRenderingVolumeOpenGL2-9.1d.lib
vtkRenderingVtkJS-9.1d.lib
vtksqlite-9.1d.lib
vtksys-9.1d.lib
vtkTestingRendering-9.1d.lib
vtktheora-9.1d.lib
vtktiff-9.1d.lib
vtkverdict-9.1d.lib
vtkViewsContext2D-9.1d.lib
vtkViewsCore-9.1d.lib
vtkViewsInfovis-9.1d.lib
vtkWrappingTools-9.1d.lib
vtkzlib-9.1d.lib
qhull_rd.lib
qhullcpp_d.lib
qhullstatic_d.lib
qhullstatic_rd.lib
flann.lib
flann_cpp.lib
flann_cpp_s.lib
flann_cpp_s-gd.lib
flann_cpp-gd.lib
flann_s.lib
flann_s-gd.lib
flann-gd.lib
libboost_atomic-vc142-mt-gd-x64-1_78.lib
libboost_atomic-vc142-mt-x64-1_78.lib
libboost_bzip2-vc142-mt-gd-x64-1_78.lib
libboost_bzip2-vc142-mt-x64-1_78.lib
libboost_chrono-vc142-mt-gd-x64-1_78.lib
libboost_chrono-vc142-mt-x64-1_78.lib
libboost_container-vc142-mt-gd-x64-1_78.lib
libboost_container-vc142-mt-x64-1_78.lib
libboost_context-vc142-mt-gd-x64-1_78.lib
libboost_context-vc142-mt-x64-1_78.lib
libboost_contract-vc142-mt-gd-x64-1_78.lib
libboost_contract-vc142-mt-x64-1_78.lib
libboost_coroutine-vc142-mt-gd-x64-1_78.lib
libboost_coroutine-vc142-mt-x64-1_78.lib
libboost_date_time-vc142-mt-gd-x64-1_78.lib
libboost_date_time-vc142-mt-x64-1_78.lib
libboost_exception-vc142-mt-gd-x64-1_78.lib
libboost_exception-vc142-mt-x64-1_78.lib
libboost_filesystem-vc142-mt-gd-x64-1_78.lib
libboost_filesystem-vc142-mt-x64-1_78.lib
libboost_graph_parallel-vc142-mt-gd-x64-1_78.lib
libboost_graph_parallel-vc142-mt-x64-1_78.lib
libboost_graph-vc142-mt-gd-x64-1_78.lib
libboost_graph-vc142-mt-x64-1_78.lib
libboost_iostreams-vc142-mt-gd-x64-1_78.lib
libboost_iostreams-vc142-mt-x64-1_78.lib
libboost_json-vc142-mt-gd-x64-1_78.lib
libboost_json-vc142-mt-x64-1_78.lib
libboost_locale-vc142-mt-gd-x64-1_78.lib
libboost_locale-vc142-mt-x64-1_78.lib
libboost_log_setup-vc142-mt-gd-x64-1_78.lib
libboost_log_setup-vc142-mt-x64-1_78.lib
libboost_log-vc142-mt-gd-x64-1_78.lib
libboost_log-vc142-mt-x64-1_78.lib
libboost_math_c99f-vc142-mt-gd-x64-1_78.lib
libboost_math_c99f-vc142-mt-x64-1_78.lib
libboost_math_c99l-vc142-mt-gd-x64-1_78.lib
libboost_math_c99l-vc142-mt-x64-1_78.lib
libboost_math_c99-vc142-mt-gd-x64-1_78.lib
libboost_math_c99-vc142-mt-x64-1_78.lib
libboost_math_tr1f-vc142-mt-gd-x64-1_78.lib
libboost_math_tr1f-vc142-mt-x64-1_78.lib
libboost_math_tr1l-vc142-mt-gd-x64-1_78.lib
libboost_math_tr1l-vc142-mt-x64-1_78.lib
libboost_math_tr1-vc142-mt-gd-x64-1_78.lib
libboost_math_tr1-vc142-mt-x64-1_78.lib
libboost_mpi-vc142-mt-gd-x64-1_78.lib
libboost_mpi-vc142-mt-x64-1_78.lib
libboost_nowide-vc142-mt-gd-x64-1_78.lib
libboost_nowide-vc142-mt-x64-1_78.lib
libboost_numpy38-vc142-mt-gd-x64-1_78.lib
libboost_numpy38-vc142-mt-x64-1_78.lib
libboost_prg_exec_monitor-vc142-mt-gd-x64-1_78.lib
libboost_prg_exec_monitor-vc142-mt-x64-1_78.lib
libboost_program_options-vc142-mt-gd-x64-1_78.lib
libboost_program_options-vc142-mt-x64-1_78.lib
libboost_python38-vc142-mt-gd-x64-1_78.lib
libboost_python38-vc142-mt-x64-1_78.lib
libboost_random-vc142-mt-gd-x64-1_78.lib
libboost_random-vc142-mt-x64-1_78.lib
libboost_regex-vc142-mt-gd-x64-1_78.lib
libboost_regex-vc142-mt-x64-1_78.lib
libboost_serialization-vc142-mt-gd-x64-1_78.lib
libboost_serialization-vc142-mt-x64-1_78.lib
libboost_system-vc142-mt-gd-x64-1_78.lib
libboost_system-vc142-mt-x64-1_78.lib
libboost_test_exec_monitor-vc142-mt-gd-x64-1_78.lib
libboost_test_exec_monitor-vc142-mt-x64-1_78.lib
libboost_thread-vc142-mt-gd-x64-1_78.lib
libboost_thread-vc142-mt-x64-1_78.lib
libboost_timer-vc142-mt-gd-x64-1_78.lib
libboost_timer-vc142-mt-x64-1_78.lib
libboost_type_erasure-vc142-mt-gd-x64-1_78.lib
libboost_type_erasure-vc142-mt-x64-1_78.lib
libboost_unit_test_framework-vc142-mt-gd-x64-1_78.lib
libboost_unit_test_framework-vc142-mt-x64-1_78.lib
libboost_wave-vc142-mt-gd-x64-1_78.lib
libboost_wave-vc142-mt-x64-1_78.lib
libboost_wserialization-vc142-mt-gd-x64-1_78.lib
libboost_wserialization-vc142-mt-x64-1_78.lib
libboost_zlib-vc142-mt-x64-1_78.lib
libboost_zlib-vc142-mt-gd-x64-1_78.lib
OpenNI2.lib
以上就完成了环境配置,下面测试一下。
3、环境测试
来跑个点云映射的 demo 测试一下:
#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);
执行成功,输出如下:
好了,以上分享了 win10 环境 vs2019 配置 pcl 点云处理开发环境搭建的方法,希望我的分享能对你的学习有一点帮助。
【公众号传送】
扫描下方二维码即可关注我的微信公众号【极智视界】,获取更多AI经验分享,让我们用极致+极客的心态来迎接AI !
以上是关于经验分享vs2019 pcl 点云处理开发环境搭建教程的主要内容,如果未能解决你的问题,请参考以下文章
Windows7系统下OpenCV2.4.4+PCL1.6.0+SSBA3.0+VS2010 IDE32环境下编译和安装以实现Sfm和PCL点云数据可视化