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