From: Timur Sattarov Date: Sat, 10 Jan 2015 23:02:58 +0000 (+0400) Subject: More sensible error messages X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~2741^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4762728fd598923f7ba4f36899fc79e22c7a5199;p=platform%2Fupstream%2Fopencv.git More sensible error messages --- diff --git a/modules/calib3d/src/calibration.cpp b/modules/calib3d/src/calibration.cpp index 43a4cd1..5a86624 100644 --- a/modules/calib3d/src/calibration.cpp +++ b/modules/calib3d/src/calibration.cpp @@ -2972,7 +2972,13 @@ static void collectCalibrationData( InputArrayOfArrays objectPoints, for( i = 0; i < nimages; i++ ) { ni = objectPoints.getMat(i).checkVector(3, CV_32F); - CV_Assert( ni >= 0 ); + if( ni <= 0 ) + CV_Error(CV_StsUnsupportedFormat, "objectPoints should contain vector of vectors of points of type Point3f"); + int ni1 = imagePoints1.getMat(i).checkVector(2, CV_32F); + if( ni1 <= 0 ) + CV_Error(CV_StsUnsupportedFormat, "imagePoints1 should contain vector of vectors of points of type Point2f"); + CV_Assert( ni == ni1 ); + total += ni; } @@ -2995,8 +3001,6 @@ static void collectCalibrationData( InputArrayOfArrays objectPoints, Mat objpt = objectPoints.getMat(i); Mat imgpt1 = imagePoints1.getMat(i); ni = objpt.checkVector(3, CV_32F); - int ni1 = imgpt1.checkVector(2, CV_32F); - CV_Assert( ni > 0 && ni == ni1 ); npoints.at(i) = ni; memcpy( objPtData + j, objpt.ptr(), ni*sizeof(objPtData[0]) ); memcpy( imgPtData1 + j, imgpt1.ptr(), ni*sizeof(imgPtData1[0]) ); diff --git a/modules/imgproc/src/contours.cpp b/modules/imgproc/src/contours.cpp index b0a81ed..758ccb0 100644 --- a/modules/imgproc/src/contours.cpp +++ b/modules/imgproc/src/contours.cpp @@ -193,7 +193,9 @@ cvStartFindContours( void* _img, CvMemStorage* storage, if( !((CV_IS_MASK_ARR( mat ) && mode < CV_RETR_FLOODFILL) || (CV_MAT_TYPE(mat->type) == CV_32SC1 && mode == CV_RETR_FLOODFILL)) ) - CV_Error( CV_StsUnsupportedFormat, "[Start]FindContours support only 8uC1 and 32sC1 images" ); + CV_Error( CV_StsUnsupportedFormat, + "[Start]FindContours supports only CV_8UC1 images when mode != CV_RETR_FLOODFILL " + "otherwise supports CV_32SC1 images only" ); CvSize size = cvSize( mat->width, mat->height ); int step = mat->step;