From: Vadim Pisarevsky Date: Mon, 13 Jun 2011 21:47:35 +0000 (+0000) Subject: return Py_None for an empty mat (should fix #1120) X-Git-Tag: accepted/2.0/20130307.220821~2806 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b97f5d5e909441486ec824f38ea9d993de46708;p=profile%2Fivi%2Fopencv.git return Py_None for an empty mat (should fix #1120) --- diff --git a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp index f9cfde4..9737f49 100644 --- a/modules/python/src2/cv2.cpp +++ b/modules/python/src2/cv2.cpp @@ -234,6 +234,11 @@ static int pyopencv_to(const PyObject* o, Mat& m, const char* name = "" static PyObject* pyopencv_from(const Mat& m) { + if( !m.data ) + { + Py_INCREF(Py_None); + return Py_None; + } Mat temp, *p = (Mat*)&m; if(!p->refcount || p->allocator != &g_numpyAllocator) {