From 8011be281034df41470b6680913f20c39551ea33 Mon Sep 17 00:00:00 2001 From: Maksim Shabunin Date: Tue, 17 May 2016 17:26:27 +0300 Subject: [PATCH] Python bindings: added std::vector< std::pair< int, double > > type read support --- modules/python/src2/cv2.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp index 9369f29..3bb98e4 100644 --- a/modules/python/src2/cv2.cpp +++ b/modules/python/src2/cv2.cpp @@ -967,6 +967,24 @@ template static inline PyObject* pyopencv_from_generic_vec(const s return seq; } +template<> +PyObject* pyopencv_from(const std::pair& src) +{ + return Py_BuildValue("(id)", src.first, src.second); +} + +template struct pyopencvVecConverter > +{ + static bool to(PyObject* obj, std::vector >& value, const ArgInfo info) + { + return pyopencv_to_generic_vec(obj, value, info); + } + + static PyObject* from(const std::vector >& value) + { + return pyopencv_from_generic_vec(value); + } +}; template struct pyopencvVecConverter > { -- 2.7.4