Windows下配置QT OpenCV
Posted 朝闻道
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Windows下配置QT OpenCV相关的知识,希望对你有一定的参考价值。
OpenCV-Study:Windows下配置OpenCV
本文博客链接:http://blog.csdn.net/jdh99,作者:jdh,转载请注明.
环境:
主机:XP
OpenCV版本:2.4.0
说明:
配置参考链接:
http://blog.csdn.net/youhaipeng/article/details/7452972
http://blog.csdn.NET/youhaipeng/article/details/7453034
测试代码:
.pro文件
- #-------------------------------------------------
- #
- # Project created by QtCreator 2012-05-07T12:27:37
- #
- #-------------------------------------------------
- QT += core gui
- TARGET = test_opencv
- TEMPLATE = app
- SOURCES += main.cpp\
- widget.cpp
- HEADERS += widget.h
- FORMS += widget.ui
- INCLUDEPATH += E:\opencv\build\include\opencv\
- E:\opencv\build\include\opencv2\
- E:\opencv\build\include\
- LIBS += E:\opencv_obj\lib\libopencv_calib3d240.dll.a\
- E:\opencv_obj\lib\libopencv_core240.dll.a\
- E:\opencv_obj\lib\libopencv_features2d240.dll.a\
- E:\opencv_obj\lib\libopencv_flann240.dll.a\
- E:\opencv_obj\lib\libopencv_gpu240.dll.a\
- E:\opencv_obj\lib\libopencv_highgui240.dll.a\
- E:\opencv_obj\lib\libopencv_imgproc240.dll.a\
- E:\opencv_obj\lib\libopencv_legacy240.dll.a\
- E:\opencv_obj\lib\libopencv_ml240.dll.a\
- E:\opencv_obj\lib\libopencv_objdetect240.dll.a\
- E:\opencv_obj\lib\libopencv_video240.dll.a
widget.cpp:
- #include "widget.h"
- #include "ui_widget.h"
- #include "highgui.h"
- #include "cv.h"
- #include "cxcore.h"
- Widget::Widget(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::Widget)
- {
- ui->setupUi(this);
- IplImage *img = cvLoadImage("lena.jpg");
- cvNamedWindow("jdh",CV_WINDOW_AUTOSIZE);
- cvShowImage("jdh",img);
- cvWaitKey(0);
- cvReleaseImage(&img);
- cvDestroyWindow("jdh");
- }
- Widget::~Widget()
- {
- delete ui;
- }
运行结果:
http://blog.csdn.net/jdh99/article/details/7542049
以上是关于Windows下配置QT OpenCV的主要内容,如果未能解决你的问题,请参考以下文章
windows下Qt5.1.0配置android环境搭建 good
windows下Qt5.4.2 for android开发环境配置