当前位置:   article > 正文

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

qt vs2019 vtk pcl
  1. 下载安装包

  1. 安装vs2019

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

3 安装Qt 6.4.2

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

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

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

  1. 安装pcl 1.12.1+OpenNI2

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

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

  1. 配置环境变量

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

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

  1. 安装cmake 2.26

按照默认,进行安装即可

  1. 编译 vtk 9.1.0

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

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

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

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

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

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

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

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

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

  1. 安装VS 2019的Qt插件

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

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

  1. 创建测试项目VS 2019 + Qt 6.4.2

1)创建项目Qt Widget Application
2)配置属性——>调试——>环境
3)配置VC++目录

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

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

4)配置C/C++

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

  1. _CRT_SECURE_NO_WARNINGS
  2. BOOST_ALL_NO_LIB
  3. BOOST_USE_WINDOWS_H
  4. NOMINMAX
  5. _SCL_SECURE_NO_WARNINGS
  6. _SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING

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

5)配置链接器

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

  1. pcl_commond.lib
  2. pcl_featuresd.lib
  3. pcl_filtersd.lib
  4. pcl_iod.lib
  5. pcl_io_plyd.lib
  6. pcl_kdtreed.lib
  7. pcl_keypointsd.lib
  8. pcl_mld.lib
  9. pcl_octreed.lib
  10. pcl_outofcored.lib
  11. pcl_peopled.lib
  12. pcl_recognitiond.lib
  13. pcl_registrationd.lib
  14. pcl_sample_consensusd.lib
  15. pcl_searchd.lib
  16. pcl_segmentationd.lib
  17. pcl_stereod.lib
  18. pcl_surfaced.lib
  19. pcl_trackingd.lib
  20. pcl_visualizationd.lib
  21. libboost_atomic-vc142-mt-gd-x64-1_78.lib
  22. libboost_bzip2-vc142-mt-gd-x64-1_78.lib
  23. libboost_chrono-vc142-mt-gd-x64-1_78.lib
  24. libboost_container-vc142-mt-gd-x64-1_78.lib
  25. libboost_context-vc142-mt-gd-x64-1_78.lib
  26. libboost_contract-vc142-mt-gd-x64-1_78.lib
  27. libboost_coroutine-vc142-mt-gd-x64-1_78.lib
  28. libboost_date_time-vc142-mt-gd-x64-1_78.lib
  29. libboost_exception-vc142-mt-gd-x64-1_78.lib
  30. libboost_filesystem-vc142-mt-gd-x64-1_78.lib
  31. libboost_graph-vc142-mt-gd-x64-1_78.lib
  32. libboost_graph_parallel-vc142-mt-gd-x64-1_78.lib
  33. libboost_iostreams-vc142-mt-gd-x64-1_78.lib
  34. libboost_json-vc142-mt-gd-x64-1_78.lib
  35. libboost_locale-vc142-mt-gd-x64-1_78.lib
  36. libboost_log-vc142-mt-gd-x64-1_78.lib
  37. libboost_log_setup-vc142-mt-gd-x64-1_78.lib
  38. libboost_math_c99-vc142-mt-gd-x64-1_78.lib
  39. libboost_math_c99f-vc142-mt-gd-x64-1_78.lib
  40. libboost_math_c99l-vc142-mt-gd-x64-1_78.lib
  41. libboost_math_tr1-vc142-mt-gd-x64-1_78.lib
  42. libboost_math_tr1f-vc142-mt-gd-x64-1_78.lib
  43. libboost_math_tr1l-vc142-mt-gd-x64-1_78.lib
  44. libboost_mpi-vc142-mt-gd-x64-1_78.lib
  45. libboost_nowide-vc142-mt-gd-x64-1_78.lib
  46. libboost_numpy38-vc142-mt-gd-x64-1_78.lib
  47. libboost_prg_exec_monitor-vc142-mt-gd-x64-1_78.lib
  48. libboost_program_options-vc142-mt-gd-x64-1_78.lib
  49. libboost_python38-vc142-mt-gd-x64-1_78.lib
  50. libboost_random-vc142-mt-gd-x64-1_78.lib
  51. libboost_regex-vc142-mt-gd-x64-1_78.lib
  52. libboost_serialization-vc142-mt-gd-x64-1_78.lib
  53. libboost_system-vc142-mt-gd-x64-1_78.lib
  54. libboost_test_exec_monitor-vc142-mt-gd-x64-1_78.lib
  55. libboost_thread-vc142-mt-gd-x64-1_78.lib
  56. libboost_timer-vc142-mt-gd-x64-1_78.lib
  57. libboost_type_erasure-vc142-mt-gd-x64-1_78.lib
  58. libboost_unit_test_framework-vc142-mt-gd-x64-1_78.lib
  59. libboost_wave-vc142-mt-gd-x64-1_78.lib
  60. libboost_wserialization-vc142-mt-gd-x64-1_78.lib
  61. libboost_zlib-vc142-mt-gd-x64-1_78.lib
  62. flann-gd.lib
  63. flann_cpp-gd.lib
  64. flann_cpp_s-gd.lib
  65. flann_s-gd.lib
  66. OpenNI2.lib
  67. qhullcpp_d.lib
  68. qhullstatic_d.lib
  69. qhullstatic_rd.lib
  70. qhull_rd.lib
  71. vtkFiltersSelection-9.1d.lib
  72. vtkFiltersSMP-9.1d.lib
  73. vtkFiltersProgrammable-9.1d.lib
  74. vtkFiltersPoints-9.1d.lib
  75. vtkFiltersParallelImaging-9.1d.lib
  76. vtkFiltersHyperTree-9.1d.lib
  77. vtkFiltersGeneric-9.1d.lib
  78. vtkFiltersFlowPaths-9.1d.lib
  79. vtkDomainsChemistryOpenGL2-9.1d.lib
  80. vtkIONetCDF-9.1d.lib
  81. vtkViewsQt-9.1d.lib
  82. vtkViewsContext2D-9.1d.lib
  83. vtkTestingRendering-9.1d.lib
  84. vtkRenderingVolumeOpenGL2-9.1d.lib
  85. vtkRenderingQt-9.1d.lib
  86. vtkRenderingLOD-9.1d.lib
  87. vtkRenderingImage-9.1d.lib
  88. vtkRenderingContextOpenGL2-9.1d.lib
  89. vtkInteractionImage-9.1d.lib
  90. vtkImagingStencil-9.1d.lib
  91. vtkImagingStatistics-9.1d.lib
  92. vtkImagingMorphological-9.1d.lib
  93. vtkImagingFourier-9.1d.lib
  94. vtkIOVideo-9.1d.lib
  95. vtkIOVeraOut-9.1d.lib
  96. vtkIOTecplotTable-9.1d.lib
  97. vtkIOSegY-9.1d.lib
  98. vtkIOParallelXML-9.1d.lib
  99. vtkIOParallel-9.1d.lib
  100. vtkIOPLY-9.1d.lib
  101. vtkIOOggTheora-9.1d.lib
  102. vtkIOMotionFX-9.1d.lib
  103. vtkIOMINC-9.1d.lib
  104. vtkIOLSDyna-9.1d.lib
  105. vtkIOInfovis-9.1d.lib
  106. vtkIOImport-9.1d.lib
  107. vtkIOIOSS-9.1d.lib
  108. vtkIOHDF-9.1d.lib
  109. vtkIOExportPDF-9.1d.lib
  110. vtkIOExportGL2PS-9.1d.lib
  111. vtkIOExodus-9.1d.lib
  112. vtkIOEnSight-9.1d.lib
  113. vtkIOCityGML-9.1d.lib
  114. vtkIOChemistry-9.1d.lib
  115. vtkIOCONVERGECFD-9.1d.lib
  116. vtkIOCGNSReader-9.1d.lib
  117. vtkIOAsynchronous-9.1d.lib
  118. vtkIOAMR-9.1d.lib
  119. vtkGeovisCore-9.1d.lib
  120. vtkGUISupportQtSQL-9.1d.lib
  121. vtkFiltersVerdict-9.1d.lib
  122. vtkFiltersTopology-9.1d.lib
  123. vtkRenderingGL2PSOpenGL2-9.1d.lib
  124. vtkverdict-9.1d.lib
  125. vtkIOExport-9.1d.lib
  126. vtktheora-9.1d.lib
  127. vtkIOSQL-9.1d.lib
  128. vtkDomainsChemistry-9.1d.lib
  129. vtkFiltersAMR-9.1d.lib
  130. vtkIOMovie-9.1d.lib
  131. vtkViewsInfovis-9.1d.lib
  132. vtkFiltersParallel-9.1d.lib
  133. vtkImagingMath-9.1d.lib
  134. vtkioss-9.1d.lib
  135. vtkGUISupportQtQuick-9.1d.lib
  136. vtklibxml2-9.1d.lib
  137. vtklibproj-9.1d.lib
  138. vtkcgns-9.1d.lib
  139. vtkIOGeometry-9.1d.lib
  140. vtkgl2ps-9.1d.lib
  141. vtkInfovisLayout-9.1d.lib
  142. vtkGUISupportQt-9.1d.lib
  143. vtkFiltersImaging-9.1d.lib
  144. vtkChartsCore-9.1d.lib
  145. vtkogg-9.1d.lib
  146. vtklibharu-9.1d.lib
  147. vtkViewsCore-9.1d.lib
  148. vtkRenderingVtkJS-9.1d.lib
  149. vtksqlite-9.1d.lib
  150. vtkexodusII-9.1d.lib
  151. vtkRenderingLabel-9.1d.lib
  152. vtkRenderingOpenGL2-9.1d.lib
  153. vtkjsoncpp-9.1d.lib
  154. vtkInfovisCore-9.1d.lib
  155. vtknetcdf-9.1d.lib
  156. vtkInteractionWidgets-9.1d.lib
  157. vtkRenderingSceneGraph-9.1d.lib
  158. vtkhdf5_hl-9.1d.lib
  159. vtkImagingGeneral-9.1d.lib
  160. vtkFiltersModeling-9.1d.lib
  161. vtkImagingHybrid-9.1d.lib
  162. vtkFiltersHybrid-9.1d.lib
  163. vtkRenderingUI-9.1d.lib
  164. vtkRenderingVolume-9.1d.lib
  165. vtkglew-9.1d.lib
  166. vtkFiltersTexture-9.1d.lib
  167. vtkInteractionStyle-9.1d.lib
  168. vtkRenderingContext2D-9.1d.lib
  169. vtkRenderingAnnotation-9.1d.lib
  170. vtkhdf5-9.1d.lib
  171. vtkIOImage-9.1d.lib
  172. vtkRenderingFreeType-9.1d.lib
  173. vtkImagingSources-9.1d.lib
  174. vtkImagingColor-9.1d.lib
  175. vtkFiltersExtraction-9.1d.lib
  176. vtkFiltersStatistics-9.1d.lib
  177. vtktiff-9.1d.lib
  178. vtkParallelDIY-9.1d.lib
  179. vtkmetaio-9.1d.lib
  180. vtkfreetype-9.1d.lib
  181. vtkRenderingCore-9.1d.lib
  182. vtkImagingCore-9.1d.lib
  183. vtkpng-9.1d.lib
  184. vtkDICOMParser-9.1d.lib
  185. vtkFiltersGeometry-9.1d.lib
  186. vtkjpeg-9.1d.lib
  187. vtkParallelCore-9.1d.lib
  188. vtkIOXML-9.1d.lib
  189. vtkFiltersSources-9.1d.lib
  190. vtkCommonColor-9.1d.lib
  191. vtkFiltersGeneral-9.1d.lib
  192. vtkIOXMLParser-9.1d.lib
  193. vtkIOLegacy-9.1d.lib
  194. vtkexpat-9.1d.lib
  195. vtkfmt-9.1d.lib
  196. vtkFiltersCore-9.1d.lib
  197. vtkIOCore-9.1d.lib
  198. vtkCommonComputationalGeometry-9.1d.lib
  199. vtklzma-9.1d.lib
  200. vtkzlib-9.1d.lib
  201. vtkdoubleconversion-9.1d.lib
  202. vtklz4-9.1d.lib
  203. vtkCommonExecutionModel-9.1d.lib
  204. vtkCommonDataModel-9.1d.lib
  205. vtkWrappingTools-9.1d.lib
  206. vtkpugixml-9.1d.lib
  207. vtkCommonSystem-9.1d.lib
  208. vtkCommonMisc-9.1d.lib
  209. vtkCommonTransforms-9.1d.lib
  210. vtkCommonMath-9.1d.lib
  211. vtkkissfft-9.1d.lib
  212. vtkCommonCore-9.1d.lib
  213. vtksys-9.1d.lib
  214. vtkloguru-9.1d.lib
  215. Qt6OpenGLWidgetsd.lib
