- 新建一个qmainwindow工程
- 准备好opencv的库,放在工程目录下
- .pro文件增加:
CONFIG(debug, debug|release) { LIBS += KaTeX parse error: Expected 'EOF', got '}' at position 41: …/libopencv_*.a }? else { LIBS +=…PWD/opencv4/x86/mingw/lib/libopencv_*.a }
INCLUDEPATH += ./opencv4/include/opencv2 INCLUDEPATH += ./opencv4/include 4. 工程中增加代码: #include “mainwindow.h” #include “ui_mainwindow.h”
#include"core.hpp" #include <highgui.hpp> #include <imgproc.hpp> using namespace cv;
MainWindow::MainWindow(QWidget *parent)
-
QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this);
cv::Mat image = imread(“F:\00QTwork\026_algrith\04_libs\opencv_testAPP\testJpg\testCV.jpg”,1); namedWindow(“disp win”, WINDOW_AUTOSIZE ); if(!image.empty()) { imshow( “disp win”,image); }
}
MainWindow::~MainWindow() { delete ui; }
- 增加一个测试图片
- 大功告成:
|