diff --git a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp index cbe285222..433f70af1 100644 --- a/modules/python/src2/cv2.cpp +++ b/modules/python/src2/cv2.cpp @@ -97,6 +97,7 @@ typedef std::vector vector_Vec4f; typedef std::vector vector_Vec6f; typedef std::vector vector_Vec4i; typedef std::vector vector_Rect; +typedef std::vector vector_Rect2d; typedef std::vector vector_KeyPoint; typedef std::vector vector_Mat; typedef std::vector vector_DMatch; @@ -649,6 +650,21 @@ PyObject* pyopencv_from(const Rect& r) return Py_BuildValue("(iiii)", r.x, r.y, r.width, r.height); } +template<> +bool pyopencv_to(PyObject* obj, Rect2d& r, const char* name) +{ + (void)name; + if(!obj || obj == Py_None) + return true; + return PyArg_ParseTuple(obj, "dddd", &r.x, &r.y, &r.width, &r.height) > 0; +} + +template<> +PyObject* pyopencv_from(const Rect2d& r) +{ + return Py_BuildValue("(dddd)", r.x, r.y, r.width, r.height); +} + template<> bool pyopencv_to(PyObject* obj, Range& r, const char* name) {