cvCreateCameraCapture: fix using preffered interface

The provided interface id must be removed from the index. Otherwise, the
underlying implementations are using a wrong camera id.

Example:
VideoCapture(800) fails because PvAPI tries to open a camera
on position 800
This commit is contained in:
Alexander Duda 2015-08-14 13:40:24 +02:00
parent 68f8d1cef0
commit fbcf5f0918

View File

@ -129,6 +129,9 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
// interpret preferred interface (0 = autodetect)
int pref = (index / 100) * 100;
// remove pref from index
index -= pref;
// local variable to memorize the captured device
CvCapture *capture = 0;