@@ -1247,6 +1247,7 @@ void _OutputArray::create(int d, const int* sizes, int mtype, int i,
1247
1247
{
1248
1248
CV_Assert ( i < 0 );
1249
1249
Mat& m = *(Mat*)obj;
1250
+ CV_Assert (!(m.empty () && fixedType () && fixedSize ()) && " Can't reallocate empty Mat with locked layout (probably due to misused 'const' modifier)" );
1250
1251
if (allowTransposed && !m.empty () &&
1251
1252
d == 2 && m.dims == 2 &&
1252
1253
m.type () == mtype && m.rows == sizes[1 ] && m.cols == sizes[0 ] &&
@@ -1260,13 +1261,13 @@ void _OutputArray::create(int d, const int* sizes, int mtype, int i,
1260
1261
if (CV_MAT_CN (mtype) == m.channels () && ((1 << CV_MAT_TYPE (flags)) & fixedDepthMask) != 0 )
1261
1262
mtype = m.type ();
1262
1263
else
1263
- CV_CheckTypeEQ (m.type (), CV_MAT_TYPE (mtype), " " );
1264
+ CV_CheckTypeEQ (m.type (), CV_MAT_TYPE (mtype), " Can't reallocate Mat with locked type (probably due to misused 'const' modifier) " );
1264
1265
}
1265
1266
if (fixedSize ())
1266
1267
{
1267
- CV_CheckEQ (m.dims , d, " " );
1268
+ CV_CheckEQ (m.dims , d, " Can't reallocate Mat with locked size (probably due to misused 'const' modifier) " );
1268
1269
for (int j = 0 ; j < d; ++j)
1269
- CV_CheckEQ (m.size [j], sizes[j], " " );
1270
+ CV_CheckEQ (m.size [j], sizes[j], " Can't reallocate Mat with locked size (probably due to misused 'const' modifier) " );
1270
1271
}
1271
1272
m.create (d, sizes, mtype);
1272
1273
return ;
@@ -1276,6 +1277,7 @@ void _OutputArray::create(int d, const int* sizes, int mtype, int i,
1276
1277
{
1277
1278
CV_Assert ( i < 0 );
1278
1279
UMat& m = *(UMat*)obj;
1280
+ CV_Assert (!(m.empty () && fixedType () && fixedSize ()) && " Can't reallocate empty UMat with locked layout (probably due to misused 'const' modifier)" );
1279
1281
if (allowTransposed && !m.empty () &&
1280
1282
d == 2 && m.dims == 2 &&
1281
1283
m.type () == mtype && m.rows == sizes[1 ] && m.cols == sizes[0 ] &&
@@ -1289,13 +1291,13 @@ void _OutputArray::create(int d, const int* sizes, int mtype, int i,
1289
1291
if (CV_MAT_CN (mtype) == m.channels () && ((1 << CV_MAT_TYPE (flags)) & fixedDepthMask) != 0 )
1290
1292
mtype = m.type ();
1291
1293
else
1292
- CV_CheckTypeEQ (m.type (), CV_MAT_TYPE (mtype), " " );
1294
+ CV_CheckTypeEQ (m.type (), CV_MAT_TYPE (mtype), " Can't reallocate UMat with locked type (probably due to misused 'const' modifier) " );
1293
1295
}
1294
1296
if (fixedSize ())
1295
1297
{
1296
- CV_CheckEQ (m.dims , d, " " );
1298
+ CV_CheckEQ (m.dims , d, " Can't reallocate UMat with locked size (probably due to misused 'const' modifier) " );
1297
1299
for (int j = 0 ; j < d; ++j)
1298
- CV_CheckEQ (m.size [j], sizes[j], " " );
1300
+ CV_CheckEQ (m.size [j], sizes[j], " Can't reallocate UMat with locked size (probably due to misused 'const' modifier) " );
1299
1301
}
1300
1302
m.create (d, sizes, mtype);
1301
1303
return ;
0 commit comments