return Py_None for an empty mat (should fix #1120)
authorVadim Pisarevsky <no@email>
Mon, 13 Jun 2011 21:47:35 +0000 (21:47 +0000)
committerVadim Pisarevsky <no@email>
Mon, 13 Jun 2011 21:47:35 +0000 (21:47 +0000)
modules/python/src2/cv2.cpp

index f9cfde4..9737f49 100644 (file)
@@ -234,6 +234,11 @@ static int pyopencv_to(const PyObject* o, Mat& m, const char* name = "<unknown>"
 
 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)
     {