1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-27 22:33:03 +04:00

fixed clone of empty matrix

This commit is contained in:
Ilya Lavrenov
2016-07-14 16:36:57 +03:00
parent ce05d6cb89
commit 87ae4e0564
5 changed files with 12 additions and 12 deletions
+4 -3
View File
@@ -115,12 +115,13 @@ cvCreateMatHeader( int rows, int cols, int type )
{
type = CV_MAT_TYPE(type);
if( rows < 0 || cols <= 0 )
if( rows < 0 || cols < 0 )
CV_Error( CV_StsBadSize, "Non-positive width or height" );
int min_step = CV_ELEM_SIZE(type)*cols;
int min_step = CV_ELEM_SIZE(type);
if( min_step <= 0 )
CV_Error( CV_StsUnsupportedFormat, "Invalid matrix type" );
min_step *= cols;
CvMat* arr = (CvMat*)cvAlloc( sizeof(*arr));
@@ -148,7 +149,7 @@ cvInitMatHeader( CvMat* arr, int rows, int cols,
if( (unsigned)CV_MAT_DEPTH(type) > CV_DEPTH_MAX )
CV_Error( CV_BadNumChannels, "" );
if( rows < 0 || cols <= 0 )
if( rows < 0 || cols < 0 )
CV_Error( CV_StsBadSize, "Non-positive cols or rows" );
type = CV_MAT_TYPE( type );