I am hoping that this question will be of use to others as how to handle input from a webcam into OpenCV seems to be a recurring issue. It would seem that many who are working in this area would also target Windows so I am hoping that my questions will have broader applicability. Sorry if my questions reflect my newbie status.
I am using the videoinput library with OpenCV 2.4.3 with a multithreaded approach for a WinForm using VS2010SE C++/cli. I am using two MSFT Lifecam 3000s as the video sources.
Currently, one thread runs a loop that polls the open VI cameras by calling isFrameNew to determine if there is a new frame to process. If a new frame is found, it is processed by running the OpenCV Canny function and then displaying the result in a WinForm picturebox on the UI thread. With two cameras at 640x480 resolution and color, I am getting ~4 frames/sec without trying a GPU approach on a Win7 machine with an Intel i3 processor.
While this works, it does not appear to be the best way of doing this in terms of polling the cameras. It would be better to have an event driven approach.
All of that is the lead up to my questions:
1) does the VideoInput library have some event driven capability that could avoid the need for polling or is there some other way of determining when new frames are available other than polling?
2) should I even be using the VideoInput library? I saw recent references that led me to the library and I understand that it is better than what is internal to OpenCV. I got it working with no problem and it is easy to use. However, it is not supported and seems to be several years old. Does it make sense to try and build something entirely new using MSFT Media Foundation? Again, this seems like an issue that huge numbers of people must face.
Thanks for any insight.