Partially back-port #25075 to 4.x

This commit is contained in:
Alexander Smorkalov 2024-03-04 15:51:05 +03:00
parent ef611df09b
commit daa8f7dfc6
111 changed files with 1124 additions and 1124 deletions

View File

@ -86,10 +86,10 @@ static CvMat* cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, b
int* dsti; int* dsti;
if( !CV_IS_MAT(idx_arr) ) 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 ) 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; idx_total = idx_arr->rows + idx_arr->cols - 1;
srcb = idx_arr->data.ptr; 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 - // idx_arr is array of 1's and 0's -
// i.e. it is a mask of the selected components // i.e. it is a mask of the selected components
if( idx_total != data_arr_size ) 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" ); "Component mask should contain as many elements as the total number of input variables" );
for( i = 0; i < idx_total; i++ ) for( i = 0; i < idx_total; i++ )
idx_selected += srcb[i*step] != 0; idx_selected += srcb[i*step] != 0;
if( idx_selected == 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; break;
case CV_32SC1: case CV_32SC1:
// idx_arr is array of integer indices of selected components // idx_arr is array of integer indices of selected components
if( idx_total > data_arr_size ) 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" ); "index array may not contain more elements than the total number of input variables" );
idx_selected = idx_total; idx_selected = idx_total;
// check if sorted already // check if sorted already
@ -134,7 +134,7 @@ static CvMat* cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, b
} }
break; break;
default: 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)" ); "(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 ); qsort( dsti, idx_total, sizeof(dsti[0]), icvCmpIntegers );
if( dsti[0] < 0 || dsti[idx_total-1] >= data_arr_size ) 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 ) if( check_for_duplicates )
{ {
for( i = 1; i < idx_total; i++ ) for( i = 1; i < idx_total; i++ )
if( dsti[i] <= dsti[i-1] ) 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_LOGIT_BOOST ) ? CvBoost::LOGIT :
!boostTypeStr.compare( CC_GENTLE_BOOST ) ? CvBoost::GENTLE : -1; !boostTypeStr.compare( CC_GENTLE_BOOST ) ? CvBoost::GENTLE : -1;
if (boost_type == -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_MINHITRATE] >> minHitRate;
node[CC_MAXFALSEALARM] >> maxFalseAlarm; node[CC_MAXFALSEALARM] >> maxFalseAlarm;
node[CC_TRIM_RATE] >> weight_trim_rate ; node[CC_TRIM_RATE] >> weight_trim_rate ;
@ -228,7 +228,7 @@ bool CvCascadeBoostParams::read( const FileNode &node )
maxFalseAlarm <= 0 || maxFalseAlarm > 1 || maxFalseAlarm <= 0 || maxFalseAlarm > 1 ||
weight_trim_rate <= 0 || weight_trim_rate > 1 || weight_trim_rate <= 0 || weight_trim_rate > 1 ||
max_depth <= 0 || weak_count <= 0 ) max_depth <= 0 || weak_count <= 0 )
CV_Error( CV_StsBadArg, "bad parameters range"); CV_Error( cv::Error::StsBadArg, "bad parameters range");
return true; return true;
} }
@ -309,7 +309,7 @@ CvDTreeNode* CvCascadeBoostTrainData::subsample_data( const CvMat* _subsample_id
bool isMakeRootCopy = true; bool isMakeRootCopy = true;
if( !data_root ) 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 ) if( _subsample_idx )
{ {
@ -547,7 +547,7 @@ void CvCascadeBoostTrainData::setData( const CvFeatureEvaluator* _featureEvaluat
// TODO: check responses: elements must be 0 or 1 // TODO: check responses: elements must be 0 or 1
if( _precalcValBufSize < 0 || _precalcIdxBufSize < 0) 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(); var_count = var_all = featureEvaluator->getNumFeatures() * featureEvaluator->getFeatureSize();
sample_count = _numSamples; 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) 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 ) if ( is_buf_16u )
@ -914,7 +914,7 @@ CvDTreeNode* CvCascadeBoostTree::predict( int sampleIdx ) const
{ {
CvDTreeNode* node = root; CvDTreeNode* node = root;
if( !node ) 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 if ( ((CvCascadeBoostTrainData*)data)->featureEvaluator->getMaxCatCount() == 0 ) // ordered
{ {

View File

@ -142,7 +142,7 @@ bool CvCascadeClassifier::train( const string _cascadeDirName,
double time = (double)getTickCount(); double time = (double)getTickCount();
if( _cascadeDirName.empty() || _posFilename.empty() || _negFilename.empty() ) 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; string dirName;
if (_cascadeDirName.find_last_of("/\\") == (_cascadeDirName.length() - 1) ) if (_cascadeDirName.find_last_of("/\\") == (_cascadeDirName.length() - 1) )
@ -452,7 +452,7 @@ void CvCascadeClassifier::save( const string filename, bool baseFormat )
//char buf[256]; //char buf[256];
CvSeq* weak; CvSeq* weak;
if ( cascadeParams.featureType != CvFeatureParams::HAAR ) 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_TYPE_ID;
fs << ICV_HAAR_SIZE_NAME << "[:" << cascadeParams.winSize.width << fs << ICV_HAAR_SIZE_NAME << "[:" << cascadeParams.winSize.width <<
cascadeParams.winSize.height << "]"; cascadeParams.winSize.height << "]";

View File

@ -138,7 +138,7 @@ bool CvCascadeImageReader::PosReader::create( const string _filename )
fread( &vecSize, sizeof( vecSize ), 1, file ) != 1 || fread( &vecSize, sizeof( vecSize ), 1, file ) != 1 ||
fread( &tmp, sizeof( tmp ), 1, file ) != 1 || fread( &tmp, sizeof( tmp ), 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 ); base = sizeof( count ) + sizeof( vecSize ) + 2*sizeof( tmp );
if( feof( file ) ) if( feof( file ) )
return false; return false;
@ -154,14 +154,14 @@ bool CvCascadeImageReader::PosReader::get( Mat &_img )
uchar tmp = 0; uchar tmp = 0;
size_t elements_read = fread( &tmp, sizeof( tmp ), 1, file ); size_t elements_read = fread( &tmp, sizeof( tmp ), 1, file );
if( elements_read != 1 ) 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"); "insufficient count of samples in given vec-file.\n");
elements_read = fread( vec, sizeof( vec[0] ), vecSize, file ); elements_read = fread( vec, sizeof( vec[0] ), vecSize, file );
if( elements_read != (size_t)(vecSize) ) 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 ) 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++ ) for( int r = 0; r < _img.rows; r++ )
{ {

View File

@ -991,7 +991,7 @@ CvBoost::set_params( const CvBoostParams& _params )
params = _params; params = _params;
if( params.boost_type != DISCRETE && params.boost_type != REAL && if( params.boost_type != DISCRETE && params.boost_type != REAL &&
params.boost_type != LOGIT && params.boost_type != GENTLE ) 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.weak_count = MAX( params.weak_count, 1 );
params.weight_trim_rate = MAX( params.weight_trim_rate, 0. ); 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 ); _sample_idx, _var_type, _missing_mask, _params, true, true );
if( data->get_num_classes() != 2 ) 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." ); "Boosted trees can only be used for 2-class classification." );
CV_CALL( storage = cvCreateMemStorage() ); CV_CALL( storage = cvCreateMemStorage() );
weak = cvCreateSeq( 0, sizeof(CvSeq), sizeof(CvBoostTree*), storage ); weak = cvCreateSeq( 0, sizeof(CvSeq), sizeof(CvBoostTree*), storage );
@ -1482,7 +1482,7 @@ CvBoost::get_active_vars( bool absolute_idx )
__BEGIN__; __BEGIN__;
if( !weak ) 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 ) if( !active_vars || !active_vars_abs )
{ {
@ -1612,13 +1612,13 @@ CvBoost::predict( const CvMat* _sample, const CvMat* _missing,
const float* sample_data; const float* sample_data;
if( !weak ) 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 || if( !CV_IS_MAT(_sample) || CV_MAT_TYPE(_sample->type) != CV_32FC1 ||
(_sample->cols != 1 && _sample->rows != 1) || (_sample->cols != 1 && _sample->rows != 1) ||
(_sample->cols + _sample->rows - 1 != data->var_all && !raw_mode) || (_sample->cols + _sample->rows - 1 != data->var_all && !raw_mode) ||
(active_vars && _sample->cols + _sample->rows - 1 != active_vars->cols && 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 " "the input sample must be 1d floating-point vector with the same "
"number of elements as the total number of variables or " "number of elements as the total number of variables or "
"as the number of variables used for training" ); "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) || if( !CV_IS_MAT(_missing) || !CV_IS_MASK_ARR(_missing) ||
!CV_ARE_SIZES_EQ(_missing, _sample) ) !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" ); "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 || CV_MAT_TYPE(weak_responses->type) != CV_32FC1 ||
(weak_responses->cols != 1 && weak_responses->rows != 1) || (weak_responses->cols != 1 && weak_responses->rows != 1) ||
weak_responses->cols + weak_responses->rows - 1 != weak_count ) 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 " "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" ); "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); 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; c = a;
int ival = cvRound(val); int ival = cvRound(val);
if ( (ival != val) && (!m) ) if ( (ival != val) && (!m) )
CV_Error( CV_StsBadArg, CV_Error( cv::Error::StsBadArg,
"one of input categorical variable is not an integer" ); "one of input categorical variable is not an integer" );
while( a < b ) while( a < b )
@ -1735,7 +1735,7 @@ CvBoost::predict( const CvMat* _sample, const CvMat* _missing,
else else
{ {
if( !CV_IS_MAT_CONT(_sample->type & (_missing ? _missing->type : -1)) ) 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 ); cvStartReadSeq( weak, &reader );
@ -1951,7 +1951,7 @@ void CvBoost::read_params( cv::FileNode& fnode )
params.boost_type = temp.empty() ? -1 : (int)temp; params.boost_type = temp.empty() ? -1 : (int)temp;
if( params.boost_type < DISCRETE || params.boost_type > GENTLE ) 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" ]; temp = fnode[ "splitting_criteria" ];
if( !temp.empty() && temp.isString() ) if( !temp.empty() && temp.isString() )
@ -1966,7 +1966,7 @@ void CvBoost::read_params( cv::FileNode& fnode )
params.split_criteria = temp.empty() ? -1 : (int) temp; params.split_criteria = temp.empty() ? -1 : (int) temp;
if( params.split_criteria < DEFAULT || params.boost_type > SQERR ) 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.weak_count = (int) fnode[ "ntrees" ];
params.weight_trim_rate = (double)fnode["weight_trimming_rate"]; params.weight_trim_rate = (double)fnode["weight_trimming_rate"];
@ -1996,13 +1996,13 @@ CvBoost::read( cv::FileNode& node )
trees_fnode = node[ "trees" ]; trees_fnode = node[ "trees" ];
if( trees_fnode.empty() || !trees_fnode.isSeq() ) if( trees_fnode.empty() || !trees_fnode.isSeq() )
CV_ERROR( CV_StsParseError, "<trees> tag is missing" ); CV_ERROR( cv::Error::StsParseError, "<trees> tag is missing" );
reader = trees_fnode.begin(); reader = trees_fnode.begin();
ntrees = (int) trees_fnode.size(); ntrees = (int) trees_fnode.size();
if( ntrees != params.weak_count ) if( ntrees != params.weak_count )
CV_ERROR( CV_StsUnmatchedSizes, CV_ERROR( cv::Error::StsUnmatchedSizes,
"The number of trees stored does not match <ntrees> tag value" ); "The number of trees stored does not match <ntrees> tag value" );
CV_CALL( storage = cvCreateMemStorage() ); 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 ); fs.startWriteStruct( name, cv::FileNode::MAP, CV_TYPE_NAME_ML_BOOSTING );
if( !weak ) 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 ); write_params( fs );
fs.startWriteStruct( "trees", cv::FileNode::SEQ ); fs.startWriteStruct( "trees", cv::FileNode::SEQ );

View File

@ -284,7 +284,7 @@ const CvMat* CvMLData::get_missing() const
__BEGIN__; __BEGIN__;
if ( !values ) if ( !values )
CV_ERROR( CV_StsInternal, "data is empty" ); CV_ERROR( cv::Error::StsInternal, "data is empty" );
__END__; __END__;
@ -331,7 +331,7 @@ void CvMLData::set_delimiter(char ch)
__BEGIN__; __BEGIN__;
if (ch == miss_ch /*|| ch == flt_separator*/) 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; delimiter = ch;
@ -349,7 +349,7 @@ void CvMLData::set_miss_ch(char ch)
__BEGIN__; __BEGIN__;
if (ch == delimiter/* || ch == flt_separator*/) 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; miss_ch = ch;
@ -367,10 +367,10 @@ void CvMLData::set_response_idx( int idx )
__BEGIN__; __BEGIN__;
if ( !values ) if ( !values )
CV_ERROR( CV_StsInternal, "data is empty" ); CV_ERROR( cv::Error::StsInternal, "data is empty" );
if ( idx >= values->cols) 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 ) if ( response_idx >= 0 )
chahge_var_idx( response_idx, true ); chahge_var_idx( response_idx, true );
@ -387,7 +387,7 @@ int CvMLData::get_response_idx() const
__BEGIN__; __BEGIN__;
if ( !values ) if ( !values )
CV_ERROR( CV_StsInternal, "data is empty" ); CV_ERROR( cv::Error::StsInternal, "data is empty" );
__END__; __END__;
return response_idx; return response_idx;
} }
@ -400,19 +400,19 @@ void CvMLData::change_var_type( int var_idx, int type )
int var_count = 0; int var_count = 0;
if ( !values ) if ( !values )
CV_ERROR( CV_StsInternal, "data is empty" ); CV_ERROR( cv::Error::StsInternal, "data is empty" );
var_count = values->cols; var_count = values->cols;
if ( var_idx < 0 || var_idx >= var_count) 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) 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 ); assert( var_types );
if ( var_types->data.ptr[var_idx] == CV_VAR_CATEGORICAL && type == CV_VAR_ORDERED) 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; var_types->data.ptr[var_idx] = (uchar)type;
__END__; __END__;
@ -428,7 +428,7 @@ void CvMLData::set_var_types( const char* str )
const char* ord = 0, *cat = 0; const char* ord = 0, *cat = 0;
int var_count = 0, set_var_type_count = 0; int var_count = 0, set_var_type_count = 0;
if ( !values ) if ( !values )
CV_ERROR( CV_StsInternal, "data is empty" ); CV_ERROR( cv::Error::StsInternal, "data is empty" );
var_count = values->cols; var_count = values->cols;
@ -437,7 +437,7 @@ void CvMLData::set_var_types( const char* str )
ord = strstr( str, "ord" ); ord = strstr( str, "ord" );
cat = strstr( str, "cat" ); cat = strstr( str, "cat" );
if ( !ord && !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" if ( !ord && strlen(cat) == 3 ) // str == "cat"
{ {
@ -455,19 +455,19 @@ void CvMLData::set_var_types( const char* str )
{ {
char* stopstring = NULL; char* stopstring = NULL;
if ( ord[3] != '[') 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[" ord += 4; // pass "ord["
do do
{ {
int b1 = (int)strtod( ord, &stopstring ); int b1 = (int)strtod( ord, &stopstring );
if ( *stopstring == 0 || (*stopstring != ',' && *stopstring != ']' && *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; ord = stopstring + 1;
if ( (stopstring[0] == ',') || (stopstring[0] == ']')) if ( (stopstring[0] == ',') || (stopstring[0] == ']'))
{ {
if ( var_types->data.ptr[b1] == CV_VAR_CATEGORICAL) 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; var_types->data.ptr[b1] = CV_VAR_ORDERED;
set_var_type_count++; set_var_type_count++;
} }
@ -477,39 +477,39 @@ void CvMLData::set_var_types( const char* str )
{ {
int b2 = (int)strtod( ord, &stopstring); int b2 = (int)strtod( ord, &stopstring);
if ( (*stopstring == 0) || (*stopstring != ',' && *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; ord = stopstring + 1;
for (int i = b1; i <= b2; i++) for (int i = b1; i <= b2; i++)
{ {
if ( var_types->data.ptr[i] == CV_VAR_CATEGORICAL) 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; var_types->data.ptr[i] = CV_VAR_ORDERED;
} }
set_var_type_count += b2 - b1 + 1; set_var_type_count += b2 - b1 + 1;
} }
else else
CV_ERROR( CV_StsBadArg, "types string is not correct" ); CV_ERROR( cv::Error::StsBadArg, "types string is not correct" );
} }
} }
while (*stopstring != ']'); while (*stopstring != ']');
if ( stopstring[1] != '\0' && stopstring[1] != ',') 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 if ( cat ) // parse cat str
{ {
char* stopstring = NULL; char* stopstring = NULL;
if ( cat[3] != '[') 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[" cat += 4; // pass "cat["
do do
{ {
int b1 = (int)strtod( cat, &stopstring ); int b1 = (int)strtod( cat, &stopstring );
if ( *stopstring == 0 || (*stopstring != ',' && *stopstring != ']' && *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; cat = stopstring + 1;
if ( (stopstring[0] == ',') || (stopstring[0] == ']')) if ( (stopstring[0] == ',') || (stopstring[0] == ']'))
{ {
@ -522,25 +522,25 @@ void CvMLData::set_var_types( const char* str )
{ {
int b2 = (int)strtod( cat, &stopstring); int b2 = (int)strtod( cat, &stopstring);
if ( (*stopstring == 0) || (*stopstring != ',' && *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; cat = stopstring + 1;
for (int i = b1; i <= b2; i++) for (int i = b1; i <= b2; i++)
var_types->data.ptr[i] = CV_VAR_CATEGORICAL; var_types->data.ptr[i] = CV_VAR_CATEGORICAL;
set_var_type_count += b2 - b1 + 1; set_var_type_count += b2 - b1 + 1;
} }
else else
CV_ERROR( CV_StsBadArg, "types string is not correct" ); CV_ERROR( cv::Error::StsBadArg, "types string is not correct" );
} }
} }
while (*stopstring != ']'); while (*stopstring != ']');
if ( stopstring[1] != '\0' && stopstring[1] != ',') 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) 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__; __END__;
} }
@ -553,7 +553,7 @@ const CvMat* CvMLData::get_var_types()
uchar *var_types_out_ptr = 0; uchar *var_types_out_ptr = 0;
int avcount, vt_size; int avcount, vt_size;
if ( !values ) if ( !values )
CV_ERROR( CV_StsInternal, "data is empty" ); CV_ERROR( cv::Error::StsInternal, "data is empty" );
assert( var_idx_mask ); assert( var_idx_mask );
@ -597,7 +597,7 @@ const CvMat* CvMLData::get_responses()
int var_count = 0; int var_count = 0;
if ( !values ) if ( !values )
CV_ERROR( CV_StsInternal, "data is empty" ); CV_ERROR( cv::Error::StsInternal, "data is empty" );
var_count = values->cols; var_count = values->cols;
if ( response_idx < 0 || response_idx >= var_count ) 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; int sample_count = 0;
if ( !values ) if ( !values )
CV_ERROR( CV_StsInternal, "data is empty" ); CV_ERROR( cv::Error::StsInternal, "data is empty" );
sample_count = values->rows; 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; train_sample_count = spl->train_sample_part.count;
if (train_sample_count > sample_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; train_sample_count = train_sample_count<=0 ? sample_count : train_sample_count;
} }
else // dtype.train_sample_part_mode == CV_PORTION else // dtype.train_sample_part_mode == CV_PORTION
{ {
train_sample_portion = spl->train_sample_part.portion; train_sample_portion = spl->train_sample_part.portion;
if ( train_sample_portion > 1) 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 || train_sample_portion = train_sample_portion <= FLT_EPSILON ||
1 - train_sample_portion <= FLT_EPSILON ? 1 : train_sample_portion; 1 - train_sample_portion <= FLT_EPSILON ? 1 : train_sample_portion;
train_sample_count = std::max(1, cvFloor( train_sample_portion * sample_count )); 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__; __BEGIN__;
if ( !values ) if ( !values )
CV_ERROR( CV_StsInternal, "data is empty" ); CV_ERROR( cv::Error::StsInternal, "data is empty" );
__END__; __END__;
return train_sample_idx; return train_sample_idx;
@ -692,7 +692,7 @@ const CvMat* CvMLData::get_test_sample_idx() const
__BEGIN__; __BEGIN__;
if ( !values ) if ( !values )
CV_ERROR( CV_StsInternal, "data is empty" ); CV_ERROR( cv::Error::StsInternal, "data is empty" );
__END__; __END__;
return test_sample_idx; return test_sample_idx;
@ -704,7 +704,7 @@ void CvMLData::mix_train_and_test_idx()
__BEGIN__; __BEGIN__;
if ( !values ) if ( !values )
CV_ERROR( CV_StsInternal, "data is empty" ); CV_ERROR( cv::Error::StsInternal, "data is empty" );
__END__; __END__;
if ( !sample_idx) if ( !sample_idx)
@ -731,7 +731,7 @@ const CvMat* CvMLData::get_var_idx()
int avcount = 0; int avcount = 0;
if ( !values ) if ( !values )
CV_ERROR( CV_StsInternal, "data is empty" ); CV_ERROR( cv::Error::StsInternal, "data is empty" );
assert( var_idx_mask ); assert( var_idx_mask );
@ -776,12 +776,12 @@ void CvMLData::change_var_idx( int vi, bool state )
int var_count = 0; int var_count = 0;
if ( !values ) if ( !values )
CV_ERROR( CV_StsInternal, "data is empty" ); CV_ERROR( cv::Error::StsInternal, "data is empty" );
var_count = values->cols; var_count = values->cols;
if ( vi < 0 || vi >= var_count) 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 ); assert( var_idx_mask );
var_idx_mask->data.ptr[vi] = state; var_idx_mask->data.ptr[vi] = state;

View File

@ -67,7 +67,7 @@ void CvStatModel::save( const char* filename, const char* name ) const
__BEGIN__; __BEGIN__;
if( !fs.open( filename, cv::FileStorage::WRITE )) 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 ); write( fs, name ? name : default_model_name );
@ -87,7 +87,7 @@ void CvStatModel::load( const char* filename, const char* name )
cv::FileNode model_node; cv::FileNode model_node;
if( !fs.open(filename, cv::FileStorage::READ) ) 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 ) if( name )
model_node = fs[ 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 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& ) 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, 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) ) if( _centers && !ICV_IS_MAT_OF_TYPE (_centers, CV_32FC1) )
{ {
CV_ERROR(CV_StsBadArg,""); CV_ERROR(cv::Error::StsBadArg,"");
} }
else if( !_centers ) else if( !_centers )
CV_CALL(centers = cvCreateMat (num_of_clusters, dim, CV_32FC1)); 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) ) if( _centers && !ICV_IS_MAT_OF_TYPE (_centers, CV_64FC1) )
{ {
CV_ERROR(CV_StsBadArg,""); CV_ERROR(cv::Error::StsBadArg,"");
} }
else if( !_centers ) else if( !_centers )
CV_CALL(centers = cvCreateMat (num_of_clusters, dim, CV_64FC1)); CV_CALL(centers = cvCreateMat (num_of_clusters, dim, CV_64FC1));
} }
else else
CV_ERROR (CV_StsBadArg,""); CV_ERROR (cv::Error::StsBadArg,"");
if( num_of_clusters < 1 ) if( num_of_clusters < 1 )
CV_ERROR (CV_StsBadArg,""); CV_ERROR (cv::Error::StsBadArg,"");
rng = cvRNG(seed); rng = cvRNG(seed);
for (i = 0; i < dim; i++) for (i = 0; i < dim; i++)
@ -208,10 +208,10 @@ cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, bool check_for_
int* dsti; int* dsti;
if( !CV_IS_MAT(idx_arr) ) 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 ) 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; idx_total = idx_arr->rows + idx_arr->cols - 1;
srcb = idx_arr->data.ptr; 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 - // idx_arr is array of 1's and 0's -
// i.e. it is a mask of the selected components // i.e. it is a mask of the selected components
if( idx_total != data_arr_size ) 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" ); "Component mask should contain as many elements as the total number of input variables" );
for( i = 0; i < idx_total; i++ ) for( i = 0; i < idx_total; i++ )
idx_selected += srcb[i*step] != 0; idx_selected += srcb[i*step] != 0;
if( idx_selected == 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; break;
case CV_32SC1: case CV_32SC1:
// idx_arr is array of integer indices of selected components // idx_arr is array of integer indices of selected components
if( idx_total > data_arr_size ) 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" ); "index array may not contain more elements than the total number of input variables" );
idx_selected = idx_total; idx_selected = idx_total;
// check if sorted already // check if sorted already
@ -256,7 +256,7 @@ cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, bool check_for_
} }
break; break;
default: 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)" ); "(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 ); qsort( dsti, idx_total, sizeof(dsti[0]), icvCmpIntegers );
if( dsti[0] < 0 || dsti[idx_total-1] >= data_arr_size ) 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 ) if( check_for_duplicates )
{ {
for( i = 1; i < idx_total; i++ ) for( i = 1; i < idx_total; i++ )
if( dsti[i] <= dsti[i-1] ) 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; uchar* dst;
if( !CV_IS_MAT(var_type) ) 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 ) 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)) 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_size = var_type->rows + var_type->cols - 1;
tm_step = var_type->rows == 1 ? 1 : var_type->step/CV_ELEM_SIZE(var_type->type); 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 ) if( /*tm_size != var_count &&*/ tm_size != var_count + 1 )
CV_ERROR( CV_StsBadArg, CV_ERROR( cv::Error::StsBadArg,
"type mask must be of <input var count> + 1 size" ); "type mask must be of <input var count> + 1 size" );
if( response_type && tm_size > var_count ) 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 || 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) ) (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 ) 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; //map = var_idx->data.i;
var_count = var_idx->rows + var_idx->cols - 1; 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; int sample_count = sample_all;
if( !CV_IS_MAT(responses) ) 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 ) 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 ) 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" ); "Response array must contain as many elements as the total number of samples" );
r_type = CV_MAT_TYPE(responses->type); r_type = CV_MAT_TYPE(responses->type);
if( r_type != CV_32FC1 && r_type != CV_32SC1 ) 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; 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 || 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) ) (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 ) 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; map = sample_idx->data.i;
sample_count = sample_idx->rows + sample_idx->cols - 1; sample_count = sample_idx->rows + sample_idx->cols - 1;
} }
@ -466,18 +466,18 @@ cvPreprocessCategoricalResponses( const CvMat* responses,
int sample_count = sample_all; int sample_count = sample_all;
if( !CV_IS_MAT(responses) ) 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 ) 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 ) 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" ); "Response array must contain as many elements as the total number of samples" );
r_type = CV_MAT_TYPE(responses->type); r_type = CV_MAT_TYPE(responses->type);
if( r_type != CV_32FC1 && r_type != CV_32SC1 ) 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); 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 || 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) ) (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 ) 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; map = sample_idx->data.i;
sample_count = sample_idx->rows + sample_idx->cols - 1; 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 )); CV_CALL( out_responses = cvCreateMat( 1, sample_count, CV_32SC1 ));
if( !out_response_map ) 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]))); CV_CALL( response_ptr = (int**)cvAlloc( sample_count*sizeof(response_ptr[0])));
@ -517,7 +517,7 @@ cvPreprocessCategoricalResponses( const CvMat* responses,
{ {
char buf[100]; char buf[100];
snprintf( buf, sizeof(buf), "response #%d is not integral", idx ); snprintf( buf, sizeof(buf), "response #%d is not integral", idx );
CV_ERROR( CV_StsBadArg, buf ); CV_ERROR( cv::Error::StsBadArg, buf );
} }
dst[i] = ri; dst[i] = ri;
} }
@ -531,7 +531,7 @@ cvPreprocessCategoricalResponses( const CvMat* responses,
cls_count += *response_ptr[i] != *response_ptr[i-1]; cls_count += *response_ptr[i] != *response_ptr[i-1];
if( cls_count < 2 ) 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 )); 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; const int *s_idx, *v_idx;
if( !CV_IS_MAT(train_data) ) 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 : var_count = var_idx ? var_idx->cols + var_idx->rows - 1 :
tflag == CV_ROW_SAMPLE ? train_data->cols : train_data->rows; 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 // check parameter types and sizes
if( !CV_IS_MAT(train_data) || CV_MAT_TYPE(train_data->type) != CV_32FC1 ) 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( missing_mask )
{ {
if( !CV_IS_MAT(missing_mask) || !CV_IS_MASK_ARR(missing_mask) || if( !CV_IS_MAT(missing_mask) || !CV_IS_MASK_ARR(missing_mask) ||
!CV_ARE_SIZES_EQ(train_data, 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" ); "missing value mask must be 8-bit matrix of the same size as training data" );
} }
if( tflag != CV_ROW_SAMPLE && tflag != CV_COL_SAMPLE ) 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)" ); "Unknown training data layout (must be CV_ROW_SAMPLE or CV_COL_SAMPLE)" );
if( var_all ) if( var_all )
@ -736,7 +736,7 @@ cvPrepareTrainData( const char* /*funcname*/,
__BEGIN__; __BEGIN__;
if( !out_train_samples ) 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 )); CV_CALL( cvCheckTrainData( train_data, tflag, 0, &var_all, &sample_all ));
@ -748,7 +748,7 @@ cvPrepareTrainData( const char* /*funcname*/,
if( responses ) if( responses )
{ {
if( !out_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 ) if( response_type == CV_VAR_NUMERICAL )
{ {
@ -841,10 +841,10 @@ cvSortSamplesByClasses( const float** samples, const CvMat* classes,
int i, k = 0, sample_count; int i, k = 0, sample_count;
if( !samples || !classes || !class_ranges ) 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 ) 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; sample_count = classes->cols;
CV_CALL( pairs = (CvSampleResponsePair*)cvAlloc( (sample_count+1)*sizeof(pairs[0]))); 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; int vec_size;
if( !is_sparse && !CV_IS_MAT(sample) ) 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 ) 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 )); CV_CALL( d = cvGetDims( sample, sizes ));
if( !((is_sparse && d == 1) || (!is_sparse && d == 2 && (sample->rows == 1 || sample->cols == 1))) ) 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 ) if( d == 1 )
sizes[1] = 1; sizes[1] = 1;
if( sizes[0] + sizes[1] - 1 != dims_all ) 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" ); "The sample size is different from what has been used for training" );
if( !_row_sample ) 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 || if( comp_idx && (!CV_IS_MAT(comp_idx) || comp_idx->rows != 1 ||
CV_MAT_TYPE(comp_idx->type) != CV_32SC1) ) 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; dims_selected = comp_idx ? comp_idx->cols : dims_all;
if( prob ) if( prob )
{ {
if( !CV_IS_MAT(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) || if( (prob->rows != 1 && prob->cols != 1) ||
(CV_MAT_TYPE(prob->type) != CV_32FC1 && (CV_MAT_TYPE(prob->type) != CV_32FC1 &&
CV_MAT_TYPE(prob->type) != CV_64FC1) ) 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" ); "The matrix of probabilities must be 1-dimensional vector of 32fC1 type" );
if( prob->rows + prob->cols - 1 != class_count ) 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 vector of probabilities must contain as many elements as "
"the number of classes in the training set" ); "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); dst_type = CV_MAT_TYPE(dst_type);
if( CV_MAT_CN(src_type) != 1 || CV_MAT_CN(dst_type) != 1 ) 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 ) if( src_step == 0 )
src_step = CV_ELEM_SIZE(src_type); 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]; ((float*)_dst)[j] = (float)((double*)src)[j];
} }
else 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__; __END__;
} }
@ -1154,15 +1154,15 @@ cvWritebackLabels( const CvMat* labels, CvMat* dst_labels,
int samples_selected = samples_all, dims_selected = dims_all; int samples_selected = samples_all, dims_selected = dims_all;
if( dst_labels && !CV_IS_MAT(dst_labels) ) 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( dst_centers )
if( !ICV_IS_MAT_OF_TYPE(dst_centers, CV_32FC1) && if( !ICV_IS_MAT_OF_TYPE(dst_centers, CV_32FC1) &&
!ICV_IS_MAT_OF_TYPE(dst_centers, CV_64FC1) ) !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) ) 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 ) 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( dst_labels && (!labels || labels->data.ptr != dst_labels->data.ptr) )
{ {
if( !labels ) if( !labels )
CV_ERROR( CV_StsNullPtr, "NULL labels" ); CV_ERROR( cv::Error::StsNullPtr, "NULL labels" );
CV_ASSERT( labels->rows == 1 ); CV_ASSERT( labels->rows == 1 );
if( dst_labels->rows != 1 && dst_labels->cols != 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 ) 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" ); "Size of vector of output labels is not equal to the total number of input samples" );
CV_ASSERT( labels->cols == samples_selected ); CV_ASSERT( labels->cols == samples_selected );
@ -1202,13 +1202,13 @@ cvWritebackLabels( const CvMat* labels, CvMat* dst_labels,
int i; int i;
if( !centers ) if( !centers )
CV_ERROR( CV_StsNullPtr, "NULL centers" ); CV_ERROR( cv::Error::StsNullPtr, "NULL centers" );
if( centers->rows != dst_centers->rows ) 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 ) if( dst_centers->cols != dims_all )
CV_ERROR( CV_StsUnmatchedSizes, CV_ERROR( cv::Error::StsUnmatchedSizes,
"Number of columns in matrix of output centers is " "Number of columns in matrix of output centers is "
"not equal to the total number of components in the input samples" ); "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( dst_probs && (!probs || probs->data.ptr != dst_probs->data.ptr) )
{ {
if( !probs ) if( !probs )
CV_ERROR( CV_StsNullPtr, "NULL probs" ); CV_ERROR( cv::Error::StsNullPtr, "NULL probs" );
if( probs->cols != dst_probs->cols ) 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 ) if( dst_probs->rows != samples_all )
CV_ERROR( CV_StsUnmatchedSizes, CV_ERROR( cv::Error::StsUnmatchedSizes,
"Number of rows in output probability matrix is " "Number of rows in output probability matrix is "
"not equal to the total number of input samples" ); "not equal to the total number of input samples" );
@ -1273,29 +1273,29 @@ cvStatModelMultiPredict( const CvStatModel* stat_model,
CvMat* probs1 = probs ? &probs_part : 0; CvMat* probs1 = probs ? &probs_part : 0;
if( !CV_IS_STAT_MODEL(stat_model) ) 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 ) 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 ) 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) ) 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) ) 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 ); type = cvGetElemType( predict_input );
if( type != CV_32FC1 || if( type != CV_32FC1 ||
(CV_MAT_TYPE(predict_output->type) != CV_32FC1 && (CV_MAT_TYPE(predict_output->type) != CV_32FC1 &&
CV_MAT_TYPE(predict_output->type) != CV_32SC1 )) 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 )); CV_CALL( d = cvGetDims( predict_input, sizes ));
if( d > 2 ) 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 ) if( !tflag )
{ {
@ -1311,30 +1311,30 @@ cvStatModelMultiPredict( const CvStatModel* stat_model,
if( sample_idx ) if( sample_idx )
{ {
if( !CV_IS_MAT(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 ) 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; samples_selected = sample_idx->rows + sample_idx->cols - 1;
if( CV_MAT_TYPE(sample_idx->type) == CV_32SC1 ) if( CV_MAT_TYPE(sample_idx->type) == CV_32SC1 )
{ {
if( samples_selected > samples_all ) 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 ) 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 = sample_idx->step ?
sample_idx->step / CV_ELEM_SIZE(sample_idx->type) : 1; sample_idx->step / CV_ELEM_SIZE(sample_idx->type) : 1;
} }
if( predict_output->rows != 1 && predict_output->cols != 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 ) 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 = predict_output->step ?
predict_output->step / CV_ELEM_SIZE(predict_output->type) : 1; predict_output->step / CV_ELEM_SIZE(predict_output->type) : 1;
@ -1342,14 +1342,14 @@ cvStatModelMultiPredict( const CvStatModel* stat_model,
if( probs ) if( probs )
{ {
if( !CV_IS_MAT(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 ) 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" ); "matrix of probabilities must have as many rows as the total number of samples" );
if( CV_MAT_TYPE(probs->type) != CV_32FC1 ) 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 ) if( is_sparse )
@ -1414,7 +1414,7 @@ cvStatModelMultiPredict( const CvStatModel* stat_model,
{ {
idx = sample_idx->data.i[i*sample_idx_step]; idx = sample_idx->data.i[i*sample_idx_step];
if( (unsigned)idx >= (unsigned)samples_all ) 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 && else if( CV_MAT_TYPE(sample_idx->type) == CV_8UC1 &&
sample_idx->data.ptr[i*sample_idx_step] == 0 ) 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 (old_response_map, CV_32SC1)) ||
(!ICV_IS_MAT_OF_TYPE (new_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. // Prepare sorted responses.

View File

@ -70,7 +70,7 @@
/* Convert matrix to vector */ /* Convert matrix to vector */
#define ICV_MAT2VEC( mat, vdata, vstep, num ) \ #define ICV_MAT2VEC( mat, vdata, vstep, num ) \
if( MIN( (mat).rows, (mat).cols ) != 1 ) \ if( MIN( (mat).rows, (mat).cols ) != 1 ) \
CV_ERROR( CV_StsBadArg, "" ); \ CV_ERROR( cv::Error::StsBadArg, "" ); \
(vdata) = ((mat).data.ptr); \ (vdata) = ((mat).data.ptr); \
if( (mat).rows == 1 ) \ if( (mat).rows == 1 ) \
{ \ { \
@ -142,7 +142,7 @@
#define ICV_TRAIN_DATA_REQUIRED( param, flags ) \ #define ICV_TRAIN_DATA_REQUIRED( param, flags ) \
if( !ICV_IS_MAT_OF_TYPE( (param), CV_32FC1 ) ) \ 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 \ else \
{ \ { \
@ -154,21 +154,21 @@
#define ICV_TRAIN_CLASSES_REQUIRED( param ) \ #define ICV_TRAIN_CLASSES_REQUIRED( param ) \
if( !ICV_IS_MAT_OF_TYPE( (param), CV_32FC1 ) ) \ 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 \ else \
{ \ { \
ICV_MAT2VEC( *(param), classes, clstep, ncl ); \ ICV_MAT2VEC( *(param), classes, clstep, ncl ); \
if( m != ncl ) \ if( m != ncl ) \
{ \ { \
CV_ERROR( CV_StsBadArg, "Unmatched sizes" ); \ CV_ERROR( cv::Error::StsBadArg, "Unmatched sizes" ); \
} \ } \
} }
#define ICV_ARG_NULL( param ) \ #define ICV_ARG_NULL( param ) \
if( (param) != NULL ) \ 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 ) \ #define ICV_MISSED_MEASUREMENTS_OPTIONAL( param, flags ) \
@ -176,14 +176,14 @@
{ \ { \
if( !ICV_IS_MAT_OF_TYPE( param, CV_8UC1 ) ) \ 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 \ else \
{ \ { \
ICV_RAWDATA( *(param), (flags), missed, msstep, mcstep, mm, mn ); \ ICV_RAWDATA( *(param), (flags), missed, msstep, mcstep, mm, mn ); \
if( mm != m || mn != n ) \ 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 ) ) \ 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 \ else \
{ \ { \
ICV_MAT2VEC( *(param), cidx, cistep, k ); \ ICV_MAT2VEC( *(param), cidx, cistep, k ); \
if( k > n ) \ 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 ) ) \ 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 \ else \
{ \ { \
ICV_MAT2VEC( *sampleIdx, sidx, sistep, l ); \ ICV_MAT2VEC( *sampleIdx, sidx, sistep, l ); \
if( l > m ) \ if( l > m ) \
CV_ERROR( CV_StsBadArg, "Invalid " #param " parameter" ); \ CV_ERROR( cv::Error::StsBadArg, "Invalid " #param " parameter" ); \
} \ } \
} }

View File

@ -93,17 +93,17 @@ bool CvDTreeTrainData::set_params( const CvDTreeParams& _params )
params = _params; params = _params;
if( params.max_categories < 2 ) 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 ); params.max_categories = MIN( params.max_categories, 15 );
if( params.max_depth < 0 ) 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.max_depth = MIN( params.max_depth, 25 );
params.min_sample_count = MAX(params.min_sample_count,1); params.min_sample_count = MAX(params.min_sample_count,1);
if( params.cv_folds < 0 ) 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) " "params.cv_folds should be =0 (the tree is not pruned) "
"or n>0 (tree is pruned using n-fold cross-validation)" ); "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; params.cv_folds = 0;
if( params.regression_accuracy < 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; 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->var_type, var_type, CV_C ) < FLT_EPSILON &&
cvNorm( data->cat_count, cat_count, CV_C ) < FLT_EPSILON && cvNorm( data->cat_count, cat_count, CV_C ) < FLT_EPSILON &&
cvNorm( data->cat_map, cat_map, 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 " "The new training data must have the same types and the input and output variables "
"and the same categories for categorical 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) || CV_MAT_TYPE(_responses->type) != CV_32FC1) ||
(_responses->rows != 1 && _responses->cols != 1) || (_responses->rows != 1 && _responses->cols != 1) ||
_responses->rows + _responses->cols - 1 != sample_all ) _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 " "floating-point vector containing as many elements as "
"the total number of samples in the training data matrix" ); "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) 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( cv_n )
{ {
if( sample_count < cv_n*MAX(params.min_sample_count,10) ) 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" ); "The many folds in cross-validation for such a small dataset" );
cv_size = cvAlign( cv_n*(sizeof(int) + sizeof(double)*2), sizeof(double) ); 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) " snprintf( err, sizeof(err), "%d-th value of %d-th (categorical) "
"variable is not an integer", i, vi ); "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) " snprintf( err, sizeof(err), "%d-th value of %d-th (categorical) "
"variable is too large", i, vi ); "variable is too large", i, vi );
CV_ERROR( CV_StsBadArg, err ); CV_ERROR( cv::Error::StsBadArg, err );
} }
num_valid++; 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) " snprintf( err, sizeof(err), "%d-th value of %d-th (ordered) "
"variable (=%g) is too large", i, vi, val ); "variable (=%g) is too large", i, vi, val );
CV_ERROR( CV_StsBadArg, err ); CV_ERROR( cv::Error::StsBadArg, err );
} }
num_valid++; num_valid++;
} }
@ -652,7 +652,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag,
{ {
double val = have_priors ? params.priors[i] : 1.; double val = have_priors ? params.priors[i] : 1.;
if( val <= 0 ) 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; priors->data.db[i] = val;
sum += val; sum += val;
} }
@ -705,7 +705,7 @@ CvDTreeNode* CvDTreeTrainData::subsample_data( const CvMat* _subsample_idx )
__BEGIN__; __BEGIN__;
if( !data_root ) 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 ) if( _subsample_idx )
{ {
@ -1396,7 +1396,7 @@ void CvDTreeTrainData::read_params( const cv::FileNode& node )
auto tmat = cvMat( tparams_node[ "priors" ].mat() ); auto tmat = cvMat( tparams_node[ "priors" ].mat() );
priors = cvCloneMat( &tmat ); priors = cvCloneMat( &tmat );
if( !CV_IS_MAT(priors) ) 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 ); 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 != 1 && var_idx->rows != 1) ||
var_idx->cols + var_idx->rows - 1 != var_count || var_idx->cols + var_idx->rows - 1 != var_count ||
CV_MAT_TYPE(var_idx->type) != CV_32SC1 ) 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 <var_count> elements" ); "var_idx (if exist) must be valid 1d integer vector containing <var_count> elements" );
for( vi = 0; vi < var_count; vi++ ) for( vi = 0; vi < var_count; vi++ )
if( (unsigned)var_idx->data.i[vi] >= (unsigned)var_all ) 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 ////// read var type
@ -1434,7 +1434,7 @@ void CvDTreeTrainData::read_params( const cv::FileNode& node )
{ {
if( vartype_node.empty() || !vartype_node.isSeq() || if( vartype_node.empty() || !vartype_node.isSeq() ||
vartype_node.size() != (size_t) var_count ) 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(); reader = vartype_node.begin();
@ -1442,7 +1442,7 @@ void CvDTreeTrainData::read_params( const cv::FileNode& node )
{ {
cv::FileNode n = *reader; cv::FileNode n = *reader;
if( !n.isInt() || ((int) n & ~1) ) 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--; var_type->data.i[vi] = (int) n ? cat_var_count++ : ord_var_count--;
reader++; 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_count->cols + cat_count->rows - 1 != cat_var_count + is_classifier ||
(cat_map->cols != 1 && cat_map->rows != 1) || (cat_map->cols != 1 && cat_map->rows != 1) ||
CV_MAT_TYPE(cat_map->type) != CV_32SC1 ) 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" ); "Both cat_count and cat_map must exist and be valid 1d integer vectors of an appropriate size" );
ccount = cat_var_count + is_classifier; 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]; int val = cat_count->data.i[vi];
if( val <= 0 ) 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 ); max_c_count = MAX( max_c_count, val );
cat_ofs->data.i[vi+1] = total_c_count += val; cat_ofs->data.i[vi+1] = total_c_count += val;
} }
if( cat_map->cols + cat_map->rows - 1 != total_c_count ) 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" ); "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; CvDTreeNode* node = root;
if( !node ) 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 || if( !CV_IS_MAT(_sample) || CV_MAT_TYPE(_sample->type) != CV_32FC1 ||
(_sample->cols != 1 && _sample->rows != 1) || (_sample->cols != 1 && _sample->rows != 1) ||
(_sample->cols + _sample->rows - 1 != data->var_all && !preprocessed_input) || (_sample->cols + _sample->rows - 1 != data->var_all && !preprocessed_input) ||
(_sample->cols + _sample->rows - 1 != data->var_count && 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 " "the input sample must be 1d floating-point vector with the same "
"number of elements as the total number of variables used for training" ); "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) || if( !CV_IS_MAT(_missing) || !CV_IS_MASK_ARR(_missing) ||
!CV_ARE_SIZES_EQ(_missing, _sample) ) !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" ); "the missing data mask must be 8-bit vector of the same size as input sample" );
m = _missing->data.ptr; m = _missing->data.ptr;
mstep = CV_IS_MAT_CONT(_missing->type) ? 1 : _missing->step/sizeof(m[0]); 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); int ival = cvRound(val);
if( ival != val ) if( ival != val )
CV_Error( CV_StsBadArg, CV_Error( cv::Error::StsBadArg,
"one of input categorical variable is not an integer" ); "one of input categorical variable is not an integer" );
while( a < b ) while( a < b )
@ -3936,11 +3936,11 @@ CvDTreeSplit* CvDTree::read_split( const cv::FileNode& fnode )
int vi, ci; int vi, ci;
if( fnode.empty() || !fnode.isMap() ) 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" ]; vi = fnode[ "var" ].empty() ? -1 : (int) fnode[ "var" ];
if( (unsigned)vi >= (unsigned)data->var_count ) 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); ci = data->get_var_type(vi);
if( ci >= 0 ) // split on categorical var if( ci >= 0 ) // split on categorical var
@ -3957,14 +3957,14 @@ CvDTreeSplit* CvDTree::read_split( const cv::FileNode& fnode )
} }
if( inseq.empty() || if( inseq.empty() ||
(!inseq.isSeq() && !inseq.isInt())) (!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" ); "Either 'in' or 'not_in' tags should be inside a categorical split data" );
if( inseq.isInt() ) if( inseq.isInt() )
{ {
val = (int) inseq; val = (int) inseq;
if( (unsigned)val >= (unsigned)n ) 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); split->subset[val >> 5] |= 1 << (val & 31);
} }
@ -3977,7 +3977,7 @@ CvDTreeSplit* CvDTree::read_split( const cv::FileNode& fnode )
cv::FileNode inode = *reader; cv::FileNode inode = *reader;
val = (int) inode; val = (int) inode;
if( !inode.isInt() || (unsigned)val >= (unsigned)n ) 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); split->subset[val >> 5] |= 1 << (val & 31);
reader++; reader++;
@ -4025,12 +4025,12 @@ CvDTreeNode* CvDTree::read_node( const cv::FileNode& fnode, CvDTreeNode* parent
int i, depth; int i, depth;
if( fnode.empty() || !fnode.isMap() ) 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 )); CV_CALL( node = data->new_node( parent, 0, 0, 0 ));
depth = fnode[ "depth" ].empty() ? -1 : (int) fnode[ "depth" ]; depth = fnode[ "depth" ].empty() ? -1 : (int) fnode[ "depth" ];
if( depth != node->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->sample_count = (int) fnode[ "sample_count" ];
node->value = (double) fnode[ "value" ]; node->value = (double) fnode[ "value" ];
@ -4051,7 +4051,7 @@ CvDTreeNode* CvDTree::read_node( const cv::FileNode& fnode, CvDTreeNode* parent
CvDTreeSplit* last_split = 0; CvDTreeSplit* last_split = 0;
if( !splits.isSeq() ) 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(); reader = splits.begin();
for( i = 0; i < (int) (*reader).size(); i++ ) 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" ]; tree_nodes = node[ "nodes" ];
if( tree_nodes.empty() || !tree_nodes.isSeq() ) 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" ]; pruned_tree_idx = node[ "best_tree_idx" ].empty() ? -1 : node[ "best_tree_idx" ];
read_tree_nodes( tree_nodes ); read_tree_nodes( tree_nodes );

View File

@ -254,32 +254,32 @@ CV_IMPL int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian )
CvMat matJ = cvMat( 3, 9, CV_64F, J ); CvMat matJ = cvMat( 3, 9, CV_64F, J );
if( !CV_IS_MAT(src) ) 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) ) 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" ); "The first output argument is not a valid matrix" );
int depth = CV_MAT_DEPTH(src->type); int depth = CV_MAT_DEPTH(src->type);
int elem_size = CV_ELEM_SIZE(depth); int elem_size = CV_ELEM_SIZE(depth);
if( depth != CV_32F && depth != CV_64F ) 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) ) 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( jacobian )
{ {
if( !CV_IS_MAT(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 ) 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) && if( (jacobian->rows != 9 || jacobian->cols != 3) &&
(jacobian->rows != 3 || jacobian->cols != 9)) (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 ) 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; int step = src->rows > 1 ? src->step / elem_size : 1;
if( src->rows + src->cols*CV_MAT_CN(src->type) - 1 != 3 ) 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 ) 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; Point3d r;
if( depth == CV_32F ) 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) && if( (dst->rows != 1 || dst->cols*CV_MAT_CN(dst->type) != 3) &&
(dst->rows != 3 || dst->cols != 1 || CV_MAT_CN(dst->type) != 1)) (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); Matx33d R = cvarrToMat(src);
@ -490,7 +490,7 @@ CV_IMPL int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian )
} }
else 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 ) if( jacobian )
@ -553,13 +553,13 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
if( !CV_IS_MAT(objectPoints) || !CV_IS_MAT(r_vec) || if( !CV_IS_MAT(objectPoints) || !CV_IS_MAT(r_vec) ||
!CV_IS_MAT(t_vec) || !CV_IS_MAT(A) || !CV_IS_MAT(t_vec) || !CV_IS_MAT(A) ||
/*!CV_IS_MAT(distCoeffs) ||*/ !CV_IS_MAT(imagePoints) ) /*!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); int total = objectPoints->rows * objectPoints->cols * CV_MAT_CN(objectPoints->type);
if(total % 3 != 0) if(total % 3 != 0)
{ {
//we have stopped support of homogeneous coordinates because it cause ambiguity in interpretation of the input data //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; count = total / 3;
@ -576,7 +576,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
{ {
// matM = cvCreateMat( 1, count, CV_64FC3 ); // matM = cvCreateMat( 1, count, CV_64FC3 );
// cvConvertPointsHomogeneous( objectPoints, matM ); // 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) && if( CV_IS_CONT_MAT(imagePoints->type) &&
@ -591,7 +591,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
else else
{ {
// _m = cvCreateMat( 1, count, CV_64FC2 ); // _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; 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 != 1 && r_vec->cols != 1) ||
r_vec->rows*r_vec->cols*CV_MAT_CN(r_vec->type) != 3) && 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))) ((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" ); "floating-point rotation vector, or 3x3 rotation matrix" );
if( r_vec->rows == 3 && r_vec->cols == 3 ) 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) || 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 != 1 && t_vec->cols != 1) ||
t_vec->rows*t_vec->cols*CV_MAT_CN(t_vec->type) != 3 ) 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" ); "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 ); _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) || if( (CV_MAT_TYPE(A->type) != CV_64FC1 && CV_MAT_TYPE(A->type) != CV_32FC1) ||
A->rows != 3 || A->cols != 3 ) 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 ); cvConvert( A, &_a );
fx = a[0]; fy = a[4]; 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) != 8 &&
distCoeffs->rows*distCoeffs->cols*CV_MAT_CN(distCoeffs->type) != 12 && distCoeffs->rows*distCoeffs->cols*CV_MAT_CN(distCoeffs->type) != 12 &&
distCoeffs->rows*distCoeffs->cols*CV_MAT_CN(distCoeffs->type) != 14) ) 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, _k = cvMat( distCoeffs->rows, distCoeffs->cols,
CV_MAKETYPE(CV_64F,CV_MAT_CN(distCoeffs->type)), k ); 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_32FC1 &&
CV_MAT_TYPE(dpdr->type) != CV_64FC1) || CV_MAT_TYPE(dpdr->type) != CV_64FC1) ||
dpdr->rows != count*2 || dpdr->cols != 3 ) 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 ) 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_32FC1 &&
CV_MAT_TYPE(dpdt->type) != CV_64FC1) || CV_MAT_TYPE(dpdt->type) != CV_64FC1) ||
dpdt->rows != count*2 || dpdt->cols != 3 ) 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 ) if( CV_MAT_TYPE(dpdt->type) == CV_64FC1 )
{ {
@ -702,7 +702,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
if( !CV_IS_MAT(dpdf) || if( !CV_IS_MAT(dpdf) ||
(CV_MAT_TYPE(dpdf->type) != CV_32FC1 && CV_MAT_TYPE(dpdf->type) != CV_64FC1) || (CV_MAT_TYPE(dpdf->type) != CV_32FC1 && CV_MAT_TYPE(dpdf->type) != CV_64FC1) ||
dpdf->rows != count*2 || dpdf->cols != 2 ) 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 ) if( CV_MAT_TYPE(dpdf->type) == CV_64FC1 )
{ {
@ -719,7 +719,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
if( !CV_IS_MAT(dpdc) || if( !CV_IS_MAT(dpdc) ||
(CV_MAT_TYPE(dpdc->type) != CV_32FC1 && CV_MAT_TYPE(dpdc->type) != CV_64FC1) || (CV_MAT_TYPE(dpdc->type) != CV_32FC1 && CV_MAT_TYPE(dpdc->type) != CV_64FC1) ||
dpdc->rows != count*2 || dpdc->cols != 2 ) 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 ) if( CV_MAT_TYPE(dpdc->type) == CV_64FC1 )
{ {
@ -736,10 +736,10 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
if( !CV_IS_MAT(dpdk) || if( !CV_IS_MAT(dpdk) ||
(CV_MAT_TYPE(dpdk->type) != CV_32FC1 && CV_MAT_TYPE(dpdk->type) != CV_64FC1) || (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) ) 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 ) 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 ) 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 if( !CV_IS_MAT( dpdo ) || ( CV_MAT_TYPE( dpdo->type ) != CV_32FC1
&& CV_MAT_TYPE( dpdo->type ) != CV_64FC1 ) && CV_MAT_TYPE( dpdo->type ) != CV_64FC1 )
|| dpdo->rows != count * 2 || dpdo->cols != count * 3 ) || 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 ) 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(objectPoints->type) != CV_64FC3) ||
(CV_MAT_TYPE(imagePoints->type) != CV_32FC2 && (CV_MAT_TYPE(imagePoints->type) != CV_32FC2 &&
CV_MAT_TYPE(imagePoints->type) != CV_64FC2) ) 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 ) 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 )); matA.reset(cvCreateMat( 2*nimages, 2, CV_64F ));
_b.reset(cvCreateMat( 2*nimages, 1, 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 // 0. check the parameters & allocate buffers
if( !CV_IS_MAT(objectPoints) || !CV_IS_MAT(imagePoints) || if( !CV_IS_MAT(objectPoints) || !CV_IS_MAT(imagePoints) ||
!CV_IS_MAT(npoints) || !CV_IS_MAT(cameraMatrix) || !CV_IS_MAT(distCoeffs) ) !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 ) 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 || if( CV_MAT_TYPE(npoints->type) != CV_32SC1 ||
(npoints->rows != 1 && npoints->cols != 1) ) (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" ); "the array of point counters must be 1-dimensional integer vector" );
if(flags & CALIB_TILTED_MODEL) if(flags & CALIB_TILTED_MODEL)
{ {
//when the tilted sensor model is used the distortion coefficients matrix must have 14 parameters //when the tilted sensor model is used the distortion coefficients matrix must have 14 parameters
if (distCoeffs->cols*distCoeffs->rows != 14) 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 else
{ {
//when the thin prism model is used the distortion coefficients matrix must have 12 parameters //when the thin prism model is used the distortion coefficients matrix must have 12 parameters
if(flags & CALIB_THIN_PRISM_MODEL) if(flags & CALIB_THIN_PRISM_MODEL)
if (distCoeffs->cols*distCoeffs->rows != 12) 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; 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) || (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 != nimages || (rvecs->cols*cn != 3 && rvecs->cols*cn != 9)) &&
(rvecs->rows != 1 || rvecs->cols != nimages || cn != 3)) ) (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" ); "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) || (CV_MAT_DEPTH(tvecs->type) != CV_32F && CV_MAT_DEPTH(tvecs->type) != CV_64F) ||
((tvecs->rows != nimages || tvecs->cols*cn != 3) && ((tvecs->rows != nimages || tvecs->cols*cn != 3) &&
(tvecs->rows != 1 || tvecs->cols != nimages || 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" ); "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)) ) (stdDevs->rows != 1 || stdDevs->cols != (nimages*6 + NINTRINSIC) || cn != 1)) )
#define STR__(x) #x #define STR__(x) #x
#define STR_(x) STR__(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," "1x(n*6 + NINTRINSIC) or (n*6 + NINTRINSIC)x1 array, where n is the number of views,"
" NINTRINSIC = " STR_(CV_CALIB_NINTRINSIC)); " NINTRINSIC = " STR_(CV_CALIB_NINTRINSIC));
} }
@ -1462,7 +1462,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
if( (CV_MAT_TYPE(cameraMatrix->type) != CV_32FC1 && if( (CV_MAT_TYPE(cameraMatrix->type) != CV_32FC1 &&
CV_MAT_TYPE(cameraMatrix->type) != CV_64FC1) || CV_MAT_TYPE(cameraMatrix->type) != CV_64FC1) ||
cameraMatrix->rows != 3 || cameraMatrix->cols != 3 ) cameraMatrix->rows != 3 || cameraMatrix->cols != 3 )
CV_Error( CV_StsBadArg, CV_Error( cv::Error::StsBadArg,
"Intrinsic parameters must be 3x3 floating-point matrix" ); "Intrinsic parameters must be 3x3 floating-point matrix" );
if( (CV_MAT_TYPE(distCoeffs->type) != CV_32FC1 && 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 != 8 &&
distCoeffs->cols*distCoeffs->rows != 12 && distCoeffs->cols*distCoeffs->rows != 12 &&
distCoeffs->cols*distCoeffs->rows != 14) ) distCoeffs->cols*distCoeffs->rows != 14) )
CV_Error( CV_StsBadArg, cvDistCoeffErr ); CV_Error( cv::Error::StsBadArg, cvDistCoeffErr );
for( i = 0; i < nimages; i++ ) for( i = 0; i < nimages; i++ )
{ {
ni = npoints->data.i[i*npstep]; ni = npoints->data.i[i*npstep];
if( ni < 4 ) 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 ); maxPoints = MAX( maxPoints, ni );
total += 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) || (CV_MAT_DEPTH(newObjPoints->type) != CV_32F && CV_MAT_DEPTH(newObjPoints->type) != CV_64F) ||
((newObjPoints->rows != maxPoints || newObjPoints->cols*cn != 3) && ((newObjPoints->rows != maxPoints || newObjPoints->cols*cn != 3) &&
(newObjPoints->rows != 1 || newObjPoints->cols != maxPoints || 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" ); "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) || (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 != (nimages*6 + NINTRINSIC + maxPoints*3) || stdDevs->cols*cn != 1) &&
(stdDevs->rows != 1 || stdDevs->cols != (nimages*6 + NINTRINSIC + maxPoints*3) || 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," "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"); " 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 ); cvConvert( cameraMatrix, &matA );
if( A(0, 0) <= 0 || A(1, 1) <= 0 ) 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 || if( A(0, 2) < 0 || A(0, 2) >= imageSize.width ||
A(1, 2) < 0 || A(1, 2) >= imageSize.height ) 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 ) 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 || 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 ) 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" ); "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(0, 1) = A(1, 0) = A(2, 0) = A(2, 1) = 0.;
A(2, 2) = 1.; A(2, 2) = 1.;
@ -1562,7 +1562,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
aspectRatio = A(0, 0)/A(1, 1); aspectRatio = A(0, 0)/A(1, 1);
if( aspectRatio < minValidAspectRatio || aspectRatio > maxValidAspectRatio ) 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" ); "The specified aspect ratio (= cameraMatrix[0][0] / cameraMatrix[1][1]) is incorrect" );
} }
cvConvert( distCoeffs, &_k ); cvConvert( distCoeffs, &_k );
@ -1572,7 +1572,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
Scalar mean, sdv; Scalar mean, sdv;
meanStdDev(matM, mean, sdv); meanStdDev(matM, mean, sdv);
if( fabs(mean[2]) > 1e-5 || fabs(sdv[2]) > 1e-5 ) 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 non-planar calibration rigs the initial intrinsic matrix must be specified" );
for( i = 0; i < total; i++ ) for( i = 0; i < total; i++ )
matM.at<Point3d>(i).z = 0.; matM.at<Point3d>(i).z = 0.;
@ -1582,7 +1582,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
aspectRatio = cvmGet(cameraMatrix,0,0); aspectRatio = cvmGet(cameraMatrix,0,0);
aspectRatio /= cvmGet(cameraMatrix,1,1); aspectRatio /= cvmGet(cameraMatrix,1,1);
if( aspectRatio < minValidAspectRatio || aspectRatio > maxValidAspectRatio ) 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" ); "The specified aspect ratio (= cameraMatrix[0][0] / cameraMatrix[1][1]) is incorrect" );
} }
CvMat _matM = cvMat(matM), m = cvMat(_m); CvMat _matM = cvMat(matM), m = cvMat(_m);
@ -1673,7 +1673,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
Mat mask = cvarrToMat(solver.mask); Mat mask = cvarrToMat(solver.mask);
int nparams_nz = countNonZero(mask); int nparams_nz = countNonZero(mask);
if (nparams_nz >= 2 * total) 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)); ("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 // 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 ) CvMat* rvecs, CvMat* tvecs, CvMat* newObjPoints, int flags, CvTermCriteria termCrit )
{ {
if( !CV_IS_MAT(npoints) ) 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 || if( CV_MAT_TYPE(npoints->type) != CV_32SC1 ||
(npoints->rows != 1 && npoints->cols != 1) ) (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" ); "the array of point counters must be 1-dimensional integer vector" );
bool releaseObject = iFixedPoint > 0 && iFixedPoint < npoints->data.i[0] - 1; bool releaseObject = iFixedPoint > 0 && iFixedPoint < npoints->data.i[0] - 1;
@ -1903,7 +1903,7 @@ CV_IMPL double cvCalibrateCamera4( const CvMat* objectPoints,
if( releaseObject ) if( releaseObject )
{ {
if( !CV_IS_MAT(objectPoints) ) 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; Mat matM;
if(CV_MAT_CN(objectPoints->type) == 3) { if(CV_MAT_CN(objectPoints->type) == 3) {
matM = cvarrToMat(objectPoints); matM = cvarrToMat(objectPoints);
@ -1917,14 +1917,14 @@ CV_IMPL double cvCalibrateCamera4( const CvMat* objectPoints,
{ {
if( npoints->data.i[i * npstep] != ni ) 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." ); "object-releasing method is requested." );
} }
Mat ocmp = matM.colRange(ni * i, ni * i + ni) != matM.colRange(0, ni); Mat ocmp = matM.colRange(ni * i, ni * i + ni) != matM.colRange(0, ni);
ocmp = ocmp.reshape(1); ocmp = ocmp.reshape(1);
if( countNonZero(ocmp) ) 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." ); " method is requested." );
} }
} }
@ -1941,10 +1941,10 @@ void cvCalibrationMatrixValues( const CvMat *calibMatr, CvSize imgSize,
{ {
/* Validate parameters. */ /* Validate parameters. */
if(calibMatr == 0) 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)) 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; double dummy = .0;
Point2d pp; 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) || (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 != nimages || (rvecs->cols*cn != 3 && rvecs->cols*cn != 9)) &&
(rvecs->rows != 1 || rvecs->cols != nimages || cn != 3)) ) (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" ); "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) || (CV_MAT_DEPTH(tvecs->type) != CV_32F && CV_MAT_DEPTH(tvecs->type) != CV_64F) ||
((tvecs->rows != nimages || tvecs->cols*cn != 3) && ((tvecs->rows != nimages || tvecs->cols*cn != 3) &&
(tvecs->rows != 1 || tvecs->cols != nimages || 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" ); "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. */ /* Validate parameters. */
if(projMatr == 0 || calibMatr == 0 || rotMatr == 0 || posVect == 0) 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)) 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) 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) 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) 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. */ /* Compute position vector. */
cvSetZero(&tmpProjMatr); // Add zero row to make matrix square. cvSetZero(&tmpProjMatr); // Add zero row to make matrix square.
@ -3402,17 +3402,17 @@ static void collectCalibrationData( InputArrayOfArrays objectPoints,
{ {
Mat objectPoint = objectPoints.getMat(i); Mat objectPoint = objectPoints.getMat(i);
if (objectPoint.empty()) 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); int numberOfObjectPoints = objectPoint.checkVector(3, CV_32F);
if (numberOfObjectPoints <= 0) 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); Mat imagePoint1 = imagePoints1.getMat(i);
if (imagePoint1.empty()) 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); int numberOfImagePoints = imagePoint1.checkVector(2, CV_32F);
if (numberOfImagePoints <= 0) 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"); CV_CheckEQ(numberOfObjectPoints, numberOfImagePoints, "Number of object and image points must be equal");
total += numberOfObjectPoints; total += numberOfObjectPoints;
@ -3467,14 +3467,14 @@ static void collectCalibrationData( InputArrayOfArrays objectPoints,
{ {
if( npoints.at<int>(i) != ni ) if( npoints.at<int>(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." ); "object-releasing method is requested." );
} }
Mat ocmp = objPtMat.colRange(ni * i, ni * i + ni) != objPtMat.colRange(0, ni); Mat ocmp = objPtMat.colRange(ni * i, ni * i + ni) != objPtMat.colRange(0, ni);
ocmp = ocmp.reshape(1); ocmp = ocmp.reshape(1);
if( countNonZero(ocmp) ) 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." ); " method is requested." );
} }
} }
@ -3884,7 +3884,7 @@ void cv::calibrationMatrixValues( InputArray _cameraMatrix, Size imageSize,
CV_INSTRUMENT_REGION(); CV_INSTRUMENT_REGION();
if(_cameraMatrix.size() != Size(3, 3)) 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(); Matx33d K = _cameraMatrix.getMat();

View File

@ -1041,7 +1041,7 @@ int solvePnPGeneric( InputArray _opoints, InputArray _ipoints,
vec_tvecs.push_back(tvec); vec_tvecs.push_back(tvec);
}*/ }*/
else 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"); "SOLVEPNP_EPNP, SOLVEPNP_DLS, SOLVEPNP_UPNP, SOLVEPNP_AP3P, SOLVEPNP_IPPE, SOLVEPNP_IPPE_SQUARE or SOLVEPNP_SQPNP");
CV_Assert(vec_rvecs.size() == vec_tvecs.size()); CV_Assert(vec_rvecs.size() == vec_tvecs.size());

