So what I need is something like capture devices list.
And some function to get from user on which device he wants to stream.
How to do such thing with openCV in win32 C++ console application?
As Martin said it's not supported in OpenCV but you could use a little trick. If that satisfies your needs, you can find out the number of cameras by successively enumerating the cameras by calling cvCreateCameraCapture()
until it returns NULL.
Sth like this:
CvCapture *cap;
int n = 0;
while(1)
{
cap = cvCreateCameraCapture(n++);
if (cap == NULL) break;
cvReleaseCapture(&cap);
}
cvReleaseCapture(&cap);
return n-1;
Now you have a number of camera devices so you can let your user to select one by its index from i.e. list box.
Disadvantage is that OpenCV doesn't give you any information about device name so if you want to accomplish that too you should take a look at Microsoft DirectShow or the library Martin proposed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With