mirror of
https://github.com/opencv/opencv.git
synced 2024-12-15 09:49:13 +08:00
8bd17163c7
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
35 lines
1.0 KiB
C++
35 lines
1.0 KiB
C++
#ifdef HAVE_OPENCV_VIDEOIO
|
|
typedef std::vector<VideoCaptureAPIs> vector_VideoCaptureAPIs;
|
|
typedef std::vector<VideoCapture> vector_VideoCapture;
|
|
|
|
template<> struct pyopencvVecConverter<cv::VideoCaptureAPIs>
|
|
{
|
|
static bool to(PyObject* obj, std::vector<cv::VideoCaptureAPIs>& value, const ArgInfo& info)
|
|
{
|
|
return pyopencv_to_generic_vec(obj, value, info);
|
|
}
|
|
|
|
static PyObject* from(const std::vector<cv::VideoCaptureAPIs>& value)
|
|
{
|
|
return pyopencv_from_generic_vec(value);
|
|
}
|
|
};
|
|
|
|
template<>
|
|
bool pyopencv_to(PyObject *o, std::vector<cv::VideoCaptureAPIs>& apis, const ArgInfo& info)
|
|
{
|
|
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
|