View File

@ -56,30 +56,30 @@ icvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2, CvMat* projPoints1, CvM
if( projMatr1 == 0 || projMatr2 == 0 || if( projMatr1 == 0 || projMatr2 == 0 ||
projPoints1 == 0 || projPoints2 == 0 || projPoints1 == 0 || projPoints2 == 0 ||
points4D == 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) || if( !CV_IS_MAT(projMatr1) || !CV_IS_MAT(projMatr2) ||
!CV_IS_MAT(projPoints1) || !CV_IS_MAT(projPoints2) || !CV_IS_MAT(projPoints1) || !CV_IS_MAT(projPoints2) ||
!CV_IS_MAT(points4D) ) !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; int numPoints = projPoints1->cols;
if( numPoints < 1 ) 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 ) 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) 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 ) 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 || if( projMatr1->cols != 4 || projMatr1->rows != 3 ||
projMatr2->cols != 4 || projMatr2->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 // preallocate SVD matrices on stack
cv::Matx<double, 4, 4> matrA; cv::Matx<double, 4, 4> matrA;
@ -147,30 +147,30 @@ icvCorrectMatches(CvMat *F_, CvMat *points1_, CvMat *points2_, CvMat *new_points
cv::Ptr<CvMat> F; cv::Ptr<CvMat> F;
if (!CV_IS_MAT(F_) || !CV_IS_MAT(points1_) || !CV_IS_MAT(points2_) ) 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)) 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 )) 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)) 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 ) 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 ) 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) { if (new_points1 != NULL) {
CV_Assert(CV_IS_MAT(new_points1)); CV_Assert(CV_IS_MAT(new_points1));
if (new_points1->cols != points1_->cols || new_points1->rows != 1) 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) 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) { if (new_points2 != NULL) {
CV_Assert(CV_IS_MAT(new_points2)); CV_Assert(CV_IS_MAT(new_points2));
if (new_points2->cols != points2_->cols || new_points2->rows != 1) 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) 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 // Make sure F uses double precision

View File

@ -149,49 +149,49 @@ void CV_CameraCalibrationBadArgTest::run( int /* start_from */ )
caller.initArgs(); caller.initArgs();
caller.objPts_arg = noArray(); 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.initArgs();
caller.imgPts_arg = noArray(); 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.initArgs();
caller.cameraMatrix_arg = noArray(); 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.initArgs();
caller.distCoeffs_arg = noArray(); 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.initArgs();
caller.imageSize.width = -1; 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.initArgs();
caller.imageSize.height = -1; 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.initArgs();
caller.imgPts[0].clear(); 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.imgPts[0] = caller.imgPts[1];
caller.initArgs(); caller.initArgs();
caller.objPts[1].clear(); 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.objPts[1] = caller.objPts[0];
caller.initArgs(); caller.initArgs();
Mat badCM = Mat::zeros(4, 4, CV_64F); Mat badCM = Mat::zeros(4, 4, CV_64F);
caller.cameraMatrix_arg = badCM; caller.cameraMatrix_arg = badCM;
caller.flags = CALIB_USE_INTRINSIC_GUESS; 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(); caller.initArgs();
Mat badDC = Mat::zeros(10, 10, CV_64F); Mat badDC = Mat::zeros(10, 10, CV_64F);
caller.distCoeffs_arg = badDC; caller.distCoeffs_arg = badDC;
caller.flags = CALIB_USE_INTRINSIC_GUESS; 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) if (errors)
ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH); ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
@ -244,15 +244,15 @@ protected:
caller.initArgs(); caller.initArgs();
caller.src_arg = noArray(); 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.initArgs();
caller.src = Mat::zeros(3, 1, CV_8U); 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.initArgs();
caller.src = Mat::zeros(1, 1, CV_32F); 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) if (errors)
ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH); ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
@ -331,57 +331,57 @@ protected:
caller.initArgs(); caller.initArgs();
caller.objectPoints_arg = noArray(); 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.initArgs();
caller.rvec_arg = noArray(); 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.initArgs();
caller.tvec_arg = noArray(); 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.initArgs();
caller.A_arg = noArray(); 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.initArgs();
caller.imagePoints_arg = noArray(); 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; Mat save_rvec = caller.r_vec;
caller.initArgs(); caller.initArgs();
caller.r_vec.create(2, 2, CV_32F); 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.initArgs();
caller.r_vec.create(1, 3, CV_8U); 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; caller.r_vec = save_rvec;
/****************************/ /****************************/
Mat save_tvec = caller.t_vec; Mat save_tvec = caller.t_vec;
caller.initArgs(); caller.initArgs();
caller.t_vec.create(3, 3, CV_32F); 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.initArgs();
caller.t_vec.create(1, 3, CV_8U); 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; caller.t_vec = save_tvec;
/****************************/ /****************************/
Mat save_A = caller.A; Mat save_A = caller.A;
caller.initArgs(); caller.initArgs();
caller.A.create(2, 2, CV_32F); 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; caller.A = save_A;
/****************************/ /****************************/
Mat save_DC = caller.distCoeffs; Mat save_DC = caller.distCoeffs;
caller.initArgs(); caller.initArgs();
caller.distCoeffs.create(3, 3, CV_32F); 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; caller.distCoeffs = save_DC;
if (errors) if (errors)

