How to avoid “Video Source -> Capture source” selection in OpenCV 2.3.0 - Visual C++ 2008

后端 未结 2 1296
一整个雨季
一整个雨季 2020-12-18 16:13

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

相关标签:
2条回答
  • 2020-12-18 16:58

    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.

    0 讨论(0)
  • 2020-12-18 17:01

    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.

    0 讨论(0)
提交回复
热议问题