return Py_None for an empty mat (should fix #1120)

This commit is contained in:
Vadim Pisarevsky 2011-06-13 21:47:35 +00:00
parent 619e503d53
commit 3b97f5d5e9

View 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)
{