Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)

  1. 下载安装包

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第1张图片
  1. 安装vs2019

勾选使用C++的桌面开发,确认MSVC v142 2019 C++ x64/86生成工具和Windows 10 SDK选中,其余保持默认即可,若有其他开发需要可以自行选择。

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第2张图片

3 安装Qt 6.4.2

首先需要注册一个Qt的账号,按照提示下一步

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第3张图片

选择安装的目录并勾选Custom installation

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第4张图片

选择Qt 6.4.2中的MSVC 2019 64-bit和Qt Debug Information Files,点击下一步,直到安装结束

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第5张图片
  1. 安装pcl 1.12.1+OpenNI2

双击exe进行安装,安装完成后,打开找到pcl安装路径下的3rdParty——>OpenNI2, 文件夹中只有msi文件,双击运行,卸载已安装的OpenNI2;再双击进行安装,安装路径选择当前OpenNI2的路径,安装完成后则会出现下列文件

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第6张图片

将下载的pdb压缩包解压,拷贝其中的所有文件到pcl的bin目录下

  1. 配置环境变量

打开环境变量,在系统变量中默认会设置好PCL_ROOT和OpenNI2_INCLUDE64/OPENNI2_LIB64/OPENNI2_REDIST64目录,确认与实际路径相符即可

双击打开Path,将如下的路径添加(根据自己的路径进行替换),配置完成后,重启电脑

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第7张图片
  1. 安装cmake 2.26

按照默认,进行安装即可

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第8张图片
  1. 编译 vtk 9.1.0

解压下载的vtk源代码压缩包,在其中创建一个新的文件夹build,打开cmake程序

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第9张图片

将CMakeLists.txt拖入cmake窗体,将Where to build the binaries的路径选为刚才创建的build路径

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第10张图片

点击Configure,选择Visual Studio 16 2019, x64,点击Finish

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第11张图片

第一次Configure完成后,确认一下模块已经勾选或选择为YES,再次点击Configure

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第12张图片

完成后,确认自动获取的Qt 版本以及Qt的各个模块路径是不是正确,再次点击Configure

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第13张图片

完成后应该没有红色提示,如果有,再次确认红色内容,点击Configure直到没有红色,点击Generate

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第14张图片

完成后,使用VS2019以管理权限启动,打开build下的VTK.sln

在VS中先对AllBuild进行Debug和Realese生成,再对INSTALL进行Debug和Relese的生成,正常情况下,所有的生成都会成功,失败数0

此时可以在刚才所选的VTK文件生成路径下,找到需要的文件,将其中的四个文件拷贝,替换pcl路径下自带的VTK中的文件

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第15张图片

  1. 安装VS 2019的Qt插件

在管理扩展中搜索qt,选择Qt Visual Studio Tools进行安装

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第16张图片

安装完成后,进入Qt VS Tools——> Qt Version,选择Qt所在路径即可

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第17张图片
Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第18张图片
  1. 创建测试项目VS 2019 + Qt 6.4.2

1)创建项目Qt Widget Application
2)配置属性——>调试——>环境
Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第19张图片
3)配置VC++目录

包含目录(按照自己的对应路径进行替换)

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第20张图片

库目录(按照自己的对应路径进行替换)

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第21张图片
4)配置C/C++

预处理器——>预处理器定义

_CRT_SECURE_NO_WARNINGS
BOOST_ALL_NO_LIB
BOOST_USE_WINDOWS_H
NOMINMAX
_SCL_SECURE_NO_WARNINGS
_SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING

所有选项——>SDL 检查,选择否

Win10+Qt6.4.2+VS2019+pcl1.12.1+vtk9.1.0环境配置(点云显示、处理)_第22张图片

5)配置链接器

输入——>附加依赖项(如下是Debug依赖项<以*d.lib结尾>,Realese只需要替换成对应lib即可)