View File

@ -106,15 +106,15 @@ void CV_UndistortPointsBadArgTest::run(int)
src_points = cv::cvarrToMat(&_src_points_orig); src_points = cv::cvarrToMat(&_src_points_orig);
src_points.create(2, 2, CV_32FC2); 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 = cv::cvarrToMat(&_src_points_orig);
src_points.create(1, 4, CV_64FC2); 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::cvarrToMat(&_src_points_orig);
src_points = cv::Mat(); 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); src_points = cv::cvarrToMat(&_src_points_orig);
//------------ //------------
@ -181,19 +181,19 @@ void CV_InitUndistortRectifyMapBadArgTest::run(int)
mapy = cv::cvarrToMat(&_mapy_orig); mapy = cv::cvarrToMat(&_mapy_orig);
mat_type = CV_64F; 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; mat_type = mat_type_orig;
camera_mat.create(3, 2, CV_32F); 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); camera_mat = cv::cvarrToMat(&_camera_mat_orig);
R.create(4, 3, CV_32F); 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); R = cv::cvarrToMat(&_R_orig);
distortion_coeffs.create(6, 1, CV_32F); 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); distortion_coeffs = cv::cvarrToMat(&_distortion_coeffs_orig);
//------------ //------------
@ -256,7 +256,7 @@ void CV_UndistortBadArgTest::run(int)
dst = cv::cvarrToMat(&_dst_orig); dst = cv::cvarrToMat(&_dst_orig);
camera_mat.create(5, 5, CV_64F); 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); ts->set_failed_test_info(errcount > 0 ? cvtest::TS::FAIL_BAD_ARG_CHECK : cvtest::TS::OK);

View File

@ -70,7 +70,7 @@ namespace cv {
static void* OutOfMemoryError(size_t size) 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(); CV_EXPORTS cv::utils::AllocatorStatisticsInterface& getAllocatorStatistics();

View File

@ -209,7 +209,7 @@ static void binary_op( InputArray _src1, InputArray _src2, OutputArray _dst,
swap(sz1, sz2); swap(sz1, sz2);
} }
else if( !checkScalar(*psrc2, type1, kind2, kind1) ) 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), " "The operation is neither 'array op array' (where arrays have the same size and type), "
"nor 'array op scalar', nor 'scalar op array'" ); "nor 'array op scalar', nor 'scalar op array'" );
haveScalar = true; haveScalar = true;
@ -644,7 +644,7 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
oclop = OCL_OP_RDIV_SCALE; oclop = OCL_OP_RDIV_SCALE;
} }
else if( !checkScalar(*psrc2, type1, kind2, kind1) ) else if( !checkScalar(*psrc2, type1, kind2, kind1) )
CV_Error( CV_StsUnmatchedSizes, CV_Error( cv::Error::StsUnmatchedSizes,
"The operation is neither 'array op array' " "The operation is neither 'array op array' "
"(where arrays have the same size and the same number of channels), " "(where arrays have the same size and the same number of channels), "
"nor 'array op scalar', nor 'scalar op array'" ); "nor 'array op scalar', nor 'scalar op array'" );
@ -669,7 +669,7 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
else else
{ {
if( !haveScalar && type1 != type2 ) 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, " "When the input arrays in add/subtract/multiply/divide functions have different types, "
"the output array type must be explicitly specified"); "the output array type must be explicitly specified");
dtype = type1; dtype = type1;
@ -1206,7 +1206,7 @@ void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op)
return; return;
} }
else if(is_src1_scalar == is_src2_scalar) 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), " "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'" ); "nor 'array op scalar', nor 'scalar op array'" );
haveScalar = true; haveScalar = true;
@ -1615,7 +1615,7 @@ static bool ocl_inRange( InputArray _src, InputArray _lowerb,
ssize != lsize || stype != ltype ) ssize != lsize || stype != ltype )
{ {
if( !checkScalar(_lowerb, stype, lkind, skind) ) 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"); "The lower boundary is neither an array of the same size and same type as src, nor a scalar");
lbScalar = true; lbScalar = true;
} }
@ -1624,7 +1624,7 @@ static bool ocl_inRange( InputArray _src, InputArray _lowerb,
ssize != usize || stype != utype ) ssize != usize || stype != utype )
{ {
if( !checkScalar(_upperb, stype, ukind, skind) ) 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"); "The upper boundary is neither an array of the same size and same type as src, nor a scalar");
ubScalar = true; ubScalar = true;
} }
@ -1738,7 +1738,7 @@ void cv::inRange(InputArray _src, InputArray _lowerb,
src.size != lb.size || src.type() != lb.type() ) src.size != lb.size || src.type() != lb.type() )
{ {
if( !checkScalar(lb, src.type(), lkind, skind) ) 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"); "The lower boundary is neither an array of the same size and same type as src, nor a scalar");
lbScalar = true; lbScalar = true;
} }
@ -1747,7 +1747,7 @@ void cv::inRange(InputArray _src, InputArray _lowerb,
src.size != ub.size || src.type() != ub.type() ) src.size != ub.size || src.type() != ub.type() )
{ {
if( !checkScalar(ub, src.type(), ukind, skind) ) 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"); "The upper boundary is neither an array of the same size and same type as src, nor a scalar");
ubScalar = true; ubScalar = true;
} }

File diff suppressed because it is too large Load Diff

View File

@ -377,7 +377,7 @@ void cv::batchDistance( InputArray _src1, InputArray _src2,
} }
if( func == 0 ) 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", ("The combination of type=%d, dtype=%d and normType=%d is not supported",
type, dtype, normType)); type, dtype, normType));

View File

