diff --git a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp index f9cfde41c..9737f49c3 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) {