I had a perfectly working OpenCV code (having the function cvCaptureFromCAM(0)
). But when I modified it to run in a separate thread, I get this \"Video
Since this is a problem that only happens on Windows, an easy fix is to leave cvCaptureFromCAM(0)
on the main()
thread and then do the image processing stuff on a separate thread, as you intented originally.
Just declare CvCapture* capture = NULL;
as a global variable so all your threads can access it.
Solved. I couldn't get rid of the above mentioned dialog box, but I avoided the error by simply duplicating the line capture = cvCaptureFromCAM(0);
capture = cvCaptureFromCAM(0);
capture = cvCaptureFromCAM(0);
It was just random. I suspect it had something to do with behavior of Thread. What's your idea?
Thanks all for contributing.