After successfully configuring your Qt-Creator with OpenCV library, its now time to get your hands dirty with the openCV programming. Here I have created a simple sample program which loads the picture from your drive named hello.jpg. Its really simple
Here is the code for main.cpp
You can download the above project for OpenCV2.2 here.
Here is the code for main.cpp
1: #include <opencv/cv.h>2: #include <opencv/highgui.h>3: #include <QtGui/QApplication>4: #include "mainwindow.h"
5:6: int main(int argc, char *argv[]){7: QApplication a(argc, argv);8: MainWindow w;9: w.show();10: IplImage* img = cvLoadImage( "C:\\hello.jpg" );
11: //load the image
12: cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
13: cvShowImage( "Example1", img );
14: cvWaitKey(0);15: cvReleaseImage( &img );16: cvDestroyWindow( "Example1" );
17: return a.exec();
18: }
You will get output like this…
You can download the above project for OpenCV2.2 here.
Thank you
ReplyDeleteI have tried running this code on Windows xp & opencv2 .2 & Qt 4.7.4 (32 bit)
But the interface did not show
No image is displayed: /
And I do not know what reason,can you help me?
@Anonymous Thanks for the comment. I have updated the post with OpenCV2.2 working one. You can try that one and if any problem occurs , you can consult again....
ReplyDeleteThis comment has been removed by the author.
ReplyDeletecan you integrate openCV in android mobile phone?? or can send image from android phone via bluetooth, wifi to pc with openCV... which is easy..and can you help me.. this is my pg project and time is critical.
ReplyDelete