首页 > 其他分享 >QT+opencv显示图片

QT+opencv显示图片

时间:2023-02-14 20:58:14浏览次数:49  
标签:QT OpenCV opencv 3.4 MinGW Build include 图片

借鉴该文章 https://blog.csdn.net/m0_60259116/article/details/128104565

 

opencv的Mingw版本放在E盘

所以在工程文件中添加如下地址:

INCLUDEPATH +=E:\opencv3.4.0\OpenCV-MinGW-Build-OpenCV-3.4.5\include\
              E:\opencv3.4.0\OpenCV-MinGW-Build-OpenCV-3.4.5\include\
              E:\opencv3.4.0\OpenCV-MinGW-Build-OpenCV-3.4.5\include\opencv2

LIBS +=E:\opencv3.4.0\OpenCV-MinGW-Build-OpenCV-3.4.5\x86\mingw\bin\libopencv_*.dll

在main.cpp中写如下程序:
#include "mainwindow.h"
#include <QApplication>
#include "opencv2/opencv.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    string image="E:/3.jpg";

    Mat colorr;
    colorr=imread(image);
    imshow("color",colorr);
    //MainWindow w;
    //w.show();

    return a.exec();
}

完成

标签:QT,OpenCV,opencv,3.4,MinGW,Build,include,图片
From: https://www.cnblogs.com/dq0618/p/17120837.html

相关文章