Hello,
In my program (MultiPlatform C++ using OpenCV 2.4.6) , I am trying to determine how many video inputs are available. There is no straightforward API for that, so I'm doing a small workaround:
I try and init a new VideoCapture with an increasing index until it fails. (isOpened() returns false)
while(bOk)
{
test = new cv::VideoCapture(i++);
bOk = test->isOpened();
...
}
While it's working on linux (with V4L2) it fails on Windows (with DirectShow) since the OpenCV Dshow wrapper, when requested to open a camera index out of bound, decides to use the last available one. (so I'm getting 99 working inputs)
cf cap_dshow.cpp l.3172
try_index = try_index < 0 ? 0 : (try_index > devices-1 ? devices-1 : try_index);
Is there any particular reason for this behaviour? (I did not find an obvious one on the source history) maybe is this a workaround for a dshow issue?
Thank you