fixed OutputArray::create, which resolves several failures in opencv_test_core

This commit is contained in:
Vadim Pisarevsky 2011-04-18 16:32:43 +00:00
parent 94e09f24c7
commit dd45fe13d1

View File

@ -1188,11 +1188,15 @@ void OutputArray::create(int dims, const int* size, int type, int i, bool alloca
{ {
CV_Assert( i < 0 ); CV_Assert( i < 0 );
Mat& m = *(Mat*)obj; Mat& m = *(Mat*)obj;
if( allocateVector && dims == 2 && m.dims == 2 && if( allocateVector )
m.type() == type && m.rows == size[1] && m.cols == size[0] && m.isContinuous()) {
return;
if( !m.isContinuous() ) if( !m.isContinuous() )
m.release(); m.release();
if( dims == 2 && m.dims == 2 && m.data &&
m.type() == type && m.rows == size[1] && m.cols == size[0] )
return;
}
m.create(dims, size, type); m.create(dims, size, type);
return; return;
} }
@ -1310,11 +1314,15 @@ void OutputArray::create(int dims, const int* size, int type, int i, bool alloca
CV_Assert( i < (int)v.size() ); CV_Assert( i < (int)v.size() );
Mat& m = v[i]; Mat& m = v[i];
if( allocateVector && dims == 2 && m.dims == 2 && if( allocateVector )
m.type() == type && m.rows == size[1] && m.cols == size[0] && m.isContinuous()) {
return;
if( !m.isContinuous() ) if( !m.isContinuous() )
m.release(); m.release();
if( dims == 2 && m.dims == 2 && m.data &&
m.type() == type && m.rows == size[1] && m.cols == size[0] )
return;
}
m.create(dims, size, type); m.create(dims, size, type);
} }
} }