pcl_commond.lib
pcl_featuresd.lib
pcl_filtersd.lib
pcl_iod.lib
pcl_io_plyd.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
libboost_atomic-vc142-mt-gd-x64-1_78.lib
libboost_bzip2-vc142-mt-gd-x64-1_78.lib
libboost_chrono-vc142-mt-gd-x64-1_78.lib
libboost_container-vc142-mt-gd-x64-1_78.lib
libboost_context-vc142-mt-gd-x64-1_78.lib
libboost_contract-vc142-mt-gd-x64-1_78.lib
libboost_coroutine-vc142-mt-gd-x64-1_78.lib
libboost_date_time-vc142-mt-gd-x64-1_78.lib
libboost_exception-vc142-mt-gd-x64-1_78.lib
libboost_filesystem-vc142-mt-gd-x64-1_78.lib
libboost_graph-vc142-mt-gd-x64-1_78.lib
libboost_graph_parallel-vc142-mt-gd-x64-1_78.lib
libboost_iostreams-vc142-mt-gd-x64-1_78.lib
libboost_json-vc142-mt-gd-x64-1_78.lib
libboost_locale-vc142-mt-gd-x64-1_78.lib
libboost_log-vc142-mt-gd-x64-1_78.lib
libboost_log_setup-vc142-mt-gd-x64-1_78.lib
libboost_math_c99-vc142-mt-gd-x64-1_78.lib
libboost_math_c99f-vc142-mt-gd-x64-1_78.lib
libboost_math_c99l-vc142-mt-gd-x64-1_78.lib
libboost_math_tr1-vc142-mt-gd-x64-1_78.lib
libboost_math_tr1f-vc142-mt-gd-x64-1_78.lib
libboost_math_tr1l-vc142-mt-gd-x64-1_78.lib
libboost_mpi-vc142-mt-gd-x64-1_78.lib
libboost_nowide-vc142-mt-gd-x64-1_78.lib
libboost_numpy38-vc142-mt-gd-x64-1_78.lib
libboost_prg_exec_monitor-vc142-mt-gd-x64-1_78.lib
libboost_program_options-vc142-mt-gd-x64-1_78.lib
libboost_python38-vc142-mt-gd-x64-1_78.lib
libboost_random-vc142-mt-gd-x64-1_78.lib
libboost_regex-vc142-mt-gd-x64-1_78.lib
libboost_serialization-vc142-mt-gd-x64-1_78.lib
libboost_system-vc142-mt-gd-x64-1_78.lib
libboost_test_exec_monitor-vc142-mt-gd-x64-1_78.lib
libboost_thread-vc142-mt-gd-x64-1_78.lib
libboost_timer-vc142-mt-gd-x64-1_78.lib
libboost_type_erasure-vc142-mt-gd-x64-1_78.lib
libboost_unit_test_framework-vc142-mt-gd-x64-1_78.lib
libboost_wave-vc142-mt-gd-x64-1_78.lib
libboost_wserialization-vc142-mt-gd-x64-1_78.lib
libboost_zlib-vc142-mt-gd-x64-1_78.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_rd.lib
qhull_rd.lib
vtkFiltersSelection-9.1d.lib
vtkFiltersSMP-9.1d.lib
vtkFiltersProgrammable-9.1d.lib
vtkFiltersPoints-9.1d.lib
vtkFiltersParallelImaging-9.1d.lib
vtkFiltersHyperTree-9.1d.lib
vtkFiltersGeneric-9.1d.lib
vtkFiltersFlowPaths-9.1d.lib
vtkDomainsChemistryOpenGL2-9.1d.lib
vtkIONetCDF-9.1d.lib
vtkViewsQt-9.1d.lib
vtkViewsContext2D-9.1d.lib
vtkTestingRendering-9.1d.lib
vtkRenderingVolumeOpenGL2-9.1d.lib
vtkRenderingQt-9.1d.lib
vtkRenderingLOD-9.1d.lib
vtkRenderingImage-9.1d.lib
vtkRenderingContextOpenGL2-9.1d.lib
vtkInteractionImage-9.1d.lib
vtkImagingStencil-9.1d.lib
vtkImagingStatistics-9.1d.lib
vtkImagingMorphological-9.1d.lib
vtkImagingFourier-9.1d.lib
vtkIOVideo-9.1d.lib
vtkIOVeraOut-9.1d.lib
vtkIOTecplotTable-9.1d.lib
vtkIOSegY-9.1d.lib
vtkIOParallelXML-9.1d.lib
vtkIOParallel-9.1d.lib
vtkIOPLY-9.1d.lib
vtkIOOggTheora-9.1d.lib
vtkIOMotionFX-9.1d.lib
vtkIOMINC-9.1d.lib
vtkIOLSDyna-9.1d.lib
vtkIOInfovis-9.1d.lib
vtkIOImport-9.1d.lib
vtkIOIOSS-9.1d.lib
vtkIOHDF-9.1d.lib
vtkIOExportPDF-9.1d.lib
vtkIOExportGL2PS-9.1d.lib
vtkIOExodus-9.1d.lib
vtkIOEnSight-9.1d.lib
vtkIOCityGML-9.1d.lib
vtkIOChemistry-9.1d.lib
vtkIOCONVERGECFD-9.1d.lib
vtkIOCGNSReader-9.1d.lib
vtkIOAsynchronous-9.1d.lib
vtkIOAMR-9.1d.lib
vtkGeovisCore-9.1d.lib
vtkGUISupportQtSQL-9.1d.lib
vtkFiltersVerdict-9.1d.lib
vtkFiltersTopology-9.1d.lib
vtkRenderingGL2PSOpenGL2-9.1d.lib
vtkverdict-9.1d.lib
vtkIOExport-9.1d.lib
vtktheora-9.1d.lib
vtkIOSQL-9.1d.lib
vtkDomainsChemistry-9.1d.lib
vtkFiltersAMR-9.1d.lib
vtkIOMovie-9.1d.lib
vtkViewsInfovis-9.1d.lib
vtkFiltersParallel-9.1d.lib
vtkImagingMath-9.1d.lib
vtkioss-9.1d.lib
vtkGUISupportQtQuick-9.1d.lib
vtklibxml2-9.1d.lib
vtklibproj-9.1d.lib
vtkcgns-9.1d.lib
vtkIOGeometry-9.1d.lib
vtkgl2ps-9.1d.lib
vtkInfovisLayout-9.1d.lib
vtkGUISupportQt-9.1d.lib
vtkFiltersImaging-9.1d.lib
vtkChartsCore-9.1d.lib
vtkogg-9.1d.lib
vtklibharu-9.1d.lib
vtkViewsCore-9.1d.lib
vtkRenderingVtkJS-9.1d.lib
vtksqlite-9.1d.lib
vtkexodusII-9.1d.lib
vtkRenderingLabel-9.1d.lib
vtkRenderingOpenGL2-9.1d.lib
vtkjsoncpp-9.1d.lib
vtkInfovisCore-9.1d.lib
vtknetcdf-9.1d.lib
vtkInteractionWidgets-9.1d.lib
vtkRenderingSceneGraph-9.1d.lib
vtkhdf5_hl-9.1d.lib
vtkImagingGeneral-9.1d.lib
vtkFiltersModeling-9.1d.lib
vtkImagingHybrid-9.1d.lib
vtkFiltersHybrid-9.1d.lib
vtkRenderingUI-9.1d.lib
vtkRenderingVolume-9.1d.lib
vtkglew-9.1d.lib
vtkFiltersTexture-9.1d.lib
vtkInteractionStyle-9.1d.lib
vtkRenderingContext2D-9.1d.lib
vtkRenderingAnnotation-9.1d.lib
vtkhdf5-9.1d.lib
vtkIOImage-9.1d.lib
vtkRenderingFreeType-9.1d.lib
vtkImagingSources-9.1d.lib
vtkImagingColor-9.1d.lib
vtkFiltersExtraction-9.1d.lib
vtkFiltersStatistics-9.1d.lib
vtktiff-9.1d.lib
vtkParallelDIY-9.1d.lib
vtkmetaio-9.1d.lib
vtkfreetype-9.1d.lib
vtkRenderingCore-9.1d.lib
vtkImagingCore-9.1d.lib
vtkpng-9.1d.lib
vtkDICOMParser-9.1d.lib
vtkFiltersGeometry-9.1d.lib
vtkjpeg-9.1d.lib
vtkParallelCore-9.1d.lib
vtkIOXML-9.1d.lib
vtkFiltersSources-9.1d.lib
vtkCommonColor-9.1d.lib
vtkFiltersGeneral-9.1d.lib
vtkIOXMLParser-9.1d.lib
vtkIOLegacy-9.1d.lib
vtkexpat-9.1d.lib
vtkfmt-9.1d.lib
vtkFiltersCore-9.1d.lib
vtkIOCore-9.1d.lib
vtkCommonComputationalGeometry-9.1d.lib
vtklzma-9.1d.lib
vtkzlib-9.1d.lib
vtkdoubleconversion-9.1d.lib
vtklz4-9.1d.lib
vtkCommonExecutionModel-9.1d.lib
vtkCommonDataModel-9.1d.lib
vtkWrappingTools-9.1d.lib
vtkpugixml-9.1d.lib
vtkCommonSystem-9.1d.lib
vtkCommonMisc-9.1d.lib
vtkCommonTransforms-9.1d.lib
vtkCommonMath-9.1d.lib
vtkkissfft-9.1d.lib
vtkCommonCore-9.1d.lib
vtksys-9.1d.lib
vtkloguru-9.1d.lib
Qt6OpenGLWidgetsd.lib
6) 使用QVTKOpenGLNativeWidget显示pclvisualizer中的点云
    vtkSmartPointer ren;
    vtkSmartPointer< vtkGenericOpenGLRenderWindow> renWin;
    qvtkWidget = new QVTKOpenGLNativeWidget;
    ren = vtkSmartPointer::New();
    renWin = vtkSmartPointer::New();
    ren->SetBackground(0.3, 0.3, 0.3);
    
    renWin->AddRenderer(ren);

    qvtkWidget->setRenderWindow(renWin);
    
    ui.verticalLayout->addWidget(qvtkWidget);

    cloud.reset(new pcl::PointCloud);
    
    viewer.reset(new pcl::visualization::PCLVisualizer(ren, renWin, "viewer", false));
    viewer->setupInteractor(qvtkWidget->interactor(), qvtkWidget->renderWindow());
    if (pcl::io::loadPCDFile(fileName.toStdString(), *cloud) == -1)
    {
        cout << "load pcd failed" << endl;
    } 
    else
    {
        viewer->addPointCloud(cloud, "cloud");
        viewer->updatePointCloud(cloud, "cloud");
    }

你可能感兴趣的:(3D点云,qt,c++,图像处理,visual,studio,windows)