OpenCV --> window reopens while webcam outputing..How to stop it?
That's the code:
Code:
#include "opencv/highgui.h"
int main( int argc, char** argv ) {
/* // Capture the Image from the webcam
CvCapture *pCapturedImage = cvCreateCameraCapture(0);
// Get the frame
IplImage *pSaveImg = cvQueryFrame(pCapturedImage);
// Save the frame into a file
cvSaveImage("test.jpg" ,pSaveImg);
*/
cvNamedWindow( "Example2", CV_WINDOW_AUTOSIZE );
CvCapture* capture = cvCreateCameraCapture(0) ;
IplImage* frame;
while(1) {
frame = cvQueryFrame( capture );
if( !frame ) break;
cvShowImage( "Example2", frame );
char c = cvWaitKey(33);
if( c == 27 ) break;
}
cvReleaseCapture( &capture );
cvDestroyWindow( "Example2" );
}
It actually shows the webcam video till it gets [Esc]
This is OK but when I manually close the window from the X button then it reopens...How can i avoid this from being done?
Re: OpenCV --> window reopens while webcam outputing..How to stop it?
My money is on cvShowImage() unhiding the window, which still exists when "closed" it is just hidden until the cvNamedWindow object is destroyed. As for how you break out of the loop when the cvNamedWindow is "closed": you probably should ask this question in an OpenCV forum because it has nothing to do with Qt.
Re: OpenCV --> window reopens while webcam outputing..How to stop it?
Hey, look this example http://qt-apps.org/content/show.php/...?content=89995
The author put the captured video inside QMainWindow and you don't need the highgui.