@ -464,7 +464,7 @@ std::vector<String> CommandLineParser::Impl::split_range_string(const String& _s
{ {
if (begin == true) if (begin == true)
{ {
throw cv::Exception(CV_StsParseError, throw cv::Exception(cv::Error::StsParseError,
String("error in split_range_string(") String("error in split_range_string(")
+ str + str
+ String(", ") + String(", ")
@ -484,7 +484,7 @@ std::vector<String> CommandLineParser::Impl::split_range_string(const String& _s
{ {
if (begin == false) if (begin == false)
{ {
throw cv::Exception(CV_StsParseError, throw cv::Exception(cv::Error::StsParseError,
String("error in split_range_string(") String("error in split_range_string(")
+ str + str
+ String(", ") + String(", ")
@ -508,7 +508,7 @@ std::vector<String> CommandLineParser::Impl::split_range_string(const String& _s
if (begin == true) if (begin == true)
{ {
throw cv::Exception(CV_StsParseError, throw cv::Exception(cv::Error::StsParseError,
String("error in split_range_string(") String("error in split_range_string(")
+ str + str
+ String(", ") + String(", ")

View File

@ -96,7 +96,7 @@ void scalarToRawData(const Scalar& s, void* _buf, int type, int unroll_to)
scalarToRawData_<float16_t>(s, (float16_t*)_buf, cn, unroll_to); scalarToRawData_<float16_t>(s, (float16_t*)_buf, cn, unroll_to);
break; break;
default: 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 ) else if( borderType == BORDER_CONSTANT )
p = -1; p = -1;
else else
CV_Error( CV_StsBadArg, "Unknown/unsupported border type" ); CV_Error( cv::Error::StsBadArg, "Unknown/unsupported border type" );
return p; return p;
} }

View File

@ -91,7 +91,7 @@ static void
icvInitMemStorage( CvMemStorage* storage, int block_size ) icvInitMemStorage( CvMemStorage* storage, int block_size )
{ {
if( !storage ) if( !storage )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( block_size <= 0 ) if( block_size <= 0 )
block_size = CV_STORAGE_BLOCK_SIZE; block_size = CV_STORAGE_BLOCK_SIZE;
@ -120,7 +120,7 @@ CV_IMPL CvMemStorage *
cvCreateChildMemStorage( CvMemStorage * parent ) cvCreateChildMemStorage( CvMemStorage * parent )
{ {
if( !parent ) if( !parent )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
CvMemStorage* storage = cvCreateMemStorage(parent->block_size); CvMemStorage* storage = cvCreateMemStorage(parent->block_size);
storage->parent = parent; storage->parent = parent;
@ -137,7 +137,7 @@ icvDestroyMemStorage( CvMemStorage* storage )
CvMemBlock *dst_top = 0; CvMemBlock *dst_top = 0;
if( !storage ) if( !storage )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( storage->parent ) if( storage->parent )
dst_top = storage->parent->top; dst_top = storage->parent->top;
@ -180,7 +180,7 @@ CV_IMPL void
cvReleaseMemStorage( CvMemStorage** storage ) cvReleaseMemStorage( CvMemStorage** storage )
{ {
if( !storage ) if( !storage )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
CvMemStorage* st = *storage; CvMemStorage* st = *storage;
*storage = 0; *storage = 0;
@ -197,7 +197,7 @@ CV_IMPL void
cvClearMemStorage( CvMemStorage * storage ) cvClearMemStorage( CvMemStorage * storage )
{ {
if( !storage ) if( !storage )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( storage->parent ) if( storage->parent )
icvDestroyMemStorage( storage ); icvDestroyMemStorage( storage );
@ -215,7 +215,7 @@ static void
icvGoNextMemBlock( CvMemStorage * storage ) icvGoNextMemBlock( CvMemStorage * storage )
{ {
if( !storage ) if( !storage )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( !storage->top || !storage->top->next ) if( !storage->top || !storage->top->next )
{ {
@ -273,7 +273,7 @@ CV_IMPL void
cvSaveMemStoragePos( const CvMemStorage * storage, CvMemStoragePos * pos ) cvSaveMemStoragePos( const CvMemStorage * storage, CvMemStoragePos * pos )
{ {
if( !storage || !pos ) if( !storage || !pos )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
pos->top = storage->top; pos->top = storage->top;
pos->free_space = storage->free_space; pos->free_space = storage->free_space;
@ -285,9 +285,9 @@ CV_IMPL void
cvRestoreMemStoragePos( CvMemStorage * storage, CvMemStoragePos * pos ) cvRestoreMemStoragePos( CvMemStorage * storage, CvMemStoragePos * pos )
{ {
if( !storage || !pos ) if( !storage || !pos )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( pos->free_space > storage->block_size ) 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 // this breaks icvGoNextMemBlock, so comment it off for now
@ -324,10 +324,10 @@ cvMemStorageAlloc( CvMemStorage* storage, size_t size )
{ {
schar *ptr = 0; schar *ptr = 0;
if( !storage ) if( !storage )
CV_Error( CV_StsNullPtr, "NULL storage pointer" ); CV_Error( cv::Error::StsNullPtr, "NULL storage pointer" );
if( size > INT_MAX ) 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 ); 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); size_t max_free_space = cvAlignLeft(storage->block_size - sizeof(CvMemBlock), CV_STRUCT_ALIGN);
if( max_free_space < size ) 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 ); icvGoNextMemBlock( storage );
} }
@ -374,9 +374,9 @@ cvCreateSeq( int seq_flags, size_t header_size, size_t elem_size, CvMemStorage*
CvSeq *seq = 0; CvSeq *seq = 0;
if( !storage ) if( !storage )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( header_size < sizeof( CvSeq ) || elem_size <= 0 ) if( header_size < sizeof( CvSeq ) || elem_size <= 0 )
CV_Error( CV_StsBadSize, "" ); CV_Error( cv::Error::StsBadSize, "" );
/* allocate sequence header */ /* allocate sequence header */
seq = (CvSeq*)cvMemStorageAlloc( storage, header_size ); 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 && if( elemtype != CV_SEQ_ELTYPE_GENERIC && elemtype != CV_SEQ_ELTYPE_PTR &&
typesize != 0 && typesize != (int)elem_size ) 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 " "Specified element size doesn't match to the size of the specified element type "
"(try to use 0 for element type)" ); "(try to use 0 for element type)" );
} }
@ -412,9 +412,9 @@ cvSetSeqBlockSize( CvSeq *seq, int delta_elements )
int useful_block_size; int useful_block_size;
if( !seq || !seq->storage ) if( !seq || !seq->storage )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( delta_elements < 0 ) if( delta_elements < 0 )
CV_Error( CV_StsOutOfRange, "" ); CV_Error( cv::Error::StsOutOfRange, "" );
useful_block_size = cvAlignLeft(seq->storage->block_size - sizeof(CvMemBlock) - useful_block_size = cvAlignLeft(seq->storage->block_size - sizeof(CvMemBlock) -
sizeof(CvSeqBlock), CV_STRUCT_ALIGN); sizeof(CvSeqBlock), CV_STRUCT_ALIGN);
@ -429,7 +429,7 @@ cvSetSeqBlockSize( CvSeq *seq, int delta_elements )
{ {
delta_elements = useful_block_size / elem_size; delta_elements = useful_block_size / elem_size;
if( delta_elements == 0 ) 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" ); "to fit the sequence elements" );
} }
@ -487,7 +487,7 @@ cvSeqElemIdx( const CvSeq* seq, const void* _element, CvSeqBlock** _block )
CvSeqBlock *block; CvSeqBlock *block;
if( !seq || !element ) if( !seq || !element )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
block = first_block = seq->first; block = first_block = seq->first;
elem_size = seq->elem_size; elem_size = seq->elem_size;
@ -548,7 +548,7 @@ cvCvtSeqToArray( const CvSeq *seq, void *array, CvSlice slice )
char *dst = (char*)array; char *dst = (char*)array;
if( !seq || !array ) if( !seq || !array )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
elem_size = seq->elem_size; elem_size = seq->elem_size;
total = cvSliceLength( slice, 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; CvSeq* result = 0;
if( elem_size <= 0 || header_size < (int)sizeof( CvSeq ) || total < 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) ) if( !seq || ((!array || !block) && total > 0) )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
memset( seq, 0, header_size ); 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 && if( elemtype != CV_SEQ_ELTYPE_GENERIC &&
typesize != 0 && typesize != elem_size ) 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 " "Element size doesn't match to the size of predefined element type "
"(try to use 0 for sequence element type)" ); "(try to use 0 for sequence element type)" );
} }
@ -634,7 +634,7 @@ icvGrowSeq( CvSeq *seq, int in_front_of )
CvSeqBlock *block; CvSeqBlock *block;
if( !seq ) if( !seq )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
block = seq->free_blocks; block = seq->free_blocks;
if( !block ) if( !block )
@ -647,7 +647,7 @@ icvGrowSeq( CvSeq *seq, int in_front_of )
cvSetSeqBlockSize( seq, delta_elems*2 ); cvSetSeqBlockSize( seq, delta_elems*2 );
if( !storage ) 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 /* If there is a free space just after last allocated block
and it is big enough then enlarge the last block. and it is big enough then enlarge the last block.
@ -817,7 +817,7 @@ CV_IMPL void
cvStartAppendToSeq( CvSeq *seq, CvSeqWriter * writer ) cvStartAppendToSeq( CvSeq *seq, CvSeqWriter * writer )
{ {
if( !seq || !writer ) if( !seq || !writer )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
memset( writer, 0, sizeof( *writer )); memset( writer, 0, sizeof( *writer ));
writer->header_size = sizeof( CvSeqWriter ); writer->header_size = sizeof( CvSeqWriter );
@ -835,7 +835,7 @@ cvStartWriteSeq( int seq_flags, int header_size,
int elem_size, CvMemStorage * storage, CvSeqWriter * writer ) int elem_size, CvMemStorage * storage, CvSeqWriter * writer )
{ {
if( !storage || !writer ) if( !storage || !writer )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
CvSeq* seq = cvCreateSeq( seq_flags, header_size, elem_size, storage ); CvSeq* seq = cvCreateSeq( seq_flags, header_size, elem_size, storage );
cvStartAppendToSeq( seq, writer ); cvStartAppendToSeq( seq, writer );
@ -847,7 +847,7 @@ CV_IMPL void
cvFlushSeqWriter( CvSeqWriter * writer ) cvFlushSeqWriter( CvSeqWriter * writer )
{ {
if( !writer ) if( !writer )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
CvSeq* seq = writer->seq; CvSeq* seq = writer->seq;
seq->ptr = writer->ptr; seq->ptr = writer->ptr;
@ -878,7 +878,7 @@ CV_IMPL CvSeq *
cvEndWriteSeq( CvSeqWriter * writer ) cvEndWriteSeq( CvSeqWriter * writer )
{ {
if( !writer ) if( !writer )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
cvFlushSeqWriter( writer ); cvFlushSeqWriter( writer );
CvSeq* seq = writer->seq; CvSeq* seq = writer->seq;
@ -909,7 +909,7 @@ CV_IMPL void
cvCreateSeqBlock( CvSeqWriter * writer ) cvCreateSeqBlock( CvSeqWriter * writer )
{ {
if( !writer || !writer->seq ) if( !writer || !writer->seq )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
CvSeq* seq = writer->seq; CvSeq* seq = writer->seq;
@ -942,7 +942,7 @@ cvStartReadSeq( const CvSeq *seq, CvSeqReader * reader, int reverse )
} }
if( !seq || !reader ) if( !seq || !reader )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
reader->header_size = sizeof( CvSeqReader ); reader->header_size = sizeof( CvSeqReader );
reader->seq = (CvSeq*)seq; reader->seq = (CvSeq*)seq;
@ -992,7 +992,7 @@ cvChangeSeqBlock( void* _reader, int direction )
CvSeqReader* reader = (CvSeqReader*)_reader; CvSeqReader* reader = (CvSeqReader*)_reader;
if( !reader ) if( !reader )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( direction > 0 ) if( direction > 0 )
{ {
@ -1017,7 +1017,7 @@ cvGetSeqReaderPos( CvSeqReader* reader )
int index = -1; int index = -1;
if( !reader || !reader->ptr ) if( !reader || !reader->ptr )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
elem_size = reader->seq->elem_size; elem_size = reader->seq->elem_size;
if( elem_size <= ICV_SHIFT_TAB_MAX && (index = icvPower2ShiftTab[elem_size - 1]) >= 0 ) 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; int elem_size, count, total;
if( !reader || !reader->seq ) if( !reader || !reader->seq )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
total = reader->seq->total; total = reader->seq->total;
elem_size = reader->seq->elem_size; elem_size = reader->seq->elem_size;
@ -1052,14 +1052,14 @@ cvSetSeqReaderPos( CvSeqReader* reader, int index, int is_relative )
if( index < 0 ) if( index < 0 )
{ {
if( index < -total ) if( index < -total )
CV_Error( CV_StsOutOfRange, "" ); CV_Error( cv::Error::StsOutOfRange, "" );
index += total; index += total;
} }
else if( index >= total ) else if( index >= total )
{ {
index -= total; index -= total;
if( index >= total ) if( index >= total )
CV_Error( CV_StsOutOfRange, "" ); CV_Error( cv::Error::StsOutOfRange, "" );
} }
block = reader->seq->first; block = reader->seq->first;
@ -1135,7 +1135,7 @@ cvSeqPush( CvSeq *seq, const void *element )
size_t elem_size; size_t elem_size;
if( !seq ) if( !seq )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
elem_size = seq->elem_size; elem_size = seq->elem_size;
ptr = seq->ptr; ptr = seq->ptr;
@ -1166,9 +1166,9 @@ cvSeqPop( CvSeq *seq, void *element )
int elem_size; int elem_size;
if( !seq ) if( !seq )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( seq->total <= 0 ) if( seq->total <= 0 )
CV_Error( CV_StsBadSize, "" ); CV_Error( cv::Error::StsBadSize, "" );
elem_size = seq->elem_size; elem_size = seq->elem_size;
seq->ptr = ptr = seq->ptr - elem_size; seq->ptr = ptr = seq->ptr - elem_size;
@ -1195,7 +1195,7 @@ cvSeqPushFront( CvSeq *seq, const void *element )
CvSeqBlock *block; CvSeqBlock *block;
if( !seq ) if( !seq )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
elem_size = seq->elem_size; elem_size = seq->elem_size;
block = seq->first; block = seq->first;
@ -1228,9 +1228,9 @@ cvSeqPopFront( CvSeq *seq, void *element )
CvSeqBlock *block; CvSeqBlock *block;
if( !seq ) if( !seq )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( seq->total <= 0 ) if( seq->total <= 0 )
CV_Error( CV_StsBadSize, "" ); CV_Error( cv::Error::StsBadSize, "" );
elem_size = seq->elem_size; elem_size = seq->elem_size;
block = seq->first; block = seq->first;
@ -1257,14 +1257,14 @@ cvSeqInsert( CvSeq *seq, int before_index, const void *element )
schar* ret_ptr = 0; schar* ret_ptr = 0;
if( !seq ) if( !seq )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
total = seq->total; total = seq->total;
before_index += before_index < 0 ? total : 0; before_index += before_index < 0 ? total : 0;
before_index -= before_index > total ? total : 0; before_index -= before_index > total ? total : 0;
if( (unsigned)before_index > (unsigned)total ) if( (unsigned)before_index > (unsigned)total )
CV_Error( CV_StsOutOfRange, "" ); CV_Error( cv::Error::StsOutOfRange, "" );
if( before_index == total ) if( before_index == total )
{ {
@ -1375,7 +1375,7 @@ cvSeqRemove( CvSeq *seq, int index )
int total, front = 0; int total, front = 0;
if( !seq ) if( !seq )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
total = seq->total; total = seq->total;
@ -1383,7 +1383,7 @@ cvSeqRemove( CvSeq *seq, int index )
index -= index >= total ? total : 0; index -= index >= total ? total : 0;
if( (unsigned) index >= (unsigned) total ) if( (unsigned) index >= (unsigned) total )
CV_Error( CV_StsOutOfRange, "Invalid index" ); CV_Error( cv::Error::StsOutOfRange, "Invalid index" );
if( index == total - 1 ) if( index == total - 1 )
{ {
@ -1456,9 +1456,9 @@ cvSeqPushMulti( CvSeq *seq, const void *_elements, int count, int front )
char *elements = (char *) _elements; char *elements = (char *) _elements;
if( !seq ) if( !seq )
CV_Error( CV_StsNullPtr, "NULL sequence pointer" ); CV_Error( cv::Error::StsNullPtr, "NULL sequence pointer" );
if( count < 0 ) 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; int elem_size = seq->elem_size;
@ -1525,9 +1525,9 @@ cvSeqPopMulti( CvSeq *seq, void *_elements, int count, int front )
char *elements = (char *) _elements; char *elements = (char *) _elements;
if( !seq ) if( !seq )
CV_Error( CV_StsNullPtr, "NULL sequence pointer" ); CV_Error( cv::Error::StsNullPtr, "NULL sequence pointer" );
if( count < 0 ) 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 ); count = MIN( count, seq->total );
@ -1593,7 +1593,7 @@ CV_IMPL void
cvClearSeq( CvSeq *seq ) cvClearSeq( CvSeq *seq )
{ {
if( !seq ) if( !seq )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
cvSeqPopMulti( seq, 0, seq->total ); 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; CvSeqBlock *block, *first_block = 0, *last_block = 0;
if( !CV_IS_SEQ(seq) ) if( !CV_IS_SEQ(seq) )
CV_Error( CV_StsBadArg, "Invalid sequence header" ); CV_Error( cv::Error::StsBadArg, "Invalid sequence header" );
if( !storage ) if( !storage )
{ {
storage = seq->storage; storage = seq->storage;
if( !storage ) if( !storage )
CV_Error( CV_StsNullPtr, "NULL storage pointer" ); CV_Error( cv::Error::StsNullPtr, "NULL storage pointer" );
} }
elem_size = seq->elem_size; 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; slice.start_index -= seq->total;
if( (unsigned)length > (unsigned)seq->total || if( (unsigned)length > (unsigned)seq->total ||
((unsigned)slice.start_index >= (unsigned)seq->total && length != 0) ) ((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 ); subseq = cvCreateSeq( seq->flags, seq->header_size, elem_size, storage );
@ -1680,7 +1680,7 @@ cvSeqRemoveSlice( CvSeq* seq, CvSlice slice )
int total, length; int total, length;
if( !CV_IS_SEQ(seq) ) if( !CV_IS_SEQ(seq) )
CV_Error( CV_StsBadArg, "Invalid sequence header" ); CV_Error( cv::Error::StsBadArg, "Invalid sequence header" );
length = cvSliceLength( slice, seq ); length = cvSliceLength( slice, seq );
total = seq->total; total = seq->total;
@ -1691,7 +1691,7 @@ cvSeqRemoveSlice( CvSeq* seq, CvSlice slice )
slice.start_index -= total; slice.start_index -= total;
if( (unsigned)slice.start_index >= (unsigned)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; slice.end_index = slice.start_index + length;
@ -1757,16 +1757,16 @@ cvSeqInsertSlice( CvSeq* seq, int index, const CvArr* from_arr )
CvSeqBlock block; CvSeqBlock block;
if( !CV_IS_SEQ(seq) ) 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)) if( !CV_IS_SEQ(from))
{ {
CvMat* mat = (CvMat*)from; CvMat* mat = (CvMat*)from;
if( !CV_IS_MAT(mat)) 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) ) 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), from = cvMakeSeqHeaderForArray( CV_SEQ_KIND_GENERIC, sizeof(from_header),
CV_ELEM_SIZE(mat->type), 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 ) if( seq->elem_size != from->elem_size )
CV_Error( CV_StsUnmatchedSizes, CV_Error( cv::Error::StsUnmatchedSizes,
"Source and destination sequence element sizes are different." ); "Source and destination sequence element sizes are different." );
from_total = from->total; from_total = from->total;
@ -1788,7 +1788,7 @@ cvSeqInsertSlice( CvSeq* seq, int index, const CvArr* from_arr )
index -= index > total ? total : 0; index -= index > total ? total : 0;
if( (unsigned)index > (unsigned)total ) if( (unsigned)index > (unsigned)total )
CV_Error( CV_StsOutOfRange, "" ); CV_Error( cv::Error::StsOutOfRange, "" );
elem_size = seq->elem_size; elem_size = seq->elem_size;
@ -1918,10 +1918,10 @@ cvSeqSort( CvSeq* seq, CvCmpFunc cmp_func, void* aux )
stack[48]; stack[48];
if( !CV_IS_SEQ(seq) ) 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 ) if( !cmp_func )
CV_Error( CV_StsNullPtr, "Null compare function" ); CV_Error( cv::Error::StsNullPtr, "Null compare function" );
if( seq->total <= 1 ) if( seq->total <= 1 )
return; return;
@ -2195,10 +2195,10 @@ cvSeqSearch( CvSeq* seq, const void* _elem, CvCmpFunc cmp_func,
*_idx = idx; *_idx = idx;
if( !CV_IS_SEQ(seq) ) 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 ) if( !elem )
CV_Error( CV_StsNullPtr, "Null element pointer" ); CV_Error( cv::Error::StsNullPtr, "Null element pointer" );
int elem_size = seq->elem_size; int elem_size = seq->elem_size;
int total = seq->total; int total = seq->total;
@ -2256,7 +2256,7 @@ cvSeqSearch( CvSeq* seq, const void* _elem, CvCmpFunc cmp_func,
else else
{ {
if( !cmp_func ) if( !cmp_func )
CV_Error( CV_StsNullPtr, "Null compare function" ); CV_Error( cv::Error::StsNullPtr, "Null compare function" );
i = 0, j = total; i = 0, j = total;
@ -2340,16 +2340,16 @@ cvSeqPartition( const CvSeq* seq, CvMemStorage* storage, CvSeq** labels,
int is_set; int is_set;
if( !labels ) if( !labels )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( !seq || !is_equal ) if( !seq || !is_equal )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( !storage ) if( !storage )
storage = seq->storage; storage = seq->storage;
if( !storage ) if( !storage )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
is_set = CV_IS_SET(seq); 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 ) cvCreateSet( int set_flags, int header_size, int elem_size, CvMemStorage * storage )
{ {
if( !storage ) if( !storage )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( header_size < (int)sizeof( CvSet ) || if( header_size < (int)sizeof( CvSet ) ||
elem_size < (int)sizeof(void*)*2 || elem_size < (int)sizeof(void*)*2 ||
(elem_size & (sizeof(void*)-1)) != 0 ) (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 ); CvSet* set = (CvSet*) cvCreateSeq( set_flags, header_size, elem_size, storage );
set->flags = (set->flags & ~CV_MAGIC_MASK) | CV_SET_MAGIC_VAL; 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; CvSetElem *free_elem;
if( !set ) if( !set )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( !(set->free_elems) ) if( !(set->free_elems) )
{ {
@ -2552,7 +2552,7 @@ cvSetRemove( CvSet* set, int index )
if( elem ) if( elem )
cvSetRemoveByPtr( set, elem ); cvSetRemoveByPtr( set, elem );
else if( !set ) 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 ) || edge_size < (int) sizeof( CvGraphEdge )
|| vtx_size < (int) sizeof( CvGraphVtx ) || vtx_size < (int) sizeof( CvGraphVtx )
){ ){
CV_Error( CV_StsBadSize, "" ); CV_Error( cv::Error::StsBadSize, "" );
} }
vertices = cvCreateSet( graph_type, header_size, vtx_size, storage ); vertices = cvCreateSet( graph_type, header_size, vtx_size, storage );
@ -2602,7 +2602,7 @@ CV_IMPL void
cvClearGraph( CvGraph * graph ) cvClearGraph( CvGraph * graph )
{ {
if( !graph ) if( !graph )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
cvClearSet( graph->edges ); cvClearSet( graph->edges );
cvClearSet( (CvSet*)graph ); cvClearSet( (CvSet*)graph );
@ -2617,7 +2617,7 @@ cvGraphAddVtx( CvGraph* graph, const CvGraphVtx* _vertex, CvGraphVtx** _inserted
int index = -1; int index = -1;
if( !graph ) if( !graph )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
vertex = (CvGraphVtx*)cvSetNew((CvSet*)graph); vertex = (CvGraphVtx*)cvSetNew((CvSet*)graph);
if( vertex ) if( vertex )
@ -2642,10 +2642,10 @@ cvGraphRemoveVtxByPtr( CvGraph* graph, CvGraphVtx* vtx )
int count = -1; int count = -1;
if( !graph || !vtx ) if( !graph || !vtx )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( !CV_IS_SET_ELEM(vtx)) 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; count = graph->edges->active_count;
for( ;; ) for( ;; )
@ -2670,11 +2670,11 @@ cvGraphRemoveVtx( CvGraph* graph, int index )
CvGraphVtx *vtx = 0; CvGraphVtx *vtx = 0;
if( !graph ) if( !graph )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
vtx = cvGetGraphVtx( graph, index ); vtx = cvGetGraphVtx( graph, index );
if( !vtx ) 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; count = graph->edges->active_count;
for( ;; ) for( ;; )
@ -2702,7 +2702,7 @@ cvFindGraphEdgeByPtr( const CvGraph* graph,
int ofs = 0; int ofs = 0;
if( !graph || !start_vtx || !end_vtx ) if( !graph || !start_vtx || !end_vtx )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( start_vtx == end_vtx ) if( start_vtx == end_vtx )
return 0; return 0;
@ -2735,7 +2735,7 @@ cvFindGraphEdge( const CvGraph* graph, int start_idx, int end_idx )
CvGraphVtx *end_vtx; CvGraphVtx *end_vtx;
if( !graph ) 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 ); start_vtx = cvGetGraphVtx( graph, start_idx );
end_vtx = cvGetGraphVtx( graph, end_idx ); end_vtx = cvGetGraphVtx( graph, end_idx );
@ -2759,7 +2759,7 @@ cvGraphAddEdgeByPtr( CvGraph* graph,
int delta; int delta;
if( !graph ) 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 ) && if( !CV_IS_GRAPH_ORIENTED( graph ) &&
(start_vtx->flags & CV_SET_ELEM_IDX_MASK) > (end_vtx->flags & CV_SET_ELEM_IDX_MASK) ) (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 ) 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)" ); "vertex pointers coincide (or set to NULL)" );
edge = (CvGraphEdge*)cvSetNew( (CvSet*)(graph->edges) ); edge = (CvGraphEdge*)cvSetNew( (CvSet*)(graph->edges) );
@ -2826,7 +2826,7 @@ cvGraphAddEdge( CvGraph* graph,
CvGraphVtx *end_vtx; CvGraphVtx *end_vtx;
if( !graph ) if( !graph )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
start_vtx = cvGetGraphVtx( graph, start_idx ); start_vtx = cvGetGraphVtx( graph, start_idx );
end_vtx = cvGetGraphVtx( graph, end_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; CvGraphEdge *edge, *next_edge, *prev_edge;
if( !graph || !start_vtx || !end_vtx ) if( !graph || !start_vtx || !end_vtx )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( start_vtx == end_vtx ) if( start_vtx == end_vtx )
return; return;
@ -2902,7 +2902,7 @@ cvGraphRemoveEdge( CvGraph* graph, int start_idx, int end_idx )
CvGraphVtx *end_vtx; CvGraphVtx *end_vtx;
if( !graph ) if( !graph )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
start_vtx = cvGetGraphVtx( graph, start_idx ); start_vtx = cvGetGraphVtx( graph, start_idx );
end_vtx = cvGetGraphVtx( graph, end_idx ); end_vtx = cvGetGraphVtx( graph, end_idx );
@ -2919,7 +2919,7 @@ cvGraphVtxDegreeByPtr( const CvGraph* graph, const CvGraphVtx* vertex )
int count; int count;
if( !graph || !vertex ) if( !graph || !vertex )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
for( edge = vertex->first, count = 0; edge; ) for( edge = vertex->first, count = 0; edge; )
{ {
@ -2940,11 +2940,11 @@ cvGraphVtxDegree( const CvGraph* graph, int vtx_idx )
int count; int count;
if( !graph ) if( !graph )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
vertex = cvGetGraphVtx( graph, vtx_idx ); vertex = cvGetGraphVtx( graph, vtx_idx );
if( !vertex ) if( !vertex )
CV_Error( CV_StsObjectNotFound, "" ); CV_Error( cv::Error::StsObjectNotFound, "" );
for( edge = vertex->first, count = 0; edge; ) for( edge = vertex->first, count = 0; edge; )
{ {
@ -2971,13 +2971,13 @@ icvSeqElemsClearFlags( CvSeq* seq, int offset, int clear_mask )
int i, total, elem_size; int i, total, elem_size;
if( !seq ) if( !seq )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
elem_size = seq->elem_size; elem_size = seq->elem_size;
total = seq->total; total = seq->total;
if( (unsigned)offset > (unsigned)elem_size ) if( (unsigned)offset > (unsigned)elem_size )
CV_Error( CV_StsBadArg, "" ); CV_Error( cv::Error::StsBadArg, "" );
cvStartReadSeq( seq, &reader ); cvStartReadSeq( seq, &reader );
@ -3001,14 +3001,14 @@ icvSeqFindNextElem( CvSeq* seq, int offset, int mask,
int total, elem_size, index; int total, elem_size, index;
if( !seq || !start_index ) if( !seq || !start_index )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
elem_size = seq->elem_size; elem_size = seq->elem_size;
total = seq->total; total = seq->total;
index = *start_index; index = *start_index;
if( (unsigned)offset > (unsigned)elem_size ) if( (unsigned)offset > (unsigned)elem_size )
CV_Error( CV_StsBadArg, "" ); CV_Error( cv::Error::StsBadArg, "" );
if( total == 0 ) if( total == 0 )
return 0; return 0;
@ -3048,7 +3048,7 @@ CV_IMPL CvGraphScanner*
cvCreateGraphScanner( CvGraph* graph, CvGraphVtx* vtx, int mask ) cvCreateGraphScanner( CvGraph* graph, CvGraphVtx* vtx, int mask )
{ {
if( !graph ) if( !graph )
CV_Error( CV_StsNullPtr, "Null graph pointer" ); CV_Error( cv::Error::StsNullPtr, "Null graph pointer" );
CV_Assert( graph->storage != 0 ); CV_Assert( graph->storage != 0 );
@ -3082,7 +3082,7 @@ CV_IMPL void
cvReleaseGraphScanner( CvGraphScanner** scanner ) cvReleaseGraphScanner( CvGraphScanner** scanner )
{ {
if( !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 ) if( *scanner )
{ {
@ -3103,7 +3103,7 @@ cvNextGraphItem( CvGraphScanner* scanner )
CvGraphItem item; CvGraphItem item;
if( !scanner || !(scanner->stack)) if( !scanner || !(scanner->stack))
CV_Error( CV_StsNullPtr, "Null graph scanner" ); CV_Error( cv::Error::StsNullPtr, "Null graph scanner" );
dst = scanner->dst; dst = scanner->dst;
vtx = scanner->vtx; vtx = scanner->vtx;
@ -3259,13 +3259,13 @@ cvCloneGraph( const CvGraph* graph, CvMemStorage* storage )
CvSeqReader reader; CvSeqReader reader;
if( !CV_IS_GRAPH(graph)) if( !CV_IS_GRAPH(graph))
CV_Error( CV_StsBadArg, "Invalid graph pointer" ); CV_Error( cv::Error::StsBadArg, "Invalid graph pointer" );
if( !storage ) if( !storage )
storage = graph->storage; storage = graph->storage;
if( !storage ) if( !storage )
CV_Error( CV_StsNullPtr, "NULL storage pointer" ); CV_Error( cv::Error::StsNullPtr, "NULL storage pointer" );
vtx_size = graph->elem_size; vtx_size = graph->elem_size;
edge_size = graph->edges->elem_size; edge_size = graph->edges->elem_size;
@ -3343,7 +3343,7 @@ cvTreeToNodeSeq( const void* first, int header_size, CvMemStorage* storage )
CvTreeNodeIterator iterator; CvTreeNodeIterator iterator;
if( !storage ) 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 ); allseq = cvCreateSeq( 0, header_size, sizeof(first), storage );
@ -3389,7 +3389,7 @@ cvInsertNodeIntoTree( void* _node, void* _parent, void* _frame )
CvTreeNode* parent = (CvTreeNode*)_parent; CvTreeNode* parent = (CvTreeNode*)_parent;
if( !node || !parent ) if( !node || !parent )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
node->v_prev = _parent != _frame ? parent : 0; node->v_prev = _parent != _frame ? parent : 0;
node->h_next = parent->v_next; node->h_next = parent->v_next;
@ -3410,10 +3410,10 @@ cvRemoveNodeFromTree( void* _node, void* _frame )
CvTreeNode* frame = (CvTreeNode*)_frame; CvTreeNode* frame = (CvTreeNode*)_frame;
if( !node ) if( !node )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( node == frame ) 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 ) if( node->h_next )
node->h_next->h_prev = node->h_prev; node->h_next->h_prev = node->h_prev;
@ -3440,10 +3440,10 @@ cvInitTreeNodeIterator( CvTreeNodeIterator* treeIterator,
const void* first, int max_level ) const void* first, int max_level )
{ {
if( !treeIterator || !first ) if( !treeIterator || !first )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( max_level < 0 ) if( max_level < 0 )
CV_Error( CV_StsOutOfRange, "" ); CV_Error( cv::Error::StsOutOfRange, "" );
treeIterator->node = (void*)first; treeIterator->node = (void*)first;
treeIterator->level = 0; treeIterator->level = 0;
@ -3459,7 +3459,7 @@ cvNextTreeNode( CvTreeNodeIterator* treeIterator )
int level; int level;
if( !treeIterator ) if( !treeIterator )
CV_Error( CV_StsNullPtr, "NULL iterator pointer" ); CV_Error( cv::Error::StsNullPtr, "NULL iterator pointer" );
prevNode = node = (CvTreeNode*)treeIterator->node; prevNode = node = (CvTreeNode*)treeIterator->node;
level = treeIterator->level; level = treeIterator->level;
@ -3500,7 +3500,7 @@ cvPrevTreeNode( CvTreeNodeIterator* treeIterator )
int level; int level;
if( !treeIterator ) if( !treeIterator )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
prevNode = node = (CvTreeNode*)treeIterator->node; prevNode = node = (CvTreeNode*)treeIterator->node;
level = treeIterator->level; level = treeIterator->level;

View File

@ -3469,7 +3469,7 @@ Ptr<DFT2D> DFT2D::create(int width, int height, int depth,
{ {
if(width == 1 && nonzero_rows > 0 ) 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" "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" ); "For fast convolution/correlation use 2-column matrix or single-row matrix instead" );
} }
@ -4317,7 +4317,7 @@ public:
if( len != prev_len ) if( len != prev_len )
{ {
if( len > 1 && (len & 1) ) 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 ); opt.nf = DFTFactorize( len, opt.factors );
bool inplace_transform = opt.factors[0] == opt.factors[opt.nf-1]; bool inplace_transform = opt.factors[0] == opt.factors[opt.nf-1];

View File

@ -276,7 +276,7 @@ static void glob_rec(const cv::String& directory, const cv::String& wildchart, s
} }
else 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 #endif // OPENCV_HAVE_FILESYSTEM_SUPPORT

View File

@ -1191,7 +1191,7 @@ bool solve( InputArray _src, InputArray _src2arg, OutputArray _dst, int method )
Mat dst = _dst.getMat(); Mat dst = _dst.getMat();
if( m < n ) 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 ) if( m == n )
is_normal = false; is_normal = false;
@ -1515,7 +1515,7 @@ void SVD::backSubst( InputArray _w, InputArray _u, InputArray _vt,
vt.ptr<double>(), vt.step, true, rhs.ptr<double>(), rhs.step, nb, vt.ptr<double>(), vt.step, true, rhs.ptr<double>(), rhs.step, nb,
dst.ptr<double>(), dst.step, buffer.data()); dst.ptr<double>(), dst.step, buffer.data());
else else
CV_Error( CV_StsUnsupportedFormat, "" ); CV_Error( cv::Error::StsUnsupportedFormat, "" );
} }

View File

@ -1566,7 +1566,7 @@ bool checkRange(InputArray _src, bool quiet, Point* pt, double minVal, double ma
{ {
cv::String value_str; cv::String value_str;
value_str << src(cv::Range(badPt.y, badPt.y + 1), cv::Range(badPt.x, badPt.x + 1)); 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)); ("the value at (%d, %d)=%s is out of range [%f, %f)", badPt.x, badPt.y, value_str.c_str(), minVal, maxVal));
} }
return false; return false;

View File

@ -921,7 +921,7 @@ void mulTransposed(InputArray _src, OutputArray _dst, bool ata,
{ {
MulTransposedFunc func = getMulTransposedFunc(stype, dtype, ata); MulTransposedFunc func = getMulTransposedFunc(stype, dtype, ata);
if( !func ) if( !func )
CV_Error( CV_StsUnsupportedFormat, "" ); CV_Error( cv::Error::StsUnsupportedFormat, "" );
func( src, dst, delta, scale ); func( src, dst, delta, scale );
completeSymm( dst, false ); completeSymm( dst, false );

View File

@ -267,7 +267,7 @@ void setSize( Mat& m, int _dims, const int* _sz, const size_t* _steps, bool auto
m.step.p[i] = total; m.step.p[i] = total;
uint64 total1 = (uint64)total*s; uint64 total1 = (uint64)total*s;
if( (uint64)total1 != (size_t)total1 ) 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; total = (size_t)total1;
} }
} }
@ -1072,9 +1072,9 @@ void Mat::push_back(const Mat& elems)
bool eq = size == elems.size; bool eq = size == elems.size;
size.p[0] = int(r); size.p[0] = int(r);
if( !eq ) 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() ) 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 ) if( isSubmatrix() || dataend + step.p[0]*delta > datalimit )
reserve( std::max(r + delta, (r*3+1)/2) ); 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; int total_size = total_width * rows;
if( !isContinuous() ) 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" ); "The matrix is not continuous, thus its number of rows can not be changed" );
if( (unsigned)new_rows > (unsigned)total_size ) 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; total_width = total_size / new_rows;
if( total_width * new_rows != total_size ) 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" ); "is not divisible by the new number of rows" );
hdr.rows = new_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; int new_width = total_width / new_cn;
if( new_width * new_cn != total_width ) 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" ); "The total width is not divisible by the new number of channels" );
hdr.cols = new_width; hdr.cols = new_width;
@ -1231,13 +1231,13 @@ Mat Mat::reshape(int _cn, int _newndims, const int* _newsz) const
else if (i < dims) else if (i < dims)
newsz_buf[i] = this->size[i]; newsz_buf[i] = this->size[i];
else 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]; total_elem1 *= (size_t)newsz_buf[i];
} }
if (total_elem1 != total_elem1_ref) 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; Mat hdr = *this;
hdr.flags = (hdr.flags & ~CV_MAT_CN_MASK) | ((_cn-1) << CV_CN_SHIFT); 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; 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 // TBD
} }

View File

@ -163,7 +163,7 @@ Mat cvarrToMat(const CvArr* arr, bool copyData,
{ {
const IplImage* iplimg = (const IplImage*)arr; const IplImage* iplimg = (const IplImage*)arr;
if( coiMode == 0 && iplimg->roi && iplimg->roi->coi > 0 ) 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); return iplImageToMat(iplimg, copyData);
} }
if( CV_IS_SEQ(arr) ) if( CV_IS_SEQ(arr) )
@ -187,7 +187,7 @@ Mat cvarrToMat(const CvArr* arr, bool copyData,
cvCvtSeqToArray(seq, buf.ptr(), CV_WHOLE_SEQ); cvCvtSeqToArray(seq, buf.ptr(), CV_WHOLE_SEQ);
return buf; 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) 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; dim = src.rows > dst.rows ? 0 : src.cols > dst.cols ? 1 : dst.cols == 1;
if( dim > 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)) || if( (dim == 0 && (dst.cols != src.cols || dst.rows != 1)) ||
(dim == 1 && (dst.rows != src.rows || dst.cols != 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() ) 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()); cv::reduce(src, dst, dim, op, dst.type());
} }
@ -333,7 +333,7 @@ cvRange( CvArr* arr, double start, double end )
fdata[j] = (float)val; fdata[j] = (float)val;
} }
else 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; return arr;
} }

View File

@ -21,7 +21,7 @@ static void checkOperandsExist(const Mat& a)
{ {
if (a.empty()) 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()) 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 ) else if( e.flags == 'a' && !e.b.data )
cv::absdiff(e.a, e.s, dst); cv::absdiff(e.a, e.s, dst);
else else
CV_Error(CV_StsError, "Unknown operation"); CV_Error(cv::Error::StsError, "Unknown operation");
if( dst.data != m.data ) if( dst.data != m.data )
dst.convertTo(m, _type); 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' ) else if( e.flags == '1' )
m = Scalar(e.alpha); m = Scalar(e.alpha);
else 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 void MatOp_Initializer::multiply(const MatExpr& e, double s, MatExpr& res) const

View File

@ -954,7 +954,7 @@ void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype)
} }
if( !func ) if( !func )
CV_Error( CV_StsUnsupportedFormat, CV_Error( cv::Error::StsUnsupportedFormat,
"Unsupported combination of input and output array formats" ); "Unsupported combination of input and output array formats" );
func( src, temp ); func( src, temp );

View File

@ -758,7 +758,7 @@ double norm( const SparseMat& src, int normType )
} }
} }
else 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 ) if( normType == NORM_L2 )
result = std::sqrt(result); result = std::sqrt(result);
@ -821,7 +821,7 @@ void minMaxLoc( const SparseMat& src, double* _minval, double* _maxval, int* _mi
*_maxval = maxval; *_maxval = maxval;
} }
else 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 ) if( _minidx && minidx )
for( i = 0; i < d; i++ ) 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.; scale = scale > DBL_EPSILON ? a/scale : 0.;
} }
else else
CV_Error( CV_StsBadArg, "Unknown/unsupported norm type" ); CV_Error( cv::Error::StsBadArg, "Unknown/unsupported norm type" );
src.convertTo( dst, -1, scale ); src.convertTo( dst, -1, scale );
} }

View File

@ -948,7 +948,7 @@ bool _InputArray::isContinuous(int i) const
if( k == CUDA_GPU_MAT ) if( k == CUDA_GPU_MAT )
return i < 0 ? ((const cuda::GpuMat*)obj)->isContinuous() : true; 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 bool _InputArray::isSubmatrix(int i) const
@ -986,7 +986,7 @@ bool _InputArray::isSubmatrix(int i) const
return vv[i].isSubmatrix(); return vv[i].isSubmatrix();
} }
CV_Error(CV_StsNotImplemented, ""); CV_Error(cv::Error::StsNotImplemented, "");
} }
size_t _InputArray::offset(int i) const 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<Vec<int, 128> >*)v)->resize(len); ((std::vector<Vec<int, 128> >*)v)->resize(len);
break; break;
default: 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; return;
} }
if( k == NONE ) 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 ) if( k == STD_VECTOR_MAT )

View File

@ -1392,7 +1392,7 @@ void normalize(InputArray _src, InputOutputArray _dst, double a, double b,
shift = 0; shift = 0;
} }
else else
CV_Error( CV_StsBadArg, "Unknown/unsupported norm type" ); CV_Error( cv::Error::StsBadArg, "Unknown/unsupported norm type" );
CV_OCL_RUN(_dst.isUMat(), CV_OCL_RUN(_dst.isUMat(),
ocl_normalize(_src, _dst, _mask, rtype, scale, shift)) ocl_normalize(_src, _dst, _mask, rtype, scale, shift))

View File

@ -574,7 +574,7 @@ void RNG::fill( InputOutputArray _mat, int disttype,
CV_Assert( scaleFunc != 0 ); CV_Assert( scaleFunc != 0 );
} }
else else
CV_Error( CV_StsBadArg, "Unknown distribution type" ); CV_Error( cv::Error::StsBadArg, "Unknown distribution type" );
const Mat* arrays[] = {&mat, 0}; const Mat* arrays[] = {&mat, 0};
uchar* ptr; uchar* ptr;

View File

@ -1377,38 +1377,38 @@ CV_IMPL const char* cvErrorStr( int status )
switch (status) switch (status)
{ {
case CV_StsOk : return "No Error"; case cv::Error::StsOk : return "No Error";
case CV_StsBackTrace : return "Backtrace"; case cv::Error::StsBackTrace : return "Backtrace";
case CV_StsError : return "Unspecified error"; case cv::Error::StsError : return "Unspecified error";
case CV_StsInternal : return "Internal error"; case cv::Error::StsInternal : return "Internal error";
case CV_StsNoMem : return "Insufficient memory"; case cv::Error::StsNoMem : return "Insufficient memory";
case CV_StsBadArg : return "Bad argument"; case cv::Error::StsBadArg : return "Bad argument";
case CV_StsNoConv : return "Iterations do not converge"; case cv::Error::StsNoConv : return "Iterations do not converge";
case CV_StsAutoTrace : return "Autotrace call"; case cv::Error::StsAutoTrace : return "Autotrace call";
case CV_StsBadSize : return "Incorrect size of input array"; case cv::Error::StsBadSize : return "Incorrect size of input array";
case CV_StsNullPtr : return "Null pointer"; case cv::Error::StsNullPtr : return "Null pointer";
case CV_StsDivByZero : return "Division by zero occurred"; case cv::Error::StsDivByZero : return "Division by zero occurred";
case CV_BadStep : return "Image step is wrong"; case cv::Error::BadStep : return "Image step is wrong";
case CV_StsInplaceNotSupported : return "Inplace operation is not supported"; case cv::Error::StsInplaceNotSupported : return "Inplace operation is not supported";
case CV_StsObjectNotFound : return "Requested object was not found"; case cv::Error::StsObjectNotFound : return "Requested object was not found";
case CV_BadDepth : return "Input image depth is not supported by function"; case cv::Error::BadDepth : return "Input image depth is not supported by function";
case CV_StsUnmatchedFormats : return "Formats of input arguments do not match"; case cv::Error::StsUnmatchedFormats : return "Formats of input arguments do not match";
case CV_StsUnmatchedSizes : return "Sizes of input arguments do not match"; case cv::Error::StsUnmatchedSizes : return "Sizes of input arguments do not match";
case CV_StsOutOfRange : return "One of the arguments\' values is out of range"; case cv::Error::StsOutOfRange : return "One of the arguments\' values is out of range";
case CV_StsUnsupportedFormat : return "Unsupported format or combination of formats"; case cv::Error::StsUnsupportedFormat : return "Unsupported format or combination of formats";
case CV_BadCOI : return "Input COI is not supported"; case cv::Error::BadCOI : return "Input COI is not supported";
case CV_BadNumChannels : return "Bad number of channels"; case cv::Error::BadNumChannels : return "Bad number of channels";
case CV_StsBadFlag : return "Bad flag (parameter or structure field)"; case cv::Error::StsBadFlag : return "Bad flag (parameter or structure field)";
case CV_StsBadPoint : return "Bad parameter of type CvPoint"; case cv::Error::StsBadPoint : return "Bad parameter of type CvPoint";
case CV_StsBadMask : return "Bad type of mask argument"; case cv::Error::StsBadMask : return "Bad type of mask argument";
case CV_StsParseError : return "Parsing error"; case cv::Error::StsParseError : return "Parsing error";
case CV_StsNotImplemented : return "The function/feature is not implemented"; case cv::Error::StsNotImplemented : return "The function/feature is not implemented";
case CV_StsBadMemBlock : return "Memory block has been corrupted"; case cv::Error::StsBadMemBlock : return "Memory block has been corrupted";
case CV_StsAssert : return "Assertion failed"; case cv::Error::StsAssert : return "Assertion failed";
case CV_GpuNotSupported : return "No CUDA support"; case cv::Error::GpuNotSupported : return "No CUDA support";
case CV_GpuApiCallError : return "Gpu API call"; case cv::Error::GpuApiCallError : return "Gpu API call";
case CV_OpenGlNotSupported : return "No OpenGL support"; case cv::Error::OpenGlNotSupported : return "No OpenGL support";
case CV_OpenGlApiCallError : return "OpenGL API call"; case cv::Error::OpenGlApiCallError : return "OpenGL API call";
}; };
snprintf(buf, sizeof(buf), "Unknown %s code %d", status >= 0 ? "status":"error", status); snprintf(buf, sizeof(buf), "Unknown %s code %d", status >= 0 ? "status":"error", status);
@ -1448,29 +1448,29 @@ cvErrorFromIppStatus( int status )
{ {
switch (status) switch (status)
{ {
case CV_BADSIZE_ERR: return CV_StsBadSize; case CV_BADSIZE_ERR: return cv::Error::StsBadSize;
case CV_BADMEMBLOCK_ERR: return CV_StsBadMemBlock; case CV_BADMEMBLOCK_ERR: return cv::Error::StsBadMemBlock;
case CV_NULLPTR_ERR: return CV_StsNullPtr; case CV_NULLPTR_ERR: return cv::Error::StsNullPtr;
case CV_DIV_BY_ZERO_ERR: return CV_StsDivByZero; case CV_DIV_BY_ZERO_ERR: return cv::Error::StsDivByZero;
case CV_BADSTEP_ERR: return CV_BadStep; case CV_BADSTEP_ERR: return cv::Error::BadStep;
case CV_OUTOFMEM_ERR: return CV_StsNoMem; case CV_OUTOFMEM_ERR: return cv::Error::StsNoMem;
case CV_BADARG_ERR: return CV_StsBadArg; case CV_BADARG_ERR: return cv::Error::StsBadArg;
case CV_NOTDEFINED_ERR: return CV_StsError; case CV_NOTDEFINED_ERR: return cv::Error::StsError;
case CV_INPLACE_NOT_SUPPORTED_ERR: return CV_StsInplaceNotSupported; case CV_INPLACE_NOT_SUPPORTED_ERR: return cv::Error::StsInplaceNotSupported;
case CV_NOTFOUND_ERR: return CV_StsObjectNotFound; case CV_NOTFOUND_ERR: return cv::Error::StsObjectNotFound;
case CV_BADCONVERGENCE_ERR: return CV_StsNoConv; case CV_BADCONVERGENCE_ERR: return cv::Error::StsNoConv;
case CV_BADDEPTH_ERR: return CV_BadDepth; case CV_BADDEPTH_ERR: return cv::Error::BadDepth;
case CV_UNMATCHED_FORMATS_ERR: return CV_StsUnmatchedFormats; case CV_UNMATCHED_FORMATS_ERR: return cv::Error::StsUnmatchedFormats;
case CV_UNSUPPORTED_COI_ERR: return CV_BadCOI; case CV_UNSUPPORTED_COI_ERR: return cv::Error::BadCOI;
case CV_UNSUPPORTED_CHANNELS_ERR: return CV_BadNumChannels; case CV_UNSUPPORTED_CHANNELS_ERR: return cv::Error::BadNumChannels;
case CV_BADFLAG_ERR: return CV_StsBadFlag; case CV_BADFLAG_ERR: return cv::Error::StsBadFlag;
case CV_BADRANGE_ERR: return CV_StsBadArg; case CV_BADRANGE_ERR: return cv::Error::StsBadArg;
case CV_BADCOEF_ERR: return CV_StsBadArg; case CV_BADCOEF_ERR: return cv::Error::StsBadArg;
case CV_BADFACTOR_ERR: return CV_StsBadArg; case CV_BADFACTOR_ERR: return cv::Error::StsBadArg;
case CV_BADPOINT_ERR: return CV_StsBadPoint; case CV_BADPOINT_ERR: return cv::Error::StsBadPoint;
default: default:
return CV_StsError; return cv::Error::StsError;
} }
} }

View File

@ -83,7 +83,7 @@ void KeyPoint::convert(const std::vector<KeyPoint>& keypoints, std::vector<Point
points2f[i] = keypoints[idx].pt; points2f[i] = keypoints[idx].pt;
else else
{ {
CV_Error( CV_StsBadArg, "keypointIndexes has element < 0. TODO: process this case" ); CV_Error( cv::Error::StsBadArg, "keypointIndexes has element < 0. TODO: process this case" );
//points2f[i] = Point2f(-1, -1); //points2f[i] = Point2f(-1, -1);
} }
} }

View File

@ -539,7 +539,7 @@ void setSize( UMat& m, int _dims, const int* _sz,
m.step.p[i] = total; m.step.p[i] = total;
int64 total1 = (int64)total*s; int64 total1 = (int64)total*s;
if( (uint64)total1 != (size_t)total1 ) 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; total = (size_t)total1;
} }
} }
@ -965,16 +965,16 @@ UMat UMat::reshape(int new_cn, int new_rows) const
{ {
int total_size = total_width * rows; int total_size = total_width * rows;
if( !isContinuous() ) 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" ); "The matrix is not continuous, thus its number of rows can not be changed" );
if( (unsigned)new_rows > (unsigned)total_size ) 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; total_width = total_size / new_rows;
if( total_width * new_rows != total_size ) 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" ); "is not divisible by the new number of rows" );
hdr.rows = new_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; int new_width = total_width / new_cn;
if( new_width * new_cn != total_width ) 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" ); "The total width is not divisible by the new number of channels" );
hdr.cols = new_width; hdr.cols = new_width;
@ -1050,13 +1050,13 @@ UMat UMat::reshape(int _cn, int _newndims, const int* _newsz) const
else if (i < dims) else if (i < dims)
newsz_buf[i] = this->size[i]; newsz_buf[i] = this->size[i];
else 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]; total_elem1 *= (size_t)newsz_buf[i];
} }
if (total_elem1 != total_elem1_ref) 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; UMat hdr = *this;
hdr.flags = (hdr.flags & ~CV_MAT_CN_MASK) | ((_cn-1) << CV_CN_SHIFT); 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; 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 Mat UMat::getMat(AccessFlag accessFlags) const

View File

@ -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); inRange_((const double*)sptr, (const double*)aptr, (const double*)bptr, dptr, total, cn);
break; break;
default: 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); inRangeS_((const double*)sptr, lbuf.d, rbuf.d, dptr, total, cn);
break; break;
default: default:
CV_Error(CV_StsUnsupportedFormat, ""); CV_Error(cv::Error::StsUnsupportedFormat, "");
} }
} }
} }

View File

@ -97,7 +97,7 @@ static void DFT_1D( const Mat& _src, Mat& _dst, int flags, const Mat& _wave=Mat(
} }
} }
else else
CV_Error(CV_StsUnsupportedFormat, ""); CV_Error(cv::Error::StsUnsupportedFormat, "");
} }
@ -878,7 +878,7 @@ protected:
{ {
cout << "actual:\n" << dst << endl << endl; cout << "actual:\n" << dst << endl << endl;
cout << "reference:\n" << dstz << endl << endl; cout << "reference:\n" << dstz << endl << endl;
CV_Error(CV_StsError, ""); CV_Error(cv::Error::StsError, "");
} }
} }
} }

View File

@ -598,7 +598,7 @@ static void setValue(SparseMat& M, const int* idx, double value, RNG& rng)
else if( M.type() == CV_64F ) else if( M.type() == CV_64F )
*(double*)ptr = value; *(double*)ptr = value;
else else
CV_Error(CV_StsUnsupportedFormat, ""); CV_Error(cv::Error::StsUnsupportedFormat, "");
} }
#if defined(__GNUC__) && (__GNUC__ == 11 || __GNUC__ == 12 || __GNUC__ == 13) #if defined(__GNUC__) && (__GNUC__ == 11 || __GNUC__ == 12 || __GNUC__ == 13)

View File

@ -438,7 +438,7 @@ void Image2BlobParams::blobRectsToImageRects(const std::vector<Rect> &rBlob, std
} }
} }
else else
CV_Error(CV_StsBadArg, "Unknown padding mode"); CV_Error(cv::Error::StsBadArg, "Unknown padding mode");
} }
} }

View File

@ -548,7 +548,7 @@ public:
{ {
// for Conv1d // for Conv1d
if (group != 1) 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."); "TimVX Backend. Please try OpenCV Backend.");
tvConv = graph->CreateOperation<tim::vx::ops::Conv1d>( tvConv = graph->CreateOperation<tim::vx::ops::Conv1d>(
tvConvWeightShape[2], tvPadType, (uint32_t)kernel_size[0], tvConvWeightShape[2], tvPadType, (uint32_t)kernel_size[0],

View File

@ -450,7 +450,7 @@ Ptr<FastConv> initFastConv(
} }
} }
else 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 // store bias; append some zero's to make sure that
// we can always read MR elements starting from any valid index // we can always read MR elements starting from any valid index

View File

@ -225,7 +225,7 @@ void Context::createInstance()
if (result != VK_SUCCESS) if (result != VK_SUCCESS)
{ {
CV_Error(CV_StsError, "Vulkan: vkEnumerateInstanceLayerProperties failed!"); CV_Error(cv::Error::StsError, "Vulkan: vkEnumerateInstanceLayerProperties failed!");
return; return;
} }
@ -234,7 +234,7 @@ void Context::createInstance()
if (result != VK_SUCCESS) if (result != VK_SUCCESS)
{ {
CV_Error(CV_StsError, "Vulkan: vkEnumerateInstanceLayerProperties failed!"); CV_Error(cv::Error::StsError, "Vulkan: vkEnumerateInstanceLayerProperties failed!");
return; return;
} }
@ -388,7 +388,7 @@ Context::Context()
vkEnumeratePhysicalDevices(kInstance, &deviceCount, NULL); vkEnumeratePhysicalDevices(kInstance, &deviceCount, NULL);
if (deviceCount == 0) 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<VkPhysicalDevice> devices(deviceCount); std::vector<VkPhysicalDevice> devices(deviceCount);
@ -442,7 +442,7 @@ Context::Context()
if (!cmdPoolPtr) if (!cmdPoolPtr)
cmdPoolPtr = CommandPool::create(kQueue, kQueueFamilyIndex); cmdPoolPtr = CommandPool::create(kQueue, kQueueFamilyIndex);
else else
CV_Error(CV_StsError, "cmdPoolPtr has been created before!!"); CV_Error(cv::Error::StsError, "cmdPoolPtr has been created before!!");
pipelineFactoryPtr = PipelineFactory::create(); pipelineFactoryPtr = PipelineFactory::create();
} }

View File

@ -244,7 +244,7 @@ bool OpConv::computeGroupCount()
group_z_ = 1; group_z_ = 1;
} }
else 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_x_ <= MAX_GROUP_COUNT_X);
CV_Assert(group_y_ <= MAX_GROUP_COUNT_Y); CV_Assert(group_y_ <= MAX_GROUP_COUNT_Y);

View File

@ -182,7 +182,7 @@ bool OpNary::computeGroupCount()
} }
else 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_x_ <= MAX_GROUP_COUNT_X);

View File

@ -279,7 +279,7 @@ Ptr<Pipeline> PipelineFactory::getPipeline(const std::string& key, const std::ve
// retrieve spv from SPVMaps with given key // retrieve spv from SPVMaps with given key
auto iterSPV = SPVMaps.find(key); auto iterSPV = SPVMaps.find(key);
if (iterSPV == SPVMaps.end()) 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; const uint32_t* spv = iterSPV->second.first;
size_t length = iterSPV->second.second; size_t length = iterSPV->second.second;
@ -292,7 +292,7 @@ Ptr<Pipeline> PipelineFactory::getPipeline(const std::string& key, const std::ve
} }
else else
{ {
CV_Error(CV_StsError, "Can not Created the VkPipeline "+key); CV_Error(cv::Error::StsError, "Can not Created the VkPipeline "+key);
} }
return pipeline; return pipeline;

View File

@ -1097,17 +1097,17 @@ void cv::imshow(const String& winname, const ogl::Texture2D& _tex)
CV_IMPL void cvSetOpenGlDrawCallback(const char*, CvOpenGlDrawCallback, void*) 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_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_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 #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::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&) 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) 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) 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 ) 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**) 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() 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&) 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&) 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 ) 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 #endif

View File

@ -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) CV_IMPL void cvAddText(const CvArr* img, const char* text, CvPoint org, CvFont* font)
{ {
if (!guiMainThread) 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, QMetaObject::invokeMethod(guiMainThread,
"putText", "putText",
@ -162,7 +162,7 @@ CV_IMPL void cvAddText(const CvArr* img, const char* text, CvPoint org, CvFont*
double cvGetRatioWindow_QT(const char* name) double cvGetRatioWindow_QT(const char* name)
{ {
if (!guiMainThread) 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; double result = -1;
QMetaObject::invokeMethod(guiMainThread, QMetaObject::invokeMethod(guiMainThread,
@ -176,7 +176,7 @@ double cvGetRatioWindow_QT(const char* name)
double cvGetPropVisible_QT(const char* name) { double cvGetPropVisible_QT(const char* name) {
if (!guiMainThread) 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; double result = 0;
@ -193,7 +193,7 @@ void cvSetRatioWindow_QT(const char* name,double prop_value)
{ {
if (!guiMainThread) 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, QMetaObject::invokeMethod(guiMainThread,
"setRatioWindow", "setRatioWindow",
@ -205,7 +205,7 @@ void cvSetRatioWindow_QT(const char* name,double prop_value)
double cvGetPropWindow_QT(const char* name) double cvGetPropWindow_QT(const char* name)
{ {
if (!guiMainThread) 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; double result = -1;
QMetaObject::invokeMethod(guiMainThread, QMetaObject::invokeMethod(guiMainThread,
@ -221,7 +221,7 @@ double cvGetPropWindow_QT(const char* name)
void cvSetPropWindow_QT(const char* name,double prop_value) void cvSetPropWindow_QT(const char* name,double prop_value)
{ {
if (!guiMainThread) 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, QMetaObject::invokeMethod(guiMainThread,
"setPropWindow", "setPropWindow",
@ -246,7 +246,7 @@ void setWindowTitle_QT(const String& winname, const String& title)
void cvSetModeWindow_QT(const char* name, double prop_value) void cvSetModeWindow_QT(const char* name, double prop_value)
{ {
if (!guiMainThread) 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, QMetaObject::invokeMethod(guiMainThread,
"toggleFullScreen", "toggleFullScreen",
@ -258,7 +258,7 @@ void cvSetModeWindow_QT(const char* name, double prop_value)
CvRect cvGetWindowRect_QT(const char* name) CvRect cvGetWindowRect_QT(const char* name)
{ {
if (!guiMainThread) 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); CvRect result = cvRect(-1, -1, -1, -1);
@ -274,7 +274,7 @@ CvRect cvGetWindowRect_QT(const char* name)
double cvGetModeWindow_QT(const char* name) double cvGetModeWindow_QT(const char* name)
{ {
if (!guiMainThread) 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; 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) CV_IMPL void cvDisplayOverlay(const char* name, const char* text, int delayms)
{ {
if (!guiMainThread) 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, QMetaObject::invokeMethod(guiMainThread,
"displayInfo", "displayInfo",
@ -305,7 +305,7 @@ CV_IMPL void cvDisplayOverlay(const char* name, const char* text, int delayms)
CV_IMPL void cvSaveWindowParameters(const char* name) CV_IMPL void cvSaveWindowParameters(const char* name)
{ {
if (!guiMainThread) 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, QMetaObject::invokeMethod(guiMainThread,
"saveWindowParameters", "saveWindowParameters",
@ -317,7 +317,7 @@ CV_IMPL void cvSaveWindowParameters(const char* name)
CV_IMPL void cvLoadWindowParameters(const char* name) CV_IMPL void cvLoadWindowParameters(const char* name)
{ {
if (!guiMainThread) 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, QMetaObject::invokeMethod(guiMainThread,
"loadWindowParameters", "loadWindowParameters",
@ -329,7 +329,7 @@ CV_IMPL void cvLoadWindowParameters(const char* name)
CV_IMPL void cvDisplayStatusBar(const char* name, const char* text, int delayms) CV_IMPL void cvDisplayStatusBar(const char* name, const char* text, int delayms)
{ {
if (!guiMainThread) 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, QMetaObject::invokeMethod(guiMainThread,
"displayStatusBar", "displayStatusBar",
@ -492,7 +492,7 @@ static CvTrackbar* icvFindTrackBarByName(const char* name_trackbar, const char*
QPointer<CvWindow> w = icvFindWindowByName(nameWinQt); QPointer<CvWindow> w = icvFindWindowByName(nameWinQt);
if (!w) 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) if (w->param_gui_mode == CV_GUI_NORMAL)
return (CvTrackbar*) icvFindBarByName(w->myBarLayout, nameQt, type_CvTrackbar); 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) CV_IMPL void cvDestroyWindow(const char* name)
{ {
if (!guiMainThread) 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, QMetaObject::invokeMethod(guiMainThread,
"destroyWindow", "destroyWindow",
@ -598,7 +598,7 @@ CV_IMPL void cvDestroyAllWindows()
CV_IMPL void* cvGetWindowHandle(const char* name) CV_IMPL void* cvGetWindowHandle(const char* name)
{ {
if (!name) if (!name)
CV_Error( CV_StsNullPtr, "NULL name string" ); CV_Error( cv::Error::StsNullPtr, "NULL name string" );
return (void*) icvFindWindowByName(QLatin1String(name)); return (void*) icvFindWindowByName(QLatin1String(name));
} }
@ -607,7 +607,7 @@ CV_IMPL void* cvGetWindowHandle(const char* name)
CV_IMPL const char* cvGetWindowName(void* window_handle) CV_IMPL const char* cvGetWindowName(void* window_handle)
{ {
if( !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(); 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) CV_IMPL void cvMoveWindow(const char* name, int x, int y)
{ {
if (!guiMainThread) 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, QMetaObject::invokeMethod(guiMainThread,
"moveWindow", "moveWindow",
autoBlockingConnection(), 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) CV_IMPL void cvResizeWindow(const char* name, int width, int height)
{ {
if (!guiMainThread) 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, QMetaObject::invokeMethod(guiMainThread,
"resizeWindow", "resizeWindow",
autoBlockingConnection(), 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) CV_IMPL int cvCreateTrackbar2(const char* name_bar, const char* window_name, int* val, int count, CvTrackbarCallback2 on_notify, void* userdata)
{ {
if (!guiMainThread) 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, QMetaObject::invokeMethod(guiMainThread,
"addSlider2", "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) CV_IMPL int cvCreateTrackbar(const char* name_bar, const char* window_name, int* value, int count, CvTrackbarCallback on_change)
{ {
if (!guiMainThread) 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, QMetaObject::invokeMethod(guiMainThread,
"addSlider", "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) CV_IMPL int cvCreateButton(const char* button_name, CvButtonCallback on_change, void* userdata, int button_type, int initial_button_state)
{ {
if (!guiMainThread) 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) if (initial_button_state < 0 || initial_button_state > 1)
return 0; return 0;
@ -750,7 +750,7 @@ CV_IMPL void cvSetMouseCallback(const char* window_name, CvMouseCallback on_mous
QPointer<CvWindow> w = icvFindWindowByName(QLatin1String(window_name)); QPointer<CvWindow> w = icvFindWindowByName(QLatin1String(window_name));
if (!w) if (!w)
CV_Error(CV_StsNullPtr, "NULL window handler"); CV_Error(cv::Error::StsNullPtr, "NULL window handler");
w->setMouseCallBack(on_mouse, param); 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) CV_IMPL void cvSetOpenGlDrawCallback(const char* window_name, CvOpenGlDrawCallback callback, void* userdata)
{ {
if (!guiMainThread) 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, QMetaObject::invokeMethod(guiMainThread,
"setOpenGlDrawCallback", "setOpenGlDrawCallback",
@ -794,7 +794,7 @@ CV_IMPL void cvSetOpenGlDrawCallback(const char* window_name, CvOpenGlDrawCallba
CV_IMPL void cvSetOpenGlContext(const char* window_name) CV_IMPL void cvSetOpenGlContext(const char* window_name)
{ {
if (!guiMainThread) 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, QMetaObject::invokeMethod(guiMainThread,
"setOpenGlContext", "setOpenGlContext",
@ -806,7 +806,7 @@ CV_IMPL void cvSetOpenGlContext(const char* window_name)
CV_IMPL void cvUpdateWindow(const char* window_name) CV_IMPL void cvUpdateWindow(const char* window_name)
{ {
if (!guiMainThread) 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, QMetaObject::invokeMethod(guiMainThread,
"updateWindow", "updateWindow",
@ -1036,7 +1036,7 @@ void GuiReceiver::toggleFullScreen(QString name, double arg2)
void GuiReceiver::createWindow(QString name, int flags) void GuiReceiver::createWindow(QString name, int flags)
{ {
if (!qApp) if (!qApp)
CV_Error(CV_StsNullPtr, "NULL session handler" ); CV_Error(cv::Error::StsNullPtr, "NULL session handler" );
// Check the name in the storage // Check the name in the storage
if (icvFindWindowByName(name.toLatin1().data())) if (icvFindWindowByName(name.toLatin1().data()))
@ -1127,7 +1127,7 @@ void GuiReceiver::destroyWindow(QString name)
void GuiReceiver::destroyAllWindow() void GuiReceiver::destroyAllWindow()
{ {
if (!qApp) if (!qApp)
CV_Error(CV_StsNullPtr, "NULL session handler" ); CV_Error(cv::Error::StsNullPtr, "NULL session handler" );
if (multiThreads) if (multiThreads)
{ {
@ -1256,7 +1256,7 @@ void GuiReceiver::addSlider2(QString bar_name, QString window_name, void* value,
return; return;
if (count <= 0) //count is the max value of the slider, so must be bigger than 0 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); 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; return;
if (!value) 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 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); CvWindow::addSlider(w, bar_name, (int*)value, count, (CvTrackbarCallback) on_change);
} }
@ -1703,7 +1703,7 @@ CvWindow::CvWindow(QString name, int arg2)
//3: my view //3: my view
#ifndef HAVE_QT_OPENGL #ifndef HAVE_QT_OPENGL
if (arg2 & CV_WINDOW_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; mode_display = CV_MODE_NORMAL;
#else #else
mode_display = arg2 & CV_WINDOW_OPENGL ? CV_MODE_OPENGL : CV_MODE_NORMAL; 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*/) 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() 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() 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; 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");
} }
} }

View File

@ -744,7 +744,7 @@ CvRect cvGetWindowRect_GTK(const char* name)
CV_LOCK_MUTEX(); CV_LOCK_MUTEX();
const auto window = icvFindWindowByName(name); const auto window = icvFindWindowByName(name);
if (!window) if (!window)
CV_Error( CV_StsNullPtr, "NULL window" ); CV_Error( cv::Error::StsNullPtr, "NULL window" );
return cvRect(getImageRect_(window)); return cvRect(getImageRect_(window));
} }
@ -786,7 +786,7 @@ double cvGetModeWindow_GTK(const char* name)//YV
CV_LOCK_MUTEX(); CV_LOCK_MUTEX();
const auto window = icvFindWindowByName(name); const auto window = icvFindWindowByName(name);
if (!window) if (!window)
CV_Error( CV_StsNullPtr, "NULL window" ); CV_Error( cv::Error::StsNullPtr, "NULL window" );
double result = window->status; double result = window->status;
return result; return result;
@ -801,7 +801,7 @@ void cvSetModeWindow_GTK( const char* name, double prop_value)//Yannick Verdie
const auto window = icvFindWindowByName(name); const auto window = icvFindWindowByName(name);
if (!window) if (!window)
CV_Error( CV_StsNullPtr, "NULL window" ); CV_Error( cv::Error::StsNullPtr, "NULL window" );
setModeWindow_(window, (int)prop_value); setModeWindow_(window, (int)prop_value);
} }
@ -917,11 +917,11 @@ namespace
// Try double-buffered visual // Try double-buffered visual
glconfig = gdk_gl_config_new_by_mode((GdkGLConfigMode)(GDK_GL_MODE_RGB | GDK_GL_MODE_DEPTH | GDK_GL_MODE_DOUBLE)); glconfig = gdk_gl_config_new_by_mode((GdkGLConfigMode)(GDK_GL_MODE_RGB | GDK_GL_MODE_DEPTH | GDK_GL_MODE_DOUBLE));
if (!glconfig) 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 // Set OpenGL-capability to the widget
if (!gtk_widget_set_gl_capability(window->widget, glconfig, NULL, TRUE, GDK_GL_RGBA_TYPE)) 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; window->useGl = true;
} }
@ -932,7 +932,7 @@ namespace
GdkGLDrawable* gldrawable = gtk_widget_get_gl_drawable(window->widget); GdkGLDrawable* gldrawable = gtk_widget_get_gl_drawable(window->widget);
if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext)) 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)); 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<CvWindow> namedWindow_(const std::string& name, int flags
#ifndef HAVE_OPENGL #ifndef HAVE_OPENGL
if (flags & CV_WINDOW_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 #else
if (flags & CV_WINDOW_OPENGL) if (flags & CV_WINDOW_OPENGL)
createGlContext(window); createGlContext(window);
@ -1131,16 +1131,16 @@ CV_IMPL void cvSetOpenGlContext(const char* name)
auto window = icvFindWindowByName(name); auto window = icvFindWindowByName(name);
if (!window) if (!window)
CV_Error( CV_StsNullPtr, "NULL window" ); CV_Error( cv::Error::StsNullPtr, "NULL window" );
if (!window->useGl) 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); glcontext = gtk_widget_get_gl_context(window->widget);
gldrawable = gtk_widget_get_gl_drawable(window->widget); gldrawable = gtk_widget_get_gl_drawable(window->widget);
if (!gdk_gl_drawable_make_current(gldrawable, glcontext)) 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) CV_IMPL void cvUpdateWindow(const char* name)
@ -1168,7 +1168,7 @@ CV_IMPL void cvSetOpenGlDrawCallback(const char* name, CvOpenGlDrawCallback call
return; return;
if (!window->useGl) 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->glDrawCallback = callback;
window->glDrawData = userdata; window->glDrawData = userdata;
@ -1384,7 +1384,7 @@ icvCreateTrackbar( const char* trackbar_name, const char* window_name,
CV_Assert(trackbar_name && "NULL trackbar name"); CV_Assert(trackbar_name && "NULL trackbar name");
if( count <= 0 ) if( count <= 0 )
CV_Error( CV_StsOutOfRange, "Bad trackbar maximal value" ); CV_Error( cv::Error::StsOutOfRange, "Bad trackbar maximal value" );
CV_LOCK_MUTEX(); 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); const auto trackbar = icvFindTrackbarByName(window, trackbar_name);
if (!trackbar) if (!trackbar)
{ {
CV_Error( CV_StsNullPtr, "No trackbar found" ); CV_Error( cv::Error::StsNullPtr, "No trackbar found" );
} }
return setTrackbarPos_(trackbar, pos); return setTrackbarPos_(trackbar, pos);

View File

@ -36,7 +36,7 @@
#define CV_WINRT_NO_GUI_ERROR( funcname ) \ #define CV_WINRT_NO_GUI_ERROR( funcname ) \
{ \ { \
cvError( CV_StsNotImplemented, funcname, \ cvError( cv::Error::StsNotImplemented, funcname, \
"The function is not implemented. ", \ "The function is not implemented. ", \
__FILE__, __LINE__ ); \ __FILE__, __LINE__ ); \
} }
@ -65,7 +65,7 @@ CV_IMPL void cvShowImage(const char* name, const CvArr* arr)
CvMat stub, *image; CvMat stub, *image;
if (!name) if (!name)
CV_ERROR(CV_StsNullPtr, "NULL name"); CV_ERROR(cv::Error::StsNullPtr, "NULL name");
CvWindow* window = HighguiBridge::getInstance().namedWindow(name); CvWindow* window = HighguiBridge::getInstance().namedWindow(name);
@ -89,7 +89,7 @@ CV_IMPL int cvNamedWindow(const char* name, int flags)
CV_FUNCNAME("cvNamedWindow"); CV_FUNCNAME("cvNamedWindow");
if (!name) if (!name)
CV_ERROR(CV_StsNullPtr, "NULL name"); CV_ERROR(cv::Error::StsNullPtr, "NULL name");
HighguiBridge::getInstance().namedWindow(name); HighguiBridge::getInstance().namedWindow(name);
@ -101,7 +101,7 @@ CV_IMPL void cvDestroyWindow(const char* name)
CV_FUNCNAME("cvDestroyWindow"); CV_FUNCNAME("cvDestroyWindow");
if (!name) if (!name)
CV_ERROR(CV_StsNullPtr, "NULL name string"); CV_ERROR(cv::Error::StsNullPtr, "NULL name string");
HighguiBridge::getInstance().destroyWindow(name); HighguiBridge::getInstance().destroyWindow(name);
} }
@ -119,16 +119,16 @@ CV_IMPL int cvCreateTrackbar2(const char* trackbar_name, const char* window_name
int pos = 0; int pos = 0;
if (!window_name || !trackbar_name) 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) 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); CvWindow* window = HighguiBridge::getInstance().namedWindow(window_name);
if (!window) if (!window)
{ {
CV_ERROR(CV_StsNullPtr, "NULL window"); CV_ERROR(cv::Error::StsNullPtr, "NULL window");
} }
window->createSlider(trackbar_name, val, count, on_notify, userdata); 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; CvTrackbar* trackbar = 0;
if (trackbar_name == 0 || window_name == 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); CvWindow* window = HighguiBridge::getInstance().findWindowByName(window_name);
if (window) if (window)
@ -160,7 +160,7 @@ CV_IMPL void cvSetTrackbarMax(const char* trackbar_name, const char* window_name
if (maxval >= 0) if (maxval >= 0)
{ {
if (trackbar_name == 0 || window_name == 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); 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 (minval >= 0)
{ {
if (trackbar_name == 0 || window_name == 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); 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"); CV_FUNCNAME("cvGetTrackbarPos");
if (trackbar_name == 0 || window_name == 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); 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"); CV_FUNCNAME("cvSetMouseCallback");
if (!window_name) 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); CvWindow* window = HighguiBridge::getInstance().findWindowByName(window_name);
if (!window) if (!window)
@ -253,19 +253,19 @@ CV_IMPL void cvResizeWindow(const char* name, int width, int height)
CV_IMPL int cvInitSystem(int, char**) CV_IMPL int cvInitSystem(int, char**)
{ {
CV_WINRT_NO_GUI_ERROR("cvInitSystem"); CV_WINRT_NO_GUI_ERROR("cvInitSystem");
return CV_StsNotImplemented; return cv::Error::StsNotImplemented;
} }
CV_IMPL void* cvGetWindowHandle(const char*) CV_IMPL void* cvGetWindowHandle(const char*)
{ {
CV_WINRT_NO_GUI_ERROR("cvGetWindowHandle"); CV_WINRT_NO_GUI_ERROR("cvGetWindowHandle");
return (void*) CV_StsNotImplemented; return (void*) cv::Error::StsNotImplemented;
} }
CV_IMPL const char* cvGetWindowName(void*) CV_IMPL const char* cvGetWindowName(void*)
{ {
CV_WINRT_NO_GUI_ERROR("cvGetWindowName"); 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) { 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) { double cvGetModeWindow_WinRT(const char* name) {
CV_WINRT_NO_GUI_ERROR("cvGetModeWindow"); CV_WINRT_NO_GUI_ERROR("cvGetModeWindow");
return CV_StsNotImplemented; return cv::Error::StsNotImplemented;
} }
CV_IMPL int cvStartWindowThread() { CV_IMPL int cvStartWindowThread() {
CV_WINRT_NO_GUI_ERROR("cvStartWindowThread"); CV_WINRT_NO_GUI_ERROR("cvStartWindowThread");
return CV_StsNotImplemented; return cv::Error::StsNotImplemented;
} }

View File

@ -389,9 +389,9 @@ cvApproxChains( CvSeq* src_seq,
CvSeq *dst_seq = 0; CvSeq *dst_seq = 0;
if( !src_seq || !storage ) 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 ) 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 ) while( src_seq != 0 )
{ {
@ -410,7 +410,7 @@ cvApproxChains( CvSeq* src_seq,
contour = icvApproximateChainTC89( (CvChain *) src_seq, sizeof( CvContour ), storage, method ); contour = icvApproximateChainTC89( (CvChain *) src_seq, sizeof( CvContour ), storage, method );
break; break;
default: default:
CV_Error( CV_StsOutOfRange, "" ); CV_Error( cv::Error::StsOutOfRange, "" );
} }
if( contour->total > 0 ) if( contour->total > 0 )
@ -681,7 +681,7 @@ void cv::approxPolyDP( InputArray _curve, OutputArray _approxCurve,
//from being used. //from being used.
if (epsilon < 0.0 || !(epsilon < 1e30)) 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(); Mat curve = _curve.getMat();
@ -704,7 +704,7 @@ void cv::approxPolyDP( InputArray _curve, OutputArray _approxCurve,
else if( depth == CV_32F ) else if( depth == CV_32F )
nout = approxPolyDP_(curve.ptr<Point2f>(), npoints, (Point2f*)buf, closed, epsilon, _stack); nout = approxPolyDP_(curve.ptr<Point2f>(), npoints, (Point2f*)buf, closed, epsilon, _stack);
else else
CV_Error( CV_StsUnsupportedFormat, "" ); CV_Error( cv::Error::StsUnsupportedFormat, "" );
Mat(nout, 1, CV_MAKETYPE(depth, 2), buf).copyTo(_approxCurve); 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; src_seq = (CvSeq*)array;
if( !CV_IS_SEQ_POLYLINE( src_seq )) if( !CV_IS_SEQ_POLYLINE( src_seq ))
CV_Error( CV_StsBadArg, "Unsupported sequence type" ); CV_Error( cv::Error::StsBadArg, "Unsupported sequence type" );
recursive = parameter2; recursive = parameter2;
@ -743,10 +743,10 @@ cvApproxPoly( const void* array, int header_size,
} }
if( !storage ) if( !storage )
CV_Error( CV_StsNullPtr, "NULL storage pointer " ); CV_Error( cv::Error::StsNullPtr, "NULL storage pointer " );
if( header_size < 0 ) 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" ); "Pass 0 to make the destination header_size == input header_size" );
if( header_size == 0 ) if( header_size == 0 )
@ -756,12 +756,12 @@ cvApproxPoly( const void* array, int header_size,
{ {
if( CV_IS_SEQ_CHAIN( src_seq )) 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" ); "Use cvApproxChains first" );
} }
else 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; header_size = src_seq->header_size;
if( header_size < (int)sizeof(CvContour) ) 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 ) 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 ) while( src_seq != 0 )
{ {
@ -782,7 +782,7 @@ cvApproxPoly( const void* array, int header_size,
{ {
case CV_POLY_APPROX_DP: case CV_POLY_APPROX_DP:
if( parameter < 0 ) 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_Assert( CV_SEQ_ELTYPE(src_seq) == CV_32SC2 ||
CV_SEQ_ELTYPE(src_seq) == CV_32FC2 ); 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, nout = cv::approxPolyDP_((cv::Point2f*)src, npoints,
(cv::Point2f*)dst, closed, parameter, stack); (cv::Point2f*)dst, closed, parameter, stack);
else else
CV_Error( CV_StsUnsupportedFormat, "" ); CV_Error( cv::Error::StsUnsupportedFormat, "" );
contour = cvCreateSeq( src_seq->flags, header_size, contour = cvCreateSeq( src_seq->flags, header_size,
src_seq->elem_size, storage ); src_seq->elem_size, storage );
@ -812,7 +812,7 @@ cvApproxPoly( const void* array, int header_size,
} }
break; break;
default: default:
CV_Error( CV_StsBadArg, "Invalid approximation method" ); CV_Error( cv::Error::StsBadArg, "Invalid approximation method" );
} }
CV_Assert( contour ); CV_Assert( contour );

View File

@ -422,7 +422,7 @@ void bilateralFilter( InputArray _src, OutputArray _dst, int d,
else if( src.depth() == CV_32F ) else if( src.depth() == CV_32F )
bilateralFilter_32f( src, dst, d, sigmaColor, sigmaSpace, borderType ); bilateralFilter_32f( src, dst, d, sigmaColor, sigmaSpace, borderType );
else else
CV_Error( CV_StsUnsupportedFormat, CV_Error( cv::Error::StsUnsupportedFormat,
"Bilateral filtering is only implemented for 8u and 32f images" ); "Bilateral filtering is only implemented for 8u and 32f images" );
} }

View File

@ -1200,7 +1200,7 @@ Ptr<BaseRowFilter> getRowSumFilter(int srcType, int sumType, int ksize, int anch
if( sdepth == CV_64F && ddepth == CV_64F ) if( sdepth == CV_64F && ddepth == CV_64F )
return makePtr<RowSum<double, double> >(ksize, anchor); return makePtr<RowSum<double, double> >(ksize, anchor);
CV_Error_( CV_StsNotImplemented, CV_Error_( cv::Error::StsNotImplemented,
("Unsupported combination of source format (=%d), and buffer format (=%d)", ("Unsupported combination of source format (=%d), and buffer format (=%d)",
srcType, sumType)); srcType, sumType));
} }
@ -1241,7 +1241,7 @@ Ptr<BaseColumnFilter> getColumnSumFilter(int sumType, int dstType, int ksize, in
if( ddepth == CV_64F && sdepth == CV_64F ) if( ddepth == CV_64F && sdepth == CV_64F )
return makePtr<ColumnSum<double, double> >(ksize, anchor, scale); return makePtr<ColumnSum<double, double> >(ksize, anchor, scale);
CV_Error_( CV_StsNotImplemented, CV_Error_( cv::Error::StsNotImplemented,
("Unsupported combination of sum format (=%d), and destination format (=%d)", ("Unsupported combination of sum format (=%d), and destination format (=%d)",
sumType, dstType)); sumType, dstType));
} }
@ -1339,7 +1339,7 @@ Ptr<BaseRowFilter> getSqrRowSumFilter(int srcType, int sumType, int ksize, int a
if( sdepth == CV_64F && ddepth == CV_64F ) if( sdepth == CV_64F && ddepth == CV_64F )
return makePtr<SqrRowSum<double, double> >(ksize, anchor); return makePtr<SqrRowSum<double, double> >(ksize, anchor);
CV_Error_( CV_StsNotImplemented, CV_Error_( cv::Error::StsNotImplemented,
("Unsupported combination of source format (=%d), and buffer format (=%d)", ("Unsupported combination of source format (=%d), and buffer format (=%d)",
srcType, sumType)); srcType, sumType));
} }

View File

@ -844,7 +844,7 @@ void Canny( InputArray _src, OutputArray _dst,
} }
if ((aperture_size & 1) == 0 || (aperture_size != -1 && (aperture_size < 3 || aperture_size > 7))) 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) if (aperture_size == 7)
{ {

View File

@ -415,7 +415,7 @@ namespace
else if (_src.type() == CV_16UC1) else if (_src.type() == CV_16UC1)
calcLutBody = cv::makePtr<CLAHE_CalcLut_Body<ushort, 65536, 0> >(srcForLut, lut_, tileSize, tilesX_, clipLimit, lutScale); calcLutBody = cv::makePtr<CLAHE_CalcLut_Body<ushort, 65536, 0> >(srcForLut, lut_, tileSize, tilesX_, clipLimit, lutScale);
else else
CV_Error( CV_StsBadArg, "Unsupported type" ); CV_Error( cv::Error::StsBadArg, "Unsupported type" );
cv::parallel_for_(cv::Range(0, tilesX_ * tilesY_), *calcLutBody); cv::parallel_for_(cv::Range(0, tilesX_ * tilesY_), *calcLutBody);

View File

@ -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: case COLOR_YUV2BGRA_NV21: case COLOR_YUV2RGBA_NV21: case COLOR_YUV2BGRA_NV12: case COLOR_YUV2RGBA_NV12:
break; break;
default: default:
CV_Error( CV_StsBadFlag, "Unknown/unsupported color conversion code" ); CV_Error( cv::Error::StsBadFlag, "Unknown/unsupported color conversion code" );
return; return;
} }
@ -379,7 +379,7 @@ void cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
cvtColormRGBA2RGBA(_src, _dst); cvtColormRGBA2RGBA(_src, _dst);
break; break;
default: default:
CV_Error( CV_StsBadFlag, "Unknown/unsupported color conversion code" ); CV_Error( cv::Error::StsBadFlag, "Unknown/unsupported color conversion code" );
} }
} }
} //namespace cv } //namespace cv

