標籤:replace ide app plain widget nbsp size oar upload
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檔案
[plain] view plain copy
- #-------------------------------------------------
- #
- # 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:
[cpp] view plain copy
- #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