首页 > 代码库 > Windows下配置QT OpenCV

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文件

 

[plain] view plain copy
 
  1. #-------------------------------------------------  
  2. #  
  3. # Project created by QtCreator 2012-05-07T12:27:37  
  4. #  
  5. #-------------------------------------------------  
  6.   
  7. QT       += core gui  
  8.   
  9. TARGET = test_opencv  
  10. TEMPLATE = app  
  11.   
  12.   
  13. SOURCES += main.cpp\  
  14.         widget.cpp  
  15.   
  16. HEADERS  += widget.h  
  17.   
  18. FORMS    += widget.ui  
  19.   
  20. INCLUDEPATH += E:\opencv\build\include\opencv\  
  21.                                  E:\opencv\build\include\opencv2\  
  22.                                  E:\opencv\build\include\  
  23.   
  24. LIBS        +=  E:\opencv_obj\lib\libopencv_calib3d240.dll.a\  
  25.                        E:\opencv_obj\lib\libopencv_core240.dll.a\  
  26.                        E:\opencv_obj\lib\libopencv_features2d240.dll.a\  
  27.                        E:\opencv_obj\lib\libopencv_flann240.dll.a\  
  28.                        E:\opencv_obj\lib\libopencv_gpu240.dll.a\  
  29.                        E:\opencv_obj\lib\libopencv_highgui240.dll.a\  
  30.                        E:\opencv_obj\lib\libopencv_imgproc240.dll.a\  
  31.                        E:\opencv_obj\lib\libopencv_legacy240.dll.a\  
  32.                        E:\opencv_obj\lib\libopencv_ml240.dll.a\  
  33.                        E:\opencv_obj\lib\libopencv_objdetect240.dll.a\  
  34.                        E:\opencv_obj\lib\libopencv_video240.dll.a  


widget.cpp:

 

 

[cpp] view plain copy
 
  1. #include "widget.h"  
  2. #include "ui_widget.h"  
  3. #include  "highgui.h"  
  4. #include "cv.h"  
  5. #include "cxcore.h"  
  6.   
  7. Widget::Widget(QWidget *parent) :  
  8.     QWidget(parent),  
  9.     ui(new Ui::Widget)  
  10. {  
  11.     ui->setupUi(this);  
  12.   
  13.     IplImage *img = cvLoadImage("lena.jpg");  
  14.   
  15.     cvNamedWindow("jdh",CV_WINDOW_AUTOSIZE);  
  16.   
  17.     cvShowImage("jdh",img);  
  18.     cvWaitKey(0);  
  19.     cvReleaseImage(&img);  
  20.     cvDestroyWindow("jdh");  
  21. }  
  22.   
  23. Widget::~Widget()  
  24. {  
  25.     delete ui;  
  26. }  


运行结果:

 

技术分享

 

http://blog.csdn.net/jdh99/article/details/7542049

Windows下配置QT OpenCV