add Rect2d to python bindings

pull/5592/head
berak 9 years ago
parent 37ce3b8cfe
commit 1048b235bf
  1. 16
      modules/python/src2/cv2.cpp

@ -97,6 +97,7 @@ typedef std::vector<Vec4f> vector_Vec4f;
typedef std::vector<Vec6f> vector_Vec6f;
typedef std::vector<Vec4i> vector_Vec4i;
typedef std::vector<Rect> vector_Rect;
typedef std::vector<Rect2d> vector_Rect2d;
typedef std::vector<KeyPoint> vector_KeyPoint;
typedef std::vector<Mat> vector_Mat;
typedef std::vector<DMatch> 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)
{

Loading…
Cancel
Save