当前位置: 代码迷 >> 综合 >> OpenCV2.4.13+Qt5.6.2配置方法
  详细解决方案

OpenCV2.4.13+Qt5.6.2配置方法

热度:16   发布时间:2024-01-12 19:06:02.0

【1、环境变量】

D:\Soft\OpenCV2\MinGW_build\bin;
C:\Qt\Qt5.6.2\Tools\mingw492_32\bin;
D:\Soft\Programming\CMake3.7.0\bin;

【2、OpenCV2.4.13的MinGW_build版本位置】

D:\Soft\OpenCV2\MinGW_build\

【3、Qt5.6.2位置】

C:\Qt\Qt5.6.2\


【4、Qt的pro文件写法】

QT += core
QT -= guiINCLUDEPATH+= D:/Soft/OpenCV2/build/include\D:/Soft/OpenCV2/build/include/opencv\D:/Soft/OpenCV2/build/include/opencv2LIBS += D:\Soft\OpenCV2\MinGW_build\lib\libopencv_core2413.dll.a\D:\Soft\OpenCV2\MinGW_build\lib\libopencv_highgui2413.dll.a\D:\Soft\OpenCV2\MinGW_build\lib\libopencv_imgproc2413.dll.aTARGET = JfzOpenCV
CONFIG += console
CONFIG -= app_bundleTEMPLATE = appSOURCES += main.cpp

【5、Qt的main.cpp函数写法】

#include<opencv2/opencv.hpp>
#include"opencv/cv.h"
#include"opencv/cxcore.h"
#include"opencv/highgui.h"using namespace cv;
int main()
{//OpenCV2代码测试Mat image=imread("D:\\1.png");         //载入图片namedWindow("OpenCV2代码测试");       //创建窗口imshow("OpenCV2代码测试",image);      //显示图像imwrite("FuckPOI2.png",image);      //保存图像//OpenCV1代码测试IplImage *pImg;                     //声明IplImage指针pImg = cvLoadImage("D:\\1.png", 0);   //载入图片cvNamedWindow("OpenCV1代码测试",1);  //创建窗口cvShowImage("OpenCV1代码测试",pImg); //显示图像cvSaveImage("FuckPOI1.jpg",pImg);   //保存图像cvWaitKey(0);                       //等待按键cvDestroyWindow("Image");           //销毁窗口cvReleaseImage(&pImg);              //释放图像waitKey(0);
}


  相关解决方案