Qt中调用OpenCV库及头文件的设置.备用

1. 在.pro文件中设置如下:

    

QT       += core gui
INCLUDEPATH += D:\opencv2.4.2\install\include
INCLUDEPATH += D:\opencv2.4.2\install\include\opencv
INCLUDEPATH += D:\opencv2.4.2\install\include\opencv2

LIBS += D:\opencv2.4.2\install\lib\libopencv_core242.dll.a
LIBS += D:\opencv2.4.2\install\lib\libopencv_highgui242.dll.a
LIBS += D:\opencv2.4.2\install\lib\libopencv_imgproc242.dll.a
LIBS += D:\opencv2.4.2\install\lib\libopencv_photo242.dll.a

2. 在.h文件中设置如下:

#include "cv.h"
#include "cxcore.h"
#include "highgui.h"

using namespace cv;    // 这个一定要加,否则Mat用来了啦,只能cv:Mat,当时自己就犯了这个错误


3.如果要编写GUI程序的话,还要添加这个

#include <QtGui/QMainWindow>



你可能感兴趣的:(Qt中调用OpenCV库及头文件的设置.备用)