View File

@ -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 401: cvtPtr = cvtYUV420sp2RGB<0, 1, 4>; break;
case 420: cvtPtr = cvtYUV420sp2RGB<2, 0, 4>; break; case 420: cvtPtr = cvtYUV420sp2RGB<2, 0, 4>; break;
case 421: cvtPtr = cvtYUV420sp2RGB<2, 1, 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); 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 32: cvtPtr = cvtYUV420p2RGB<2, 3>; break;
case 40: cvtPtr = cvtYUV420p2RGB<0, 4>; break; case 40: cvtPtr = cvtYUV420p2RGB<0, 4>; break;
case 42: cvtPtr = cvtYUV420p2RGB<2, 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); 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 4200: cvtPtr = cvtYUV422toRGB<2,0,0,4>; break;
case 4201: cvtPtr = cvtYUV422toRGB<2,0,1,4>; break; case 4201: cvtPtr = cvtYUV422toRGB<2,0,1,4>; break;
case 4210: cvtPtr = cvtYUV422toRGB<2,1,0,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); 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 4200: cvtPtr = cvtRGBtoYUV422<2,0,0,4>; break;
case 4201: cvtPtr = cvtRGBtoYUV422<2,0,1,4>; break; case 4201: cvtPtr = cvtRGBtoYUV422<2,0,1,4>; break;
case 4210: cvtPtr = cvtRGBtoYUV422<2,1,0,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); cvtPtr(dst_data, dst_step, src_data, src_step, width, height);

