为了促进同行业人员(特指 LiDAR 点云处理人员或相近行业)的技术交流,解决平时开发过程中遇到的技术性问题,博主建立一个QQ群,欢迎大家积极加入,共同引领点云行业的快速发展 ~
群名:LiDAR点云部落
群号:190162198
本文综合了许多前辈们的文章,取其精华,去其糟粕,精简为一篇讲解详细、内容全面的博客,供后来人能够少走弯路,更快的实现自己的目标。
电脑配置一览:Win10 / i7 7700 / HyperFury 16G / Gigabyte GTX 1060 6G 等
软件版本一览:VS2013 / PCL1.8.0(MSVC2013) / Qt5.7.0(MSVC2013) / QVTK7.0 / qt-vsaddin2.0 等
懒人福利:以下表格内容是作者运行环境的详细说明,可以直接按照作者的路径进行配置,然后直接拷贝 .props / .pro 文件进行使用。一定要注意安装路径的位置和大小写!!!
软件 | 版本号 | 安装路径(根目录) | 根目录包含以下内容 |
---|---|---|---|
VS | 2013 | D:\VS2013 | Blend、Common7、DIA SDK、FontStyleFromNet、Download、FSharp、ImportProjects、JavaScript、Licenses、names.txt 等 |
vs-addin | qt-vsaddin-msvc2013-2.2.0 | 自动安装到C盘 | 未知 |
Qt | qt-opensource-windows-x86-msvc2013_64-5.7.0 | D:\Qt | 5.7、components.xml、dist、Docs、Examples、Licenses、MaintenanceTool.dat、MaintenanceTool.exe、Mai、ntenanceTool.ini、network.xml、Tools、vcredist |
Debugger | 10.0.17134.12 | D:\DebuggingToolsForWindows | Catalogs、Debuggers、Licenses、names.txt |
OpenCV | 2.4.13 | D:\opencv | build、LICENSE.txt、names.txt、README.md.txt、sources |
PCL | PCL-1.8.0-AllInOne-msvc2013-win64 | D:\PCL1.8_MSVC2013 | 3rdParty、bin cmake、include、lib、Uninstall.exe |
QVTK | 7.0 | D:\Qt\5.7\msvc2013_64\plugins\designer | names.txt、qaxwidget.dll、qquickwidget.dll、QVTKWidgetPlugin.dll、QVTKWidgetPlugin.lib、qwebengineview.dll |
PDB 点云文件 | 未知 | 未知 | 未知 |
这里用到的软件较多,博主已打包至百度云,请前往打包下载。软件内容如下(注:该文章以 MSVC2013 和 x64 为主线,所以涉及到有多版本的软件均已该版本为主,读者如果想用更高级的版本,一定要注意软件版本的一致性,否则会出现未知错误。以下内容重要的部分作者已标红):
注:一定要注意版本的一致性!!!安装需要注意的地方如下:
- Qt 安装默认安装,或者全选勾选框安装
- VS 直接安装即可,务必要安装 C++
- VS 插件 Qt-Addin 安装自动进行
- QVTK 插件下文用到再讲
- Debugger 安装软件用到再讲
- PCL 安装时,软件自动会安装到 …/PCL 1.8.0 位置,我们强制将路径修改为 …/PCL1.8.0 或者其他,核心是要去掉PCL和1.8.0之间空格!!!PCL安装路径不能有空格!!!
目的:在 VS 中显示点云文件 ,这是PCL库最简单的使用方式
方法:请读者参考我的这篇博客,写的很详细
目的: 在 Qt 中编辑并显示点云
方法:
此时会发现调试按钮已处于可用状态
INCLUDEPATH += D:\PCL1.8_MSVC2013\3rdParty\OpenNI2\Include
INCLUDEPATH += D:\PCL1.8_MSVC2013\include\pcl-1.8
INCLUDEPATH += D:\PCL1.8_MSVC2013\include\pcl-1.8\pcl
INCLUDEPATH += D:\PCL1.8_MSVC2013\3rdParty\Boost\include\boost-1_59
INCLUDEPATH += D:\PCL1.8_MSVC2013\3rdParty\Eigen\eigen3
INCLUDEPATH += D:\PCL1.8_MSVC2013\3rdParty\FLANN\include
INCLUDEPATH += D:\PCL1.8_MSVC2013\3rdParty\Qhull\include
INCLUDEPATH += D:\PCL1.8_MSVC2013\3rdParty\VTK\include\vtk-7.0
CONFIG(debug,debug | release ){
LIBS += D:\PCL1.8_MSVC2013\lib\pcl_apps_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_common_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_features_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_filters_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_io_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_io_ply_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_kdtree_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_keypoints_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_ml_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_octree_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_outofcore_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_people_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_recognition_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_registration_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_sample_consensus_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_search_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_segmentation_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_simulation_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_stereo_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_surface_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_tracking_debug.lib\
D:\PCL1.8_MSVC2013\lib\pcl_visualization_debug.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_atomic-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_chrono-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_container-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_context-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_coroutine-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_date_time-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_exception-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_filesystem-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_graph-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_iostreams-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_locale-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_log_setup-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_log-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_math_c99f-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_math_c99l-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_math_c99-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_math_tr1f-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_math_tr1l-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_math_tr1-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_mpi-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_prg_exec_monitor-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_program_options-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_random-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_regex-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_serialization-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_signals-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_system-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_test_exec_monitor-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_thread-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_timer-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_unit_test_framework-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_wave-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\Boost\lib\libboost_wserialization-vc120-mt-gd-1_59.lib\
D:\PCL1.8_MSVC2013\3rdParty\FLANN\lib\flann_cpp_s-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\FLANN\lib\flann_s-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\FLANN\lib\flann-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\OpenNI2\Lib\OpenNI2.lib\
D:\PCL1.8_MSVC2013\3rdParty\Qhull\lib\qhull_p-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\Qhull\lib\qhull_r-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\Qhull\lib\qhullcpp-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\Qhull\lib\qhull-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\Qhull\lib\qhullstatic_r-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\Qhull\lib\qhullstatic-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkalglib-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkChartsCore-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkCommonColor-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkCommonComputationalGeometry-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkCommonCore-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkCommonDataModel-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkCommonExecutionModel-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkCommonMath-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkCommonMisc-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkCommonSystem-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkCommonTransforms-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkDICOMParser-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkDomainsChemistry-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkDomainsChemistryOpenGL2-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkexoIIc-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkexpat-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersAMR-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersCore-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersExtraction-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersFlowPaths-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersGeneral-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersGeneric-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersGeometry-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersHybrid-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersHyperTree-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersImaging-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersModeling-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersParallel-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersParallelImaging-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersProgrammable-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersSelection-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersSMP-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersSources-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersStatistics-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersTexture-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkFiltersVerdict-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkfreetype-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkGeovisCore-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkglew-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkGUISupportQt-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkGUISupportQtSQL-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkhdf5_hl-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkhdf5-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkImagingColor-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkImagingCore-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkImagingFourier-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkImagingGeneral-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkImagingHybrid-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkImagingMath-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkImagingMorphological-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkImagingSources-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkImagingStatistics-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkImagingStencil-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkInfovisCore-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkInfovisLayout-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkInteractionImage-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkInteractionStyle-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkInteractionWidgets-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOAMR-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOCore-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOEnSight-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOExodus-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOExport-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOGeometry-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOImage-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOImport-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOInfovis-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOLegacy-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOLSDyna-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOMINC-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOMovie-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIONetCDF-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOParallel-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOParallelXML-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOPLY-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOSQL-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOVideo-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOXML-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkIOXMLParser-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkjpeg-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkjsoncpp-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtklibxml2-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkmetaio-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkNetCDF_cxx-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkNetCDF-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkoggtheora-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkParallelCore-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkpng-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkproj4-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkRenderingAnnotation-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkRenderingContext2D-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkRenderingContextOpenGL2-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkRenderingCore-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkRenderingFreeType-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkRenderingImage-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkRenderingLabel-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkRenderingLOD-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkRenderingOpenGL2-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkRenderingQt-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkRenderingVolume-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkRenderingVolumeOpenGL2-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtksqlite-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtksys-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtktiff-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkverdict-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkViewsContext2D-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkViewsCore-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkViewsInfovis-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkViewsQt-7.0-gd.lib\
D:\PCL1.8_MSVC2013\3rdParty\VTK\lib\vtkzlib-7.0-gd.lib
}else{
}
注:把上面的 D:\PCL1.8_MSVC2013\ 路径换为自己的安装路径
第六步:右键工程文件,执行 qmake !!!
第七步:测试代码,新建一个纯C++项目(plain C++ Application) ,写如下代码,运行
#include
#include
#include
#include
int user_data;
void viewerOneOff(pcl::visualization::PCLVisualizer& viewer)
{
viewer.setBackgroundColor(1.0, 0.5, 1.0);
pcl::PointXYZ o;
o.x = 1.0;
o.y = 0;
o.z = 0;
viewer.addSphere(o, 0.25, "sphere", 0);
std::cout << "i only run once" << std::endl;
}
void viewerPsycho(pcl::visualization::PCLVisualizer& viewer)
{
static unsigned count = 0;
std::stringstream ss;
ss << "Once per viewer loop: " << count++;
viewer.removeShape("text", 0);
viewer.addText(ss.str(), 200, 300, "text", 0);
//FIXME: possible race condition here:
user_data++;
}
int main()
{
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::io::loadPCDFile("my_point_cloud.pcd", *cloud);
pcl::visualization::CloudViewer viewer("Cloud Viewer");
//blocks until the cloud is actually rendered
viewer.showCloud(cloud);
//use the following functions to get access to the underlying more advanced/powerful
//PCLVisualizer
//This will only get called once
viewer.runOnVisualizationThreadOnce(viewerOneOff);
//This will get called once per visualization iteration
viewer.runOnVisualizationThread(viewerPsycho);
while (!viewer.wasStopped())
{
//you can also do cool processing here
//FIXME: Note that this is running in a separate thread from viewerPsycho
//and you should guard against race conditions yourself...
user_data++;
}
return 0;
}
若配置成功,显示如下图:
经测试,先安装 vs-addin ,后安装 Qt ,会报错!!!
所以先安装 Qt、VS,再安装 vs-addin!!!
目的:使用 VS 的编辑器写代码,使用 Qt 的界面显示点云
方法:
注意这里一定要写 Qt5.7.0,否则会提示找不到怕匹配的Qt!!!
将 QVTKWidgetPlugin.dll 和 QVTKWidgetPlugin.lib 复制到 D:\Qt\5.7\msvc2013_64\plugins\designer 下
注:QVTKWidgetPlugin 作用是充当显示点云的控件,QtCreator 本身没有显示点云的控件
注1:如果没有出现,则做以下修改:找到 D:\Qt.7\msvc2013_64in\Qt5WebEngineWidgets.dll ,修改成 Qt5WebEngineWidgets666.dll ,不知道这是一个什么神奇的bug
注2:如果还没有出现,右键 .ui 文件,选择打开方式,先移除 QtDesigner ,后重新添加 QtDesigner
一共涉及到4个文件,分别是
源代码的 Github 项目网址
PCLViewer.h
#ifndef PCLVIEWER_H
#define PCLVIEWER_H
#include
// Qt
#include
// Point Cloud Library
#include
#include
#include
// Visualization Toolkit (VTK)
#include
typedef pcl::PointXYZRGBA PointT;
typedef pcl::PointCloud<PointT> PointCloudT;
namespace Ui
{
class PCLViewer;
}
class PCLViewer : public QMainWindow
{
Q_OBJECT
public:
explicit PCLViewer(QWidget *parent = 0);
~PCLViewer();
public Q_SLOTS:
void randomButtonPressed();
void RGBsliderReleased();
void pSliderValueChanged(int value);
void redSliderValueChanged(int value);
void greenSliderValueChanged(int value);
void blueSliderValueChanged(int value);
protected:
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer;
PointCloudT::Ptr cloud;
unsigned int red;
unsigned int green;
unsigned int blue;
private:
Ui::PCLViewer *ui;
};
#endif // PCLVIEWER_H
PCLViewer.cpp
#include "pclviewer.h"
#include "ui_pclviewer.h"
PCLViewer::PCLViewer(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::PCLViewer)
{
ui->setupUi(this);
this->setWindowTitle("PCL viewer");
// Setup the cloud pointer
cloud.reset(new PointCloudT);
// The number of points in the cloud
cloud->points.resize(200);
// The default color
red = 128;
green = 128;
blue = 128;
// Fill the cloud with some points
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);
cloud->points[i].r = red;
cloud->points[i].g = green;
cloud->points[i].b = blue;
}
// Set up the QVTK window
viewer.reset(new pcl::visualization::PCLVisualizer("viewer", false));
ui->qvtkWidget->SetRenderWindow(viewer->getRenderWindow());
viewer->setupInteractor(ui->qvtkWidget->GetInteractor(), ui->qvtkWidget->GetRenderWindow());
ui->qvtkWidget->update();
// Connect "random" button and the function
connect(ui->pushButton_random, SIGNAL(clicked()), this, SLOT(randomButtonPressed()));
// Connect R,G,B sliders and their functions
connect(ui->horizontalSlider_R, SIGNAL(valueChanged(int)), this, SLOT(redSliderValueChanged(int)));
connect(ui->horizontalSlider_G, SIGNAL(valueChanged(int)), this, SLOT(greenSliderValueChanged(int)));
connect(ui->horizontalSlider_B, SIGNAL(valueChanged(int)), this, SLOT(blueSliderValueChanged(int)));
connect(ui->horizontalSlider_R, SIGNAL(sliderReleased()), this, SLOT(RGBsliderReleased()));
connect(ui->horizontalSlider_G, SIGNAL(sliderReleased()), this, SLOT(RGBsliderReleased()));
connect(ui->horizontalSlider_B, SIGNAL(sliderReleased()), this, SLOT(RGBsliderReleased()));
// Connect point size slider
connect(ui->horizontalSlider_p, SIGNAL(valueChanged(int)), this, SLOT(pSliderValueChanged(int)));
viewer->addPointCloud(cloud, "cloud");
pSliderValueChanged(2);
viewer->resetCamera();
ui->qvtkWidget->update();
}
void PCLViewer::randomButtonPressed()
{
printf("Random button was pressed\n");
// Set the new color
for (size_t i = 0; i < cloud->size(); i++)
{
cloud->points[i].r = 255 * (1024 * rand() / (RAND_MAX + 1.0f));
cloud->points[i].g = 255 * (1024 * rand() / (RAND_MAX + 1.0f));
cloud->points[i].b = 255 * (1024 * rand() / (RAND_MAX + 1.0f));
}
viewer->updatePointCloud(cloud, "cloud");
ui->qvtkWidget->update();
}
void PCLViewer::RGBsliderReleased()
{
// Set the new color
for (size_t i = 0; i < cloud->size(); i++)
{
cloud->points[i].r = red;
cloud->points[i].g = green;
cloud->points[i].b = blue;
}
viewer->updatePointCloud(cloud, "cloud");
ui->qvtkWidget->update();
}
void PCLViewer::pSliderValueChanged(int value)
{
viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, value, "cloud");
ui->qvtkWidget->update();
}
void PCLViewer::redSliderValueChanged(int value)
{
red = value;
printf("redSliderValueChanged: [%d|%d|%d]\n", red, green, blue);
}
void PCLViewer::greenSliderValueChanged(int value)
{
green = value;
printf("greenSliderValueChanged: [%d|%d|%d]\n", red, green, blue);
}
void PCLViewer::blueSliderValueChanged(int value)
{
blue = value;
printf("blueSliderValueChanged: [%d|%d|%d]\n", red, green, blue);
}
PCLViewer::~PCLViewer()
{
delete ui;
}
main.cpp
#include "pclviewer.h"
#include
#include
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
PCLViewer w;
w.show();
return a.exec();
}
PCLViewer.ui
<ui version="4.0">
<class>PCLViewerclass>
<widget class="QMainWindow" name="PCLViewer">
<property name="geometry">
<rect>
<x>0x>
<y>0y>
<width>966width>
<height>499height>
rect>
property>
<property name="minimumSize">
<size>
<width>0width>
<height>0height>
size>
property>
<property name="maximumSize">
<size>
<width>5000width>
<height>5000height>
size>
property>
<property name="windowTitle">
<string>PCLViewerstring>
property>
<widget class="QWidget" name="centralwidget">
<widget class="QVTKWidget" name="qvtkWidget" native="true">
<property name="geometry">
<rect>
<x>300x>
<y>10y>
<width>640width>
<height>480height>
rect>
property>
widget>
<widget class="QSlider" name="horizontalSlider_R">
<property name="geometry">
<rect>
<x>30x>
<y>60y>
<width>160width>
<height>29height>
rect>
property>
<property name="maximum">
<number>255number>
property>
<property name="value">
<number>128number>
property>
<property name="orientation">
<enum>Qt::Horizontalenum>
property>
widget>
<widget class="QSlider" name="horizontalSlider_G">
<property name="geometry">
<rect>
<x>30x>
<y>140y>
<width>160width>
<height>29height>
rect>
property>
<property name="maximum">
<number>255number>
property>
<property name="value">
<number>128number>
property>
<property name="orientation">
<enum>Qt::Horizontalenum>
property>
widget>
<widget class="QSlider" name="horizontalSlider_B">
<property name="geometry">
<rect>
<x>30x>
<y>220y>
<width>160width>
<height>29height>
rect>
property>
<property name="maximum">
<number>255number>
property>
<property name="value">
<number>128number>
property>
<property name="orientation">
<enum>Qt::Horizontalenum>
property>
widget>
<widget class="QLCDNumber" name="lcdNumber_R">
<property name="geometry">
<rect>
<x>200x>
<y>50y>
<width>81width>
<height>41height>
rect>
property>
<property name="digitCount">
<number>3number>
property>
<property name="segmentStyle">
<enum>QLCDNumber::Flatenum>
property>
<property name="intValue" stdset="0">
<number>128number>
property>
widget>
<widget class="QLCDNumber" name="lcdNumber_G">
<property name="geometry">
<rect>
<x>200x>
<y>130y>
<width>81width>
<height>41height>
rect>
property>
<property name="digitCount">
<number>3number>
property>
<property name="segmentStyle">
<enum>QLCDNumber::Flatenum>
property>
<property name="intValue" stdset="0">
<number>128number>
property>
widget>
<widget class="QLCDNumber" name="lcdNumber_B">
<property name="geometry">
<rect>
<x>200x>
<y>210y>
<width>81width>
<height>41height>
rect>
property>
<property name="digitCount">
<number>3number>
property>
<property name="segmentStyle">
<enum>QLCDNumber::Flatenum>
property>
<property name="intValue" stdset="0">
<number>128number>
property>
widget>
<widget class="QSlider" name="horizontalSlider_p">
<property name="geometry">
<rect>
<x>30x>
<y>320y>
<width>160width>
<height>29height>
rect>
property>
<property name="minimum">
<number>1number>
property>
<property name="maximum">
<number>6number>
property>
<property name="value">
<number>2number>
property>
<property name="orientation">
<enum>Qt::Horizontalenum>
property>
widget>
<widget class="QLCDNumber" name="lcdNumber_p">
<property name="geometry">
<rect>
<x>200x>
<y>310y>
<width>81width>
<height>41height>
rect>
property>
<property name="digitCount">
<number>1number>
property>
<property name="segmentStyle">
<enum>QLCDNumber::Flatenum>
property>
<property name="intValue" stdset="0">
<number>2number>
property>
widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>30x>
<y>20y>
<width>191width>
<height>31height>
rect>
property>
<property name="font">
<font>
<pointsize>16pointsize>
<weight>50weight>
<italic>falseitalic>
<bold>falsebold>
font>
property>
<property name="text">
<string>Red componentstring>
property>
widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>30x>
<y>100y>
<width>191width>
<height>31height>
rect>
property>
<property name="font">
<font>
<pointsize>16pointsize>
<weight>50weight>
<italic>falseitalic>
<bold>falsebold>
font>
property>
<property name="text">
<string>Green componentstring>
property>
widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>30x>
<y>190y>
<width>191width>
<height>31height>
rect>
property>
<property name="font">
<font>
<pointsize>16pointsize>
<weight>50weight>
<italic>falseitalic>
<bold>falsebold>
font>
property>
<property name="text">
<string>Blue componentstring>
property>
widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>30x>
<y>280y>
<width>141width>
<height>31height>
rect>
property>
<property name="font">
<font>
<pointsize>16pointsize>
<weight>50weight>
<italic>falseitalic>
<bold>falsebold>
font>
property>
<property name="text">
<string>Point sizestring>
property>
widget>
<widget class="QPushButton" name="pushButton_random">
<property name="geometry">
<rect>
<x>40x>
<y>370y>
<width>201width>
<height>81height>
rect>
property>
<property name="text">
<string>Random colorsstring>
property>
widget>
widget>
widget>
<customwidgets>
<customwidget>
<class>QVTKWidgetclass>
<extends>QWidgetextends>
<header>QVTKWidget.hheader>
customwidget>
customwidgets>
<resources/>
<connections>
<connection>
<sender>horizontalSlider_Rsender>
<signal>sliderMoved(int)signal>
<receiver>lcdNumber_Rreceiver>
<slot>display(int)slot>
<hints>
<hint type="sourcelabel">
<x>136x>
<y>111y>
hint>
<hint type="destinationlabel">
<x>222x>
<y>115y>
hint>
hints>
connection>
<connection>
<sender>horizontalSlider_Gsender>
<signal>sliderMoved(int)signal>
<receiver>lcdNumber_Greceiver>
<slot>display(int)slot>
<hints>
<hint type="sourcelabel">
<x>166x>
<y>193y>
hint>
<hint type="destinationlabel">
<x>235x>
<y>195y>
hint>
hints>
connection>
<connection>
<sender>horizontalSlider_Bsender>
<signal>sliderMoved(int)signal>
<receiver>lcdNumber_Breceiver>
<slot>display(int)slot>
<hints>
<hint type="sourcelabel">
<x>185x>
<y>273y>
hint>
<hint type="destinationlabel">
<x>224x>
<y>275y>
hint>
hints>
connection>
<connection>
<sender>horizontalSlider_psender>
<signal>sliderMoved(int)signal>
<receiver>lcdNumber_preceiver>
<slot>display(int)slot>
<hints>
<hint type="sourcelabel">
<x>136x>
<y>352y>
hint>
<hint type="destinationlabel">
<x>253x>
<y>342y>
hint>
hints>
connection>
connections>
ui>
源代码的 Github 项目网址
PCLViewer.ui 的打开方式选择见下图
尽管最终的代码编辑区可能还会报错,但是不影响程序的运行!!!这可能是兼容性不好遗留的问题!!!
以下是基于我的安装环境配置好的一些文件详解,如果不同,请勿使用,否则后果自负!!`!
Github下载链接 — SomePropsConfig
该链接包含如下内容:
详情请参考我的另一篇博客 — PCL / OpenCV 在 VS / Qt 下的一些配置文件
在这里我仅仅展示我遇到的、我想到的一些可能的出错点,供大家参考,具体请发送问题到我邮箱 [email protected]
暂且就想到这么多,失败是成功之母,失败后请大家耐心配置
VS 宇宙最强IDE,不多说 ↩︎
安装该插件后,能在 VS 中调用 QtDesigner ↩︎
Qt ,轻量级带有界面的 IDE ↩︎
Qt 不自带调试器,安装 Debugger 后可以在 Qt 内调试代码 ↩︎
QVTK 插件,用于显示点云的控件 ↩︎
PCL,开源的点云库 ↩︎
.props PCL配置文件 ↩︎
PDB 点云文件 ↩︎