1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Merge pull request #22939 from stopmosk:21826-python-bindings-for-videocapturewaitany

Add Python bindings for VideoCapture::waitAny #21826

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Sergei Shutov
2022-12-14 21:15:02 +02:00
committed by GitHub
parent 81aaca8c04
commit 8bd17163c7
6 changed files with 67 additions and 1 deletions
@@ -1,5 +1,6 @@
#ifdef HAVE_OPENCV_VIDEOIO
typedef std::vector<VideoCaptureAPIs> vector_VideoCaptureAPIs;
typedef std::vector<VideoCapture> vector_VideoCapture;
template<> struct pyopencvVecConverter<cv::VideoCaptureAPIs>
{
@@ -20,4 +21,14 @@ bool pyopencv_to(PyObject *o, std::vector<cv::VideoCaptureAPIs>& apis, const Arg
return pyopencvVecConverter<cv::VideoCaptureAPIs>::to(o, apis, info);
}
template<> bool pyopencv_to(PyObject* obj, cv::VideoCapture& stream, const ArgInfo& info)
{
Ptr<VideoCapture> * obj_getp = nullptr;
if (!pyopencv_VideoCapture_getp(obj, obj_getp))
return (failmsgp("Incorrect type of self (must be 'VideoCapture' or its derivative)") != nullptr);
stream = **obj_getp;
return true;
}
#endif // HAVE_OPENCV_VIDEOIO