View File

@ -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); return connectedComponents_sub1(img, labels, connectivity, ccltype, sop);
} }
else{ 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); return connectedComponents_sub1(img, labels, connectivity, ccltype, sop);
} }
else{ 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; return 0;
} }
} }

View File

@ -59,10 +59,10 @@ cvStartReadChainPoints( CvChain * chain, CvChainPtReader * reader )
int i; int i;
if( !chain || !reader ) if( !chain || !reader )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( chain->elem_size != 1 || chain->header_size < (int)sizeof(CvChain)) 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 ); cvStartReadSeq( (CvSeq *) chain, (CvSeqReader *) reader, 0 );
@ -80,7 +80,7 @@ CV_IMPL CvPoint
cvReadChainPoint( CvChainPtReader * reader ) cvReadChainPoint( CvChainPtReader * reader )
{ {
if( !reader ) if( !reader )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
cv::Point2i pt = reader->pt; cv::Point2i pt = reader->pt;
@ -180,7 +180,7 @@ cvStartFindContours_Impl( void* _img, CvMemStorage* storage,
int method, CvPoint offset, int needFillBorder ) int method, CvPoint offset, int needFillBorder )
{ {
if( !storage ) if( !storage )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
CvMat stub, *mat = cvGetMat( _img, &stub ); 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) || if( !((CV_IS_MASK_ARR( mat ) && mode < CV_RETR_FLOODFILL) ||
(CV_MAT_TYPE(mat->type) == CV_32SC1 && 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 " "[Start]FindContours supports only CV_8UC1 images when mode != CV_RETR_FLOODFILL "
"otherwise supports CV_32SC1 images only" ); "otherwise supports CV_32SC1 images only" );
@ -198,10 +198,10 @@ cvStartFindContours_Impl( void* _img, CvMemStorage* storage,
uchar* img = (uchar*)(mat->data.ptr); uchar* img = (uchar*)(mat->data.ptr);
if( method < 0 || method > CV_CHAIN_APPROX_TC89_KCOS ) 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 ))) 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 )); CvContourScanner scanner = (CvContourScanner)cvAlloc( sizeof( *scanner ));
memset( scanner, 0, sizeof(*scanner) ); memset( scanner, 0, sizeof(*scanner) );
@ -487,7 +487,7 @@ cvSubstituteContour( CvContourScanner scanner, CvSeq * new_contour )
_CvContourInfo *l_cinfo; _CvContourInfo *l_cinfo;
if( !scanner ) if( !scanner )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
l_cinfo = scanner->l_cinfo; l_cinfo = scanner->l_cinfo;
if( l_cinfo && l_cinfo->contour && l_cinfo->contour != new_contour ) if( l_cinfo && l_cinfo->contour && l_cinfo->contour != new_contour )
@ -1029,7 +1029,7 @@ CvSeq *
cvFindNextContour( CvContourScanner scanner ) cvFindNextContour( CvContourScanner scanner )
{ {
if( !scanner ) if( !scanner )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
CV_Assert(scanner->img_step >= 0); CV_Assert(scanner->img_step >= 0);
@ -1313,7 +1313,7 @@ cvEndFindContours( CvContourScanner * _scanner )
CvSeq *first = 0; CvSeq *first = 0;
if( !_scanner ) if( !_scanner )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
scanner = *_scanner; scanner = *_scanner;
if( scanner ) if( scanner )
@ -1438,13 +1438,13 @@ icvFindContoursInInterval( const CvArr* src,
CvSeq* prev = 0; CvSeq* prev = 0;
if( !storage ) if( !storage )
CV_Error( CV_StsNullPtr, "NULL storage pointer" ); CV_Error( cv::Error::StsNullPtr, "NULL storage pointer" );
if( !result ) if( !result )
CV_Error( CV_StsNullPtr, "NULL double CvSeq pointer" ); CV_Error( cv::Error::StsNullPtr, "NULL double CvSeq pointer" );
if( contourHeaderSize < (int)sizeof(CvContour)) 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)); storage00.reset(cvCreateChildMemStorage(storage));
storage01.reset(cvCreateChildMemStorage(storage)); storage01.reset(cvCreateChildMemStorage(storage));
@ -1453,7 +1453,7 @@ icvFindContoursInInterval( const CvArr* src,
mat = cvGetMat( src, &stub ); mat = cvGetMat( src, &stub );
if( !CV_IS_MASK_ARR(mat)) 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; src_data = mat->data.ptr;
img_step = mat->step; img_step = mat->step;
img_size = cvGetMatSize(mat); img_size = cvGetMatSize(mat);
@ -1745,14 +1745,14 @@ cvFindContours_Impl( void* img, CvMemStorage* storage,
int count = -1; int count = -1;
if( !firstContour ) if( !firstContour )
CV_Error( CV_StsNullPtr, "NULL double CvSeq pointer" ); CV_Error( cv::Error::StsNullPtr, "NULL double CvSeq pointer" );
*firstContour = 0; *firstContour = 0;
if( method == CV_LINK_RUNS ) if( method == CV_LINK_RUNS )
{ {
if( offset.x != 0 || offset.y != 0 ) 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" ); "Nonzero offset is not supported in CV_LINK_RUNS yet" );
count = icvFindContoursInInterval( img, storage, firstContour, cntHeaderSize ); count = icvFindContoursInInterval( img, storage, firstContour, cntHeaderSize );

View File

@ -471,7 +471,7 @@ cvConvexHull2( const CvArr* array, void* hull_storage,
{ {
ptseq = (CvSeq*)array; ptseq = (CvSeq*)array;
if( !CV_IS_SEQ_POINT_SET( ptseq )) 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 ) if( hull_storage == 0 )
hull_storage = ptseq->storage; hull_storage = ptseq->storage;
} }
@ -503,15 +503,15 @@ cvConvexHull2( const CvArr* array, void* hull_storage,
mat = (CvMat*)hull_storage; mat = (CvMat*)hull_storage;
if( (mat->cols != 1 && mat->rows != 1) || !CV_IS_MAT_CONT(mat->type)) 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" ); "The hull matrix should be continuous and have a single row or a single column" );
if( mat->cols + mat->rows - 1 < ptseq->total ) 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) && if( CV_MAT_TYPE(mat->type) != CV_SEQ_ELTYPE(ptseq) &&
CV_MAT_TYPE(mat->type) != CV_32SC1 ) 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)" ); "The hull matrix must have the same type as input or 32sC1 (integers)" );
hullseq = cvMakeSeqHeaderForArray( hullseq = cvMakeSeqHeaderForArray(
@ -526,7 +526,7 @@ cvConvexHull2( const CvArr* array, void* hull_storage,
if( total == 0 ) if( total == 0 )
{ {
if( !isStorage ) if( !isStorage )
CV_Error( CV_StsBadSize, CV_Error( cv::Error::StsBadSize,
"Point sequence can not be empty if the output is matrix" ); "Point sequence can not be empty if the output is matrix" );
return 0; return 0;
} }
@ -592,7 +592,7 @@ CV_IMPL CvSeq* cvConvexityDefects( const CvArr* array,
if( CV_IS_SEQ( ptseq )) if( CV_IS_SEQ( ptseq ))
{ {
if( !CV_IS_SEQ_POINT_SET( 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" ); "Input sequence is not a sequence of points" );
if( !storage ) if( !storage )
storage = ptseq->storage; storage = ptseq->storage;
@ -603,13 +603,13 @@ CV_IMPL CvSeq* cvConvexityDefects( const CvArr* array,
} }
if( CV_SEQ_ELTYPE( ptseq ) != CV_32SC2 ) 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 )) if( CV_IS_SEQ( hull ))
{ {
int hulltype = CV_SEQ_ELTYPE( hull ); int hulltype = CV_SEQ_ELTYPE( hull );
if( hulltype != CV_SEQ_ELTYPE_PPOINT && hulltype != CV_SEQ_ELTYPE_INDEX ) 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 " "Convex hull must represented as a sequence "
"of indices or sequence of pointers" ); "of indices or sequence of pointers" );
if( !storage ) if( !storage )
@ -620,15 +620,15 @@ CV_IMPL CvSeq* cvConvexityDefects( const CvArr* array,
CvMat* mat = (CvMat*)hull; CvMat* mat = (CvMat*)hull;
if( !CV_IS_MAT( 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) || if( (mat->cols != 1 && mat->rows != 1) ||
!CV_IS_MAT_CONT(mat->type) || CV_MAT_TYPE(mat->type) != CV_32SC1 ) !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" ); "The matrix should be 1-dimensional and continuous array of int's" );
if( mat->cols + mat->rows - 1 > ptseq->total ) 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( hull = cvMakeSeqHeaderForArray(
CV_SEQ_KIND_CURVE|CV_MAT_TYPE(mat->type)|CV_SEQ_FLAG_CLOSED, 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; is_index = CV_SEQ_ELTYPE(hull) == CV_SEQ_ELTYPE_INDEX;
if( !storage ) 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 ); defects = cvCreateSeq( CV_SEQ_KIND_GENERIC, sizeof(CvSeq), sizeof(CvConvexityDefect), storage );
if( ptseq->total < 4 || hull->total < 3) 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" ); // "point seq size must be >= 4, convex hull size must be >= 3" );
return defects; return defects;
} }
@ -779,7 +779,7 @@ cvCheckContourConvexity( const CvArr* array )
if( CV_IS_SEQ(contour) ) if( CV_IS_SEQ(contour) )
{ {
if( !CV_IS_SEQ_POINT_SET(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)" ); "Input sequence must be polygon (closed 2d curve)" );
} }
else else

View File

@ -1708,7 +1708,7 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn)
else if( depth == CV_16U ) else if( depth == CV_16U )
Bayer2Gray_<ushort, SIMDBayerStubInterpolator_<ushort> >(src, dst, code); Bayer2Gray_<ushort, SIMDBayerStubInterpolator_<ushort> >(src, dst, code);
else 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; break;
case COLOR_BayerBG2BGRA: case COLOR_BayerGB2BGRA: case COLOR_BayerRG2BGRA: case COLOR_BayerGR2BGRA: 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 ) else if( depth == CV_16U )
Bayer2RGB_<ushort, SIMDBayerStubInterpolator_<ushort> >(src, dst_, code); Bayer2RGB_<ushort, SIMDBayerStubInterpolator_<ushort> >(src, dst_, code);
else 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 else
{ {
@ -1758,11 +1758,11 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn)
else if (depth == CV_16U) else if (depth == CV_16U)
Bayer2RGB_EdgeAware_T<ushort, SIMDBayerStubInterpolator_<ushort> >(src, dst, code); Bayer2RGB_EdgeAware_T<ushort, SIMDBayerStubInterpolator_<ushort> >(src, dst, code);
else 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; break;
default: default:
CV_Error( CV_StsBadFlag, "Unknown / unsupported color conversion code" ); CV_Error( cv::Error::StsBadFlag, "Unknown / unsupported color conversion code" );
} }
} }

View File

@ -101,7 +101,7 @@ static void getSobelKernels( OutputArray _kx, OutputArray _ky,
Mat ky = _ky.getMat(); Mat ky = _ky.getMat();
if( _ksize % 2 == 0 || _ksize > 31 ) 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<int> kerI(std::max(ksizeX, ksizeY) + 1); std::vector<int> kerI(std::max(ksizeX, ksizeY) + 1);
CV_Assert( dx >= 0 && dy >= 0 && dx+dy > 0 ); CV_Assert( dx >= 0 && dy >= 0 && dx+dy > 0 );

View File

@ -448,7 +448,7 @@ static void getDistanceTransformMask( int maskType, float *metrics )
metrics[2] = 2.1969f; metrics[2] = 2.1969f;
break; break;
default: 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}; float _mask[5] = {0};
if( maskSize != cv::DIST_MASK_3 && maskSize != cv::DIST_MASK_5 && maskSize != cv::DIST_MASK_PRECISE ) 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) if ((distType == cv::DIST_C || distType == cv::DIST_L1) && !need_labels)
maskSize = cv::DIST_MASK_3; maskSize = cv::DIST_MASK_3;

View File

@ -2239,7 +2239,7 @@ static const int* getFontData(int fontFace)
ascii = HersheyScriptComplex; ascii = HersheyScriptComplex;
break; break;
default: default:
CV_Error( CV_StsOutOfRange, "Unknown font type" ); CV_Error( cv::Error::StsOutOfRange, "Unknown font type" );
} }
return ascii; return ascii;
} }

View File

@ -174,28 +174,28 @@ CV_IMPL float cvCalcEMD2( const CvArr* signature_arr1,
signature2 = cvGetMat( signature2, &sign_stub2 ); signature2 = cvGetMat( signature2, &sign_stub2 );
if( signature1->cols != signature2->cols ) 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; dims = signature1->cols - 1;
size1 = signature1->rows; size1 = signature1->rows;
size2 = signature2->rows; size2 = signature2->rows;
if( !CV_ARE_TYPES_EQ( signature1, signature2 )) 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 ) 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 ) if( flow )
{ {
flow = cvGetMat( flow, &flow_stub ); flow = cvGetMat( flow, &flow_stub );
if( flow->rows != size1 || flow->cols != size2 ) 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" ); "The flow matrix size does not match to the signatures' sizes" );
if( CV_MAT_TYPE( flow->type ) != CV_32FC1 ) 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; cost->data.fl = 0;
@ -206,28 +206,28 @@ CV_IMPL float cvCalcEMD2( const CvArr* signature_arr1,
if( cost_matrix ) if( cost_matrix )
{ {
if( dist_func ) 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" ); "Only one of cost matrix or distance function should be non-NULL in case of user-defined distance" );
if( lower_bound ) 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" ); "The lower boundary can not be calculated if the cost matrix is used" );
cost = cvGetMat( cost_matrix, &cost_stub ); cost = cvGetMat( cost_matrix, &cost_stub );
if( cost->rows != size1 || cost->cols != size2 ) 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" ); "The cost matrix size does not match to the signatures' sizes" );
if( CV_MAT_TYPE( cost->type ) != CV_32FC1 ) 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 ) 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 else
{ {
if( dims == 0 ) 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" ); "Number of dimensions can be 0 only if a user-defined metric is used" );
user_param = (void *) (size_t)dims; user_param = (void *) (size_t)dims;
switch (dist_type) switch (dist_type)
@ -242,7 +242,7 @@ CV_IMPL float cvCalcEMD2( const CvArr* signature_arr1,
dist_func = icvDistC; dist_func = icvDistC;
break; break;
default: 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 ); state.ssize, state.dsize, state.enter_x );
if( min_delta == CV_EMD_INF ) 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 no negative deltamin, we found the optimal solution */
if( min_delta >= -eps ) if( min_delta >= -eps )
@ -287,7 +287,7 @@ CV_IMPL float cvCalcEMD2( const CvArr* signature_arr1,
/* improve solution */ /* improve solution */
if(!icvNewSolution( &state )) 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 ) 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++ ) for( i = 0; i < size2; i++ )
@ -401,13 +401,13 @@ static int icvInitEMD( const float* signature1, int size1,
state->idx2[dsize++] = i; state->idx2[dsize++] = i;
} }
else if( weight < 0 ) 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 ) 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 ) 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 */ /* if supply different than the demand, add a zero-cost dummy cluster */
diff = s_sum - d_sum; diff = s_sum - d_sum;

View File

@ -3039,7 +3039,7 @@ Ptr<BaseRowFilter> getLinearRowFilter(
if( sdepth == CV_64F && ddepth == CV_64F ) if( sdepth == CV_64F && ddepth == CV_64F )
return makePtr<RowFilter<double, double, RowNoVec> >(kernel, anchor); return makePtr<RowFilter<double, double, RowNoVec> >(kernel, anchor);
CV_Error_( CV_StsNotImplemented, CV_Error_( cv::Error::StsNotImplemented,
("Unsupported combination of source format (=%d), and buffer format (=%d)", ("Unsupported combination of source format (=%d), and buffer format (=%d)",
srcType, bufType)); srcType, bufType));
} }
@ -3137,7 +3137,7 @@ Ptr<BaseColumnFilter> getLinearColumnFilter(
(kernel, anchor, delta, symmetryType); (kernel, anchor, delta, symmetryType);
} }
CV_Error_( CV_StsNotImplemented, CV_Error_( cv::Error::StsNotImplemented,
("Unsupported combination of buffer format (=%d), and destination format (=%d)", ("Unsupported combination of buffer format (=%d), and destination format (=%d)",
bufType, dstType)); bufType, dstType));
} }
@ -3291,7 +3291,7 @@ Ptr<BaseFilter> getLinearFilter(
return makePtr<Filter2D<double, return makePtr<Filter2D<double,
Cast<double, double>, FilterNoVec> >(kernel, anchor, delta); Cast<double, double>, FilterNoVec> >(kernel, anchor, delta);
CV_Error_( CV_StsNotImplemented, CV_Error_( cv::Error::StsNotImplemented,
("Unsupported combination of source format (=%d), and destination format (=%d)", ("Unsupported combination of source format (=%d), and destination format (=%d)",
srcType, dstType)); srcType, dstType));
} }