6) 使用QVTKOpenGLNativeWidget显示pclvisualizer中的点云
  1.     vtkSmartPointer<vtkRenderer> ren;
  2. vtkSmartPointer< vtkGenericOpenGLRenderWindow> renWin;
  3. qvtkWidget = new QVTKOpenGLNativeWidget;
  4. ren = vtkSmartPointer<vtkRenderer>::New();
  5. renWin = vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();
  6. ren->SetBackground(0.3, 0.3, 0.3);
  7. renWin->AddRenderer(ren);
  8. qvtkWidget->setRenderWindow(renWin);
  9. ui.verticalLayout->addWidget(qvtkWidget);
  10. cloud.reset(new pcl::PointCloud<pcl::PointXYZ>);
  11. viewer.reset(new pcl::visualization::PCLVisualizer(ren, renWin, "viewer", false));
  12.     viewer->setupInteractor(qvtkWidget->interactor(), qvtkWidget->renderWindow());
  13.     if (pcl::io::loadPCDFile(fileName.toStdString(), *cloud) == -1)
  14. {
  15. cout << "load pcd failed" << endl;
  16. }
  17.     else
  18.     {
  19.         viewer->addPointCloud<pcl::PointXYZRGB>(cloud, "cloud");
  20.     viewer->updatePointCloud(cloud, "cloud");
  21.     }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/118596
推荐阅读
相关标签
  

闽ICP备14008679号