本文主要是介绍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,当时自己就犯了这个错误
- #include <QtGui/QMainWindow>
这篇关于Qt中调用OpenCV库及头文件的设置.备用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!