View File

@ -487,12 +487,12 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask,
if ( (cn != 1) && (cn != 3) ) 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; const int connectivity = flags & 255;
if( connectivity != 0 && connectivity != 4 && connectivity != 8 ) 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() ) if( _mask.empty() )
{ {
@ -513,13 +513,13 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask,
for( i = 0; i < cn; i++ ) for( i = 0; i < cn; i++ )
{ {
if( loDiff[i] < 0 || upDiff[i] < 0 ) 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; is_simple = is_simple && fabs(loDiff[i]) < DBL_EPSILON && fabs(upDiff[i]) < DBL_EPSILON;
} }
if( (unsigned)seedPoint.x >= (unsigned)size.width || if( (unsigned)seedPoint.x >= (unsigned)size.width ||
(unsigned)seedPoint.y >= (unsigned)size.height ) (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); scalarToRawData( newVal, &nv_buf, type, 0);
size_t buffer_size = MAX( size.width, size.height ) * 2; 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 ) else if( type == CV_32FC3 )
floodFill_CnIR(img, seedPoint, Vec3f(nv_buf.f), &comp, flags, &buffer); floodFill_CnIR(img, seedPoint, Vec3f(nv_buf.f), &comp, flags, &buffer);
else else
CV_Error( CV_StsUnsupportedFormat, "" ); CV_Error( cv::Error::StsUnsupportedFormat, "" );
if( rect ) if( rect )
*rect = comp.rect; *rect = comp.rect;
return comp.area; return comp.area;
@ -583,7 +583,7 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask,
ud_buf.f[i] = (float)upDiff[i]; ud_buf.f[i] = (float)upDiff[i];
} }
else else
CV_Error( CV_StsUnsupportedFormat, "" ); CV_Error( cv::Error::StsUnsupportedFormat, "" );
uchar newMaskVal = (uchar)((flags & 0xff00) == 0 ? 1 : ((flags >> 8) & 255)); 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), Diff32fC3(ld_buf.f, ud_buf.f),
&comp, flags, &buffer); &comp, flags, &buffer);
else else
CV_Error(CV_StsUnsupportedFormat, ""); CV_Error(cv::Error::StsUnsupportedFormat, "");
if( rect ) if( rect )
*rect = comp.rect; *rect = comp.rect;

View File

@ -87,7 +87,7 @@ CV_IMPL void
cvBoxPoints( CvBox2D box, CvPoint2D32f pt[4] ) cvBoxPoints( CvBox2D box, CvPoint2D32f pt[4] )
{ {
if( !pt ) 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); cv::RotatedRect(box).points((cv::Point2f*)pt);
} }

View File

@ -96,7 +96,7 @@ GMM::GMM( Mat& _model )
_model.setTo(Scalar(0)); _model.setTo(Scalar(0));
} }
else if( (_model.type() != CV_64FC1) || (_model.rows != 1) || (_model.cols != modelSize*componentsCount) ) 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; 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 ) static void checkMask( const Mat& img, const Mat& mask )
{ {
if( mask.empty() ) if( mask.empty() )
CV_Error( CV_StsBadArg, "mask is empty" ); CV_Error( cv::Error::StsBadArg, "mask is empty" );
if( mask.type() != CV_8UC1 ) 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 ) 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 y = 0; y < mask.rows; y++ )
{ {
for( int x = 0; x < mask.cols; x++ ) for( int x = 0; x < mask.cols; x++ )
{ {
uchar val = mask.at<uchar>(y,x); uchar val = mask.at<uchar>(y,x);
if( val!=GC_BGD && val!=GC_FGD && val!=GC_PR_BGD && val!=GC_PR_FGD ) 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" ); "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(); Mat& fgdModel = _fgdModel.getMatRef();
if( img.empty() ) if( img.empty() )
CV_Error( CV_StsBadArg, "image is empty" ); CV_Error( cv::Error::StsBadArg, "image is empty" );
if( img.type() != CV_8UC3 ) 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 ); GMM bgdGMM( bgdModel ), fgdGMM( fgdModel );
Mat compIdxs( img.size(), CV_32SC1 ); Mat compIdxs( img.size(), CV_32SC1 );

View File

@ -1005,7 +1005,7 @@ void cv::calcHist( const Mat* images, int nimages, const int* channels,
else if( depth == CV_32F ) else if( depth == CV_32F )
calcHist_<float>(ptrs, deltas, imsize, ihist, dims, ranges, _uniranges, uniform ); calcHist_<float>(ptrs, deltas, imsize, ihist, dims, ranges, _uniranges, uniform );
else else
CV_Error(CV_StsUnsupportedFormat, ""); CV_Error(cv::Error::StsUnsupportedFormat, "");
ihist.convertTo(hist, CV_32F); 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 ) else if( depth == CV_32F )
calcSparseHist_<float>(ptrs, deltas, imsize, hist, dims, ranges, _uniranges, uniform ); calcSparseHist_<float>(ptrs, deltas, imsize, hist, dims, ranges, _uniranges, uniform );
else else
CV_Error(CV_StsUnsupportedFormat, ""); CV_Error(cv::Error::StsUnsupportedFormat, "");
if( !keepInt ) if( !keepInt )
{ {
@ -1637,7 +1637,7 @@ void cv::calcBackProject( const Mat* images, int nimages, const int* channels,
else if( depth == CV_32F ) else if( depth == CV_32F )
calcBackProj_<float, float>(ptrs, deltas, imsize, hist, dims, ranges, _uniranges, (float)scale, uniform ); calcBackProj_<float, float>(ptrs, deltas, imsize, hist, dims, ranges, _uniranges, (float)scale, uniform );
else 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_<float, float>(ptrs, deltas, imsize, hist, dims, ranges, calcSparseBackProj_<float, float>(ptrs, deltas, imsize, hist, dims, ranges,
_uniranges, (float)scale, uniform ); _uniranges, (float)scale, uniform );
else else
CV_Error(CV_StsUnsupportedFormat, ""); CV_Error(cv::Error::StsUnsupportedFormat, "");
} }
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
@ -2211,7 +2211,7 @@ double cv::compareHist( InputArray _H1, InputArray _H2, int method )
} }
} }
else else
CV_Error( CV_StsBadArg, "Unknown comparison method" ); CV_Error( cv::Error::StsBadArg, "Unknown comparison method" );
} }
if( method == CV_COMP_CHISQR_ALT ) if( method == CV_COMP_CHISQR_ALT )
@ -2350,7 +2350,7 @@ double cv::compareHist( const SparseMat& H1, const SparseMat& H2, int method )
} }
} }
else else
CV_Error( CV_StsBadArg, "Unknown comparison method" ); CV_Error( cv::Error::StsBadArg, "Unknown comparison method" );
if( method == CV_COMP_CHISQR_ALT ) if( method == CV_COMP_CHISQR_ALT )
result *= 2; result *= 2;
@ -2387,7 +2387,7 @@ cvCreateHist( int dims, int *sizes, CvHistType type, float** ranges, int uniform
else if( type == CV_HIST_SPARSE ) else if( type == CV_HIST_SPARSE )
hist->bins = cvCreateSparseMat( dims, sizes, CV_HIST_DEFAULT_TYPE ); hist->bins = cvCreateSparseMat( dims, sizes, CV_HIST_DEFAULT_TYPE );
else else
CV_Error( CV_StsBadArg, "Invalid histogram type" ); CV_Error( cv::Error::StsBadArg, "Invalid histogram type" );
if( ranges ) if( ranges )
cvSetHistBinRanges( hist, ranges, uniform ); cvSetHistBinRanges( hist, ranges, uniform );
@ -2402,10 +2402,10 @@ cvMakeHistHeaderForArray( int dims, int *sizes, CvHistogram *hist,
float *data, float **ranges, int uniform ) float *data, float **ranges, int uniform )
{ {
if( !hist ) if( !hist )
CV_Error( CV_StsNullPtr, "Null histogram header pointer" ); CV_Error( cv::Error::StsNullPtr, "Null histogram header pointer" );
if( !data ) if( !data )
CV_Error( CV_StsNullPtr, "Null data pointer" ); CV_Error( cv::Error::StsNullPtr, "Null data pointer" );
hist->thresh2 = 0; hist->thresh2 = 0;
hist->type = CV_HIST_MAGIC_VAL; hist->type = CV_HIST_MAGIC_VAL;
@ -2414,7 +2414,7 @@ cvMakeHistHeaderForArray( int dims, int *sizes, CvHistogram *hist,
if( ranges ) if( ranges )
{ {
if( !uniform ) 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)" ); "(to avoid memory allocation)" );
cvSetHistBinRanges( hist, ranges, uniform ); cvSetHistBinRanges( hist, ranges, uniform );
} }
@ -2427,14 +2427,14 @@ CV_IMPL void
cvReleaseHist( CvHistogram **hist ) cvReleaseHist( CvHistogram **hist )
{ {
if( !hist ) if( !hist )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( *hist ) if( *hist )
{ {
CvHistogram* temp = *hist; CvHistogram* temp = *hist;
if( !CV_IS_HIST(temp)) if( !CV_IS_HIST(temp))
CV_Error( CV_StsBadArg, "Invalid histogram header" ); CV_Error( cv::Error::StsBadArg, "Invalid histogram header" );
*hist = 0; *hist = 0;
if( CV_IS_SPARSE_HIST( temp )) if( CV_IS_SPARSE_HIST( temp ))
@ -2455,7 +2455,7 @@ CV_IMPL void
cvClearHist( CvHistogram *hist ) cvClearHist( CvHistogram *hist )
{ {
if( !CV_IS_HIST(hist) ) if( !CV_IS_HIST(hist) )
CV_Error( CV_StsBadArg, "Invalid histogram header" ); CV_Error( cv::Error::StsBadArg, "Invalid histogram header" );
cvZero( hist->bins ); cvZero( hist->bins );
} }
@ -2465,7 +2465,7 @@ CV_IMPL void
cvThreshHist( CvHistogram* hist, double thresh ) cvThreshHist( CvHistogram* hist, double thresh )
{ {
if( !CV_IS_HIST(hist) ) 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) ) if( !CV_IS_SPARSE_MAT(hist->bins) )
{ {
@ -2497,7 +2497,7 @@ cvNormalizeHist( CvHistogram* hist, double factor )
double sum = 0; double sum = 0;
if( !CV_IS_HIST(hist) ) 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) ) if( !CV_IS_SPARSE_HIST(hist) )
{ {
@ -2544,7 +2544,7 @@ cvGetMinMaxHistValue( const CvHistogram* hist,
int dims, size[CV_MAX_DIM]; int dims, size[CV_MAX_DIM];
if( !CV_IS_HIST(hist) ) 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 ); dims = cvGetDims( hist->bins, size );
@ -2662,10 +2662,10 @@ cvCompareHist( const CvHistogram* hist1,
int size1[CV_MAX_DIM], size2[CV_MAX_DIM], total = 1; int size1[CV_MAX_DIM], size2[CV_MAX_DIM], total = 1;
if( !CV_IS_HIST(hist1) || !CV_IS_HIST(hist2) ) 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)) 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) ) if( !CV_IS_SPARSE_MAT(hist1->bins) )
{ {
@ -2678,13 +2678,13 @@ cvCompareHist( const CvHistogram* hist1,
int dims2 = cvGetDims( hist2->bins, size2 ); int dims2 = cvGetDims( hist2->bins, size2 );
if( dims1 != dims2 ) if( dims1 != dims2 )
CV_Error( CV_StsUnmatchedSizes, CV_Error( cv::Error::StsUnmatchedSizes,
"The histograms have different numbers of dimensions" ); "The histograms have different numbers of dimensions" );
for( i = 0; i < dims1; i++ ) for( i = 0; i < dims1; i++ )
{ {
if( size1[i] != size2[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]; total *= size1[i];
} }
@ -2804,7 +2804,7 @@ cvCompareHist( const CvHistogram* hist1,
result = cv::compareHist( sH1, sH2, CV_COMP_KL_DIV ); result = cv::compareHist( sH1, sH2, CV_COMP_KL_DIV );
} }
else else
CV_Error( CV_StsBadArg, "Unknown comparison method" ); CV_Error( cv::Error::StsBadArg, "Unknown comparison method" );
if( method == CV_COMP_CHISQR_ALT ) if( method == CV_COMP_CHISQR_ALT )
result *= 2; result *= 2;
@ -2817,12 +2817,12 @@ CV_IMPL void
cvCopyHist( const CvHistogram* src, CvHistogram** _dst ) cvCopyHist( const CvHistogram* src, CvHistogram** _dst )
{ {
if( !_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; CvHistogram* dst = *_dst;
if( !CV_IS_HIST(src) || (dst && !CV_IS_HIST(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; bool eq = false;
int size1[CV_MAX_DIM]; int size1[CV_MAX_DIM];
@ -2887,10 +2887,10 @@ cvSetHistBinRanges( CvHistogram* hist, float** ranges, int uniform )
int i, j; int i, j;
if( !ranges ) if( !ranges )
CV_Error( CV_StsNullPtr, "NULL ranges pointer" ); CV_Error( cv::Error::StsNullPtr, "NULL ranges pointer" );
if( !CV_IS_HIST(hist) ) 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 ); dims = cvGetDims( hist->bins, size );
for( i = 0; i < dims; i++ ) for( i = 0; i < dims; i++ )
@ -2901,7 +2901,7 @@ cvSetHistBinRanges( CvHistogram* hist, float** ranges, int uniform )
for( i = 0; i < dims; i++ ) for( i = 0; i < dims; i++ )
{ {
if( !ranges[i] ) if( !ranges[i] )
CV_Error( CV_StsNullPtr, "One of <ranges> elements is NULL" ); CV_Error( cv::Error::StsNullPtr, "One of <ranges> elements is NULL" );
hist->thresh[i][0] = ranges[i][0]; hist->thresh[i][0] = ranges[i][0];
hist->thresh[i][1] = ranges[i][1]; hist->thresh[i][1] = ranges[i][1];
} }
@ -2925,13 +2925,13 @@ cvSetHistBinRanges( CvHistogram* hist, float** ranges, int uniform )
float val0 = -FLT_MAX; float val0 = -FLT_MAX;
if( !ranges[i] ) if( !ranges[i] )
CV_Error( CV_StsNullPtr, "One of <ranges> elements is NULL" ); CV_Error( cv::Error::StsNullPtr, "One of <ranges> elements is NULL" );
for( j = 0; j <= size[i]; j++ ) for( j = 0; j <= size[i]; j++ )
{ {
float val = ranges[i][j]; float val = ranges[i][j];
if( val <= val0 ) 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; val0 = dim_ranges[j] = val;
} }
@ -2949,10 +2949,10 @@ CV_IMPL void
cvCalcArrHist( CvArr** img, CvHistogram* hist, int accumulate, const CvArr* mask ) cvCalcArrHist( CvArr** img, CvHistogram* hist, int accumulate, const CvArr* mask )
{ {
if( !CV_IS_HIST(hist)) if( !CV_IS_HIST(hist))
CV_Error( CV_StsBadArg, "Bad histogram pointer" ); CV_Error( cv::Error::StsBadArg, "Bad histogram pointer" );
if( !img ) 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 size[CV_MAX_DIM];
int i, dims = cvGetDims( hist->bins, size); int i, dims = cvGetDims( hist->bins, size);
@ -3015,10 +3015,10 @@ CV_IMPL void
cvCalcArrBackProject( CvArr** img, CvArr* dst, const CvHistogram* hist ) cvCalcArrBackProject( CvArr** img, CvArr* dst, const CvHistogram* hist )
{ {
if( !CV_IS_HIST(hist)) if( !CV_IS_HIST(hist))
CV_Error( CV_StsBadArg, "Bad histogram pointer" ); CV_Error( cv::Error::StsBadArg, "Bad histogram pointer" );
if( !img ) 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 size[CV_MAX_DIM];
int i, dims = cvGetDims( hist->bins, size ); int i, dims = cvGetDims( hist->bins, size );
@ -3078,21 +3078,21 @@ cvCalcArrBackProjectPatch( CvArr** arr, CvArr* dst, CvSize patch_size, CvHistogr
cv::Size size; cv::Size size;
if( !CV_IS_HIST(hist)) if( !CV_IS_HIST(hist))
CV_Error( CV_StsBadArg, "Bad histogram pointer" ); CV_Error( cv::Error::StsBadArg, "Bad histogram pointer" );
if( !arr ) if( !arr )
CV_Error( CV_StsNullPtr, "Null double array pointer" ); CV_Error( cv::Error::StsNullPtr, "Null double array pointer" );
if( norm_factor <= 0 ) if( norm_factor <= 0 )
CV_Error( CV_StsOutOfRange, CV_Error( cv::Error::StsOutOfRange,
"Bad normalization factor (set it to 1.0 if unsure)" ); "Bad normalization factor (set it to 1.0 if unsure)" );
if( patch_size.width <= 0 || patch_size.height <= 0 ) 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 ); dims = cvGetDims( hist->bins );
if (dims < 1) if (dims < 1)
CV_Error( CV_StsOutOfRange, "Invalid number of dimensions"); CV_Error( cv::Error::StsOutOfRange, "Invalid number of dimensions");
cvNormalizeHist( hist, norm_factor ); cvNormalizeHist( hist, norm_factor );
for( i = 0; i < dims; i++ ) 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 ); dstmat = cvGetMat( dst, &dststub, 0, 0 );
if( CV_MAT_TYPE( dstmat->type ) != CV_32FC1 ) 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 || if( dstmat->cols != img[0]->width - patch_size.width + 1 ||
dstmat->rows != img[0]->height - patch_size.height + 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), " "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)" ); "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; int i;
if( !src || !dst ) if( !src || !dst )
CV_Error( CV_StsNullPtr, "NULL histogram array pointer" ); CV_Error( cv::Error::StsNullPtr, "NULL histogram array pointer" );
if( count < 2 ) 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++ ) for( i = 0; i < count; i++ )
{ {
if( !CV_IS_HIST(src[i]) || !CV_IS_HIST(dst[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) ) 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 ); cvZero( dst[0]->bins );
@ -3178,10 +3178,10 @@ cvCalcProbDensity( const CvHistogram* hist, const CvHistogram* hist_mask,
CvHistogram* hist_dens, double scale ) CvHistogram* hist_dens, double scale )
{ {
if( scale <= 0 ) 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) ) 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 }; 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 ); cvInitNArrayIterator( 3, arrs, 0, stubs, &iterator );
if( CV_MAT_TYPE(iterator.hdr[0]->type) != CV_32FC1 ) 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 do
{ {
@ -3533,7 +3533,7 @@ static void *icvReadHist( CvFileStorage * fs, CvFileNode * node )
int i, sizes[CV_MAX_DIM]; int i, sizes[CV_MAX_DIM];
if(!CV_IS_MATND(mat)) if(!CV_IS_MATND(mat))
CV_Error( CV_StsError, "Expected CvMatND"); CV_Error( cv::Error::StsError, "Expected CvMatND");
for(i=0; i<mat->dims; i++) for(i=0; i<mat->dims; i++)
sizes[i] = mat->dim[i].size; sizes[i] = mat->dim[i].size;
@ -3554,7 +3554,7 @@ static void *icvReadHist( CvFileStorage * fs, CvFileNode * node )
{ {
h->bins = cvReadByName( fs, node, "bins" ); h->bins = cvReadByName( fs, node, "bins" );
if(!CV_IS_SPARSE_MAT(h->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" ); thresh_node = cvGetFileNodeByName( fs, node, "thresh" );
if(!thresh_node) 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 ); cvStartReadRawData( fs, thresh_node, &reader );
if(is_uniform) if(is_uniform)

View File

@ -2396,11 +2396,11 @@ cvHoughLines2( CvArr* src_image, void* lineStorage, int method,
mat = (CvMat*)lineStorage; mat = (CvMat*)lineStorage;
if( !CV_IS_MAT_CONT( mat->type ) || (mat->rows != 1 && mat->cols != 1) ) 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" ); "The destination matrix should be continuous and have a single row or a single column" );
if( CV_MAT_TYPE( mat->type ) != lineType ) 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" ); "The destination matrix data type is inappropriate, see the manual" );
lines = cvMakeSeqHeaderForArray( lineType, sizeof(CvSeq), elemSize, mat->data.ptr, 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 ); threshold, iparam1, iparam2, l4, linesMax );
break; break;
default: default:
CV_Error( CV_StsBadArg, "Unrecognized method id" ); CV_Error( cv::Error::StsBadArg, "Unrecognized method id" );
} }
int nlines = (int)(l2.size() + l4.size()); 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; cv::Mat src = cv::cvarrToMat(src_image), circles_mat;
if( !circle_storage ) if( !circle_storage )
CV_Error( CV_StsNullPtr, "NULL destination" ); CV_Error( cv::Error::StsNullPtr, "NULL destination" );
bool isStorage = isStorageOrMat(circle_storage); 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) || if( !CV_IS_MAT_CONT( mat->type ) || (mat->rows != 1 && mat->cols != 1) ||
CV_MAT_TYPE(mat->type) != CV_32FC3 ) 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" ); "The destination matrix should be continuous and have a single row or a single column" );
circles = cvMakeSeqHeaderForArray( CV_32FC3, sizeof(CvSeq), sizeof(float)*3, circles = cvMakeSeqHeaderForArray( CV_32FC3, sizeof(CvSeq), sizeof(float)*3,

View File

@ -206,7 +206,7 @@ static void initInterTab1D(int method, float* tab, int tabsz)
interpolateLanczos4( i*scale, tab ); interpolateLanczos4( i*scale, tab );
} }
else 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 ) else if( method == INTER_LANCZOS4 )
tab = Lanczos4Tab_f[0][0], itab = Lanczos4Tab_i[0][0], ksize=8; tab = Lanczos4Tab_f[0][0], itab = Lanczos4Tab_i[0][0], ksize=8;
else else
CV_Error( CV_StsBadArg, "Unknown/unsupported interpolation type" ); CV_Error( cv::Error::StsBadArg, "Unknown/unsupported interpolation type" );
if( !inittab[method] ) if( !inittab[method] )
{ {
@ -1502,7 +1502,7 @@ static bool ocl_logPolar(InputArray _src, OutputArray _dst,
Point2f center, double M, int flags) Point2f center, double M, int flags)
{ {
if (M <= 0) 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 src_with_border; // don't scope this variable (it holds image data)
UMat mapx, mapy, r, cp_sp; 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) catch (const ivx::RuntimeError & e)
{ {
CV_Error(CV_StsInternal, e.what()); CV_Error(cv::Error::StsInternal, e.what());
return false; return false;
} }
catch (const ivx::WrapperError & e) catch (const ivx::WrapperError & e)
{ {
CV_Error(CV_StsInternal, e.what()); CV_Error(cv::Error::StsInternal, e.what());
return false; return false;
} }
return true; return true;
@ -1888,7 +1888,7 @@ void cv::remap( InputArray _src, OutputArray _dst,
CV_Assert( _src.channels() <= 4 ); CV_Assert( _src.channels() <= 4 );
} }
else else
CV_Error( CV_StsBadArg, "Unknown interpolation method" ); CV_Error( cv::Error::StsBadArg, "Unknown interpolation method" );
CV_Assert( ifunc != 0 ); CV_Assert( ifunc != 0 );
ctab = initInterTab2D( interpolation, fixpt ); ctab = initInterTab2D( interpolation, fixpt );
} }
@ -2236,7 +2236,7 @@ void cv::convertMaps( InputArray _map1, InputArray _map2,
} }
} }
else 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; iM[istep] = A21; iM[istep+1] = A22; iM[istep+2] = b2;
} }
else else
CV_Error( CV_StsUnsupportedFormat, "" ); CV_Error( cv::Error::StsUnsupportedFormat, "" );
} }
cv::Mat cv::getPerspectiveTransform(InputArray _src, InputArray _dst, int solveMethod) cv::Mat cv::getPerspectiveTransform(InputArray _src, InputArray _dst, int solveMethod)

View File

@ -358,7 +358,7 @@ static void fitLine2D( const Point2f * points, int count, int dist,
calc_weights = (void ( * )(float *, int, float *)) _PFP.fp; calc_weights = (void ( * )(float *, int, float *)) _PFP.fp;
break;*/ break;*/
default: default:
CV_Error(CV_StsBadArg, "Unknown distance type"); CV_Error(cv::Error::StsBadArg, "Unknown distance type");
} }
AutoBuffer<float> wr(count*2); AutoBuffer<float> wr(count*2);
@ -499,7 +499,7 @@ static void fitLine3D( Point3f * points, int count, int dist,
break; break;
default: default:
CV_Error(CV_StsBadArg, "Unknown distance"); CV_Error(cv::Error::StsBadArg, "Unknown distance");
} }
AutoBuffer<float> buf(count*2); AutoBuffer<float> buf(count*2);

View File

@ -158,7 +158,7 @@ double cv::matchShapes(InputArray contour1, InputArray contour2, int method, dou
} }
break; break;
default: 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. //If anyA and anyB are both true, the result is correct.

View File

@ -867,7 +867,7 @@ void medianBlur(const Mat& src0, /*const*/ Mat& dst, int ksize)
else if( src.depth() == CV_32F ) else if( src.depth() == CV_32F )
medianBlur_SortNet<MinMax32f, MinMaxVec32f>( src, dst, ksize ); medianBlur_SortNet<MinMax32f, MinMaxVec32f>( src, dst, ksize );
else else
CV_Error(CV_StsUnsupportedFormat, ""); CV_Error(cv::Error::StsUnsupportedFormat, "");
return; return;
} }

View File

@ -584,7 +584,7 @@ cv::Moments cv::moments( InputArray _src, bool binary )
return contourMoments(mat); return contourMoments(mat);
if( cn > 1 ) 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); 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 ) else if( depth == CV_64F )
func = momentsInTile<double, double, double>; func = momentsInTile<double, double, double>;
else else
CV_Error( CV_StsUnsupportedFormat, "" ); CV_Error( cv::Error::StsUnsupportedFormat, "" );
Mat src0(mat); 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; int order = x_order + y_order;
if( !moments ) if( !moments )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( (x_order | y_order) < 0 || order > 3 ) 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]; 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; int order = x_order + y_order;
if( !moments ) if( !moments )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( (x_order | y_order) < 0 || order > 3 ) 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] : return order >= 2 ? (&(moments->m00))[4 + order * 3 + y_order] :
order == 0 ? moments->m00 : 0; 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 ) CV_IMPL void cvGetHuMoments( CvMoments * mState, CvHuMoments * HuState )
{ {
if( !mState || !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; double m00s = mState->inv_sqrt_m00, m00 = m00s * m00s, s2 = m00 * m00, s3 = s2 * m00s;

View File

@ -1076,7 +1076,7 @@ static bool ocl_morphologyEx(InputArray _src, OutputArray _dst, int op,
return false; return false;
break; break;
default: default:
CV_Error( CV_StsBadArg, "unknown morphological operation" ); CV_Error( cv::Error::StsBadArg, "unknown morphological operation" );
} }
return true; return true;
@ -1249,7 +1249,7 @@ void morphologyEx( InputArray _src, OutputArray _dst, int op,
} }
break; break;
default: 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 ) cvReleaseStructuringElement( IplConvKernel ** element )
{ {
if( !element ) if( !element )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
cvFree( element ); cvFree( element );
} }

View File

