一、参考链接:
1、VS2019+QT5.12.10+PCL1.11.1+VTK8.2.0(cmake3.20.4)环境搭配_寒木休思的博客-CSDN博客
2、VS2019+PCL1.11.1+VTK8.2.0+Qt5.14.2配置_点云侠的博客-CSDN博客_qt vtk
3、PCL1.11.0+VTK8.2.0+QT5.14.2+VS2019在Win10环境下的配置(小白必看!)QVTKOpenGLNativeWidget_v寰宇的博客-CSDN博客eez
资源文件:(个别软件外网下载较慢,自己根据情况点击链接下载)
cmake-3.18.0-rc2-win64-x64-其它文档类资源-CSDN下载
PCL-1.11.0-AllInOne-msvc2019-win64-其它文档类资源-CSDN下载
pcl-1.11.0-pdb-msvc2019-win64(1)-C++文档类资源-CSDN下载
qt-opensource-windows-x86-5.14.2-C++文档类资源-CSDN下载
VTK-8.2.0(1)-C++文档类资源-CSDN下载
VisualStudio2019(64bit)(1)-C++文档类资源-CSDN下载
二、安装过程中的注意事项
1、要将pcl、vtk、opencv的包含目录、库目录、链接器-输入-附加依赖项都添加
OpencvRelease属性表我之前已经配过,直接加载进来的
PCL1.11.0_VTK8.20-Release的包含目录:
PCL1.11.0_VTK8.20-Release的库目录:
PCL1.11.0_VTK8.20-Release的链接器-输入-附加依赖项:
libboost_atomic-vc142-mt-x64-1_73.lib
libboost_bzip2-vc142-mt-x64-1_73.lib
libboost_chrono-vc142-mt-x64-1_73.lib
libboost_container-vc142-mt-x64-1_73.lib
libboost_context-vc142-mt-x64-1_73.lib
libboost_contract-vc142-mt-x64-1_73.lib
libboost_coroutine-vc142-mt-x64-1_73.lib
libboost_date_time-vc142-mt-x64-1_73.lib
libboost_exception-vc142-mt-x64-1_73.lib
libboost_fiber-vc142-mt-x64-1_73.lib
libboost_filesystem-vc142-mt-x64-1_73.lib
libboost_graph-vc142-mt-x64-1_73.lib
libboost_graph_parallel-vc142-mt-x64-1_73.lib
libboost_iostreams-vc142-mt-x64-1_73.lib
libboost_locale-vc142-mt-x64-1_73.lib
libboost_log-vc142-mt-x64-1_73.lib
libboost_log_setup-vc142-mt-x64-1_73.lib
libboost_math_c99-vc142-mt-x64-1_73.lib
libboost_math_c99f-vc142-mt-x64-1_73.lib
libboost_math_c99l-vc142-mt-x64-1_73.lib
libboost_math_tr1-vc142-mt-x64-1_73.lib
libboost_math_tr1f-vc142-mt-x64-1_73.lib
libboost_math_tr1l-vc142-mt-x64-1_73.lib
libboost_mpi-vc142-mt-x64-1_73.lib
libboost_nowide-vc142-mt-x64-1_73.lib
libboost_numpy38-vc142-mt-x64-1_73.lib
libboost_prg_exec_monitor-vc142-mt-x64-1_73.lib
libboost_program_options-vc142-mt-x64-1_73.lib
libboost_python38-vc142-mt-x64-1_73.lib
libboost_random-vc142-mt-x64-1_73.lib
libboost_regex-vc142-mt-x64-1_73.lib
libboost_serialization-vc142-mt-x64-1_73.lib
libboost_stacktrace_noop-vc142-mt-x64-1_73.lib
libboost_stacktrace_windbg-vc142-mt-x64-1_73.lib
libboost_stacktrace_windbg_cached-vc142-mt-x64-1_73.lib
libboost_system-vc142-mt-x64-1_73.lib
libboost_test_exec_monitor-vc142-mt-x64-1_73.lib
libboost_thread-vc142-mt-x64-1_73.lib
libboost_timer-vc142-mt-x64-1_73.lib
libboost_type_erasure-vc142-mt-x64-1_73.lib
libboost_unit_test_framework-vc142-mt-x64-1_73.lib
libboost_wave-vc142-mt-x64-1_73.lib
libboost_wserialization-vc142-mt-x64-1_73.lib
libboost_zlib-vc142-mt-x64-1_73.lib
flann.lib
flann_cpp.lib
flann_cpp_s.lib
flann_s.lib
qhull.lib
qhullcpp.lib
qhullstatic.lib
qhullstatic_r.lib
qhull_p.lib
qhull_r.lib
vtkChartsCore-8.2.lib
vtkCommonColor-8.2.lib
vtkCommonComputationalGeometry-8.2.lib
vtkCommonCore-8.2.lib
vtkCommonDataModel-8.2.lib
vtkCommonExecutionModel-8.2.lib
vtkCommonMath-8.2.lib
vtkCommonMisc-8.2.lib
vtkCommonSystem-8.2.lib
vtkCommonTransforms-8.2.lib
vtkDICOMParser-8.2.lib
vtkDomainsChemistry-8.2.lib
vtkDomainsChemistryOpenGL2-8.2.lib
vtkdoubleconversion-8.2.lib
vtkexodusII-8.2.lib
vtkexpat-8.2.lib
vtkFiltersAMR-8.2.lib
vtkFiltersCore-8.2.lib
vtkFiltersExtraction-8.2.lib
vtkFiltersFlowPaths-8.2.lib
vtkFiltersGeneral-8.2.lib
vtkFiltersGeneric-8.2.lib
vtkFiltersGeometry-8.2.lib
vtkFiltersHybrid-8.2.lib
vtkFiltersHyperTree-8.2.lib
vtkFiltersImaging-8.2.lib
vtkFiltersModeling-8.2.lib
vtkFiltersParallel-8.2.lib
vtkFiltersParallelImaging-8.2.lib
vtkFiltersPoints-8.2.lib
vtkFiltersProgrammable-8.2.lib
vtkFiltersSelection-8.2.lib
vtkFiltersSMP-8.2.lib
vtkFiltersSources-8.2.lib
vtkFiltersStatistics-8.2.lib
vtkFiltersTexture-8.2.lib
vtkFiltersTopology-8.2.lib
vtkFiltersVerdict-8.2.lib
vtkfreetype-8.2.lib
vtkGeovisCore-8.2.lib
vtkgl2ps-8.2.lib
vtkglew-8.2.lib
vtkGUISupportMFC-8.2.lib
vtkhdf5-8.2.lib
vtkhdf5_hl-8.2.lib
vtkImagingColor-8.2.lib
vtkImagingCore-8.2.lib
vtkImagingFourier-8.2.lib
vtkImagingGeneral-8.2.lib
vtkImagingHybrid-8.2.lib
vtkImagingMath-8.2.lib
vtkImagingMorphological-8.2.lib
vtkImagingSources-8.2.lib
vtkImagingStatistics-8.2.lib
vtkImagingStencil-8.2.lib
vtkInfovisCore-8.2.lib
vtkInfovisLayout-8.2.lib
vtkInteractionImage-8.2.lib
vtkInteractionStyle-8.2.lib
vtkInteractionWidgets-8.2.lib
vtkIOAMR-8.2.lib
vtkIOAsynchronous-8.2.lib
vtkIOCityGML-8.2.lib
vtkIOCore-8.2.lib
vtkIOEnSight-8.2.lib
vtkIOExodus-8.2.lib
vtkIOExport-8.2.lib
vtkIOExportOpenGL2-8.2.lib
vtkIOExportPDF-8.2.lib
vtkIOGeometry-8.2.lib
vtkIOImage-8.2.lib
vtkIOImport-8.2.lib
vtkIOInfovis-8.2.lib
vtkIOLegacy-8.2.lib
vtkIOLSDyna-8.2.lib
vtkIOMINC-8.2.lib
vtkIOMovie-8.2.lib
vtkIONetCDF-8.2.lib
vtkIOParallel-8.2.lib
vtkIOParallelXML-8.2.lib
vtkIOPLY-8.2.lib
vtkIOSegY-8.2.lib
vtkIOSQL-8.2.lib
vtkIOTecplotTable-8.2.lib
vtkIOVeraOut-8.2.lib
vtkIOVideo-8.2.lib
vtkIOXML-8.2.lib
vtkIOXMLParser-8.2.lib
vtkjpeg-8.2.lib
vtkjsoncpp-8.2.lib
vtklibharu-8.2.lib
vtklibxml2-8.2.lib
vtklz4-8.2.lib
vtklzma-8.2.lib
vtkmetaio-8.2.lib
vtkNetCDF-8.2.lib
vtkogg-8.2.lib
vtkParallelCore-8.2.lib
vtkpng-8.2.lib
vtkproj-8.2.lib
vtkpugixml-8.2.lib
vtkRenderingAnnotation-8.2.lib
vtkRenderingContext2D-8.2.lib
vtkRenderingContextOpenGL2-8.2.lib
vtkRenderingCore-8.2.lib
vtkRenderingExternal-8.2.lib
vtkRenderingFreeType-8.2.lib
vtkRenderingGL2PSOpenGL2-8.2.lib
vtkRenderingImage-8.2.lib
vtkRenderingLabel-8.2.lib
vtkRenderingLOD-8.2.lib
vtkRenderingOpenGL2-8.2.lib
vtkRenderingVolume-8.2.lib
vtkRenderingVolumeOpenGL2-8.2.lib
vtksqlite-8.2.lib
vtksys-8.2.lib
vtktheora-8.2.lib
vtktiff-8.2.lib
vtkverdict-8.2.lib
vtkViewsContext2D-8.2.lib
vtkViewsCore-8.2.lib
vtkViewsInfovis-8.2.lib
vtkzlib-8.2.lib
pcl_common.lib
pcl_features.lib
pcl_filters.lib
pcl_io.lib
pcl_io_ply.lib
pcl_kdtree.lib
pcl_keypoints.lib
pcl_ml.lib
pcl_octree.lib
pcl_outofcore.lib
pcl_people.lib
pcl_recognition.lib
pcl_registration.lib
pcl_sample_consensus.lib
pcl_search.lib
pcl_segmentation.lib
pcl_stereo.lib
pcl_surface.lib
pcl_tracking.lib
pcl_visualization.lib
vtkGUISupportQt-8.2.lib
vtkGUISupportQtOpenGL-8.2.lib
vtkGUISupportQtSQL-8.2.lib
vtkRenderingQt-8.2.lib
vtkViewsQt-8.2.lib
OpencvRelease的包含目录:
OpencvRelease的库目录:
OpencvRelease的链接器-输入-附加依赖项:
2、这里只配置成功了release模式下,因为在在debug模式下,QT中没有出现QVTKWidght,原因不详
3、如果出现了.dll错误,要注意看环境变量是否添加
4、出现错误:“没有为 vtkGUISupportQt-8.2.dll 加载的符号文件”
添加以下三行代码:
#include
VTK_MODULE_INIT(vtkRenderingOpenGL2)
VTK_MODULE_INIT(vtkInteractionStyle)
5、出现了警告窗口,还不知道怎么消除,但不影响使用
6、配了很久,过程并不顺利,有些问题不太记得了。
实例:在QT窗口界面加载显示点云和图片
头文件QVTK.h
#pragma once
#include
#include "ui_QVTK.h"
#include
#include
#include
#include
#include
#include
using namespace cv;
class QVTK : public QWidget
{
Q_OBJECT
public:
QVTK(QWidget *parent = Q_NULLPTR);
~QVTK();
Mat src;
private:
Ui::QVTK ui;
pcl::PointCloud::Ptr cloud;
boost::shared_ptr viewer;
void initialVtkWidget();
void ShowPicture_label(Mat image);//显示图片到label
private slots:
void onOpen();//加载显示点云
void openImage();//加载图片
};
源文件 QVTK.cpp
#include "QVTK.h"
#include
using namespace std;
QVTK::QVTK(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
initialVtkWidget();
}
QVTK::~QVTK()
{
}
void QVTK::initialVtkWidget()
{
cloud.reset(new pcl::PointCloud);
viewer.reset(new pcl::visualization::PCLVisualizer("viewer", false));
viewer->addPointCloud(cloud, "cloud");
ui.qvtkWidget->SetRenderWindow(viewer->getRenderWindow());
viewer->setupInteractor(ui.qvtkWidget->GetInteractor(), ui.qvtkWidget->GetRenderWindow());
ui.qvtkWidget->update();
}
void QVTK::onOpen()//加载显示点云
{
QString fileName = QFileDialog::getOpenFileName(this, "Open PointCloud", ".", "Open PCD files(*.pcd)");
pcl::io::loadPCDFile(fileName.toStdString(), *cloud);
viewer->updatePointCloud(cloud, "cloud");
viewer->resetCamera();
ui.qvtkWidget->update();
}
void QVTK::openImage()//加载图片
{
QString filename = QFileDialog::getOpenFileName();
string s1 = string(filename.toLocal8Bit());
std::cout << s1 << std::endl;
const char* str = s1.c_str();
Mat src = imread(str);
QVTK::ShowPicture_label(src);
QVTK::src = src;
}
void QVTK::ShowPicture_label(Mat image)//显示图片
{
QImage img;
Mat src = image;
Mat rgb;
if (src.channels() == 3)
{
cvtColor(src, rgb, CV_BGR2RGB);
img = QImage((const uchar*)(rgb.data),
rgb.cols, rgb.rows,
rgb.cols * rgb.channels(),
QImage::Format_RGB888);
}
else
{
img = QImage((const uchar*)(src.data),
src.cols, src.rows,
src.cols * src.channels(),
QImage::Format_Indexed8);
}
ui.label->setPixmap(QPixmap::fromImage(img));
ui.label->resize(ui.label->pixmap()->size());
ui.label->show();
}
QT中ui界面
点击“加载点云”,选择.pcd点云文件(只试了pcd格式点云,其它格式不清楚),点击加载图片,选择图片文件。
显示结果:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)