Skip to content

Commit 12569dc

Browse files
committed
Merge pull request opencv#7625 from souch55:Fixapi
2 parents a19cb20 + 94b5a74 commit 12569dc

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

modules/videoio/include/opencv2/videoio.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,16 @@ class CV_EXPORTS_W VideoCapture
650650
*/
651651
CV_WRAP virtual bool open(int index);
652652

653+
/** @brief Open a camera for video capturing
654+
655+
@overload
656+
657+
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
658+
Parameters are similar as the constructor VideoCapture(int index),except it takes an additional argument apiPreference.
659+
@return open(cameraNum + apiPreference).
660+
*/
661+
CV_WRAP bool open(int cameraNum, int apiPreference);
662+
653663
/** @brief Returns true if video capturing has been initialized already.
654664
655665
If the previous call to VideoCapture constructor or VideoCapture::open() succeeded, the method returns

modules/videoio/src/cap.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,11 @@ bool VideoCapture::open(int index)
606606
cap.reset(cvCreateCameraCapture(index));
607607
return isOpened();
608608
}
609+
bool VideoCapture::open(int cameraNum, int apiPreference)
610+
{
611+
cameraNum = cameraNum + apiPreference;
612+
return open(cameraNum);
613+
}
609614

610615
bool VideoCapture::isOpened() const
611616
{

0 commit comments

Comments
 (0)