@ -753,7 +753,7 @@ Ptr<BaseRowFilter> getMorphologyRowFilter(int op, int type, int ksize, int ancho
DilateRowVec64f> >(ksize, anchor); DilateRowVec64f> >(ksize, anchor);
} }
CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type)); CV_Error_( cv::Error::StsNotImplemented, ("Unsupported data type (=%d)", type));
} }
Ptr<BaseColumnFilter> getMorphologyColumnFilter(int op, int type, int ksize, int anchor) Ptr<BaseColumnFilter> getMorphologyColumnFilter(int op, int type, int ksize, int anchor)
@ -801,7 +801,7 @@ Ptr<BaseColumnFilter> getMorphologyColumnFilter(int op, int type, int ksize, int
DilateColumnVec64f> >(ksize, anchor); DilateColumnVec64f> >(ksize, anchor);
} }
CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type)); CV_Error_( cv::Error::StsNotImplemented, ("Unsupported data type (=%d)", type));
} }
Ptr<BaseFilter> getMorphologyFilter(int op, int type, const Mat& kernel, Point anchor) Ptr<BaseFilter> getMorphologyFilter(int op, int type, const Mat& kernel, Point anchor)
@ -838,7 +838,7 @@ Ptr<BaseFilter> getMorphologyFilter(int op, int type, const Mat& kernel, Point a
return makePtr<MorphFilter<MaxOp<double>, DilateVec64f> >(kernel, anchor); return makePtr<MorphFilter<MaxOp<double>, DilateVec64f> >(kernel, anchor);
} }
CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type)); CV_Error_( cv::Error::StsNotImplemented, ("Unsupported data type (=%d)", type));
} }
#endif #endif

View File

@ -112,7 +112,7 @@ inline bool isStorageOrMat(void * arr)
return true; return true;
else if (CV_IS_MAT( arr )) else if (CV_IS_MAT( arr ))
return false; return false;
CV_Error( CV_StsBadArg, "Destination is not CvMemStorage* nor CvMat*" ); CV_Error( cv::Error::StsBadArg, "Destination is not CvMemStorage* nor CvMat*" );
} }

View File

@ -1448,7 +1448,7 @@ void cv::pyrDown( InputArray _src, OutputArray _dst, const Size& _dsz, int borde
else if( depth == CV_64F ) else if( depth == CV_64F )
func = pyrDown_< FltCast<double, 8> >; func = pyrDown_< FltCast<double, 8> >;
else else
CV_Error( CV_StsUnsupportedFormat, "" ); CV_Error( cv::Error::StsUnsupportedFormat, "" );
func( src, dst, borderType ); 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 ) else if( depth == CV_64F )
func = pyrUp_< FltCast<double, 6> >; func = pyrUp_< FltCast<double, 6> >;
else else
CV_Error( CV_StsUnsupportedFormat, "" ); CV_Error( cv::Error::StsUnsupportedFormat, "" );
func( src, dst, borderType ); func( src, dst, borderType );
} }
@ -1722,7 +1722,7 @@ CV_IMPL void
cvReleasePyramid( CvMat*** _pyramid, int extra_layers ) cvReleasePyramid( CvMat*** _pyramid, int extra_layers )
{ {
if( !_pyramid ) if( !_pyramid )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
if( *_pyramid ) if( *_pyramid )
for( int i = 0; i <= extra_layers; i++ ) 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 ); CvMat stub, *src = cvGetMat( srcarr, &stub );
if( extra_layers < 0 ) 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); int i, layer_step, elem_size = CV_ELEM_SIZE(src->type);
cv::Size layer_size, size = cvGetMatSize(src); cv::Size layer_size, size = cvGetMatSize(src);
@ -1770,7 +1770,7 @@ cvCreatePyramid( const CvArr* srcarr, int extra_layers, double rate,
} }
if( bufsize < 0 ) 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; ptr = buf->data.ptr;
} }

View File

@ -4024,7 +4024,7 @@ void resize(int src_type,
else if( interpolation == INTER_LINEAR || interpolation == INTER_AREA ) else if( interpolation == INTER_LINEAR || interpolation == INTER_AREA )
ksize = 2, func = linear_tab[depth]; ksize = 2, func = linear_tab[depth];
else else
CV_Error( CV_StsBadArg, "Unknown interpolation method" ); CV_Error( cv::Error::StsBadArg, "Unknown interpolation method" );
ksize2 = ksize/2; ksize2 = ksize/2;
CV_Assert( func != 0 ); CV_Assert( func != 0 );

View File

@ -245,7 +245,7 @@ static void rotatingCalipers( const Point2f* points, int n, int mode, float* out
base_b = lead_x; base_b = lead_x;
break; break;
default: 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 */ /* change base point of main edge */

View File

@ -417,7 +417,7 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center,
getRectSubPix_Cn_<float, float, float, nop<float>, nop<float> > getRectSubPix_Cn_<float, float, float, nop<float>, nop<float> >
(image.ptr<float>(), image.step, image.size(), patch.ptr<float>(), patch.step, patch.size(), center, cn); (image.ptr<float>(), image.step, image.size(), patch.ptr<float>(), patch.step, patch.size(), center, cn);
else 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(); size_t pixsize = img.elemSize();
if( !buffer ) if( !buffer )
CV_Error( CV_StsNullPtr, "" ); CV_Error( cv::Error::StsNullPtr, "" );
for( int i = 0; i < li.count; i++, ++li ) for( int i = 0; i < li.count; i++, ++li )
{ {

View File

@ -348,7 +348,7 @@ void cv::pyrMeanShiftFiltering( InputArray _src, OutputArray _dst,
const int MAX_LEVELS = 8; const int MAX_LEVELS = 8;
if( (unsigned)max_level > (unsigned)MAX_LEVELS ) 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<cv::Mat> src_pyramid(max_level+1); std::vector<cv::Mat> src_pyramid(max_level+1);
std::vector<cv::Mat> dst_pyramid(max_level+1); std::vector<cv::Mat> dst_pyramid(max_level+1);
@ -365,13 +365,13 @@ void cv::pyrMeanShiftFiltering( InputArray _src, OutputArray _dst,
if( src0.type() != CV_8UC3 ) 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() ) 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() ) 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) ) if( !(termcrit.type & CV_TERMCRIT_ITER) )
termcrit.maxCount = 5; termcrit.maxCount = 5;

View File

@ -357,7 +357,7 @@ static RotatedRect fitEllipseNoDirect( InputArray _points )
RotatedRect box; RotatedRect box;
if( n < 5 ) 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 // New fitellipse algorithm, contributed by Dr. Daniel Weiss
Point2f c(0,0); Point2f c(0,0);
@ -520,7 +520,7 @@ cv::RotatedRect cv::fitEllipseAMS( InputArray _points )
RotatedRect box; RotatedRect box;
if( n < 5 ) 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); Point2f c(0,0);
@ -705,7 +705,7 @@ cv::RotatedRect cv::fitEllipseDirect( InputArray _points )
RotatedRect box; RotatedRect box;
if( n < 5 ) 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.); Point2d c(0., 0.);
@ -1364,7 +1364,7 @@ cvContourArea( const void *array, CvSlice slice, int oriented )
{ {
contour = (CvSeq*)array; contour = (CvSeq*)array;
if( !CV_IS_SEQ_POLYLINE( contour )) if( !CV_IS_SEQ_POLYLINE( contour ))
CV_Error( CV_StsBadArg, "Unsupported sequence type" ); CV_Error( cv::Error::StsBadArg, "Unsupported sequence type" );
} }
else else
{ {
@ -1379,7 +1379,7 @@ cvContourArea( const void *array, CvSlice slice, int oriented )
} }
if( CV_SEQ_ELTYPE( contour ) != CV_32SC2 ) 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" ); "Only curves with integer coordinates are supported in case of contour slice" );
area = icvContourSecArea( contour, slice ); area = icvContourSecArea( contour, slice );
return oriented ? area : fabs(area); return oriented ? area : fabs(area);
@ -1405,7 +1405,7 @@ cvArcLength( const void *array, CvSlice slice, int is_closed )
{ {
contour = (CvSeq*)array; contour = (CvSeq*)array;
if( !CV_IS_SEQ_POLYLINE( contour )) 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 ) if( is_closed < 0 )
is_closed = CV_IS_SEQ_CLOSED( contour ); is_closed = CV_IS_SEQ_CLOSED( contour );
} }
@ -1498,7 +1498,7 @@ cvBoundingRect( CvArr* array, int update )
{ {
ptseq = (CvSeq*)array; ptseq = (CvSeq*)array;
if( !CV_IS_SEQ_POINT_SET( ptseq )) 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)) 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 && else if( CV_MAT_TYPE(mat->type) != CV_8UC1 &&
CV_MAT_TYPE(mat->type) != CV_8SC1 ) 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" ); "The image/matrix format is not supported by the function" );
update = 0; update = 0;
calculate = 1; calculate = 1;

View File

@ -784,7 +784,7 @@ cvSmooth( const void* srcarr, void* dstarr, int smooth_type,
cv::bilateralFilter( src, dst, param1, param3, param4, cv::BORDER_REPLICATE ); cv::bilateralFilter( src, dst, param1, param3, param4, cv::BORDER_REPLICATE );
if( dst.data != dst0.data ) 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. */ /* End of file. */

View File

@ -282,10 +282,10 @@ int Subdiv2D::locate(Point2f pt, int& _edge, int& _vertex)
int i, maxEdges = (int)(qedges.size() * 4); int i, maxEdges = (int)(qedges.size() * 4);
if( qedges.size() < (size_t)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 ) 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; int edge = recentEdge;
CV_Assert(edge > 0); CV_Assert(edge > 0);
@ -417,10 +417,10 @@ int Subdiv2D::insert(Point2f pt)
int location = locate( pt, curr_edge, curr_point ); int location = locate( pt, curr_edge, curr_point );
if( location == PTLOC_ERROR ) if( location == PTLOC_ERROR )
CV_Error( CV_StsBadSize, "" ); CV_Error( cv::Error::StsBadSize, "" );
if( location == PTLOC_OUTSIDE_RECT ) if( location == PTLOC_OUTSIDE_RECT )
CV_Error( CV_StsOutOfRange, "" ); CV_Error( cv::Error::StsOutOfRange, "" );
if( location == PTLOC_VERTEX ) if( location == PTLOC_VERTEX )
return curr_point; return curr_point;
@ -434,7 +434,7 @@ int Subdiv2D::insert(Point2f pt)
else if( location == PTLOC_INSIDE ) else if( location == PTLOC_INSIDE )
; ;
else 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 ); CV_Assert( curr_edge != 0 );
validGeometry = false; validGeometry = false;

View File

@ -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.width = std::max(getOptimalDFTSize(block_size.width + templ_size.width - 1), 2);
dft_size.height = getOptimalDFTSize(block_size.height + templ_size.height - 1); dft_size.height = getOptimalDFTSize(block_size.height + templ_size.height - 1);
if( dft_size.width <= 0 || dft_size.height <= 0 ) 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 // recompute block size
block_size.width = dft_size.width - templ_size.width + 1; 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.width = std::max(getOptimalDFTSize(blocksize.width + templ.cols - 1), 2);
dftsize.height = getOptimalDFTSize(blocksize.height + templ.rows - 1); dftsize.height = getOptimalDFTSize(blocksize.height + templ.rows - 1);
if( dftsize.width <= 0 || dftsize.height <= 0 ) 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 // recompute block size
blocksize.width = dftsize.width - templ.cols + 1; blocksize.width = dftsize.width - templ.cols + 1;

View File

@ -117,7 +117,7 @@ static void threshGeneric(Size roi, const T* src, size_t src_step, T* dst,
return; return;
default: 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; break;
default: default:
CV_Error( CV_StsBadArg, "" ); return; CV_Error( cv::Error::StsBadArg, "" ); return;
} }
#else #else
threshGeneric<short>(roi, src, src_step, dst, dst_step, thresh, maxval, type); threshGeneric<short>(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; break;
default: default:
CV_Error( CV_StsBadArg, "" ); return; CV_Error( cv::Error::StsBadArg, "" ); return;
} }
#else #else
threshGeneric<float>(roi, src, src_step, dst, dst_step, thresh, maxval, type); threshGeneric<float>(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; break;
default: default:
CV_Error(CV_StsBadArg, ""); return; CV_Error(cv::Error::StsBadArg, ""); return;
} }
#else #else
threshGeneric<double>(roi, src, src_step, dst, dst_step, thresh, maxval, type); threshGeneric<double>(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 if( src.depth() == CV_64F )
; ;
else else
CV_Error( CV_StsUnsupportedFormat, "" ); CV_Error( cv::Error::StsUnsupportedFormat, "" );
parallel_for_(Range(0, dst.rows), parallel_for_(Range(0, dst.rows),
ThresholdRunner(src, dst, thresh, maxval, type), ThresholdRunner(src, dst, thresh, maxval, type),
@ -1704,7 +1704,7 @@ void cv::adaptiveThreshold( InputArray _src, OutputArray _dst, double maxValue,
meanfloat.convertTo(mean, src.type()); meanfloat.convertTo(mean, src.type());
} }
else else
CV_Error( CV_StsBadFlag, "Unknown/unsupported adaptive threshold method" ); CV_Error( cv::Error::StsBadFlag, "Unknown/unsupported adaptive threshold method" );
int i, j; int i, j;
uchar imaxval = saturate_cast<uchar>(maxValue); uchar imaxval = saturate_cast<uchar>(maxValue);
@ -1718,7 +1718,7 @@ void cv::adaptiveThreshold( InputArray _src, OutputArray _dst, double maxValue,
for( i = 0; i < 768; i++ ) for( i = 0; i < 768; i++ )
tab[i] = (uchar)(i - 255 <= -idelta ? imaxval : 0); tab[i] = (uchar)(i - 255 <= -idelta ? imaxval : 0);
else 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() ) if( src.isContinuous() && mean.isContinuous() && dst.isContinuous() )
{ {

View File

@ -51,19 +51,19 @@ CV_IMPL CvSeq* cvPointSeqFromMat( int seq_kind, const CvArr* arr,
CvMat* mat = (CvMat*)arr; CvMat* mat = (CvMat*)arr;
if( !CV_IS_MAT( mat )) 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 ) if( CV_MAT_CN(mat->type) == 1 && mat->width == 2 )
mat = cvReshape(mat, &hdr, 2); mat = cvReshape(mat, &hdr, 2);
eltype = CV_MAT_TYPE( mat->type ); eltype = CV_MAT_TYPE( mat->type );
if( eltype != CV_32SC2 && eltype != CV_32FC2 ) 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 " "The matrix can not be converted to point sequence because of "
"inappropriate element type" ); "inappropriate element type" );
if( (mat->width != 1 && mat->height != 1) || !CV_IS_MAT_CONT(mat->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 " "The matrix converted to point sequence must be "
"1-dimensional and continuous" ); "1-dimensional and continuous" );

View File

@ -1824,7 +1824,7 @@ void CV_ColorBayerTest::prepare_to_validation( int /*test_case_idx*/ )
else if( depth == CV_16U ) else if( depth == CV_16U )
bayer2BGR_<ushort>(src, dst, fwd_code); bayer2BGR_<ushort>(src, dst, fwd_code);
else else
CV_Error(CV_StsUnsupportedFormat, ""); CV_Error(cv::Error::StsUnsupportedFormat, "");
} }

View File

@ -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() ); cvtest::add( dst, 1, src, -1, Scalar::all(0), dst, dst.type() );
} }
else else
CV_Error( CV_StsBadArg, "Unknown operation" ); CV_Error( cv::Error::StsBadArg, "Unknown operation" );
} }
cvReleaseStructuringElement( &element ); cvReleaseStructuringElement( &element );

View File

@ -223,7 +223,7 @@ public:
void setActivationFunction(int _activ_func, double _f_param1, double _f_param2) CV_OVERRIDE void setActivationFunction(int _activ_func, double _f_param1, double _f_param2) CV_OVERRIDE
{ {
if( _activ_func < 0 || _activ_func > LEAKYRELU) 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; activ_func = _activ_func;
@ -322,7 +322,7 @@ public:
{ {
int n = layer_sizes[i]; int n = layer_sizes[i];
if( n < 1 + (0 < i && i < l_count-1)) 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 " "there should be at least one input and one output "
"and every hidden layer must have more than 1 neuron" ); "and every hidden layer must have more than 1 neuron" );
max_lsize = std::max( max_lsize, n ); max_lsize = std::max( max_lsize, n );
@ -341,7 +341,7 @@ public:
float predict( InputArray _inputs, OutputArray _outputs, int ) const CV_OVERRIDE float predict( InputArray _inputs, OutputArray _outputs, int ) const CV_OVERRIDE
{ {
if( !trained ) 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(); Mat inputs = _inputs.getMat();
int type = inputs.type(), l_count = layer_count(); int type = inputs.type(), l_count = layer_count();
@ -790,7 +790,7 @@ public:
{ {
t = t*inv_scale[j*2] + inv_scale[2*j+1]; t = t*inv_scale[j*2] + inv_scale[2*j+1];
if( t < m1 || t > M1 ) 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" ); "Some of new output training vector components run exceed the original range too much" );
} }
} }
@ -817,25 +817,25 @@ public:
Mat& sample_weights, int flags ) Mat& sample_weights, int flags )
{ {
if( layer_sizes.empty() ) 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" ); "The network has not been created. Use method create or the appropriate constructor" );
if( (inputs.type() != CV_32F && inputs.type() != CV_64F) || if( (inputs.type() != CV_32F && inputs.type() != CV_64F) ||
inputs.cols != layer_sizes[0] ) inputs.cols != layer_sizes[0] )
CV_Error( CV_StsBadArg, CV_Error( cv::Error::StsBadArg,
"input training data should be a floating-point matrix with " "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 rows equal to the number of training samples and "
"the number of columns equal to the size of 0-th (input) layer" ); "the number of columns equal to the size of 0-th (input) layer" );
if( (outputs.type() != CV_32F && outputs.type() != CV_64F) || if( (outputs.type() != CV_32F && outputs.type() != CV_64F) ||
outputs.cols != layer_sizes.back() ) outputs.cols != layer_sizes.back() )
CV_Error( CV_StsBadArg, CV_Error( cv::Error::StsBadArg,
"output training data should be a floating-point matrix with " "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 rows equal to the number of training samples and "
"the number of columns equal to the size of last (output) layer" ); "the number of columns equal to the size of last (output) layer" );
if( inputs.rows != outputs.rows ) 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; Mat temp;
double s = sum(sample_weights)[0]; double s = sum(sample_weights)[0];
@ -1323,7 +1323,7 @@ public:
fs << "itePerStep" << params.itePerStep; fs << "itePerStep" << params.itePerStep;
} }
else else
CV_Error(CV_StsError, "Unknown training method"); CV_Error(cv::Error::StsError, "Unknown training method");
fs << "term_criteria" << "{"; fs << "term_criteria" << "{";
if( params.termCrit.type & TermCriteria::EPS ) if( params.termCrit.type & TermCriteria::EPS )
@ -1421,7 +1421,7 @@ public:
params.itePerStep = tpn["itePerStep"]; params.itePerStep = tpn["itePerStep"];
} }
else 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"]; FileNode tcn = tpn["term_criteria"];
if( !tcn.empty() ) if( !tcn.empty() )

View File

@ -308,7 +308,7 @@ public:
} }
} }
else else
CV_Error(CV_StsNotImplemented, "Unknown boosting type"); CV_Error(cv::Error::StsNotImplemented, "Unknown boosting type");
/*if( bparams.boostType != Boost::LOGIT ) /*if( bparams.boostType != Boost::LOGIT )
{ {
@ -387,7 +387,7 @@ public:
void write( FileStorage& fs ) const CV_OVERRIDE void write( FileStorage& fs ) const CV_OVERRIDE
{ {
if( roots.empty() ) if( roots.empty() )
CV_Error( CV_StsBadArg, "RTrees have not been trained" ); CV_Error( cv::Error::StsBadArg, "RTrees have not been trained" );
writeFormat(fs); writeFormat(fs);
writeParams(fs); writeParams(fs);

View File

@ -574,7 +574,7 @@ public:
if( nvars == 0 ) if( nvars == 0 )
{ {
if( rowvals.empty() ) 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(); nvars = (int)rowvals.size();
if( !varTypeSpec.empty() && varTypeSpec.size() > 0 ) if( !varTypeSpec.empty() && varTypeSpec.size() > 0 )
{ {
@ -637,7 +637,7 @@ public:
{ {
for( i = ninputvars; i < nvars; i++ ) for( i = ninputvars; i < nvars; i++ )
if( vtypes[i] == VAR_CATEGORICAL ) 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"); "If responses are vector values, not scalars, they must be marked as ordered responses");
} }
} }
@ -724,14 +724,14 @@ public:
} }
if ( ptr[3] != '[') if ( ptr[3] != '[')
CV_Error( CV_StsBadArg, errmsg ); CV_Error( cv::Error::StsBadArg, errmsg );
ptr += 4; // pass "ord[" ptr += 4; // pass "ord["
do do
{ {
int b1 = (int)strtod( ptr, &stopstring ); int b1 = (int)strtod( ptr, &stopstring );
if( *stopstring == 0 || (*stopstring != ',' && *stopstring != ']' && *stopstring != '-') ) if( *stopstring == 0 || (*stopstring != ',' && *stopstring != ']' && *stopstring != '-') )
CV_Error( CV_StsBadArg, errmsg ); CV_Error( cv::Error::StsBadArg, errmsg );
ptr = stopstring + 1; ptr = stopstring + 1;
if( (stopstring[0] == ',') || (stopstring[0] == ']')) if( (stopstring[0] == ',') || (stopstring[0] == ']'))
{ {
@ -745,7 +745,7 @@ public:
{ {
int b2 = (int)strtod( ptr, &stopstring); int b2 = (int)strtod( ptr, &stopstring);
if ( (*stopstring == 0) || (*stopstring != ',' && *stopstring != ']') ) if ( (*stopstring == 0) || (*stopstring != ',' && *stopstring != ']') )
CV_Error( CV_StsBadArg, errmsg ); CV_Error( cv::Error::StsBadArg, errmsg );
ptr = stopstring + 1; ptr = stopstring + 1;
CV_Assert( 0 <= b1 && b1 <= b2 && b2 < nvars ); CV_Assert( 0 <= b1 && b1 <= b2 && b2 < nvars );
for (int i = b1; i <= b2; i++) for (int i = b1; i <= b2; i++)
@ -753,7 +753,7 @@ public:
specCounter += b2 - b1 + 1; specCounter += b2 - b1 + 1;
} }
else else
CV_Error( CV_StsBadArg, errmsg ); CV_Error( cv::Error::StsBadArg, errmsg );
} }
} }
@ -762,7 +762,7 @@ public:
} }
if( specCounter != nvars ) 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 void setTrainTestSplitRatio(double ratio, bool shuffle) CV_OVERRIDE

View File

@ -218,7 +218,7 @@ CvGBTrees::train( const CvMat* _train_data, int _tflag,
orig_response->data.fl[i] = (float) _responses->data.i[i*step]; orig_response->data.fl[i] = (float) _responses->data.i[i*step];
}; break; }; break;
default: 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) if (!is_regression)
@ -283,7 +283,7 @@ CvGBTrees::train( const CvMat* _train_data, int _tflag,
sample_idx->data.i[active_samples_count++] = i; sample_idx->data.i[active_samples_count++] = i;
} break; } 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 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) 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.weak_count = cvReadIntByName( fs, fnode, "ensemble_length" );
params.shrinkage = (float)cvReadRealByName( fs, fnode, "shrinkage", 0.1 ); 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" ); class_labels = (CvMat*)cvReadByName( fs, fnode, "class_labels" );
if( class_labels && !CV_IS_MAT(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; 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 ); cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_ML_GBT );
if( !weak ) 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 ); write_params( fs );
cvWriteReal( fs, "base_value", base_value); 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() ); trees_fnode = cvGetFileNodeByName( fs, node, s.c_str() );
if( !trees_fnode || !CV_NODE_IS_SEQ(trees_fnode->tag) ) if( !trees_fnode || !CV_NODE_IS_SEQ(trees_fnode->tag) )
CV_ERROR( CV_StsParseError, "<trees_x> tag is missing" ); CV_ERROR( cv::Error::StsParseError, "<trees_x> tag is missing" );
cvStartReadSeq( trees_fnode->data.seq, &reader ); cvStartReadSeq( trees_fnode->data.seq, &reader );
ntrees = trees_fnode->data.seq->total; ntrees = trees_fnode->data.seq->total;
if( ntrees != params.weak_count ) if( ntrees != params.weak_count )
CV_ERROR( CV_StsUnmatchedSizes, CV_ERROR( cv::Error::StsUnmatchedSizes,
"The number of trees stored does not match <ntrees> tag value" ); "The number of trees stored does not match <ntrees> tag value" );
CV_CALL( storage = cvCreateMemStorage() ); CV_CALL( storage = cvCreateMemStorage() );

View File

@ -63,7 +63,7 @@ bool StatModel::train(const Ptr<TrainData>& trainData, int )
{ {
CV_TRACE_FUNCTION(); CV_TRACE_FUNCTION();
CV_Assert(!trainData.empty()); CV_Assert(!trainData.empty());
CV_Error(CV_StsNotImplemented, ""); CV_Error(cv::Error::StsNotImplemented, "");
return false; return false;
} }

View File

@ -109,15 +109,15 @@ bool LogisticRegressionImpl::train(const Ptr<TrainData>& trainData, int)
CV_Assert( !_labels_i.empty() && !_data_i.empty()); CV_Assert( !_labels_i.empty() && !_data_i.empty());
if(_labels_i.cols != 1) 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) 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) 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 // class labels
@ -126,7 +126,7 @@ bool LogisticRegressionImpl::train(const Ptr<TrainData>& trainData, int)
int num_classes = (int) this->forward_mapper.size(); int num_classes = (int) this->forward_mapper.size();
if(num_classes < 2) 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) // add a column of ones to the data (bias/intercept term)
@ -174,7 +174,7 @@ bool LogisticRegressionImpl::train(const Ptr<TrainData>& trainData, int)
this->learnt_thetas = thetas.clone(); this->learnt_thetas = thetas.clone();
if( cvIsNaN( (double)sum(this->learnt_thetas)[0] ) ) 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 // success
@ -187,7 +187,7 @@ float LogisticRegressionImpl::predict(InputArray samples, OutputArray results, i
// check if learnt_mats array is populated // check if learnt_mats array is populated
if(!this->isTrained()) if(!this->isTrained())
{ {
CV_Error( CV_StsBadArg, "classifier should be trained first" ); CV_Error( cv::Error::StsBadArg, "classifier should be trained first" );
} }
// coefficient matrix // coefficient matrix
@ -206,7 +206,7 @@ float LogisticRegressionImpl::predict(InputArray samples, OutputArray results, i
Mat data = samples.getMat(); Mat data = samples.getMat();
if(data.type() != CV_32F) 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) // 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) 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; return cost;
@ -398,12 +398,12 @@ Mat LogisticRegressionImpl::batch_gradient_descent(const Mat& _data, const Mat&
// implements batch gradient descent // implements batch gradient descent
if(this->params.alpha<=0) 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) 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; 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) 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) 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(); Mat theta_p = _init_theta.clone();
@ -551,7 +551,7 @@ void LogisticRegressionImpl::write(FileStorage& fs) const
// check if open // check if open
if(fs.isOpened() == 0) 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); writeFormat(fs);
string desc = "Logistic Regression Classifier"; string desc = "Logistic Regression Classifier";
@ -574,7 +574,7 @@ void LogisticRegressionImpl::read(const FileNode& fn)
// check if empty // check if empty
if(fn.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"]; this->params.alpha = (double)fn["alpha"];

View File

@ -101,7 +101,7 @@ public:
norm(var_idx, __var_idx, NORM_INF) != 0 || norm(var_idx, __var_idx, NORM_INF) != 0 ||
cls_labels.size() != __cls_labels.size() || cls_labels.size() != __cls_labels.size() ||
norm(cls_labels, __cls_labels, NORM_INF) != 0 ) 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" ); "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; bool rawOutput = (flags & RAW_OUTPUT) != 0;
if( samples.type() != CV_32F || samples.cols != nallvars ) 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" ); "The input samples must be 32f matrix with the number of columns = nallvars" );
if( (samples.rows > 1) && (! _results.needed()) ) 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" ); "When the number of input samples is >1, the output vector of results must be passed" );
if( _results.needed() ) if( _results.needed() )
@ -388,7 +388,7 @@ public:
fn["var_all"] >> nallvars; fn["var_all"] >> nallvars;
if( nallvars <= 0 ) if( nallvars <= 0 )
CV_Error( CV_StsParseError, CV_Error( cv::Error::StsParseError,
"The field \"var_count\" of NBayes classifier is missing or non-positive" ); "The field \"var_count\" of NBayes classifier is missing or non-positive" );
fn["var_idx"] >> var_idx; fn["var_idx"] >> var_idx;
@ -397,7 +397,7 @@ public:
int nclasses = (int)cls_labels.total(), i; int nclasses = (int)cls_labels.total(), i;
if( cls_labels.empty() || nclasses < 1 ) 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 FileNodeIterator
count_it = fn["count"].begin(), count_it = fn["count"].begin(),

View File

@ -131,13 +131,13 @@ namespace ml
inline void setMaxCategories(int val) inline void setMaxCategories(int val)
{ {
if( val < 2 ) 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 ); maxCategories = std::min(val, 15 );
} }
inline void setMaxDepth(int val) inline void setMaxDepth(int val)
{ {
if( val < 0 ) 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 ); maxDepth = std::min( val, 25 );
} }
inline void setMinSampleCount(int val) inline void setMinSampleCount(int val)
@ -147,11 +147,11 @@ namespace ml
inline void setCVFolds(int val) inline void setCVFolds(int val)
{ {
if( val < 0 ) if( val < 0 )
CV_Error( CV_StsOutOfRange, CV_Error( cv::Error::StsOutOfRange,
"params.CVFolds should be =0 (the tree is not pruned) " "params.CVFolds should be =0 (the tree is not pruned) "
"or n>0 (tree is pruned using n-fold cross-validation)" ); "or n>0 (tree is pruned using n-fold cross-validation)" );
if(val > 1) if(val > 1)
CV_Error( CV_StsNotImplemented, CV_Error( cv::Error::StsNotImplemented,
"tree pruning using cross-validation is not implemented." "tree pruning using cross-validation is not implemented."
"Set CVFolds to 1"); "Set CVFolds to 1");
@ -162,7 +162,7 @@ namespace ml
inline void setRegressionAccuracy(float val) inline void setRegressionAccuracy(float val)
{ {
if( val < 0 ) 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; regressionAccuracy = val;
} }

Some files were not shown because too many files have changed in this diff Show More