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
pull/5192/head
Alexander Duda 9 years ago
parent 68f8d1cef0
commit fbcf5f0918
  1. 3
      modules/videoio/src/cap.cpp

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

Loading…
Cancel
Save