diff --git a/apps/traincascade/boost.cpp b/apps/traincascade/boost.cpp index d409216b8a..c1a451672a 100644 --- a/apps/traincascade/boost.cpp +++ b/apps/traincascade/boost.cpp @@ -86,10 +86,10 @@ static CvMat* cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, b int* dsti; if( !CV_IS_MAT(idx_arr) ) - CV_ERROR( CV_StsBadArg, "Invalid index array" ); + CV_ERROR( cv::Error::StsBadArg, "Invalid index array" ); if( idx_arr->rows != 1 && idx_arr->cols != 1 ) - CV_ERROR( CV_StsBadSize, "the index array must be 1-dimensional" ); + CV_ERROR( cv::Error::StsBadSize, "the index array must be 1-dimensional" ); idx_total = idx_arr->rows + idx_arr->cols - 1; srcb = idx_arr->data.ptr; @@ -105,20 +105,20 @@ static CvMat* cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, b // idx_arr is array of 1's and 0's - // i.e. it is a mask of the selected components if( idx_total != data_arr_size ) - CV_ERROR( CV_StsUnmatchedSizes, + CV_ERROR( cv::Error::StsUnmatchedSizes, "Component mask should contain as many elements as the total number of input variables" ); for( i = 0; i < idx_total; i++ ) idx_selected += srcb[i*step] != 0; if( idx_selected == 0 ) - CV_ERROR( CV_StsOutOfRange, "No components/input_variables is selected!" ); + CV_ERROR( cv::Error::StsOutOfRange, "No components/input_variables is selected!" ); break; case CV_32SC1: // idx_arr is array of integer indices of selected components if( idx_total > data_arr_size ) - CV_ERROR( CV_StsOutOfRange, + CV_ERROR( cv::Error::StsOutOfRange, "index array may not contain more elements than the total number of input variables" ); idx_selected = idx_total; // check if sorted already @@ -134,7 +134,7 @@ static CvMat* cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, b } break; default: - CV_ERROR( CV_StsUnsupportedFormat, "Unsupported index array data type " + CV_ERROR( cv::Error::StsUnsupportedFormat, "Unsupported index array data type " "(it should be 8uC1, 8sC1 or 32sC1)" ); } @@ -156,13 +156,13 @@ static CvMat* cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, b qsort( dsti, idx_total, sizeof(dsti[0]), icvCmpIntegers ); if( dsti[0] < 0 || dsti[idx_total-1] >= data_arr_size ) - CV_ERROR( CV_StsOutOfRange, "the index array elements are out of range" ); + CV_ERROR( cv::Error::StsOutOfRange, "the index array elements are out of range" ); if( check_for_duplicates ) { for( i = 1; i < idx_total; i++ ) if( dsti[i] <= dsti[i-1] ) - CV_ERROR( CV_StsBadArg, "There are duplicated index array elements" ); + CV_ERROR( cv::Error::StsBadArg, "There are duplicated index array elements" ); } } @@ -218,7 +218,7 @@ bool CvCascadeBoostParams::read( const FileNode &node ) !boostTypeStr.compare( CC_LOGIT_BOOST ) ? CvBoost::LOGIT : !boostTypeStr.compare( CC_GENTLE_BOOST ) ? CvBoost::GENTLE : -1; if (boost_type == -1) - CV_Error( CV_StsBadArg, "unsupported Boost type" ); + CV_Error( cv::Error::StsBadArg, "unsupported Boost type" ); node[CC_MINHITRATE] >> minHitRate; node[CC_MAXFALSEALARM] >> maxFalseAlarm; node[CC_TRIM_RATE] >> weight_trim_rate ; @@ -228,7 +228,7 @@ bool CvCascadeBoostParams::read( const FileNode &node ) maxFalseAlarm <= 0 || maxFalseAlarm > 1 || weight_trim_rate <= 0 || weight_trim_rate > 1 || max_depth <= 0 || weak_count <= 0 ) - CV_Error( CV_StsBadArg, "bad parameters range"); + CV_Error( cv::Error::StsBadArg, "bad parameters range"); return true; } @@ -309,7 +309,7 @@ CvDTreeNode* CvCascadeBoostTrainData::subsample_data( const CvMat* _subsample_id bool isMakeRootCopy = true; if( !data_root ) - CV_Error( CV_StsError, "No training data has been set" ); + CV_Error( cv::Error::StsError, "No training data has been set" ); if( _subsample_idx ) { @@ -547,7 +547,7 @@ void CvCascadeBoostTrainData::setData( const CvFeatureEvaluator* _featureEvaluat // TODO: check responses: elements must be 0 or 1 if( _precalcValBufSize < 0 || _precalcIdxBufSize < 0) - CV_Error( CV_StsOutOfRange, "_numPrecalcVal and _numPrecalcIdx must be positive or 0" ); + CV_Error( cv::Error::StsOutOfRange, "_numPrecalcVal and _numPrecalcIdx must be positive or 0" ); var_count = var_all = featureEvaluator->getNumFeatures() * featureEvaluator->getFeatureSize(); sample_count = _numSamples; @@ -602,7 +602,7 @@ void CvCascadeBoostTrainData::setData( const CvFeatureEvaluator* _featureEvaluat if ((uint64)effective_buf_width * (uint64)effective_buf_height != effective_buf_size) { - CV_Error(CV_StsBadArg, "The memory buffer cannot be allocated since its size exceeds integer fields limit"); + CV_Error(cv::Error::StsBadArg, "The memory buffer cannot be allocated since its size exceeds integer fields limit"); } if ( is_buf_16u ) @@ -914,7 +914,7 @@ CvDTreeNode* CvCascadeBoostTree::predict( int sampleIdx ) const { CvDTreeNode* node = root; if( !node ) - CV_Error( CV_StsError, "The tree has not been trained yet" ); + CV_Error( cv::Error::StsError, "The tree has not been trained yet" ); if ( ((CvCascadeBoostTrainData*)data)->featureEvaluator->getMaxCatCount() == 0 ) // ordered { diff --git a/apps/traincascade/cascadeclassifier.cpp b/apps/traincascade/cascadeclassifier.cpp index e364f2e3ed..6540c30e3a 100644 --- a/apps/traincascade/cascadeclassifier.cpp +++ b/apps/traincascade/cascadeclassifier.cpp @@ -142,7 +142,7 @@ bool CvCascadeClassifier::train( const string _cascadeDirName, double time = (double)getTickCount(); if( _cascadeDirName.empty() || _posFilename.empty() || _negFilename.empty() ) - CV_Error( CV_StsBadArg, "_cascadeDirName or _bgfileName or _vecFileName is NULL" ); + CV_Error( cv::Error::StsBadArg, "_cascadeDirName or _bgfileName or _vecFileName is NULL" ); string dirName; if (_cascadeDirName.find_last_of("/\\") == (_cascadeDirName.length() - 1) ) @@ -452,7 +452,7 @@ void CvCascadeClassifier::save( const string filename, bool baseFormat ) //char buf[256]; CvSeq* weak; if ( cascadeParams.featureType != CvFeatureParams::HAAR ) - CV_Error( CV_StsBadFunc, "old file format is used for Haar-like features only"); + CV_Error( cv::Error::StsBadFunc, "old file format is used for Haar-like features only"); fs << "{:" ICV_HAAR_TYPE_ID; fs << ICV_HAAR_SIZE_NAME << "[:" << cascadeParams.winSize.width << cascadeParams.winSize.height << "]"; diff --git a/apps/traincascade/imagestorage.cpp b/apps/traincascade/imagestorage.cpp index f220e5c2b3..a32824c317 100644 --- a/apps/traincascade/imagestorage.cpp +++ b/apps/traincascade/imagestorage.cpp @@ -138,7 +138,7 @@ bool CvCascadeImageReader::PosReader::create( const string _filename ) fread( &vecSize, sizeof( vecSize ), 1, file ) != 1 || fread( &tmp, sizeof( tmp ), 1, file ) != 1 || fread( &tmp, sizeof( tmp ), 1, file ) != 1 ) - CV_Error_( CV_StsParseError, ("wrong file format for %s\n", _filename.c_str()) ); + CV_Error_( cv::Error::StsParseError, ("wrong file format for %s\n", _filename.c_str()) ); base = sizeof( count ) + sizeof( vecSize ) + 2*sizeof( tmp ); if( feof( file ) ) return false; @@ -154,14 +154,14 @@ bool CvCascadeImageReader::PosReader::get( Mat &_img ) uchar tmp = 0; size_t elements_read = fread( &tmp, sizeof( tmp ), 1, file ); if( elements_read != 1 ) - CV_Error( CV_StsBadArg, "Can not get new positive sample. The most possible reason is " + CV_Error( cv::Error::StsBadArg, "Can not get new positive sample. The most possible reason is " "insufficient count of samples in given vec-file.\n"); elements_read = fread( vec, sizeof( vec[0] ), vecSize, file ); if( elements_read != (size_t)(vecSize) ) - CV_Error( CV_StsBadArg, "Can not get new positive sample. Seems that vec-file has incorrect structure.\n"); + CV_Error( cv::Error::StsBadArg, "Can not get new positive sample. Seems that vec-file has incorrect structure.\n"); if( feof( file ) || last++ >= count ) - CV_Error( CV_StsBadArg, "Can not get new positive sample. vec-file is over.\n"); + CV_Error( cv::Error::StsBadArg, "Can not get new positive sample. vec-file is over.\n"); for( int r = 0; r < _img.rows; r++ ) { diff --git a/apps/traincascade/old_ml_boost.cpp b/apps/traincascade/old_ml_boost.cpp index 2f53bd9031..3dbd0204b1 100644 --- a/apps/traincascade/old_ml_boost.cpp +++ b/apps/traincascade/old_ml_boost.cpp @@ -991,7 +991,7 @@ CvBoost::set_params( const CvBoostParams& _params ) params = _params; if( params.boost_type != DISCRETE && params.boost_type != REAL && params.boost_type != LOGIT && params.boost_type != GENTLE ) - CV_ERROR( CV_StsBadArg, "Unknown/unsupported boosting type" ); + CV_ERROR( cv::Error::StsBadArg, "Unknown/unsupported boosting type" ); params.weak_count = MAX( params.weak_count, 1 ); params.weight_trim_rate = MAX( params.weight_trim_rate, 0. ); @@ -1045,7 +1045,7 @@ CvBoost::train( const CvMat* _train_data, int _tflag, _sample_idx, _var_type, _missing_mask, _params, true, true ); if( data->get_num_classes() != 2 ) - CV_ERROR( CV_StsNotImplemented, + CV_ERROR( cv::Error::StsNotImplemented, "Boosted trees can only be used for 2-class classification." ); CV_CALL( storage = cvCreateMemStorage() ); weak = cvCreateSeq( 0, sizeof(CvSeq), sizeof(CvBoostTree*), storage ); @@ -1482,7 +1482,7 @@ CvBoost::get_active_vars( bool absolute_idx ) __BEGIN__; if( !weak ) - CV_ERROR( CV_StsError, "The boosted tree ensemble has not been trained yet" ); + CV_ERROR( cv::Error::StsError, "The boosted tree ensemble has not been trained yet" ); if( !active_vars || !active_vars_abs ) { @@ -1612,13 +1612,13 @@ CvBoost::predict( const CvMat* _sample, const CvMat* _missing, const float* sample_data; if( !weak ) - CV_Error( CV_StsError, "The boosted tree ensemble has not been trained yet" ); + CV_Error( cv::Error::StsError, "The boosted tree ensemble has not been trained yet" ); if( !CV_IS_MAT(_sample) || CV_MAT_TYPE(_sample->type) != CV_32FC1 || (_sample->cols != 1 && _sample->rows != 1) || (_sample->cols + _sample->rows - 1 != data->var_all && !raw_mode) || (active_vars && _sample->cols + _sample->rows - 1 != active_vars->cols && raw_mode) ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "the input sample must be 1d floating-point vector with the same " "number of elements as the total number of variables or " "as the number of variables used for training" ); @@ -1627,7 +1627,7 @@ CvBoost::predict( const CvMat* _sample, const CvMat* _missing, { if( !CV_IS_MAT(_missing) || !CV_IS_MASK_ARR(_missing) || !CV_ARE_SIZES_EQ(_missing, _sample) ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "the missing data mask must be 8-bit vector of the same size as input sample" ); } @@ -1644,7 +1644,7 @@ CvBoost::predict( const CvMat* _sample, const CvMat* _missing, CV_MAT_TYPE(weak_responses->type) != CV_32FC1 || (weak_responses->cols != 1 && weak_responses->rows != 1) || weak_responses->cols + weak_responses->rows - 1 != weak_count ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "The output matrix of weak classifier responses must be valid " "floating-point vector of the same number of components as the length of input slice" ); wstep = CV_IS_MAT_CONT(weak_responses->type) ? 1 : weak_responses->step/sizeof(float); @@ -1700,7 +1700,7 @@ CvBoost::predict( const CvMat* _sample, const CvMat* _missing, c = a; int ival = cvRound(val); if ( (ival != val) && (!m) ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "one of input categorical variable is not an integer" ); while( a < b ) @@ -1735,7 +1735,7 @@ CvBoost::predict( const CvMat* _sample, const CvMat* _missing, else { if( !CV_IS_MAT_CONT(_sample->type & (_missing ? _missing->type : -1)) ) - CV_Error( CV_StsBadArg, "In raw mode the input vectors must be continuous" ); + CV_Error( cv::Error::StsBadArg, "In raw mode the input vectors must be continuous" ); } cvStartReadSeq( weak, &reader ); @@ -1951,7 +1951,7 @@ void CvBoost::read_params( cv::FileNode& fnode ) params.boost_type = temp.empty() ? -1 : (int)temp; if( params.boost_type < DISCRETE || params.boost_type > GENTLE ) - CV_ERROR( CV_StsBadArg, "Unknown boosting type" ); + CV_ERROR( cv::Error::StsBadArg, "Unknown boosting type" ); temp = fnode[ "splitting_criteria" ]; if( !temp.empty() && temp.isString() ) @@ -1966,7 +1966,7 @@ void CvBoost::read_params( cv::FileNode& fnode ) params.split_criteria = temp.empty() ? -1 : (int) temp; if( params.split_criteria < DEFAULT || params.boost_type > SQERR ) - CV_ERROR( CV_StsBadArg, "Unknown boosting type" ); + CV_ERROR( cv::Error::StsBadArg, "Unknown boosting type" ); params.weak_count = (int) fnode[ "ntrees" ]; params.weight_trim_rate = (double)fnode["weight_trimming_rate"]; @@ -1996,13 +1996,13 @@ CvBoost::read( cv::FileNode& node ) trees_fnode = node[ "trees" ]; if( trees_fnode.empty() || !trees_fnode.isSeq() ) - CV_ERROR( CV_StsParseError, " tag is missing" ); + CV_ERROR( cv::Error::StsParseError, " tag is missing" ); reader = trees_fnode.begin(); ntrees = (int) trees_fnode.size(); if( ntrees != params.weak_count ) - CV_ERROR( CV_StsUnmatchedSizes, + CV_ERROR( cv::Error::StsUnmatchedSizes, "The number of trees stored does not match tag value" ); CV_CALL( storage = cvCreateMemStorage() ); @@ -2034,7 +2034,7 @@ CvBoost::write( cv::FileStorage& fs, const char* name ) const fs.startWriteStruct( name, cv::FileNode::MAP, CV_TYPE_NAME_ML_BOOSTING ); if( !weak ) - CV_ERROR( CV_StsBadArg, "The classifier has not been trained yet" ); + CV_ERROR( cv::Error::StsBadArg, "The classifier has not been trained yet" ); write_params( fs ); fs.startWriteStruct( "trees", cv::FileNode::SEQ ); diff --git a/apps/traincascade/old_ml_data.cpp b/apps/traincascade/old_ml_data.cpp index d221dcbf0f..3b0712def1 100644 --- a/apps/traincascade/old_ml_data.cpp +++ b/apps/traincascade/old_ml_data.cpp @@ -284,7 +284,7 @@ const CvMat* CvMLData::get_missing() const __BEGIN__; if ( !values ) - CV_ERROR( CV_StsInternal, "data is empty" ); + CV_ERROR( cv::Error::StsInternal, "data is empty" ); __END__; @@ -331,7 +331,7 @@ void CvMLData::set_delimiter(char ch) __BEGIN__; if (ch == miss_ch /*|| ch == flt_separator*/) - CV_ERROR(CV_StsBadArg, "delimited, miss_character and flt_separator must be different"); + CV_ERROR(cv::Error::StsBadArg, "delimited, miss_character and flt_separator must be different"); delimiter = ch; @@ -349,7 +349,7 @@ void CvMLData::set_miss_ch(char ch) __BEGIN__; if (ch == delimiter/* || ch == flt_separator*/) - CV_ERROR(CV_StsBadArg, "delimited, miss_character and flt_separator must be different"); + CV_ERROR(cv::Error::StsBadArg, "delimited, miss_character and flt_separator must be different"); miss_ch = ch; @@ -367,10 +367,10 @@ void CvMLData::set_response_idx( int idx ) __BEGIN__; if ( !values ) - CV_ERROR( CV_StsInternal, "data is empty" ); + CV_ERROR( cv::Error::StsInternal, "data is empty" ); if ( idx >= values->cols) - CV_ERROR( CV_StsBadArg, "idx value is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "idx value is not correct" ); if ( response_idx >= 0 ) chahge_var_idx( response_idx, true ); @@ -387,7 +387,7 @@ int CvMLData::get_response_idx() const __BEGIN__; if ( !values ) - CV_ERROR( CV_StsInternal, "data is empty" ); + CV_ERROR( cv::Error::StsInternal, "data is empty" ); __END__; return response_idx; } @@ -400,19 +400,19 @@ void CvMLData::change_var_type( int var_idx, int type ) int var_count = 0; if ( !values ) - CV_ERROR( CV_StsInternal, "data is empty" ); + CV_ERROR( cv::Error::StsInternal, "data is empty" ); var_count = values->cols; if ( var_idx < 0 || var_idx >= var_count) - CV_ERROR( CV_StsBadArg, "var_idx is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "var_idx is not correct" ); if ( type != CV_VAR_ORDERED && type != CV_VAR_CATEGORICAL) - CV_ERROR( CV_StsBadArg, "type is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "type is not correct" ); assert( var_types ); if ( var_types->data.ptr[var_idx] == CV_VAR_CATEGORICAL && type == CV_VAR_ORDERED) - CV_ERROR( CV_StsBadArg, "it`s impossible to assign CV_VAR_ORDERED type to categorical variable" ); + CV_ERROR( cv::Error::StsBadArg, "it`s impossible to assign CV_VAR_ORDERED type to categorical variable" ); var_types->data.ptr[var_idx] = (uchar)type; __END__; @@ -428,7 +428,7 @@ void CvMLData::set_var_types( const char* str ) const char* ord = 0, *cat = 0; int var_count = 0, set_var_type_count = 0; if ( !values ) - CV_ERROR( CV_StsInternal, "data is empty" ); + CV_ERROR( cv::Error::StsInternal, "data is empty" ); var_count = values->cols; @@ -437,7 +437,7 @@ void CvMLData::set_var_types( const char* str ) ord = strstr( str, "ord" ); cat = strstr( str, "cat" ); if ( !ord && !cat ) - CV_ERROR( CV_StsBadArg, "types string is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "types string is not correct" ); if ( !ord && strlen(cat) == 3 ) // str == "cat" { @@ -455,19 +455,19 @@ void CvMLData::set_var_types( const char* str ) { char* stopstring = NULL; if ( ord[3] != '[') - CV_ERROR( CV_StsBadArg, "types string is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "types string is not correct" ); ord += 4; // pass "ord[" do { int b1 = (int)strtod( ord, &stopstring ); if ( *stopstring == 0 || (*stopstring != ',' && *stopstring != ']' && *stopstring != '-') ) - CV_ERROR( CV_StsBadArg, "types string is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "types string is not correct" ); ord = stopstring + 1; if ( (stopstring[0] == ',') || (stopstring[0] == ']')) { if ( var_types->data.ptr[b1] == CV_VAR_CATEGORICAL) - CV_ERROR( CV_StsBadArg, "it`s impossible to assign CV_VAR_ORDERED type to categorical variable" ); + CV_ERROR( cv::Error::StsBadArg, "it`s impossible to assign CV_VAR_ORDERED type to categorical variable" ); var_types->data.ptr[b1] = CV_VAR_ORDERED; set_var_type_count++; } @@ -477,39 +477,39 @@ void CvMLData::set_var_types( const char* str ) { int b2 = (int)strtod( ord, &stopstring); if ( (*stopstring == 0) || (*stopstring != ',' && *stopstring != ']') ) - CV_ERROR( CV_StsBadArg, "types string is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "types string is not correct" ); ord = stopstring + 1; for (int i = b1; i <= b2; i++) { if ( var_types->data.ptr[i] == CV_VAR_CATEGORICAL) - CV_ERROR( CV_StsBadArg, "it`s impossible to assign CV_VAR_ORDERED type to categorical variable" ); + CV_ERROR( cv::Error::StsBadArg, "it`s impossible to assign CV_VAR_ORDERED type to categorical variable" ); var_types->data.ptr[i] = CV_VAR_ORDERED; } set_var_type_count += b2 - b1 + 1; } else - CV_ERROR( CV_StsBadArg, "types string is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "types string is not correct" ); } } while (*stopstring != ']'); if ( stopstring[1] != '\0' && stopstring[1] != ',') - CV_ERROR( CV_StsBadArg, "types string is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "types string is not correct" ); } if ( cat ) // parse cat str { char* stopstring = NULL; if ( cat[3] != '[') - CV_ERROR( CV_StsBadArg, "types string is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "types string is not correct" ); cat += 4; // pass "cat[" do { int b1 = (int)strtod( cat, &stopstring ); if ( *stopstring == 0 || (*stopstring != ',' && *stopstring != ']' && *stopstring != '-') ) - CV_ERROR( CV_StsBadArg, "types string is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "types string is not correct" ); cat = stopstring + 1; if ( (stopstring[0] == ',') || (stopstring[0] == ']')) { @@ -522,25 +522,25 @@ void CvMLData::set_var_types( const char* str ) { int b2 = (int)strtod( cat, &stopstring); if ( (*stopstring == 0) || (*stopstring != ',' && *stopstring != ']') ) - CV_ERROR( CV_StsBadArg, "types string is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "types string is not correct" ); cat = stopstring + 1; for (int i = b1; i <= b2; i++) var_types->data.ptr[i] = CV_VAR_CATEGORICAL; set_var_type_count += b2 - b1 + 1; } else - CV_ERROR( CV_StsBadArg, "types string is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "types string is not correct" ); } } while (*stopstring != ']'); if ( stopstring[1] != '\0' && stopstring[1] != ',') - CV_ERROR( CV_StsBadArg, "types string is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "types string is not correct" ); } if (set_var_type_count != var_count) - CV_ERROR( CV_StsBadArg, "types string is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "types string is not correct" ); __END__; } @@ -553,7 +553,7 @@ const CvMat* CvMLData::get_var_types() uchar *var_types_out_ptr = 0; int avcount, vt_size; if ( !values ) - CV_ERROR( CV_StsInternal, "data is empty" ); + CV_ERROR( cv::Error::StsInternal, "data is empty" ); assert( var_idx_mask ); @@ -597,7 +597,7 @@ const CvMat* CvMLData::get_responses() int var_count = 0; if ( !values ) - CV_ERROR( CV_StsInternal, "data is empty" ); + CV_ERROR( cv::Error::StsInternal, "data is empty" ); var_count = values->cols; if ( response_idx < 0 || response_idx >= var_count ) @@ -621,7 +621,7 @@ void CvMLData::set_train_test_split( const CvTrainTestSplit * spl) int sample_count = 0; if ( !values ) - CV_ERROR( CV_StsInternal, "data is empty" ); + CV_ERROR( cv::Error::StsInternal, "data is empty" ); sample_count = values->rows; @@ -631,14 +631,14 @@ void CvMLData::set_train_test_split( const CvTrainTestSplit * spl) { train_sample_count = spl->train_sample_part.count; if (train_sample_count > sample_count) - CV_ERROR( CV_StsBadArg, "train samples count is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "train samples count is not correct" ); train_sample_count = train_sample_count<=0 ? sample_count : train_sample_count; } else // dtype.train_sample_part_mode == CV_PORTION { train_sample_portion = spl->train_sample_part.portion; if ( train_sample_portion > 1) - CV_ERROR( CV_StsBadArg, "train samples count is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "train samples count is not correct" ); train_sample_portion = train_sample_portion <= FLT_EPSILON || 1 - train_sample_portion <= FLT_EPSILON ? 1 : train_sample_portion; train_sample_count = std::max(1, cvFloor( train_sample_portion * sample_count )); @@ -680,7 +680,7 @@ const CvMat* CvMLData::get_train_sample_idx() const __BEGIN__; if ( !values ) - CV_ERROR( CV_StsInternal, "data is empty" ); + CV_ERROR( cv::Error::StsInternal, "data is empty" ); __END__; return train_sample_idx; @@ -692,7 +692,7 @@ const CvMat* CvMLData::get_test_sample_idx() const __BEGIN__; if ( !values ) - CV_ERROR( CV_StsInternal, "data is empty" ); + CV_ERROR( cv::Error::StsInternal, "data is empty" ); __END__; return test_sample_idx; @@ -704,7 +704,7 @@ void CvMLData::mix_train_and_test_idx() __BEGIN__; if ( !values ) - CV_ERROR( CV_StsInternal, "data is empty" ); + CV_ERROR( cv::Error::StsInternal, "data is empty" ); __END__; if ( !sample_idx) @@ -731,7 +731,7 @@ const CvMat* CvMLData::get_var_idx() int avcount = 0; if ( !values ) - CV_ERROR( CV_StsInternal, "data is empty" ); + CV_ERROR( cv::Error::StsInternal, "data is empty" ); assert( var_idx_mask ); @@ -776,12 +776,12 @@ void CvMLData::change_var_idx( int vi, bool state ) int var_count = 0; if ( !values ) - CV_ERROR( CV_StsInternal, "data is empty" ); + CV_ERROR( cv::Error::StsInternal, "data is empty" ); var_count = values->cols; if ( vi < 0 || vi >= var_count) - CV_ERROR( CV_StsBadArg, "variable index is not correct" ); + CV_ERROR( cv::Error::StsBadArg, "variable index is not correct" ); assert( var_idx_mask ); var_idx_mask->data.ptr[vi] = state; diff --git a/apps/traincascade/old_ml_inner_functions.cpp b/apps/traincascade/old_ml_inner_functions.cpp index ef81da3548..719674f4be 100644 --- a/apps/traincascade/old_ml_inner_functions.cpp +++ b/apps/traincascade/old_ml_inner_functions.cpp @@ -67,7 +67,7 @@ void CvStatModel::save( const char* filename, const char* name ) const __BEGIN__; if( !fs.open( filename, cv::FileStorage::WRITE )) - CV_ERROR( CV_StsError, "Could not open the file storage. Check the path and permissions" ); + CV_ERROR( cv::Error::StsError, "Could not open the file storage. Check the path and permissions" ); write( fs, name ? name : default_model_name ); @@ -87,7 +87,7 @@ void CvStatModel::load( const char* filename, const char* name ) cv::FileNode model_node; if( !fs.open(filename, cv::FileStorage::READ) ) - CV_ERROR( CV_StsError, "Could not open the file storage. Check the path and permissions" ); + CV_ERROR( cv::Error::StsError, "Could not open the file storage. Check the path and permissions" ); if( name ) model_node = fs[ name ]; @@ -107,12 +107,12 @@ void CvStatModel::load( const char* filename, const char* name ) void CvStatModel::write( cv::FileStorage&, const char* ) const { - OPENCV_ERROR( CV_StsNotImplemented, "CvStatModel::write", "" ); + OPENCV_ERROR( cv::Error::StsNotImplemented, "CvStatModel::write", "" ); } void CvStatModel::read( const cv::FileNode& ) { - OPENCV_ERROR( CV_StsNotImplemented, "CvStatModel::read", "" ); + OPENCV_ERROR( cv::Error::StsNotImplemented, "CvStatModel::read", "" ); } CvMat* icvGenerateRandomClusterCenters ( int seed, const CvMat* data, @@ -134,7 +134,7 @@ CvMat* icvGenerateRandomClusterCenters ( int seed, const CvMat* data, { if( _centers && !ICV_IS_MAT_OF_TYPE (_centers, CV_32FC1) ) { - CV_ERROR(CV_StsBadArg,""); + CV_ERROR(cv::Error::StsBadArg,""); } else if( !_centers ) CV_CALL(centers = cvCreateMat (num_of_clusters, dim, CV_32FC1)); @@ -143,16 +143,16 @@ CvMat* icvGenerateRandomClusterCenters ( int seed, const CvMat* data, { if( _centers && !ICV_IS_MAT_OF_TYPE (_centers, CV_64FC1) ) { - CV_ERROR(CV_StsBadArg,""); + CV_ERROR(cv::Error::StsBadArg,""); } else if( !_centers ) CV_CALL(centers = cvCreateMat (num_of_clusters, dim, CV_64FC1)); } else - CV_ERROR (CV_StsBadArg,""); + CV_ERROR (cv::Error::StsBadArg,""); if( num_of_clusters < 1 ) - CV_ERROR (CV_StsBadArg,""); + CV_ERROR (cv::Error::StsBadArg,""); rng = cvRNG(seed); for (i = 0; i < dim; i++) @@ -208,10 +208,10 @@ cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, bool check_for_ int* dsti; if( !CV_IS_MAT(idx_arr) ) - CV_ERROR( CV_StsBadArg, "Invalid index array" ); + CV_ERROR( cv::Error::StsBadArg, "Invalid index array" ); if( idx_arr->rows != 1 && idx_arr->cols != 1 ) - CV_ERROR( CV_StsBadSize, "the index array must be 1-dimensional" ); + CV_ERROR( cv::Error::StsBadSize, "the index array must be 1-dimensional" ); idx_total = idx_arr->rows + idx_arr->cols - 1; srcb = idx_arr->data.ptr; @@ -227,20 +227,20 @@ cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, bool check_for_ // idx_arr is array of 1's and 0's - // i.e. it is a mask of the selected components if( idx_total != data_arr_size ) - CV_ERROR( CV_StsUnmatchedSizes, + CV_ERROR( cv::Error::StsUnmatchedSizes, "Component mask should contain as many elements as the total number of input variables" ); for( i = 0; i < idx_total; i++ ) idx_selected += srcb[i*step] != 0; if( idx_selected == 0 ) - CV_ERROR( CV_StsOutOfRange, "No components/input_variables is selected!" ); + CV_ERROR( cv::Error::StsOutOfRange, "No components/input_variables is selected!" ); break; case CV_32SC1: // idx_arr is array of integer indices of selected components if( idx_total > data_arr_size ) - CV_ERROR( CV_StsOutOfRange, + CV_ERROR( cv::Error::StsOutOfRange, "index array may not contain more elements than the total number of input variables" ); idx_selected = idx_total; // check if sorted already @@ -256,7 +256,7 @@ cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, bool check_for_ } break; default: - CV_ERROR( CV_StsUnsupportedFormat, "Unsupported index array data type " + CV_ERROR( cv::Error::StsUnsupportedFormat, "Unsupported index array data type " "(it should be 8uC1, 8sC1 or 32sC1)" ); } @@ -278,13 +278,13 @@ cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, bool check_for_ qsort( dsti, idx_total, sizeof(dsti[0]), icvCmpIntegers ); if( dsti[0] < 0 || dsti[idx_total-1] >= data_arr_size ) - CV_ERROR( CV_StsOutOfRange, "the index array elements are out of range" ); + CV_ERROR( cv::Error::StsOutOfRange, "the index array elements are out of range" ); if( check_for_duplicates ) { for( i = 1; i < idx_total; i++ ) if( dsti[i] <= dsti[i-1] ) - CV_ERROR( CV_StsBadArg, "There are duplicated index array elements" ); + CV_ERROR( cv::Error::StsBadArg, "There are duplicated index array elements" ); } } @@ -315,19 +315,19 @@ cvPreprocessVarType( const CvMat* var_type, const CvMat* var_idx, uchar* dst; if( !CV_IS_MAT(var_type) ) - CV_ERROR( var_type ? CV_StsBadArg : CV_StsNullPtr, "Invalid or absent var_type array" ); + CV_ERROR( var_type ? cv::Error::StsBadArg : cv::Error::StsNullPtr, "Invalid or absent var_type array" ); if( var_type->rows != 1 && var_type->cols != 1 ) - CV_ERROR( CV_StsBadSize, "var_type array must be 1-dimensional" ); + CV_ERROR( cv::Error::StsBadSize, "var_type array must be 1-dimensional" ); if( !CV_IS_MASK_ARR(var_type)) - CV_ERROR( CV_StsUnsupportedFormat, "type mask must be 8uC1 or 8sC1 array" ); + CV_ERROR( cv::Error::StsUnsupportedFormat, "type mask must be 8uC1 or 8sC1 array" ); tm_size = var_type->rows + var_type->cols - 1; tm_step = var_type->rows == 1 ? 1 : var_type->step/CV_ELEM_SIZE(var_type->type); if( /*tm_size != var_count &&*/ tm_size != var_count + 1 ) - CV_ERROR( CV_StsBadArg, + CV_ERROR( cv::Error::StsBadArg, "type mask must be of + 1 size" ); if( response_type && tm_size > var_count ) @@ -337,9 +337,9 @@ cvPreprocessVarType( const CvMat* var_type, const CvMat* var_idx, { if( !CV_IS_MAT(var_idx) || CV_MAT_TYPE(var_idx->type) != CV_32SC1 || (var_idx->rows != 1 && var_idx->cols != 1) || !CV_IS_MAT_CONT(var_idx->type) ) - CV_ERROR( CV_StsBadArg, "var index array should be continuous 1-dimensional integer vector" ); + CV_ERROR( cv::Error::StsBadArg, "var index array should be continuous 1-dimensional integer vector" ); if( var_idx->rows + var_idx->cols - 1 > var_count ) - CV_ERROR( CV_StsBadSize, "var index array is too large" ); + CV_ERROR( cv::Error::StsBadSize, "var index array is too large" ); //map = var_idx->data.i; var_count = var_idx->rows + var_idx->cols - 1; } @@ -376,18 +376,18 @@ cvPreprocessOrderedResponses( const CvMat* responses, const CvMat* sample_idx, i int sample_count = sample_all; if( !CV_IS_MAT(responses) ) - CV_ERROR( CV_StsBadArg, "Invalid response array" ); + CV_ERROR( cv::Error::StsBadArg, "Invalid response array" ); if( responses->rows != 1 && responses->cols != 1 ) - CV_ERROR( CV_StsBadSize, "Response array must be 1-dimensional" ); + CV_ERROR( cv::Error::StsBadSize, "Response array must be 1-dimensional" ); if( responses->rows + responses->cols - 1 != sample_count ) - CV_ERROR( CV_StsUnmatchedSizes, + CV_ERROR( cv::Error::StsUnmatchedSizes, "Response array must contain as many elements as the total number of samples" ); r_type = CV_MAT_TYPE(responses->type); if( r_type != CV_32FC1 && r_type != CV_32SC1 ) - CV_ERROR( CV_StsUnsupportedFormat, "Unsupported response type" ); + CV_ERROR( cv::Error::StsUnsupportedFormat, "Unsupported response type" ); r_step = responses->step ? responses->step / CV_ELEM_SIZE(responses->type) : 1; @@ -401,9 +401,9 @@ cvPreprocessOrderedResponses( const CvMat* responses, const CvMat* sample_idx, i { if( !CV_IS_MAT(sample_idx) || CV_MAT_TYPE(sample_idx->type) != CV_32SC1 || (sample_idx->rows != 1 && sample_idx->cols != 1) || !CV_IS_MAT_CONT(sample_idx->type) ) - CV_ERROR( CV_StsBadArg, "sample index array should be continuous 1-dimensional integer vector" ); + CV_ERROR( cv::Error::StsBadArg, "sample index array should be continuous 1-dimensional integer vector" ); if( sample_idx->rows + sample_idx->cols - 1 > sample_count ) - CV_ERROR( CV_StsBadSize, "sample index array is too large" ); + CV_ERROR( cv::Error::StsBadSize, "sample index array is too large" ); map = sample_idx->data.i; sample_count = sample_idx->rows + sample_idx->cols - 1; } @@ -466,18 +466,18 @@ cvPreprocessCategoricalResponses( const CvMat* responses, int sample_count = sample_all; if( !CV_IS_MAT(responses) ) - CV_ERROR( CV_StsBadArg, "Invalid response array" ); + CV_ERROR( cv::Error::StsBadArg, "Invalid response array" ); if( responses->rows != 1 && responses->cols != 1 ) - CV_ERROR( CV_StsBadSize, "Response array must be 1-dimensional" ); + CV_ERROR( cv::Error::StsBadSize, "Response array must be 1-dimensional" ); if( responses->rows + responses->cols - 1 != sample_count ) - CV_ERROR( CV_StsUnmatchedSizes, + CV_ERROR( cv::Error::StsUnmatchedSizes, "Response array must contain as many elements as the total number of samples" ); r_type = CV_MAT_TYPE(responses->type); if( r_type != CV_32FC1 && r_type != CV_32SC1 ) - CV_ERROR( CV_StsUnsupportedFormat, "Unsupported response type" ); + CV_ERROR( cv::Error::StsUnsupportedFormat, "Unsupported response type" ); r_step = responses->rows == 1 ? 1 : responses->step / CV_ELEM_SIZE(responses->type); @@ -485,9 +485,9 @@ cvPreprocessCategoricalResponses( const CvMat* responses, { if( !CV_IS_MAT(sample_idx) || CV_MAT_TYPE(sample_idx->type) != CV_32SC1 || (sample_idx->rows != 1 && sample_idx->cols != 1) || !CV_IS_MAT_CONT(sample_idx->type) ) - CV_ERROR( CV_StsBadArg, "sample index array should be continuous 1-dimensional integer vector" ); + CV_ERROR( cv::Error::StsBadArg, "sample index array should be continuous 1-dimensional integer vector" ); if( sample_idx->rows + sample_idx->cols - 1 > sample_count ) - CV_ERROR( CV_StsBadSize, "sample index array is too large" ); + CV_ERROR( cv::Error::StsBadSize, "sample index array is too large" ); map = sample_idx->data.i; sample_count = sample_idx->rows + sample_idx->cols - 1; } @@ -495,7 +495,7 @@ cvPreprocessCategoricalResponses( const CvMat* responses, CV_CALL( out_responses = cvCreateMat( 1, sample_count, CV_32SC1 )); if( !out_response_map ) - CV_ERROR( CV_StsNullPtr, "out_response_map pointer is NULL" ); + CV_ERROR( cv::Error::StsNullPtr, "out_response_map pointer is NULL" ); CV_CALL( response_ptr = (int**)cvAlloc( sample_count*sizeof(response_ptr[0]))); @@ -517,7 +517,7 @@ cvPreprocessCategoricalResponses( const CvMat* responses, { char buf[100]; snprintf( buf, sizeof(buf), "response #%d is not integral", idx ); - CV_ERROR( CV_StsBadArg, buf ); + CV_ERROR( cv::Error::StsBadArg, buf ); } dst[i] = ri; } @@ -531,7 +531,7 @@ cvPreprocessCategoricalResponses( const CvMat* responses, cls_count += *response_ptr[i] != *response_ptr[i-1]; if( cls_count < 2 ) - CV_ERROR( CV_StsBadArg, "There is only a single class" ); + CV_ERROR( cv::Error::StsBadArg, "There is only a single class" ); CV_CALL( *out_response_map = cvCreateMat( 1, cls_count, CV_32SC1 )); @@ -588,7 +588,7 @@ cvGetTrainSamples( const CvMat* train_data, int tflag, const int *s_idx, *v_idx; if( !CV_IS_MAT(train_data) ) - CV_ERROR( CV_StsBadArg, "Invalid or NULL training data matrix" ); + CV_ERROR( cv::Error::StsBadArg, "Invalid or NULL training data matrix" ); var_count = var_idx ? var_idx->cols + var_idx->rows - 1 : tflag == CV_ROW_SAMPLE ? train_data->cols : train_data->rows; @@ -659,18 +659,18 @@ cvCheckTrainData( const CvMat* train_data, int tflag, // check parameter types and sizes if( !CV_IS_MAT(train_data) || CV_MAT_TYPE(train_data->type) != CV_32FC1 ) - CV_ERROR( CV_StsBadArg, "train data must be floating-point matrix" ); + CV_ERROR( cv::Error::StsBadArg, "train data must be floating-point matrix" ); if( missing_mask ) { if( !CV_IS_MAT(missing_mask) || !CV_IS_MASK_ARR(missing_mask) || !CV_ARE_SIZES_EQ(train_data, missing_mask) ) - CV_ERROR( CV_StsBadArg, + CV_ERROR( cv::Error::StsBadArg, "missing value mask must be 8-bit matrix of the same size as training data" ); } if( tflag != CV_ROW_SAMPLE && tflag != CV_COL_SAMPLE ) - CV_ERROR( CV_StsBadArg, + CV_ERROR( cv::Error::StsBadArg, "Unknown training data layout (must be CV_ROW_SAMPLE or CV_COL_SAMPLE)" ); if( var_all ) @@ -736,7 +736,7 @@ cvPrepareTrainData( const char* /*funcname*/, __BEGIN__; if( !out_train_samples ) - CV_ERROR( CV_StsBadArg, "output pointer to train samples is NULL" ); + CV_ERROR( cv::Error::StsBadArg, "output pointer to train samples is NULL" ); CV_CALL( cvCheckTrainData( train_data, tflag, 0, &var_all, &sample_all )); @@ -748,7 +748,7 @@ cvPrepareTrainData( const char* /*funcname*/, if( responses ) { if( !out_responses ) - CV_ERROR( CV_StsNullPtr, "output response pointer is NULL" ); + CV_ERROR( cv::Error::StsNullPtr, "output response pointer is NULL" ); if( response_type == CV_VAR_NUMERICAL ) { @@ -841,10 +841,10 @@ cvSortSamplesByClasses( const float** samples, const CvMat* classes, int i, k = 0, sample_count; if( !samples || !classes || !class_ranges ) - CV_ERROR( CV_StsNullPtr, "INTERNAL ERROR: some of the args are NULL pointers" ); + CV_ERROR( cv::Error::StsNullPtr, "INTERNAL ERROR: some of the args are NULL pointers" ); if( classes->rows != 1 || CV_MAT_TYPE(classes->type) != CV_32SC1 ) - CV_ERROR( CV_StsBadArg, "classes array must be a single row of integers" ); + CV_ERROR( cv::Error::StsBadArg, "classes array must be a single row of integers" ); sample_count = classes->cols; CV_CALL( pairs = (CvSampleResponsePair*)cvAlloc( (sample_count+1)*sizeof(pairs[0]))); @@ -901,45 +901,45 @@ cvPreparePredictData( const CvArr* _sample, int dims_all, int vec_size; if( !is_sparse && !CV_IS_MAT(sample) ) - CV_ERROR( !sample ? CV_StsNullPtr : CV_StsBadArg, "The sample is not a valid vector" ); + CV_ERROR( !sample ? cv::Error::StsNullPtr : cv::Error::StsBadArg, "The sample is not a valid vector" ); if( cvGetElemType( sample ) != CV_32FC1 ) - CV_ERROR( CV_StsUnsupportedFormat, "Input sample must have 32fC1 type" ); + CV_ERROR( cv::Error::StsUnsupportedFormat, "Input sample must have 32fC1 type" ); CV_CALL( d = cvGetDims( sample, sizes )); if( !((is_sparse && d == 1) || (!is_sparse && d == 2 && (sample->rows == 1 || sample->cols == 1))) ) - CV_ERROR( CV_StsBadSize, "Input sample must be 1-dimensional vector" ); + CV_ERROR( cv::Error::StsBadSize, "Input sample must be 1-dimensional vector" ); if( d == 1 ) sizes[1] = 1; if( sizes[0] + sizes[1] - 1 != dims_all ) - CV_ERROR( CV_StsUnmatchedSizes, + CV_ERROR( cv::Error::StsUnmatchedSizes, "The sample size is different from what has been used for training" ); if( !_row_sample ) - CV_ERROR( CV_StsNullPtr, "INTERNAL ERROR: The row_sample pointer is NULL" ); + CV_ERROR( cv::Error::StsNullPtr, "INTERNAL ERROR: The row_sample pointer is NULL" ); if( comp_idx && (!CV_IS_MAT(comp_idx) || comp_idx->rows != 1 || CV_MAT_TYPE(comp_idx->type) != CV_32SC1) ) - CV_ERROR( CV_StsBadArg, "INTERNAL ERROR: invalid comp_idx" ); + CV_ERROR( cv::Error::StsBadArg, "INTERNAL ERROR: invalid comp_idx" ); dims_selected = comp_idx ? comp_idx->cols : dims_all; if( prob ) { if( !CV_IS_MAT(prob) ) - CV_ERROR( CV_StsBadArg, "The output matrix of probabilities is invalid" ); + CV_ERROR( cv::Error::StsBadArg, "The output matrix of probabilities is invalid" ); if( (prob->rows != 1 && prob->cols != 1) || (CV_MAT_TYPE(prob->type) != CV_32FC1 && CV_MAT_TYPE(prob->type) != CV_64FC1) ) - CV_ERROR( CV_StsBadSize, + CV_ERROR( cv::Error::StsBadSize, "The matrix of probabilities must be 1-dimensional vector of 32fC1 type" ); if( prob->rows + prob->cols - 1 != class_count ) - CV_ERROR( CV_StsUnmatchedSizes, + CV_ERROR( cv::Error::StsUnmatchedSizes, "The vector of probabilities must contain as many elements as " "the number of classes in the training set" ); } @@ -1071,7 +1071,7 @@ icvConvertDataToSparse( const uchar* src, int src_step, int src_type, dst_type = CV_MAT_TYPE(dst_type); if( CV_MAT_CN(src_type) != 1 || CV_MAT_CN(dst_type) != 1 ) - CV_ERROR( CV_StsUnsupportedFormat, "The function supports only single-channel arrays" ); + CV_ERROR( cv::Error::StsUnsupportedFormat, "The function supports only single-channel arrays" ); if( src_step == 0 ) src_step = CV_ELEM_SIZE(src_type); @@ -1134,7 +1134,7 @@ icvConvertDataToSparse( const uchar* src, int src_step, int src_type, ((float*)_dst)[j] = (float)((double*)src)[j]; } else - CV_ERROR( CV_StsUnsupportedFormat, "Unsupported combination of input and output vectors" ); + CV_ERROR( cv::Error::StsUnsupportedFormat, "Unsupported combination of input and output vectors" ); __END__; } @@ -1154,15 +1154,15 @@ cvWritebackLabels( const CvMat* labels, CvMat* dst_labels, int samples_selected = samples_all, dims_selected = dims_all; if( dst_labels && !CV_IS_MAT(dst_labels) ) - CV_ERROR( CV_StsBadArg, "Array of output labels is not a valid matrix" ); + CV_ERROR( cv::Error::StsBadArg, "Array of output labels is not a valid matrix" ); if( dst_centers ) if( !ICV_IS_MAT_OF_TYPE(dst_centers, CV_32FC1) && !ICV_IS_MAT_OF_TYPE(dst_centers, CV_64FC1) ) - CV_ERROR( CV_StsBadArg, "Array of cluster centers is not a valid matrix" ); + CV_ERROR( cv::Error::StsBadArg, "Array of cluster centers is not a valid matrix" ); if( dst_probs && !CV_IS_MAT(dst_probs) ) - CV_ERROR( CV_StsBadArg, "Probability matrix is not valid" ); + CV_ERROR( cv::Error::StsBadArg, "Probability matrix is not valid" ); if( sample_idx ) { @@ -1179,15 +1179,15 @@ cvWritebackLabels( const CvMat* labels, CvMat* dst_labels, if( dst_labels && (!labels || labels->data.ptr != dst_labels->data.ptr) ) { if( !labels ) - CV_ERROR( CV_StsNullPtr, "NULL labels" ); + CV_ERROR( cv::Error::StsNullPtr, "NULL labels" ); CV_ASSERT( labels->rows == 1 ); if( dst_labels->rows != 1 && dst_labels->cols != 1 ) - CV_ERROR( CV_StsBadSize, "Array of output labels should be 1d vector" ); + CV_ERROR( cv::Error::StsBadSize, "Array of output labels should be 1d vector" ); if( dst_labels->rows + dst_labels->cols - 1 != samples_all ) - CV_ERROR( CV_StsUnmatchedSizes, + CV_ERROR( cv::Error::StsUnmatchedSizes, "Size of vector of output labels is not equal to the total number of input samples" ); CV_ASSERT( labels->cols == samples_selected ); @@ -1202,13 +1202,13 @@ cvWritebackLabels( const CvMat* labels, CvMat* dst_labels, int i; if( !centers ) - CV_ERROR( CV_StsNullPtr, "NULL centers" ); + CV_ERROR( cv::Error::StsNullPtr, "NULL centers" ); if( centers->rows != dst_centers->rows ) - CV_ERROR( CV_StsUnmatchedSizes, "Invalid number of rows in matrix of output centers" ); + CV_ERROR( cv::Error::StsUnmatchedSizes, "Invalid number of rows in matrix of output centers" ); if( dst_centers->cols != dims_all ) - CV_ERROR( CV_StsUnmatchedSizes, + CV_ERROR( cv::Error::StsUnmatchedSizes, "Number of columns in matrix of output centers is " "not equal to the total number of components in the input samples" ); @@ -1223,13 +1223,13 @@ cvWritebackLabels( const CvMat* labels, CvMat* dst_labels, if( dst_probs && (!probs || probs->data.ptr != dst_probs->data.ptr) ) { if( !probs ) - CV_ERROR( CV_StsNullPtr, "NULL probs" ); + CV_ERROR( cv::Error::StsNullPtr, "NULL probs" ); if( probs->cols != dst_probs->cols ) - CV_ERROR( CV_StsUnmatchedSizes, "Invalid number of columns in output probability matrix" ); + CV_ERROR( cv::Error::StsUnmatchedSizes, "Invalid number of columns in output probability matrix" ); if( dst_probs->rows != samples_all ) - CV_ERROR( CV_StsUnmatchedSizes, + CV_ERROR( cv::Error::StsUnmatchedSizes, "Number of rows in output probability matrix is " "not equal to the total number of input samples" ); @@ -1273,29 +1273,29 @@ cvStatModelMultiPredict( const CvStatModel* stat_model, CvMat* probs1 = probs ? &probs_part : 0; if( !CV_IS_STAT_MODEL(stat_model) ) - CV_ERROR( !stat_model ? CV_StsNullPtr : CV_StsBadArg, "Invalid statistical model" ); + CV_ERROR( !stat_model ? cv::Error::StsNullPtr : cv::Error::StsBadArg, "Invalid statistical model" ); if( !stat_model->predict ) - CV_ERROR( CV_StsNotImplemented, "There is no \"predict\" method" ); + CV_ERROR( cv::Error::StsNotImplemented, "There is no \"predict\" method" ); if( !predict_input || !predict_output ) - CV_ERROR( CV_StsNullPtr, "NULL input or output matrices" ); + CV_ERROR( cv::Error::StsNullPtr, "NULL input or output matrices" ); if( !is_sparse && !CV_IS_MAT(predict_input) ) - CV_ERROR( CV_StsBadArg, "predict_input should be a matrix or a sparse matrix" ); + CV_ERROR( cv::Error::StsBadArg, "predict_input should be a matrix or a sparse matrix" ); if( !CV_IS_MAT(predict_output) ) - CV_ERROR( CV_StsBadArg, "predict_output should be a matrix" ); + CV_ERROR( cv::Error::StsBadArg, "predict_output should be a matrix" ); type = cvGetElemType( predict_input ); if( type != CV_32FC1 || (CV_MAT_TYPE(predict_output->type) != CV_32FC1 && CV_MAT_TYPE(predict_output->type) != CV_32SC1 )) - CV_ERROR( CV_StsUnsupportedFormat, "The input or output matrix has unsupported format" ); + CV_ERROR( cv::Error::StsUnsupportedFormat, "The input or output matrix has unsupported format" ); CV_CALL( d = cvGetDims( predict_input, sizes )); if( d > 2 ) - CV_ERROR( CV_StsBadSize, "The input matrix should be 1- or 2-dimensional" ); + CV_ERROR( cv::Error::StsBadSize, "The input matrix should be 1- or 2-dimensional" ); if( !tflag ) { @@ -1311,30 +1311,30 @@ cvStatModelMultiPredict( const CvStatModel* stat_model, if( sample_idx ) { if( !CV_IS_MAT(sample_idx) ) - CV_ERROR( CV_StsBadArg, "Invalid sample_idx matrix" ); + CV_ERROR( cv::Error::StsBadArg, "Invalid sample_idx matrix" ); if( sample_idx->cols != 1 && sample_idx->rows != 1 ) - CV_ERROR( CV_StsBadSize, "sample_idx must be 1-dimensional matrix" ); + CV_ERROR( cv::Error::StsBadSize, "sample_idx must be 1-dimensional matrix" ); samples_selected = sample_idx->rows + sample_idx->cols - 1; if( CV_MAT_TYPE(sample_idx->type) == CV_32SC1 ) { if( samples_selected > samples_all ) - CV_ERROR( CV_StsBadSize, "sample_idx is too large vector" ); + CV_ERROR( cv::Error::StsBadSize, "sample_idx is too large vector" ); } else if( samples_selected != samples_all ) - CV_ERROR( CV_StsUnmatchedSizes, "sample_idx has incorrect size" ); + CV_ERROR( cv::Error::StsUnmatchedSizes, "sample_idx has incorrect size" ); sample_idx_step = sample_idx->step ? sample_idx->step / CV_ELEM_SIZE(sample_idx->type) : 1; } if( predict_output->rows != 1 && predict_output->cols != 1 ) - CV_ERROR( CV_StsBadSize, "predict_output should be a 1-dimensional matrix" ); + CV_ERROR( cv::Error::StsBadSize, "predict_output should be a 1-dimensional matrix" ); if( predict_output->rows + predict_output->cols - 1 != samples_all ) - CV_ERROR( CV_StsUnmatchedSizes, "predict_output and predict_input have uncoordinated sizes" ); + CV_ERROR( cv::Error::StsUnmatchedSizes, "predict_output and predict_input have uncoordinated sizes" ); predict_output_step = predict_output->step ? predict_output->step / CV_ELEM_SIZE(predict_output->type) : 1; @@ -1342,14 +1342,14 @@ cvStatModelMultiPredict( const CvStatModel* stat_model, if( probs ) { if( !CV_IS_MAT(probs) ) - CV_ERROR( CV_StsBadArg, "Invalid matrix of probabilities" ); + CV_ERROR( cv::Error::StsBadArg, "Invalid matrix of probabilities" ); if( probs->rows != samples_all ) - CV_ERROR( CV_StsUnmatchedSizes, + CV_ERROR( cv::Error::StsUnmatchedSizes, "matrix of probabilities must have as many rows as the total number of samples" ); if( CV_MAT_TYPE(probs->type) != CV_32FC1 ) - CV_ERROR( CV_StsUnsupportedFormat, "matrix of probabilities must have 32fC1 type" ); + CV_ERROR( cv::Error::StsUnsupportedFormat, "matrix of probabilities must have 32fC1 type" ); } if( is_sparse ) @@ -1414,7 +1414,7 @@ cvStatModelMultiPredict( const CvStatModel* stat_model, { idx = sample_idx->data.i[i*sample_idx_step]; if( (unsigned)idx >= (unsigned)samples_all ) - CV_ERROR( CV_StsOutOfRange, "Some of sample_idx elements are out of range" ); + CV_ERROR( cv::Error::StsOutOfRange, "Some of sample_idx elements are out of range" ); } else if( CV_MAT_TYPE(sample_idx->type) == CV_8UC1 && sample_idx->data.ptr[i*sample_idx_step] == 0 ) @@ -1494,7 +1494,7 @@ void cvCombineResponseMaps (CvMat* _responses, (!ICV_IS_MAT_OF_TYPE (old_response_map, CV_32SC1)) || (!ICV_IS_MAT_OF_TYPE (new_response_map, CV_32SC1))) { - CV_ERROR (CV_StsBadArg, "Some of input arguments is not the CvMat") + CV_ERROR (cv::Error::StsBadArg, "Some of input arguments is not the CvMat") } // Prepare sorted responses. diff --git a/apps/traincascade/old_ml_precomp.hpp b/apps/traincascade/old_ml_precomp.hpp index 6702e5b59f..592739c65d 100644 --- a/apps/traincascade/old_ml_precomp.hpp +++ b/apps/traincascade/old_ml_precomp.hpp @@ -70,7 +70,7 @@ /* Convert matrix to vector */ #define ICV_MAT2VEC( mat, vdata, vstep, num ) \ if( MIN( (mat).rows, (mat).cols ) != 1 ) \ - CV_ERROR( CV_StsBadArg, "" ); \ + CV_ERROR( cv::Error::StsBadArg, "" ); \ (vdata) = ((mat).data.ptr); \ if( (mat).rows == 1 ) \ { \ @@ -142,7 +142,7 @@ #define ICV_TRAIN_DATA_REQUIRED( param, flags ) \ if( !ICV_IS_MAT_OF_TYPE( (param), CV_32FC1 ) ) \ { \ - CV_ERROR( CV_StsBadArg, "Invalid " #param " parameter" ); \ + CV_ERROR( cv::Error::StsBadArg, "Invalid " #param " parameter" ); \ } \ else \ { \ @@ -154,21 +154,21 @@ #define ICV_TRAIN_CLASSES_REQUIRED( param ) \ if( !ICV_IS_MAT_OF_TYPE( (param), CV_32FC1 ) ) \ { \ - CV_ERROR( CV_StsBadArg, "Invalid " #param " parameter" ); \ + CV_ERROR( cv::Error::StsBadArg, "Invalid " #param " parameter" ); \ } \ else \ { \ ICV_MAT2VEC( *(param), classes, clstep, ncl ); \ if( m != ncl ) \ { \ - CV_ERROR( CV_StsBadArg, "Unmatched sizes" ); \ + CV_ERROR( cv::Error::StsBadArg, "Unmatched sizes" ); \ } \ } #define ICV_ARG_NULL( param ) \ if( (param) != NULL ) \ { \ - CV_ERROR( CV_StsBadArg, #param " parameter must be NULL" ); \ + CV_ERROR( cv::Error::StsBadArg, #param " parameter must be NULL" ); \ } #define ICV_MISSED_MEASUREMENTS_OPTIONAL( param, flags ) \ @@ -176,14 +176,14 @@ { \ if( !ICV_IS_MAT_OF_TYPE( param, CV_8UC1 ) ) \ { \ - CV_ERROR( CV_StsBadArg, "Invalid " #param " parameter" ); \ + CV_ERROR( cv::Error::StsBadArg, "Invalid " #param " parameter" ); \ } \ else \ { \ ICV_RAWDATA( *(param), (flags), missed, msstep, mcstep, mm, mn ); \ if( mm != m || mn != n ) \ { \ - CV_ERROR( CV_StsBadArg, "Unmatched sizes" ); \ + CV_ERROR( cv::Error::StsBadArg, "Unmatched sizes" ); \ } \ } \ } @@ -193,13 +193,13 @@ { \ if( !ICV_IS_MAT_OF_TYPE( param, CV_32SC1 ) ) \ { \ - CV_ERROR( CV_StsBadArg, "Invalid " #param " parameter" ); \ + CV_ERROR( cv::Error::StsBadArg, "Invalid " #param " parameter" ); \ } \ else \ { \ ICV_MAT2VEC( *(param), cidx, cistep, k ); \ if( k > n ) \ - CV_ERROR( CV_StsBadArg, "Invalid " #param " parameter" ); \ + CV_ERROR( cv::Error::StsBadArg, "Invalid " #param " parameter" ); \ } \ } @@ -208,13 +208,13 @@ { \ if( !ICV_IS_MAT_OF_TYPE( param, CV_32SC1 ) ) \ { \ - CV_ERROR( CV_StsBadArg, "Invalid " #param " parameter" ); \ + CV_ERROR( cv::Error::StsBadArg, "Invalid " #param " parameter" ); \ } \ else \ { \ ICV_MAT2VEC( *sampleIdx, sidx, sistep, l ); \ if( l > m ) \ - CV_ERROR( CV_StsBadArg, "Invalid " #param " parameter" ); \ + CV_ERROR( cv::Error::StsBadArg, "Invalid " #param " parameter" ); \ } \ } diff --git a/apps/traincascade/old_ml_tree.cpp b/apps/traincascade/old_ml_tree.cpp index 55052ed532..7085debd89 100644 --- a/apps/traincascade/old_ml_tree.cpp +++ b/apps/traincascade/old_ml_tree.cpp @@ -93,17 +93,17 @@ bool CvDTreeTrainData::set_params( const CvDTreeParams& _params ) params = _params; if( params.max_categories < 2 ) - CV_ERROR( CV_StsOutOfRange, "params.max_categories should be >= 2" ); + CV_ERROR( cv::Error::StsOutOfRange, "params.max_categories should be >= 2" ); params.max_categories = MIN( params.max_categories, 15 ); if( params.max_depth < 0 ) - CV_ERROR( CV_StsOutOfRange, "params.max_depth should be >= 0" ); + CV_ERROR( cv::Error::StsOutOfRange, "params.max_depth should be >= 0" ); params.max_depth = MIN( params.max_depth, 25 ); params.min_sample_count = MAX(params.min_sample_count,1); if( params.cv_folds < 0 ) - CV_ERROR( CV_StsOutOfRange, + CV_ERROR( cv::Error::StsOutOfRange, "params.cv_folds should be =0 (the tree is not pruned) " "or n>0 (tree is pruned using n-fold cross-validation)" ); @@ -111,7 +111,7 @@ bool CvDTreeTrainData::set_params( const CvDTreeParams& _params ) params.cv_folds = 0; if( params.regression_accuracy < 0 ) - CV_ERROR( CV_StsOutOfRange, "params.regression_accuracy should be >= 0" ); + CV_ERROR( cv::Error::StsOutOfRange, "params.regression_accuracy should be >= 0" ); ok = true; @@ -183,7 +183,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag, cvNorm( data->var_type, var_type, CV_C ) < FLT_EPSILON && cvNorm( data->cat_count, cat_count, CV_C ) < FLT_EPSILON && cvNorm( data->cat_map, cat_map, CV_C ) < FLT_EPSILON) ) - CV_ERROR( CV_StsBadArg, + CV_ERROR( cv::Error::StsBadArg, "The new training data must have the same types and the input and output variables " "and the same categories for categorical variables" ); @@ -264,7 +264,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag, CV_MAT_TYPE(_responses->type) != CV_32FC1) || (_responses->rows != 1 && _responses->cols != 1) || _responses->rows + _responses->cols - 1 != sample_all ) - CV_ERROR( CV_StsBadArg, "The array of _responses must be an integer or " + CV_ERROR( cv::Error::StsBadArg, "The array of _responses must be an integer or " "floating-point vector containing as many elements as " "the total number of samples in the training data matrix" ); @@ -317,7 +317,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag, if ((uint64)effective_buf_width * (uint64)effective_buf_height != effective_buf_size) { - CV_Error(CV_StsBadArg, "The memory buffer cannot be allocated since its size exceeds integer fields limit"); + CV_Error(cv::Error::StsBadArg, "The memory buffer cannot be allocated since its size exceeds integer fields limit"); } @@ -360,7 +360,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag, if( cv_n ) { if( sample_count < cv_n*MAX(params.min_sample_count,10) ) - CV_ERROR( CV_StsOutOfRange, + CV_ERROR( cv::Error::StsOutOfRange, "The many folds in cross-validation for such a small dataset" ); cv_size = cvAlign( cv_n*(sizeof(int) + sizeof(double)*2), sizeof(double) ); @@ -444,7 +444,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag, { snprintf( err, sizeof(err), "%d-th value of %d-th (categorical) " "variable is not an integer", i, vi ); - CV_ERROR( CV_StsBadArg, err ); + CV_ERROR( cv::Error::StsBadArg, err ); } } @@ -452,7 +452,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag, { snprintf( err, sizeof(err), "%d-th value of %d-th (categorical) " "variable is too large", i, vi ); - CV_ERROR( CV_StsBadArg, err ); + CV_ERROR( cv::Error::StsBadArg, err ); } num_valid++; } @@ -559,7 +559,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag, { snprintf( err, sizeof(err), "%d-th value of %d-th (ordered) " "variable (=%g) is too large", i, vi, val ); - CV_ERROR( CV_StsBadArg, err ); + CV_ERROR( cv::Error::StsBadArg, err ); } num_valid++; } @@ -652,7 +652,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag, { double val = have_priors ? params.priors[i] : 1.; if( val <= 0 ) - CV_ERROR( CV_StsOutOfRange, "Every class weight should be positive" ); + CV_ERROR( cv::Error::StsOutOfRange, "Every class weight should be positive" ); priors->data.db[i] = val; sum += val; } @@ -705,7 +705,7 @@ CvDTreeNode* CvDTreeTrainData::subsample_data( const CvMat* _subsample_idx ) __BEGIN__; if( !data_root ) - CV_ERROR( CV_StsError, "No training data has been set" ); + CV_ERROR( cv::Error::StsError, "No training data has been set" ); if( _subsample_idx ) { @@ -1396,7 +1396,7 @@ void CvDTreeTrainData::read_params( const cv::FileNode& node ) auto tmat = cvMat( tparams_node[ "priors" ].mat() ); priors = cvCloneMat( &tmat ); if( !CV_IS_MAT(priors) ) - CV_ERROR( CV_StsParseError, "priors must stored as a matrix" ); + CV_ERROR( cv::Error::StsParseError, "priors must stored as a matrix" ); priors_mult = cvCloneMat( priors ); } } @@ -1413,12 +1413,12 @@ void CvDTreeTrainData::read_params( const cv::FileNode& node ) (var_idx->cols != 1 && var_idx->rows != 1) || var_idx->cols + var_idx->rows - 1 != var_count || CV_MAT_TYPE(var_idx->type) != CV_32SC1 ) - CV_ERROR( CV_StsParseError, + CV_ERROR( cv::Error::StsParseError, "var_idx (if exist) must be valid 1d integer vector containing elements" ); for( vi = 0; vi < var_count; vi++ ) if( (unsigned)var_idx->data.i[vi] >= (unsigned)var_all ) - CV_ERROR( CV_StsOutOfRange, "some of var_idx elements are out of range" ); + CV_ERROR( cv::Error::StsOutOfRange, "some of var_idx elements are out of range" ); } ////// read var type @@ -1434,7 +1434,7 @@ void CvDTreeTrainData::read_params( const cv::FileNode& node ) { if( vartype_node.empty() || !vartype_node.isSeq() || vartype_node.size() != (size_t) var_count ) - CV_ERROR( CV_StsParseError, "var_type must exist and be a sequence of 0's and 1's" ); + CV_ERROR( cv::Error::StsParseError, "var_type must exist and be a sequence of 0's and 1's" ); reader = vartype_node.begin(); @@ -1442,7 +1442,7 @@ void CvDTreeTrainData::read_params( const cv::FileNode& node ) { cv::FileNode n = *reader; if( !n.isInt() || ((int) n & ~1) ) - CV_ERROR( CV_StsParseError, "var_type must exist and be a sequence of 0's and 1's" ); + CV_ERROR( cv::Error::StsParseError, "var_type must exist and be a sequence of 0's and 1's" ); var_type->data.i[vi] = (int) n ? cat_var_count++ : ord_var_count--; reader++; } @@ -1468,7 +1468,7 @@ void CvDTreeTrainData::read_params( const cv::FileNode& node ) cat_count->cols + cat_count->rows - 1 != cat_var_count + is_classifier || (cat_map->cols != 1 && cat_map->rows != 1) || CV_MAT_TYPE(cat_map->type) != CV_32SC1 ) - CV_ERROR( CV_StsParseError, + CV_ERROR( cv::Error::StsParseError, "Both cat_count and cat_map must exist and be valid 1d integer vectors of an appropriate size" ); ccount = cat_var_count + is_classifier; @@ -1481,13 +1481,13 @@ void CvDTreeTrainData::read_params( const cv::FileNode& node ) { int val = cat_count->data.i[vi]; if( val <= 0 ) - CV_ERROR( CV_StsOutOfRange, "some of cat_count elements are out of range" ); + CV_ERROR( cv::Error::StsOutOfRange, "some of cat_count elements are out of range" ); max_c_count = MAX( max_c_count, val ); cat_ofs->data.i[vi+1] = total_c_count += val; } if( cat_map->cols + cat_map->rows - 1 != total_c_count ) - CV_ERROR( CV_StsBadSize, + CV_ERROR( cv::Error::StsBadSize, "cat_map vector length is not equal to the total number of categories in all categorical vars" ); } @@ -3631,13 +3631,13 @@ CvDTreeNode* CvDTree::predict( const CvMat* _sample, CvDTreeNode* node = root; if( !node ) - CV_Error( CV_StsError, "The tree has not been trained yet" ); + CV_Error( cv::Error::StsError, "The tree has not been trained yet" ); if( !CV_IS_MAT(_sample) || CV_MAT_TYPE(_sample->type) != CV_32FC1 || (_sample->cols != 1 && _sample->rows != 1) || (_sample->cols + _sample->rows - 1 != data->var_all && !preprocessed_input) || (_sample->cols + _sample->rows - 1 != data->var_count && preprocessed_input) ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "the input sample must be 1d floating-point vector with the same " "number of elements as the total number of variables used for training" ); @@ -3656,7 +3656,7 @@ CvDTreeNode* CvDTree::predict( const CvMat* _sample, { if( !CV_IS_MAT(_missing) || !CV_IS_MASK_ARR(_missing) || !CV_ARE_SIZES_EQ(_missing, _sample) ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "the missing data mask must be 8-bit vector of the same size as input sample" ); m = _missing->data.ptr; mstep = CV_IS_MAT_CONT(_missing->type) ? 1 : _missing->step/sizeof(m[0]); @@ -3696,7 +3696,7 @@ CvDTreeNode* CvDTree::predict( const CvMat* _sample, int ival = cvRound(val); if( ival != val ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "one of input categorical variable is not an integer" ); while( a < b ) @@ -3936,11 +3936,11 @@ CvDTreeSplit* CvDTree::read_split( const cv::FileNode& fnode ) int vi, ci; if( fnode.empty() || !fnode.isMap() ) - CV_ERROR( CV_StsParseError, "some of the splits are not stored properly" ); + CV_ERROR( cv::Error::StsParseError, "some of the splits are not stored properly" ); vi = fnode[ "var" ].empty() ? -1 : (int) fnode[ "var" ]; if( (unsigned)vi >= (unsigned)data->var_count ) - CV_ERROR( CV_StsOutOfRange, "Split variable index is out of range" ); + CV_ERROR( cv::Error::StsOutOfRange, "Split variable index is out of range" ); ci = data->get_var_type(vi); if( ci >= 0 ) // split on categorical var @@ -3957,14 +3957,14 @@ CvDTreeSplit* CvDTree::read_split( const cv::FileNode& fnode ) } if( inseq.empty() || (!inseq.isSeq() && !inseq.isInt())) - CV_ERROR( CV_StsParseError, + CV_ERROR( cv::Error::StsParseError, "Either 'in' or 'not_in' tags should be inside a categorical split data" ); if( inseq.isInt() ) { val = (int) inseq; if( (unsigned)val >= (unsigned)n ) - CV_ERROR( CV_StsOutOfRange, "some of in/not_in elements are out of range" ); + CV_ERROR( cv::Error::StsOutOfRange, "some of in/not_in elements are out of range" ); split->subset[val >> 5] |= 1 << (val & 31); } @@ -3977,7 +3977,7 @@ CvDTreeSplit* CvDTree::read_split( const cv::FileNode& fnode ) cv::FileNode inode = *reader; val = (int) inode; if( !inode.isInt() || (unsigned)val >= (unsigned)n ) - CV_ERROR( CV_StsOutOfRange, "some of in/not_in elements are out of range" ); + CV_ERROR( cv::Error::StsOutOfRange, "some of in/not_in elements are out of range" ); split->subset[val >> 5] |= 1 << (val & 31); reader++; @@ -4025,12 +4025,12 @@ CvDTreeNode* CvDTree::read_node( const cv::FileNode& fnode, CvDTreeNode* parent int i, depth; if( fnode.empty() || !fnode.isMap() ) - CV_ERROR( CV_StsParseError, "some of the tree elements are not stored properly" ); + CV_ERROR( cv::Error::StsParseError, "some of the tree elements are not stored properly" ); CV_CALL( node = data->new_node( parent, 0, 0, 0 )); depth = fnode[ "depth" ].empty() ? -1 : (int) fnode[ "depth" ]; if( depth != node->depth ) - CV_ERROR( CV_StsParseError, "incorrect node depth" ); + CV_ERROR( cv::Error::StsParseError, "incorrect node depth" ); node->sample_count = (int) fnode[ "sample_count" ]; node->value = (double) fnode[ "value" ]; @@ -4051,7 +4051,7 @@ CvDTreeNode* CvDTree::read_node( const cv::FileNode& fnode, CvDTreeNode* parent CvDTreeSplit* last_split = 0; if( !splits.isSeq() ) - CV_ERROR( CV_StsParseError, "splits tag must stored as a sequence" ); + CV_ERROR( cv::Error::StsParseError, "splits tag must stored as a sequence" ); reader = splits.begin(); for( i = 0; i < (int) (*reader).size(); i++ ) @@ -4137,7 +4137,7 @@ void CvDTree::read( const cv::FileNode& node, CvDTreeTrainData* _data ) tree_nodes = node[ "nodes" ]; if( tree_nodes.empty() || !tree_nodes.isSeq() ) - CV_ERROR( CV_StsParseError, "nodes tag is missing" ); + CV_ERROR( cv::Error::StsParseError, "nodes tag is missing" ); pruned_tree_idx = node[ "best_tree_idx" ].empty() ? -1 : node[ "best_tree_idx" ]; read_tree_nodes( tree_nodes ); diff --git a/modules/calib3d/src/calibration.cpp b/modules/calib3d/src/calibration.cpp index d488e4569e..24d2875fdd 100644 --- a/modules/calib3d/src/calibration.cpp +++ b/modules/calib3d/src/calibration.cpp @@ -254,32 +254,32 @@ CV_IMPL int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian ) CvMat matJ = cvMat( 3, 9, CV_64F, J ); if( !CV_IS_MAT(src) ) - CV_Error( !src ? CV_StsNullPtr : CV_StsBadArg, "Input argument is not a valid matrix" ); + CV_Error( !src ? cv::Error::StsNullPtr : cv::Error::StsBadArg, "Input argument is not a valid matrix" ); if( !CV_IS_MAT(dst) ) - CV_Error( !dst ? CV_StsNullPtr : CV_StsBadArg, + CV_Error( !dst ? cv::Error::StsNullPtr : cv::Error::StsBadArg, "The first output argument is not a valid matrix" ); int depth = CV_MAT_DEPTH(src->type); int elem_size = CV_ELEM_SIZE(depth); if( depth != CV_32F && depth != CV_64F ) - CV_Error( CV_StsUnsupportedFormat, "The matrices must have 32f or 64f data type" ); + CV_Error( cv::Error::StsUnsupportedFormat, "The matrices must have 32f or 64f data type" ); if( !CV_ARE_DEPTHS_EQ(src, dst) ) - CV_Error( CV_StsUnmatchedFormats, "All the matrices must have the same data type" ); + CV_Error( cv::Error::StsUnmatchedFormats, "All the matrices must have the same data type" ); if( jacobian ) { if( !CV_IS_MAT(jacobian) ) - CV_Error( CV_StsBadArg, "Jacobian is not a valid matrix" ); + CV_Error( cv::Error::StsBadArg, "Jacobian is not a valid matrix" ); if( !CV_ARE_DEPTHS_EQ(src, jacobian) || CV_MAT_CN(jacobian->type) != 1 ) - CV_Error( CV_StsUnmatchedFormats, "Jacobian must have 32fC1 or 64fC1 datatype" ); + CV_Error( cv::Error::StsUnmatchedFormats, "Jacobian must have 32fC1 or 64fC1 datatype" ); if( (jacobian->rows != 9 || jacobian->cols != 3) && (jacobian->rows != 3 || jacobian->cols != 9)) - CV_Error( CV_StsBadSize, "Jacobian must be 3x9 or 9x3" ); + CV_Error( cv::Error::StsBadSize, "Jacobian must be 3x9 or 9x3" ); } if( src->cols == 1 || src->rows == 1 ) @@ -287,10 +287,10 @@ CV_IMPL int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian ) int step = src->rows > 1 ? src->step / elem_size : 1; if( src->rows + src->cols*CV_MAT_CN(src->type) - 1 != 3 ) - CV_Error( CV_StsBadSize, "Input matrix must be 1x3, 3x1 or 3x3" ); + CV_Error( cv::Error::StsBadSize, "Input matrix must be 1x3, 3x1 or 3x3" ); if( dst->rows != 3 || dst->cols != 3 || CV_MAT_CN(dst->type) != 1 ) - CV_Error( CV_StsBadSize, "Output matrix must be 3x3, single-channel floating point matrix" ); + CV_Error( cv::Error::StsBadSize, "Output matrix must be 3x3, single-channel floating point matrix" ); Point3d r; if( depth == CV_32F ) @@ -368,7 +368,7 @@ CV_IMPL int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian ) if( (dst->rows != 1 || dst->cols*CV_MAT_CN(dst->type) != 3) && (dst->rows != 3 || dst->cols != 1 || CV_MAT_CN(dst->type) != 1)) - CV_Error( CV_StsBadSize, "Output matrix must be 1x3 or 3x1" ); + CV_Error( cv::Error::StsBadSize, "Output matrix must be 1x3 or 3x1" ); Matx33d R = cvarrToMat(src); @@ -490,7 +490,7 @@ CV_IMPL int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian ) } else { - CV_Error(CV_StsBadSize, "Input matrix must be 1x3 or 3x1 for a rotation vector, or 3x3 for a rotation matrix"); + CV_Error(cv::Error::StsBadSize, "Input matrix must be 1x3 or 3x1 for a rotation vector, or 3x3 for a rotation matrix"); } if( jacobian ) @@ -553,13 +553,13 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints, if( !CV_IS_MAT(objectPoints) || !CV_IS_MAT(r_vec) || !CV_IS_MAT(t_vec) || !CV_IS_MAT(A) || /*!CV_IS_MAT(distCoeffs) ||*/ !CV_IS_MAT(imagePoints) ) - CV_Error( CV_StsBadArg, "One of required arguments is not a valid matrix" ); + CV_Error( cv::Error::StsBadArg, "One of required arguments is not a valid matrix" ); int total = objectPoints->rows * objectPoints->cols * CV_MAT_CN(objectPoints->type); if(total % 3 != 0) { //we have stopped support of homogeneous coordinates because it cause ambiguity in interpretation of the input data - CV_Error( CV_StsBadArg, "Homogeneous coordinates are not supported" ); + CV_Error( cv::Error::StsBadArg, "Homogeneous coordinates are not supported" ); } count = total / 3; @@ -576,7 +576,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints, { // matM = cvCreateMat( 1, count, CV_64FC3 ); // cvConvertPointsHomogeneous( objectPoints, matM ); - CV_Error( CV_StsBadArg, "Homogeneous coordinates are not supported" ); + CV_Error( cv::Error::StsBadArg, "Homogeneous coordinates are not supported" ); } if( CV_IS_CONT_MAT(imagePoints->type) && @@ -591,7 +591,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints, else { // _m = cvCreateMat( 1, count, CV_64FC2 ); - CV_Error( CV_StsBadArg, "Homogeneous coordinates are not supported" ); + CV_Error( cv::Error::StsBadArg, "Homogeneous coordinates are not supported" ); } M = (CvPoint3D64f*)matM->data.db; @@ -601,7 +601,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints, (((r_vec->rows != 1 && r_vec->cols != 1) || r_vec->rows*r_vec->cols*CV_MAT_CN(r_vec->type) != 3) && ((r_vec->rows != 3 && r_vec->cols != 3) || CV_MAT_CN(r_vec->type) != 1))) - CV_Error( CV_StsBadArg, "Rotation must be represented by 1x3 or 3x1 " + CV_Error( cv::Error::StsBadArg, "Rotation must be represented by 1x3 or 3x1 " "floating-point rotation vector, or 3x3 rotation matrix" ); if( r_vec->rows == 3 && r_vec->cols == 3 ) @@ -621,7 +621,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints, if( (CV_MAT_DEPTH(t_vec->type) != CV_64F && CV_MAT_DEPTH(t_vec->type) != CV_32F) || (t_vec->rows != 1 && t_vec->cols != 1) || t_vec->rows*t_vec->cols*CV_MAT_CN(t_vec->type) != 3 ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "Translation vector must be 1x3 or 3x1 floating-point vector" ); _t = cvMat( t_vec->rows, t_vec->cols, CV_MAKETYPE(CV_64F,CV_MAT_CN(t_vec->type)), t ); @@ -629,7 +629,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints, if( (CV_MAT_TYPE(A->type) != CV_64FC1 && CV_MAT_TYPE(A->type) != CV_32FC1) || A->rows != 3 || A->cols != 3 ) - CV_Error( CV_StsBadArg, "Intrinsic parameters must be 3x3 floating-point matrix" ); + CV_Error( cv::Error::StsBadArg, "Intrinsic parameters must be 3x3 floating-point matrix" ); cvConvert( A, &_a ); fx = a[0]; fy = a[4]; @@ -649,7 +649,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints, distCoeffs->rows*distCoeffs->cols*CV_MAT_CN(distCoeffs->type) != 8 && distCoeffs->rows*distCoeffs->cols*CV_MAT_CN(distCoeffs->type) != 12 && distCoeffs->rows*distCoeffs->cols*CV_MAT_CN(distCoeffs->type) != 14) ) - CV_Error( CV_StsBadArg, cvDistCoeffErr ); + CV_Error( cv::Error::StsBadArg, cvDistCoeffErr ); _k = cvMat( distCoeffs->rows, distCoeffs->cols, CV_MAKETYPE(CV_64F,CV_MAT_CN(distCoeffs->type)), k ); @@ -667,7 +667,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints, (CV_MAT_TYPE(dpdr->type) != CV_32FC1 && CV_MAT_TYPE(dpdr->type) != CV_64FC1) || dpdr->rows != count*2 || dpdr->cols != 3 ) - CV_Error( CV_StsBadArg, "dp/drot must be 2Nx3 floating-point matrix" ); + CV_Error( cv::Error::StsBadArg, "dp/drot must be 2Nx3 floating-point matrix" ); if( CV_MAT_TYPE(dpdr->type) == CV_64FC1 ) { @@ -685,7 +685,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints, (CV_MAT_TYPE(dpdt->type) != CV_32FC1 && CV_MAT_TYPE(dpdt->type) != CV_64FC1) || dpdt->rows != count*2 || dpdt->cols != 3 ) - CV_Error( CV_StsBadArg, "dp/dT must be 2Nx3 floating-point matrix" ); + CV_Error( cv::Error::StsBadArg, "dp/dT must be 2Nx3 floating-point matrix" ); if( CV_MAT_TYPE(dpdt->type) == CV_64FC1 ) { @@ -702,7 +702,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints, if( !CV_IS_MAT(dpdf) || (CV_MAT_TYPE(dpdf->type) != CV_32FC1 && CV_MAT_TYPE(dpdf->type) != CV_64FC1) || dpdf->rows != count*2 || dpdf->cols != 2 ) - CV_Error( CV_StsBadArg, "dp/df must be 2Nx2 floating-point matrix" ); + CV_Error( cv::Error::StsBadArg, "dp/df must be 2Nx2 floating-point matrix" ); if( CV_MAT_TYPE(dpdf->type) == CV_64FC1 ) { @@ -719,7 +719,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints, if( !CV_IS_MAT(dpdc) || (CV_MAT_TYPE(dpdc->type) != CV_32FC1 && CV_MAT_TYPE(dpdc->type) != CV_64FC1) || dpdc->rows != count*2 || dpdc->cols != 2 ) - CV_Error( CV_StsBadArg, "dp/dc must be 2Nx2 floating-point matrix" ); + CV_Error( cv::Error::StsBadArg, "dp/dc must be 2Nx2 floating-point matrix" ); if( CV_MAT_TYPE(dpdc->type) == CV_64FC1 ) { @@ -736,10 +736,10 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints, if( !CV_IS_MAT(dpdk) || (CV_MAT_TYPE(dpdk->type) != CV_32FC1 && CV_MAT_TYPE(dpdk->type) != CV_64FC1) || dpdk->rows != count*2 || (dpdk->cols != 14 && dpdk->cols != 12 && dpdk->cols != 8 && dpdk->cols != 5 && dpdk->cols != 4 && dpdk->cols != 2) ) - CV_Error( CV_StsBadArg, "dp/df must be 2Nx14, 2Nx12, 2Nx8, 2Nx5, 2Nx4 or 2Nx2 floating-point matrix" ); + CV_Error( cv::Error::StsBadArg, "dp/df must be 2Nx14, 2Nx12, 2Nx8, 2Nx5, 2Nx4 or 2Nx2 floating-point matrix" ); if( !distCoeffs ) - CV_Error( CV_StsNullPtr, "distCoeffs is NULL while dpdk is not" ); + CV_Error( cv::Error::StsNullPtr, "distCoeffs is NULL while dpdk is not" ); if( CV_MAT_TYPE(dpdk->type) == CV_64FC1 ) { @@ -756,7 +756,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints, if( !CV_IS_MAT( dpdo ) || ( CV_MAT_TYPE( dpdo->type ) != CV_32FC1 && CV_MAT_TYPE( dpdo->type ) != CV_64FC1 ) || dpdo->rows != count * 2 || dpdo->cols != count * 3 ) - CV_Error( CV_StsBadArg, "dp/do must be 2Nx3N floating-point matrix" ); + CV_Error( cv::Error::StsBadArg, "dp/do must be 2Nx3N floating-point matrix" ); if( CV_MAT_TYPE( dpdo->type ) == CV_64FC1 ) { @@ -1283,10 +1283,10 @@ CV_IMPL void cvInitIntrinsicParams2D( const CvMat* objectPoints, CV_MAT_TYPE(objectPoints->type) != CV_64FC3) || (CV_MAT_TYPE(imagePoints->type) != CV_32FC2 && CV_MAT_TYPE(imagePoints->type) != CV_64FC2) ) - CV_Error( CV_StsUnsupportedFormat, "Both object points and image points must be 2D" ); + CV_Error( cv::Error::StsUnsupportedFormat, "Both object points and image points must be 2D" ); if( objectPoints->rows != 1 || imagePoints->rows != 1 ) - CV_Error( CV_StsBadSize, "object points and image points must be a single-row matrices" ); + CV_Error( cv::Error::StsBadSize, "object points and image points must be a single-row matrices" ); matA.reset(cvCreateMat( 2*nimages, 2, CV_64F )); _b.reset(cvCreateMat( 2*nimages, 1, CV_64F )); @@ -1395,27 +1395,27 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints, // 0. check the parameters & allocate buffers if( !CV_IS_MAT(objectPoints) || !CV_IS_MAT(imagePoints) || !CV_IS_MAT(npoints) || !CV_IS_MAT(cameraMatrix) || !CV_IS_MAT(distCoeffs) ) - CV_Error( CV_StsBadArg, "One of required vector arguments is not a valid matrix" ); + CV_Error( cv::Error::StsBadArg, "One of required vector arguments is not a valid matrix" ); if( imageSize.width <= 0 || imageSize.height <= 0 ) - CV_Error( CV_StsOutOfRange, "image width and height must be positive" ); + CV_Error( cv::Error::StsOutOfRange, "image width and height must be positive" ); if( CV_MAT_TYPE(npoints->type) != CV_32SC1 || (npoints->rows != 1 && npoints->cols != 1) ) - CV_Error( CV_StsUnsupportedFormat, + CV_Error( cv::Error::StsUnsupportedFormat, "the array of point counters must be 1-dimensional integer vector" ); if(flags & CALIB_TILTED_MODEL) { //when the tilted sensor model is used the distortion coefficients matrix must have 14 parameters if (distCoeffs->cols*distCoeffs->rows != 14) - CV_Error( CV_StsBadArg, "The tilted sensor model must have 14 parameters in the distortion matrix" ); + CV_Error( cv::Error::StsBadArg, "The tilted sensor model must have 14 parameters in the distortion matrix" ); } else { //when the thin prism model is used the distortion coefficients matrix must have 12 parameters if(flags & CALIB_THIN_PRISM_MODEL) if (distCoeffs->cols*distCoeffs->rows != 12) - CV_Error( CV_StsBadArg, "Thin prism model must have 12 parameters in the distortion matrix" ); + CV_Error( cv::Error::StsBadArg, "Thin prism model must have 12 parameters in the distortion matrix" ); } nimages = npoints->rows*npoints->cols; @@ -1428,7 +1428,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints, (CV_MAT_DEPTH(rvecs->type) != CV_32F && CV_MAT_DEPTH(rvecs->type) != CV_64F) || ((rvecs->rows != nimages || (rvecs->cols*cn != 3 && rvecs->cols*cn != 9)) && (rvecs->rows != 1 || rvecs->cols != nimages || cn != 3)) ) - CV_Error( CV_StsBadArg, "the output array of rotation vectors must be 3-channel " + CV_Error( cv::Error::StsBadArg, "the output array of rotation vectors must be 3-channel " "1xn or nx1 array or 1-channel nx3 or nx9 array, where n is the number of views" ); } @@ -1439,7 +1439,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints, (CV_MAT_DEPTH(tvecs->type) != CV_32F && CV_MAT_DEPTH(tvecs->type) != CV_64F) || ((tvecs->rows != nimages || tvecs->cols*cn != 3) && (tvecs->rows != 1 || tvecs->cols != nimages || cn != 3)) ) - CV_Error( CV_StsBadArg, "the output array of translation vectors must be 3-channel " + CV_Error( cv::Error::StsBadArg, "the output array of translation vectors must be 3-channel " "1xn or nx1 array or 1-channel nx3 array, where n is the number of views" ); } @@ -1454,7 +1454,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints, (stdDevs->rows != 1 || stdDevs->cols != (nimages*6 + NINTRINSIC) || cn != 1)) ) #define STR__(x) #x #define STR_(x) STR__(x) - CV_Error( CV_StsBadArg, "the output array of standard deviations vectors must be 1-channel " + CV_Error( cv::Error::StsBadArg, "the output array of standard deviations vectors must be 1-channel " "1x(n*6 + NINTRINSIC) or (n*6 + NINTRINSIC)x1 array, where n is the number of views," " NINTRINSIC = " STR_(CV_CALIB_NINTRINSIC)); } @@ -1462,7 +1462,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints, if( (CV_MAT_TYPE(cameraMatrix->type) != CV_32FC1 && CV_MAT_TYPE(cameraMatrix->type) != CV_64FC1) || cameraMatrix->rows != 3 || cameraMatrix->cols != 3 ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "Intrinsic parameters must be 3x3 floating-point matrix" ); if( (CV_MAT_TYPE(distCoeffs->type) != CV_32FC1 && @@ -1473,14 +1473,14 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints, distCoeffs->cols*distCoeffs->rows != 8 && distCoeffs->cols*distCoeffs->rows != 12 && distCoeffs->cols*distCoeffs->rows != 14) ) - CV_Error( CV_StsBadArg, cvDistCoeffErr ); + CV_Error( cv::Error::StsBadArg, cvDistCoeffErr ); for( i = 0; i < nimages; i++ ) { ni = npoints->data.i[i*npstep]; if( ni < 4 ) { - CV_Error_( CV_StsOutOfRange, ("The number of points in the view #%d is < 4", i)); + CV_Error_( cv::Error::StsOutOfRange, ("The number of points in the view #%d is < 4", i)); } maxPoints = MAX( maxPoints, ni ); total += ni; @@ -1493,7 +1493,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints, (CV_MAT_DEPTH(newObjPoints->type) != CV_32F && CV_MAT_DEPTH(newObjPoints->type) != CV_64F) || ((newObjPoints->rows != maxPoints || newObjPoints->cols*cn != 3) && (newObjPoints->rows != 1 || newObjPoints->cols != maxPoints || cn != 3)) ) - CV_Error( CV_StsBadArg, "the output array of refined object points must be 3-channel " + CV_Error( cv::Error::StsBadArg, "the output array of refined object points must be 3-channel " "1xn or nx1 array or 1-channel nx3 array, where n is the number of object points per view" ); } @@ -1504,7 +1504,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints, (CV_MAT_DEPTH(stdDevs->type) != CV_32F && CV_MAT_DEPTH(stdDevs->type) != CV_64F) || ((stdDevs->rows != (nimages*6 + NINTRINSIC + maxPoints*3) || stdDevs->cols*cn != 1) && (stdDevs->rows != 1 || stdDevs->cols != (nimages*6 + NINTRINSIC + maxPoints*3) || cn != 1)) ) - CV_Error( CV_StsBadArg, "the output array of standard deviations vectors must be 1-channel " + CV_Error( cv::Error::StsBadArg, "the output array of standard deviations vectors must be 1-channel " "1x(n*6 + NINTRINSIC + m*3) or (n*6 + NINTRINSIC + m*3)x1 array, where n is the number of views," " NINTRINSIC = " STR_(CV_CALIB_NINTRINSIC) ", m is the number of object points per view"); } @@ -1544,15 +1544,15 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints, { cvConvert( cameraMatrix, &matA ); if( A(0, 0) <= 0 || A(1, 1) <= 0 ) - CV_Error( CV_StsOutOfRange, "Focal length (fx and fy) must be positive" ); + CV_Error( cv::Error::StsOutOfRange, "Focal length (fx and fy) must be positive" ); if( A(0, 2) < 0 || A(0, 2) >= imageSize.width || A(1, 2) < 0 || A(1, 2) >= imageSize.height ) - CV_Error( CV_StsOutOfRange, "Principal point must be within the image" ); + CV_Error( cv::Error::StsOutOfRange, "Principal point must be within the image" ); if( fabs(A(0, 1)) > 1e-5 ) - CV_Error( CV_StsOutOfRange, "Non-zero skew is not supported by the function" ); + CV_Error( cv::Error::StsOutOfRange, "Non-zero skew is not supported by the function" ); if( fabs(A(1, 0)) > 1e-5 || fabs(A(2, 0)) > 1e-5 || fabs(A(2, 1)) > 1e-5 || fabs(A(2,2)-1) > 1e-5 ) - CV_Error( CV_StsOutOfRange, + CV_Error( cv::Error::StsOutOfRange, "The intrinsic matrix must have [fx 0 cx; 0 fy cy; 0 0 1] shape" ); A(0, 1) = A(1, 0) = A(2, 0) = A(2, 1) = 0.; A(2, 2) = 1.; @@ -1562,7 +1562,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints, aspectRatio = A(0, 0)/A(1, 1); if( aspectRatio < minValidAspectRatio || aspectRatio > maxValidAspectRatio ) - CV_Error( CV_StsOutOfRange, + CV_Error( cv::Error::StsOutOfRange, "The specified aspect ratio (= cameraMatrix[0][0] / cameraMatrix[1][1]) is incorrect" ); } cvConvert( distCoeffs, &_k ); @@ -1572,7 +1572,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints, Scalar mean, sdv; meanStdDev(matM, mean, sdv); if( fabs(mean[2]) > 1e-5 || fabs(sdv[2]) > 1e-5 ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "For non-planar calibration rigs the initial intrinsic matrix must be specified" ); for( i = 0; i < total; i++ ) matM.at(i).z = 0.; @@ -1582,7 +1582,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints, aspectRatio = cvmGet(cameraMatrix,0,0); aspectRatio /= cvmGet(cameraMatrix,1,1); if( aspectRatio < minValidAspectRatio || aspectRatio > maxValidAspectRatio ) - CV_Error( CV_StsOutOfRange, + CV_Error( cv::Error::StsOutOfRange, "The specified aspect ratio (= cameraMatrix[0][0] / cameraMatrix[1][1]) is incorrect" ); } CvMat _matM = cvMat(matM), m = cvMat(_m); @@ -1673,7 +1673,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints, Mat mask = cvarrToMat(solver.mask); int nparams_nz = countNonZero(mask); if (nparams_nz >= 2 * total) - CV_Error_(CV_StsBadArg, + CV_Error_(cv::Error::StsBadArg, ("There should be less vars to optimize (having %d) than the number of residuals (%d = 2 per point)", nparams_nz, 2 * total)); // 2. initialize extrinsic parameters @@ -1889,10 +1889,10 @@ CV_IMPL double cvCalibrateCamera4( const CvMat* objectPoints, CvMat* rvecs, CvMat* tvecs, CvMat* newObjPoints, int flags, CvTermCriteria termCrit ) { if( !CV_IS_MAT(npoints) ) - CV_Error( CV_StsBadArg, "npoints is not a valid matrix" ); + CV_Error( cv::Error::StsBadArg, "npoints is not a valid matrix" ); if( CV_MAT_TYPE(npoints->type) != CV_32SC1 || (npoints->rows != 1 && npoints->cols != 1) ) - CV_Error( CV_StsUnsupportedFormat, + CV_Error( cv::Error::StsUnsupportedFormat, "the array of point counters must be 1-dimensional integer vector" ); bool releaseObject = iFixedPoint > 0 && iFixedPoint < npoints->data.i[0] - 1; @@ -1903,7 +1903,7 @@ CV_IMPL double cvCalibrateCamera4( const CvMat* objectPoints, if( releaseObject ) { if( !CV_IS_MAT(objectPoints) ) - CV_Error( CV_StsBadArg, "objectPoints is not a valid matrix" ); + CV_Error( cv::Error::StsBadArg, "objectPoints is not a valid matrix" ); Mat matM; if(CV_MAT_CN(objectPoints->type) == 3) { matM = cvarrToMat(objectPoints); @@ -1917,14 +1917,14 @@ CV_IMPL double cvCalibrateCamera4( const CvMat* objectPoints, { if( npoints->data.i[i * npstep] != ni ) { - CV_Error( CV_StsBadArg, "All objectPoints[i].size() should be equal when " + CV_Error( cv::Error::StsBadArg, "All objectPoints[i].size() should be equal when " "object-releasing method is requested." ); } Mat ocmp = matM.colRange(ni * i, ni * i + ni) != matM.colRange(0, ni); ocmp = ocmp.reshape(1); if( countNonZero(ocmp) ) { - CV_Error( CV_StsBadArg, "All objectPoints[i] should be identical when object-releasing" + CV_Error( cv::Error::StsBadArg, "All objectPoints[i] should be identical when object-releasing" " method is requested." ); } } @@ -1941,10 +1941,10 @@ void cvCalibrationMatrixValues( const CvMat *calibMatr, CvSize imgSize, { /* Validate parameters. */ if(calibMatr == 0) - CV_Error(CV_StsNullPtr, "Some of parameters is a NULL pointer!"); + CV_Error(cv::Error::StsNullPtr, "Some of parameters is a NULL pointer!"); if(!CV_IS_MAT(calibMatr)) - CV_Error(CV_StsUnsupportedFormat, "Input parameters must be matrices!"); + CV_Error(cv::Error::StsUnsupportedFormat, "Input parameters must be matrices!"); double dummy = .0; Point2d pp; @@ -2023,7 +2023,7 @@ static double cvStereoCalibrateImpl( const CvMat* _objectPoints, const CvMat* _i (CV_MAT_DEPTH(rvecs->type) != CV_32F && CV_MAT_DEPTH(rvecs->type) != CV_64F) || ((rvecs->rows != nimages || (rvecs->cols*cn != 3 && rvecs->cols*cn != 9)) && (rvecs->rows != 1 || rvecs->cols != nimages || cn != 3)) ) - CV_Error( CV_StsBadArg, "the output array of rotation vectors must be 3-channel " + CV_Error( cv::Error::StsBadArg, "the output array of rotation vectors must be 3-channel " "1xn or nx1 array or 1-channel nx3 or nx9 array, where n is the number of views" ); } @@ -2034,7 +2034,7 @@ static double cvStereoCalibrateImpl( const CvMat* _objectPoints, const CvMat* _i (CV_MAT_DEPTH(tvecs->type) != CV_32F && CV_MAT_DEPTH(tvecs->type) != CV_64F) || ((tvecs->rows != nimages || tvecs->cols*cn != 3) && (tvecs->rows != 1 || tvecs->cols != nimages || cn != 3)) ) - CV_Error( CV_StsBadArg, "the output array of translation vectors must be 3-channel " + CV_Error( cv::Error::StsBadArg, "the output array of translation vectors must be 3-channel " "1xn or nx1 array or 1-channel nx3 array, where n is the number of views" ); } @@ -3344,19 +3344,19 @@ cvDecomposeProjectionMatrix( const CvMat *projMatr, CvMat *calibMatr, /* Validate parameters. */ if(projMatr == 0 || calibMatr == 0 || rotMatr == 0 || posVect == 0) - CV_Error(CV_StsNullPtr, "Some of parameters is a NULL pointer!"); + CV_Error(cv::Error::StsNullPtr, "Some of parameters is a NULL pointer!"); if(!CV_IS_MAT(projMatr) || !CV_IS_MAT(calibMatr) || !CV_IS_MAT(rotMatr) || !CV_IS_MAT(posVect)) - CV_Error(CV_StsUnsupportedFormat, "Input parameters must be matrices!"); + CV_Error(cv::Error::StsUnsupportedFormat, "Input parameters must be matrices!"); if(projMatr->cols != 4 || projMatr->rows != 3) - CV_Error(CV_StsUnmatchedSizes, "Size of projection matrix must be 3x4!"); + CV_Error(cv::Error::StsUnmatchedSizes, "Size of projection matrix must be 3x4!"); if(calibMatr->cols != 3 || calibMatr->rows != 3 || rotMatr->cols != 3 || rotMatr->rows != 3) - CV_Error(CV_StsUnmatchedSizes, "Size of calibration and rotation matrices must be 3x3!"); + CV_Error(cv::Error::StsUnmatchedSizes, "Size of calibration and rotation matrices must be 3x3!"); if(posVect->cols != 1 || posVect->rows != 4) - CV_Error(CV_StsUnmatchedSizes, "Size of position vector must be 4x1!"); + CV_Error(cv::Error::StsUnmatchedSizes, "Size of position vector must be 4x1!"); /* Compute position vector. */ cvSetZero(&tmpProjMatr); // Add zero row to make matrix square. @@ -3402,17 +3402,17 @@ static void collectCalibrationData( InputArrayOfArrays objectPoints, { Mat objectPoint = objectPoints.getMat(i); if (objectPoint.empty()) - CV_Error(CV_StsBadSize, "objectPoints should not contain empty vector of vectors of points"); + CV_Error(cv::Error::StsBadSize, "objectPoints should not contain empty vector of vectors of points"); int numberOfObjectPoints = objectPoint.checkVector(3, CV_32F); if (numberOfObjectPoints <= 0) - CV_Error(CV_StsUnsupportedFormat, "objectPoints should contain vector of vectors of points of type Point3f"); + CV_Error(cv::Error::StsUnsupportedFormat, "objectPoints should contain vector of vectors of points of type Point3f"); Mat imagePoint1 = imagePoints1.getMat(i); if (imagePoint1.empty()) - CV_Error(CV_StsBadSize, "imagePoints1 should not contain empty vector of vectors of points"); + CV_Error(cv::Error::StsBadSize, "imagePoints1 should not contain empty vector of vectors of points"); int numberOfImagePoints = imagePoint1.checkVector(2, CV_32F); if (numberOfImagePoints <= 0) - CV_Error(CV_StsUnsupportedFormat, "imagePoints1 should contain vector of vectors of points of type Point2f"); + CV_Error(cv::Error::StsUnsupportedFormat, "imagePoints1 should contain vector of vectors of points of type Point2f"); CV_CheckEQ(numberOfObjectPoints, numberOfImagePoints, "Number of object and image points must be equal"); total += numberOfObjectPoints; @@ -3467,14 +3467,14 @@ static void collectCalibrationData( InputArrayOfArrays objectPoints, { if( npoints.at(i) != ni ) { - CV_Error( CV_StsBadArg, "All objectPoints[i].size() should be equal when " + CV_Error( cv::Error::StsBadArg, "All objectPoints[i].size() should be equal when " "object-releasing method is requested." ); } Mat ocmp = objPtMat.colRange(ni * i, ni * i + ni) != objPtMat.colRange(0, ni); ocmp = ocmp.reshape(1); if( countNonZero(ocmp) ) { - CV_Error( CV_StsBadArg, "All objectPoints[i] should be identical when object-releasing" + CV_Error( cv::Error::StsBadArg, "All objectPoints[i] should be identical when object-releasing" " method is requested." ); } } @@ -3884,7 +3884,7 @@ void cv::calibrationMatrixValues( InputArray _cameraMatrix, Size imageSize, CV_INSTRUMENT_REGION(); if(_cameraMatrix.size() != Size(3, 3)) - CV_Error(CV_StsUnmatchedSizes, "Size of cameraMatrix must be 3x3!"); + CV_Error(cv::Error::StsUnmatchedSizes, "Size of cameraMatrix must be 3x3!"); Matx33d K = _cameraMatrix.getMat(); diff --git a/modules/calib3d/src/solvepnp.cpp b/modules/calib3d/src/solvepnp.cpp index 54e23ca9f8..771abff483 100644 --- a/modules/calib3d/src/solvepnp.cpp +++ b/modules/calib3d/src/solvepnp.cpp @@ -1041,7 +1041,7 @@ int solvePnPGeneric( InputArray _opoints, InputArray _ipoints, vec_tvecs.push_back(tvec); }*/ else - CV_Error(CV_StsBadArg, "The flags argument must be one of SOLVEPNP_ITERATIVE, SOLVEPNP_P3P, " + CV_Error(cv::Error::StsBadArg, "The flags argument must be one of SOLVEPNP_ITERATIVE, SOLVEPNP_P3P, " "SOLVEPNP_EPNP, SOLVEPNP_DLS, SOLVEPNP_UPNP, SOLVEPNP_AP3P, SOLVEPNP_IPPE, SOLVEPNP_IPPE_SQUARE or SOLVEPNP_SQPNP"); CV_Assert(vec_rvecs.size() == vec_tvecs.size()); diff --git a/modules/calib3d/src/triangulate.cpp b/modules/calib3d/src/triangulate.cpp index cded42232a..671659c84b 100644 --- a/modules/calib3d/src/triangulate.cpp +++ b/modules/calib3d/src/triangulate.cpp @@ -56,30 +56,30 @@ icvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2, CvMat* projPoints1, CvM if( projMatr1 == 0 || projMatr2 == 0 || projPoints1 == 0 || projPoints2 == 0 || points4D == 0) - CV_Error( CV_StsNullPtr, "Some of parameters is a NULL pointer" ); + CV_Error( cv::Error::StsNullPtr, "Some of parameters is a NULL pointer" ); if( !CV_IS_MAT(projMatr1) || !CV_IS_MAT(projMatr2) || !CV_IS_MAT(projPoints1) || !CV_IS_MAT(projPoints2) || !CV_IS_MAT(points4D) ) - CV_Error( CV_StsUnsupportedFormat, "Input parameters must be matrices" ); + CV_Error( cv::Error::StsUnsupportedFormat, "Input parameters must be matrices" ); int numPoints = projPoints1->cols; if( numPoints < 1 ) - CV_Error( CV_StsOutOfRange, "Number of points must be more than zero" ); + CV_Error( cv::Error::StsOutOfRange, "Number of points must be more than zero" ); if( projPoints2->cols != numPoints || points4D->cols != numPoints ) - CV_Error( CV_StsUnmatchedSizes, "Number of points must be the same" ); + CV_Error( cv::Error::StsUnmatchedSizes, "Number of points must be the same" ); if( projPoints1->rows != 2 || projPoints2->rows != 2) - CV_Error( CV_StsUnmatchedSizes, "Number of proj points coordinates must be == 2" ); + CV_Error( cv::Error::StsUnmatchedSizes, "Number of proj points coordinates must be == 2" ); if( points4D->rows != 4 ) - CV_Error( CV_StsUnmatchedSizes, "Number of world points coordinates must be == 4" ); + CV_Error( cv::Error::StsUnmatchedSizes, "Number of world points coordinates must be == 4" ); if( projMatr1->cols != 4 || projMatr1->rows != 3 || projMatr2->cols != 4 || projMatr2->rows != 3) - CV_Error( CV_StsUnmatchedSizes, "Size of projection matrices must be 3x4" ); + CV_Error( cv::Error::StsUnmatchedSizes, "Size of projection matrices must be 3x4" ); // preallocate SVD matrices on stack cv::Matx matrA; @@ -147,30 +147,30 @@ icvCorrectMatches(CvMat *F_, CvMat *points1_, CvMat *points2_, CvMat *new_points cv::Ptr F; if (!CV_IS_MAT(F_) || !CV_IS_MAT(points1_) || !CV_IS_MAT(points2_) ) - CV_Error( CV_StsUnsupportedFormat, "Input parameters must be matrices" ); + CV_Error( cv::Error::StsUnsupportedFormat, "Input parameters must be matrices" ); if (!( F_->cols == 3 && F_->rows == 3)) - CV_Error( CV_StsUnmatchedSizes, "The fundamental matrix must be a 3x3 matrix"); + CV_Error( cv::Error::StsUnmatchedSizes, "The fundamental matrix must be a 3x3 matrix"); if (!(((F_->type & CV_MAT_TYPE_MASK) >> 3) == 0 )) - CV_Error( CV_StsUnsupportedFormat, "The fundamental matrix must be a single-channel matrix" ); + CV_Error( cv::Error::StsUnsupportedFormat, "The fundamental matrix must be a single-channel matrix" ); if (!(points1_->rows == 1 && points2_->rows == 1 && points1_->cols == points2_->cols)) - CV_Error( CV_StsUnmatchedSizes, "The point-matrices must have one row, and an equal number of columns" ); + CV_Error( cv::Error::StsUnmatchedSizes, "The point-matrices must have one row, and an equal number of columns" ); if (((points1_->type & CV_MAT_TYPE_MASK) >> 3) != 1 ) - CV_Error( CV_StsUnmatchedSizes, "The first set of points must contain two channels; one for x and one for y" ); + CV_Error( cv::Error::StsUnmatchedSizes, "The first set of points must contain two channels; one for x and one for y" ); if (((points2_->type & CV_MAT_TYPE_MASK) >> 3) != 1 ) - CV_Error( CV_StsUnmatchedSizes, "The second set of points must contain two channels; one for x and one for y" ); + CV_Error( cv::Error::StsUnmatchedSizes, "The second set of points must contain two channels; one for x and one for y" ); if (new_points1 != NULL) { CV_Assert(CV_IS_MAT(new_points1)); if (new_points1->cols != points1_->cols || new_points1->rows != 1) - CV_Error( CV_StsUnmatchedSizes, "The first output matrix must have the same dimensions as the input matrices" ); + CV_Error( cv::Error::StsUnmatchedSizes, "The first output matrix must have the same dimensions as the input matrices" ); if (CV_MAT_CN(new_points1->type) != 2) - CV_Error( CV_StsUnsupportedFormat, "The first output matrix must have two channels; one for x and one for y" ); + CV_Error( cv::Error::StsUnsupportedFormat, "The first output matrix must have two channels; one for x and one for y" ); } if (new_points2 != NULL) { CV_Assert(CV_IS_MAT(new_points2)); if (new_points2->cols != points2_->cols || new_points2->rows != 1) - CV_Error( CV_StsUnmatchedSizes, "The second output matrix must have the same dimensions as the input matrices" ); + CV_Error( cv::Error::StsUnmatchedSizes, "The second output matrix must have the same dimensions as the input matrices" ); if (CV_MAT_CN(new_points2->type) != 2) - CV_Error( CV_StsUnsupportedFormat, "The second output matrix must have two channels; one for x and one for y" ); + CV_Error( cv::Error::StsUnsupportedFormat, "The second output matrix must have two channels; one for x and one for y" ); } // Make sure F uses double precision diff --git a/modules/calib3d/test/test_cameracalibration_badarg.cpp b/modules/calib3d/test/test_cameracalibration_badarg.cpp index 240bdbb1b3..046fc1d530 100644 --- a/modules/calib3d/test/test_cameracalibration_badarg.cpp +++ b/modules/calib3d/test/test_cameracalibration_badarg.cpp @@ -149,49 +149,49 @@ void CV_CameraCalibrationBadArgTest::run( int /* start_from */ ) caller.initArgs(); caller.objPts_arg = noArray(); - errors += run_test_case( CV_StsBadArg, "None passed in objPts", caller); + errors += run_test_case( cv::Error::StsBadArg, "None passed in objPts", caller); caller.initArgs(); caller.imgPts_arg = noArray(); - errors += run_test_case( CV_StsBadArg, "None passed in imgPts", caller ); + errors += run_test_case( cv::Error::StsBadArg, "None passed in imgPts", caller ); caller.initArgs(); caller.cameraMatrix_arg = noArray(); - errors += run_test_case( CV_StsBadArg, "Zero passed in cameraMatrix", caller ); + errors += run_test_case( cv::Error::StsBadArg, "Zero passed in cameraMatrix", caller ); caller.initArgs(); caller.distCoeffs_arg = noArray(); - errors += run_test_case( CV_StsBadArg, "Zero passed in distCoeffs", caller ); + errors += run_test_case( cv::Error::StsBadArg, "Zero passed in distCoeffs", caller ); caller.initArgs(); caller.imageSize.width = -1; - errors += run_test_case( CV_StsOutOfRange, "Bad image width", caller ); + errors += run_test_case( cv::Error::StsOutOfRange, "Bad image width", caller ); caller.initArgs(); caller.imageSize.height = -1; - errors += run_test_case( CV_StsOutOfRange, "Bad image height", caller ); + errors += run_test_case( cv::Error::StsOutOfRange, "Bad image height", caller ); caller.initArgs(); caller.imgPts[0].clear(); - errors += run_test_case( CV_StsBadSize, "Bad imgpts[0]", caller ); + errors += run_test_case( cv::Error::StsBadSize, "Bad imgpts[0]", caller ); caller.imgPts[0] = caller.imgPts[1]; caller.initArgs(); caller.objPts[1].clear(); - errors += run_test_case( CV_StsBadSize, "Bad objpts[1]", caller ); + errors += run_test_case( cv::Error::StsBadSize, "Bad objpts[1]", caller ); caller.objPts[1] = caller.objPts[0]; caller.initArgs(); Mat badCM = Mat::zeros(4, 4, CV_64F); caller.cameraMatrix_arg = badCM; caller.flags = CALIB_USE_INTRINSIC_GUESS; - errors += run_test_case( CV_StsBadArg, "Bad camearaMatrix header", caller ); + errors += run_test_case( cv::Error::StsBadArg, "Bad camearaMatrix header", caller ); caller.initArgs(); Mat badDC = Mat::zeros(10, 10, CV_64F); caller.distCoeffs_arg = badDC; caller.flags = CALIB_USE_INTRINSIC_GUESS; - errors += run_test_case( CV_StsBadArg, "Bad camearaMatrix header", caller ); + errors += run_test_case( cv::Error::StsBadArg, "Bad camearaMatrix header", caller ); if (errors) ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH); @@ -244,15 +244,15 @@ protected: caller.initArgs(); caller.src_arg = noArray(); - errors += run_test_case( CV_StsBadArg, "Src is empty matrix", caller ); + errors += run_test_case( cv::Error::StsBadArg, "Src is empty matrix", caller ); caller.initArgs(); caller.src = Mat::zeros(3, 1, CV_8U); - errors += run_test_case( CV_StsUnsupportedFormat, "Bad src formart", caller ); + errors += run_test_case( cv::Error::StsUnsupportedFormat, "Bad src formart", caller ); caller.initArgs(); caller.src = Mat::zeros(1, 1, CV_32F); - errors += run_test_case( CV_StsBadSize, "Bad src size", caller ); + errors += run_test_case( cv::Error::StsBadSize, "Bad src size", caller ); if (errors) ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH); @@ -331,57 +331,57 @@ protected: caller.initArgs(); caller.objectPoints_arg = noArray(); - errors += run_test_case( CV_StsBadArg, "Zero objectPoints", caller ); + errors += run_test_case( cv::Error::StsBadArg, "Zero objectPoints", caller ); caller.initArgs(); caller.rvec_arg = noArray(); - errors += run_test_case( CV_StsBadArg, "Zero r_vec", caller ); + errors += run_test_case( cv::Error::StsBadArg, "Zero r_vec", caller ); caller.initArgs(); caller.tvec_arg = noArray(); - errors += run_test_case( CV_StsBadArg, "Zero t_vec", caller ); + errors += run_test_case( cv::Error::StsBadArg, "Zero t_vec", caller ); caller.initArgs(); caller.A_arg = noArray(); - errors += run_test_case( CV_StsBadArg, "Zero camMat", caller ); + errors += run_test_case( cv::Error::StsBadArg, "Zero camMat", caller ); caller.initArgs(); caller.imagePoints_arg = noArray(); - errors += run_test_case( CV_StsBadArg, "Zero imagePoints", caller ); + errors += run_test_case( cv::Error::StsBadArg, "Zero imagePoints", caller ); Mat save_rvec = caller.r_vec; caller.initArgs(); caller.r_vec.create(2, 2, CV_32F); - errors += run_test_case( CV_StsBadArg, "Bad rvec format", caller ); + errors += run_test_case( cv::Error::StsBadArg, "Bad rvec format", caller ); caller.initArgs(); caller.r_vec.create(1, 3, CV_8U); - errors += run_test_case( CV_StsBadArg, "Bad rvec format", caller ); + errors += run_test_case( cv::Error::StsBadArg, "Bad rvec format", caller ); caller.r_vec = save_rvec; /****************************/ Mat save_tvec = caller.t_vec; caller.initArgs(); caller.t_vec.create(3, 3, CV_32F); - errors += run_test_case( CV_StsBadArg, "Bad tvec format", caller ); + errors += run_test_case( cv::Error::StsBadArg, "Bad tvec format", caller ); caller.initArgs(); caller.t_vec.create(1, 3, CV_8U); - errors += run_test_case( CV_StsBadArg, "Bad tvec format", caller ); + errors += run_test_case( cv::Error::StsBadArg, "Bad tvec format", caller ); caller.t_vec = save_tvec; /****************************/ Mat save_A = caller.A; caller.initArgs(); caller.A.create(2, 2, CV_32F); - errors += run_test_case( CV_StsBadArg, "Bad A format", caller ); + errors += run_test_case( cv::Error::StsBadArg, "Bad A format", caller ); caller.A = save_A; /****************************/ Mat save_DC = caller.distCoeffs; caller.initArgs(); caller.distCoeffs.create(3, 3, CV_32F); - errors += run_test_case( CV_StsBadArg, "Bad distCoeffs format", caller ); + errors += run_test_case( cv::Error::StsBadArg, "Bad distCoeffs format", caller ); caller.distCoeffs = save_DC; if (errors) diff --git a/modules/calib3d/test/test_undistort_badarg.cpp b/modules/calib3d/test/test_undistort_badarg.cpp index 0ba13f1212..71bb21a0bd 100644 --- a/modules/calib3d/test/test_undistort_badarg.cpp +++ b/modules/calib3d/test/test_undistort_badarg.cpp @@ -106,15 +106,15 @@ void CV_UndistortPointsBadArgTest::run(int) src_points = cv::cvarrToMat(&_src_points_orig); src_points.create(2, 2, CV_32FC2); - errcount += run_test_case( CV_StsAssert, "Invalid input data matrix size" ); + errcount += run_test_case( cv::Error::StsAssert, "Invalid input data matrix size" ); src_points = cv::cvarrToMat(&_src_points_orig); src_points.create(1, 4, CV_64FC2); - errcount += run_test_case( CV_StsAssert, "Invalid input data matrix type" ); + errcount += run_test_case( cv::Error::StsAssert, "Invalid input data matrix type" ); src_points = cv::cvarrToMat(&_src_points_orig); src_points = cv::Mat(); - errcount += run_test_case( CV_StsBadArg, "Input data matrix is not continuous" ); + errcount += run_test_case( cv::Error::StsBadArg, "Input data matrix is not continuous" ); src_points = cv::cvarrToMat(&_src_points_orig); //------------ @@ -181,19 +181,19 @@ void CV_InitUndistortRectifyMapBadArgTest::run(int) mapy = cv::cvarrToMat(&_mapy_orig); mat_type = CV_64F; - errcount += run_test_case( CV_StsAssert, "Invalid map matrix type" ); + errcount += run_test_case( cv::Error::StsAssert, "Invalid map matrix type" ); mat_type = mat_type_orig; camera_mat.create(3, 2, CV_32F); - errcount += run_test_case( CV_StsAssert, "Invalid camera data matrix size" ); + errcount += run_test_case( cv::Error::StsAssert, "Invalid camera data matrix size" ); camera_mat = cv::cvarrToMat(&_camera_mat_orig); R.create(4, 3, CV_32F); - errcount += run_test_case( CV_StsAssert, "Invalid R data matrix size" ); + errcount += run_test_case( cv::Error::StsAssert, "Invalid R data matrix size" ); R = cv::cvarrToMat(&_R_orig); distortion_coeffs.create(6, 1, CV_32F); - errcount += run_test_case( CV_StsAssert, "Invalid distortion coefficients data matrix size" ); + errcount += run_test_case( cv::Error::StsAssert, "Invalid distortion coefficients data matrix size" ); distortion_coeffs = cv::cvarrToMat(&_distortion_coeffs_orig); //------------ @@ -256,7 +256,7 @@ void CV_UndistortBadArgTest::run(int) dst = cv::cvarrToMat(&_dst_orig); camera_mat.create(5, 5, CV_64F); - errcount += run_test_case( CV_StsAssert, "Invalid camera data matrix size" ); + errcount += run_test_case( cv::Error::StsAssert, "Invalid camera data matrix size" ); //------------ ts->set_failed_test_info(errcount > 0 ? cvtest::TS::FAIL_BAD_ARG_CHECK : cvtest::TS::OK); diff --git a/modules/core/src/alloc.cpp b/modules/core/src/alloc.cpp index cb2db71e2c..f6abeeb098 100644 --- a/modules/core/src/alloc.cpp +++ b/modules/core/src/alloc.cpp @@ -70,7 +70,7 @@ namespace cv { static void* OutOfMemoryError(size_t size) { - CV_Error_(CV_StsNoMem, ("Failed to allocate %llu bytes", (unsigned long long)size)); + CV_Error_(cv::Error::StsNoMem, ("Failed to allocate %llu bytes", (unsigned long long)size)); } CV_EXPORTS cv::utils::AllocatorStatisticsInterface& getAllocatorStatistics(); diff --git a/modules/core/src/arithm.cpp b/modules/core/src/arithm.cpp index 9de474b402..9e690fef2f 100644 --- a/modules/core/src/arithm.cpp +++ b/modules/core/src/arithm.cpp @@ -209,7 +209,7 @@ static void binary_op( InputArray _src1, InputArray _src2, OutputArray _dst, swap(sz1, sz2); } else if( !checkScalar(*psrc2, type1, kind2, kind1) ) - CV_Error( CV_StsUnmatchedSizes, + CV_Error( cv::Error::StsUnmatchedSizes, "The operation is neither 'array op array' (where arrays have the same size and type), " "nor 'array op scalar', nor 'scalar op array'" ); haveScalar = true; @@ -644,7 +644,7 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst, oclop = OCL_OP_RDIV_SCALE; } else if( !checkScalar(*psrc2, type1, kind2, kind1) ) - CV_Error( CV_StsUnmatchedSizes, + CV_Error( cv::Error::StsUnmatchedSizes, "The operation is neither 'array op array' " "(where arrays have the same size and the same number of channels), " "nor 'array op scalar', nor 'scalar op array'" ); @@ -669,7 +669,7 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst, else { if( !haveScalar && type1 != type2 ) - CV_Error(CV_StsBadArg, + CV_Error(cv::Error::StsBadArg, "When the input arrays in add/subtract/multiply/divide functions have different types, " "the output array type must be explicitly specified"); dtype = type1; @@ -1206,7 +1206,7 @@ void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op) return; } else if(is_src1_scalar == is_src2_scalar) - CV_Error( CV_StsUnmatchedSizes, + CV_Error( cv::Error::StsUnmatchedSizes, "The operation is neither 'array op array' (where arrays have the same size and the same type), " "nor 'array op scalar', nor 'scalar op array'" ); haveScalar = true; @@ -1615,7 +1615,7 @@ static bool ocl_inRange( InputArray _src, InputArray _lowerb, ssize != lsize || stype != ltype ) { if( !checkScalar(_lowerb, stype, lkind, skind) ) - CV_Error( CV_StsUnmatchedSizes, + CV_Error( cv::Error::StsUnmatchedSizes, "The lower boundary is neither an array of the same size and same type as src, nor a scalar"); lbScalar = true; } @@ -1624,7 +1624,7 @@ static bool ocl_inRange( InputArray _src, InputArray _lowerb, ssize != usize || stype != utype ) { if( !checkScalar(_upperb, stype, ukind, skind) ) - CV_Error( CV_StsUnmatchedSizes, + CV_Error( cv::Error::StsUnmatchedSizes, "The upper boundary is neither an array of the same size and same type as src, nor a scalar"); ubScalar = true; } @@ -1738,7 +1738,7 @@ void cv::inRange(InputArray _src, InputArray _lowerb, src.size != lb.size || src.type() != lb.type() ) { if( !checkScalar(lb, src.type(), lkind, skind) ) - CV_Error( CV_StsUnmatchedSizes, + CV_Error( cv::Error::StsUnmatchedSizes, "The lower boundary is neither an array of the same size and same type as src, nor a scalar"); lbScalar = true; } @@ -1747,7 +1747,7 @@ void cv::inRange(InputArray _src, InputArray _lowerb, src.size != ub.size || src.type() != ub.type() ) { if( !checkScalar(ub, src.type(), ukind, skind) ) - CV_Error( CV_StsUnmatchedSizes, + CV_Error( cv::Error::StsUnmatchedSizes, "The upper boundary is neither an array of the same size and same type as src, nor a scalar"); ubScalar = true; } diff --git a/modules/core/src/array.cpp b/modules/core/src/array.cpp index 1eef447d0c..252ac13ca0 100644 --- a/modules/core/src/array.cpp +++ b/modules/core/src/array.cpp @@ -79,7 +79,7 @@ cvSetIPLAllocators( Cv_iplCreateImageHeader createHeader, (createROI != 0) + (cloneImage != 0); if( count != 0 && count != 5 ) - CV_Error( CV_StsBadArg, "Either all the pointers should be null or " + CV_Error( cv::Error::StsBadArg, "Either all the pointers should be null or " "they all should be non-null" ); CvIPL.createHeader = createHeader; @@ -118,11 +118,11 @@ cvCreateMatHeader( int rows, int cols, int type ) type = CV_MAT_TYPE(type); if( rows < 0 || cols < 0 ) - CV_Error( CV_StsBadSize, "Non-positive width or height" ); + CV_Error( cv::Error::StsBadSize, "Non-positive width or height" ); int min_step = CV_ELEM_SIZE(type); if( min_step <= 0 ) - CV_Error( CV_StsUnsupportedFormat, "Invalid matrix type" ); + CV_Error( cv::Error::StsUnsupportedFormat, "Invalid matrix type" ); min_step *= cols; CvMat* arr = (CvMat*)cvAlloc( sizeof(*arr)); @@ -146,13 +146,13 @@ cvInitMatHeader( CvMat* arr, int rows, int cols, int type, void* data, int step ) { if( !arr ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( (unsigned)CV_MAT_DEPTH(type) > CV_DEPTH_MAX ) - CV_Error( CV_BadNumChannels, "" ); + CV_Error( cv::Error::BadNumChannels, "" ); if( rows < 0 || cols < 0 ) - CV_Error( CV_StsBadSize, "Non-positive cols or rows" ); + CV_Error( cv::Error::StsBadSize, "Non-positive cols or rows" ); type = CV_MAT_TYPE( type ); arr->type = type | CV_MAT_MAGIC_VAL; @@ -168,7 +168,7 @@ cvInitMatHeader( CvMat* arr, int rows, int cols, if( step != CV_AUTOSTEP && step != 0 ) { if( step < min_step ) - CV_Error( CV_BadStep, "" ); + CV_Error( cv::Error::BadStep, "" ); arr->step = step; } else @@ -196,7 +196,7 @@ cvReleaseMat( CvMat** array ) CvMat* arr = *array; if( !CV_IS_MAT_HDR_Z(arr) && !CV_IS_MATND_HDR(arr) ) - CV_Error( CV_StsBadFlag, "" ); + CV_Error( cv::Error::StsBadFlag, "" ); *array = 0; @@ -211,7 +211,7 @@ CV_IMPL CvMat* cvCloneMat( const CvMat* src ) { if( !CV_IS_MAT_HDR( src )) - CV_Error( CV_StsBadArg, "Bad CvMat header" ); + CV_Error( cv::Error::StsBadArg, "Bad CvMat header" ); CvMat* dst = cvCreateMatHeader( src->rows, src->cols, src->type ); @@ -237,25 +237,25 @@ cvInitMatNDHeader( CvMatND* mat, int dims, const int* sizes, int64 step = CV_ELEM_SIZE(type); if( !mat ) - CV_Error( CV_StsNullPtr, "NULL matrix header pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL matrix header pointer" ); if( step == 0 ) - CV_Error( CV_StsUnsupportedFormat, "invalid array data type" ); + CV_Error( cv::Error::StsUnsupportedFormat, "invalid array data type" ); if( !sizes ) - CV_Error( CV_StsNullPtr, "NULL pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL pointer" ); if( dims <= 0 || dims > CV_MAX_DIM ) - CV_Error( CV_StsOutOfRange, + CV_Error( cv::Error::StsOutOfRange, "non-positive or too large number of dimensions" ); for( int i = dims - 1; i >= 0; i-- ) { if( sizes[i] < 0 ) - CV_Error( CV_StsBadSize, "one of dimension sizes is non-positive" ); + CV_Error( cv::Error::StsBadSize, "one of dimension sizes is non-positive" ); mat->dim[i].size = sizes[i]; if( step > INT_MAX ) - CV_Error( CV_StsOutOfRange, "The array is too big" ); + CV_Error( cv::Error::StsOutOfRange, "The array is too big" ); mat->dim[i].step = (int)step; step *= sizes[i]; } @@ -285,7 +285,7 @@ CV_IMPL CvMatND* cvCreateMatNDHeader( int dims, const int* sizes, int type ) { if( dims <= 0 || dims > CV_MAX_DIM ) - CV_Error( CV_StsOutOfRange, + CV_Error( cv::Error::StsOutOfRange, "non-positive or too large number of dimensions" ); CvMatND* arr = (CvMatND*)cvAlloc( sizeof(*arr) ); @@ -301,7 +301,7 @@ CV_IMPL CvMatND* cvCloneMatND( const CvMatND* src ) { if( !CV_IS_MATND_HDR( src )) - CV_Error( CV_StsBadArg, "Bad CvMatND header" ); + CV_Error( cv::Error::StsBadArg, "Bad CvMatND header" ); CV_Assert( src->dims <= CV_MAX_DIM ); int sizes[CV_MAX_DIM]; @@ -335,12 +335,12 @@ cvGetMatND( const CvArr* arr, CvMatND* matnd, int* coi ) *coi = 0; if( !matnd || !arr ) - CV_Error( CV_StsNullPtr, "NULL array pointer is passed" ); + CV_Error( cv::Error::StsNullPtr, "NULL array pointer is passed" ); if( CV_IS_MATND_HDR(arr)) { if( !((CvMatND*)arr)->data.ptr ) - CV_Error( CV_StsNullPtr, "The matrix has NULL data pointer" ); + CV_Error( cv::Error::StsNullPtr, "The matrix has NULL data pointer" ); result = (CvMatND*)arr; } @@ -352,10 +352,10 @@ cvGetMatND( const CvArr* arr, CvMatND* matnd, int* coi ) mat = cvGetMat( mat, &stub, coi ); if( !CV_IS_MAT_HDR( mat )) - CV_Error( CV_StsBadArg, "Unrecognized or unsupported array type" ); + CV_Error( cv::Error::StsBadArg, "Unrecognized or unsupported array type" ); if( !mat->data.ptr ) - CV_Error( CV_StsNullPtr, "Input array has NULL data pointer" ); + CV_Error( cv::Error::StsNullPtr, "Input array has NULL data pointer" ); matnd->data.ptr = mat->data.ptr; matnd->refcount = 0; @@ -393,16 +393,16 @@ cvInitNArrayIterator( int count, CvArr** arrs, CvMatND* hdr0 = 0; if( count < 1 || count > CV_MAX_ARR ) - CV_Error( CV_StsOutOfRange, "Incorrect number of arrays" ); + CV_Error( cv::Error::StsOutOfRange, "Incorrect number of arrays" ); if( !arrs || !stubs ) - CV_Error( CV_StsNullPtr, "Some of required array pointers is NULL" ); + CV_Error( cv::Error::StsNullPtr, "Some of required array pointers is NULL" ); if( !iterator ) - CV_Error( CV_StsNullPtr, "Iterator pointer is NULL" ); + CV_Error( cv::Error::StsNullPtr, "Iterator pointer is NULL" ); if (mask) - CV_Error( CV_StsBadArg, "Iterator with mask is not supported" ); + CV_Error( cv::Error::StsBadArg, "Iterator with mask is not supported" ); for( i = 0; i < count; i++ ) { @@ -410,7 +410,7 @@ cvInitNArrayIterator( int count, CvArr** arrs, CvMatND* hdr; if( !arr ) - CV_Error( CV_StsNullPtr, "Some of required array pointers is NULL" ); + CV_Error( cv::Error::StsNullPtr, "Some of required array pointers is NULL" ); if( CV_IS_MATND( arr )) hdr = (CvMatND*)arr; @@ -419,7 +419,7 @@ cvInitNArrayIterator( int count, CvArr** arrs, int coi = 0; hdr = cvGetMatND( arr, stubs + i, &coi ); if( coi != 0 ) - CV_Error( CV_BadCOI, "COI set is not allowed here" ); + CV_Error( cv::Error::BadCOI, "COI set is not allowed here" ); } iterator->hdr[i] = hdr; @@ -427,24 +427,24 @@ cvInitNArrayIterator( int count, CvArr** arrs, if( i > 0 ) { if( hdr->dims != hdr0->dims ) - CV_Error( CV_StsUnmatchedSizes, + CV_Error( cv::Error::StsUnmatchedSizes, "Number of dimensions is the same for all arrays" ); switch( flags & (CV_NO_DEPTH_CHECK|CV_NO_CN_CHECK)) { case 0: if( !CV_ARE_TYPES_EQ( hdr, hdr0 )) - CV_Error( CV_StsUnmatchedFormats, + CV_Error( cv::Error::StsUnmatchedFormats, "Data type is not the same for all arrays" ); break; case CV_NO_DEPTH_CHECK: if( !CV_ARE_CNS_EQ( hdr, hdr0 )) - CV_Error( CV_StsUnmatchedFormats, + CV_Error( cv::Error::StsUnmatchedFormats, "Number of channels is not the same for all arrays" ); break; case CV_NO_CN_CHECK: if( !CV_ARE_CNS_EQ( hdr, hdr0 )) - CV_Error( CV_StsUnmatchedFormats, + CV_Error( cv::Error::StsUnmatchedFormats, "Depth is not the same for all arrays" ); break; } @@ -453,7 +453,7 @@ cvInitNArrayIterator( int count, CvArr** arrs, { for( j = 0; j < hdr->dims; j++ ) if( hdr->dim[j].size != hdr0->dim[j].size ) - CV_Error( CV_StsUnmatchedSizes, + CV_Error( cv::Error::StsUnmatchedSizes, "Dimension sizes are the same for all arrays" ); } } @@ -536,18 +536,18 @@ cvCreateSparseMat( int dims, const int* sizes, int type ) CvMemStorage* storage; if( pix_size == 0 ) - CV_Error( CV_StsUnsupportedFormat, "invalid array data type" ); + CV_Error( cv::Error::StsUnsupportedFormat, "invalid array data type" ); if( dims <= 0 || dims > CV_MAX_DIM ) - CV_Error( CV_StsOutOfRange, "bad number of dimensions" ); + CV_Error( cv::Error::StsOutOfRange, "bad number of dimensions" ); if( !sizes ) - CV_Error( CV_StsNullPtr, "NULL pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL pointer" ); for( i = 0; i < dims; i++ ) { if( sizes[i] <= 0 ) - CV_Error( CV_StsBadSize, "one of dimension sizes is non-positive" ); + CV_Error( cv::Error::StsBadSize, "one of dimension sizes is non-positive" ); } CvSparseMat* arr = (CvSparseMat*)cvAlloc(sizeof(*arr)+MAX(0,dims-CV_MAX_DIM)*sizeof(arr->size[0])); @@ -587,7 +587,7 @@ cvReleaseSparseMat( CvSparseMat** array ) CvSparseMat* arr = *array; if( !CV_IS_SPARSE_MAT_HDR(arr) ) - CV_Error( CV_StsBadFlag, "" ); + CV_Error( cv::Error::StsBadFlag, "" ); *array = 0; @@ -604,7 +604,7 @@ CV_IMPL CvSparseMat* cvCloneSparseMat( const CvSparseMat* src ) { if( !CV_IS_SPARSE_MAT_HDR(src) ) - CV_Error( CV_StsBadArg, "Invalid sparse array header" ); + CV_Error( cv::Error::StsBadArg, "Invalid sparse array header" ); CvSparseMat* dst = cvCreateSparseMat( src->dims, src->size, src->type ); cvCopy( src, dst ); @@ -619,10 +619,10 @@ cvInitSparseMatIterator( const CvSparseMat* mat, CvSparseMatIterator* iterator ) int idx; if( !CV_IS_SPARSE_MAT( mat )) - CV_Error( CV_StsBadArg, "Invalid sparse matrix header" ); + CV_Error( cv::Error::StsBadArg, "Invalid sparse matrix header" ); if( !iterator ) - CV_Error( CV_StsNullPtr, "NULL iterator pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL iterator pointer" ); iterator->mat = (CvSparseMat*)mat; iterator->node = 0; @@ -656,7 +656,7 @@ icvGetNodePtr( CvSparseMat* mat, const int* idx, int* _type, { int t = idx[i]; if( (unsigned)t >= (unsigned)mat->size[i] ) - CV_Error( CV_StsOutOfRange, "One of indices is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "One of indices is out of range" ); hashval = hashval*ICV_SPARSE_MAT_HASH_MULTIPLIER + t; } } @@ -750,7 +750,7 @@ icvDeleteNode( CvSparseMat* mat, const int* idx, unsigned* precalc_hashval ) { int t = idx[i]; if( (unsigned)t >= (unsigned)mat->size[i] ) - CV_Error( CV_StsOutOfRange, "One of indices is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "One of indices is out of range" ); hashval = hashval*ICV_SPARSE_MAT_HASH_MULTIPLIER + t; } } @@ -805,7 +805,7 @@ cvCreateData( CvArr* arr ) return; if( mat->data.ptr != 0 ) - CV_Error( CV_StsError, "Data is already allocated" ); + CV_Error( cv::Error::StsError, "Data is already allocated" ); if( step == 0 ) step = CV_ELEM_SIZE(mat->type)*mat->cols; @@ -813,7 +813,7 @@ cvCreateData( CvArr* arr ) int64 _total_size = (int64)step*mat->rows + sizeof(int) + CV_MALLOC_ALIGN; total_size = (size_t)_total_size; if(_total_size != (int64)total_size) - CV_Error(CV_StsNoMem, "Too big buffer is allocated" ); + CV_Error(cv::Error::StsNoMem, "Too big buffer is allocated" ); mat->refcount = (int*)cvAlloc( (size_t)total_size ); mat->data.ptr = (uchar*)cvAlignPtr( mat->refcount + 1, CV_MALLOC_ALIGN ); *mat->refcount = 1; @@ -823,13 +823,13 @@ cvCreateData( CvArr* arr ) IplImage* img = (IplImage*)arr; if( img->imageData != 0 ) - CV_Error( CV_StsError, "Data is already allocated" ); + CV_Error( cv::Error::StsError, "Data is already allocated" ); if( !CvIPL.allocateData ) { const int64 imageSize_tmp = (int64)img->widthStep*(int64)img->height; if( (int64)img->imageSize != imageSize_tmp ) - CV_Error( CV_StsNoMem, "Overflow for imageSize" ); + CV_Error( cv::Error::StsNoMem, "Overflow for imageSize" ); img->imageData = img->imageDataOrigin = (char*)cvAlloc( (size_t)img->imageSize ); } @@ -859,7 +859,7 @@ cvCreateData( CvArr* arr ) return; if( mat->data.ptr != 0 ) - CV_Error( CV_StsError, "Data is already allocated" ); + CV_Error( cv::Error::StsError, "Data is already allocated" ); if( CV_IS_MAT_CONT( mat->type )) { @@ -884,7 +884,7 @@ cvCreateData( CvArr* arr ) *mat->refcount = 1; } else - CV_Error( CV_StsBadArg, "unrecognized or unsupported array type" ); + CV_Error( cv::Error::StsBadArg, "unrecognized or unsupported array type" ); } @@ -908,7 +908,7 @@ cvSetData( CvArr* arr, void* data, int step ) if( step != CV_AUTOSTEP && step != 0 ) { if( step < min_step && data != 0 ) - CV_Error( CV_BadStep, "" ); + CV_Error( cv::Error::BadStep, "" ); mat->step = step; } else @@ -929,7 +929,7 @@ cvSetData( CvArr* arr, void* data, int step ) if( step != CV_AUTOSTEP && img->height > 1 ) { if( step < min_step && data != 0 ) - CV_Error( CV_BadStep, "" ); + CV_Error( cv::Error::BadStep, "" ); img->widthStep = step; } else @@ -940,7 +940,7 @@ cvSetData( CvArr* arr, void* data, int step ) const int64 imageSize_tmp = (int64)img->widthStep*(int64)img->height; img->imageSize = (int)imageSize_tmp; if( (int64)img->imageSize != imageSize_tmp ) - CV_Error( CV_StsNoMem, "Overflow for imageSize" ); + CV_Error( cv::Error::StsNoMem, "Overflow for imageSize" ); img->imageData = img->imageDataOrigin = (char*)data; if( (((int)(size_t)data | step) & 7) == 0 && @@ -956,7 +956,7 @@ cvSetData( CvArr* arr, void* data, int step ) int64 cur_step; if( step != CV_AUTOSTEP ) - CV_Error( CV_BadStep, + CV_Error( cv::Error::BadStep, "For multidimensional array only CV_AUTOSTEP is allowed here" ); mat->data.ptr = (uchar*)data; @@ -965,13 +965,13 @@ cvSetData( CvArr* arr, void* data, int step ) for( i = mat->dims - 1; i >= 0; i-- ) { if( cur_step > INT_MAX ) - CV_Error( CV_StsOutOfRange, "The array is too big" ); + CV_Error( cv::Error::StsOutOfRange, "The array is too big" ); mat->dim[i].step = (int)cur_step; cur_step *= mat->dim[i].size; } } else - CV_Error( CV_StsBadArg, "unrecognized or unsupported array type" ); + CV_Error( cv::Error::StsBadArg, "unrecognized or unsupported array type" ); } @@ -1000,7 +1000,7 @@ cvReleaseData( CvArr* arr ) } } else - CV_Error( CV_StsBadArg, "unrecognized or unsupported array type" ); + CV_Error( cv::Error::StsBadArg, "unrecognized or unsupported array type" ); } @@ -1048,7 +1048,7 @@ cvGetRawData( const CvArr* arr, uchar** data, int* step, CvSize* roi_size ) CvMatND* mat = (CvMatND*)arr; if( !CV_IS_MAT_CONT( mat->type )) - CV_Error( CV_StsBadArg, "Only continuous nD arrays are supported here" ); + CV_Error( cv::Error::StsBadArg, "Only continuous nD arrays are supported here" ); if( data ) *data = mat->data.ptr; @@ -1077,7 +1077,7 @@ cvGetRawData( const CvArr* arr, uchar** data, int* step, CvSize* roi_size ) } } else - CV_Error( CV_StsBadArg, "unrecognized or unsupported array type" ); + CV_Error( cv::Error::StsBadArg, "unrecognized or unsupported array type" ); } @@ -1093,7 +1093,7 @@ cvGetElemType( const CvArr* arr ) type = CV_MAKETYPE( IPL2CV_DEPTH(img->depth), img->nChannels ); } else - CV_Error( CV_StsBadArg, "unrecognized or unsupported array type" ); + CV_Error( cv::Error::StsBadArg, "unrecognized or unsupported array type" ); return type; } @@ -1147,7 +1147,7 @@ cvGetDims( const CvArr* arr, int* sizes ) memcpy( sizes, mat->size, dims*sizeof(sizes[0])); } else - CV_Error( CV_StsBadArg, "unrecognized or unsupported array type" ); + CV_Error( cv::Error::StsBadArg, "unrecognized or unsupported array type" ); return dims; } @@ -1172,7 +1172,7 @@ cvGetDimSize( const CvArr* arr, int index ) size = mat->cols; break; default: - CV_Error( CV_StsOutOfRange, "bad dimension index" ); + CV_Error( cv::Error::StsOutOfRange, "bad dimension index" ); } } else if( CV_IS_IMAGE( arr )) @@ -1188,7 +1188,7 @@ cvGetDimSize( const CvArr* arr, int index ) size = !img->roi ? img->width : img->roi->width; break; default: - CV_Error( CV_StsOutOfRange, "bad dimension index" ); + CV_Error( cv::Error::StsOutOfRange, "bad dimension index" ); } } else if( CV_IS_MATND_HDR( arr )) @@ -1196,7 +1196,7 @@ cvGetDimSize( const CvArr* arr, int index ) CvMatND* mat = (CvMatND*)arr; if( (unsigned)index >= (unsigned)mat->dims ) - CV_Error( CV_StsOutOfRange, "bad dimension index" ); + CV_Error( cv::Error::StsOutOfRange, "bad dimension index" ); size = mat->dim[index].size; } @@ -1205,12 +1205,12 @@ cvGetDimSize( const CvArr* arr, int index ) CvSparseMat* mat = (CvSparseMat*)arr; if( (unsigned)index >= (unsigned)mat->dims ) - CV_Error( CV_StsOutOfRange, "bad dimension index" ); + CV_Error( cv::Error::StsOutOfRange, "bad dimension index" ); size = mat->size[index]; } else - CV_Error( CV_StsBadArg, "unrecognized or unsupported array type" ); + CV_Error( cv::Error::StsBadArg, "unrecognized or unsupported array type" ); return size; } @@ -1245,7 +1245,7 @@ cvGetSize( const CvArr* arr ) } } else - CV_Error( CV_StsBadArg, "Array should be CvMat or IplImage" ); + CV_Error( cv::Error::StsBadArg, "Array should be CvMat or IplImage" ); return size; } @@ -1262,14 +1262,14 @@ cvGetSubRect( const CvArr* arr, CvMat* submat, CvRect rect ) mat = cvGetMat( mat, &stub ); if( !submat ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( (rect.x|rect.y|rect.width|rect.height) < 0 ) - CV_Error( CV_StsBadSize, "" ); + CV_Error( cv::Error::StsBadSize, "" ); if( rect.x + rect.width > mat->cols || rect.y + rect.height > mat->rows ) - CV_Error( CV_StsBadSize, "" ); + CV_Error( cv::Error::StsBadSize, "" ); { /* @@ -1307,11 +1307,11 @@ cvGetRows( const CvArr* arr, CvMat* submat, mat = cvGetMat( mat, &stub ); if( !submat ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( (unsigned)start_row >= (unsigned)mat->rows || (unsigned)end_row > (unsigned)mat->rows || delta_row <= 0 ) - CV_Error( CV_StsOutOfRange, "" ); + CV_Error( cv::Error::StsOutOfRange, "" ); { /* @@ -1359,12 +1359,12 @@ cvGetCols( const CvArr* arr, CvMat* submat, int start_col, int end_col ) mat = cvGetMat( mat, &stub ); if( !submat ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); cols = mat->cols; if( (unsigned)start_col >= (unsigned)cols || (unsigned)end_col > (unsigned)cols ) - CV_Error( CV_StsOutOfRange, "" ); + CV_Error( cv::Error::StsOutOfRange, "" ); { /* @@ -1401,7 +1401,7 @@ cvGetDiag( const CvArr* arr, CvMat* submat, int diag ) mat = cvGetMat( mat, &stub ); if( !submat ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); pix_size = CV_ELEM_SIZE(mat->type); @@ -1419,7 +1419,7 @@ cvGetDiag( const CvArr* arr, CvMat* submat, int diag ) len = mat->cols - diag; if( len <= 0 ) - CV_Error( CV_StsOutOfRange, "" ); + CV_Error( cv::Error::StsOutOfRange, "" ); len = CV_IMIN( len, mat->rows ); submat->data.ptr = mat->data.ptr + diag*pix_size; @@ -1429,7 +1429,7 @@ cvGetDiag( const CvArr* arr, CvMat* submat, int diag ) len = mat->rows + diag; if( len <= 0 ) - CV_Error( CV_StsOutOfRange, "" ); + CV_Error( cv::Error::StsOutOfRange, "" ); len = CV_IMIN( len, mat->cols ); submat->data.ptr = mat->data.ptr - diag*mat->step; @@ -1464,7 +1464,7 @@ cvScalarToRawData( const CvScalar* scalar, void* data, int type, int extend_to_1 CV_Assert( scalar && data ); if( (unsigned)(cn - 1) >= 4 ) - CV_Error( CV_StsOutOfRange, "The number of channels must be 1, 2, 3 or 4" ); + CV_Error( cv::Error::StsOutOfRange, "The number of channels must be 1, 2, 3 or 4" ); switch( depth ) { @@ -1510,7 +1510,7 @@ cvScalarToRawData( const CvScalar* scalar, void* data, int type, int extend_to_1 break; default: CV_Assert(0); - CV_Error( CV_BadDepth, "" ); + CV_Error( cv::Error::BadDepth, "" ); } if( extend_to_12 ) @@ -1537,7 +1537,7 @@ cvRawDataToScalar( const void* data, int flags, CvScalar* scalar ) CV_Assert( scalar && data ); if( (unsigned)(cn - 1) >= 4 ) - CV_Error( CV_StsOutOfRange, "The number of channels must be 1, 2, 3 or 4" ); + CV_Error( cv::Error::StsOutOfRange, "The number of channels must be 1, 2, 3 or 4" ); memset( scalar->val, 0, sizeof(scalar->val)); @@ -1573,7 +1573,7 @@ cvRawDataToScalar( const void* data, int flags, CvScalar* scalar ) break; default: CV_Assert(0); - CV_Error( CV_BadDepth, "" ); + CV_Error( cv::Error::BadDepth, "" ); } } @@ -1660,7 +1660,7 @@ cvPtr1D( const CvArr* arr, int idx, int* _type ) // that the index is within the matrix if( (unsigned)idx >= (unsigned)(mat->rows + mat->cols - 1) && (unsigned)idx >= (unsigned)(mat->rows*mat->cols)) - CV_Error( CV_StsOutOfRange, "index is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "index is out of range" ); if( CV_IS_MAT_CONT(mat->type)) { @@ -1697,7 +1697,7 @@ cvPtr1D( const CvArr* arr, int idx, int* _type ) size *= mat->dim[j].size; if((unsigned)idx >= (unsigned)size ) - CV_Error( CV_StsOutOfRange, "index is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "index is out of range" ); if( CV_IS_MAT_CONT(mat->type)) { @@ -1741,7 +1741,7 @@ cvPtr1D( const CvArr* arr, int idx, int* _type ) } else { - CV_Error( CV_StsBadArg, "unrecognized or unsupported array type" ); + CV_Error( cv::Error::StsBadArg, "unrecognized or unsupported array type" ); } return ptr; @@ -1760,7 +1760,7 @@ cvPtr2D( const CvArr* arr, int y, int x, int* _type ) if( (unsigned)y >= (unsigned)(mat->rows) || (unsigned)x >= (unsigned)(mat->cols) ) - CV_Error( CV_StsOutOfRange, "index is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "index is out of range" ); type = CV_MAT_TYPE(mat->type); if( _type ) @@ -1790,7 +1790,7 @@ cvPtr2D( const CvArr* arr, int y, int x, int* _type ) { int coi = img->roi->coi; if( !coi ) - CV_Error( CV_BadCOI, + CV_Error( cv::Error::BadCOI, "COI must be non-null in case of planar images" ); ptr += (coi - 1)*img->imageSize; } @@ -1803,7 +1803,7 @@ cvPtr2D( const CvArr* arr, int y, int x, int* _type ) if( (unsigned)y >= (unsigned)height || (unsigned)x >= (unsigned)width ) - CV_Error( CV_StsOutOfRange, "index is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "index is out of range" ); ptr += y*img->widthStep + x*pix_size; @@ -1811,7 +1811,7 @@ cvPtr2D( const CvArr* arr, int y, int x, int* _type ) { int type = IPL2CV_DEPTH(img->depth); if( type < 0 || (unsigned)(img->nChannels - 1) > 3 ) - CV_Error( CV_StsUnsupportedFormat, "" ); + CV_Error( cv::Error::StsUnsupportedFormat, "" ); *_type = CV_MAKETYPE( type, img->nChannels ); } @@ -1823,7 +1823,7 @@ cvPtr2D( const CvArr* arr, int y, int x, int* _type ) if( mat->dims != 2 || (unsigned)y >= (unsigned)(mat->dim[0].size) || (unsigned)x >= (unsigned)(mat->dim[1].size) ) - CV_Error( CV_StsOutOfRange, "index is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "index is out of range" ); ptr = mat->data.ptr + (size_t)y*mat->dim[0].step + x*mat->dim[1].step; if( _type ) @@ -1837,7 +1837,7 @@ cvPtr2D( const CvArr* arr, int y, int x, int* _type ) } else { - CV_Error( CV_StsBadArg, "unrecognized or unsupported array type" ); + CV_Error( cv::Error::StsBadArg, "unrecognized or unsupported array type" ); } return ptr; @@ -1857,7 +1857,7 @@ cvPtr3D( const CvArr* arr, int z, int y, int x, int* _type ) (unsigned)z >= (unsigned)(mat->dim[0].size) || (unsigned)y >= (unsigned)(mat->dim[1].size) || (unsigned)x >= (unsigned)(mat->dim[2].size) ) - CV_Error( CV_StsOutOfRange, "index is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "index is out of range" ); ptr = mat->data.ptr + (size_t)z*mat->dim[0].step + (size_t)y*mat->dim[1].step + x*mat->dim[2].step; @@ -1872,7 +1872,7 @@ cvPtr3D( const CvArr* arr, int z, int y, int x, int* _type ) } else { - CV_Error( CV_StsBadArg, "unrecognized or unsupported array type" ); + CV_Error( cv::Error::StsBadArg, "unrecognized or unsupported array type" ); } return ptr; @@ -1886,7 +1886,7 @@ cvPtrND( const CvArr* arr, const int* idx, int* _type, { uchar* ptr = 0; if( !idx ) - CV_Error( CV_StsNullPtr, "NULL pointer to indices" ); + CV_Error( cv::Error::StsNullPtr, "NULL pointer to indices" ); if( CV_IS_SPARSE_MAT( arr )) ptr = icvGetNodePtr( (CvSparseMat*)arr, idx, @@ -1900,7 +1900,7 @@ cvPtrND( const CvArr* arr, const int* idx, int* _type, for( i = 0; i < mat->dims; i++ ) { if( (unsigned)idx[i] >= (unsigned)(mat->dim[i].size) ) - CV_Error( CV_StsOutOfRange, "index is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "index is out of range" ); ptr += (size_t)idx[i]*mat->dim[i].step; } @@ -1910,7 +1910,7 @@ cvPtrND( const CvArr* arr, const int* idx, int* _type, else if( CV_IS_MAT_HDR(arr) || CV_IS_IMAGE_HDR(arr) ) ptr = cvPtr2D( arr, idx[0], idx[1], _type ); else - CV_Error( CV_StsBadArg, "unrecognized or unsupported array type" ); + CV_Error( cv::Error::StsBadArg, "unrecognized or unsupported array type" ); return ptr; } @@ -1935,7 +1935,7 @@ cvGet1D( const CvArr* arr, int idx ) // that the index is within the matrix if( (unsigned)idx >= (unsigned)(mat->rows + mat->cols - 1) && (unsigned)idx >= (unsigned)(mat->rows*mat->cols)) - CV_Error( CV_StsOutOfRange, "index is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "index is out of range" ); ptr = mat->data.ptr + (size_t)idx*pix_size; } @@ -1965,7 +1965,7 @@ cvGet2D( const CvArr* arr, int y, int x ) if( (unsigned)y >= (unsigned)(mat->rows) || (unsigned)x >= (unsigned)(mat->cols) ) - CV_Error( CV_StsOutOfRange, "index is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "index is out of range" ); type = CV_MAT_TYPE(mat->type); ptr = mat->data.ptr + (size_t)y*mat->step + x*CV_ELEM_SIZE(type); @@ -2046,7 +2046,7 @@ cvGetReal1D( const CvArr* arr, int idx ) // that the index is within the matrix if( (unsigned)idx >= (unsigned)(mat->rows + mat->cols - 1) && (unsigned)idx >= (unsigned)(mat->rows*mat->cols)) - CV_Error( CV_StsOutOfRange, "index is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "index is out of range" ); ptr = mat->data.ptr + (size_t)idx*pix_size; } @@ -2058,7 +2058,7 @@ cvGetReal1D( const CvArr* arr, int idx ) if( ptr ) { if( CV_MAT_CN( type ) > 1 ) - CV_Error( CV_BadNumChannels, "cvGetReal* support only single-channel arrays" ); + CV_Error( cv::Error::BadNumChannels, "cvGetReal* support only single-channel arrays" ); value = icvGetReal( ptr, type ); } @@ -2080,7 +2080,7 @@ cvGetReal2D( const CvArr* arr, int y, int x ) if( (unsigned)y >= (unsigned)(mat->rows) || (unsigned)x >= (unsigned)(mat->cols) ) - CV_Error( CV_StsOutOfRange, "index is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "index is out of range" ); type = CV_MAT_TYPE(mat->type); ptr = mat->data.ptr + (size_t)y*mat->step + x*CV_ELEM_SIZE(type); @@ -2096,7 +2096,7 @@ cvGetReal2D( const CvArr* arr, int y, int x ) if( ptr ) { if( CV_MAT_CN( type ) > 1 ) - CV_Error( CV_BadNumChannels, "cvGetReal* support only single-channel arrays" ); + CV_Error( cv::Error::BadNumChannels, "cvGetReal* support only single-channel arrays" ); value = icvGetReal( ptr, type ); } @@ -2124,7 +2124,7 @@ cvGetReal3D( const CvArr* arr, int z, int y, int x ) if( ptr ) { if( CV_MAT_CN( type ) > 1 ) - CV_Error( CV_BadNumChannels, "cvGetReal* support only single-channel arrays" ); + CV_Error( cv::Error::BadNumChannels, "cvGetReal* support only single-channel arrays" ); value = icvGetReal( ptr, type ); } @@ -2149,7 +2149,7 @@ cvGetRealND( const CvArr* arr, const int* idx ) if( ptr ) { if( CV_MAT_CN( type ) > 1 ) - CV_Error( CV_BadNumChannels, "cvGetReal* support only single-channel arrays" ); + CV_Error( cv::Error::BadNumChannels, "cvGetReal* support only single-channel arrays" ); value = icvGetReal( ptr, type ); } @@ -2176,7 +2176,7 @@ cvSet1D( CvArr* arr, int idx, CvScalar scalar ) // that the index is within the matrix if( (unsigned)idx >= (unsigned)(mat->rows + mat->cols - 1) && (unsigned)idx >= (unsigned)(mat->rows*mat->cols)) - CV_Error( CV_StsOutOfRange, "index is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "index is out of range" ); ptr = mat->data.ptr + (size_t)idx*pix_size; } @@ -2202,7 +2202,7 @@ cvSet2D( CvArr* arr, int y, int x, CvScalar scalar ) if( (unsigned)y >= (unsigned)(mat->rows) || (unsigned)x >= (unsigned)(mat->cols) ) - CV_Error( CV_StsOutOfRange, "index is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "index is out of range" ); type = CV_MAT_TYPE(mat->type); ptr = mat->data.ptr + (size_t)y*mat->step + x*CV_ELEM_SIZE(type); @@ -2268,7 +2268,7 @@ cvSetReal1D( CvArr* arr, int idx, double value ) // that the index is within the matrix if( (unsigned)idx >= (unsigned)(mat->rows + mat->cols - 1) && (unsigned)idx >= (unsigned)(mat->rows*mat->cols)) - CV_Error( CV_StsOutOfRange, "index is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "index is out of range" ); ptr = mat->data.ptr + (size_t)idx*pix_size; } @@ -2278,7 +2278,7 @@ cvSetReal1D( CvArr* arr, int idx, double value ) ptr = icvGetNodePtr( (CvSparseMat*)arr, &idx, &type, -1, 0 ); if( CV_MAT_CN( type ) > 1 ) - CV_Error( CV_BadNumChannels, "cvSetReal* support only single-channel arrays" ); + CV_Error( cv::Error::BadNumChannels, "cvSetReal* support only single-channel arrays" ); if( ptr ) icvSetReal( value, ptr, type ); @@ -2297,7 +2297,7 @@ cvSetReal2D( CvArr* arr, int y, int x, double value ) if( (unsigned)y >= (unsigned)(mat->rows) || (unsigned)x >= (unsigned)(mat->cols) ) - CV_Error( CV_StsOutOfRange, "index is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "index is out of range" ); type = CV_MAT_TYPE(mat->type); ptr = mat->data.ptr + (size_t)y*mat->step + x*CV_ELEM_SIZE(type); @@ -2312,7 +2312,7 @@ cvSetReal2D( CvArr* arr, int y, int x, double value ) ptr = icvGetNodePtr( (CvSparseMat*)arr, idx, &type, -1, 0 ); } if( CV_MAT_CN( type ) > 1 ) - CV_Error( CV_BadNumChannels, "cvSetReal* support only single-channel arrays" ); + CV_Error( cv::Error::BadNumChannels, "cvSetReal* support only single-channel arrays" ); if( ptr ) icvSetReal( value, ptr, type ); @@ -2333,7 +2333,7 @@ cvSetReal3D( CvArr* arr, int z, int y, int x, double value ) ptr = icvGetNodePtr( (CvSparseMat*)arr, idx, &type, -1, 0 ); } if( CV_MAT_CN( type ) > 1 ) - CV_Error( CV_BadNumChannels, "cvSetReal* support only single-channel arrays" ); + CV_Error( cv::Error::BadNumChannels, "cvSetReal* support only single-channel arrays" ); if( ptr ) icvSetReal( value, ptr, type ); @@ -2352,7 +2352,7 @@ cvSetRealND( CvArr* arr, const int* idx, double value ) ptr = icvGetNodePtr( (CvSparseMat*)arr, idx, &type, -1, 0 ); if( CV_MAT_CN( type ) > 1 ) - CV_Error( CV_BadNumChannels, "cvSetReal* support only single-channel arrays" ); + CV_Error( cv::Error::BadNumChannels, "cvSetReal* support only single-channel arrays" ); if( ptr ) icvSetReal( value, ptr, type ); @@ -2389,12 +2389,12 @@ cvGetMat( const CvArr* array, CvMat* mat, int coi = 0; if( !mat || !src ) - CV_Error( CV_StsNullPtr, "NULL array pointer is passed" ); + CV_Error( cv::Error::StsNullPtr, "NULL array pointer is passed" ); if( CV_IS_MAT_HDR(src)) { if( !src->data.ptr ) - CV_Error( CV_StsNullPtr, "The matrix has NULL data pointer" ); + CV_Error( cv::Error::StsNullPtr, "The matrix has NULL data pointer" ); result = (CvMat*)src; } @@ -2404,11 +2404,11 @@ cvGetMat( const CvArr* array, CvMat* mat, int depth, order; if( img->imageData == 0 ) - CV_Error( CV_StsNullPtr, "The image has NULL data pointer" ); + CV_Error( cv::Error::StsNullPtr, "The image has NULL data pointer" ); depth = IPL2CV_DEPTH( img->depth ); if( depth < 0 ) - CV_Error( CV_BadDepth, "" ); + CV_Error( cv::Error::BadDepth, "" ); order = img->dataOrder & (img->nChannels > 1 ? -1 : 0); @@ -2419,7 +2419,7 @@ cvGetMat( const CvArr* array, CvMat* mat, int type = depth; if( img->roi->coi == 0 ) - CV_Error( CV_StsBadFlag, + CV_Error( cv::Error::StsBadFlag, "Images with planar data layout should be used with COI selected" ); cvInitMatHeader( mat, img->roi->height, @@ -2435,7 +2435,7 @@ cvGetMat( const CvArr* array, CvMat* mat, coi = img->roi->coi; if( img->nChannels > CV_CN_MAX ) - CV_Error( CV_BadNumChannels, + CV_Error( cv::Error::BadNumChannels, "The image is interleaved and has over CV_CN_MAX channels" ); cvInitMatHeader( mat, img->roi->height, img->roi->width, @@ -2450,7 +2450,7 @@ cvGetMat( const CvArr* array, CvMat* mat, int type = CV_MAKETYPE( depth, img->nChannels ); if( order != IPL_DATA_ORDER_PIXEL ) - CV_Error( CV_StsBadFlag, "Pixel order should be used with coi == 0" ); + CV_Error( cv::Error::StsBadFlag, "Pixel order should be used with coi == 0" ); cvInitMatHeader( mat, img->height, img->width, type, img->imageData, img->widthStep ); @@ -2464,10 +2464,10 @@ cvGetMat( const CvArr* array, CvMat* mat, int size1 = matnd->dim[0].size, size2 = 1; if( !src->data.ptr ) - CV_Error( CV_StsNullPtr, "Input array has NULL data pointer" ); + CV_Error( cv::Error::StsNullPtr, "Input array has NULL data pointer" ); if( !CV_IS_MAT_CONT( matnd->type )) - CV_Error( CV_StsBadArg, "Only continuous nD arrays are supported here" ); + CV_Error( cv::Error::StsBadArg, "Only continuous nD arrays are supported here" ); if( matnd->dims > 2 ) { @@ -2491,7 +2491,7 @@ cvGetMat( const CvArr* array, CvMat* mat, result = mat; } else - CV_Error( CV_StsBadFlag, "Unrecognized or unsupported array type" ); + CV_Error( cv::Error::StsBadFlag, "Unrecognized or unsupported array type" ); if( pCOI ) *pCOI = coi; @@ -2509,10 +2509,10 @@ cvReshapeMatND( const CvArr* arr, int dims, coi = 0; if( !arr || !_header ) - CV_Error( CV_StsNullPtr, "NULL pointer to array or destination header" ); + CV_Error( cv::Error::StsNullPtr, "NULL pointer to array or destination header" ); if( new_cn == 0 && new_dims == 0 ) - CV_Error( CV_StsBadArg, "None of array parameters is changed: dummy call?" ); + CV_Error( cv::Error::StsBadArg, "None of array parameters is changed: dummy call?" ); dims = cvGetDims( arr ); @@ -2528,9 +2528,9 @@ cvReshapeMatND( const CvArr* arr, else { if( new_dims <= 0 || new_dims > CV_MAX_DIM ) - CV_Error( CV_StsOutOfRange, "Non-positive or too large number of dimensions" ); + CV_Error( cv::Error::StsOutOfRange, "Non-positive or too large number of dimensions" ); if( !new_sizes ) - CV_Error( CV_StsNullPtr, "New dimension sizes are not specified" ); + CV_Error( cv::Error::StsNullPtr, "New dimension sizes are not specified" ); } if( new_dims <= 2 ) @@ -2542,7 +2542,7 @@ cvReshapeMatND( const CvArr* arr, int total_width, new_rows, cn; if( sizeof_header != sizeof(CvMat) && sizeof_header != sizeof(CvMatND) ) - CV_Error( CV_StsBadArg, "The output header should be CvMat or CvMatND" ); + CV_Error( cv::Error::StsBadArg, "The output header should be CvMat or CvMatND" ); if( mat == (CvMat*)_header ) { @@ -2575,13 +2575,13 @@ cvReshapeMatND( const CvArr* arr, int total_size = total_width * mat->rows; if( !CV_IS_MAT_CONT( mat->type )) - CV_Error( CV_BadStep, + CV_Error( cv::Error::BadStep, "The matrix is not continuous so the number of rows can not be changed" ); total_width = total_size / new_rows; if( total_width * new_rows != total_size ) - CV_Error( CV_StsBadArg, "The total number of matrix elements " + CV_Error( cv::Error::StsBadArg, "The total number of matrix elements " "is not divisible by the new number of rows" ); } @@ -2590,7 +2590,7 @@ cvReshapeMatND( const CvArr* arr, if( header.cols * new_cn != total_width || (new_sizes && header.cols != new_sizes[1]) ) - CV_Error( CV_StsBadArg, "The total matrix width is not " + CV_Error( cv::Error::StsBadArg, "The total matrix width is not " "divisible by the new number of columns" ); header.type = (mat->type & ~CV_MAT_TYPE_MASK) | CV_MAKETYPE(mat->type, new_cn); @@ -2614,12 +2614,12 @@ cvReshapeMatND( const CvArr* arr, CvMatND* header = (CvMatND*)_header; if( sizeof_header != sizeof(CvMatND)) - CV_Error( CV_StsBadSize, "The output header should be CvMatND" ); + CV_Error( cv::Error::StsBadSize, "The output header should be CvMatND" ); if( !new_sizes ) { if( !CV_IS_MATND( arr )) - CV_Error( CV_StsBadArg, "The input array must be CvMatND" ); + CV_Error( cv::Error::StsBadArg, "The input array must be CvMatND" ); { CvMatND* mat = (CvMatND*)arr; @@ -2628,7 +2628,7 @@ cvReshapeMatND( const CvArr* arr, int new_size = last_dim_size/new_cn; if( new_size*new_cn != last_dim_size ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "The last dimension full size is not divisible by new number of channels"); if( mat != header ) @@ -2650,7 +2650,7 @@ cvReshapeMatND( const CvArr* arr, int step; if( new_cn != 0 ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "Simultaneous change of shape and number of channels is not supported. " "Do it by 2 separate calls" ); @@ -2661,7 +2661,7 @@ cvReshapeMatND( const CvArr* arr, } if( CV_IS_MAT_CONT( mat->type )) - CV_Error( CV_StsBadArg, "Non-continuous nD arrays are not supported" ); + CV_Error( cv::Error::StsBadArg, "Non-continuous nD arrays are not supported" ); size1 = mat->dim[0].size; for( i = 1; i < dims; i++ ) @@ -2671,13 +2671,13 @@ cvReshapeMatND( const CvArr* arr, for( i = 0; i < new_dims; i++ ) { if( new_sizes[i] <= 0 ) - CV_Error( CV_StsBadSize, + CV_Error( cv::Error::StsBadSize, "One of new dimension sizes is non-positive" ); size2 *= new_sizes[i]; } if( size1 != size2 ) - CV_Error( CV_StsBadSize, + CV_Error( cv::Error::StsBadSize, "Number of elements in the original and reshaped array is different" ); if( header != mat ) @@ -2701,7 +2701,7 @@ cvReshapeMatND( const CvArr* arr, } if( coi ) - CV_Error( CV_BadCOI, "COI is not supported by this operation" ); + CV_Error( cv::Error::BadCOI, "COI is not supported by this operation" ); result = _header; return result; @@ -2717,20 +2717,20 @@ cvReshape( const CvArr* array, CvMat* header, int total_width, new_width; if( !header ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( !CV_IS_MAT( mat )) { int coi = 0; mat = cvGetMat( mat, header, &coi, 1 ); if( coi ) - CV_Error( CV_BadCOI, "COI is not supported" ); + CV_Error( cv::Error::BadCOI, "COI is not supported" ); } if( new_cn == 0 ) new_cn = CV_MAT_CN(mat->type); else if( (unsigned)(new_cn - 1) > 3 ) - CV_Error( CV_BadNumChannels, "" ); + CV_Error( cv::Error::BadNumChannels, "" ); if( mat != header ) { @@ -2754,16 +2754,16 @@ cvReshape( const CvArr* array, CvMat* header, { int total_size = total_width * mat->rows; if( !CV_IS_MAT_CONT( mat->type )) - CV_Error( CV_BadStep, + CV_Error( cv::Error::BadStep, "The matrix is not continuous, thus its number of rows can not be changed" ); if( (unsigned)new_rows > (unsigned)total_size ) - CV_Error( CV_StsOutOfRange, "Bad new number of rows" ); + CV_Error( cv::Error::StsOutOfRange, "Bad new number of rows" ); total_width = total_size / new_rows; if( total_width * new_rows != total_size ) - CV_Error( CV_StsBadArg, "The total number of matrix elements " + CV_Error( cv::Error::StsBadArg, "The total number of matrix elements " "is not divisible by the new number of rows" ); header->rows = new_rows; @@ -2773,7 +2773,7 @@ cvReshape( const CvArr* array, CvMat* header, new_width = total_width / new_cn; if( new_width * new_cn != total_width ) - CV_Error( CV_BadNumChannels, + CV_Error( cv::Error::BadNumChannels, "The total width is not divisible by the new number of channels" ); header->cols = new_width; @@ -2792,17 +2792,17 @@ cvGetImage( const CvArr* array, IplImage* img ) const IplImage* src = (const IplImage*)array; if( !img ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( !CV_IS_IMAGE_HDR(src) ) { const CvMat* mat = (const CvMat*)src; if( !CV_IS_MAT_HDR(mat)) - CV_Error( CV_StsBadFlag, "" ); + CV_Error( cv::Error::StsBadFlag, "" ); if( mat->data.ptr == 0 ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); int depth = cvIplDepth(mat->type); @@ -2942,7 +2942,7 @@ cvInitImageHeader( IplImage * image, CvSize size, int depth, depth != (int)IPL_DEPTH_16S && depth != (int)IPL_DEPTH_32S && depth != (int)IPL_DEPTH_32F && depth != (int)IPL_DEPTH_64F) || channels < 0 ) - CV_Error( CV_BadDepth, "Unsupported format" ); + CV_Error( cv::Error::BadDepth, "Unsupported format" ); if( origin != CV_ORIGIN_BL && origin != CV_ORIGIN_TL ) CV_Error( CV_BadOrigin, "Bad input origin" ); @@ -2969,7 +2969,7 @@ cvInitImageHeader( IplImage * image, CvSize size, int depth, const int64 imageSize_tmp = (int64)image->widthStep*(int64)image->height; image->imageSize = (int)imageSize_tmp; if( (int64)image->imageSize != imageSize_tmp ) - CV_Error( CV_StsNoMem, "Overflow for imageSize" ); + CV_Error( cv::Error::StsNoMem, "Overflow for imageSize" ); return image; } @@ -2979,7 +2979,7 @@ CV_IMPL void cvReleaseImageHeader( IplImage** image ) { if( !image ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( *image ) { @@ -3003,7 +3003,7 @@ CV_IMPL void cvReleaseImage( IplImage ** image ) { if( !image ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( *image ) { @@ -3077,7 +3077,7 @@ cvGetImageROI( const IplImage* img ) { CvRect rect = {0, 0, 0, 0}; if( !img ) - CV_Error( CV_StsNullPtr, "Null pointer to image" ); + CV_Error( cv::Error::StsNullPtr, "Null pointer to image" ); if( img->roi ) rect = cvRect( img->roi->xOffset, img->roi->yOffset, @@ -3096,7 +3096,7 @@ cvSetImageCOI( IplImage* image, int coi ) CV_Error( CV_HeaderIsNull, "" ); if( (unsigned)coi > (unsigned)(image->nChannels) ) - CV_Error( CV_BadCOI, "" ); + CV_Error( cv::Error::BadCOI, "" ); if( image->roi || coi != 0 ) { @@ -3128,7 +3128,7 @@ cvCloneImage( const IplImage* src ) IplImage* dst = 0; if( !CV_IS_IMAGE_HDR( src )) - CV_Error( CV_StsBadArg, "Bad image header" ); + CV_Error( cv::Error::StsBadArg, "Bad image header" ); if( !CvIPL.cloneImage ) { @@ -3174,13 +3174,13 @@ cvCheckTermCriteria( CvTermCriteria criteria, double default_eps, crit.epsilon = (float)default_eps; if( (criteria.type & ~(CV_TERMCRIT_EPS | CV_TERMCRIT_ITER)) != 0 ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "Unknown type of term criteria" ); if( (criteria.type & CV_TERMCRIT_ITER) != 0 ) { if( criteria.max_iter <= 0 ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "Iterations flag is set and maximum number of iterations is <= 0" ); crit.max_iter = criteria.max_iter; } @@ -3188,13 +3188,13 @@ cvCheckTermCriteria( CvTermCriteria criteria, double default_eps, if( (criteria.type & CV_TERMCRIT_EPS) != 0 ) { if( criteria.epsilon < 0 ) - CV_Error( CV_StsBadArg, "Accuracy flag is set and epsilon is < 0" ); + CV_Error( cv::Error::StsBadArg, "Accuracy flag is set and epsilon is < 0" ); crit.epsilon = criteria.epsilon; } if( (criteria.type & (CV_TERMCRIT_EPS | CV_TERMCRIT_ITER)) == 0 ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "Neither accuracy nor maximum iterations " "number flags are set in criteria type" ); @@ -3221,7 +3221,7 @@ CV_IMPL void cvRelease( void** struct_ptr ) { if( !struct_ptr ) - CV_Error( CV_StsNullPtr, "NULL double pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL double pointer" ); if( *struct_ptr ) { @@ -3230,7 +3230,7 @@ cvRelease( void** struct_ptr ) else if( CV_IS_IMAGE(*struct_ptr)) cvReleaseImage((IplImage**)struct_ptr); else - CV_Error( CV_StsError, "Unknown object type" ); + CV_Error( cv::Error::StsError, "Unknown object type" ); } } @@ -3238,14 +3238,14 @@ void* cvClone( const void* struct_ptr ) { void* ptr = 0; if( !struct_ptr ) - CV_Error( CV_StsNullPtr, "NULL structure pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL structure pointer" ); if( CV_IS_MAT(struct_ptr) ) ptr = cvCloneMat((const CvMat*)struct_ptr); else if( CV_IS_IMAGE(struct_ptr)) ptr = cvCloneImage((const IplImage*)struct_ptr); else - CV_Error( CV_StsError, "Unknown object type" ); + CV_Error( cv::Error::StsError, "Unknown object type" ); return ptr; } diff --git a/modules/core/src/batch_distance.cpp b/modules/core/src/batch_distance.cpp index 1ce2edb769..4210c672b9 100644 --- a/modules/core/src/batch_distance.cpp +++ b/modules/core/src/batch_distance.cpp @@ -377,7 +377,7 @@ void cv::batchDistance( InputArray _src1, InputArray _src2, } if( func == 0 ) - CV_Error_(CV_StsUnsupportedFormat, + CV_Error_(cv::Error::StsUnsupportedFormat, ("The combination of type=%d, dtype=%d and normType=%d is not supported", type, dtype, normType)); diff --git a/modules/core/src/command_line_parser.cpp b/modules/core/src/command_line_parser.cpp index af97232db6..a83cb3166d 100644 --- a/modules/core/src/command_line_parser.cpp +++ b/modules/core/src/command_line_parser.cpp @@ -464,7 +464,7 @@ std::vector CommandLineParser::Impl::split_range_string(const String& _s { if (begin == true) { - throw cv::Exception(CV_StsParseError, + throw cv::Exception(cv::Error::StsParseError, String("error in split_range_string(") + str + String(", ") @@ -484,7 +484,7 @@ std::vector CommandLineParser::Impl::split_range_string(const String& _s { if (begin == false) { - throw cv::Exception(CV_StsParseError, + throw cv::Exception(cv::Error::StsParseError, String("error in split_range_string(") + str + String(", ") @@ -508,7 +508,7 @@ std::vector CommandLineParser::Impl::split_range_string(const String& _s if (begin == true) { - throw cv::Exception(CV_StsParseError, + throw cv::Exception(cv::Error::StsParseError, String("error in split_range_string(") + str + String(", ") diff --git a/modules/core/src/copy.cpp b/modules/core/src/copy.cpp index d641c6f497..f4c98b49c0 100644 --- a/modules/core/src/copy.cpp +++ b/modules/core/src/copy.cpp @@ -96,7 +96,7 @@ void scalarToRawData(const Scalar& s, void* _buf, int type, int unroll_to) scalarToRawData_(s, (float16_t*)_buf, cn, unroll_to); break; default: - CV_Error(CV_StsUnsupportedFormat,""); + CV_Error(cv::Error::StsUnsupportedFormat,""); } } @@ -788,7 +788,7 @@ int cv::borderInterpolate( int p, int len, int borderType ) else if( borderType == BORDER_CONSTANT ) p = -1; else - CV_Error( CV_StsBadArg, "Unknown/unsupported border type" ); + CV_Error( cv::Error::StsBadArg, "Unknown/unsupported border type" ); return p; } diff --git a/modules/core/src/datastructs.cpp b/modules/core/src/datastructs.cpp index 80b02283dc..17da7119a3 100644 --- a/modules/core/src/datastructs.cpp +++ b/modules/core/src/datastructs.cpp @@ -91,7 +91,7 @@ static void icvInitMemStorage( CvMemStorage* storage, int block_size ) { if( !storage ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( block_size <= 0 ) block_size = CV_STORAGE_BLOCK_SIZE; @@ -120,7 +120,7 @@ CV_IMPL CvMemStorage * cvCreateChildMemStorage( CvMemStorage * parent ) { if( !parent ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); CvMemStorage* storage = cvCreateMemStorage(parent->block_size); storage->parent = parent; @@ -137,7 +137,7 @@ icvDestroyMemStorage( CvMemStorage* storage ) CvMemBlock *dst_top = 0; if( !storage ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( storage->parent ) dst_top = storage->parent->top; @@ -180,7 +180,7 @@ CV_IMPL void cvReleaseMemStorage( CvMemStorage** storage ) { if( !storage ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); CvMemStorage* st = *storage; *storage = 0; @@ -197,7 +197,7 @@ CV_IMPL void cvClearMemStorage( CvMemStorage * storage ) { if( !storage ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( storage->parent ) icvDestroyMemStorage( storage ); @@ -215,7 +215,7 @@ static void icvGoNextMemBlock( CvMemStorage * storage ) { if( !storage ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( !storage->top || !storage->top->next ) { @@ -273,7 +273,7 @@ CV_IMPL void cvSaveMemStoragePos( const CvMemStorage * storage, CvMemStoragePos * pos ) { if( !storage || !pos ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); pos->top = storage->top; pos->free_space = storage->free_space; @@ -285,9 +285,9 @@ CV_IMPL void cvRestoreMemStoragePos( CvMemStorage * storage, CvMemStoragePos * pos ) { if( !storage || !pos ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( pos->free_space > storage->block_size ) - CV_Error( CV_StsBadSize, "" ); + CV_Error( cv::Error::StsBadSize, "" ); /* // this breaks icvGoNextMemBlock, so comment it off for now @@ -324,10 +324,10 @@ cvMemStorageAlloc( CvMemStorage* storage, size_t size ) { schar *ptr = 0; if( !storage ) - CV_Error( CV_StsNullPtr, "NULL storage pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL storage pointer" ); if( size > INT_MAX ) - CV_Error( CV_StsOutOfRange, "Too large memory block is requested" ); + CV_Error( cv::Error::StsOutOfRange, "Too large memory block is requested" ); CV_Assert( storage->free_space % CV_STRUCT_ALIGN == 0 ); @@ -335,7 +335,7 @@ cvMemStorageAlloc( CvMemStorage* storage, size_t size ) { size_t max_free_space = cvAlignLeft(storage->block_size - sizeof(CvMemBlock), CV_STRUCT_ALIGN); if( max_free_space < size ) - CV_Error( CV_StsOutOfRange, "requested size is negative or too big" ); + CV_Error( cv::Error::StsOutOfRange, "requested size is negative or too big" ); icvGoNextMemBlock( storage ); } @@ -374,9 +374,9 @@ cvCreateSeq( int seq_flags, size_t header_size, size_t elem_size, CvMemStorage* CvSeq *seq = 0; if( !storage ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( header_size < sizeof( CvSeq ) || elem_size <= 0 ) - CV_Error( CV_StsBadSize, "" ); + CV_Error( cv::Error::StsBadSize, "" ); /* allocate sequence header */ seq = (CvSeq*)cvMemStorageAlloc( storage, header_size ); @@ -390,7 +390,7 @@ cvCreateSeq( int seq_flags, size_t header_size, size_t elem_size, CvMemStorage* if( elemtype != CV_SEQ_ELTYPE_GENERIC && elemtype != CV_SEQ_ELTYPE_PTR && typesize != 0 && typesize != (int)elem_size ) - CV_Error( CV_StsBadSize, + CV_Error( cv::Error::StsBadSize, "Specified element size doesn't match to the size of the specified element type " "(try to use 0 for element type)" ); } @@ -412,9 +412,9 @@ cvSetSeqBlockSize( CvSeq *seq, int delta_elements ) int useful_block_size; if( !seq || !seq->storage ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( delta_elements < 0 ) - CV_Error( CV_StsOutOfRange, "" ); + CV_Error( cv::Error::StsOutOfRange, "" ); useful_block_size = cvAlignLeft(seq->storage->block_size - sizeof(CvMemBlock) - sizeof(CvSeqBlock), CV_STRUCT_ALIGN); @@ -429,7 +429,7 @@ cvSetSeqBlockSize( CvSeq *seq, int delta_elements ) { delta_elements = useful_block_size / elem_size; if( delta_elements == 0 ) - CV_Error( CV_StsOutOfRange, "Storage block size is too small " + CV_Error( cv::Error::StsOutOfRange, "Storage block size is too small " "to fit the sequence elements" ); } @@ -487,7 +487,7 @@ cvSeqElemIdx( const CvSeq* seq, const void* _element, CvSeqBlock** _block ) CvSeqBlock *block; if( !seq || !element ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); block = first_block = seq->first; elem_size = seq->elem_size; @@ -548,7 +548,7 @@ cvCvtSeqToArray( const CvSeq *seq, void *array, CvSlice slice ) char *dst = (char*)array; if( !seq || !array ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); elem_size = seq->elem_size; total = cvSliceLength( slice, seq )*elem_size; @@ -587,10 +587,10 @@ cvMakeSeqHeaderForArray( int seq_flags, int header_size, int elem_size, CvSeq* result = 0; if( elem_size <= 0 || header_size < (int)sizeof( CvSeq ) || total < 0 ) - CV_Error( CV_StsBadSize, "" ); + CV_Error( cv::Error::StsBadSize, "" ); if( !seq || ((!array || !block) && total > 0) ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); memset( seq, 0, header_size ); @@ -602,7 +602,7 @@ cvMakeSeqHeaderForArray( int seq_flags, int header_size, int elem_size, if( elemtype != CV_SEQ_ELTYPE_GENERIC && typesize != 0 && typesize != elem_size ) - CV_Error( CV_StsBadSize, + CV_Error( cv::Error::StsBadSize, "Element size doesn't match to the size of predefined element type " "(try to use 0 for sequence element type)" ); } @@ -634,7 +634,7 @@ icvGrowSeq( CvSeq *seq, int in_front_of ) CvSeqBlock *block; if( !seq ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); block = seq->free_blocks; if( !block ) @@ -647,7 +647,7 @@ icvGrowSeq( CvSeq *seq, int in_front_of ) cvSetSeqBlockSize( seq, delta_elems*2 ); if( !storage ) - CV_Error( CV_StsNullPtr, "The sequence has NULL storage pointer" ); + CV_Error( cv::Error::StsNullPtr, "The sequence has NULL storage pointer" ); /* If there is a free space just after last allocated block and it is big enough then enlarge the last block. @@ -817,7 +817,7 @@ CV_IMPL void cvStartAppendToSeq( CvSeq *seq, CvSeqWriter * writer ) { if( !seq || !writer ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); memset( writer, 0, sizeof( *writer )); writer->header_size = sizeof( CvSeqWriter ); @@ -835,7 +835,7 @@ cvStartWriteSeq( int seq_flags, int header_size, int elem_size, CvMemStorage * storage, CvSeqWriter * writer ) { if( !storage || !writer ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); CvSeq* seq = cvCreateSeq( seq_flags, header_size, elem_size, storage ); cvStartAppendToSeq( seq, writer ); @@ -847,7 +847,7 @@ CV_IMPL void cvFlushSeqWriter( CvSeqWriter * writer ) { if( !writer ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); CvSeq* seq = writer->seq; seq->ptr = writer->ptr; @@ -878,7 +878,7 @@ CV_IMPL CvSeq * cvEndWriteSeq( CvSeqWriter * writer ) { if( !writer ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); cvFlushSeqWriter( writer ); CvSeq* seq = writer->seq; @@ -909,7 +909,7 @@ CV_IMPL void cvCreateSeqBlock( CvSeqWriter * writer ) { if( !writer || !writer->seq ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); CvSeq* seq = writer->seq; @@ -942,7 +942,7 @@ cvStartReadSeq( const CvSeq *seq, CvSeqReader * reader, int reverse ) } if( !seq || !reader ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); reader->header_size = sizeof( CvSeqReader ); reader->seq = (CvSeq*)seq; @@ -992,7 +992,7 @@ cvChangeSeqBlock( void* _reader, int direction ) CvSeqReader* reader = (CvSeqReader*)_reader; if( !reader ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( direction > 0 ) { @@ -1017,7 +1017,7 @@ cvGetSeqReaderPos( CvSeqReader* reader ) int index = -1; if( !reader || !reader->ptr ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); elem_size = reader->seq->elem_size; if( elem_size <= ICV_SHIFT_TAB_MAX && (index = icvPower2ShiftTab[elem_size - 1]) >= 0 ) @@ -1042,7 +1042,7 @@ cvSetSeqReaderPos( CvSeqReader* reader, int index, int is_relative ) int elem_size, count, total; if( !reader || !reader->seq ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); total = reader->seq->total; elem_size = reader->seq->elem_size; @@ -1052,14 +1052,14 @@ cvSetSeqReaderPos( CvSeqReader* reader, int index, int is_relative ) if( index < 0 ) { if( index < -total ) - CV_Error( CV_StsOutOfRange, "" ); + CV_Error( cv::Error::StsOutOfRange, "" ); index += total; } else if( index >= total ) { index -= total; if( index >= total ) - CV_Error( CV_StsOutOfRange, "" ); + CV_Error( cv::Error::StsOutOfRange, "" ); } block = reader->seq->first; @@ -1135,7 +1135,7 @@ cvSeqPush( CvSeq *seq, const void *element ) size_t elem_size; if( !seq ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); elem_size = seq->elem_size; ptr = seq->ptr; @@ -1166,9 +1166,9 @@ cvSeqPop( CvSeq *seq, void *element ) int elem_size; if( !seq ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( seq->total <= 0 ) - CV_Error( CV_StsBadSize, "" ); + CV_Error( cv::Error::StsBadSize, "" ); elem_size = seq->elem_size; seq->ptr = ptr = seq->ptr - elem_size; @@ -1195,7 +1195,7 @@ cvSeqPushFront( CvSeq *seq, const void *element ) CvSeqBlock *block; if( !seq ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); elem_size = seq->elem_size; block = seq->first; @@ -1228,9 +1228,9 @@ cvSeqPopFront( CvSeq *seq, void *element ) CvSeqBlock *block; if( !seq ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( seq->total <= 0 ) - CV_Error( CV_StsBadSize, "" ); + CV_Error( cv::Error::StsBadSize, "" ); elem_size = seq->elem_size; block = seq->first; @@ -1257,14 +1257,14 @@ cvSeqInsert( CvSeq *seq, int before_index, const void *element ) schar* ret_ptr = 0; if( !seq ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); total = seq->total; before_index += before_index < 0 ? total : 0; before_index -= before_index > total ? total : 0; if( (unsigned)before_index > (unsigned)total ) - CV_Error( CV_StsOutOfRange, "" ); + CV_Error( cv::Error::StsOutOfRange, "" ); if( before_index == total ) { @@ -1375,7 +1375,7 @@ cvSeqRemove( CvSeq *seq, int index ) int total, front = 0; if( !seq ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); total = seq->total; @@ -1383,7 +1383,7 @@ cvSeqRemove( CvSeq *seq, int index ) index -= index >= total ? total : 0; if( (unsigned) index >= (unsigned) total ) - CV_Error( CV_StsOutOfRange, "Invalid index" ); + CV_Error( cv::Error::StsOutOfRange, "Invalid index" ); if( index == total - 1 ) { @@ -1456,9 +1456,9 @@ cvSeqPushMulti( CvSeq *seq, const void *_elements, int count, int front ) char *elements = (char *) _elements; if( !seq ) - CV_Error( CV_StsNullPtr, "NULL sequence pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL sequence pointer" ); if( count < 0 ) - CV_Error( CV_StsBadSize, "number of removed elements is negative" ); + CV_Error( cv::Error::StsBadSize, "number of removed elements is negative" ); int elem_size = seq->elem_size; @@ -1525,9 +1525,9 @@ cvSeqPopMulti( CvSeq *seq, void *_elements, int count, int front ) char *elements = (char *) _elements; if( !seq ) - CV_Error( CV_StsNullPtr, "NULL sequence pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL sequence pointer" ); if( count < 0 ) - CV_Error( CV_StsBadSize, "number of removed elements is negative" ); + CV_Error( cv::Error::StsBadSize, "number of removed elements is negative" ); count = MIN( count, seq->total ); @@ -1593,7 +1593,7 @@ CV_IMPL void cvClearSeq( CvSeq *seq ) { if( !seq ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); cvSeqPopMulti( seq, 0, seq->total ); } @@ -1607,13 +1607,13 @@ cvSeqSlice( const CvSeq* seq, CvSlice slice, CvMemStorage* storage, int copy_dat CvSeqBlock *block, *first_block = 0, *last_block = 0; if( !CV_IS_SEQ(seq) ) - CV_Error( CV_StsBadArg, "Invalid sequence header" ); + CV_Error( cv::Error::StsBadArg, "Invalid sequence header" ); if( !storage ) { storage = seq->storage; if( !storage ) - CV_Error( CV_StsNullPtr, "NULL storage pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL storage pointer" ); } elem_size = seq->elem_size; @@ -1624,7 +1624,7 @@ cvSeqSlice( const CvSeq* seq, CvSlice slice, CvMemStorage* storage, int copy_dat slice.start_index -= seq->total; if( (unsigned)length > (unsigned)seq->total || ((unsigned)slice.start_index >= (unsigned)seq->total && length != 0) ) - CV_Error( CV_StsOutOfRange, "Bad sequence slice" ); + CV_Error( cv::Error::StsOutOfRange, "Bad sequence slice" ); subseq = cvCreateSeq( seq->flags, seq->header_size, elem_size, storage ); @@ -1680,7 +1680,7 @@ cvSeqRemoveSlice( CvSeq* seq, CvSlice slice ) int total, length; if( !CV_IS_SEQ(seq) ) - CV_Error( CV_StsBadArg, "Invalid sequence header" ); + CV_Error( cv::Error::StsBadArg, "Invalid sequence header" ); length = cvSliceLength( slice, seq ); total = seq->total; @@ -1691,7 +1691,7 @@ cvSeqRemoveSlice( CvSeq* seq, CvSlice slice ) slice.start_index -= total; if( (unsigned)slice.start_index >= (unsigned)total ) - CV_Error( CV_StsOutOfRange, "start slice index is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "start slice index is out of range" ); slice.end_index = slice.start_index + length; @@ -1757,16 +1757,16 @@ cvSeqInsertSlice( CvSeq* seq, int index, const CvArr* from_arr ) CvSeqBlock block; if( !CV_IS_SEQ(seq) ) - CV_Error( CV_StsBadArg, "Invalid destination sequence header" ); + CV_Error( cv::Error::StsBadArg, "Invalid destination sequence header" ); if( !CV_IS_SEQ(from)) { CvMat* mat = (CvMat*)from; if( !CV_IS_MAT(mat)) - CV_Error( CV_StsBadArg, "Source is not a sequence nor matrix" ); + CV_Error( cv::Error::StsBadArg, "Source is not a sequence nor matrix" ); if( !CV_IS_MAT_CONT(mat->type) || (mat->rows != 1 && mat->cols != 1) ) - CV_Error( CV_StsBadArg, "The source array must be 1d continuous vector" ); + CV_Error( cv::Error::StsBadArg, "The source array must be 1d continuous vector" ); from = cvMakeSeqHeaderForArray( CV_SEQ_KIND_GENERIC, sizeof(from_header), CV_ELEM_SIZE(mat->type), @@ -1775,7 +1775,7 @@ cvSeqInsertSlice( CvSeq* seq, int index, const CvArr* from_arr ) } if( seq->elem_size != from->elem_size ) - CV_Error( CV_StsUnmatchedSizes, + CV_Error( cv::Error::StsUnmatchedSizes, "Source and destination sequence element sizes are different." ); from_total = from->total; @@ -1788,7 +1788,7 @@ cvSeqInsertSlice( CvSeq* seq, int index, const CvArr* from_arr ) index -= index > total ? total : 0; if( (unsigned)index > (unsigned)total ) - CV_Error( CV_StsOutOfRange, "" ); + CV_Error( cv::Error::StsOutOfRange, "" ); elem_size = seq->elem_size; @@ -1918,10 +1918,10 @@ cvSeqSort( CvSeq* seq, CvCmpFunc cmp_func, void* aux ) stack[48]; if( !CV_IS_SEQ(seq) ) - CV_Error( !seq ? CV_StsNullPtr : CV_StsBadArg, "Bad input sequence" ); + CV_Error( !seq ? cv::Error::StsNullPtr : cv::Error::StsBadArg, "Bad input sequence" ); if( !cmp_func ) - CV_Error( CV_StsNullPtr, "Null compare function" ); + CV_Error( cv::Error::StsNullPtr, "Null compare function" ); if( seq->total <= 1 ) return; @@ -2195,10 +2195,10 @@ cvSeqSearch( CvSeq* seq, const void* _elem, CvCmpFunc cmp_func, *_idx = idx; if( !CV_IS_SEQ(seq) ) - CV_Error( !seq ? CV_StsNullPtr : CV_StsBadArg, "Bad input sequence" ); + CV_Error( !seq ? cv::Error::StsNullPtr : cv::Error::StsBadArg, "Bad input sequence" ); if( !elem ) - CV_Error( CV_StsNullPtr, "Null element pointer" ); + CV_Error( cv::Error::StsNullPtr, "Null element pointer" ); int elem_size = seq->elem_size; int total = seq->total; @@ -2256,7 +2256,7 @@ cvSeqSearch( CvSeq* seq, const void* _elem, CvCmpFunc cmp_func, else { if( !cmp_func ) - CV_Error( CV_StsNullPtr, "Null compare function" ); + CV_Error( cv::Error::StsNullPtr, "Null compare function" ); i = 0, j = total; @@ -2340,16 +2340,16 @@ cvSeqPartition( const CvSeq* seq, CvMemStorage* storage, CvSeq** labels, int is_set; if( !labels ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( !seq || !is_equal ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( !storage ) storage = seq->storage; if( !storage ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); is_set = CV_IS_SET(seq); @@ -2483,11 +2483,11 @@ CV_IMPL CvSet* cvCreateSet( int set_flags, int header_size, int elem_size, CvMemStorage * storage ) { if( !storage ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( header_size < (int)sizeof( CvSet ) || elem_size < (int)sizeof(void*)*2 || (elem_size & (sizeof(void*)-1)) != 0 ) - CV_Error( CV_StsBadSize, "" ); + CV_Error( cv::Error::StsBadSize, "" ); CvSet* set = (CvSet*) cvCreateSeq( set_flags, header_size, elem_size, storage ); set->flags = (set->flags & ~CV_MAGIC_MASK) | CV_SET_MAGIC_VAL; @@ -2504,7 +2504,7 @@ cvSetAdd( CvSet* set, CvSetElem* element, CvSetElem** inserted_element ) CvSetElem *free_elem; if( !set ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( !(set->free_elems) ) { @@ -2552,7 +2552,7 @@ cvSetRemove( CvSet* set, int index ) if( elem ) cvSetRemoveByPtr( set, elem ); else if( !set ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); } @@ -2583,7 +2583,7 @@ cvCreateGraph( int graph_type, int header_size, || edge_size < (int) sizeof( CvGraphEdge ) || vtx_size < (int) sizeof( CvGraphVtx ) ){ - CV_Error( CV_StsBadSize, "" ); + CV_Error( cv::Error::StsBadSize, "" ); } vertices = cvCreateSet( graph_type, header_size, vtx_size, storage ); @@ -2602,7 +2602,7 @@ CV_IMPL void cvClearGraph( CvGraph * graph ) { if( !graph ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); cvClearSet( graph->edges ); cvClearSet( (CvSet*)graph ); @@ -2617,7 +2617,7 @@ cvGraphAddVtx( CvGraph* graph, const CvGraphVtx* _vertex, CvGraphVtx** _inserted int index = -1; if( !graph ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); vertex = (CvGraphVtx*)cvSetNew((CvSet*)graph); if( vertex ) @@ -2642,10 +2642,10 @@ cvGraphRemoveVtxByPtr( CvGraph* graph, CvGraphVtx* vtx ) int count = -1; if( !graph || !vtx ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( !CV_IS_SET_ELEM(vtx)) - CV_Error( CV_StsBadArg, "The vertex does not belong to the graph" ); + CV_Error( cv::Error::StsBadArg, "The vertex does not belong to the graph" ); count = graph->edges->active_count; for( ;; ) @@ -2670,11 +2670,11 @@ cvGraphRemoveVtx( CvGraph* graph, int index ) CvGraphVtx *vtx = 0; if( !graph ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); vtx = cvGetGraphVtx( graph, index ); if( !vtx ) - CV_Error( CV_StsBadArg, "The vertex is not found" ); + CV_Error( cv::Error::StsBadArg, "The vertex is not found" ); count = graph->edges->active_count; for( ;; ) @@ -2702,7 +2702,7 @@ cvFindGraphEdgeByPtr( const CvGraph* graph, int ofs = 0; if( !graph || !start_vtx || !end_vtx ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( start_vtx == end_vtx ) return 0; @@ -2735,7 +2735,7 @@ cvFindGraphEdge( const CvGraph* graph, int start_idx, int end_idx ) CvGraphVtx *end_vtx; if( !graph ) - CV_Error( CV_StsNullPtr, "graph pointer is NULL" ); + CV_Error( cv::Error::StsNullPtr, "graph pointer is NULL" ); start_vtx = cvGetGraphVtx( graph, start_idx ); end_vtx = cvGetGraphVtx( graph, end_idx ); @@ -2759,7 +2759,7 @@ cvGraphAddEdgeByPtr( CvGraph* graph, int delta; if( !graph ) - CV_Error( CV_StsNullPtr, "graph pointer is NULL" ); + CV_Error( cv::Error::StsNullPtr, "graph pointer is NULL" ); if( !CV_IS_GRAPH_ORIENTED( graph ) && (start_vtx->flags & CV_SET_ELEM_IDX_MASK) > (end_vtx->flags & CV_SET_ELEM_IDX_MASK) ) @@ -2778,7 +2778,7 @@ cvGraphAddEdgeByPtr( CvGraph* graph, } if( start_vtx == end_vtx ) - CV_Error( start_vtx ? CV_StsBadArg : CV_StsNullPtr, + CV_Error( start_vtx ? cv::Error::StsBadArg : cv::Error::StsNullPtr, "vertex pointers coincide (or set to NULL)" ); edge = (CvGraphEdge*)cvSetNew( (CvSet*)(graph->edges) ); @@ -2826,7 +2826,7 @@ cvGraphAddEdge( CvGraph* graph, CvGraphVtx *end_vtx; if( !graph ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); start_vtx = cvGetGraphVtx( graph, start_idx ); end_vtx = cvGetGraphVtx( graph, end_idx ); @@ -2843,7 +2843,7 @@ cvGraphRemoveEdgeByPtr( CvGraph* graph, CvGraphVtx* start_vtx, CvGraphVtx* end_v CvGraphEdge *edge, *next_edge, *prev_edge; if( !graph || !start_vtx || !end_vtx ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( start_vtx == end_vtx ) return; @@ -2902,7 +2902,7 @@ cvGraphRemoveEdge( CvGraph* graph, int start_idx, int end_idx ) CvGraphVtx *end_vtx; if( !graph ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); start_vtx = cvGetGraphVtx( graph, start_idx ); end_vtx = cvGetGraphVtx( graph, end_idx ); @@ -2919,7 +2919,7 @@ cvGraphVtxDegreeByPtr( const CvGraph* graph, const CvGraphVtx* vertex ) int count; if( !graph || !vertex ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); for( edge = vertex->first, count = 0; edge; ) { @@ -2940,11 +2940,11 @@ cvGraphVtxDegree( const CvGraph* graph, int vtx_idx ) int count; if( !graph ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); vertex = cvGetGraphVtx( graph, vtx_idx ); if( !vertex ) - CV_Error( CV_StsObjectNotFound, "" ); + CV_Error( cv::Error::StsObjectNotFound, "" ); for( edge = vertex->first, count = 0; edge; ) { @@ -2971,13 +2971,13 @@ icvSeqElemsClearFlags( CvSeq* seq, int offset, int clear_mask ) int i, total, elem_size; if( !seq ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); elem_size = seq->elem_size; total = seq->total; if( (unsigned)offset > (unsigned)elem_size ) - CV_Error( CV_StsBadArg, "" ); + CV_Error( cv::Error::StsBadArg, "" ); cvStartReadSeq( seq, &reader ); @@ -3001,14 +3001,14 @@ icvSeqFindNextElem( CvSeq* seq, int offset, int mask, int total, elem_size, index; if( !seq || !start_index ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); elem_size = seq->elem_size; total = seq->total; index = *start_index; if( (unsigned)offset > (unsigned)elem_size ) - CV_Error( CV_StsBadArg, "" ); + CV_Error( cv::Error::StsBadArg, "" ); if( total == 0 ) return 0; @@ -3048,7 +3048,7 @@ CV_IMPL CvGraphScanner* cvCreateGraphScanner( CvGraph* graph, CvGraphVtx* vtx, int mask ) { if( !graph ) - CV_Error( CV_StsNullPtr, "Null graph pointer" ); + CV_Error( cv::Error::StsNullPtr, "Null graph pointer" ); CV_Assert( graph->storage != 0 ); @@ -3082,7 +3082,7 @@ CV_IMPL void cvReleaseGraphScanner( CvGraphScanner** scanner ) { if( !scanner ) - CV_Error( CV_StsNullPtr, "Null double pointer to graph scanner" ); + CV_Error( cv::Error::StsNullPtr, "Null double pointer to graph scanner" ); if( *scanner ) { @@ -3103,7 +3103,7 @@ cvNextGraphItem( CvGraphScanner* scanner ) CvGraphItem item; if( !scanner || !(scanner->stack)) - CV_Error( CV_StsNullPtr, "Null graph scanner" ); + CV_Error( cv::Error::StsNullPtr, "Null graph scanner" ); dst = scanner->dst; vtx = scanner->vtx; @@ -3259,13 +3259,13 @@ cvCloneGraph( const CvGraph* graph, CvMemStorage* storage ) CvSeqReader reader; if( !CV_IS_GRAPH(graph)) - CV_Error( CV_StsBadArg, "Invalid graph pointer" ); + CV_Error( cv::Error::StsBadArg, "Invalid graph pointer" ); if( !storage ) storage = graph->storage; if( !storage ) - CV_Error( CV_StsNullPtr, "NULL storage pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL storage pointer" ); vtx_size = graph->elem_size; edge_size = graph->edges->elem_size; @@ -3343,7 +3343,7 @@ cvTreeToNodeSeq( const void* first, int header_size, CvMemStorage* storage ) CvTreeNodeIterator iterator; if( !storage ) - CV_Error( CV_StsNullPtr, "NULL storage pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL storage pointer" ); allseq = cvCreateSeq( 0, header_size, sizeof(first), storage ); @@ -3389,7 +3389,7 @@ cvInsertNodeIntoTree( void* _node, void* _parent, void* _frame ) CvTreeNode* parent = (CvTreeNode*)_parent; if( !node || !parent ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); node->v_prev = _parent != _frame ? parent : 0; node->h_next = parent->v_next; @@ -3410,10 +3410,10 @@ cvRemoveNodeFromTree( void* _node, void* _frame ) CvTreeNode* frame = (CvTreeNode*)_frame; if( !node ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( node == frame ) - CV_Error( CV_StsBadArg, "frame node could not be deleted" ); + CV_Error( cv::Error::StsBadArg, "frame node could not be deleted" ); if( node->h_next ) node->h_next->h_prev = node->h_prev; @@ -3440,10 +3440,10 @@ cvInitTreeNodeIterator( CvTreeNodeIterator* treeIterator, const void* first, int max_level ) { if( !treeIterator || !first ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( max_level < 0 ) - CV_Error( CV_StsOutOfRange, "" ); + CV_Error( cv::Error::StsOutOfRange, "" ); treeIterator->node = (void*)first; treeIterator->level = 0; @@ -3459,7 +3459,7 @@ cvNextTreeNode( CvTreeNodeIterator* treeIterator ) int level; if( !treeIterator ) - CV_Error( CV_StsNullPtr, "NULL iterator pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL iterator pointer" ); prevNode = node = (CvTreeNode*)treeIterator->node; level = treeIterator->level; @@ -3500,7 +3500,7 @@ cvPrevTreeNode( CvTreeNodeIterator* treeIterator ) int level; if( !treeIterator ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); prevNode = node = (CvTreeNode*)treeIterator->node; level = treeIterator->level; diff --git a/modules/core/src/dxt.cpp b/modules/core/src/dxt.cpp index 6dca818b1c..d491be5cd1 100644 --- a/modules/core/src/dxt.cpp +++ b/modules/core/src/dxt.cpp @@ -3469,7 +3469,7 @@ Ptr DFT2D::create(int width, int height, int depth, { if(width == 1 && nonzero_rows > 0 ) { - CV_Error( CV_StsNotImplemented, + CV_Error( cv::Error::StsNotImplemented, "This mode (using nonzero_rows with a single-column matrix) breaks the function's logic, so it is prohibited.\n" "For fast convolution/correlation use 2-column matrix or single-row matrix instead" ); } @@ -4317,7 +4317,7 @@ public: if( len != prev_len ) { if( len > 1 && (len & 1) ) - CV_Error( CV_StsNotImplemented, "Odd-size DCT\'s are not implemented" ); + CV_Error( cv::Error::StsNotImplemented, "Odd-size DCT\'s are not implemented" ); opt.nf = DFTFactorize( len, opt.factors ); bool inplace_transform = opt.factors[0] == opt.factors[opt.nf-1]; diff --git a/modules/core/src/glob.cpp b/modules/core/src/glob.cpp index b7cf1bf236..03638d49b1 100644 --- a/modules/core/src/glob.cpp +++ b/modules/core/src/glob.cpp @@ -276,7 +276,7 @@ static void glob_rec(const cv::String& directory, const cv::String& wildchart, s } else { - CV_Error_(CV_StsObjectNotFound, ("could not open directory: %s", directory.c_str())); + CV_Error_(cv::Error::StsObjectNotFound, ("could not open directory: %s", directory.c_str())); } } #endif // OPENCV_HAVE_FILESYSTEM_SUPPORT diff --git a/modules/core/src/lapack.cpp b/modules/core/src/lapack.cpp index 12376c2508..83adeeabc3 100644 --- a/modules/core/src/lapack.cpp +++ b/modules/core/src/lapack.cpp @@ -1191,7 +1191,7 @@ bool solve( InputArray _src, InputArray _src2arg, OutputArray _dst, int method ) Mat dst = _dst.getMat(); if( m < n ) - CV_Error(CV_StsBadArg, "The function can not solve under-determined linear systems" ); + CV_Error(cv::Error::StsBadArg, "The function can not solve under-determined linear systems" ); if( m == n ) is_normal = false; @@ -1515,7 +1515,7 @@ void SVD::backSubst( InputArray _w, InputArray _u, InputArray _vt, vt.ptr(), vt.step, true, rhs.ptr(), rhs.step, nb, dst.ptr(), dst.step, buffer.data()); else - CV_Error( CV_StsUnsupportedFormat, "" ); + CV_Error( cv::Error::StsUnsupportedFormat, "" ); } diff --git a/modules/core/src/mathfuncs.cpp b/modules/core/src/mathfuncs.cpp index 525d71ba09..04604e84c0 100644 --- a/modules/core/src/mathfuncs.cpp +++ b/modules/core/src/mathfuncs.cpp @@ -1566,7 +1566,7 @@ bool checkRange(InputArray _src, bool quiet, Point* pt, double minVal, double ma { cv::String value_str; value_str << src(cv::Range(badPt.y, badPt.y + 1), cv::Range(badPt.x, badPt.x + 1)); - CV_Error_( CV_StsOutOfRange, + CV_Error_( cv::Error::StsOutOfRange, ("the value at (%d, %d)=%s is out of range [%f, %f)", badPt.x, badPt.y, value_str.c_str(), minVal, maxVal)); } return false; diff --git a/modules/core/src/matmul.dispatch.cpp b/modules/core/src/matmul.dispatch.cpp index a213ca06c7..a72301b4c3 100644 --- a/modules/core/src/matmul.dispatch.cpp +++ b/modules/core/src/matmul.dispatch.cpp @@ -921,7 +921,7 @@ void mulTransposed(InputArray _src, OutputArray _dst, bool ata, { MulTransposedFunc func = getMulTransposedFunc(stype, dtype, ata); if( !func ) - CV_Error( CV_StsUnsupportedFormat, "" ); + CV_Error( cv::Error::StsUnsupportedFormat, "" ); func( src, dst, delta, scale ); completeSymm( dst, false ); diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index 513e13ea5f..0701542dfd 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -267,7 +267,7 @@ void setSize( Mat& m, int _dims, const int* _sz, const size_t* _steps, bool auto m.step.p[i] = total; uint64 total1 = (uint64)total*s; if( (uint64)total1 != (size_t)total1 ) - CV_Error( CV_StsOutOfRange, "The total matrix size does not fit to \"size_t\" type" ); + CV_Error( cv::Error::StsOutOfRange, "The total matrix size does not fit to \"size_t\" type" ); total = (size_t)total1; } } @@ -1072,9 +1072,9 @@ void Mat::push_back(const Mat& elems) bool eq = size == elems.size; size.p[0] = int(r); if( !eq ) - CV_Error(CV_StsUnmatchedSizes, "Pushed vector length is not equal to matrix row length"); + CV_Error(cv::Error::StsUnmatchedSizes, "Pushed vector length is not equal to matrix row length"); if( type() != elems.type() ) - CV_Error(CV_StsUnmatchedFormats, "Pushed vector type is not the same as matrix type"); + CV_Error(cv::Error::StsUnmatchedFormats, "Pushed vector type is not the same as matrix type"); if( isSubmatrix() || dataend + step.p[0]*delta > datalimit ) reserve( std::max(r + delta, (r*3+1)/2) ); @@ -1170,16 +1170,16 @@ Mat Mat::reshape(int new_cn, int new_rows) const { int total_size = total_width * rows; if( !isContinuous() ) - CV_Error( CV_BadStep, + CV_Error( cv::Error::BadStep, "The matrix is not continuous, thus its number of rows can not be changed" ); if( (unsigned)new_rows > (unsigned)total_size ) - CV_Error( CV_StsOutOfRange, "Bad new number of rows" ); + CV_Error( cv::Error::StsOutOfRange, "Bad new number of rows" ); total_width = total_size / new_rows; if( total_width * new_rows != total_size ) - CV_Error( CV_StsBadArg, "The total number of matrix elements " + CV_Error( cv::Error::StsBadArg, "The total number of matrix elements " "is not divisible by the new number of rows" ); hdr.rows = new_rows; @@ -1189,7 +1189,7 @@ Mat Mat::reshape(int new_cn, int new_rows) const int new_width = total_width / new_cn; if( new_width * new_cn != total_width ) - CV_Error( CV_BadNumChannels, + CV_Error( cv::Error::BadNumChannels, "The total width is not divisible by the new number of channels" ); hdr.cols = new_width; @@ -1231,13 +1231,13 @@ Mat Mat::reshape(int _cn, int _newndims, const int* _newsz) const else if (i < dims) newsz_buf[i] = this->size[i]; else - CV_Error(CV_StsOutOfRange, "Copy dimension (which has zero size) is not present in source matrix"); + CV_Error(cv::Error::StsOutOfRange, "Copy dimension (which has zero size) is not present in source matrix"); total_elem1 *= (size_t)newsz_buf[i]; } if (total_elem1 != total_elem1_ref) - CV_Error(CV_StsUnmatchedSizes, "Requested and source matrices have different count of elements"); + CV_Error(cv::Error::StsUnmatchedSizes, "Requested and source matrices have different count of elements"); Mat hdr = *this; hdr.flags = (hdr.flags & ~CV_MAT_CN_MASK) | ((_cn-1) << CV_CN_SHIFT); @@ -1246,7 +1246,7 @@ Mat Mat::reshape(int _cn, int _newndims, const int* _newsz) const return hdr; } - CV_Error(CV_StsNotImplemented, "Reshaping of n-dimensional non-continuous matrices is not supported yet"); + CV_Error(cv::Error::StsNotImplemented, "Reshaping of n-dimensional non-continuous matrices is not supported yet"); // TBD } diff --git a/modules/core/src/matrix_c.cpp b/modules/core/src/matrix_c.cpp index baa61bb66f..13c9c11dd4 100644 --- a/modules/core/src/matrix_c.cpp +++ b/modules/core/src/matrix_c.cpp @@ -163,7 +163,7 @@ Mat cvarrToMat(const CvArr* arr, bool copyData, { const IplImage* iplimg = (const IplImage*)arr; if( coiMode == 0 && iplimg->roi && iplimg->roi->coi > 0 ) - CV_Error(CV_BadCOI, "COI is not supported by the function"); + CV_Error(cv::Error::BadCOI, "COI is not supported by the function"); return iplImageToMat(iplimg, copyData); } if( CV_IS_SEQ(arr) ) @@ -187,7 +187,7 @@ Mat cvarrToMat(const CvArr* arr, bool copyData, cvCvtSeqToArray(seq, buf.ptr(), CV_WHOLE_SEQ); return buf; } - CV_Error(CV_StsBadArg, "Unknown array type"); + CV_Error(cv::Error::StsBadArg, "Unknown array type"); } void extractImageCOI(const CvArr* arr, OutputArray _ch, int coi) @@ -269,14 +269,14 @@ cvReduce( const CvArr* srcarr, CvArr* dstarr, int dim, int op ) dim = src.rows > dst.rows ? 0 : src.cols > dst.cols ? 1 : dst.cols == 1; if( dim > 1 ) - CV_Error( CV_StsOutOfRange, "The reduced dimensionality index is out of range" ); + CV_Error( cv::Error::StsOutOfRange, "The reduced dimensionality index is out of range" ); if( (dim == 0 && (dst.cols != src.cols || dst.rows != 1)) || (dim == 1 && (dst.rows != src.rows || dst.cols != 1)) ) - CV_Error( CV_StsBadSize, "The output array size is incorrect" ); + CV_Error( cv::Error::StsBadSize, "The output array size is incorrect" ); if( src.channels() != dst.channels() ) - CV_Error( CV_StsUnmatchedFormats, "Input and output arrays must have the same number of channels" ); + CV_Error( cv::Error::StsUnmatchedFormats, "Input and output arrays must have the same number of channels" ); cv::reduce(src, dst, dim, op, dst.type()); } @@ -333,7 +333,7 @@ cvRange( CvArr* arr, double start, double end ) fdata[j] = (float)val; } else - CV_Error( CV_StsUnsupportedFormat, "The function only supports 32sC1 and 32fC1 datatypes" ); + CV_Error( cv::Error::StsUnsupportedFormat, "The function only supports 32sC1 and 32fC1 datatypes" ); return arr; } diff --git a/modules/core/src/matrix_expressions.cpp b/modules/core/src/matrix_expressions.cpp index 44ac8f1713..dd39d50a01 100644 --- a/modules/core/src/matrix_expressions.cpp +++ b/modules/core/src/matrix_expressions.cpp @@ -21,7 +21,7 @@ static void checkOperandsExist(const Mat& a) { if (a.empty()) { - CV_Error(CV_StsBadArg, "Matrix operand is an empty matrix."); + CV_Error(cv::Error::StsBadArg, "Matrix operand is an empty matrix."); } } @@ -29,7 +29,7 @@ static void checkOperandsExist(const Mat& a, const Mat& b) { if (a.empty() || b.empty()) { - CV_Error(CV_StsBadArg, "One or more matrix operands are empty."); + CV_Error(cv::Error::StsBadArg, "One or more matrix operands are empty."); } } @@ -1456,7 +1456,7 @@ void MatOp_Bin::assign(const MatExpr& e, Mat& m, int _type) const else if( e.flags == 'a' && !e.b.data ) cv::absdiff(e.a, e.s, dst); else - CV_Error(CV_StsError, "Unknown operation"); + CV_Error(cv::Error::StsError, "Unknown operation"); if( dst.data != m.data ) dst.convertTo(m, _type); @@ -1691,7 +1691,7 @@ void MatOp_Initializer::assign(const MatExpr& e, Mat& m, int _type) const else if( e.flags == '1' ) m = Scalar(e.alpha); else - CV_Error(CV_StsError, "Invalid matrix initializer type"); + CV_Error(cv::Error::StsError, "Invalid matrix initializer type"); } void MatOp_Initializer::multiply(const MatExpr& e, double s, MatExpr& res) const diff --git a/modules/core/src/matrix_operations.cpp b/modules/core/src/matrix_operations.cpp index 94e0c2b50b..8bb8c66e5c 100644 --- a/modules/core/src/matrix_operations.cpp +++ b/modules/core/src/matrix_operations.cpp @@ -954,7 +954,7 @@ void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype) } if( !func ) - CV_Error( CV_StsUnsupportedFormat, + CV_Error( cv::Error::StsUnsupportedFormat, "Unsupported combination of input and output array formats" ); func( src, temp ); diff --git a/modules/core/src/matrix_sparse.cpp b/modules/core/src/matrix_sparse.cpp index 173f9ea8f6..7a02e5961d 100644 --- a/modules/core/src/matrix_sparse.cpp +++ b/modules/core/src/matrix_sparse.cpp @@ -758,7 +758,7 @@ double norm( const SparseMat& src, int normType ) } } else - CV_Error( CV_StsUnsupportedFormat, "Only 32f and 64f are supported" ); + CV_Error( cv::Error::StsUnsupportedFormat, "Only 32f and 64f are supported" ); if( normType == NORM_L2 ) result = std::sqrt(result); @@ -821,7 +821,7 @@ void minMaxLoc( const SparseMat& src, double* _minval, double* _maxval, int* _mi *_maxval = maxval; } else - CV_Error( CV_StsUnsupportedFormat, "Only 32f and 64f are supported" ); + CV_Error( cv::Error::StsUnsupportedFormat, "Only 32f and 64f are supported" ); if( _minidx && minidx ) for( i = 0; i < d; i++ ) @@ -843,7 +843,7 @@ void normalize( const SparseMat& src, SparseMat& dst, double a, int norm_type ) scale = scale > DBL_EPSILON ? a/scale : 0.; } else - CV_Error( CV_StsBadArg, "Unknown/unsupported norm type" ); + CV_Error( cv::Error::StsBadArg, "Unknown/unsupported norm type" ); src.convertTo( dst, -1, scale ); } diff --git a/modules/core/src/matrix_wrap.cpp b/modules/core/src/matrix_wrap.cpp index fa9a23ee2a..238fc642fd 100644 --- a/modules/core/src/matrix_wrap.cpp +++ b/modules/core/src/matrix_wrap.cpp @@ -948,7 +948,7 @@ bool _InputArray::isContinuous(int i) const if( k == CUDA_GPU_MAT ) return i < 0 ? ((const cuda::GpuMat*)obj)->isContinuous() : true; - CV_Error(CV_StsNotImplemented, "Unknown/unsupported array type"); + CV_Error(cv::Error::StsNotImplemented, "Unknown/unsupported array type"); } bool _InputArray::isSubmatrix(int i) const @@ -986,7 +986,7 @@ bool _InputArray::isSubmatrix(int i) const return vv[i].isSubmatrix(); } - CV_Error(CV_StsNotImplemented, ""); + CV_Error(cv::Error::StsNotImplemented, ""); } size_t _InputArray::offset(int i) const @@ -1466,14 +1466,14 @@ void _OutputArray::create(int d, const int* sizes, int mtype, int i, ((std::vector >*)v)->resize(len); break; default: - CV_Error_(CV_StsBadArg, ("Vectors with element size %d are not supported. Please, modify OutputArray::create()\n", esz)); + CV_Error_(cv::Error::StsBadArg, ("Vectors with element size %d are not supported. Please, modify OutputArray::create()\n", esz)); } return; } if( k == NONE ) { - CV_Error(CV_StsNullPtr, "create() called for the missing output array" ); + CV_Error(cv::Error::StsNullPtr, "create() called for the missing output array" ); } if( k == STD_VECTOR_MAT ) diff --git a/modules/core/src/norm.cpp b/modules/core/src/norm.cpp index be68efddf0..31178dbcda 100644 --- a/modules/core/src/norm.cpp +++ b/modules/core/src/norm.cpp @@ -1392,7 +1392,7 @@ void normalize(InputArray _src, InputOutputArray _dst, double a, double b, shift = 0; } else - CV_Error( CV_StsBadArg, "Unknown/unsupported norm type" ); + CV_Error( cv::Error::StsBadArg, "Unknown/unsupported norm type" ); CV_OCL_RUN(_dst.isUMat(), ocl_normalize(_src, _dst, _mask, rtype, scale, shift)) diff --git a/modules/core/src/rand.cpp b/modules/core/src/rand.cpp index 0647c95486..e39acce529 100644 --- a/modules/core/src/rand.cpp +++ b/modules/core/src/rand.cpp @@ -574,7 +574,7 @@ void RNG::fill( InputOutputArray _mat, int disttype, CV_Assert( scaleFunc != 0 ); } else - CV_Error( CV_StsBadArg, "Unknown distribution type" ); + CV_Error( cv::Error::StsBadArg, "Unknown distribution type" ); const Mat* arrays[] = {&mat, 0}; uchar* ptr; diff --git a/modules/core/src/system.cpp b/modules/core/src/system.cpp index 934c3b458c..c02944079e 100644 --- a/modules/core/src/system.cpp +++ b/modules/core/src/system.cpp @@ -1377,38 +1377,38 @@ CV_IMPL const char* cvErrorStr( int status ) switch (status) { - case CV_StsOk : return "No Error"; - case CV_StsBackTrace : return "Backtrace"; - case CV_StsError : return "Unspecified error"; - case CV_StsInternal : return "Internal error"; - case CV_StsNoMem : return "Insufficient memory"; - case CV_StsBadArg : return "Bad argument"; - case CV_StsNoConv : return "Iterations do not converge"; - case CV_StsAutoTrace : return "Autotrace call"; - case CV_StsBadSize : return "Incorrect size of input array"; - case CV_StsNullPtr : return "Null pointer"; - case CV_StsDivByZero : return "Division by zero occurred"; - case CV_BadStep : return "Image step is wrong"; - case CV_StsInplaceNotSupported : return "Inplace operation is not supported"; - case CV_StsObjectNotFound : return "Requested object was not found"; - case CV_BadDepth : return "Input image depth is not supported by function"; - case CV_StsUnmatchedFormats : return "Formats of input arguments do not match"; - case CV_StsUnmatchedSizes : return "Sizes of input arguments do not match"; - case CV_StsOutOfRange : return "One of the arguments\' values is out of range"; - case CV_StsUnsupportedFormat : return "Unsupported format or combination of formats"; - case CV_BadCOI : return "Input COI is not supported"; - case CV_BadNumChannels : return "Bad number of channels"; - case CV_StsBadFlag : return "Bad flag (parameter or structure field)"; - case CV_StsBadPoint : return "Bad parameter of type CvPoint"; - case CV_StsBadMask : return "Bad type of mask argument"; - case CV_StsParseError : return "Parsing error"; - case CV_StsNotImplemented : return "The function/feature is not implemented"; - case CV_StsBadMemBlock : return "Memory block has been corrupted"; - case CV_StsAssert : return "Assertion failed"; - case CV_GpuNotSupported : return "No CUDA support"; - case CV_GpuApiCallError : return "Gpu API call"; - case CV_OpenGlNotSupported : return "No OpenGL support"; - case CV_OpenGlApiCallError : return "OpenGL API call"; + case cv::Error::StsOk : return "No Error"; + case cv::Error::StsBackTrace : return "Backtrace"; + case cv::Error::StsError : return "Unspecified error"; + case cv::Error::StsInternal : return "Internal error"; + case cv::Error::StsNoMem : return "Insufficient memory"; + case cv::Error::StsBadArg : return "Bad argument"; + case cv::Error::StsNoConv : return "Iterations do not converge"; + case cv::Error::StsAutoTrace : return "Autotrace call"; + case cv::Error::StsBadSize : return "Incorrect size of input array"; + case cv::Error::StsNullPtr : return "Null pointer"; + case cv::Error::StsDivByZero : return "Division by zero occurred"; + case cv::Error::BadStep : return "Image step is wrong"; + case cv::Error::StsInplaceNotSupported : return "Inplace operation is not supported"; + case cv::Error::StsObjectNotFound : return "Requested object was not found"; + case cv::Error::BadDepth : return "Input image depth is not supported by function"; + case cv::Error::StsUnmatchedFormats : return "Formats of input arguments do not match"; + case cv::Error::StsUnmatchedSizes : return "Sizes of input arguments do not match"; + case cv::Error::StsOutOfRange : return "One of the arguments\' values is out of range"; + case cv::Error::StsUnsupportedFormat : return "Unsupported format or combination of formats"; + case cv::Error::BadCOI : return "Input COI is not supported"; + case cv::Error::BadNumChannels : return "Bad number of channels"; + case cv::Error::StsBadFlag : return "Bad flag (parameter or structure field)"; + case cv::Error::StsBadPoint : return "Bad parameter of type CvPoint"; + case cv::Error::StsBadMask : return "Bad type of mask argument"; + case cv::Error::StsParseError : return "Parsing error"; + case cv::Error::StsNotImplemented : return "The function/feature is not implemented"; + case cv::Error::StsBadMemBlock : return "Memory block has been corrupted"; + case cv::Error::StsAssert : return "Assertion failed"; + case cv::Error::GpuNotSupported : return "No CUDA support"; + case cv::Error::GpuApiCallError : return "Gpu API call"; + case cv::Error::OpenGlNotSupported : return "No OpenGL support"; + case cv::Error::OpenGlApiCallError : return "OpenGL API call"; }; snprintf(buf, sizeof(buf), "Unknown %s code %d", status >= 0 ? "status":"error", status); @@ -1448,29 +1448,29 @@ cvErrorFromIppStatus( int status ) { switch (status) { - case CV_BADSIZE_ERR: return CV_StsBadSize; - case CV_BADMEMBLOCK_ERR: return CV_StsBadMemBlock; - case CV_NULLPTR_ERR: return CV_StsNullPtr; - case CV_DIV_BY_ZERO_ERR: return CV_StsDivByZero; - case CV_BADSTEP_ERR: return CV_BadStep; - case CV_OUTOFMEM_ERR: return CV_StsNoMem; - case CV_BADARG_ERR: return CV_StsBadArg; - case CV_NOTDEFINED_ERR: return CV_StsError; - case CV_INPLACE_NOT_SUPPORTED_ERR: return CV_StsInplaceNotSupported; - case CV_NOTFOUND_ERR: return CV_StsObjectNotFound; - case CV_BADCONVERGENCE_ERR: return CV_StsNoConv; - case CV_BADDEPTH_ERR: return CV_BadDepth; - case CV_UNMATCHED_FORMATS_ERR: return CV_StsUnmatchedFormats; - case CV_UNSUPPORTED_COI_ERR: return CV_BadCOI; - case CV_UNSUPPORTED_CHANNELS_ERR: return CV_BadNumChannels; - case CV_BADFLAG_ERR: return CV_StsBadFlag; - case CV_BADRANGE_ERR: return CV_StsBadArg; - case CV_BADCOEF_ERR: return CV_StsBadArg; - case CV_BADFACTOR_ERR: return CV_StsBadArg; - case CV_BADPOINT_ERR: return CV_StsBadPoint; + case CV_BADSIZE_ERR: return cv::Error::StsBadSize; + case CV_BADMEMBLOCK_ERR: return cv::Error::StsBadMemBlock; + case CV_NULLPTR_ERR: return cv::Error::StsNullPtr; + case CV_DIV_BY_ZERO_ERR: return cv::Error::StsDivByZero; + case CV_BADSTEP_ERR: return cv::Error::BadStep; + case CV_OUTOFMEM_ERR: return cv::Error::StsNoMem; + case CV_BADARG_ERR: return cv::Error::StsBadArg; + case CV_NOTDEFINED_ERR: return cv::Error::StsError; + case CV_INPLACE_NOT_SUPPORTED_ERR: return cv::Error::StsInplaceNotSupported; + case CV_NOTFOUND_ERR: return cv::Error::StsObjectNotFound; + case CV_BADCONVERGENCE_ERR: return cv::Error::StsNoConv; + case CV_BADDEPTH_ERR: return cv::Error::BadDepth; + case CV_UNMATCHED_FORMATS_ERR: return cv::Error::StsUnmatchedFormats; + case CV_UNSUPPORTED_COI_ERR: return cv::Error::BadCOI; + case CV_UNSUPPORTED_CHANNELS_ERR: return cv::Error::BadNumChannels; + case CV_BADFLAG_ERR: return cv::Error::StsBadFlag; + case CV_BADRANGE_ERR: return cv::Error::StsBadArg; + case CV_BADCOEF_ERR: return cv::Error::StsBadArg; + case CV_BADFACTOR_ERR: return cv::Error::StsBadArg; + case CV_BADPOINT_ERR: return cv::Error::StsBadPoint; default: - return CV_StsError; + return cv::Error::StsError; } } diff --git a/modules/core/src/types.cpp b/modules/core/src/types.cpp index 43e25ef045..ccf3109989 100644 --- a/modules/core/src/types.cpp +++ b/modules/core/src/types.cpp @@ -83,7 +83,7 @@ void KeyPoint::convert(const std::vector& keypoints, std::vector (unsigned)total_size ) - CV_Error( CV_StsOutOfRange, "Bad new number of rows" ); + CV_Error( cv::Error::StsOutOfRange, "Bad new number of rows" ); total_width = total_size / new_rows; if( total_width * new_rows != total_size ) - CV_Error( CV_StsBadArg, "The total number of matrix elements " + CV_Error( cv::Error::StsBadArg, "The total number of matrix elements " "is not divisible by the new number of rows" ); hdr.rows = new_rows; @@ -984,7 +984,7 @@ UMat UMat::reshape(int new_cn, int new_rows) const int new_width = total_width / new_cn; if( new_width * new_cn != total_width ) - CV_Error( CV_BadNumChannels, + CV_Error( cv::Error::BadNumChannels, "The total width is not divisible by the new number of channels" ); hdr.cols = new_width; @@ -1050,13 +1050,13 @@ UMat UMat::reshape(int _cn, int _newndims, const int* _newsz) const else if (i < dims) newsz_buf[i] = this->size[i]; else - CV_Error(CV_StsOutOfRange, "Copy dimension (which has zero size) is not present in source matrix"); + CV_Error(cv::Error::StsOutOfRange, "Copy dimension (which has zero size) is not present in source matrix"); total_elem1 *= (size_t)newsz_buf[i]; } if (total_elem1 != total_elem1_ref) - CV_Error(CV_StsUnmatchedSizes, "Requested and source matrices have different count of elements"); + CV_Error(cv::Error::StsUnmatchedSizes, "Requested and source matrices have different count of elements"); UMat hdr = *this; hdr.flags = (hdr.flags & ~CV_MAT_CN_MASK) | ((_cn-1) << CV_CN_SHIFT); @@ -1065,7 +1065,7 @@ UMat UMat::reshape(int _cn, int _newndims, const int* _newsz) const return hdr; } - CV_Error(CV_StsNotImplemented, "Reshaping of n-dimensional non-continuous matrices is not supported yet"); + CV_Error(cv::Error::StsNotImplemented, "Reshaping of n-dimensional non-continuous matrices is not supported yet"); } Mat UMat::getMat(AccessFlag accessFlags) const diff --git a/modules/core/test/test_arithm.cpp b/modules/core/test/test_arithm.cpp index f26e47bc03..499c766a84 100644 --- a/modules/core/test/test_arithm.cpp +++ b/modules/core/test/test_arithm.cpp @@ -593,7 +593,7 @@ static void inRange(const Mat& src, const Mat& lb, const Mat& rb, Mat& dst) inRange_((const double*)sptr, (const double*)aptr, (const double*)bptr, dptr, total, cn); break; default: - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(cv::Error::StsUnsupportedFormat, ""); } } } @@ -642,7 +642,7 @@ static void inRangeS(const Mat& src, const Scalar& lb, const Scalar& rb, Mat& ds inRangeS_((const double*)sptr, lbuf.d, rbuf.d, dptr, total, cn); break; default: - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(cv::Error::StsUnsupportedFormat, ""); } } } diff --git a/modules/core/test/test_dxt.cpp b/modules/core/test/test_dxt.cpp index 05d1f3062c..b2305fef9a 100644 --- a/modules/core/test/test_dxt.cpp +++ b/modules/core/test/test_dxt.cpp @@ -97,7 +97,7 @@ static void DFT_1D( const Mat& _src, Mat& _dst, int flags, const Mat& _wave=Mat( } } else - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(cv::Error::StsUnsupportedFormat, ""); } @@ -878,7 +878,7 @@ protected: { cout << "actual:\n" << dst << endl << endl; cout << "reference:\n" << dstz << endl << endl; - CV_Error(CV_StsError, ""); + CV_Error(cv::Error::StsError, ""); } } } diff --git a/modules/core/test/test_mat.cpp b/modules/core/test/test_mat.cpp index 4b6dcb8fcf..23a00a7eff 100644 --- a/modules/core/test/test_mat.cpp +++ b/modules/core/test/test_mat.cpp @@ -598,7 +598,7 @@ static void setValue(SparseMat& M, const int* idx, double value, RNG& rng) else if( M.type() == CV_64F ) *(double*)ptr = value; else - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(cv::Error::StsUnsupportedFormat, ""); } #if defined(__GNUC__) && (__GNUC__ == 11 || __GNUC__ == 12 || __GNUC__ == 13) diff --git a/modules/dnn/src/dnn_utils.cpp b/modules/dnn/src/dnn_utils.cpp index 99b4e77e11..3ef75fad36 100644 --- a/modules/dnn/src/dnn_utils.cpp +++ b/modules/dnn/src/dnn_utils.cpp @@ -438,7 +438,7 @@ void Image2BlobParams::blobRectsToImageRects(const std::vector &rBlob, std } } else - CV_Error(CV_StsBadArg, "Unknown padding mode"); + CV_Error(cv::Error::StsBadArg, "Unknown padding mode"); } } diff --git a/modules/dnn/src/int8layers/convolution_layer.cpp b/modules/dnn/src/int8layers/convolution_layer.cpp index 6121e971a2..a5a98c9764 100644 --- a/modules/dnn/src/int8layers/convolution_layer.cpp +++ b/modules/dnn/src/int8layers/convolution_layer.cpp @@ -548,7 +548,7 @@ public: { // for Conv1d if (group != 1) - CV_Error( CV_StsNotImplemented, " Grouped Conv1d or Depth-Wise Conv1d are not supported by " + CV_Error( cv::Error::StsNotImplemented, " Grouped Conv1d or Depth-Wise Conv1d are not supported by " "TimVX Backend. Please try OpenCV Backend."); tvConv = graph->CreateOperation( tvConvWeightShape[2], tvPadType, (uint32_t)kernel_size[0], diff --git a/modules/dnn/src/layers/cpu_kernels/convolution.cpp b/modules/dnn/src/layers/cpu_kernels/convolution.cpp index c5258ccd91..6ae304f29d 100644 --- a/modules/dnn/src/layers/cpu_kernels/convolution.cpp +++ b/modules/dnn/src/layers/cpu_kernels/convolution.cpp @@ -450,7 +450,7 @@ Ptr initFastConv( } } else - CV_Error(CV_StsUnsupportedFormat, "Unknown convolution type."); + CV_Error(cv::Error::StsUnsupportedFormat, "Unknown convolution type."); // store bias; append some zero's to make sure that // we can always read MR elements starting from any valid index diff --git a/modules/dnn/src/vkcom/src/context.cpp b/modules/dnn/src/vkcom/src/context.cpp index 2cb355a247..4432d58aa0 100644 --- a/modules/dnn/src/vkcom/src/context.cpp +++ b/modules/dnn/src/vkcom/src/context.cpp @@ -225,7 +225,7 @@ void Context::createInstance() if (result != VK_SUCCESS) { - CV_Error(CV_StsError, "Vulkan: vkEnumerateInstanceLayerProperties failed!"); + CV_Error(cv::Error::StsError, "Vulkan: vkEnumerateInstanceLayerProperties failed!"); return; } @@ -234,7 +234,7 @@ void Context::createInstance() if (result != VK_SUCCESS) { - CV_Error(CV_StsError, "Vulkan: vkEnumerateInstanceLayerProperties failed!"); + CV_Error(cv::Error::StsError, "Vulkan: vkEnumerateInstanceLayerProperties failed!"); return; } @@ -388,7 +388,7 @@ Context::Context() vkEnumeratePhysicalDevices(kInstance, &deviceCount, NULL); if (deviceCount == 0) { - CV_Error(CV_StsError, "Vulkan Backend: could not find a device with vulkan support!"); + CV_Error(cv::Error::StsError, "Vulkan Backend: could not find a device with vulkan support!"); } std::vector devices(deviceCount); @@ -442,7 +442,7 @@ Context::Context() if (!cmdPoolPtr) cmdPoolPtr = CommandPool::create(kQueue, kQueueFamilyIndex); else - CV_Error(CV_StsError, "cmdPoolPtr has been created before!!"); + CV_Error(cv::Error::StsError, "cmdPoolPtr has been created before!!"); pipelineFactoryPtr = PipelineFactory::create(); } diff --git a/modules/dnn/src/vkcom/src/op_conv.cpp b/modules/dnn/src/vkcom/src/op_conv.cpp index 9c84ffccdf..22aa537111 100644 --- a/modules/dnn/src/vkcom/src/op_conv.cpp +++ b/modules/dnn/src/vkcom/src/op_conv.cpp @@ -244,7 +244,7 @@ bool OpConv::computeGroupCount() group_z_ = 1; } else - CV_Error(CV_StsNotImplemented, "shader type is not supported at compute GroupCount."); + CV_Error(cv::Error::StsNotImplemented, "shader type is not supported at compute GroupCount."); CV_Assert(group_x_ <= MAX_GROUP_COUNT_X); CV_Assert(group_y_ <= MAX_GROUP_COUNT_Y); diff --git a/modules/dnn/src/vkcom/src/op_naryEltwise.cpp b/modules/dnn/src/vkcom/src/op_naryEltwise.cpp index 812ca097b3..bcc5cd7e2e 100644 --- a/modules/dnn/src/vkcom/src/op_naryEltwise.cpp +++ b/modules/dnn/src/vkcom/src/op_naryEltwise.cpp @@ -182,7 +182,7 @@ bool OpNary::computeGroupCount() } else { - CV_Error(CV_StsNotImplemented, "shader type is not supported at compute GroupCount."); + CV_Error(cv::Error::StsNotImplemented, "shader type is not supported at compute GroupCount."); } CV_Assert(group_x_ <= MAX_GROUP_COUNT_X); diff --git a/modules/dnn/src/vkcom/src/pipeline.cpp b/modules/dnn/src/vkcom/src/pipeline.cpp index ea29d8824a..240102fba4 100644 --- a/modules/dnn/src/vkcom/src/pipeline.cpp +++ b/modules/dnn/src/vkcom/src/pipeline.cpp @@ -279,7 +279,7 @@ Ptr PipelineFactory::getPipeline(const std::string& key, const std::ve // retrieve spv from SPVMaps with given key auto iterSPV = SPVMaps.find(key); if (iterSPV == SPVMaps.end()) - CV_Error(CV_StsError, "Can not create SPV with the given name:"+key+"!"); + CV_Error(cv::Error::StsError, "Can not create SPV with the given name:"+key+"!"); const uint32_t* spv = iterSPV->second.first; size_t length = iterSPV->second.second; @@ -292,7 +292,7 @@ Ptr PipelineFactory::getPipeline(const std::string& key, const std::ve } else { - CV_Error(CV_StsError, "Can not Created the VkPipeline "+key); + CV_Error(cv::Error::StsError, "Can not Created the VkPipeline "+key); } return pipeline; diff --git a/modules/highgui/src/window.cpp b/modules/highgui/src/window.cpp index 2e528fe8e5..fef71f2b31 100644 --- a/modules/highgui/src/window.cpp +++ b/modules/highgui/src/window.cpp @@ -1097,17 +1097,17 @@ void cv::imshow(const String& winname, const ogl::Texture2D& _tex) CV_IMPL void cvSetOpenGlDrawCallback(const char*, CvOpenGlDrawCallback, void*) { - CV_Error(CV_OpenGlNotSupported, "The library is compiled without OpenGL support"); + CV_Error(cv::Error::OpenGlNotSupported, "The library is compiled without OpenGL support"); } CV_IMPL void cvSetOpenGlContext(const char*) { - CV_Error(CV_OpenGlNotSupported, "The library is compiled without OpenGL support"); + CV_Error(cv::Error::OpenGlNotSupported, "The library is compiled without OpenGL support"); } CV_IMPL void cvUpdateWindow(const char*) { - CV_Error(CV_OpenGlNotSupported, "The library is compiled without OpenGL support"); + CV_Error(cv::Error::OpenGlNotSupported, "The library is compiled without OpenGL support"); } #endif // !HAVE_OPENGL @@ -1176,52 +1176,52 @@ static const char* NO_QT_ERR_MSG = "The library is compiled without QT support"; cv::QtFont cv::fontQt(const String&, int, Scalar, int, int, int) { - CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG); + CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG); } void cv::addText( const Mat&, const String&, Point, const QtFont&) { - CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG); + CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG); } void cv::addText(const Mat&, const String&, Point, const String&, int, Scalar, int, int, int) { - CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG); + CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG); } void cv::displayStatusBar(const String&, const String&, int) { - CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG); + CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG); } void cv::displayOverlay(const String&, const String&, int ) { - CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG); + CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG); } int cv::startLoop(int (*)(int argc, char *argv[]), int , char**) { - CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG); + CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG); } void cv::stopLoop() { - CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG); + CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG); } void cv::saveWindowParameters(const String&) { - CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG); + CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG); } void cv::loadWindowParameters(const String&) { - CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG); + CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG); } int cv::createButton(const String&, ButtonCallback, void*, int , bool ) { - CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG); + CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG); } #endif diff --git a/modules/highgui/src/window_QT.cpp b/modules/highgui/src/window_QT.cpp index c72163cd6b..65bcdb5239 100644 --- a/modules/highgui/src/window_QT.cpp +++ b/modules/highgui/src/window_QT.cpp @@ -147,7 +147,7 @@ CV_IMPL CvFont cvFontQt(const char* nameFont, int pointSize,CvScalar color,int w CV_IMPL void cvAddText(const CvArr* img, const char* text, CvPoint org, CvFont* font) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); QMetaObject::invokeMethod(guiMainThread, "putText", @@ -162,7 +162,7 @@ CV_IMPL void cvAddText(const CvArr* img, const char* text, CvPoint org, CvFont* double cvGetRatioWindow_QT(const char* name) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); double result = -1; QMetaObject::invokeMethod(guiMainThread, @@ -176,7 +176,7 @@ double cvGetRatioWindow_QT(const char* name) double cvGetPropVisible_QT(const char* name) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); double result = 0; @@ -193,7 +193,7 @@ void cvSetRatioWindow_QT(const char* name,double prop_value) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); QMetaObject::invokeMethod(guiMainThread, "setRatioWindow", @@ -205,7 +205,7 @@ void cvSetRatioWindow_QT(const char* name,double prop_value) double cvGetPropWindow_QT(const char* name) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); double result = -1; QMetaObject::invokeMethod(guiMainThread, @@ -221,7 +221,7 @@ double cvGetPropWindow_QT(const char* name) void cvSetPropWindow_QT(const char* name,double prop_value) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); QMetaObject::invokeMethod(guiMainThread, "setPropWindow", @@ -246,7 +246,7 @@ void setWindowTitle_QT(const String& winname, const String& title) void cvSetModeWindow_QT(const char* name, double prop_value) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); QMetaObject::invokeMethod(guiMainThread, "toggleFullScreen", @@ -258,7 +258,7 @@ void cvSetModeWindow_QT(const char* name, double prop_value) CvRect cvGetWindowRect_QT(const char* name) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); CvRect result = cvRect(-1, -1, -1, -1); @@ -274,7 +274,7 @@ CvRect cvGetWindowRect_QT(const char* name) double cvGetModeWindow_QT(const char* name) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); double result = -1; @@ -291,7 +291,7 @@ double cvGetModeWindow_QT(const char* name) CV_IMPL void cvDisplayOverlay(const char* name, const char* text, int delayms) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); QMetaObject::invokeMethod(guiMainThread, "displayInfo", @@ -305,7 +305,7 @@ CV_IMPL void cvDisplayOverlay(const char* name, const char* text, int delayms) CV_IMPL void cvSaveWindowParameters(const char* name) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); QMetaObject::invokeMethod(guiMainThread, "saveWindowParameters", @@ -317,7 +317,7 @@ CV_IMPL void cvSaveWindowParameters(const char* name) CV_IMPL void cvLoadWindowParameters(const char* name) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); QMetaObject::invokeMethod(guiMainThread, "loadWindowParameters", @@ -329,7 +329,7 @@ CV_IMPL void cvLoadWindowParameters(const char* name) CV_IMPL void cvDisplayStatusBar(const char* name, const char* text, int delayms) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); QMetaObject::invokeMethod(guiMainThread, "displayStatusBar", @@ -492,7 +492,7 @@ static CvTrackbar* icvFindTrackBarByName(const char* name_trackbar, const char* QPointer w = icvFindWindowByName(nameWinQt); if (!w) - CV_Error(CV_StsNullPtr, "NULL window handler"); + CV_Error(cv::Error::StsNullPtr, "NULL window handler"); if (w->param_gui_mode == CV_GUI_NORMAL) return (CvTrackbar*) icvFindBarByName(w->myBarLayout, nameQt, type_CvTrackbar); @@ -575,7 +575,7 @@ CV_IMPL int cvNamedWindow(const char* name, int flags) CV_IMPL void cvDestroyWindow(const char* name) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); QMetaObject::invokeMethod(guiMainThread, "destroyWindow", @@ -598,7 +598,7 @@ CV_IMPL void cvDestroyAllWindows() CV_IMPL void* cvGetWindowHandle(const char* name) { if (!name) - CV_Error( CV_StsNullPtr, "NULL name string" ); + CV_Error( cv::Error::StsNullPtr, "NULL name string" ); return (void*) icvFindWindowByName(QLatin1String(name)); } @@ -607,7 +607,7 @@ CV_IMPL void* cvGetWindowHandle(const char* name) CV_IMPL const char* cvGetWindowName(void* window_handle) { if( !window_handle ) - CV_Error( CV_StsNullPtr, "NULL window handler" ); + CV_Error( cv::Error::StsNullPtr, "NULL window handler" ); return ((CvWindow*)window_handle)->objectName().toLatin1().data(); } @@ -616,7 +616,7 @@ CV_IMPL const char* cvGetWindowName(void* window_handle) CV_IMPL void cvMoveWindow(const char* name, int x, int y) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); QMetaObject::invokeMethod(guiMainThread, "moveWindow", autoBlockingConnection(), @@ -628,7 +628,7 @@ CV_IMPL void cvMoveWindow(const char* name, int x, int y) CV_IMPL void cvResizeWindow(const char* name, int width, int height) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); QMetaObject::invokeMethod(guiMainThread, "resizeWindow", autoBlockingConnection(), @@ -641,7 +641,7 @@ CV_IMPL void cvResizeWindow(const char* name, int width, int height) CV_IMPL int cvCreateTrackbar2(const char* name_bar, const char* window_name, int* val, int count, CvTrackbarCallback2 on_notify, void* userdata) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); QMetaObject::invokeMethod(guiMainThread, "addSlider2", @@ -666,7 +666,7 @@ CV_IMPL int cvStartWindowThread() CV_IMPL int cvCreateTrackbar(const char* name_bar, const char* window_name, int* value, int count, CvTrackbarCallback on_change) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); QMetaObject::invokeMethod(guiMainThread, "addSlider", @@ -684,7 +684,7 @@ CV_IMPL int cvCreateTrackbar(const char* name_bar, const char* window_name, int* CV_IMPL int cvCreateButton(const char* button_name, CvButtonCallback on_change, void* userdata, int button_type, int initial_button_state) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); if (initial_button_state < 0 || initial_button_state > 1) return 0; @@ -750,7 +750,7 @@ CV_IMPL void cvSetMouseCallback(const char* window_name, CvMouseCallback on_mous QPointer w = icvFindWindowByName(QLatin1String(window_name)); if (!w) - CV_Error(CV_StsNullPtr, "NULL window handler"); + CV_Error(cv::Error::StsNullPtr, "NULL window handler"); w->setMouseCallBack(on_mouse, param); @@ -780,7 +780,7 @@ CV_IMPL void cvShowImage(const char* name, const CvArr* arr) CV_IMPL void cvSetOpenGlDrawCallback(const char* window_name, CvOpenGlDrawCallback callback, void* userdata) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); QMetaObject::invokeMethod(guiMainThread, "setOpenGlDrawCallback", @@ -794,7 +794,7 @@ CV_IMPL void cvSetOpenGlDrawCallback(const char* window_name, CvOpenGlDrawCallba CV_IMPL void cvSetOpenGlContext(const char* window_name) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); QMetaObject::invokeMethod(guiMainThread, "setOpenGlContext", @@ -806,7 +806,7 @@ CV_IMPL void cvSetOpenGlContext(const char* window_name) CV_IMPL void cvUpdateWindow(const char* window_name) { if (!guiMainThread) - CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" ); + CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" ); QMetaObject::invokeMethod(guiMainThread, "updateWindow", @@ -1036,7 +1036,7 @@ void GuiReceiver::toggleFullScreen(QString name, double arg2) void GuiReceiver::createWindow(QString name, int flags) { if (!qApp) - CV_Error(CV_StsNullPtr, "NULL session handler" ); + CV_Error(cv::Error::StsNullPtr, "NULL session handler" ); // Check the name in the storage if (icvFindWindowByName(name.toLatin1().data())) @@ -1127,7 +1127,7 @@ void GuiReceiver::destroyWindow(QString name) void GuiReceiver::destroyAllWindow() { if (!qApp) - CV_Error(CV_StsNullPtr, "NULL session handler" ); + CV_Error(cv::Error::StsNullPtr, "NULL session handler" ); if (multiThreads) { @@ -1256,7 +1256,7 @@ void GuiReceiver::addSlider2(QString bar_name, QString window_name, void* value, return; if (count <= 0) //count is the max value of the slider, so must be bigger than 0 - CV_Error(CV_StsNullPtr, "Max value of the slider must be bigger than 0" ); + CV_Error(cv::Error::StsNullPtr, "Max value of the slider must be bigger than 0" ); CvWindow::addSlider2(w, bar_name, (int*)value, count, (CvTrackbarCallback2) on_change, userdata); } @@ -1286,10 +1286,10 @@ void GuiReceiver::addSlider(QString bar_name, QString window_name, void* value, return; if (!value) - CV_Error(CV_StsNullPtr, "NULL value pointer" ); + CV_Error(cv::Error::StsNullPtr, "NULL value pointer" ); if (count <= 0) //count is the max value of the slider, so must be bigger than 0 - CV_Error(CV_StsNullPtr, "Max value of the slider must be bigger than 0" ); + CV_Error(cv::Error::StsNullPtr, "Max value of the slider must be bigger than 0" ); CvWindow::addSlider(w, bar_name, (int*)value, count, (CvTrackbarCallback) on_change); } @@ -1703,7 +1703,7 @@ CvWindow::CvWindow(QString name, int arg2) //3: my view #ifndef HAVE_QT_OPENGL if (arg2 & CV_WINDOW_OPENGL) - CV_Error( CV_OpenGlNotSupported, "Library was built without OpenGL support" ); + CV_Error( cv::Error::OpenGlNotSupported, "Library was built without OpenGL support" ); mode_display = CV_MODE_NORMAL; #else mode_display = arg2 & CV_WINDOW_OPENGL ? CV_MODE_OPENGL : CV_MODE_NORMAL; @@ -2662,19 +2662,19 @@ void DefaultViewPort::startDisplayInfo(QString text, int delayms) void DefaultViewPort::setOpenGlDrawCallback(CvOpenGlDrawCallback /*callback*/, void* /*userdata*/) { - CV_Error(CV_OpenGlNotSupported, "Window doesn't support OpenGL"); + CV_Error(cv::Error::OpenGlNotSupported, "Window doesn't support OpenGL"); } void DefaultViewPort::makeCurrentOpenGlContext() { - CV_Error(CV_OpenGlNotSupported, "Window doesn't support OpenGL"); + CV_Error(cv::Error::OpenGlNotSupported, "Window doesn't support OpenGL"); } void DefaultViewPort::updateGl() { - CV_Error(CV_OpenGlNotSupported, "Window doesn't support OpenGL"); + CV_Error(cv::Error::OpenGlNotSupported, "Window doesn't support OpenGL"); } @@ -2777,7 +2777,7 @@ void DefaultViewPort::saveView() return; } - CV_Error(CV_StsNullPtr, "file extension not recognized, please choose between JPG, JPEG, BMP or PNG"); + CV_Error(cv::Error::StsNullPtr, "file extension not recognized, please choose between JPG, JPEG, BMP or PNG"); } } diff --git a/modules/highgui/src/window_gtk.cpp b/modules/highgui/src/window_gtk.cpp index ee590bd9c4..fa169f0bee 100644 --- a/modules/highgui/src/window_gtk.cpp +++ b/modules/highgui/src/window_gtk.cpp @@ -744,7 +744,7 @@ CvRect cvGetWindowRect_GTK(const char* name) CV_LOCK_MUTEX(); const auto window = icvFindWindowByName(name); if (!window) - CV_Error( CV_StsNullPtr, "NULL window" ); + CV_Error( cv::Error::StsNullPtr, "NULL window" ); return cvRect(getImageRect_(window)); } @@ -786,7 +786,7 @@ double cvGetModeWindow_GTK(const char* name)//YV CV_LOCK_MUTEX(); const auto window = icvFindWindowByName(name); if (!window) - CV_Error( CV_StsNullPtr, "NULL window" ); + CV_Error( cv::Error::StsNullPtr, "NULL window" ); double result = window->status; return result; @@ -801,7 +801,7 @@ void cvSetModeWindow_GTK( const char* name, double prop_value)//Yannick Verdie const auto window = icvFindWindowByName(name); if (!window) - CV_Error( CV_StsNullPtr, "NULL window" ); + CV_Error( cv::Error::StsNullPtr, "NULL window" ); setModeWindow_(window, (int)prop_value); } @@ -917,11 +917,11 @@ namespace // Try double-buffered visual glconfig = gdk_gl_config_new_by_mode((GdkGLConfigMode)(GDK_GL_MODE_RGB | GDK_GL_MODE_DEPTH | GDK_GL_MODE_DOUBLE)); if (!glconfig) - CV_Error( CV_OpenGlApiCallError, "Can't Create A GL Device Context" ); + CV_Error( cv::Error::OpenGlApiCallError, "Can't Create A GL Device Context" ); // Set OpenGL-capability to the widget if (!gtk_widget_set_gl_capability(window->widget, glconfig, NULL, TRUE, GDK_GL_RGBA_TYPE)) - CV_Error( CV_OpenGlApiCallError, "Can't Create A GL Device Context" ); + CV_Error( cv::Error::OpenGlApiCallError, "Can't Create A GL Device Context" ); window->useGl = true; } @@ -932,7 +932,7 @@ namespace GdkGLDrawable* gldrawable = gtk_widget_get_gl_drawable(window->widget); if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext)) - CV_Error( CV_OpenGlApiCallError, "Can't Activate The GL Rendering Context" ); + CV_Error( cv::Error::OpenGlApiCallError, "Can't Activate The GL Rendering Context" ); glViewport(0, 0, gtk_widget_get_allocated_width(window->widget), gtk_widget_get_allocated_height(window->widget)); @@ -1050,7 +1050,7 @@ static std::shared_ptr namedWindow_(const std::string& name, int flags #ifndef HAVE_OPENGL if (flags & CV_WINDOW_OPENGL) - CV_Error( CV_OpenGlNotSupported, "Library was built without OpenGL support" ); + CV_Error( cv::Error::OpenGlNotSupported, "Library was built without OpenGL support" ); #else if (flags & CV_WINDOW_OPENGL) createGlContext(window); @@ -1131,16 +1131,16 @@ CV_IMPL void cvSetOpenGlContext(const char* name) auto window = icvFindWindowByName(name); if (!window) - CV_Error( CV_StsNullPtr, "NULL window" ); + CV_Error( cv::Error::StsNullPtr, "NULL window" ); if (!window->useGl) - CV_Error( CV_OpenGlNotSupported, "Window doesn't support OpenGL" ); + CV_Error( cv::Error::OpenGlNotSupported, "Window doesn't support OpenGL" ); glcontext = gtk_widget_get_gl_context(window->widget); gldrawable = gtk_widget_get_gl_drawable(window->widget); if (!gdk_gl_drawable_make_current(gldrawable, glcontext)) - CV_Error( CV_OpenGlApiCallError, "Can't Activate The GL Rendering Context" ); + CV_Error( cv::Error::OpenGlApiCallError, "Can't Activate The GL Rendering Context" ); } CV_IMPL void cvUpdateWindow(const char* name) @@ -1168,7 +1168,7 @@ CV_IMPL void cvSetOpenGlDrawCallback(const char* name, CvOpenGlDrawCallback call return; if (!window->useGl) - CV_Error( CV_OpenGlNotSupported, "Window was created without OpenGL context" ); + CV_Error( cv::Error::OpenGlNotSupported, "Window was created without OpenGL context" ); window->glDrawCallback = callback; window->glDrawData = userdata; @@ -1384,7 +1384,7 @@ icvCreateTrackbar( const char* trackbar_name, const char* window_name, CV_Assert(trackbar_name && "NULL trackbar name"); if( count <= 0 ) - CV_Error( CV_StsOutOfRange, "Bad trackbar maximal value" ); + CV_Error( cv::Error::StsOutOfRange, "Bad trackbar maximal value" ); CV_LOCK_MUTEX(); @@ -1557,7 +1557,7 @@ CV_IMPL void cvSetTrackbarPos( const char* trackbar_name, const char* window_nam const auto trackbar = icvFindTrackbarByName(window, trackbar_name); if (!trackbar) { - CV_Error( CV_StsNullPtr, "No trackbar found" ); + CV_Error( cv::Error::StsNullPtr, "No trackbar found" ); } return setTrackbarPos_(trackbar, pos); diff --git a/modules/highgui/src/window_winrt.cpp b/modules/highgui/src/window_winrt.cpp index af771bd00b..93d14e3aef 100644 --- a/modules/highgui/src/window_winrt.cpp +++ b/modules/highgui/src/window_winrt.cpp @@ -36,7 +36,7 @@ #define CV_WINRT_NO_GUI_ERROR( funcname ) \ { \ - cvError( CV_StsNotImplemented, funcname, \ + cvError( cv::Error::StsNotImplemented, funcname, \ "The function is not implemented. ", \ __FILE__, __LINE__ ); \ } @@ -65,7 +65,7 @@ CV_IMPL void cvShowImage(const char* name, const CvArr* arr) CvMat stub, *image; if (!name) - CV_ERROR(CV_StsNullPtr, "NULL name"); + CV_ERROR(cv::Error::StsNullPtr, "NULL name"); CvWindow* window = HighguiBridge::getInstance().namedWindow(name); @@ -89,7 +89,7 @@ CV_IMPL int cvNamedWindow(const char* name, int flags) CV_FUNCNAME("cvNamedWindow"); if (!name) - CV_ERROR(CV_StsNullPtr, "NULL name"); + CV_ERROR(cv::Error::StsNullPtr, "NULL name"); HighguiBridge::getInstance().namedWindow(name); @@ -101,7 +101,7 @@ CV_IMPL void cvDestroyWindow(const char* name) CV_FUNCNAME("cvDestroyWindow"); if (!name) - CV_ERROR(CV_StsNullPtr, "NULL name string"); + CV_ERROR(cv::Error::StsNullPtr, "NULL name string"); HighguiBridge::getInstance().destroyWindow(name); } @@ -119,16 +119,16 @@ CV_IMPL int cvCreateTrackbar2(const char* trackbar_name, const char* window_name int pos = 0; if (!window_name || !trackbar_name) - CV_ERROR(CV_StsNullPtr, "NULL window or trackbar name"); + CV_ERROR(cv::Error::StsNullPtr, "NULL window or trackbar name"); if (count < 0) - CV_ERROR(CV_StsOutOfRange, "Bad trackbar max value"); + CV_ERROR(cv::Error::StsOutOfRange, "Bad trackbar max value"); CvWindow* window = HighguiBridge::getInstance().namedWindow(window_name); if (!window) { - CV_ERROR(CV_StsNullPtr, "NULL window"); + CV_ERROR(cv::Error::StsNullPtr, "NULL window"); } window->createSlider(trackbar_name, val, count, on_notify, userdata); @@ -143,7 +143,7 @@ CV_IMPL void cvSetTrackbarPos(const char* trackbar_name, const char* window_name CvTrackbar* trackbar = 0; if (trackbar_name == 0 || window_name == 0) - CV_ERROR(CV_StsNullPtr, "NULL trackbar or window name"); + CV_ERROR(cv::Error::StsNullPtr, "NULL trackbar or window name"); CvWindow* window = HighguiBridge::getInstance().findWindowByName(window_name); if (window) @@ -160,7 +160,7 @@ CV_IMPL void cvSetTrackbarMax(const char* trackbar_name, const char* window_name if (maxval >= 0) { if (trackbar_name == 0 || window_name == 0) - CV_ERROR(CV_StsNullPtr, "NULL trackbar or window name"); + CV_ERROR(cv::Error::StsNullPtr, "NULL trackbar or window name"); CvTrackbar* trackbar = HighguiBridge::getInstance().findTrackbarByName(trackbar_name, window_name); @@ -176,7 +176,7 @@ CV_IMPL void cvSetTrackbarMin(const char* trackbar_name, const char* window_name if (minval >= 0) { if (trackbar_name == 0 || window_name == 0) - CV_ERROR(CV_StsNullPtr, "NULL trackbar or window name"); + CV_ERROR(cv::Error::StsNullPtr, "NULL trackbar or window name"); CvTrackbar* trackbar = HighguiBridge::getInstance().findTrackbarByName(trackbar_name, window_name); @@ -192,7 +192,7 @@ CV_IMPL int cvGetTrackbarPos(const char* trackbar_name, const char* window_name) CV_FUNCNAME("cvGetTrackbarPos"); if (trackbar_name == 0 || window_name == 0) - CV_ERROR(CV_StsNullPtr, "NULL trackbar or window name"); + CV_ERROR(cv::Error::StsNullPtr, "NULL trackbar or window name"); CvTrackbar* trackbar = HighguiBridge::getInstance().findTrackbarByName(trackbar_name, window_name); @@ -229,7 +229,7 @@ CV_IMPL void cvSetMouseCallback(const char* window_name, CvMouseCallback on_mous CV_FUNCNAME("cvSetMouseCallback"); if (!window_name) - CV_ERROR(CV_StsNullPtr, "NULL window name"); + CV_ERROR(cv::Error::StsNullPtr, "NULL window name"); CvWindow* window = HighguiBridge::getInstance().findWindowByName(window_name); if (!window) @@ -253,19 +253,19 @@ CV_IMPL void cvResizeWindow(const char* name, int width, int height) CV_IMPL int cvInitSystem(int, char**) { CV_WINRT_NO_GUI_ERROR("cvInitSystem"); - return CV_StsNotImplemented; + return cv::Error::StsNotImplemented; } CV_IMPL void* cvGetWindowHandle(const char*) { CV_WINRT_NO_GUI_ERROR("cvGetWindowHandle"); - return (void*) CV_StsNotImplemented; + return (void*) cv::Error::StsNotImplemented; } CV_IMPL const char* cvGetWindowName(void*) { CV_WINRT_NO_GUI_ERROR("cvGetWindowName"); - return (const char*) CV_StsNotImplemented; + return (const char*) cv::Error::StsNotImplemented; } void cvSetModeWindow_WinRT(const char* name, double prop_value) { @@ -274,10 +274,10 @@ void cvSetModeWindow_WinRT(const char* name, double prop_value) { double cvGetModeWindow_WinRT(const char* name) { CV_WINRT_NO_GUI_ERROR("cvGetModeWindow"); - return CV_StsNotImplemented; + return cv::Error::StsNotImplemented; } CV_IMPL int cvStartWindowThread() { CV_WINRT_NO_GUI_ERROR("cvStartWindowThread"); - return CV_StsNotImplemented; + return cv::Error::StsNotImplemented; } diff --git a/modules/imgproc/src/approx.cpp b/modules/imgproc/src/approx.cpp index df1570c38d..f05a6bcf3c 100644 --- a/modules/imgproc/src/approx.cpp +++ b/modules/imgproc/src/approx.cpp @@ -389,9 +389,9 @@ cvApproxChains( CvSeq* src_seq, CvSeq *dst_seq = 0; if( !src_seq || !storage ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( method > cv::CHAIN_APPROX_TC89_KCOS || method <= 0 || minimal_perimeter < 0 ) - CV_Error( CV_StsOutOfRange, "" ); + CV_Error( cv::Error::StsOutOfRange, "" ); while( src_seq != 0 ) { @@ -410,7 +410,7 @@ cvApproxChains( CvSeq* src_seq, contour = icvApproximateChainTC89( (CvChain *) src_seq, sizeof( CvContour ), storage, method ); break; default: - CV_Error( CV_StsOutOfRange, "" ); + CV_Error( cv::Error::StsOutOfRange, "" ); } if( contour->total > 0 ) @@ -681,7 +681,7 @@ void cv::approxPolyDP( InputArray _curve, OutputArray _approxCurve, //from being used. if (epsilon < 0.0 || !(epsilon < 1e30)) { - CV_Error(CV_StsOutOfRange, "Epsilon not valid."); + CV_Error(cv::Error::StsOutOfRange, "Epsilon not valid."); } Mat curve = _curve.getMat(); @@ -704,7 +704,7 @@ void cv::approxPolyDP( InputArray _curve, OutputArray _approxCurve, else if( depth == CV_32F ) nout = approxPolyDP_(curve.ptr(), npoints, (Point2f*)buf, closed, epsilon, _stack); else - CV_Error( CV_StsUnsupportedFormat, "" ); + CV_Error( cv::Error::StsUnsupportedFormat, "" ); Mat(nout, 1, CV_MAKETYPE(depth, 2), buf).copyTo(_approxCurve); } @@ -728,7 +728,7 @@ cvApproxPoly( const void* array, int header_size, { src_seq = (CvSeq*)array; if( !CV_IS_SEQ_POLYLINE( src_seq )) - CV_Error( CV_StsBadArg, "Unsupported sequence type" ); + CV_Error( cv::Error::StsBadArg, "Unsupported sequence type" ); recursive = parameter2; @@ -743,10 +743,10 @@ cvApproxPoly( const void* array, int header_size, } if( !storage ) - CV_Error( CV_StsNullPtr, "NULL storage pointer " ); + CV_Error( cv::Error::StsNullPtr, "NULL storage pointer " ); if( header_size < 0 ) - CV_Error( CV_StsOutOfRange, "header_size is negative. " + CV_Error( cv::Error::StsOutOfRange, "header_size is negative. " "Pass 0 to make the destination header_size == input header_size" ); if( header_size == 0 ) @@ -756,12 +756,12 @@ cvApproxPoly( const void* array, int header_size, { if( CV_IS_SEQ_CHAIN( src_seq )) { - CV_Error( CV_StsBadArg, "Input curves are not polygonal. " + CV_Error( cv::Error::StsBadArg, "Input curves are not polygonal. " "Use cvApproxChains first" ); } else { - CV_Error( CV_StsBadArg, "Input curves have unknown type" ); + CV_Error( cv::Error::StsBadArg, "Input curves have unknown type" ); } } @@ -769,10 +769,10 @@ cvApproxPoly( const void* array, int header_size, header_size = src_seq->header_size; if( header_size < (int)sizeof(CvContour) ) - CV_Error( CV_StsBadSize, "New header size must be non-less than sizeof(CvContour)" ); + CV_Error( cv::Error::StsBadSize, "New header size must be non-less than sizeof(CvContour)" ); if( method != CV_POLY_APPROX_DP ) - CV_Error( CV_StsOutOfRange, "Unknown approximation method" ); + CV_Error( cv::Error::StsOutOfRange, "Unknown approximation method" ); while( src_seq != 0 ) { @@ -782,7 +782,7 @@ cvApproxPoly( const void* array, int header_size, { case CV_POLY_APPROX_DP: if( parameter < 0 ) - CV_Error( CV_StsOutOfRange, "Accuracy must be non-negative" ); + CV_Error( cv::Error::StsOutOfRange, "Accuracy must be non-negative" ); CV_Assert( CV_SEQ_ELTYPE(src_seq) == CV_32SC2 || CV_SEQ_ELTYPE(src_seq) == CV_32FC2 ); @@ -804,7 +804,7 @@ cvApproxPoly( const void* array, int header_size, nout = cv::approxPolyDP_((cv::Point2f*)src, npoints, (cv::Point2f*)dst, closed, parameter, stack); else - CV_Error( CV_StsUnsupportedFormat, "" ); + CV_Error( cv::Error::StsUnsupportedFormat, "" ); contour = cvCreateSeq( src_seq->flags, header_size, src_seq->elem_size, storage ); @@ -812,7 +812,7 @@ cvApproxPoly( const void* array, int header_size, } break; default: - CV_Error( CV_StsBadArg, "Invalid approximation method" ); + CV_Error( cv::Error::StsBadArg, "Invalid approximation method" ); } CV_Assert( contour ); diff --git a/modules/imgproc/src/bilateral_filter.dispatch.cpp b/modules/imgproc/src/bilateral_filter.dispatch.cpp index e2a9dcba39..501af5b244 100644 --- a/modules/imgproc/src/bilateral_filter.dispatch.cpp +++ b/modules/imgproc/src/bilateral_filter.dispatch.cpp @@ -422,7 +422,7 @@ void bilateralFilter( InputArray _src, OutputArray _dst, int d, else if( src.depth() == CV_32F ) bilateralFilter_32f( src, dst, d, sigmaColor, sigmaSpace, borderType ); else - CV_Error( CV_StsUnsupportedFormat, + CV_Error( cv::Error::StsUnsupportedFormat, "Bilateral filtering is only implemented for 8u and 32f images" ); } diff --git a/modules/imgproc/src/box_filter.simd.hpp b/modules/imgproc/src/box_filter.simd.hpp index f7c8f66a35..ac0b0f1b56 100644 --- a/modules/imgproc/src/box_filter.simd.hpp +++ b/modules/imgproc/src/box_filter.simd.hpp @@ -1200,7 +1200,7 @@ Ptr getRowSumFilter(int srcType, int sumType, int ksize, int anch if( sdepth == CV_64F && ddepth == CV_64F ) return makePtr >(ksize, anchor); - CV_Error_( CV_StsNotImplemented, + CV_Error_( cv::Error::StsNotImplemented, ("Unsupported combination of source format (=%d), and buffer format (=%d)", srcType, sumType)); } @@ -1241,7 +1241,7 @@ Ptr getColumnSumFilter(int sumType, int dstType, int ksize, in if( ddepth == CV_64F && sdepth == CV_64F ) return makePtr >(ksize, anchor, scale); - CV_Error_( CV_StsNotImplemented, + CV_Error_( cv::Error::StsNotImplemented, ("Unsupported combination of sum format (=%d), and destination format (=%d)", sumType, dstType)); } @@ -1339,7 +1339,7 @@ Ptr getSqrRowSumFilter(int srcType, int sumType, int ksize, int a if( sdepth == CV_64F && ddepth == CV_64F ) return makePtr >(ksize, anchor); - CV_Error_( CV_StsNotImplemented, + CV_Error_( cv::Error::StsNotImplemented, ("Unsupported combination of source format (=%d), and buffer format (=%d)", srcType, sumType)); } diff --git a/modules/imgproc/src/canny.cpp b/modules/imgproc/src/canny.cpp index 2fed0ba0c2..c322959441 100644 --- a/modules/imgproc/src/canny.cpp +++ b/modules/imgproc/src/canny.cpp @@ -844,7 +844,7 @@ void Canny( InputArray _src, OutputArray _dst, } if ((aperture_size & 1) == 0 || (aperture_size != -1 && (aperture_size < 3 || aperture_size > 7))) - CV_Error(CV_StsBadFlag, "Aperture size should be odd between 3 and 7"); + CV_Error(cv::Error::StsBadFlag, "Aperture size should be odd between 3 and 7"); if (aperture_size == 7) { diff --git a/modules/imgproc/src/clahe.cpp b/modules/imgproc/src/clahe.cpp index 677b6a0738..b787378ee3 100644 --- a/modules/imgproc/src/clahe.cpp +++ b/modules/imgproc/src/clahe.cpp @@ -415,7 +415,7 @@ namespace else if (_src.type() == CV_16UC1) calcLutBody = cv::makePtr >(srcForLut, lut_, tileSize, tilesX_, clipLimit, lutScale); else - CV_Error( CV_StsBadArg, "Unsupported type" ); + CV_Error( cv::Error::StsBadArg, "Unsupported type" ); cv::parallel_for_(cv::Range(0, tilesX_ * tilesY_), *calcLutBody); diff --git a/modules/imgproc/src/color.cpp b/modules/imgproc/src/color.cpp index 4eaa051e24..dde8e1344c 100644 --- a/modules/imgproc/src/color.cpp +++ b/modules/imgproc/src/color.cpp @@ -177,7 +177,7 @@ void cvtColorTwoPlane( InputArray _ysrc, InputArray _uvsrc, OutputArray _dst, in case COLOR_YUV2BGRA_NV21: case COLOR_YUV2RGBA_NV21: case COLOR_YUV2BGRA_NV12: case COLOR_YUV2RGBA_NV12: break; default: - CV_Error( CV_StsBadFlag, "Unknown/unsupported color conversion code" ); + CV_Error( cv::Error::StsBadFlag, "Unknown/unsupported color conversion code" ); return; } @@ -379,7 +379,7 @@ void cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) cvtColormRGBA2RGBA(_src, _dst); break; default: - CV_Error( CV_StsBadFlag, "Unknown/unsupported color conversion code" ); + CV_Error( cv::Error::StsBadFlag, "Unknown/unsupported color conversion code" ); } } } //namespace cv diff --git a/modules/imgproc/src/color_yuv.simd.hpp b/modules/imgproc/src/color_yuv.simd.hpp index 03f1b653e5..f80b3d931c 100644 --- a/modules/imgproc/src/color_yuv.simd.hpp +++ b/modules/imgproc/src/color_yuv.simd.hpp @@ -2029,7 +2029,7 @@ void cvtTwoPlaneYUVtoBGR(const uchar * y_data, size_t y_step, const uchar * uv_d case 401: cvtPtr = cvtYUV420sp2RGB<0, 1, 4>; break; case 420: cvtPtr = cvtYUV420sp2RGB<2, 0, 4>; break; case 421: cvtPtr = cvtYUV420sp2RGB<2, 1, 4>; break; - default: CV_Error( CV_StsBadFlag, "Unknown/unsupported color conversion code" ); break; + default: CV_Error( cv::Error::StsBadFlag, "Unknown/unsupported color conversion code" ); break; }; cvtPtr(dst_data, dst_step, dst_width, dst_height, y_data, y_step, uv_data, uv_step); @@ -2069,7 +2069,7 @@ void cvtThreePlaneYUVtoBGR(const uchar * src_data, size_t src_step, case 32: cvtPtr = cvtYUV420p2RGB<2, 3>; break; case 40: cvtPtr = cvtYUV420p2RGB<0, 4>; break; case 42: cvtPtr = cvtYUV420p2RGB<2, 4>; break; - default: CV_Error( CV_StsBadFlag, "Unknown/unsupported color conversion code" ); break; + default: CV_Error( cv::Error::StsBadFlag, "Unknown/unsupported color conversion code" ); break; }; cvtPtr(dst_data, dst_step, dst_width, dst_height, src_step, src_data, u, v, ustepIdx, vstepIdx); @@ -2139,7 +2139,7 @@ void cvtOnePlaneYUVtoBGR(const uchar * src_data, size_t src_step, case 4200: cvtPtr = cvtYUV422toRGB<2,0,0,4>; break; case 4201: cvtPtr = cvtYUV422toRGB<2,0,1,4>; break; case 4210: cvtPtr = cvtYUV422toRGB<2,1,0,4>; break; - default: CV_Error( CV_StsBadFlag, "Unknown/unsupported color conversion code" ); break; + default: CV_Error( cv::Error::StsBadFlag, "Unknown/unsupported color conversion code" ); break; }; cvtPtr(dst_data, dst_step, src_data, src_step, width, height); @@ -2168,7 +2168,7 @@ void cvtOnePlaneBGRtoYUV(const uchar * src_data, size_t src_step, case 4200: cvtPtr = cvtRGBtoYUV422<2,0,0,4>; break; case 4201: cvtPtr = cvtRGBtoYUV422<2,0,1,4>; break; case 4210: cvtPtr = cvtRGBtoYUV422<2,1,0,4>; break; - default: CV_Error( CV_StsBadFlag, "Unknown/unsupported color conversion code" ); break; + default: CV_Error( cv::Error::StsBadFlag, "Unknown/unsupported color conversion code" ); break; }; cvtPtr(dst_data, dst_step, src_data, src_step, width, height); diff --git a/modules/imgproc/src/connectedcomponents.cpp b/modules/imgproc/src/connectedcomponents.cpp index a2f4b6e890..d402ea91c3 100644 --- a/modules/imgproc/src/connectedcomponents.cpp +++ b/modules/imgproc/src/connectedcomponents.cpp @@ -5716,7 +5716,7 @@ namespace cv{ } } - CV_Error(CV_StsUnsupportedFormat, "unsupported label/image type"); + CV_Error(cv::Error::StsUnsupportedFormat, "unsupported label/image type"); } } @@ -5738,7 +5738,7 @@ int cv::connectedComponents(InputArray img_, OutputArray _labels, int connectivi return connectedComponents_sub1(img, labels, connectivity, ccltype, sop); } else{ - CV_Error(CV_StsUnsupportedFormat, "the type of labels must be 16u or 32s"); + CV_Error(cv::Error::StsUnsupportedFormat, "the type of labels must be 16u or 32s"); } } @@ -5763,7 +5763,7 @@ int cv::connectedComponentsWithStats(InputArray img_, OutputArray _labels, Outpu return connectedComponents_sub1(img, labels, connectivity, ccltype, sop); } else{ - CV_Error(CV_StsUnsupportedFormat, "the type of labels must be 16u or 32s"); + CV_Error(cv::Error::StsUnsupportedFormat, "the type of labels must be 16u or 32s"); return 0; } } diff --git a/modules/imgproc/src/contours.cpp b/modules/imgproc/src/contours.cpp index 2e0d14e4c7..2e3121418a 100644 --- a/modules/imgproc/src/contours.cpp +++ b/modules/imgproc/src/contours.cpp @@ -59,10 +59,10 @@ cvStartReadChainPoints( CvChain * chain, CvChainPtReader * reader ) int i; if( !chain || !reader ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( chain->elem_size != 1 || chain->header_size < (int)sizeof(CvChain)) - CV_Error( CV_StsBadSize, "" ); + CV_Error( cv::Error::StsBadSize, "" ); cvStartReadSeq( (CvSeq *) chain, (CvSeqReader *) reader, 0 ); @@ -80,7 +80,7 @@ CV_IMPL CvPoint cvReadChainPoint( CvChainPtReader * reader ) { if( !reader ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); cv::Point2i pt = reader->pt; @@ -180,7 +180,7 @@ cvStartFindContours_Impl( void* _img, CvMemStorage* storage, int method, CvPoint offset, int needFillBorder ) { if( !storage ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); CvMat stub, *mat = cvGetMat( _img, &stub ); @@ -189,7 +189,7 @@ cvStartFindContours_Impl( 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, + CV_Error( cv::Error::StsUnsupportedFormat, "[Start]FindContours supports only CV_8UC1 images when mode != CV_RETR_FLOODFILL " "otherwise supports CV_32SC1 images only" ); @@ -198,10 +198,10 @@ cvStartFindContours_Impl( void* _img, CvMemStorage* storage, uchar* img = (uchar*)(mat->data.ptr); if( method < 0 || method > CV_CHAIN_APPROX_TC89_KCOS ) - CV_Error( CV_StsOutOfRange, "" ); + CV_Error( cv::Error::StsOutOfRange, "" ); if( header_size < (int) (method == CV_CHAIN_CODE ? sizeof( CvChain ) : sizeof( CvContour ))) - CV_Error( CV_StsBadSize, "" ); + CV_Error( cv::Error::StsBadSize, "" ); CvContourScanner scanner = (CvContourScanner)cvAlloc( sizeof( *scanner )); memset( scanner, 0, sizeof(*scanner) ); @@ -487,7 +487,7 @@ cvSubstituteContour( CvContourScanner scanner, CvSeq * new_contour ) _CvContourInfo *l_cinfo; if( !scanner ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); l_cinfo = scanner->l_cinfo; if( l_cinfo && l_cinfo->contour && l_cinfo->contour != new_contour ) @@ -1029,7 +1029,7 @@ CvSeq * cvFindNextContour( CvContourScanner scanner ) { if( !scanner ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); CV_Assert(scanner->img_step >= 0); @@ -1313,7 +1313,7 @@ cvEndFindContours( CvContourScanner * _scanner ) CvSeq *first = 0; if( !_scanner ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); scanner = *_scanner; if( scanner ) @@ -1438,13 +1438,13 @@ icvFindContoursInInterval( const CvArr* src, CvSeq* prev = 0; if( !storage ) - CV_Error( CV_StsNullPtr, "NULL storage pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL storage pointer" ); if( !result ) - CV_Error( CV_StsNullPtr, "NULL double CvSeq pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL double CvSeq pointer" ); if( contourHeaderSize < (int)sizeof(CvContour)) - CV_Error( CV_StsBadSize, "Contour header size must be >= sizeof(CvContour)" ); + CV_Error( cv::Error::StsBadSize, "Contour header size must be >= sizeof(CvContour)" ); storage00.reset(cvCreateChildMemStorage(storage)); storage01.reset(cvCreateChildMemStorage(storage)); @@ -1453,7 +1453,7 @@ icvFindContoursInInterval( const CvArr* src, mat = cvGetMat( src, &stub ); if( !CV_IS_MASK_ARR(mat)) - CV_Error( CV_StsBadArg, "Input array must be 8uC1 or 8sC1" ); + CV_Error( cv::Error::StsBadArg, "Input array must be 8uC1 or 8sC1" ); src_data = mat->data.ptr; img_step = mat->step; img_size = cvGetMatSize(mat); @@ -1745,14 +1745,14 @@ cvFindContours_Impl( void* img, CvMemStorage* storage, int count = -1; if( !firstContour ) - CV_Error( CV_StsNullPtr, "NULL double CvSeq pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL double CvSeq pointer" ); *firstContour = 0; if( method == CV_LINK_RUNS ) { if( offset.x != 0 || offset.y != 0 ) - CV_Error( CV_StsOutOfRange, + CV_Error( cv::Error::StsOutOfRange, "Nonzero offset is not supported in CV_LINK_RUNS yet" ); count = icvFindContoursInInterval( img, storage, firstContour, cntHeaderSize ); diff --git a/modules/imgproc/src/convhull.cpp b/modules/imgproc/src/convhull.cpp index d6e02cc0fb..f16618ccb6 100644 --- a/modules/imgproc/src/convhull.cpp +++ b/modules/imgproc/src/convhull.cpp @@ -471,7 +471,7 @@ cvConvexHull2( const CvArr* array, void* hull_storage, { ptseq = (CvSeq*)array; if( !CV_IS_SEQ_POINT_SET( ptseq )) - CV_Error( CV_StsBadArg, "Unsupported sequence type" ); + CV_Error( cv::Error::StsBadArg, "Unsupported sequence type" ); if( hull_storage == 0 ) hull_storage = ptseq->storage; } @@ -503,15 +503,15 @@ cvConvexHull2( const CvArr* array, void* hull_storage, mat = (CvMat*)hull_storage; if( (mat->cols != 1 && mat->rows != 1) || !CV_IS_MAT_CONT(mat->type)) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "The hull matrix should be continuous and have a single row or a single column" ); if( mat->cols + mat->rows - 1 < ptseq->total ) - CV_Error( CV_StsBadSize, "The hull matrix size might be not enough to fit the hull" ); + CV_Error( cv::Error::StsBadSize, "The hull matrix size might be not enough to fit the hull" ); if( CV_MAT_TYPE(mat->type) != CV_SEQ_ELTYPE(ptseq) && CV_MAT_TYPE(mat->type) != CV_32SC1 ) - CV_Error( CV_StsUnsupportedFormat, + CV_Error( cv::Error::StsUnsupportedFormat, "The hull matrix must have the same type as input or 32sC1 (integers)" ); hullseq = cvMakeSeqHeaderForArray( @@ -526,7 +526,7 @@ cvConvexHull2( const CvArr* array, void* hull_storage, if( total == 0 ) { if( !isStorage ) - CV_Error( CV_StsBadSize, + CV_Error( cv::Error::StsBadSize, "Point sequence can not be empty if the output is matrix" ); return 0; } @@ -592,7 +592,7 @@ CV_IMPL CvSeq* cvConvexityDefects( const CvArr* array, if( CV_IS_SEQ( ptseq )) { if( !CV_IS_SEQ_POINT_SET( ptseq )) - CV_Error( CV_StsUnsupportedFormat, + CV_Error( cv::Error::StsUnsupportedFormat, "Input sequence is not a sequence of points" ); if( !storage ) storage = ptseq->storage; @@ -603,13 +603,13 @@ CV_IMPL CvSeq* cvConvexityDefects( const CvArr* array, } if( CV_SEQ_ELTYPE( ptseq ) != CV_32SC2 ) - CV_Error( CV_StsUnsupportedFormat, "Floating-point coordinates are not supported here" ); + CV_Error( cv::Error::StsUnsupportedFormat, "Floating-point coordinates are not supported here" ); if( CV_IS_SEQ( hull )) { int hulltype = CV_SEQ_ELTYPE( hull ); if( hulltype != CV_SEQ_ELTYPE_PPOINT && hulltype != CV_SEQ_ELTYPE_INDEX ) - CV_Error( CV_StsUnsupportedFormat, + CV_Error( cv::Error::StsUnsupportedFormat, "Convex hull must represented as a sequence " "of indices or sequence of pointers" ); if( !storage ) @@ -620,15 +620,15 @@ CV_IMPL CvSeq* cvConvexityDefects( const CvArr* array, CvMat* mat = (CvMat*)hull; if( !CV_IS_MAT( hull )) - CV_Error(CV_StsBadArg, "Convex hull is neither sequence nor matrix"); + CV_Error(cv::Error::StsBadArg, "Convex hull is neither sequence nor matrix"); if( (mat->cols != 1 && mat->rows != 1) || !CV_IS_MAT_CONT(mat->type) || CV_MAT_TYPE(mat->type) != CV_32SC1 ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "The matrix should be 1-dimensional and continuous array of int's" ); if( mat->cols + mat->rows - 1 > ptseq->total ) - CV_Error( CV_StsBadSize, "Convex hull is larger than the point sequence" ); + CV_Error( cv::Error::StsBadSize, "Convex hull is larger than the point sequence" ); hull = cvMakeSeqHeaderForArray( CV_SEQ_KIND_CURVE|CV_MAT_TYPE(mat->type)|CV_SEQ_FLAG_CLOSED, @@ -639,13 +639,13 @@ CV_IMPL CvSeq* cvConvexityDefects( const CvArr* array, is_index = CV_SEQ_ELTYPE(hull) == CV_SEQ_ELTYPE_INDEX; if( !storage ) - CV_Error( CV_StsNullPtr, "NULL storage pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL storage pointer" ); defects = cvCreateSeq( CV_SEQ_KIND_GENERIC, sizeof(CvSeq), sizeof(CvConvexityDefect), storage ); if( ptseq->total < 4 || hull->total < 3) { - //CV_ERROR( CV_StsBadSize, + //CV_ERROR( cv::Error::StsBadSize, // "point seq size must be >= 4, convex hull size must be >= 3" ); return defects; } @@ -779,7 +779,7 @@ cvCheckContourConvexity( const CvArr* array ) if( CV_IS_SEQ(contour) ) { if( !CV_IS_SEQ_POINT_SET(contour)) - CV_Error( CV_StsUnsupportedFormat, + CV_Error( cv::Error::StsUnsupportedFormat, "Input sequence must be polygon (closed 2d curve)" ); } else diff --git a/modules/imgproc/src/demosaicing.cpp b/modules/imgproc/src/demosaicing.cpp index 148df552e4..2bfa705b8a 100644 --- a/modules/imgproc/src/demosaicing.cpp +++ b/modules/imgproc/src/demosaicing.cpp @@ -1708,7 +1708,7 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn) else if( depth == CV_16U ) Bayer2Gray_ >(src, dst, code); else - CV_Error(CV_StsUnsupportedFormat, "Bayer->Gray demosaicing only supports 8u and 16u types"); + CV_Error(cv::Error::StsUnsupportedFormat, "Bayer->Gray demosaicing only supports 8u and 16u types"); break; case COLOR_BayerBG2BGRA: case COLOR_BayerGB2BGRA: case COLOR_BayerRG2BGRA: case COLOR_BayerGR2BGRA: @@ -1735,7 +1735,7 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn) else if( depth == CV_16U ) Bayer2RGB_ >(src, dst_, code); else - CV_Error(CV_StsUnsupportedFormat, "Bayer->RGB demosaicing only supports 8u and 16u types"); + CV_Error(cv::Error::StsUnsupportedFormat, "Bayer->RGB demosaicing only supports 8u and 16u types"); } else { @@ -1758,11 +1758,11 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn) else if (depth == CV_16U) Bayer2RGB_EdgeAware_T >(src, dst, code); else - CV_Error(CV_StsUnsupportedFormat, "Bayer->RGB Edge-Aware demosaicing only currently supports 8u and 16u types"); + CV_Error(cv::Error::StsUnsupportedFormat, "Bayer->RGB Edge-Aware demosaicing only currently supports 8u and 16u types"); break; default: - CV_Error( CV_StsBadFlag, "Unknown / unsupported color conversion code" ); + CV_Error( cv::Error::StsBadFlag, "Unknown / unsupported color conversion code" ); } } diff --git a/modules/imgproc/src/deriv.cpp b/modules/imgproc/src/deriv.cpp index 9cec64a9e9..cc9db282fd 100644 --- a/modules/imgproc/src/deriv.cpp +++ b/modules/imgproc/src/deriv.cpp @@ -101,7 +101,7 @@ static void getSobelKernels( OutputArray _kx, OutputArray _ky, Mat ky = _ky.getMat(); if( _ksize % 2 == 0 || _ksize > 31 ) - CV_Error( CV_StsOutOfRange, "The kernel size must be odd and not larger than 31" ); + CV_Error( cv::Error::StsOutOfRange, "The kernel size must be odd and not larger than 31" ); std::vector kerI(std::max(ksizeX, ksizeY) + 1); CV_Assert( dx >= 0 && dy >= 0 && dx+dy > 0 ); diff --git a/modules/imgproc/src/distransform.cpp b/modules/imgproc/src/distransform.cpp index c2bdb62948..6a7026c8c8 100644 --- a/modules/imgproc/src/distransform.cpp +++ b/modules/imgproc/src/distransform.cpp @@ -448,7 +448,7 @@ static void getDistanceTransformMask( int maskType, float *metrics ) metrics[2] = 2.1969f; break; default: - CV_Error(CV_StsBadArg, "Unknown metric type"); + CV_Error(cv::Error::StsBadArg, "Unknown metric type"); } } @@ -766,7 +766,7 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe float _mask[5] = {0}; if( maskSize != cv::DIST_MASK_3 && maskSize != cv::DIST_MASK_5 && maskSize != cv::DIST_MASK_PRECISE ) - CV_Error( CV_StsBadSize, "Mask size should be 3 or 5 or 0 (precise)" ); + CV_Error( cv::Error::StsBadSize, "Mask size should be 3 or 5 or 0 (precise)" ); if ((distType == cv::DIST_C || distType == cv::DIST_L1) && !need_labels) maskSize = cv::DIST_MASK_3; diff --git a/modules/imgproc/src/drawing.cpp b/modules/imgproc/src/drawing.cpp index 019c6e537e..355525eb6c 100644 --- a/modules/imgproc/src/drawing.cpp +++ b/modules/imgproc/src/drawing.cpp @@ -2239,7 +2239,7 @@ static const int* getFontData(int fontFace) ascii = HersheyScriptComplex; break; default: - CV_Error( CV_StsOutOfRange, "Unknown font type" ); + CV_Error( cv::Error::StsOutOfRange, "Unknown font type" ); } return ascii; } diff --git a/modules/imgproc/src/emd.cpp b/modules/imgproc/src/emd.cpp index eb86460535..8b7f325e74 100644 --- a/modules/imgproc/src/emd.cpp +++ b/modules/imgproc/src/emd.cpp @@ -174,28 +174,28 @@ CV_IMPL float cvCalcEMD2( const CvArr* signature_arr1, signature2 = cvGetMat( signature2, &sign_stub2 ); if( signature1->cols != signature2->cols ) - CV_Error( CV_StsUnmatchedSizes, "The arrays must have equal number of columns (which is number of dimensions but 1)" ); + CV_Error( cv::Error::StsUnmatchedSizes, "The arrays must have equal number of columns (which is number of dimensions but 1)" ); dims = signature1->cols - 1; size1 = signature1->rows; size2 = signature2->rows; if( !CV_ARE_TYPES_EQ( signature1, signature2 )) - CV_Error( CV_StsUnmatchedFormats, "The array must have equal types" ); + CV_Error( cv::Error::StsUnmatchedFormats, "The array must have equal types" ); if( CV_MAT_TYPE( signature1->type ) != CV_32FC1 ) - CV_Error( CV_StsUnsupportedFormat, "The signatures must be 32fC1" ); + CV_Error( cv::Error::StsUnsupportedFormat, "The signatures must be 32fC1" ); if( flow ) { flow = cvGetMat( flow, &flow_stub ); if( flow->rows != size1 || flow->cols != size2 ) - CV_Error( CV_StsUnmatchedSizes, + CV_Error( cv::Error::StsUnmatchedSizes, "The flow matrix size does not match to the signatures' sizes" ); if( CV_MAT_TYPE( flow->type ) != CV_32FC1 ) - CV_Error( CV_StsUnsupportedFormat, "The flow matrix must be 32fC1" ); + CV_Error( cv::Error::StsUnsupportedFormat, "The flow matrix must be 32fC1" ); } cost->data.fl = 0; @@ -206,28 +206,28 @@ CV_IMPL float cvCalcEMD2( const CvArr* signature_arr1, if( cost_matrix ) { if( dist_func ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "Only one of cost matrix or distance function should be non-NULL in case of user-defined distance" ); if( lower_bound ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "The lower boundary can not be calculated if the cost matrix is used" ); cost = cvGetMat( cost_matrix, &cost_stub ); if( cost->rows != size1 || cost->cols != size2 ) - CV_Error( CV_StsUnmatchedSizes, + CV_Error( cv::Error::StsUnmatchedSizes, "The cost matrix size does not match to the signatures' sizes" ); if( CV_MAT_TYPE( cost->type ) != CV_32FC1 ) - CV_Error( CV_StsUnsupportedFormat, "The cost matrix must be 32fC1" ); + CV_Error( cv::Error::StsUnsupportedFormat, "The cost matrix must be 32fC1" ); } else if( !dist_func ) - CV_Error( CV_StsNullPtr, "In case of user-defined distance Distance function is undefined" ); + CV_Error( cv::Error::StsNullPtr, "In case of user-defined distance Distance function is undefined" ); } else { if( dims == 0 ) - CV_Error( CV_StsBadSize, + CV_Error( cv::Error::StsBadSize, "Number of dimensions can be 0 only if a user-defined metric is used" ); user_param = (void *) (size_t)dims; switch (dist_type) @@ -242,7 +242,7 @@ CV_IMPL float cvCalcEMD2( const CvArr* signature_arr1, dist_func = icvDistC; break; default: - CV_Error( CV_StsBadFlag, "Bad or unsupported metric type" ); + CV_Error( cv::Error::StsBadFlag, "Bad or unsupported metric type" ); } } @@ -279,7 +279,7 @@ CV_IMPL float cvCalcEMD2( const CvArr* signature_arr1, state.ssize, state.dsize, state.enter_x ); if( min_delta == CV_EMD_INF ) - CV_Error( CV_StsNoConv, "" ); + CV_Error( cv::Error::StsNoConv, "" ); /* if no negative deltamin, we found the optimal solution */ if( min_delta >= -eps ) @@ -287,7 +287,7 @@ CV_IMPL float cvCalcEMD2( const CvArr* signature_arr1, /* improve solution */ if(!icvNewSolution( &state )) - CV_Error( CV_StsNoConv, "" ); + CV_Error( cv::Error::StsNoConv, "" ); } } @@ -387,7 +387,7 @@ static int icvInitEMD( const float* signature1, int size1, } else if( weight < 0 ) - CV_Error(CV_StsBadArg, "signature1 must not contain negative weights"); + CV_Error(cv::Error::StsBadArg, "signature1 must not contain negative weights"); } for( i = 0; i < size2; i++ ) @@ -401,13 +401,13 @@ static int icvInitEMD( const float* signature1, int size1, state->idx2[dsize++] = i; } else if( weight < 0 ) - CV_Error(CV_StsBadArg, "signature2 must not contain negative weights"); + CV_Error(cv::Error::StsBadArg, "signature2 must not contain negative weights"); } if( ssize == 0 ) - CV_Error(CV_StsBadArg, "signature1 must contain at least one non-zero value"); + CV_Error(cv::Error::StsBadArg, "signature1 must contain at least one non-zero value"); if( dsize == 0 ) - CV_Error(CV_StsBadArg, "signature2 must contain at least one non-zero value"); + CV_Error(cv::Error::StsBadArg, "signature2 must contain at least one non-zero value"); /* if supply different than the demand, add a zero-cost dummy cluster */ diff = s_sum - d_sum; diff --git a/modules/imgproc/src/filter.simd.hpp b/modules/imgproc/src/filter.simd.hpp index 9306c78a30..21dab519af 100644 --- a/modules/imgproc/src/filter.simd.hpp +++ b/modules/imgproc/src/filter.simd.hpp @@ -3039,7 +3039,7 @@ Ptr getLinearRowFilter( if( sdepth == CV_64F && ddepth == CV_64F ) return makePtr >(kernel, anchor); - CV_Error_( CV_StsNotImplemented, + CV_Error_( cv::Error::StsNotImplemented, ("Unsupported combination of source format (=%d), and buffer format (=%d)", srcType, bufType)); } @@ -3137,7 +3137,7 @@ Ptr getLinearColumnFilter( (kernel, anchor, delta, symmetryType); } - CV_Error_( CV_StsNotImplemented, + CV_Error_( cv::Error::StsNotImplemented, ("Unsupported combination of buffer format (=%d), and destination format (=%d)", bufType, dstType)); } @@ -3291,7 +3291,7 @@ Ptr getLinearFilter( return makePtr, FilterNoVec> >(kernel, anchor, delta); - CV_Error_( CV_StsNotImplemented, + CV_Error_( cv::Error::StsNotImplemented, ("Unsupported combination of source format (=%d), and destination format (=%d)", srcType, dstType)); } diff --git a/modules/imgproc/src/floodfill.cpp b/modules/imgproc/src/floodfill.cpp index 91beca2a99..273f220bb0 100644 --- a/modules/imgproc/src/floodfill.cpp +++ b/modules/imgproc/src/floodfill.cpp @@ -487,12 +487,12 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask, if ( (cn != 1) && (cn != 3) ) { - CV_Error( CV_StsBadArg, "Number of channels in input image must be 1 or 3" ); + CV_Error( cv::Error::StsBadArg, "Number of channels in input image must be 1 or 3" ); } const int connectivity = flags & 255; if( connectivity != 0 && connectivity != 4 && connectivity != 8 ) - CV_Error( CV_StsBadFlag, "Connectivity must be 4, 0(=4) or 8" ); + CV_Error( cv::Error::StsBadFlag, "Connectivity must be 4, 0(=4) or 8" ); if( _mask.empty() ) { @@ -513,13 +513,13 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask, for( i = 0; i < cn; i++ ) { if( loDiff[i] < 0 || upDiff[i] < 0 ) - CV_Error( CV_StsBadArg, "lo_diff and up_diff must be non-negative" ); + CV_Error( cv::Error::StsBadArg, "lo_diff and up_diff must be non-negative" ); is_simple = is_simple && fabs(loDiff[i]) < DBL_EPSILON && fabs(upDiff[i]) < DBL_EPSILON; } if( (unsigned)seedPoint.x >= (unsigned)size.width || (unsigned)seedPoint.y >= (unsigned)size.height ) - CV_Error( CV_StsOutOfRange, "Seed point is outside of image" ); + CV_Error( cv::Error::StsOutOfRange, "Seed point is outside of image" ); scalarToRawData( newVal, &nv_buf, type, 0); size_t buffer_size = MAX( size.width, size.height ) * 2; @@ -550,7 +550,7 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask, else if( type == CV_32FC3 ) floodFill_CnIR(img, seedPoint, Vec3f(nv_buf.f), &comp, flags, &buffer); else - CV_Error( CV_StsUnsupportedFormat, "" ); + CV_Error( cv::Error::StsUnsupportedFormat, "" ); if( rect ) *rect = comp.rect; return comp.area; @@ -583,7 +583,7 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask, ud_buf.f[i] = (float)upDiff[i]; } else - CV_Error( CV_StsUnsupportedFormat, "" ); + CV_Error( cv::Error::StsUnsupportedFormat, "" ); uchar newMaskVal = (uchar)((flags & 0xff00) == 0 ? 1 : ((flags >> 8) & 255)); @@ -618,7 +618,7 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask, Diff32fC3(ld_buf.f, ud_buf.f), &comp, flags, &buffer); else - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(cv::Error::StsUnsupportedFormat, ""); if( rect ) *rect = comp.rect; diff --git a/modules/imgproc/src/geometry.cpp b/modules/imgproc/src/geometry.cpp index 77d3d16e02..ae14590f22 100644 --- a/modules/imgproc/src/geometry.cpp +++ b/modules/imgproc/src/geometry.cpp @@ -87,7 +87,7 @@ CV_IMPL void cvBoxPoints( CvBox2D box, CvPoint2D32f pt[4] ) { if( !pt ) - CV_Error( CV_StsNullPtr, "NULL vertex array pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL vertex array pointer" ); cv::RotatedRect(box).points((cv::Point2f*)pt); } diff --git a/modules/imgproc/src/grabcut.cpp b/modules/imgproc/src/grabcut.cpp index 5ec5af2be4..695c0dd6c5 100644 --- a/modules/imgproc/src/grabcut.cpp +++ b/modules/imgproc/src/grabcut.cpp @@ -96,7 +96,7 @@ GMM::GMM( Mat& _model ) _model.setTo(Scalar(0)); } else if( (_model.type() != CV_64FC1) || (_model.rows != 1) || (_model.cols != modelSize*componentsCount) ) - CV_Error( CV_StsBadArg, "_model must have CV_64FC1 type, rows == 1 and cols == 13*componentsCount" ); + CV_Error( cv::Error::StsBadArg, "_model must have CV_64FC1 type, rows == 1 and cols == 13*componentsCount" ); model = _model; @@ -329,18 +329,18 @@ static void calcNWeights( const Mat& img, Mat& leftW, Mat& upleftW, Mat& upW, Ma static void checkMask( const Mat& img, const Mat& mask ) { if( mask.empty() ) - CV_Error( CV_StsBadArg, "mask is empty" ); + CV_Error( cv::Error::StsBadArg, "mask is empty" ); if( mask.type() != CV_8UC1 ) - CV_Error( CV_StsBadArg, "mask must have CV_8UC1 type" ); + CV_Error( cv::Error::StsBadArg, "mask must have CV_8UC1 type" ); if( mask.cols != img.cols || mask.rows != img.rows ) - CV_Error( CV_StsBadArg, "mask must have as many rows and cols as img" ); + CV_Error( cv::Error::StsBadArg, "mask must have as many rows and cols as img" ); for( int y = 0; y < mask.rows; y++ ) { for( int x = 0; x < mask.cols; x++ ) { uchar val = mask.at(y,x); if( val!=GC_BGD && val!=GC_FGD && val!=GC_PR_BGD && val!=GC_PR_FGD ) - CV_Error( CV_StsBadArg, "mask element value must be equal " + CV_Error( cv::Error::StsBadArg, "mask element value must be equal " "GC_BGD or GC_FGD or GC_PR_BGD or GC_PR_FGD" ); } } @@ -552,9 +552,9 @@ void cv::grabCut( InputArray _img, InputOutputArray _mask, Rect rect, Mat& fgdModel = _fgdModel.getMatRef(); if( img.empty() ) - CV_Error( CV_StsBadArg, "image is empty" ); + CV_Error( cv::Error::StsBadArg, "image is empty" ); if( img.type() != CV_8UC3 ) - CV_Error( CV_StsBadArg, "image must have CV_8UC3 type" ); + CV_Error( cv::Error::StsBadArg, "image must have CV_8UC3 type" ); GMM bgdGMM( bgdModel ), fgdGMM( fgdModel ); Mat compIdxs( img.size(), CV_32SC1 ); diff --git a/modules/imgproc/src/histogram.cpp b/modules/imgproc/src/histogram.cpp index 499dd6e983..99d5e7b1d8 100644 --- a/modules/imgproc/src/histogram.cpp +++ b/modules/imgproc/src/histogram.cpp @@ -1005,7 +1005,7 @@ void cv::calcHist( const Mat* images, int nimages, const int* channels, else if( depth == CV_32F ) calcHist_(ptrs, deltas, imsize, ihist, dims, ranges, _uniranges, uniform ); else - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(cv::Error::StsUnsupportedFormat, ""); ihist.convertTo(hist, CV_32F); } @@ -1182,7 +1182,7 @@ static void calcHist( const Mat* images, int nimages, const int* channels, else if( depth == CV_32F ) calcSparseHist_(ptrs, deltas, imsize, hist, dims, ranges, _uniranges, uniform ); else - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(cv::Error::StsUnsupportedFormat, ""); if( !keepInt ) { @@ -1637,7 +1637,7 @@ void cv::calcBackProject( const Mat* images, int nimages, const int* channels, else if( depth == CV_32F ) calcBackProj_(ptrs, deltas, imsize, hist, dims, ranges, _uniranges, (float)scale, uniform ); else - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(cv::Error::StsUnsupportedFormat, ""); } @@ -1810,7 +1810,7 @@ void cv::calcBackProject( const Mat* images, int nimages, const int* channels, calcSparseBackProj_(ptrs, deltas, imsize, hist, dims, ranges, _uniranges, (float)scale, uniform ); else - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(cv::Error::StsUnsupportedFormat, ""); } #ifdef HAVE_OPENCL @@ -2211,7 +2211,7 @@ double cv::compareHist( InputArray _H1, InputArray _H2, int method ) } } else - CV_Error( CV_StsBadArg, "Unknown comparison method" ); + CV_Error( cv::Error::StsBadArg, "Unknown comparison method" ); } if( method == CV_COMP_CHISQR_ALT ) @@ -2350,7 +2350,7 @@ double cv::compareHist( const SparseMat& H1, const SparseMat& H2, int method ) } } else - CV_Error( CV_StsBadArg, "Unknown comparison method" ); + CV_Error( cv::Error::StsBadArg, "Unknown comparison method" ); if( method == CV_COMP_CHISQR_ALT ) result *= 2; @@ -2387,7 +2387,7 @@ cvCreateHist( int dims, int *sizes, CvHistType type, float** ranges, int uniform else if( type == CV_HIST_SPARSE ) hist->bins = cvCreateSparseMat( dims, sizes, CV_HIST_DEFAULT_TYPE ); else - CV_Error( CV_StsBadArg, "Invalid histogram type" ); + CV_Error( cv::Error::StsBadArg, "Invalid histogram type" ); if( ranges ) cvSetHistBinRanges( hist, ranges, uniform ); @@ -2402,10 +2402,10 @@ cvMakeHistHeaderForArray( int dims, int *sizes, CvHistogram *hist, float *data, float **ranges, int uniform ) { if( !hist ) - CV_Error( CV_StsNullPtr, "Null histogram header pointer" ); + CV_Error( cv::Error::StsNullPtr, "Null histogram header pointer" ); if( !data ) - CV_Error( CV_StsNullPtr, "Null data pointer" ); + CV_Error( cv::Error::StsNullPtr, "Null data pointer" ); hist->thresh2 = 0; hist->type = CV_HIST_MAGIC_VAL; @@ -2414,7 +2414,7 @@ cvMakeHistHeaderForArray( int dims, int *sizes, CvHistogram *hist, if( ranges ) { if( !uniform ) - CV_Error( CV_StsBadArg, "Only uniform bin ranges can be used here " + CV_Error( cv::Error::StsBadArg, "Only uniform bin ranges can be used here " "(to avoid memory allocation)" ); cvSetHistBinRanges( hist, ranges, uniform ); } @@ -2427,14 +2427,14 @@ CV_IMPL void cvReleaseHist( CvHistogram **hist ) { if( !hist ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( *hist ) { CvHistogram* temp = *hist; if( !CV_IS_HIST(temp)) - CV_Error( CV_StsBadArg, "Invalid histogram header" ); + CV_Error( cv::Error::StsBadArg, "Invalid histogram header" ); *hist = 0; if( CV_IS_SPARSE_HIST( temp )) @@ -2455,7 +2455,7 @@ CV_IMPL void cvClearHist( CvHistogram *hist ) { if( !CV_IS_HIST(hist) ) - CV_Error( CV_StsBadArg, "Invalid histogram header" ); + CV_Error( cv::Error::StsBadArg, "Invalid histogram header" ); cvZero( hist->bins ); } @@ -2465,7 +2465,7 @@ CV_IMPL void cvThreshHist( CvHistogram* hist, double thresh ) { if( !CV_IS_HIST(hist) ) - CV_Error( CV_StsBadArg, "Invalid histogram header" ); + CV_Error( cv::Error::StsBadArg, "Invalid histogram header" ); if( !CV_IS_SPARSE_MAT(hist->bins) ) { @@ -2497,7 +2497,7 @@ cvNormalizeHist( CvHistogram* hist, double factor ) double sum = 0; if( !CV_IS_HIST(hist) ) - CV_Error( CV_StsBadArg, "Invalid histogram header" ); + CV_Error( cv::Error::StsBadArg, "Invalid histogram header" ); if( !CV_IS_SPARSE_HIST(hist) ) { @@ -2544,7 +2544,7 @@ cvGetMinMaxHistValue( const CvHistogram* hist, int dims, size[CV_MAX_DIM]; if( !CV_IS_HIST(hist) ) - CV_Error( CV_StsBadArg, "Invalid histogram header" ); + CV_Error( cv::Error::StsBadArg, "Invalid histogram header" ); dims = cvGetDims( hist->bins, size ); @@ -2662,10 +2662,10 @@ cvCompareHist( const CvHistogram* hist1, int size1[CV_MAX_DIM], size2[CV_MAX_DIM], total = 1; if( !CV_IS_HIST(hist1) || !CV_IS_HIST(hist2) ) - CV_Error( CV_StsBadArg, "Invalid histogram header[s]" ); + CV_Error( cv::Error::StsBadArg, "Invalid histogram header[s]" ); if( CV_IS_SPARSE_MAT(hist1->bins) != CV_IS_SPARSE_MAT(hist2->bins)) - CV_Error(CV_StsUnmatchedFormats, "One of histograms is sparse and other is not"); + CV_Error(cv::Error::StsUnmatchedFormats, "One of histograms is sparse and other is not"); if( !CV_IS_SPARSE_MAT(hist1->bins) ) { @@ -2678,13 +2678,13 @@ cvCompareHist( const CvHistogram* hist1, int dims2 = cvGetDims( hist2->bins, size2 ); if( dims1 != dims2 ) - CV_Error( CV_StsUnmatchedSizes, + CV_Error( cv::Error::StsUnmatchedSizes, "The histograms have different numbers of dimensions" ); for( i = 0; i < dims1; i++ ) { if( size1[i] != size2[i] ) - CV_Error( CV_StsUnmatchedSizes, "The histograms have different sizes" ); + CV_Error( cv::Error::StsUnmatchedSizes, "The histograms have different sizes" ); total *= size1[i]; } @@ -2804,7 +2804,7 @@ cvCompareHist( const CvHistogram* hist1, result = cv::compareHist( sH1, sH2, CV_COMP_KL_DIV ); } else - CV_Error( CV_StsBadArg, "Unknown comparison method" ); + CV_Error( cv::Error::StsBadArg, "Unknown comparison method" ); if( method == CV_COMP_CHISQR_ALT ) result *= 2; @@ -2817,12 +2817,12 @@ CV_IMPL void cvCopyHist( const CvHistogram* src, CvHistogram** _dst ) { if( !_dst ) - CV_Error( CV_StsNullPtr, "Destination double pointer is NULL" ); + CV_Error( cv::Error::StsNullPtr, "Destination double pointer is NULL" ); CvHistogram* dst = *_dst; if( !CV_IS_HIST(src) || (dst && !CV_IS_HIST(dst)) ) - CV_Error( CV_StsBadArg, "Invalid histogram header[s]" ); + CV_Error( cv::Error::StsBadArg, "Invalid histogram header[s]" ); bool eq = false; int size1[CV_MAX_DIM]; @@ -2887,10 +2887,10 @@ cvSetHistBinRanges( CvHistogram* hist, float** ranges, int uniform ) int i, j; if( !ranges ) - CV_Error( CV_StsNullPtr, "NULL ranges pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL ranges pointer" ); if( !CV_IS_HIST(hist) ) - CV_Error( CV_StsBadArg, "Invalid histogram header" ); + CV_Error( cv::Error::StsBadArg, "Invalid histogram header" ); dims = cvGetDims( hist->bins, size ); for( i = 0; i < dims; i++ ) @@ -2901,7 +2901,7 @@ cvSetHistBinRanges( CvHistogram* hist, float** ranges, int uniform ) for( i = 0; i < dims; i++ ) { if( !ranges[i] ) - CV_Error( CV_StsNullPtr, "One of elements is NULL" ); + CV_Error( cv::Error::StsNullPtr, "One of elements is NULL" ); hist->thresh[i][0] = ranges[i][0]; hist->thresh[i][1] = ranges[i][1]; } @@ -2925,13 +2925,13 @@ cvSetHistBinRanges( CvHistogram* hist, float** ranges, int uniform ) float val0 = -FLT_MAX; if( !ranges[i] ) - CV_Error( CV_StsNullPtr, "One of elements is NULL" ); + CV_Error( cv::Error::StsNullPtr, "One of elements is NULL" ); for( j = 0; j <= size[i]; j++ ) { float val = ranges[i][j]; if( val <= val0 ) - CV_Error(CV_StsOutOfRange, "Bin ranges should go in ascenting order"); + CV_Error(cv::Error::StsOutOfRange, "Bin ranges should go in ascenting order"); val0 = dim_ranges[j] = val; } @@ -2949,10 +2949,10 @@ CV_IMPL void cvCalcArrHist( CvArr** img, CvHistogram* hist, int accumulate, const CvArr* mask ) { if( !CV_IS_HIST(hist)) - CV_Error( CV_StsBadArg, "Bad histogram pointer" ); + CV_Error( cv::Error::StsBadArg, "Bad histogram pointer" ); if( !img ) - CV_Error( CV_StsNullPtr, "Null double array pointer" ); + CV_Error( cv::Error::StsNullPtr, "Null double array pointer" ); int size[CV_MAX_DIM]; int i, dims = cvGetDims( hist->bins, size); @@ -3015,10 +3015,10 @@ CV_IMPL void cvCalcArrBackProject( CvArr** img, CvArr* dst, const CvHistogram* hist ) { if( !CV_IS_HIST(hist)) - CV_Error( CV_StsBadArg, "Bad histogram pointer" ); + CV_Error( cv::Error::StsBadArg, "Bad histogram pointer" ); if( !img ) - CV_Error( CV_StsNullPtr, "Null double array pointer" ); + CV_Error( cv::Error::StsNullPtr, "Null double array pointer" ); int size[CV_MAX_DIM]; int i, dims = cvGetDims( hist->bins, size ); @@ -3078,21 +3078,21 @@ cvCalcArrBackProjectPatch( CvArr** arr, CvArr* dst, CvSize patch_size, CvHistogr cv::Size size; if( !CV_IS_HIST(hist)) - CV_Error( CV_StsBadArg, "Bad histogram pointer" ); + CV_Error( cv::Error::StsBadArg, "Bad histogram pointer" ); if( !arr ) - CV_Error( CV_StsNullPtr, "Null double array pointer" ); + CV_Error( cv::Error::StsNullPtr, "Null double array pointer" ); if( norm_factor <= 0 ) - CV_Error( CV_StsOutOfRange, + CV_Error( cv::Error::StsOutOfRange, "Bad normalization factor (set it to 1.0 if unsure)" ); if( patch_size.width <= 0 || patch_size.height <= 0 ) - CV_Error( CV_StsBadSize, "The patch width and height must be positive" ); + CV_Error( cv::Error::StsBadSize, "The patch width and height must be positive" ); dims = cvGetDims( hist->bins ); if (dims < 1) - CV_Error( CV_StsOutOfRange, "Invalid number of dimensions"); + CV_Error( cv::Error::StsOutOfRange, "Invalid number of dimensions"); cvNormalizeHist( hist, norm_factor ); for( i = 0; i < dims; i++ ) @@ -3105,11 +3105,11 @@ cvCalcArrBackProjectPatch( CvArr** arr, CvArr* dst, CvSize patch_size, CvHistogr dstmat = cvGetMat( dst, &dststub, 0, 0 ); if( CV_MAT_TYPE( dstmat->type ) != CV_32FC1 ) - CV_Error( CV_StsUnsupportedFormat, "Resultant image must have 32fC1 type" ); + CV_Error( cv::Error::StsUnsupportedFormat, "Resultant image must have 32fC1 type" ); if( dstmat->cols != img[0]->width - patch_size.width + 1 || dstmat->rows != img[0]->height - patch_size.height + 1 ) - CV_Error( CV_StsUnmatchedSizes, + CV_Error( cv::Error::StsUnmatchedSizes, "The output map must be (W-w+1 x H-h+1), " "where the input images are (W x H) each and the patch is (w x h)" ); @@ -3146,18 +3146,18 @@ cvCalcBayesianProb( CvHistogram** src, int count, CvHistogram** dst ) int i; if( !src || !dst ) - CV_Error( CV_StsNullPtr, "NULL histogram array pointer" ); + CV_Error( cv::Error::StsNullPtr, "NULL histogram array pointer" ); if( count < 2 ) - CV_Error( CV_StsOutOfRange, "Too small number of histograms" ); + CV_Error( cv::Error::StsOutOfRange, "Too small number of histograms" ); for( i = 0; i < count; i++ ) { if( !CV_IS_HIST(src[i]) || !CV_IS_HIST(dst[i]) ) - CV_Error( CV_StsBadArg, "Invalid histogram header" ); + CV_Error( cv::Error::StsBadArg, "Invalid histogram header" ); if( !CV_IS_MATND(src[i]->bins) || !CV_IS_MATND(dst[i]->bins) ) - CV_Error( CV_StsBadArg, "The function supports dense histograms only" ); + CV_Error( cv::Error::StsBadArg, "The function supports dense histograms only" ); } cvZero( dst[0]->bins ); @@ -3178,10 +3178,10 @@ cvCalcProbDensity( const CvHistogram* hist, const CvHistogram* hist_mask, CvHistogram* hist_dens, double scale ) { if( scale <= 0 ) - CV_Error( CV_StsOutOfRange, "scale must be positive" ); + CV_Error( cv::Error::StsOutOfRange, "scale must be positive" ); if( !CV_IS_HIST(hist) || !CV_IS_HIST(hist_mask) || !CV_IS_HIST(hist_dens) ) - CV_Error( CV_StsBadArg, "Invalid histogram pointer[s]" ); + CV_Error( cv::Error::StsBadArg, "Invalid histogram pointer[s]" ); { CvArr* arrs[] = { hist->bins, hist_mask->bins, hist_dens->bins }; @@ -3191,7 +3191,7 @@ cvCalcProbDensity( const CvHistogram* hist, const CvHistogram* hist_mask, cvInitNArrayIterator( 3, arrs, 0, stubs, &iterator ); if( CV_MAT_TYPE(iterator.hdr[0]->type) != CV_32FC1 ) - CV_Error( CV_StsUnsupportedFormat, "All histograms must have 32fC1 type" ); + CV_Error( cv::Error::StsUnsupportedFormat, "All histograms must have 32fC1 type" ); do { @@ -3533,7 +3533,7 @@ static void *icvReadHist( CvFileStorage * fs, CvFileNode * node ) int i, sizes[CV_MAX_DIM]; if(!CV_IS_MATND(mat)) - CV_Error( CV_StsError, "Expected CvMatND"); + CV_Error( cv::Error::StsError, "Expected CvMatND"); for(i=0; idims; i++) sizes[i] = mat->dim[i].size; @@ -3554,7 +3554,7 @@ static void *icvReadHist( CvFileStorage * fs, CvFileNode * node ) { h->bins = cvReadByName( fs, node, "bins" ); if(!CV_IS_SPARSE_MAT(h->bins)){ - CV_Error( CV_StsError, "Unknown Histogram type"); + CV_Error( cv::Error::StsError, "Unknown Histogram type"); } } @@ -3571,7 +3571,7 @@ static void *icvReadHist( CvFileStorage * fs, CvFileNode * node ) thresh_node = cvGetFileNodeByName( fs, node, "thresh" ); if(!thresh_node) - CV_Error( CV_StsError, "'thresh' node is missing"); + CV_Error( cv::Error::StsError, "'thresh' node is missing"); cvStartReadRawData( fs, thresh_node, &reader ); if(is_uniform) diff --git a/modules/imgproc/src/hough.cpp b/modules/imgproc/src/hough.cpp index 9961e9aace..523e4491c5 100644 --- a/modules/imgproc/src/hough.cpp +++ b/modules/imgproc/src/hough.cpp @@ -2396,11 +2396,11 @@ cvHoughLines2( CvArr* src_image, void* lineStorage, int method, mat = (CvMat*)lineStorage; if( !CV_IS_MAT_CONT( mat->type ) || (mat->rows != 1 && mat->cols != 1) ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "The destination matrix should be continuous and have a single row or a single column" ); if( CV_MAT_TYPE( mat->type ) != lineType ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "The destination matrix data type is inappropriate, see the manual" ); lines = cvMakeSeqHeaderForArray( lineType, sizeof(CvSeq), elemSize, mat->data.ptr, @@ -2427,7 +2427,7 @@ cvHoughLines2( CvArr* src_image, void* lineStorage, int method, threshold, iparam1, iparam2, l4, linesMax ); break; default: - CV_Error( CV_StsBadArg, "Unrecognized method id" ); + CV_Error( cv::Error::StsBadArg, "Unrecognized method id" ); } int nlines = (int)(l2.size() + l4.size()); @@ -2473,7 +2473,7 @@ cvHoughCircles( CvArr* src_image, void* circle_storage, cv::Mat src = cv::cvarrToMat(src_image), circles_mat; if( !circle_storage ) - CV_Error( CV_StsNullPtr, "NULL destination" ); + CV_Error( cv::Error::StsNullPtr, "NULL destination" ); bool isStorage = isStorageOrMat(circle_storage); @@ -2490,7 +2490,7 @@ cvHoughCircles( CvArr* src_image, void* circle_storage, if( !CV_IS_MAT_CONT( mat->type ) || (mat->rows != 1 && mat->cols != 1) || CV_MAT_TYPE(mat->type) != CV_32FC3 ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "The destination matrix should be continuous and have a single row or a single column" ); circles = cvMakeSeqHeaderForArray( CV_32FC3, sizeof(CvSeq), sizeof(float)*3, diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp index 7a9ed3033e..7c4567218b 100644 --- a/modules/imgproc/src/imgwarp.cpp +++ b/modules/imgproc/src/imgwarp.cpp @@ -206,7 +206,7 @@ static void initInterTab1D(int method, float* tab, int tabsz) interpolateLanczos4( i*scale, tab ); } else - CV_Error( CV_StsBadArg, "Unknown interpolation method" ); + CV_Error( cv::Error::StsBadArg, "Unknown interpolation method" ); } @@ -223,7 +223,7 @@ static const void* initInterTab2D( int method, bool fixpt ) else if( method == INTER_LANCZOS4 ) tab = Lanczos4Tab_f[0][0], itab = Lanczos4Tab_i[0][0], ksize=8; else - CV_Error( CV_StsBadArg, "Unknown/unsupported interpolation type" ); + CV_Error( cv::Error::StsBadArg, "Unknown/unsupported interpolation type" ); if( !inittab[method] ) { @@ -1502,7 +1502,7 @@ static bool ocl_logPolar(InputArray _src, OutputArray _dst, Point2f center, double M, int flags) { if (M <= 0) - CV_Error(CV_StsOutOfRange, "M should be >0"); + CV_Error(cv::Error::StsOutOfRange, "M should be >0"); UMat src_with_border; // don't scope this variable (it holds image data) UMat mapx, mapy, r, cp_sp; @@ -1649,12 +1649,12 @@ static bool openvx_remap(Mat src, Mat dst, Mat map1, Mat map2, int interpolation } catch (const ivx::RuntimeError & e) { - CV_Error(CV_StsInternal, e.what()); + CV_Error(cv::Error::StsInternal, e.what()); return false; } catch (const ivx::WrapperError & e) { - CV_Error(CV_StsInternal, e.what()); + CV_Error(cv::Error::StsInternal, e.what()); return false; } return true; @@ -1888,7 +1888,7 @@ void cv::remap( InputArray _src, OutputArray _dst, CV_Assert( _src.channels() <= 4 ); } else - CV_Error( CV_StsBadArg, "Unknown interpolation method" ); + CV_Error( cv::Error::StsBadArg, "Unknown interpolation method" ); CV_Assert( ifunc != 0 ); ctab = initInterTab2D( interpolation, fixpt ); } @@ -2236,7 +2236,7 @@ void cv::convertMaps( InputArray _map1, InputArray _map2, } } else - CV_Error( CV_StsNotImplemented, "Unsupported combination of input/output matrices" ); + CV_Error( cv::Error::StsNotImplemented, "Unsupported combination of input/output matrices" ); } } @@ -3610,7 +3610,7 @@ void cv::invertAffineTransform(InputArray _matM, OutputArray __iM) iM[istep] = A21; iM[istep+1] = A22; iM[istep+2] = b2; } else - CV_Error( CV_StsUnsupportedFormat, "" ); + CV_Error( cv::Error::StsUnsupportedFormat, "" ); } cv::Mat cv::getPerspectiveTransform(InputArray _src, InputArray _dst, int solveMethod) diff --git a/modules/imgproc/src/linefit.cpp b/modules/imgproc/src/linefit.cpp index cd205c60ab..67a3affccd 100644 --- a/modules/imgproc/src/linefit.cpp +++ b/modules/imgproc/src/linefit.cpp @@ -358,7 +358,7 @@ static void fitLine2D( const Point2f * points, int count, int dist, calc_weights = (void ( * )(float *, int, float *)) _PFP.fp; break;*/ default: - CV_Error(CV_StsBadArg, "Unknown distance type"); + CV_Error(cv::Error::StsBadArg, "Unknown distance type"); } AutoBuffer wr(count*2); @@ -499,7 +499,7 @@ static void fitLine3D( Point3f * points, int count, int dist, break; default: - CV_Error(CV_StsBadArg, "Unknown distance"); + CV_Error(cv::Error::StsBadArg, "Unknown distance"); } AutoBuffer buf(count*2); diff --git a/modules/imgproc/src/matchcontours.cpp b/modules/imgproc/src/matchcontours.cpp index e676bf9804..f278ddd366 100644 --- a/modules/imgproc/src/matchcontours.cpp +++ b/modules/imgproc/src/matchcontours.cpp @@ -158,7 +158,7 @@ double cv::matchShapes(InputArray contour1, InputArray contour2, int method, dou } break; default: - CV_Error( CV_StsBadArg, "Unknown comparison method" ); + CV_Error( cv::Error::StsBadArg, "Unknown comparison method" ); } //If anyA and anyB are both true, the result is correct. diff --git a/modules/imgproc/src/median_blur.simd.hpp b/modules/imgproc/src/median_blur.simd.hpp index 1fe2e4060c..1069d8abab 100644 --- a/modules/imgproc/src/median_blur.simd.hpp +++ b/modules/imgproc/src/median_blur.simd.hpp @@ -867,7 +867,7 @@ void medianBlur(const Mat& src0, /*const*/ Mat& dst, int ksize) else if( src.depth() == CV_32F ) medianBlur_SortNet( src, dst, ksize ); else - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(cv::Error::StsUnsupportedFormat, ""); return; } diff --git a/modules/imgproc/src/moments.cpp b/modules/imgproc/src/moments.cpp index 523ea586d4..b2320258b1 100644 --- a/modules/imgproc/src/moments.cpp +++ b/modules/imgproc/src/moments.cpp @@ -584,7 +584,7 @@ cv::Moments cv::moments( InputArray _src, bool binary ) return contourMoments(mat); if( cn > 1 ) - CV_Error( CV_StsBadArg, "Invalid image type (must be single-channel)" ); + CV_Error( cv::Error::StsBadArg, "Invalid image type (must be single-channel)" ); CV_IPP_RUN(!binary, ipp_moments(mat, m), m); @@ -599,7 +599,7 @@ cv::Moments cv::moments( InputArray _src, bool binary ) else if( depth == CV_64F ) func = momentsInTile; else - CV_Error( CV_StsUnsupportedFormat, "" ); + CV_Error( cv::Error::StsUnsupportedFormat, "" ); Mat src0(mat); @@ -730,9 +730,9 @@ CV_IMPL double cvGetSpatialMoment( CvMoments * moments, int x_order, int y_order int order = x_order + y_order; if( !moments ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( (x_order | y_order) < 0 || order > 3 ) - CV_Error( CV_StsOutOfRange, "" ); + CV_Error( cv::Error::StsOutOfRange, "" ); return (&(moments->m00))[order + (order >> 1) + (order > 2) * 2 + y_order]; } @@ -743,9 +743,9 @@ CV_IMPL double cvGetCentralMoment( CvMoments * moments, int x_order, int y_order int order = x_order + y_order; if( !moments ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( (x_order | y_order) < 0 || order > 3 ) - CV_Error( CV_StsOutOfRange, "" ); + CV_Error( cv::Error::StsOutOfRange, "" ); return order >= 2 ? (&(moments->m00))[4 + order * 3 + y_order] : order == 0 ? moments->m00 : 0; @@ -768,7 +768,7 @@ CV_IMPL double cvGetNormalizedCentralMoment( CvMoments * moments, int x_order, i CV_IMPL void cvGetHuMoments( CvMoments * mState, CvHuMoments * HuState ) { if( !mState || !HuState ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); double m00s = mState->inv_sqrt_m00, m00 = m00s * m00s, s2 = m00 * m00, s3 = s2 * m00s; diff --git a/modules/imgproc/src/morph.dispatch.cpp b/modules/imgproc/src/morph.dispatch.cpp index a0857d1266..0cb50ec368 100644 --- a/modules/imgproc/src/morph.dispatch.cpp +++ b/modules/imgproc/src/morph.dispatch.cpp @@ -1076,7 +1076,7 @@ static bool ocl_morphologyEx(InputArray _src, OutputArray _dst, int op, return false; break; default: - CV_Error( CV_StsBadArg, "unknown morphological operation" ); + CV_Error( cv::Error::StsBadArg, "unknown morphological operation" ); } return true; @@ -1249,7 +1249,7 @@ void morphologyEx( InputArray _src, OutputArray _dst, int op, } break; default: - CV_Error( CV_StsBadArg, "unknown morphological operation" ); + CV_Error( cv::Error::StsBadArg, "unknown morphological operation" ); } } @@ -1296,7 +1296,7 @@ CV_IMPL void cvReleaseStructuringElement( IplConvKernel ** element ) { if( !element ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); cvFree( element ); } diff --git a/modules/imgproc/src/morph.simd.hpp b/modules/imgproc/src/morph.simd.hpp index ef813dccec..e93f829daa 100644 --- a/modules/imgproc/src/morph.simd.hpp +++ b/modules/imgproc/src/morph.simd.hpp @@ -753,7 +753,7 @@ Ptr getMorphologyRowFilter(int op, int type, int ksize, int ancho DilateRowVec64f> >(ksize, anchor); } - CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type)); + CV_Error_( cv::Error::StsNotImplemented, ("Unsupported data type (=%d)", type)); } Ptr getMorphologyColumnFilter(int op, int type, int ksize, int anchor) @@ -801,7 +801,7 @@ Ptr getMorphologyColumnFilter(int op, int type, int ksize, int DilateColumnVec64f> >(ksize, anchor); } - CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type)); + CV_Error_( cv::Error::StsNotImplemented, ("Unsupported data type (=%d)", type)); } Ptr getMorphologyFilter(int op, int type, const Mat& kernel, Point anchor) @@ -838,7 +838,7 @@ Ptr getMorphologyFilter(int op, int type, const Mat& kernel, Point a return makePtr, DilateVec64f> >(kernel, anchor); } - CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type)); + CV_Error_( cv::Error::StsNotImplemented, ("Unsupported data type (=%d)", type)); } #endif diff --git a/modules/imgproc/src/precomp.hpp b/modules/imgproc/src/precomp.hpp index a72d2a4d2a..29dbce6d5f 100644 --- a/modules/imgproc/src/precomp.hpp +++ b/modules/imgproc/src/precomp.hpp @@ -112,7 +112,7 @@ inline bool isStorageOrMat(void * arr) return true; else if (CV_IS_MAT( arr )) return false; - CV_Error( CV_StsBadArg, "Destination is not CvMemStorage* nor CvMat*" ); + CV_Error( cv::Error::StsBadArg, "Destination is not CvMemStorage* nor CvMat*" ); } diff --git a/modules/imgproc/src/pyramids.cpp b/modules/imgproc/src/pyramids.cpp index 52f957348d..64667a5f97 100644 --- a/modules/imgproc/src/pyramids.cpp +++ b/modules/imgproc/src/pyramids.cpp @@ -1448,7 +1448,7 @@ void cv::pyrDown( InputArray _src, OutputArray _dst, const Size& _dsz, int borde else if( depth == CV_64F ) func = pyrDown_< FltCast >; else - CV_Error( CV_StsUnsupportedFormat, "" ); + CV_Error( cv::Error::StsUnsupportedFormat, "" ); func( src, dst, borderType ); } @@ -1551,7 +1551,7 @@ void cv::pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz, int borderT else if( depth == CV_64F ) func = pyrUp_< FltCast >; else - CV_Error( CV_StsUnsupportedFormat, "" ); + CV_Error( cv::Error::StsUnsupportedFormat, "" ); func( src, dst, borderType ); } @@ -1722,7 +1722,7 @@ CV_IMPL void cvReleasePyramid( CvMat*** _pyramid, int extra_layers ) { if( !_pyramid ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); if( *_pyramid ) for( int i = 0; i <= extra_layers; i++ ) @@ -1743,7 +1743,7 @@ cvCreatePyramid( const CvArr* srcarr, int extra_layers, double rate, CvMat stub, *src = cvGetMat( srcarr, &stub ); if( extra_layers < 0 ) - CV_Error( CV_StsOutOfRange, "The number of extra layers must be non negative" ); + CV_Error( cv::Error::StsOutOfRange, "The number of extra layers must be non negative" ); int i, layer_step, elem_size = CV_ELEM_SIZE(src->type); cv::Size layer_size, size = cvGetMatSize(src); @@ -1770,7 +1770,7 @@ cvCreatePyramid( const CvArr* srcarr, int extra_layers, double rate, } if( bufsize < 0 ) - CV_Error( CV_StsOutOfRange, "The buffer is too small to fit the pyramid" ); + CV_Error( cv::Error::StsOutOfRange, "The buffer is too small to fit the pyramid" ); ptr = buf->data.ptr; } diff --git a/modules/imgproc/src/resize.cpp b/modules/imgproc/src/resize.cpp index 0943e97ead..7e45f1e0f4 100644 --- a/modules/imgproc/src/resize.cpp +++ b/modules/imgproc/src/resize.cpp @@ -4024,7 +4024,7 @@ void resize(int src_type, else if( interpolation == INTER_LINEAR || interpolation == INTER_AREA ) ksize = 2, func = linear_tab[depth]; else - CV_Error( CV_StsBadArg, "Unknown interpolation method" ); + CV_Error( cv::Error::StsBadArg, "Unknown interpolation method" ); ksize2 = ksize/2; CV_Assert( func != 0 ); diff --git a/modules/imgproc/src/rotcalipers.cpp b/modules/imgproc/src/rotcalipers.cpp index e3d81c7e0c..3bec592c9b 100644 --- a/modules/imgproc/src/rotcalipers.cpp +++ b/modules/imgproc/src/rotcalipers.cpp @@ -245,7 +245,7 @@ static void rotatingCalipers( const Point2f* points, int n, int mode, float* out base_b = lead_x; break; default: - CV_Error(CV_StsError, "main_element should be 0, 1, 2 or 3"); + CV_Error(cv::Error::StsError, "main_element should be 0, 1, 2 or 3"); } } /* change base point of main edge */ diff --git a/modules/imgproc/src/samplers.cpp b/modules/imgproc/src/samplers.cpp index 287e78c6df..5fb30c9434 100644 --- a/modules/imgproc/src/samplers.cpp +++ b/modules/imgproc/src/samplers.cpp @@ -417,7 +417,7 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center, getRectSubPix_Cn_, nop > (image.ptr(), image.step, image.size(), patch.ptr(), patch.step, patch.size(), center, cn); else - CV_Error( CV_StsUnsupportedFormat, "Unsupported combination of input and output formats"); + CV_Error( cv::Error::StsUnsupportedFormat, "Unsupported combination of input and output formats"); } @@ -473,7 +473,7 @@ cvSampleLine( const void* _img, CvPoint pt1, CvPoint pt2, size_t pixsize = img.elemSize(); if( !buffer ) - CV_Error( CV_StsNullPtr, "" ); + CV_Error( cv::Error::StsNullPtr, "" ); for( int i = 0; i < li.count; i++, ++li ) { diff --git a/modules/imgproc/src/segmentation.cpp b/modules/imgproc/src/segmentation.cpp index f4145c6cfa..0476c4a244 100644 --- a/modules/imgproc/src/segmentation.cpp +++ b/modules/imgproc/src/segmentation.cpp @@ -348,7 +348,7 @@ void cv::pyrMeanShiftFiltering( InputArray _src, OutputArray _dst, const int MAX_LEVELS = 8; if( (unsigned)max_level > (unsigned)MAX_LEVELS ) - CV_Error( CV_StsOutOfRange, "The number of pyramid levels is too large or negative" ); + CV_Error( cv::Error::StsOutOfRange, "The number of pyramid levels is too large or negative" ); std::vector src_pyramid(max_level+1); std::vector dst_pyramid(max_level+1); @@ -365,13 +365,13 @@ void cv::pyrMeanShiftFiltering( InputArray _src, OutputArray _dst, if( src0.type() != CV_8UC3 ) - CV_Error( CV_StsUnsupportedFormat, "Only 8-bit, 3-channel images are supported" ); + CV_Error( cv::Error::StsUnsupportedFormat, "Only 8-bit, 3-channel images are supported" ); if( src0.type() != dst0.type() ) - CV_Error( CV_StsUnmatchedFormats, "The input and output images must have the same type" ); + CV_Error( cv::Error::StsUnmatchedFormats, "The input and output images must have the same type" ); if( src0.size() != dst0.size() ) - CV_Error( CV_StsUnmatchedSizes, "The input and output images must have the same size" ); + CV_Error( cv::Error::StsUnmatchedSizes, "The input and output images must have the same size" ); if( !(termcrit.type & CV_TERMCRIT_ITER) ) termcrit.maxCount = 5; diff --git a/modules/imgproc/src/shapedescr.cpp b/modules/imgproc/src/shapedescr.cpp index 194e5a0862..fe5664abf2 100644 --- a/modules/imgproc/src/shapedescr.cpp +++ b/modules/imgproc/src/shapedescr.cpp @@ -357,7 +357,7 @@ static RotatedRect fitEllipseNoDirect( InputArray _points ) RotatedRect box; if( n < 5 ) - CV_Error( CV_StsBadSize, "There should be at least 5 points to fit the ellipse" ); + CV_Error( cv::Error::StsBadSize, "There should be at least 5 points to fit the ellipse" ); // New fitellipse algorithm, contributed by Dr. Daniel Weiss Point2f c(0,0); @@ -520,7 +520,7 @@ cv::RotatedRect cv::fitEllipseAMS( InputArray _points ) RotatedRect box; if( n < 5 ) - CV_Error( CV_StsBadSize, "There should be at least 5 points to fit the ellipse" ); + CV_Error( cv::Error::StsBadSize, "There should be at least 5 points to fit the ellipse" ); Point2f c(0,0); @@ -705,7 +705,7 @@ cv::RotatedRect cv::fitEllipseDirect( InputArray _points ) RotatedRect box; if( n < 5 ) - CV_Error( CV_StsBadSize, "There should be at least 5 points to fit the ellipse" ); + CV_Error( cv::Error::StsBadSize, "There should be at least 5 points to fit the ellipse" ); Point2d c(0., 0.); @@ -1364,7 +1364,7 @@ cvContourArea( const void *array, CvSlice slice, int oriented ) { contour = (CvSeq*)array; if( !CV_IS_SEQ_POLYLINE( contour )) - CV_Error( CV_StsBadArg, "Unsupported sequence type" ); + CV_Error( cv::Error::StsBadArg, "Unsupported sequence type" ); } else { @@ -1379,7 +1379,7 @@ cvContourArea( const void *array, CvSlice slice, int oriented ) } if( CV_SEQ_ELTYPE( contour ) != CV_32SC2 ) - CV_Error( CV_StsUnsupportedFormat, + CV_Error( cv::Error::StsUnsupportedFormat, "Only curves with integer coordinates are supported in case of contour slice" ); area = icvContourSecArea( contour, slice ); return oriented ? area : fabs(area); @@ -1405,7 +1405,7 @@ cvArcLength( const void *array, CvSlice slice, int is_closed ) { contour = (CvSeq*)array; if( !CV_IS_SEQ_POLYLINE( contour )) - CV_Error( CV_StsBadArg, "Unsupported sequence type" ); + CV_Error( cv::Error::StsBadArg, "Unsupported sequence type" ); if( is_closed < 0 ) is_closed = CV_IS_SEQ_CLOSED( contour ); } @@ -1498,7 +1498,7 @@ cvBoundingRect( CvArr* array, int update ) { ptseq = (CvSeq*)array; if( !CV_IS_SEQ_POINT_SET( ptseq )) - CV_Error( CV_StsBadArg, "Unsupported sequence type" ); + CV_Error( cv::Error::StsBadArg, "Unsupported sequence type" ); if( ptseq->header_size < (int)sizeof(CvContour)) { @@ -1517,7 +1517,7 @@ cvBoundingRect( CvArr* array, int update ) } else if( CV_MAT_TYPE(mat->type) != CV_8UC1 && CV_MAT_TYPE(mat->type) != CV_8SC1 ) - CV_Error( CV_StsUnsupportedFormat, + CV_Error( cv::Error::StsUnsupportedFormat, "The image/matrix format is not supported by the function" ); update = 0; calculate = 1; diff --git a/modules/imgproc/src/smooth.dispatch.cpp b/modules/imgproc/src/smooth.dispatch.cpp index 8a521d6df3..26566c7e03 100644 --- a/modules/imgproc/src/smooth.dispatch.cpp +++ b/modules/imgproc/src/smooth.dispatch.cpp @@ -784,7 +784,7 @@ cvSmooth( const void* srcarr, void* dstarr, int smooth_type, cv::bilateralFilter( src, dst, param1, param3, param4, cv::BORDER_REPLICATE ); if( dst.data != dst0.data ) - CV_Error( CV_StsUnmatchedFormats, "The destination image does not have the proper type" ); + CV_Error( cv::Error::StsUnmatchedFormats, "The destination image does not have the proper type" ); } /* End of file. */ diff --git a/modules/imgproc/src/subdivision2d.cpp b/modules/imgproc/src/subdivision2d.cpp index 24075ac6eb..2a2ab1dfeb 100644 --- a/modules/imgproc/src/subdivision2d.cpp +++ b/modules/imgproc/src/subdivision2d.cpp @@ -282,10 +282,10 @@ int Subdiv2D::locate(Point2f pt, int& _edge, int& _vertex) int i, maxEdges = (int)(qedges.size() * 4); if( qedges.size() < (size_t)4 ) - CV_Error( CV_StsError, "Subdivision is empty" ); + CV_Error( cv::Error::StsError, "Subdivision is empty" ); if( pt.x < topLeft.x || pt.y < topLeft.y || pt.x >= bottomRight.x || pt.y >= bottomRight.y ) - CV_Error( CV_StsOutOfRange, "" ); + CV_Error( cv::Error::StsOutOfRange, "" ); int edge = recentEdge; CV_Assert(edge > 0); @@ -417,10 +417,10 @@ int Subdiv2D::insert(Point2f pt) int location = locate( pt, curr_edge, curr_point ); if( location == PTLOC_ERROR ) - CV_Error( CV_StsBadSize, "" ); + CV_Error( cv::Error::StsBadSize, "" ); if( location == PTLOC_OUTSIDE_RECT ) - CV_Error( CV_StsOutOfRange, "" ); + CV_Error( cv::Error::StsOutOfRange, "" ); if( location == PTLOC_VERTEX ) return curr_point; @@ -434,7 +434,7 @@ int Subdiv2D::insert(Point2f pt) else if( location == PTLOC_INSIDE ) ; else - CV_Error_(CV_StsError, ("Subdiv2D::locate returned invalid location = %d", location) ); + CV_Error_(cv::Error::StsError, ("Subdiv2D::locate returned invalid location = %d", location) ); CV_Assert( curr_edge != 0 ); validGeometry = false; diff --git a/modules/imgproc/src/templmatch.cpp b/modules/imgproc/src/templmatch.cpp index 67845e7429..5998bcbac7 100644 --- a/modules/imgproc/src/templmatch.cpp +++ b/modules/imgproc/src/templmatch.cpp @@ -145,7 +145,7 @@ void ConvolveBuf::create(Size image_size, Size templ_size) dft_size.width = std::max(getOptimalDFTSize(block_size.width + templ_size.width - 1), 2); dft_size.height = getOptimalDFTSize(block_size.height + templ_size.height - 1); if( dft_size.width <= 0 || dft_size.height <= 0 ) - CV_Error( CV_StsOutOfRange, "the input arrays are too big" ); + CV_Error( cv::Error::StsOutOfRange, "the input arrays are too big" ); // recompute block size block_size.width = dft_size.width - templ_size.width + 1; @@ -602,7 +602,7 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr, dftsize.width = std::max(getOptimalDFTSize(blocksize.width + templ.cols - 1), 2); dftsize.height = getOptimalDFTSize(blocksize.height + templ.rows - 1); if( dftsize.width <= 0 || dftsize.height <= 0 ) - CV_Error( CV_StsOutOfRange, "the input arrays are too big" ); + CV_Error( cv::Error::StsOutOfRange, "the input arrays are too big" ); // recompute block size blocksize.width = dftsize.width - templ.cols + 1; diff --git a/modules/imgproc/src/thresh.cpp b/modules/imgproc/src/thresh.cpp index 8259902ed7..8d82c14a50 100644 --- a/modules/imgproc/src/thresh.cpp +++ b/modules/imgproc/src/thresh.cpp @@ -117,7 +117,7 @@ static void threshGeneric(Size roi, const T* src, size_t src_step, T* dst, return; default: - CV_Error( CV_StsBadArg, "" ); return; + CV_Error( cv::Error::StsBadArg, "" ); return; } } @@ -719,7 +719,7 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type ) } break; default: - CV_Error( CV_StsBadArg, "" ); return; + CV_Error( cv::Error::StsBadArg, "" ); return; } #else threshGeneric(roi, src, src_step, dst, dst_step, thresh, maxval, type); @@ -925,7 +925,7 @@ thresh_32f( const Mat& _src, Mat& _dst, float thresh, float maxval, int type ) } break; default: - CV_Error( CV_StsBadArg, "" ); return; + CV_Error( cv::Error::StsBadArg, "" ); return; } #else threshGeneric(roi, src, src_step, dst, dst_step, thresh, maxval, type); @@ -1096,7 +1096,7 @@ thresh_64f(const Mat& _src, Mat& _dst, double thresh, double maxval, int type) } break; default: - CV_Error(CV_StsBadArg, ""); return; + CV_Error(cv::Error::StsBadArg, ""); return; } #else threshGeneric(roi, src, src_step, dst, dst_step, thresh, maxval, type); @@ -1656,7 +1656,7 @@ double cv::threshold( InputArray _src, OutputArray _dst, double thresh, double m else if( src.depth() == CV_64F ) ; else - CV_Error( CV_StsUnsupportedFormat, "" ); + CV_Error( cv::Error::StsUnsupportedFormat, "" ); parallel_for_(Range(0, dst.rows), ThresholdRunner(src, dst, thresh, maxval, type), @@ -1704,7 +1704,7 @@ void cv::adaptiveThreshold( InputArray _src, OutputArray _dst, double maxValue, meanfloat.convertTo(mean, src.type()); } else - CV_Error( CV_StsBadFlag, "Unknown/unsupported adaptive threshold method" ); + CV_Error( cv::Error::StsBadFlag, "Unknown/unsupported adaptive threshold method" ); int i, j; uchar imaxval = saturate_cast(maxValue); @@ -1718,7 +1718,7 @@ void cv::adaptiveThreshold( InputArray _src, OutputArray _dst, double maxValue, for( i = 0; i < 768; i++ ) tab[i] = (uchar)(i - 255 <= -idelta ? imaxval : 0); else - CV_Error( CV_StsBadFlag, "Unknown/unsupported threshold type" ); + CV_Error( cv::Error::StsBadFlag, "Unknown/unsupported threshold type" ); if( src.isContinuous() && mean.isContinuous() && dst.isContinuous() ) { diff --git a/modules/imgproc/src/utils.cpp b/modules/imgproc/src/utils.cpp index 4f45cde5e0..518de58eab 100644 --- a/modules/imgproc/src/utils.cpp +++ b/modules/imgproc/src/utils.cpp @@ -51,19 +51,19 @@ CV_IMPL CvSeq* cvPointSeqFromMat( int seq_kind, const CvArr* arr, CvMat* mat = (CvMat*)arr; if( !CV_IS_MAT( mat )) - CV_Error( CV_StsBadArg, "Input array is not a valid matrix" ); + CV_Error( cv::Error::StsBadArg, "Input array is not a valid matrix" ); if( CV_MAT_CN(mat->type) == 1 && mat->width == 2 ) mat = cvReshape(mat, &hdr, 2); eltype = CV_MAT_TYPE( mat->type ); if( eltype != CV_32SC2 && eltype != CV_32FC2 ) - CV_Error( CV_StsUnsupportedFormat, + CV_Error( cv::Error::StsUnsupportedFormat, "The matrix can not be converted to point sequence because of " "inappropriate element type" ); if( (mat->width != 1 && mat->height != 1) || !CV_IS_MAT_CONT(mat->type)) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "The matrix converted to point sequence must be " "1-dimensional and continuous" ); diff --git a/modules/imgproc/test/test_color.cpp b/modules/imgproc/test/test_color.cpp index 2c89932adc..5a5898415c 100644 --- a/modules/imgproc/test/test_color.cpp +++ b/modules/imgproc/test/test_color.cpp @@ -1824,7 +1824,7 @@ void CV_ColorBayerTest::prepare_to_validation( int /*test_case_idx*/ ) else if( depth == CV_16U ) bayer2BGR_(src, dst, fwd_code); else - CV_Error(CV_StsUnsupportedFormat, ""); + CV_Error(cv::Error::StsUnsupportedFormat, ""); } diff --git a/modules/imgproc/test/test_filter.cpp b/modules/imgproc/test/test_filter.cpp index 02d5e232a2..011cbaab0b 100644 --- a/modules/imgproc/test/test_filter.cpp +++ b/modules/imgproc/test/test_filter.cpp @@ -307,7 +307,7 @@ void CV_MorphologyBaseTest::prepare_to_validation( int /*test_case_idx*/ ) cvtest::add( dst, 1, src, -1, Scalar::all(0), dst, dst.type() ); } else - CV_Error( CV_StsBadArg, "Unknown operation" ); + CV_Error( cv::Error::StsBadArg, "Unknown operation" ); } cvReleaseStructuringElement( &element ); diff --git a/modules/ml/src/ann_mlp.cpp b/modules/ml/src/ann_mlp.cpp index 3843564e15..5f15c173a1 100644 --- a/modules/ml/src/ann_mlp.cpp +++ b/modules/ml/src/ann_mlp.cpp @@ -223,7 +223,7 @@ public: void setActivationFunction(int _activ_func, double _f_param1, double _f_param2) CV_OVERRIDE { if( _activ_func < 0 || _activ_func > LEAKYRELU) - CV_Error( CV_StsOutOfRange, "Unknown activation function" ); + CV_Error( cv::Error::StsOutOfRange, "Unknown activation function" ); activ_func = _activ_func; @@ -322,7 +322,7 @@ public: { int n = layer_sizes[i]; if( n < 1 + (0 < i && i < l_count-1)) - CV_Error( CV_StsOutOfRange, + CV_Error( cv::Error::StsOutOfRange, "there should be at least one input and one output " "and every hidden layer must have more than 1 neuron" ); max_lsize = std::max( max_lsize, n ); @@ -341,7 +341,7 @@ public: float predict( InputArray _inputs, OutputArray _outputs, int ) const CV_OVERRIDE { if( !trained ) - CV_Error( CV_StsError, "The network has not been trained or loaded" ); + CV_Error( cv::Error::StsError, "The network has not been trained or loaded" ); Mat inputs = _inputs.getMat(); int type = inputs.type(), l_count = layer_count(); @@ -790,7 +790,7 @@ public: { t = t*inv_scale[j*2] + inv_scale[2*j+1]; if( t < m1 || t > M1 ) - CV_Error( CV_StsOutOfRange, + CV_Error( cv::Error::StsOutOfRange, "Some of new output training vector components run exceed the original range too much" ); } } @@ -817,25 +817,25 @@ public: Mat& sample_weights, int flags ) { if( layer_sizes.empty() ) - CV_Error( CV_StsError, + CV_Error( cv::Error::StsError, "The network has not been created. Use method create or the appropriate constructor" ); if( (inputs.type() != CV_32F && inputs.type() != CV_64F) || inputs.cols != layer_sizes[0] ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "input training data should be a floating-point matrix with " "the number of rows equal to the number of training samples and " "the number of columns equal to the size of 0-th (input) layer" ); if( (outputs.type() != CV_32F && outputs.type() != CV_64F) || outputs.cols != layer_sizes.back() ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "output training data should be a floating-point matrix with " "the number of rows equal to the number of training samples and " "the number of columns equal to the size of last (output) layer" ); if( inputs.rows != outputs.rows ) - CV_Error( CV_StsUnmatchedSizes, "The numbers of input and output samples do not match" ); + CV_Error( cv::Error::StsUnmatchedSizes, "The numbers of input and output samples do not match" ); Mat temp; double s = sum(sample_weights)[0]; @@ -1323,7 +1323,7 @@ public: fs << "itePerStep" << params.itePerStep; } else - CV_Error(CV_StsError, "Unknown training method"); + CV_Error(cv::Error::StsError, "Unknown training method"); fs << "term_criteria" << "{"; if( params.termCrit.type & TermCriteria::EPS ) @@ -1421,7 +1421,7 @@ public: params.itePerStep = tpn["itePerStep"]; } else - CV_Error(CV_StsParseError, "Unknown training method (should be BACKPROP or RPROP)"); + CV_Error(cv::Error::StsParseError, "Unknown training method (should be BACKPROP or RPROP)"); FileNode tcn = tpn["term_criteria"]; if( !tcn.empty() ) diff --git a/modules/ml/src/boost.cpp b/modules/ml/src/boost.cpp index be9c9a7b46..87e1fe4131 100644 --- a/modules/ml/src/boost.cpp +++ b/modules/ml/src/boost.cpp @@ -308,7 +308,7 @@ public: } } else - CV_Error(CV_StsNotImplemented, "Unknown boosting type"); + CV_Error(cv::Error::StsNotImplemented, "Unknown boosting type"); /*if( bparams.boostType != Boost::LOGIT ) { @@ -387,7 +387,7 @@ public: void write( FileStorage& fs ) const CV_OVERRIDE { if( roots.empty() ) - CV_Error( CV_StsBadArg, "RTrees have not been trained" ); + CV_Error( cv::Error::StsBadArg, "RTrees have not been trained" ); writeFormat(fs); writeParams(fs); diff --git a/modules/ml/src/data.cpp b/modules/ml/src/data.cpp index fd7c8d1016..6f8035947b 100644 --- a/modules/ml/src/data.cpp +++ b/modules/ml/src/data.cpp @@ -574,7 +574,7 @@ public: if( nvars == 0 ) { if( rowvals.empty() ) - CV_Error(CV_StsBadArg, "invalid CSV format; no data found"); + CV_Error(cv::Error::StsBadArg, "invalid CSV format; no data found"); nvars = (int)rowvals.size(); if( !varTypeSpec.empty() && varTypeSpec.size() > 0 ) { @@ -637,7 +637,7 @@ public: { for( i = ninputvars; i < nvars; i++ ) if( vtypes[i] == VAR_CATEGORICAL ) - CV_Error(CV_StsBadArg, + CV_Error(cv::Error::StsBadArg, "If responses are vector values, not scalars, they must be marked as ordered responses"); } } @@ -724,14 +724,14 @@ public: } if ( ptr[3] != '[') - CV_Error( CV_StsBadArg, errmsg ); + CV_Error( cv::Error::StsBadArg, errmsg ); ptr += 4; // pass "ord[" do { int b1 = (int)strtod( ptr, &stopstring ); if( *stopstring == 0 || (*stopstring != ',' && *stopstring != ']' && *stopstring != '-') ) - CV_Error( CV_StsBadArg, errmsg ); + CV_Error( cv::Error::StsBadArg, errmsg ); ptr = stopstring + 1; if( (stopstring[0] == ',') || (stopstring[0] == ']')) { @@ -745,7 +745,7 @@ public: { int b2 = (int)strtod( ptr, &stopstring); if ( (*stopstring == 0) || (*stopstring != ',' && *stopstring != ']') ) - CV_Error( CV_StsBadArg, errmsg ); + CV_Error( cv::Error::StsBadArg, errmsg ); ptr = stopstring + 1; CV_Assert( 0 <= b1 && b1 <= b2 && b2 < nvars ); for (int i = b1; i <= b2; i++) @@ -753,7 +753,7 @@ public: specCounter += b2 - b1 + 1; } else - CV_Error( CV_StsBadArg, errmsg ); + CV_Error( cv::Error::StsBadArg, errmsg ); } } @@ -762,7 +762,7 @@ public: } if( specCounter != nvars ) - CV_Error( CV_StsBadArg, "type of some variables is not specified" ); + CV_Error( cv::Error::StsBadArg, "type of some variables is not specified" ); } void setTrainTestSplitRatio(double ratio, bool shuffle) CV_OVERRIDE diff --git a/modules/ml/src/gbt.cpp b/modules/ml/src/gbt.cpp index 57f2eb176b..d1d6f2c8ea 100644 --- a/modules/ml/src/gbt.cpp +++ b/modules/ml/src/gbt.cpp @@ -218,7 +218,7 @@ CvGBTrees::train( const CvMat* _train_data, int _tflag, orig_response->data.fl[i] = (float) _responses->data.i[i*step]; }; break; default: - CV_Error(CV_StsUnmatchedFormats, "Response should be a 32fC1 or 32sC1 vector."); + CV_Error(cv::Error::StsUnmatchedFormats, "Response should be a 32fC1 or 32sC1 vector."); } if (!is_regression) @@ -283,7 +283,7 @@ CvGBTrees::train( const CvMat* _train_data, int _tflag, sample_idx->data.i[active_samples_count++] = i; } break; - default: CV_Error(CV_StsUnmatchedFormats, "_sample_idx should be a 32sC1, 8sC1 or 8uC1 vector."); + default: CV_Error(cv::Error::StsUnmatchedFormats, "_sample_idx should be a 32sC1, 8sC1 or 8uC1 vector."); } } else @@ -1072,7 +1072,7 @@ void CvGBTrees::read_params( CvFileStorage* fs, CvFileNode* fnode ) if( params.loss_function_type < SQUARED_LOSS || params.loss_function_type > DEVIANCE_LOSS || params.loss_function_type == 2) - CV_ERROR( CV_StsBadArg, "Unknown loss function" ); + CV_ERROR( cv::Error::StsBadArg, "Unknown loss function" ); params.weak_count = cvReadIntByName( fs, fnode, "ensemble_length" ); params.shrinkage = (float)cvReadRealByName( fs, fnode, "shrinkage", 0.1 ); @@ -1082,7 +1082,7 @@ void CvGBTrees::read_params( CvFileStorage* fs, CvFileNode* fnode ) { class_labels = (CvMat*)cvReadByName( fs, fnode, "class_labels" ); if( class_labels && !CV_IS_MAT(class_labels)) - CV_ERROR( CV_StsParseError, "class_labels must stored as a matrix"); + CV_ERROR( cv::Error::StsParseError, "class_labels must stored as a matrix"); } data->is_classifier = 0; @@ -1105,7 +1105,7 @@ void CvGBTrees::write( CvFileStorage* fs, const char* name ) const cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_ML_GBT ); if( !weak ) - CV_ERROR( CV_StsBadArg, "The model has not been trained yet" ); + CV_ERROR( cv::Error::StsBadArg, "The model has not been trained yet" ); write_params( fs ); cvWriteReal( fs, "base_value", base_value); @@ -1170,13 +1170,13 @@ void CvGBTrees::read( CvFileStorage* fs, CvFileNode* node ) trees_fnode = cvGetFileNodeByName( fs, node, s.c_str() ); if( !trees_fnode || !CV_NODE_IS_SEQ(trees_fnode->tag) ) - CV_ERROR( CV_StsParseError, " tag is missing" ); + CV_ERROR( cv::Error::StsParseError, " tag is missing" ); cvStartReadSeq( trees_fnode->data.seq, &reader ); ntrees = trees_fnode->data.seq->total; if( ntrees != params.weak_count ) - CV_ERROR( CV_StsUnmatchedSizes, + CV_ERROR( cv::Error::StsUnmatchedSizes, "The number of trees stored does not match tag value" ); CV_CALL( storage = cvCreateMemStorage() ); diff --git a/modules/ml/src/inner_functions.cpp b/modules/ml/src/inner_functions.cpp index 6b3affcebc..c0e5f45dd1 100644 --- a/modules/ml/src/inner_functions.cpp +++ b/modules/ml/src/inner_functions.cpp @@ -63,7 +63,7 @@ bool StatModel::train(const Ptr& trainData, int ) { CV_TRACE_FUNCTION(); CV_Assert(!trainData.empty()); - CV_Error(CV_StsNotImplemented, ""); + CV_Error(cv::Error::StsNotImplemented, ""); return false; } diff --git a/modules/ml/src/lr.cpp b/modules/ml/src/lr.cpp index b43e104045..6f462e14c3 100644 --- a/modules/ml/src/lr.cpp +++ b/modules/ml/src/lr.cpp @@ -109,15 +109,15 @@ bool LogisticRegressionImpl::train(const Ptr& trainData, int) CV_Assert( !_labels_i.empty() && !_data_i.empty()); if(_labels_i.cols != 1) { - CV_Error( CV_StsBadArg, "labels should be a column matrix" ); + CV_Error( cv::Error::StsBadArg, "labels should be a column matrix" ); } if(_data_i.type() != CV_32FC1 || _labels_i.type() != CV_32FC1) { - CV_Error( CV_StsBadArg, "data and labels must be a floating point matrix" ); + CV_Error( cv::Error::StsBadArg, "data and labels must be a floating point matrix" ); } if(_labels_i.rows != _data_i.rows) { - CV_Error( CV_StsBadArg, "number of rows in data and labels should be equal" ); + CV_Error( cv::Error::StsBadArg, "number of rows in data and labels should be equal" ); } // class labels @@ -126,7 +126,7 @@ bool LogisticRegressionImpl::train(const Ptr& trainData, int) int num_classes = (int) this->forward_mapper.size(); if(num_classes < 2) { - CV_Error( CV_StsBadArg, "data should have at least 2 classes" ); + CV_Error( cv::Error::StsBadArg, "data should have at least 2 classes" ); } // add a column of ones to the data (bias/intercept term) @@ -174,7 +174,7 @@ bool LogisticRegressionImpl::train(const Ptr& trainData, int) this->learnt_thetas = thetas.clone(); if( cvIsNaN( (double)sum(this->learnt_thetas)[0] ) ) { - CV_Error( CV_StsBadArg, "check training parameters. Invalid training classifier" ); + CV_Error( cv::Error::StsBadArg, "check training parameters. Invalid training classifier" ); } // success @@ -187,7 +187,7 @@ float LogisticRegressionImpl::predict(InputArray samples, OutputArray results, i // check if learnt_mats array is populated if(!this->isTrained()) { - CV_Error( CV_StsBadArg, "classifier should be trained first" ); + CV_Error( cv::Error::StsBadArg, "classifier should be trained first" ); } // coefficient matrix @@ -206,7 +206,7 @@ float LogisticRegressionImpl::predict(InputArray samples, OutputArray results, i Mat data = samples.getMat(); if(data.type() != CV_32F) { - CV_Error( CV_StsBadArg, "data must be of floating type" ); + CV_Error( cv::Error::StsBadArg, "data must be of floating type" ); } // add a column of ones to the data (bias/intercept term) @@ -327,7 +327,7 @@ double LogisticRegressionImpl::compute_cost(const Mat& _data, const Mat& _labels if(cvIsNaN( cost ) == 1) { - CV_Error( CV_StsBadArg, "check training parameters. Invalid training classifier" ); + CV_Error( cv::Error::StsBadArg, "check training parameters. Invalid training classifier" ); } return cost; @@ -398,12 +398,12 @@ Mat LogisticRegressionImpl::batch_gradient_descent(const Mat& _data, const Mat& // implements batch gradient descent if(this->params.alpha<=0) { - CV_Error( CV_StsBadArg, "check training parameters (learning rate) for the classifier" ); + CV_Error( cv::Error::StsBadArg, "check training parameters (learning rate) for the classifier" ); } if(this->params.num_iters <= 0) { - CV_Error( CV_StsBadArg, "number of iterations cannot be zero or a negative number" ); + CV_Error( cv::Error::StsBadArg, "number of iterations cannot be zero or a negative number" ); } int llambda = 0; @@ -439,12 +439,12 @@ Mat LogisticRegressionImpl::mini_batch_gradient_descent(const Mat& _data, const if(this->params.mini_batch_size <= 0 || this->params.alpha == 0) { - CV_Error( CV_StsBadArg, "check training parameters for the classifier" ); + CV_Error( cv::Error::StsBadArg, "check training parameters for the classifier" ); } if(this->params.num_iters <= 0) { - CV_Error( CV_StsBadArg, "number of iterations cannot be zero or a negative number" ); + CV_Error( cv::Error::StsBadArg, "number of iterations cannot be zero or a negative number" ); } Mat theta_p = _init_theta.clone(); @@ -551,7 +551,7 @@ void LogisticRegressionImpl::write(FileStorage& fs) const // check if open if(fs.isOpened() == 0) { - CV_Error(CV_StsBadArg,"file can't open. Check file path"); + CV_Error(cv::Error::StsBadArg,"file can't open. Check file path"); } writeFormat(fs); string desc = "Logistic Regression Classifier"; @@ -574,7 +574,7 @@ void LogisticRegressionImpl::read(const FileNode& fn) // check if empty if(fn.empty()) { - CV_Error( CV_StsBadArg, "empty FileNode object" ); + CV_Error( cv::Error::StsBadArg, "empty FileNode object" ); } this->params.alpha = (double)fn["alpha"]; diff --git a/modules/ml/src/nbayes.cpp b/modules/ml/src/nbayes.cpp index 60dda0c7d4..910a1e1c37 100644 --- a/modules/ml/src/nbayes.cpp +++ b/modules/ml/src/nbayes.cpp @@ -101,7 +101,7 @@ public: norm(var_idx, __var_idx, NORM_INF) != 0 || cls_labels.size() != __cls_labels.size() || norm(cls_labels, __cls_labels, NORM_INF) != 0 ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "The new training data is inconsistent with the original training data; varIdx and the class labels should be the same" ); } @@ -312,11 +312,11 @@ public: bool rawOutput = (flags & RAW_OUTPUT) != 0; if( samples.type() != CV_32F || samples.cols != nallvars ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "The input samples must be 32f matrix with the number of columns = nallvars" ); if( (samples.rows > 1) && (! _results.needed()) ) - CV_Error( CV_StsNullPtr, + CV_Error( cv::Error::StsNullPtr, "When the number of input samples is >1, the output vector of results must be passed" ); if( _results.needed() ) @@ -388,7 +388,7 @@ public: fn["var_all"] >> nallvars; if( nallvars <= 0 ) - CV_Error( CV_StsParseError, + CV_Error( cv::Error::StsParseError, "The field \"var_count\" of NBayes classifier is missing or non-positive" ); fn["var_idx"] >> var_idx; @@ -397,7 +397,7 @@ public: int nclasses = (int)cls_labels.total(), i; if( cls_labels.empty() || nclasses < 1 ) - CV_Error( CV_StsParseError, "No or invalid \"cls_labels\" in NBayes classifier" ); + CV_Error( cv::Error::StsParseError, "No or invalid \"cls_labels\" in NBayes classifier" ); FileNodeIterator count_it = fn["count"].begin(), diff --git a/modules/ml/src/precomp.hpp b/modules/ml/src/precomp.hpp index 328cc4732a..6a91ef98f0 100644 --- a/modules/ml/src/precomp.hpp +++ b/modules/ml/src/precomp.hpp @@ -131,13 +131,13 @@ namespace ml inline void setMaxCategories(int val) { if( val < 2 ) - CV_Error( CV_StsOutOfRange, "max_categories should be >= 2" ); + CV_Error( cv::Error::StsOutOfRange, "max_categories should be >= 2" ); maxCategories = std::min(val, 15 ); } inline void setMaxDepth(int val) { if( val < 0 ) - CV_Error( CV_StsOutOfRange, "max_depth should be >= 0" ); + CV_Error( cv::Error::StsOutOfRange, "max_depth should be >= 0" ); maxDepth = std::min( val, 25 ); } inline void setMinSampleCount(int val) @@ -147,11 +147,11 @@ namespace ml inline void setCVFolds(int val) { if( val < 0 ) - CV_Error( CV_StsOutOfRange, + CV_Error( cv::Error::StsOutOfRange, "params.CVFolds should be =0 (the tree is not pruned) " "or n>0 (tree is pruned using n-fold cross-validation)" ); if(val > 1) - CV_Error( CV_StsNotImplemented, + CV_Error( cv::Error::StsNotImplemented, "tree pruning using cross-validation is not implemented." "Set CVFolds to 1"); @@ -162,7 +162,7 @@ namespace ml inline void setRegressionAccuracy(float val) { if( val < 0 ) - CV_Error( CV_StsOutOfRange, "params.regression_accuracy should be >= 0" ); + CV_Error( cv::Error::StsOutOfRange, "params.regression_accuracy should be >= 0" ); regressionAccuracy = val; } diff --git a/modules/ml/src/rtrees.cpp b/modules/ml/src/rtrees.cpp index 2cad961f99..41ffa03a5e 100644 --- a/modules/ml/src/rtrees.cpp +++ b/modules/ml/src/rtrees.cpp @@ -309,7 +309,7 @@ public: { CV_TRACE_FUNCTION(); if( roots.empty() ) - CV_Error( CV_StsBadArg, "RTrees have not been trained" ); + CV_Error( cv::Error::StsBadArg, "RTrees have not been trained" ); writeFormat(fs); writeParams(fs); diff --git a/modules/ml/src/svm.cpp b/modules/ml/src/svm.cpp index 40c18c03ea..0d62f7858a 100644 --- a/modules/ml/src/svm.cpp +++ b/modules/ml/src/svm.cpp @@ -95,11 +95,11 @@ const int QFLOAT_TYPE = DataDepth::value; static void checkParamGrid(const ParamGrid& pg) { if( pg.minVal > pg.maxVal ) - CV_Error( CV_StsBadArg, "Lower bound of the grid must be less then the upper one" ); + CV_Error( cv::Error::StsBadArg, "Lower bound of the grid must be less then the upper one" ); if( pg.minVal < DBL_EPSILON ) - CV_Error( CV_StsBadArg, "Lower bound of the grid must be positive" ); + CV_Error( cv::Error::StsBadArg, "Lower bound of the grid must be positive" ); if( pg.logStep < 1. + FLT_EPSILON ) - CV_Error( CV_StsBadArg, "Grid step must greater than 1" ); + CV_Error( cv::Error::StsBadArg, "Grid step must greater than 1" ); } // SVM training parameters @@ -325,7 +325,7 @@ public: calc_intersec(vcount, var_count, vecs, another, results); break; default: - CV_Error(CV_StsBadArg, "Unknown kernel type"); + CV_Error(cv::Error::StsBadArg, "Unknown kernel type"); } const Qfloat max_val = (Qfloat)(FLT_MAX*1e-3); for( int j = 0; j < vcount; j++ ) @@ -410,7 +410,7 @@ ParamGrid SVM::getDefaultGrid( int param_id ) grid.logStep = 7; // total iterations = 3 } else - cvError( CV_StsBadArg, "SVM::getDefaultGrid", "Invalid type of parameter " + cvError( cv::Error::StsBadArg, "SVM::getDefaultGrid", "Invalid type of parameter " "(use one of SVM::C, SVM::GAMMA et al.)", __FILE__, __LINE__ ); return grid; } @@ -1297,12 +1297,12 @@ public: if( kernelType != LINEAR && kernelType != POLY && kernelType != SIGMOID && kernelType != RBF && kernelType != INTER && kernelType != CHI2) - CV_Error( CV_StsBadArg, "Unknown/unsupported kernel type" ); + CV_Error( cv::Error::StsBadArg, "Unknown/unsupported kernel type" ); if( kernelType == LINEAR ) params.gamma = 1; else if( params.gamma <= 0 ) - CV_Error( CV_StsOutOfRange, "gamma parameter of the kernel must be positive" ); + CV_Error( cv::Error::StsOutOfRange, "gamma parameter of the kernel must be positive" ); if( kernelType != SIGMOID && kernelType != POLY ) params.coef0 = 0; @@ -1310,14 +1310,14 @@ public: if( kernelType != POLY ) params.degree = 0; else if( params.degree <= 0 ) - CV_Error( CV_StsOutOfRange, "The kernel parameter must be positive" ); + CV_Error( cv::Error::StsOutOfRange, "The kernel parameter must be positive" ); kernel = makePtr(params); } else { if (!kernel) - CV_Error( CV_StsBadArg, "Custom kernel is not set" ); + CV_Error( cv::Error::StsBadArg, "Custom kernel is not set" ); } int svmType = params.svmType; @@ -1325,22 +1325,22 @@ public: if( svmType != C_SVC && svmType != NU_SVC && svmType != ONE_CLASS && svmType != EPS_SVR && svmType != NU_SVR ) - CV_Error( CV_StsBadArg, "Unknown/unsupported SVM type" ); + CV_Error( cv::Error::StsBadArg, "Unknown/unsupported SVM type" ); if( svmType == ONE_CLASS || svmType == NU_SVC ) params.C = 0; else if( params.C <= 0 ) - CV_Error( CV_StsOutOfRange, "The parameter C must be positive" ); + CV_Error( cv::Error::StsOutOfRange, "The parameter C must be positive" ); if( svmType == C_SVC || svmType == EPS_SVR ) params.nu = 0; else if( params.nu <= 0 || params.nu >= 1 ) - CV_Error( CV_StsOutOfRange, "The parameter nu must be between 0 and 1" ); + CV_Error( cv::Error::StsOutOfRange, "The parameter nu must be between 0 and 1" ); if( svmType != EPS_SVR ) params.p = 0; else if( params.p <= 0 ) - CV_Error( CV_StsOutOfRange, "The parameter p must be positive" ); + CV_Error( cv::Error::StsOutOfRange, "The parameter p must be positive" ); if( svmType != C_SVC ) params.classWeights.release(); @@ -1431,7 +1431,7 @@ public: if( (cw.cols != 1 && cw.rows != 1) || (int)cw.total() != class_count || (cw.type() != CV_32F && cw.type() != CV_64F) ) - CV_Error( CV_StsBadArg, "params.class_weights must be 1d floating-point vector " + CV_Error( cv::Error::StsBadArg, "params.class_weights must be 1d floating-point vector " "containing as many elements as the number of classes" ); cw.convertTo(class_weights, CV_64F, params.C); @@ -1446,7 +1446,7 @@ public: //check that while cross-validation there were the samples from all the classes if ((int)class_ranges.size() < class_count + 1) - CV_Error( CV_StsBadArg, "While cross-validation one or more of the classes have " + CV_Error( cv::Error::StsBadArg, "While cross-validation one or more of the classes have " "been fell out of the sample. Try to reduce " ); if( svmType == NU_SVC ) @@ -1620,7 +1620,7 @@ public: { responses = data->getTrainNormCatResponses(); if( responses.empty() ) - CV_Error(CV_StsBadArg, "in the case of classification problem the responses must be categorical; " + CV_Error(cv::Error::StsBadArg, "in the case of classification problem the responses must be categorical; " "either specify varType when creating TrainData, or pass integer responses"); class_labels = data->getClassLabels(); } @@ -1969,7 +1969,7 @@ public: } } else - CV_Error( CV_StsBadArg, "INTERNAL ERROR: Unknown SVM type, " + CV_Error( cv::Error::StsBadArg, "INTERNAL ERROR: Unknown SVM type, " "the SVM structure is probably corrupted" ); } @@ -2112,7 +2112,7 @@ public: int class_count = !class_labels.empty() ? (int)class_labels.total() : params.svmType == ONE_CLASS ? 1 : 0; if( !isTrained() ) - CV_Error( CV_StsParseError, "SVM model data is invalid, check sv_count, var_* and class_count tags" ); + CV_Error( cv::Error::StsParseError, "SVM model data is invalid, check sv_count, var_* and class_count tags" ); writeFormat(fs); write_params( fs ); @@ -2197,11 +2197,11 @@ public: svm_type_str == "NU_SVR" ? NU_SVR : -1; if( svmType < 0 ) - CV_Error( CV_StsParseError, "Missing or invalid SVM type" ); + CV_Error( cv::Error::StsParseError, "Missing or invalid SVM type" ); FileNode kernel_node = fn["kernel"]; if( kernel_node.empty() ) - CV_Error( CV_StsParseError, "SVM kernel tag is not found" ); + CV_Error( cv::Error::StsParseError, "SVM kernel tag is not found" ); String kernel_type_str = (String)kernel_node["type"]; int kernelType = @@ -2213,7 +2213,7 @@ public: kernel_type_str == "INTER" ? INTER : CUSTOM; if( kernelType == CUSTOM ) - CV_Error( CV_StsParseError, "Invalid SVM kernel type (or custom kernel)" ); + CV_Error( cv::Error::StsParseError, "Invalid SVM kernel type (or custom kernel)" ); _params.svmType = svmType; _params.kernelType = kernelType; @@ -2253,7 +2253,7 @@ public: int class_count = (int)fn["class_count"]; if( sv_total <= 0 || var_count <= 0 ) - CV_Error( CV_StsParseError, "SVM model data is invalid, check sv_count, var_* and class_count tags" ); + CV_Error( cv::Error::StsParseError, "SVM model data is invalid, check sv_count, var_* and class_count tags" ); FileNode m = fn["class_labels"]; if( !m.empty() ) @@ -2263,7 +2263,7 @@ public: m >> params.classWeights; if( class_count > 1 && (class_labels.empty() || (int)class_labels.total() != class_count)) - CV_Error( CV_StsParseError, "Array of class labels is missing or invalid" ); + CV_Error( cv::Error::StsParseError, "Array of class labels is missing or invalid" ); // read support vectors FileNode sv_node = fn["support_vectors"]; diff --git a/modules/ml/src/svmsgd.cpp b/modules/ml/src/svmsgd.cpp index 266c7cf300..ccb5ca3a85 100644 --- a/modules/ml/src/svmsgd.cpp +++ b/modules/ml/src/svmsgd.cpp @@ -375,7 +375,7 @@ bool SVMSGDImpl::isTrained() const void SVMSGDImpl::write(FileStorage& fs) const { if( !isTrained() ) - CV_Error( CV_StsParseError, "SVMSGD model data is invalid, it hasn't been trained" ); + CV_Error( cv::Error::StsParseError, "SVMSGD model data is invalid, it hasn't been trained" ); writeFormat(fs); writeParams( fs ); @@ -437,7 +437,7 @@ void SVMSGDImpl::readParams( const FileNode& fn ) svmsgdTypeStr == "ASGD" ? ASGD : -1; if( svmsgdType < 0 ) - CV_Error( CV_StsParseError, "Missing or invalid SVMSGD type" ); + CV_Error( cv::Error::StsParseError, "Missing or invalid SVMSGD type" ); params.svmsgdType = svmsgdType; @@ -447,7 +447,7 @@ void SVMSGDImpl::readParams( const FileNode& fn ) marginTypeStr == "HARD_MARGIN" ? HARD_MARGIN : -1; if( marginType < 0 ) - CV_Error( CV_StsParseError, "Missing or invalid margin type" ); + CV_Error( cv::Error::StsParseError, "Missing or invalid margin type" ); params.marginType = marginType; @@ -517,7 +517,7 @@ void SVMSGDImpl::setOptimalParameters(int svmsgdType, int marginType) break; default: - CV_Error( CV_StsParseError, "SVMSGD model data is invalid" ); + CV_Error( cv::Error::StsParseError, "SVMSGD model data is invalid" ); } } } //ml diff --git a/modules/ml/src/testset.cpp b/modules/ml/src/testset.cpp index 48cd134154..b20115d199 100644 --- a/modules/ml/src/testset.cpp +++ b/modules/ml/src/testset.cpp @@ -60,13 +60,13 @@ void createConcentricSpheresTestSet( int num_samples, int num_features, int num_ OutputArray _samples, OutputArray _responses) { if( num_samples < 1 ) - CV_Error( CV_StsBadArg, "num_samples parameter must be positive" ); + CV_Error( cv::Error::StsBadArg, "num_samples parameter must be positive" ); if( num_features < 1 ) - CV_Error( CV_StsBadArg, "num_features parameter must be positive" ); + CV_Error( cv::Error::StsBadArg, "num_features parameter must be positive" ); if( num_classes < 1 ) - CV_Error( CV_StsBadArg, "num_classes parameter must be positive" ); + CV_Error( cv::Error::StsBadArg, "num_classes parameter must be positive" ); int i, cur_class; diff --git a/modules/ml/src/tree.cpp b/modules/ml/src/tree.cpp index b69ddaece2..3d8941344d 100644 --- a/modules/ml/src/tree.cpp +++ b/modules/ml/src/tree.cpp @@ -404,7 +404,7 @@ int DTreesImpl::addNodeAndTrySplit( int parent, const vector& sidx ) { node.defaultDir = calcDir( node.split, sidx, sleft, sright ); if( params.useSurrogates ) - CV_Error( CV_StsNotImplemented, "surrogate splits are not implemented yet"); + CV_Error( cv::Error::StsNotImplemented, "surrogate splits are not implemented yet"); int left = addNodeAndTrySplit( nidx, sleft ); int right = addNodeAndTrySplit( nidx, sright ); @@ -1445,7 +1445,7 @@ float DTreesImpl::predictTrees( const Range& range, const Mat& sample, int flags int ival = cvRound(val); if( ival != val ) - CV_Error( CV_StsBadArg, + CV_Error( cv::Error::StsBadArg, "one of input categorical variable is not an integer" ); CV_Assert(cmap != NULL); diff --git a/modules/photo/src/inpaint.cpp b/modules/photo/src/inpaint.cpp index 05d2d49dca..a763b63f33 100644 --- a/modules/photo/src/inpaint.cpp +++ b/modules/photo/src/inpaint.cpp @@ -693,18 +693,18 @@ icvInpaint( const CvArr* _input_img, const CvArr* _inpaint_mask, CvArr* _output_ output_img = cvGetMat( _output_img, &output_hdr ); if( !CV_ARE_SIZES_EQ(input_img,output_img) || !CV_ARE_SIZES_EQ(input_img,inpaint_mask)) - CV_Error( CV_StsUnmatchedSizes, "All the input and output images must have the same size" ); + CV_Error( cv::Error::StsUnmatchedSizes, "All the input and output images must have the same size" ); if( (CV_MAT_TYPE(input_img->type) != CV_8U && CV_MAT_TYPE(input_img->type) != CV_16U && CV_MAT_TYPE(input_img->type) != CV_32F && CV_MAT_TYPE(input_img->type) != CV_8UC3) || !CV_ARE_TYPES_EQ(input_img,output_img) ) - CV_Error( CV_StsUnsupportedFormat, + CV_Error( cv::Error::StsUnsupportedFormat, "8-bit, 16-bit unsigned or 32-bit float 1-channel and 8-bit 3-channel input/output images are supported" ); if( CV_MAT_TYPE(inpaint_mask->type) != CV_8UC1 ) - CV_Error( CV_StsUnsupportedFormat, "The mask must be 8-bit 1-channel image" ); + CV_Error( cv::Error::StsUnsupportedFormat, "The mask must be 8-bit 1-channel image" ); range = MAX(range,1); range = MIN(range,100); diff --git a/modules/stitching/src/motion_estimators.cpp b/modules/stitching/src/motion_estimators.cpp index dfe929f9ba..8d227409ca 100644 --- a/modules/stitching/src/motion_estimators.cpp +++ b/modules/stitching/src/motion_estimators.cpp @@ -962,7 +962,7 @@ void waveCorrect(std::vector &rmats, WaveCorrectKind kind) else if (kind == WAVE_CORRECT_VERT) rg1 = eigen_vecs.row(0).t(); else - CV_Error(CV_StsBadArg, "unsupported kind of wave correction"); + CV_Error(cv::Error::StsBadArg, "unsupported kind of wave correction"); Mat img_k = Mat::zeros(3, 1, CV_32F); for (size_t i = 0; i < rmats.size(); ++i) diff --git a/modules/ts/src/ts.cpp b/modules/ts/src/ts.cpp index e5d36b435b..2d795cd3a2 100644 --- a/modules/ts/src/ts.cpp +++ b/modules/ts/src/ts.cpp @@ -643,7 +643,7 @@ void TS::update_context( BaseTest* test, int test_case_idx, bool update_ts_conte current_test_info.test = test; current_test_info.test_case_idx = test_case_idx; current_test_info.code = 0; - cvSetErrStatus( CV_StsOk ); + cvSetErrStatus( cv::Error::StsOk ); } diff --git a/modules/videoio/src/cap_mjpeg_encoder.cpp b/modules/videoio/src/cap_mjpeg_encoder.cpp index 2e7452cf17..2bb01f4a81 100644 --- a/modules/videoio/src/cap_mjpeg_encoder.cpp +++ b/modules/videoio/src/cap_mjpeg_encoder.cpp @@ -95,7 +95,7 @@ static bool createEncodeHuffmanTable( const int* src, unsigned* table, int max_s if( size > max_size ) { - CV_Error(CV_StsOutOfRange, "too big maximum Huffman code size"); + CV_Error(cv::Error::StsOutOfRange, "too big maximum Huffman code size"); } memset( table, 0, size*sizeof(table[0])); @@ -487,7 +487,7 @@ public: colorspace = COLORSPACE_YUV444P; } else - CV_Error(CV_StsBadArg, "Invalid combination of specified video colorspace and the input image colorspace"); + CV_Error(cv::Error::StsBadArg, "Invalid combination of specified video colorspace and the input image colorspace"); if( !rawstream ) { int avi_index = container.getAVIIndex(0, dc); diff --git a/modules/videoio/src/cap_msmf.cpp b/modules/videoio/src/cap_msmf.cpp index 93545c615e..d4afa23440 100644 --- a/modules/videoio/src/cap_msmf.cpp +++ b/modules/videoio/src/cap_msmf.cpp @@ -707,7 +707,7 @@ public: if (FAILED(MFCreateAttributes(&attr, 1)) || FAILED(attr->SetGUID(MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE, sourceType))) { - CV_Error(CV_StsError, "Failed to create attributes"); + CV_Error(cv::Error::StsError, "Failed to create attributes"); } if (FAILED(MFEnumDeviceSources(attr.Get(), &devices, &count))) { @@ -961,14 +961,14 @@ _ComPtr CvCapture_MSMF::getDefaultSourceConfig(UINT32 num) FAILED(res->SetUINT32(MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING, true)) ) { - CV_Error(CV_StsError, "Failed to create attributes"); + CV_Error(cv::Error::StsError, "Failed to create attributes"); } #ifdef HAVE_MSMF_DXVA if (D3DMgr) { if (FAILED(res->SetUnknown(MF_SOURCE_READER_D3D_MANAGER, D3DMgr.Get()))) { - CV_Error(CV_StsError, "Failed to create attributes"); + CV_Error(cv::Error::StsError, "Failed to create attributes"); } } #endif diff --git a/modules/videoio/src/cap_openni2.cpp b/modules/videoio/src/cap_openni2.cpp index 034509cdf7..214cc1a559 100644 --- a/modules/videoio/src/cap_openni2.cpp +++ b/modules/videoio/src/cap_openni2.cpp @@ -90,7 +90,7 @@ private: openni::Status status = openni::OpenNI::initialize(); if (status != openni::STATUS_OK) { - CV_Error(CV_StsError, std::string("Failed to initialize:") + openni::OpenNI::getExtendedError()); + CV_Error(cv::Error::StsError, std::string("Failed to initialize:") + openni::OpenNI::getExtendedError()); } } @@ -274,7 +274,7 @@ CvCapture_OpenNI2::CvCapture_OpenNI2(int index, const char * filename) : deviceURI = ldevs[index].getUri(); else { - CV_Error(CV_StsError, "OpenCVKinect2: Device index exceeds the number of available OpenNI devices"); + CV_Error(cv::Error::StsError, "OpenCVKinect2: Device index exceeds the number of available OpenNI devices"); } } } @@ -287,7 +287,7 @@ CvCapture_OpenNI2::CvCapture_OpenNI2(int index, const char * filename) : status = device.open(deviceURI); if (status != openni::STATUS_OK) { - CV_Error(CV_StsError, std::string("OpenCVKinect2: Failed to open device: ") + openni::OpenNI::getExtendedError()); + CV_Error(cv::Error::StsError, std::string("OpenCVKinect2: Failed to open device: ") + openni::OpenNI::getExtendedError()); } toggleStream(CV_DEPTH_STREAM, true); @@ -361,7 +361,7 @@ void CvCapture_OpenNI2::toggleStream(int stream, bool toggle) if (status != openni::STATUS_OK) { streams[stream].destroy(); - CV_Error(CV_StsError, std::string("OpenCVKinect2 : Couldn't set ") + + CV_Error(cv::Error::StsError, std::string("OpenCVKinect2 : Couldn't set ") + stream_names[stream] + std::string(" stream output mode: ") + std::string(openni::OpenNI::getExtendedError())); } @@ -373,14 +373,14 @@ void CvCapture_OpenNI2::toggleStream(int stream, bool toggle) if (status != openni::STATUS_OK) { streams[stream].destroy(); - CV_Error(CV_StsError, std::string("CvCapture_OpenNI2::CvCapture_OpenNI2 : Couldn't start ") + + CV_Error(cv::Error::StsError, std::string("CvCapture_OpenNI2::CvCapture_OpenNI2 : Couldn't start ") + stream_names[stream] + std::string(" stream: ") + std::string(openni::OpenNI::getExtendedError())); } } else { - CV_Error(CV_StsError, std::string("CvCapture_OpenNI2::CvCapture_OpenNI2 : Couldn't find ") + + CV_Error(cv::Error::StsError, std::string("CvCapture_OpenNI2::CvCapture_OpenNI2 : Couldn't find ") + stream_names[stream] + " stream: " + std::string(openni::OpenNI::getExtendedError())); } @@ -1026,7 +1026,7 @@ inline void getBGRImageFromMetaData( const openni::VideoFrameRef& imageMetaData, { cv::Mat bufferImage; if( imageMetaData.getVideoMode().getPixelFormat() != openni::PIXEL_FORMAT_RGB888 ) - CV_Error( CV_StsUnsupportedFormat, "Unsupported format of grabbed image." ); + CV_Error( cv::Error::StsUnsupportedFormat, "Unsupported format of grabbed image." ); bgrImage.create(imageMetaData.getHeight(), imageMetaData.getWidth(), CV_8UC3); bufferImage.create(imageMetaData.getHeight(), imageMetaData.getWidth(), CV_8UC3); @@ -1049,7 +1049,7 @@ inline void getGrayImageFromMetaData(const openni::VideoFrameRef& imageMetaData, } else { - CV_Error(CV_StsUnsupportedFormat, "Unsupported format of grabbed image."); + CV_Error(cv::Error::StsUnsupportedFormat, "Unsupported format of grabbed image."); } }