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


注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
粤ICP备14056181号  © 2014-2020 ITdaan.com