I reported this problem but now I think it might be specific to my system, I'll try to perform more tests to clear it up.
Anyway, here's what I had to to fix the issue:
Edit modules/highgui/src/cap_qtkit.mm and jump to line 313 to see the implementation of:
int CvCaptureCAM::startCaptureDevice(int cameraNum) {
Our changes will be made to this method, so locate the following block:
if (cameraNum >= 0) {
int nCameras = [devices count];
if( cameraNum < 0 || cameraNum >= nCameras )
return 0;
device = [devices objectAtIndex:cameraNum] ;
} else {
device = [QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeVideo] ;
}
and replace it by:
if (cameraNum >= 0) {
int nCameras = [devices count];
if( cameraNum > nCameras )
return 0;
cameraNum--;
device = [devices objectAtIndex:cameraNum] ;
} else {
device = [QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeVideo] ;
}
Recompile OpenCV and don't forget to install it on your system again.