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;
if( !CV_IS_MAT(idx_arr) )
CV_ERROR( CV_StsBadArg, "Invalid index array" );
CV_ERROR( cv::Error::StsBadArg, "Invalid index array" );
if( idx_arr->rows != 1 && idx_arr->cols != 1 )
CV_ERROR( CV_StsBadSize, "the index array must be 1-dimensional" );
CV_ERROR( cv::Error::StsBadSize, "the index array must be 1-dimensional" );
idx_total = idx_arr->rows + idx_arr->cols - 1;
srcb = idx_arr->data.ptr;
@ -105,20 +105,20 @@ static CvMat* cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, b
// idx_arr is array of 1's and 0's -
// i.e. it is a mask of the selected components
if( idx_total != data_arr_size )
CV_ERROR( CV_StsUnmatchedSizes,
CV_ERROR( cv::Error::StsUnmatchedSizes,
"Component mask should contain as many elements as the total number of input variables" );
for( i = 0; i < idx_total; i++ )
idx_selected += srcb[i*step] != 0;
if( idx_selected == 0 )
CV_ERROR( CV_StsOutOfRange, "No components/input_variables is selected!" );
CV_ERROR( cv::Error::StsOutOfRange, "No components/input_variables is selected!" );
break;
case CV_32SC1:
// idx_arr is array of integer indices of selected components
if( idx_total > data_arr_size )
CV_ERROR( CV_StsOutOfRange,
CV_ERROR( cv::Error::StsOutOfRange,
"index array may not contain more elements than the total number of input variables" );
idx_selected = idx_total;
// check if sorted already
@ -134,7 +134,7 @@ static CvMat* cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, b
}
break;
default:
CV_ERROR( CV_StsUnsupportedFormat, "Unsupported index array data type "
CV_ERROR( cv::Error::StsUnsupportedFormat, "Unsupported index array data type "
"(it should be 8uC1, 8sC1 or 32sC1)" );
}
@ -156,13 +156,13 @@ static CvMat* cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, b
qsort( dsti, idx_total, sizeof(dsti[0]), icvCmpIntegers );
if( dsti[0] < 0 || dsti[idx_total-1] >= data_arr_size )
CV_ERROR( CV_StsOutOfRange, "the index array elements are out of range" );
CV_ERROR( cv::Error::StsOutOfRange, "the index array elements are out of range" );
if( check_for_duplicates )
{
for( i = 1; i < idx_total; i++ )
if( dsti[i] <= dsti[i-1] )
CV_ERROR( CV_StsBadArg, "There are duplicated index array elements" );
CV_ERROR( cv::Error::StsBadArg, "There are duplicated index array elements" );
}
}
@ -218,7 +218,7 @@ bool CvCascadeBoostParams::read( const FileNode &node )
!boostTypeStr.compare( CC_LOGIT_BOOST ) ? CvBoost::LOGIT :
!boostTypeStr.compare( CC_GENTLE_BOOST ) ? CvBoost::GENTLE : -1;
if (boost_type == -1)
CV_Error( CV_StsBadArg, "unsupported Boost type" );
CV_Error( cv::Error::StsBadArg, "unsupported Boost type" );
node[CC_MINHITRATE] >> minHitRate;
node[CC_MAXFALSEALARM] >> maxFalseAlarm;
node[CC_TRIM_RATE] >> weight_trim_rate ;
@ -228,7 +228,7 @@ bool CvCascadeBoostParams::read( const FileNode &node )
maxFalseAlarm <= 0 || maxFalseAlarm > 1 ||
weight_trim_rate <= 0 || weight_trim_rate > 1 ||
max_depth <= 0 || weak_count <= 0 )
CV_Error( CV_StsBadArg, "bad parameters range");
CV_Error( cv::Error::StsBadArg, "bad parameters range");
return true;
}
@ -309,7 +309,7 @@ CvDTreeNode* CvCascadeBoostTrainData::subsample_data( const CvMat* _subsample_id
bool isMakeRootCopy = true;
if( !data_root )
CV_Error( CV_StsError, "No training data has been set" );
CV_Error( cv::Error::StsError, "No training data has been set" );
if( _subsample_idx )
{
@ -547,7 +547,7 @@ void CvCascadeBoostTrainData::setData( const CvFeatureEvaluator* _featureEvaluat
// TODO: check responses: elements must be 0 or 1
if( _precalcValBufSize < 0 || _precalcIdxBufSize < 0)
CV_Error( CV_StsOutOfRange, "_numPrecalcVal and _numPrecalcIdx must be positive or 0" );
CV_Error( cv::Error::StsOutOfRange, "_numPrecalcVal and _numPrecalcIdx must be positive or 0" );
var_count = var_all = featureEvaluator->getNumFeatures() * featureEvaluator->getFeatureSize();
sample_count = _numSamples;
@ -602,7 +602,7 @@ void CvCascadeBoostTrainData::setData( const CvFeatureEvaluator* _featureEvaluat
if ((uint64)effective_buf_width * (uint64)effective_buf_height != effective_buf_size)
{
CV_Error(CV_StsBadArg, "The memory buffer cannot be allocated since its size exceeds integer fields limit");
CV_Error(cv::Error::StsBadArg, "The memory buffer cannot be allocated since its size exceeds integer fields limit");
}
if ( is_buf_16u )
@ -914,7 +914,7 @@ CvDTreeNode* CvCascadeBoostTree::predict( int sampleIdx ) const
{
CvDTreeNode* node = root;
if( !node )
CV_Error( CV_StsError, "The tree has not been trained yet" );
CV_Error( cv::Error::StsError, "The tree has not been trained yet" );
if ( ((CvCascadeBoostTrainData*)data)->featureEvaluator->getMaxCatCount() == 0 ) // ordered
{

View File

@ -142,7 +142,7 @@ bool CvCascadeClassifier::train( const string _cascadeDirName,
double time = (double)getTickCount();
if( _cascadeDirName.empty() || _posFilename.empty() || _negFilename.empty() )
CV_Error( CV_StsBadArg, "_cascadeDirName or _bgfileName or _vecFileName is NULL" );
CV_Error( cv::Error::StsBadArg, "_cascadeDirName or _bgfileName or _vecFileName is NULL" );
string dirName;
if (_cascadeDirName.find_last_of("/\\") == (_cascadeDirName.length() - 1) )
@ -452,7 +452,7 @@ void CvCascadeClassifier::save( const string filename, bool baseFormat )
//char buf[256];
CvSeq* weak;
if ( cascadeParams.featureType != CvFeatureParams::HAAR )
CV_Error( CV_StsBadFunc, "old file format is used for Haar-like features only");
CV_Error( cv::Error::StsBadFunc, "old file format is used for Haar-like features only");
fs << "{:" ICV_HAAR_TYPE_ID;
fs << ICV_HAAR_SIZE_NAME << "[:" << cascadeParams.winSize.width <<
cascadeParams.winSize.height << "]";

View File

@ -138,7 +138,7 @@ bool CvCascadeImageReader::PosReader::create( const string _filename )
fread( &vecSize, sizeof( vecSize ), 1, file ) != 1 ||
fread( &tmp, sizeof( tmp ), 1, file ) != 1 ||
fread( &tmp, sizeof( tmp ), 1, file ) != 1 )
CV_Error_( CV_StsParseError, ("wrong file format for %s\n", _filename.c_str()) );
CV_Error_( cv::Error::StsParseError, ("wrong file format for %s\n", _filename.c_str()) );
base = sizeof( count ) + sizeof( vecSize ) + 2*sizeof( tmp );
if( feof( file ) )
return false;
@ -154,14 +154,14 @@ bool CvCascadeImageReader::PosReader::get( Mat &_img )
uchar tmp = 0;
size_t elements_read = fread( &tmp, sizeof( tmp ), 1, file );
if( elements_read != 1 )
CV_Error( CV_StsBadArg, "Can not get new positive sample. The most possible reason is "
CV_Error( cv::Error::StsBadArg, "Can not get new positive sample. The most possible reason is "
"insufficient count of samples in given vec-file.\n");
elements_read = fread( vec, sizeof( vec[0] ), vecSize, file );
if( elements_read != (size_t)(vecSize) )
CV_Error( CV_StsBadArg, "Can not get new positive sample. Seems that vec-file has incorrect structure.\n");
CV_Error( cv::Error::StsBadArg, "Can not get new positive sample. Seems that vec-file has incorrect structure.\n");
if( feof( file ) || last++ >= count )
CV_Error( CV_StsBadArg, "Can not get new positive sample. vec-file is over.\n");
CV_Error( cv::Error::StsBadArg, "Can not get new positive sample. vec-file is over.\n");
for( int r = 0; r < _img.rows; r++ )
{

View File

@ -991,7 +991,7 @@ CvBoost::set_params( const CvBoostParams& _params )
params = _params;
if( params.boost_type != DISCRETE && params.boost_type != REAL &&
params.boost_type != LOGIT && params.boost_type != GENTLE )
CV_ERROR( CV_StsBadArg, "Unknown/unsupported boosting type" );
CV_ERROR( cv::Error::StsBadArg, "Unknown/unsupported boosting type" );
params.weak_count = MAX( params.weak_count, 1 );
params.weight_trim_rate = MAX( params.weight_trim_rate, 0. );
@ -1045,7 +1045,7 @@ CvBoost::train( const CvMat* _train_data, int _tflag,
_sample_idx, _var_type, _missing_mask, _params, true, true );
if( data->get_num_classes() != 2 )
CV_ERROR( CV_StsNotImplemented,
CV_ERROR( cv::Error::StsNotImplemented,
"Boosted trees can only be used for 2-class classification." );
CV_CALL( storage = cvCreateMemStorage() );
weak = cvCreateSeq( 0, sizeof(CvSeq), sizeof(CvBoostTree*), storage );
@ -1482,7 +1482,7 @@ CvBoost::get_active_vars( bool absolute_idx )
__BEGIN__;
if( !weak )
CV_ERROR( CV_StsError, "The boosted tree ensemble has not been trained yet" );
CV_ERROR( cv::Error::StsError, "The boosted tree ensemble has not been trained yet" );
if( !active_vars || !active_vars_abs )
{
@ -1612,13 +1612,13 @@ CvBoost::predict( const CvMat* _sample, const CvMat* _missing,
const float* sample_data;
if( !weak )
CV_Error( CV_StsError, "The boosted tree ensemble has not been trained yet" );
CV_Error( cv::Error::StsError, "The boosted tree ensemble has not been trained yet" );
if( !CV_IS_MAT(_sample) || CV_MAT_TYPE(_sample->type) != CV_32FC1 ||
(_sample->cols != 1 && _sample->rows != 1) ||
(_sample->cols + _sample->rows - 1 != data->var_all && !raw_mode) ||
(active_vars && _sample->cols + _sample->rows - 1 != active_vars->cols && raw_mode) )
CV_Error( CV_StsBadArg,
CV_Error( cv::Error::StsBadArg,
"the input sample must be 1d floating-point vector with the same "
"number of elements as the total number of variables or "
"as the number of variables used for training" );
@ -1627,7 +1627,7 @@ CvBoost::predict( const CvMat* _sample, const CvMat* _missing,
{
if( !CV_IS_MAT(_missing) || !CV_IS_MASK_ARR(_missing) ||
!CV_ARE_SIZES_EQ(_missing, _sample) )
CV_Error( CV_StsBadArg,
CV_Error( cv::Error::StsBadArg,
"the missing data mask must be 8-bit vector of the same size as input sample" );
}
@ -1644,7 +1644,7 @@ CvBoost::predict( const CvMat* _sample, const CvMat* _missing,
CV_MAT_TYPE(weak_responses->type) != CV_32FC1 ||
(weak_responses->cols != 1 && weak_responses->rows != 1) ||
weak_responses->cols + weak_responses->rows - 1 != weak_count )
CV_Error( CV_StsBadArg,
CV_Error( cv::Error::StsBadArg,
"The output matrix of weak classifier responses must be valid "
"floating-point vector of the same number of components as the length of input slice" );
wstep = CV_IS_MAT_CONT(weak_responses->type) ? 1 : weak_responses->step/sizeof(float);
@ -1700,7 +1700,7 @@ CvBoost::predict( const CvMat* _sample, const CvMat* _missing,
c = a;
int ival = cvRound(val);
if ( (ival != val) && (!m) )
CV_Error( CV_StsBadArg,
CV_Error( cv::Error::StsBadArg,
"one of input categorical variable is not an integer" );
while( a < b )
@ -1735,7 +1735,7 @@ CvBoost::predict( const CvMat* _sample, const CvMat* _missing,
else
{
if( !CV_IS_MAT_CONT(_sample->type & (_missing ? _missing->type : -1)) )
CV_Error( CV_StsBadArg, "In raw mode the input vectors must be continuous" );
CV_Error( cv::Error::StsBadArg, "In raw mode the input vectors must be continuous" );
}
cvStartReadSeq( weak, &reader );
@ -1951,7 +1951,7 @@ void CvBoost::read_params( cv::FileNode& fnode )
params.boost_type = temp.empty() ? -1 : (int)temp;
if( params.boost_type < DISCRETE || params.boost_type > GENTLE )
CV_ERROR( CV_StsBadArg, "Unknown boosting type" );
CV_ERROR( cv::Error::StsBadArg, "Unknown boosting type" );
temp = fnode[ "splitting_criteria" ];
if( !temp.empty() && temp.isString() )
@ -1966,7 +1966,7 @@ void CvBoost::read_params( cv::FileNode& fnode )
params.split_criteria = temp.empty() ? -1 : (int) temp;
if( params.split_criteria < DEFAULT || params.boost_type > SQERR )
CV_ERROR( CV_StsBadArg, "Unknown boosting type" );
CV_ERROR( cv::Error::StsBadArg, "Unknown boosting type" );
params.weak_count = (int) fnode[ "ntrees" ];
params.weight_trim_rate = (double)fnode["weight_trimming_rate"];
@ -1996,13 +1996,13 @@ CvBoost::read( cv::FileNode& node )
trees_fnode = node[ "trees" ];
if( trees_fnode.empty() || !trees_fnode.isSeq() )
CV_ERROR( CV_StsParseError, "<trees> tag is missing" );
CV_ERROR( cv::Error::StsParseError, "<trees> tag is missing" );
reader = trees_fnode.begin();
ntrees = (int) trees_fnode.size();
if( ntrees != params.weak_count )
CV_ERROR( CV_StsUnmatchedSizes,
CV_ERROR( cv::Error::StsUnmatchedSizes,
"The number of trees stored does not match <ntrees> tag value" );
CV_CALL( storage = cvCreateMemStorage() );
@ -2034,7 +2034,7 @@ CvBoost::write( cv::FileStorage& fs, const char* name ) const
fs.startWriteStruct( name, cv::FileNode::MAP, CV_TYPE_NAME_ML_BOOSTING );
if( !weak )
CV_ERROR( CV_StsBadArg, "The classifier has not been trained yet" );
CV_ERROR( cv::Error::StsBadArg, "The classifier has not been trained yet" );
write_params( fs );
fs.startWriteStruct( "trees", cv::FileNode::SEQ );

View File

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

View File

@ -67,7 +67,7 @@ void CvStatModel::save( const char* filename, const char* name ) const
__BEGIN__;
if( !fs.open( filename, cv::FileStorage::WRITE ))
CV_ERROR( CV_StsError, "Could not open the file storage. Check the path and permissions" );
CV_ERROR( cv::Error::StsError, "Could not open the file storage. Check the path and permissions" );
write( fs, name ? name : default_model_name );
@ -87,7 +87,7 @@ void CvStatModel::load( const char* filename, const char* name )
cv::FileNode model_node;
if( !fs.open(filename, cv::FileStorage::READ) )
CV_ERROR( CV_StsError, "Could not open the file storage. Check the path and permissions" );
CV_ERROR( cv::Error::StsError, "Could not open the file storage. Check the path and permissions" );
if( name )
model_node = fs[ name ];
@ -107,12 +107,12 @@ void CvStatModel::load( const char* filename, const char* name )
void CvStatModel::write( cv::FileStorage&, const char* ) const
{
OPENCV_ERROR( CV_StsNotImplemented, "CvStatModel::write", "" );
OPENCV_ERROR( cv::Error::StsNotImplemented, "CvStatModel::write", "" );
}
void CvStatModel::read( const cv::FileNode& )
{
OPENCV_ERROR( CV_StsNotImplemented, "CvStatModel::read", "" );
OPENCV_ERROR( cv::Error::StsNotImplemented, "CvStatModel::read", "" );
}
CvMat* icvGenerateRandomClusterCenters ( int seed, const CvMat* data,
@ -134,7 +134,7 @@ CvMat* icvGenerateRandomClusterCenters ( int seed, const CvMat* data,
{
if( _centers && !ICV_IS_MAT_OF_TYPE (_centers, CV_32FC1) )
{
CV_ERROR(CV_StsBadArg,"");
CV_ERROR(cv::Error::StsBadArg,"");
}
else if( !_centers )
CV_CALL(centers = cvCreateMat (num_of_clusters, dim, CV_32FC1));
@ -143,16 +143,16 @@ CvMat* icvGenerateRandomClusterCenters ( int seed, const CvMat* data,
{
if( _centers && !ICV_IS_MAT_OF_TYPE (_centers, CV_64FC1) )
{
CV_ERROR(CV_StsBadArg,"");
CV_ERROR(cv::Error::StsBadArg,"");
}
else if( !_centers )
CV_CALL(centers = cvCreateMat (num_of_clusters, dim, CV_64FC1));
}
else
CV_ERROR (CV_StsBadArg,"");
CV_ERROR (cv::Error::StsBadArg,"");
if( num_of_clusters < 1 )
CV_ERROR (CV_StsBadArg,"");
CV_ERROR (cv::Error::StsBadArg,"");
rng = cvRNG(seed);
for (i = 0; i < dim; i++)
@ -208,10 +208,10 @@ cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, bool check_for_
int* dsti;
if( !CV_IS_MAT(idx_arr) )
CV_ERROR( CV_StsBadArg, "Invalid index array" );
CV_ERROR( cv::Error::StsBadArg, "Invalid index array" );
if( idx_arr->rows != 1 && idx_arr->cols != 1 )
CV_ERROR( CV_StsBadSize, "the index array must be 1-dimensional" );
CV_ERROR( cv::Error::StsBadSize, "the index array must be 1-dimensional" );
idx_total = idx_arr->rows + idx_arr->cols - 1;
srcb = idx_arr->data.ptr;
@ -227,20 +227,20 @@ cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, bool check_for_
// idx_arr is array of 1's and 0's -
// i.e. it is a mask of the selected components
if( idx_total != data_arr_size )
CV_ERROR( CV_StsUnmatchedSizes,
CV_ERROR( cv::Error::StsUnmatchedSizes,
"Component mask should contain as many elements as the total number of input variables" );
for( i = 0; i < idx_total; i++ )
idx_selected += srcb[i*step] != 0;
if( idx_selected == 0 )
CV_ERROR( CV_StsOutOfRange, "No components/input_variables is selected!" );
CV_ERROR( cv::Error::StsOutOfRange, "No components/input_variables is selected!" );
break;
case CV_32SC1:
// idx_arr is array of integer indices of selected components
if( idx_total > data_arr_size )
CV_ERROR( CV_StsOutOfRange,
CV_ERROR( cv::Error::StsOutOfRange,
"index array may not contain more elements than the total number of input variables" );
idx_selected = idx_total;
// check if sorted already
@ -256,7 +256,7 @@ cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, bool check_for_
}
break;
default:
CV_ERROR( CV_StsUnsupportedFormat, "Unsupported index array data type "
CV_ERROR( cv::Error::StsUnsupportedFormat, "Unsupported index array data type "
"(it should be 8uC1, 8sC1 or 32sC1)" );
}
@ -278,13 +278,13 @@ cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, bool check_for_
qsort( dsti, idx_total, sizeof(dsti[0]), icvCmpIntegers );
if( dsti[0] < 0 || dsti[idx_total-1] >= data_arr_size )
CV_ERROR( CV_StsOutOfRange, "the index array elements are out of range" );
CV_ERROR( cv::Error::StsOutOfRange, "the index array elements are out of range" );
if( check_for_duplicates )
{
for( i = 1; i < idx_total; i++ )
if( dsti[i] <= dsti[i-1] )
CV_ERROR( CV_StsBadArg, "There are duplicated index array elements" );
CV_ERROR( cv::Error::StsBadArg, "There are duplicated index array elements" );
}
}
@ -315,19 +315,19 @@ cvPreprocessVarType( const CvMat* var_type, const CvMat* var_idx,
uchar* dst;
if( !CV_IS_MAT(var_type) )
CV_ERROR( var_type ? CV_StsBadArg : CV_StsNullPtr, "Invalid or absent var_type array" );
CV_ERROR( var_type ? cv::Error::StsBadArg : cv::Error::StsNullPtr, "Invalid or absent var_type array" );
if( var_type->rows != 1 && var_type->cols != 1 )
CV_ERROR( CV_StsBadSize, "var_type array must be 1-dimensional" );
CV_ERROR( cv::Error::StsBadSize, "var_type array must be 1-dimensional" );
if( !CV_IS_MASK_ARR(var_type))
CV_ERROR( CV_StsUnsupportedFormat, "type mask must be 8uC1 or 8sC1 array" );
CV_ERROR( cv::Error::StsUnsupportedFormat, "type mask must be 8uC1 or 8sC1 array" );
tm_size = var_type->rows + var_type->cols - 1;
tm_step = var_type->rows == 1 ? 1 : var_type->step/CV_ELEM_SIZE(var_type->type);
if( /*tm_size != var_count &&*/ tm_size != var_count + 1 )
CV_ERROR( CV_StsBadArg,
CV_ERROR( cv::Error::StsBadArg,
"type mask must be of <input var count> + 1 size" );
if( response_type && tm_size > var_count )
@ -337,9 +337,9 @@ cvPreprocessVarType( const CvMat* var_type, const CvMat* var_idx,
{
if( !CV_IS_MAT(var_idx) || CV_MAT_TYPE(var_idx->type) != CV_32SC1 ||
(var_idx->rows != 1 && var_idx->cols != 1) || !CV_IS_MAT_CONT(var_idx->type) )
CV_ERROR( CV_StsBadArg, "var index array should be continuous 1-dimensional integer vector" );
CV_ERROR( cv::Error::StsBadArg, "var index array should be continuous 1-dimensional integer vector" );
if( var_idx->rows + var_idx->cols - 1 > var_count )
CV_ERROR( CV_StsBadSize, "var index array is too large" );
CV_ERROR( cv::Error::StsBadSize, "var index array is too large" );
//map = var_idx->data.i;
var_count = var_idx->rows + var_idx->cols - 1;
}
@ -376,18 +376,18 @@ cvPreprocessOrderedResponses( const CvMat* responses, const CvMat* sample_idx, i
int sample_count = sample_all;
if( !CV_IS_MAT(responses) )
CV_ERROR( CV_StsBadArg, "Invalid response array" );
CV_ERROR( cv::Error::StsBadArg, "Invalid response array" );
if( responses->rows != 1 && responses->cols != 1 )
CV_ERROR( CV_StsBadSize, "Response array must be 1-dimensional" );
CV_ERROR( cv::Error::StsBadSize, "Response array must be 1-dimensional" );
if( responses->rows + responses->cols - 1 != sample_count )
CV_ERROR( CV_StsUnmatchedSizes,
CV_ERROR( cv::Error::StsUnmatchedSizes,
"Response array must contain as many elements as the total number of samples" );
r_type = CV_MAT_TYPE(responses->type);
if( r_type != CV_32FC1 && r_type != CV_32SC1 )
CV_ERROR( CV_StsUnsupportedFormat, "Unsupported response type" );
CV_ERROR( cv::Error::StsUnsupportedFormat, "Unsupported response type" );
r_step = responses->step ? responses->step / CV_ELEM_SIZE(responses->type) : 1;
@ -401,9 +401,9 @@ cvPreprocessOrderedResponses( const CvMat* responses, const CvMat* sample_idx, i
{
if( !CV_IS_MAT(sample_idx) || CV_MAT_TYPE(sample_idx->type) != CV_32SC1 ||
(sample_idx->rows != 1 && sample_idx->cols != 1) || !CV_IS_MAT_CONT(sample_idx->type) )
CV_ERROR( CV_StsBadArg, "sample index array should be continuous 1-dimensional integer vector" );
CV_ERROR( cv::Error::StsBadArg, "sample index array should be continuous 1-dimensional integer vector" );
if( sample_idx->rows + sample_idx->cols - 1 > sample_count )
CV_ERROR( CV_StsBadSize, "sample index array is too large" );
CV_ERROR( cv::Error::StsBadSize, "sample index array is too large" );
map = sample_idx->data.i;
sample_count = sample_idx->rows + sample_idx->cols - 1;
}
@ -466,18 +466,18 @@ cvPreprocessCategoricalResponses( const CvMat* responses,
int sample_count = sample_all;
if( !CV_IS_MAT(responses) )
CV_ERROR( CV_StsBadArg, "Invalid response array" );
CV_ERROR( cv::Error::StsBadArg, "Invalid response array" );
if( responses->rows != 1 && responses->cols != 1 )
CV_ERROR( CV_StsBadSize, "Response array must be 1-dimensional" );
CV_ERROR( cv::Error::StsBadSize, "Response array must be 1-dimensional" );
if( responses->rows + responses->cols - 1 != sample_count )
CV_ERROR( CV_StsUnmatchedSizes,
CV_ERROR( cv::Error::StsUnmatchedSizes,
"Response array must contain as many elements as the total number of samples" );
r_type = CV_MAT_TYPE(responses->type);
if( r_type != CV_32FC1 && r_type != CV_32SC1 )
CV_ERROR( CV_StsUnsupportedFormat, "Unsupported response type" );
CV_ERROR( cv::Error::StsUnsupportedFormat, "Unsupported response type" );
r_step = responses->rows == 1 ? 1 : responses->step / CV_ELEM_SIZE(responses->type);
@ -485,9 +485,9 @@ cvPreprocessCategoricalResponses( const CvMat* responses,
{
if( !CV_IS_MAT(sample_idx) || CV_MAT_TYPE(sample_idx->type) != CV_32SC1 ||
(sample_idx->rows != 1 && sample_idx->cols != 1) || !CV_IS_MAT_CONT(sample_idx->type) )
CV_ERROR( CV_StsBadArg, "sample index array should be continuous 1-dimensional integer vector" );
CV_ERROR( cv::Error::StsBadArg, "sample index array should be continuous 1-dimensional integer vector" );
if( sample_idx->rows + sample_idx->cols - 1 > sample_count )
CV_ERROR( CV_StsBadSize, "sample index array is too large" );
CV_ERROR( cv::Error::StsBadSize, "sample index array is too large" );
map = sample_idx->data.i;
sample_count = sample_idx->rows + sample_idx->cols - 1;
}
@ -495,7 +495,7 @@ cvPreprocessCategoricalResponses( const CvMat* responses,
CV_CALL( out_responses = cvCreateMat( 1, sample_count, CV_32SC1 ));
if( !out_response_map )
CV_ERROR( CV_StsNullPtr, "out_response_map pointer is NULL" );
CV_ERROR( cv::Error::StsNullPtr, "out_response_map pointer is NULL" );
CV_CALL( response_ptr = (int**)cvAlloc( sample_count*sizeof(response_ptr[0])));
@ -517,7 +517,7 @@ cvPreprocessCategoricalResponses( const CvMat* responses,
{
char buf[100];
snprintf( buf, sizeof(buf), "response #%d is not integral", idx );
CV_ERROR( CV_StsBadArg, buf );
CV_ERROR( cv::Error::StsBadArg, buf );
}
dst[i] = ri;
}
@ -531,7 +531,7 @@ cvPreprocessCategoricalResponses( const CvMat* responses,
cls_count += *response_ptr[i] != *response_ptr[i-1];
if( cls_count < 2 )
CV_ERROR( CV_StsBadArg, "There is only a single class" );
CV_ERROR( cv::Error::StsBadArg, "There is only a single class" );
CV_CALL( *out_response_map = cvCreateMat( 1, cls_count, CV_32SC1 ));
@ -588,7 +588,7 @@ cvGetTrainSamples( const CvMat* train_data, int tflag,
const int *s_idx, *v_idx;
if( !CV_IS_MAT(train_data) )
CV_ERROR( CV_StsBadArg, "Invalid or NULL training data matrix" );
CV_ERROR( cv::Error::StsBadArg, "Invalid or NULL training data matrix" );
var_count = var_idx ? var_idx->cols + var_idx->rows - 1 :
tflag == CV_ROW_SAMPLE ? train_data->cols : train_data->rows;
@ -659,18 +659,18 @@ cvCheckTrainData( const CvMat* train_data, int tflag,
// check parameter types and sizes
if( !CV_IS_MAT(train_data) || CV_MAT_TYPE(train_data->type) != CV_32FC1 )
CV_ERROR( CV_StsBadArg, "train data must be floating-point matrix" );
CV_ERROR( cv::Error::StsBadArg, "train data must be floating-point matrix" );
if( missing_mask )
{
if( !CV_IS_MAT(missing_mask) || !CV_IS_MASK_ARR(missing_mask) ||
!CV_ARE_SIZES_EQ(train_data, missing_mask) )
CV_ERROR( CV_StsBadArg,
CV_ERROR( cv::Error::StsBadArg,
"missing value mask must be 8-bit matrix of the same size as training data" );
}
if( tflag != CV_ROW_SAMPLE && tflag != CV_COL_SAMPLE )
CV_ERROR( CV_StsBadArg,
CV_ERROR( cv::Error::StsBadArg,
"Unknown training data layout (must be CV_ROW_SAMPLE or CV_COL_SAMPLE)" );
if( var_all )
@ -736,7 +736,7 @@ cvPrepareTrainData( const char* /*funcname*/,
__BEGIN__;
if( !out_train_samples )
CV_ERROR( CV_StsBadArg, "output pointer to train samples is NULL" );
CV_ERROR( cv::Error::StsBadArg, "output pointer to train samples is NULL" );
CV_CALL( cvCheckTrainData( train_data, tflag, 0, &var_all, &sample_all ));
@ -748,7 +748,7 @@ cvPrepareTrainData( const char* /*funcname*/,
if( responses )
{
if( !out_responses )
CV_ERROR( CV_StsNullPtr, "output response pointer is NULL" );
CV_ERROR( cv::Error::StsNullPtr, "output response pointer is NULL" );
if( response_type == CV_VAR_NUMERICAL )
{
@ -841,10 +841,10 @@ cvSortSamplesByClasses( const float** samples, const CvMat* classes,
int i, k = 0, sample_count;
if( !samples || !classes || !class_ranges )
CV_ERROR( CV_StsNullPtr, "INTERNAL ERROR: some of the args are NULL pointers" );
CV_ERROR( cv::Error::StsNullPtr, "INTERNAL ERROR: some of the args are NULL pointers" );
if( classes->rows != 1 || CV_MAT_TYPE(classes->type) != CV_32SC1 )
CV_ERROR( CV_StsBadArg, "classes array must be a single row of integers" );
CV_ERROR( cv::Error::StsBadArg, "classes array must be a single row of integers" );
sample_count = classes->cols;
CV_CALL( pairs = (CvSampleResponsePair*)cvAlloc( (sample_count+1)*sizeof(pairs[0])));
@ -901,45 +901,45 @@ cvPreparePredictData( const CvArr* _sample, int dims_all,
int vec_size;
if( !is_sparse && !CV_IS_MAT(sample) )
CV_ERROR( !sample ? CV_StsNullPtr : CV_StsBadArg, "The sample is not a valid vector" );
CV_ERROR( !sample ? cv::Error::StsNullPtr : cv::Error::StsBadArg, "The sample is not a valid vector" );
if( cvGetElemType( sample ) != CV_32FC1 )
CV_ERROR( CV_StsUnsupportedFormat, "Input sample must have 32fC1 type" );
CV_ERROR( cv::Error::StsUnsupportedFormat, "Input sample must have 32fC1 type" );
CV_CALL( d = cvGetDims( sample, sizes ));
if( !((is_sparse && d == 1) || (!is_sparse && d == 2 && (sample->rows == 1 || sample->cols == 1))) )
CV_ERROR( CV_StsBadSize, "Input sample must be 1-dimensional vector" );
CV_ERROR( cv::Error::StsBadSize, "Input sample must be 1-dimensional vector" );
if( d == 1 )
sizes[1] = 1;
if( sizes[0] + sizes[1] - 1 != dims_all )
CV_ERROR( CV_StsUnmatchedSizes,
CV_ERROR( cv::Error::StsUnmatchedSizes,
"The sample size is different from what has been used for training" );
if( !_row_sample )
CV_ERROR( CV_StsNullPtr, "INTERNAL ERROR: The row_sample pointer is NULL" );
CV_ERROR( cv::Error::StsNullPtr, "INTERNAL ERROR: The row_sample pointer is NULL" );
if( comp_idx && (!CV_IS_MAT(comp_idx) || comp_idx->rows != 1 ||
CV_MAT_TYPE(comp_idx->type) != CV_32SC1) )
CV_ERROR( CV_StsBadArg, "INTERNAL ERROR: invalid comp_idx" );
CV_ERROR( cv::Error::StsBadArg, "INTERNAL ERROR: invalid comp_idx" );
dims_selected = comp_idx ? comp_idx->cols : dims_all;
if( prob )
{
if( !CV_IS_MAT(prob) )
CV_ERROR( CV_StsBadArg, "The output matrix of probabilities is invalid" );
CV_ERROR( cv::Error::StsBadArg, "The output matrix of probabilities is invalid" );
if( (prob->rows != 1 && prob->cols != 1) ||
(CV_MAT_TYPE(prob->type) != CV_32FC1 &&
CV_MAT_TYPE(prob->type) != CV_64FC1) )
CV_ERROR( CV_StsBadSize,
CV_ERROR( cv::Error::StsBadSize,
"The matrix of probabilities must be 1-dimensional vector of 32fC1 type" );
if( prob->rows + prob->cols - 1 != class_count )
CV_ERROR( CV_StsUnmatchedSizes,
CV_ERROR( cv::Error::StsUnmatchedSizes,
"The vector of probabilities must contain as many elements as "
"the number of classes in the training set" );
}
@ -1071,7 +1071,7 @@ icvConvertDataToSparse( const uchar* src, int src_step, int src_type,
dst_type = CV_MAT_TYPE(dst_type);
if( CV_MAT_CN(src_type) != 1 || CV_MAT_CN(dst_type) != 1 )
CV_ERROR( CV_StsUnsupportedFormat, "The function supports only single-channel arrays" );
CV_ERROR( cv::Error::StsUnsupportedFormat, "The function supports only single-channel arrays" );
if( src_step == 0 )
src_step = CV_ELEM_SIZE(src_type);
@ -1134,7 +1134,7 @@ icvConvertDataToSparse( const uchar* src, int src_step, int src_type,
((float*)_dst)[j] = (float)((double*)src)[j];
}
else
CV_ERROR( CV_StsUnsupportedFormat, "Unsupported combination of input and output vectors" );
CV_ERROR( cv::Error::StsUnsupportedFormat, "Unsupported combination of input and output vectors" );
__END__;
}
@ -1154,15 +1154,15 @@ cvWritebackLabels( const CvMat* labels, CvMat* dst_labels,
int samples_selected = samples_all, dims_selected = dims_all;
if( dst_labels && !CV_IS_MAT(dst_labels) )
CV_ERROR( CV_StsBadArg, "Array of output labels is not a valid matrix" );
CV_ERROR( cv::Error::StsBadArg, "Array of output labels is not a valid matrix" );
if( dst_centers )
if( !ICV_IS_MAT_OF_TYPE(dst_centers, CV_32FC1) &&
!ICV_IS_MAT_OF_TYPE(dst_centers, CV_64FC1) )
CV_ERROR( CV_StsBadArg, "Array of cluster centers is not a valid matrix" );
CV_ERROR( cv::Error::StsBadArg, "Array of cluster centers is not a valid matrix" );
if( dst_probs && !CV_IS_MAT(dst_probs) )
CV_ERROR( CV_StsBadArg, "Probability matrix is not valid" );
CV_ERROR( cv::Error::StsBadArg, "Probability matrix is not valid" );
if( sample_idx )
{
@ -1179,15 +1179,15 @@ cvWritebackLabels( const CvMat* labels, CvMat* dst_labels,
if( dst_labels && (!labels || labels->data.ptr != dst_labels->data.ptr) )
{
if( !labels )
CV_ERROR( CV_StsNullPtr, "NULL labels" );
CV_ERROR( cv::Error::StsNullPtr, "NULL labels" );
CV_ASSERT( labels->rows == 1 );
if( dst_labels->rows != 1 && dst_labels->cols != 1 )
CV_ERROR( CV_StsBadSize, "Array of output labels should be 1d vector" );
CV_ERROR( cv::Error::StsBadSize, "Array of output labels should be 1d vector" );
if( dst_labels->rows + dst_labels->cols - 1 != samples_all )
CV_ERROR( CV_StsUnmatchedSizes,
CV_ERROR( cv::Error::StsUnmatchedSizes,
"Size of vector of output labels is not equal to the total number of input samples" );
CV_ASSERT( labels->cols == samples_selected );
@ -1202,13 +1202,13 @@ cvWritebackLabels( const CvMat* labels, CvMat* dst_labels,
int i;
if( !centers )
CV_ERROR( CV_StsNullPtr, "NULL centers" );
CV_ERROR( cv::Error::StsNullPtr, "NULL centers" );
if( centers->rows != dst_centers->rows )
CV_ERROR( CV_StsUnmatchedSizes, "Invalid number of rows in matrix of output centers" );
CV_ERROR( cv::Error::StsUnmatchedSizes, "Invalid number of rows in matrix of output centers" );
if( dst_centers->cols != dims_all )
CV_ERROR( CV_StsUnmatchedSizes,
CV_ERROR( cv::Error::StsUnmatchedSizes,
"Number of columns in matrix of output centers is "
"not equal to the total number of components in the input samples" );
@ -1223,13 +1223,13 @@ cvWritebackLabels( const CvMat* labels, CvMat* dst_labels,
if( dst_probs && (!probs || probs->data.ptr != dst_probs->data.ptr) )
{
if( !probs )
CV_ERROR( CV_StsNullPtr, "NULL probs" );
CV_ERROR( cv::Error::StsNullPtr, "NULL probs" );
if( probs->cols != dst_probs->cols )
CV_ERROR( CV_StsUnmatchedSizes, "Invalid number of columns in output probability matrix" );
CV_ERROR( cv::Error::StsUnmatchedSizes, "Invalid number of columns in output probability matrix" );
if( dst_probs->rows != samples_all )
CV_ERROR( CV_StsUnmatchedSizes,
CV_ERROR( cv::Error::StsUnmatchedSizes,
"Number of rows in output probability matrix is "
"not equal to the total number of input samples" );
@ -1273,29 +1273,29 @@ cvStatModelMultiPredict( const CvStatModel* stat_model,
CvMat* probs1 = probs ? &probs_part : 0;
if( !CV_IS_STAT_MODEL(stat_model) )
CV_ERROR( !stat_model ? CV_StsNullPtr : CV_StsBadArg, "Invalid statistical model" );
CV_ERROR( !stat_model ? cv::Error::StsNullPtr : cv::Error::StsBadArg, "Invalid statistical model" );
if( !stat_model->predict )
CV_ERROR( CV_StsNotImplemented, "There is no \"predict\" method" );
CV_ERROR( cv::Error::StsNotImplemented, "There is no \"predict\" method" );
if( !predict_input || !predict_output )
CV_ERROR( CV_StsNullPtr, "NULL input or output matrices" );
CV_ERROR( cv::Error::StsNullPtr, "NULL input or output matrices" );
if( !is_sparse && !CV_IS_MAT(predict_input) )
CV_ERROR( CV_StsBadArg, "predict_input should be a matrix or a sparse matrix" );
CV_ERROR( cv::Error::StsBadArg, "predict_input should be a matrix or a sparse matrix" );
if( !CV_IS_MAT(predict_output) )
CV_ERROR( CV_StsBadArg, "predict_output should be a matrix" );
CV_ERROR( cv::Error::StsBadArg, "predict_output should be a matrix" );
type = cvGetElemType( predict_input );
if( type != CV_32FC1 ||
(CV_MAT_TYPE(predict_output->type) != CV_32FC1 &&
CV_MAT_TYPE(predict_output->type) != CV_32SC1 ))
CV_ERROR( CV_StsUnsupportedFormat, "The input or output matrix has unsupported format" );
CV_ERROR( cv::Error::StsUnsupportedFormat, "The input or output matrix has unsupported format" );
CV_CALL( d = cvGetDims( predict_input, sizes ));
if( d > 2 )
CV_ERROR( CV_StsBadSize, "The input matrix should be 1- or 2-dimensional" );
CV_ERROR( cv::Error::StsBadSize, "The input matrix should be 1- or 2-dimensional" );
if( !tflag )
{
@ -1311,30 +1311,30 @@ cvStatModelMultiPredict( const CvStatModel* stat_model,
if( sample_idx )
{
if( !CV_IS_MAT(sample_idx) )
CV_ERROR( CV_StsBadArg, "Invalid sample_idx matrix" );
CV_ERROR( cv::Error::StsBadArg, "Invalid sample_idx matrix" );
if( sample_idx->cols != 1 && sample_idx->rows != 1 )
CV_ERROR( CV_StsBadSize, "sample_idx must be 1-dimensional matrix" );
CV_ERROR( cv::Error::StsBadSize, "sample_idx must be 1-dimensional matrix" );
samples_selected = sample_idx->rows + sample_idx->cols - 1;
if( CV_MAT_TYPE(sample_idx->type) == CV_32SC1 )
{
if( samples_selected > samples_all )
CV_ERROR( CV_StsBadSize, "sample_idx is too large vector" );
CV_ERROR( cv::Error::StsBadSize, "sample_idx is too large vector" );
}
else if( samples_selected != samples_all )
CV_ERROR( CV_StsUnmatchedSizes, "sample_idx has incorrect size" );
CV_ERROR( cv::Error::StsUnmatchedSizes, "sample_idx has incorrect size" );
sample_idx_step = sample_idx->step ?
sample_idx->step / CV_ELEM_SIZE(sample_idx->type) : 1;
}
if( predict_output->rows != 1 && predict_output->cols != 1 )
CV_ERROR( CV_StsBadSize, "predict_output should be a 1-dimensional matrix" );
CV_ERROR( cv::Error::StsBadSize, "predict_output should be a 1-dimensional matrix" );
if( predict_output->rows + predict_output->cols - 1 != samples_all )
CV_ERROR( CV_StsUnmatchedSizes, "predict_output and predict_input have uncoordinated sizes" );
CV_ERROR( cv::Error::StsUnmatchedSizes, "predict_output and predict_input have uncoordinated sizes" );
predict_output_step = predict_output->step ?
predict_output->step / CV_ELEM_SIZE(predict_output->type) : 1;
@ -1342,14 +1342,14 @@ cvStatModelMultiPredict( const CvStatModel* stat_model,
if( probs )
{
if( !CV_IS_MAT(probs) )
CV_ERROR( CV_StsBadArg, "Invalid matrix of probabilities" );
CV_ERROR( cv::Error::StsBadArg, "Invalid matrix of probabilities" );
if( probs->rows != samples_all )
CV_ERROR( CV_StsUnmatchedSizes,
CV_ERROR( cv::Error::StsUnmatchedSizes,
"matrix of probabilities must have as many rows as the total number of samples" );
if( CV_MAT_TYPE(probs->type) != CV_32FC1 )
CV_ERROR( CV_StsUnsupportedFormat, "matrix of probabilities must have 32fC1 type" );
CV_ERROR( cv::Error::StsUnsupportedFormat, "matrix of probabilities must have 32fC1 type" );
}
if( is_sparse )
@ -1414,7 +1414,7 @@ cvStatModelMultiPredict( const CvStatModel* stat_model,
{
idx = sample_idx->data.i[i*sample_idx_step];
if( (unsigned)idx >= (unsigned)samples_all )
CV_ERROR( CV_StsOutOfRange, "Some of sample_idx elements are out of range" );
CV_ERROR( cv::Error::StsOutOfRange, "Some of sample_idx elements are out of range" );
}
else if( CV_MAT_TYPE(sample_idx->type) == CV_8UC1 &&
sample_idx->data.ptr[i*sample_idx_step] == 0 )
@ -1494,7 +1494,7 @@ void cvCombineResponseMaps (CvMat* _responses,
(!ICV_IS_MAT_OF_TYPE (old_response_map, CV_32SC1)) ||
(!ICV_IS_MAT_OF_TYPE (new_response_map, CV_32SC1)))
{
CV_ERROR (CV_StsBadArg, "Some of input arguments is not the CvMat")
CV_ERROR (cv::Error::StsBadArg, "Some of input arguments is not the CvMat")
}
// Prepare sorted responses.

View File

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

View File

@ -93,17 +93,17 @@ bool CvDTreeTrainData::set_params( const CvDTreeParams& _params )
params = _params;
if( params.max_categories < 2 )
CV_ERROR( CV_StsOutOfRange, "params.max_categories should be >= 2" );
CV_ERROR( cv::Error::StsOutOfRange, "params.max_categories should be >= 2" );
params.max_categories = MIN( params.max_categories, 15 );
if( params.max_depth < 0 )
CV_ERROR( CV_StsOutOfRange, "params.max_depth should be >= 0" );
CV_ERROR( cv::Error::StsOutOfRange, "params.max_depth should be >= 0" );
params.max_depth = MIN( params.max_depth, 25 );
params.min_sample_count = MAX(params.min_sample_count,1);
if( params.cv_folds < 0 )
CV_ERROR( CV_StsOutOfRange,
CV_ERROR( cv::Error::StsOutOfRange,
"params.cv_folds should be =0 (the tree is not pruned) "
"or n>0 (tree is pruned using n-fold cross-validation)" );
@ -111,7 +111,7 @@ bool CvDTreeTrainData::set_params( const CvDTreeParams& _params )
params.cv_folds = 0;
if( params.regression_accuracy < 0 )
CV_ERROR( CV_StsOutOfRange, "params.regression_accuracy should be >= 0" );
CV_ERROR( cv::Error::StsOutOfRange, "params.regression_accuracy should be >= 0" );
ok = true;
@ -183,7 +183,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag,
cvNorm( data->var_type, var_type, CV_C ) < FLT_EPSILON &&
cvNorm( data->cat_count, cat_count, CV_C ) < FLT_EPSILON &&
cvNorm( data->cat_map, cat_map, CV_C ) < FLT_EPSILON) )
CV_ERROR( CV_StsBadArg,
CV_ERROR( cv::Error::StsBadArg,
"The new training data must have the same types and the input and output variables "
"and the same categories for categorical variables" );
@ -264,7 +264,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag,
CV_MAT_TYPE(_responses->type) != CV_32FC1) ||
(_responses->rows != 1 && _responses->cols != 1) ||
_responses->rows + _responses->cols - 1 != sample_all )
CV_ERROR( CV_StsBadArg, "The array of _responses must be an integer or "
CV_ERROR( cv::Error::StsBadArg, "The array of _responses must be an integer or "
"floating-point vector containing as many elements as "
"the total number of samples in the training data matrix" );
@ -317,7 +317,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag,
if ((uint64)effective_buf_width * (uint64)effective_buf_height != effective_buf_size)
{
CV_Error(CV_StsBadArg, "The memory buffer cannot be allocated since its size exceeds integer fields limit");
CV_Error(cv::Error::StsBadArg, "The memory buffer cannot be allocated since its size exceeds integer fields limit");
}
@ -360,7 +360,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag,
if( cv_n )
{
if( sample_count < cv_n*MAX(params.min_sample_count,10) )
CV_ERROR( CV_StsOutOfRange,
CV_ERROR( cv::Error::StsOutOfRange,
"The many folds in cross-validation for such a small dataset" );
cv_size = cvAlign( cv_n*(sizeof(int) + sizeof(double)*2), sizeof(double) );
@ -444,7 +444,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag,
{
snprintf( err, sizeof(err), "%d-th value of %d-th (categorical) "
"variable is not an integer", i, vi );
CV_ERROR( CV_StsBadArg, err );
CV_ERROR( cv::Error::StsBadArg, err );
}
}
@ -452,7 +452,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag,
{
snprintf( err, sizeof(err), "%d-th value of %d-th (categorical) "
"variable is too large", i, vi );
CV_ERROR( CV_StsBadArg, err );
CV_ERROR( cv::Error::StsBadArg, err );
}
num_valid++;
}
@ -559,7 +559,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag,
{
snprintf( err, sizeof(err), "%d-th value of %d-th (ordered) "
"variable (=%g) is too large", i, vi, val );
CV_ERROR( CV_StsBadArg, err );
CV_ERROR( cv::Error::StsBadArg, err );
}
num_valid++;
}
@ -652,7 +652,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag,
{
double val = have_priors ? params.priors[i] : 1.;
if( val <= 0 )
CV_ERROR( CV_StsOutOfRange, "Every class weight should be positive" );
CV_ERROR( cv::Error::StsOutOfRange, "Every class weight should be positive" );
priors->data.db[i] = val;
sum += val;
}
@ -705,7 +705,7 @@ CvDTreeNode* CvDTreeTrainData::subsample_data( const CvMat* _subsample_idx )
__BEGIN__;
if( !data_root )
CV_ERROR( CV_StsError, "No training data has been set" );
CV_ERROR( cv::Error::StsError, "No training data has been set" );
if( _subsample_idx )
{
@ -1396,7 +1396,7 @@ void CvDTreeTrainData::read_params( const cv::FileNode& node )
auto tmat = cvMat( tparams_node[ "priors" ].mat() );
priors = cvCloneMat( &tmat );
if( !CV_IS_MAT(priors) )
CV_ERROR( CV_StsParseError, "priors must stored as a matrix" );
CV_ERROR( cv::Error::StsParseError, "priors must stored as a matrix" );
priors_mult = cvCloneMat( priors );
}
}
@ -1413,12 +1413,12 @@ void CvDTreeTrainData::read_params( const cv::FileNode& node )
(var_idx->cols != 1 && var_idx->rows != 1) ||
var_idx->cols + var_idx->rows - 1 != var_count ||
CV_MAT_TYPE(var_idx->type) != CV_32SC1 )
CV_ERROR( CV_StsParseError,
CV_ERROR( cv::Error::StsParseError,
"var_idx (if exist) must be valid 1d integer vector containing <var_count> elements" );
for( vi = 0; vi < var_count; vi++ )
if( (unsigned)var_idx->data.i[vi] >= (unsigned)var_all )
CV_ERROR( CV_StsOutOfRange, "some of var_idx elements are out of range" );
CV_ERROR( cv::Error::StsOutOfRange, "some of var_idx elements are out of range" );
}
////// read var type
@ -1434,7 +1434,7 @@ void CvDTreeTrainData::read_params( const cv::FileNode& node )
{
if( vartype_node.empty() || !vartype_node.isSeq() ||
vartype_node.size() != (size_t) var_count )
CV_ERROR( CV_StsParseError, "var_type must exist and be a sequence of 0's and 1's" );
CV_ERROR( cv::Error::StsParseError, "var_type must exist and be a sequence of 0's and 1's" );
reader = vartype_node.begin();
@ -1442,7 +1442,7 @@ void CvDTreeTrainData::read_params( const cv::FileNode& node )
{
cv::FileNode n = *reader;
if( !n.isInt() || ((int) n & ~1) )
CV_ERROR( CV_StsParseError, "var_type must exist and be a sequence of 0's and 1's" );
CV_ERROR( cv::Error::StsParseError, "var_type must exist and be a sequence of 0's and 1's" );
var_type->data.i[vi] = (int) n ? cat_var_count++ : ord_var_count--;
reader++;
}
@ -1468,7 +1468,7 @@ void CvDTreeTrainData::read_params( const cv::FileNode& node )
cat_count->cols + cat_count->rows - 1 != cat_var_count + is_classifier ||
(cat_map->cols != 1 && cat_map->rows != 1) ||
CV_MAT_TYPE(cat_map->type) != CV_32SC1 )
CV_ERROR( CV_StsParseError,
CV_ERROR( cv::Error::StsParseError,
"Both cat_count and cat_map must exist and be valid 1d integer vectors of an appropriate size" );
ccount = cat_var_count + is_classifier;
@ -1481,13 +1481,13 @@ void CvDTreeTrainData::read_params( const cv::FileNode& node )
{
int val = cat_count->data.i[vi];
if( val <= 0 )
CV_ERROR( CV_StsOutOfRange, "some of cat_count elements are out of range" );
CV_ERROR( cv::Error::StsOutOfRange, "some of cat_count elements are out of range" );
max_c_count = MAX( max_c_count, val );
cat_ofs->data.i[vi+1] = total_c_count += val;
}
if( cat_map->cols + cat_map->rows - 1 != total_c_count )
CV_ERROR( CV_StsBadSize,
CV_ERROR( cv::Error::StsBadSize,
"cat_map vector length is not equal to the total number of categories in all categorical vars" );
}
@ -3631,13 +3631,13 @@ CvDTreeNode* CvDTree::predict( const CvMat* _sample,
CvDTreeNode* node = root;
if( !node )
CV_Error( CV_StsError, "The tree has not been trained yet" );
CV_Error( cv::Error::StsError, "The tree has not been trained yet" );
if( !CV_IS_MAT(_sample) || CV_MAT_TYPE(_sample->type) != CV_32FC1 ||
(_sample->cols != 1 && _sample->rows != 1) ||
(_sample->cols + _sample->rows - 1 != data->var_all && !preprocessed_input) ||
(_sample->cols + _sample->rows - 1 != data->var_count && preprocessed_input) )
CV_Error( CV_StsBadArg,
CV_Error( cv::Error::StsBadArg,
"the input sample must be 1d floating-point vector with the same "
"number of elements as the total number of variables used for training" );
@ -3656,7 +3656,7 @@ CvDTreeNode* CvDTree::predict( const CvMat* _sample,
{
if( !CV_IS_MAT(_missing) || !CV_IS_MASK_ARR(_missing) ||
!CV_ARE_SIZES_EQ(_missing, _sample) )
CV_Error( CV_StsBadArg,
CV_Error( cv::Error::StsBadArg,
"the missing data mask must be 8-bit vector of the same size as input sample" );
m = _missing->data.ptr;
mstep = CV_IS_MAT_CONT(_missing->type) ? 1 : _missing->step/sizeof(m[0]);
@ -3696,7 +3696,7 @@ CvDTreeNode* CvDTree::predict( const CvMat* _sample,
int ival = cvRound(val);
if( ival != val )
CV_Error( CV_StsBadArg,
CV_Error( cv::Error::StsBadArg,
"one of input categorical variable is not an integer" );
while( a < b )
@ -3936,11 +3936,11 @@ CvDTreeSplit* CvDTree::read_split( const cv::FileNode& fnode )
int vi, ci;
if( fnode.empty() || !fnode.isMap() )
CV_ERROR( CV_StsParseError, "some of the splits are not stored properly" );
CV_ERROR( cv::Error::StsParseError, "some of the splits are not stored properly" );
vi = fnode[ "var" ].empty() ? -1 : (int) fnode[ "var" ];
if( (unsigned)vi >= (unsigned)data->var_count )
CV_ERROR( CV_StsOutOfRange, "Split variable index is out of range" );
CV_ERROR( cv::Error::StsOutOfRange, "Split variable index is out of range" );
ci = data->get_var_type(vi);
if( ci >= 0 ) // split on categorical var
@ -3957,14 +3957,14 @@ CvDTreeSplit* CvDTree::read_split( const cv::FileNode& fnode )
}
if( inseq.empty() ||
(!inseq.isSeq() && !inseq.isInt()))
CV_ERROR( CV_StsParseError,
CV_ERROR( cv::Error::StsParseError,
"Either 'in' or 'not_in' tags should be inside a categorical split data" );
if( inseq.isInt() )
{
val = (int) inseq;
if( (unsigned)val >= (unsigned)n )
CV_ERROR( CV_StsOutOfRange, "some of in/not_in elements are out of range" );
CV_ERROR( cv::Error::StsOutOfRange, "some of in/not_in elements are out of range" );
split->subset[val >> 5] |= 1 << (val & 31);
}
@ -3977,7 +3977,7 @@ CvDTreeSplit* CvDTree::read_split( const cv::FileNode& fnode )
cv::FileNode inode = *reader;
val = (int) inode;
if( !inode.isInt() || (unsigned)val >= (unsigned)n )
CV_ERROR( CV_StsOutOfRange, "some of in/not_in elements are out of range" );
CV_ERROR( cv::Error::StsOutOfRange, "some of in/not_in elements are out of range" );
split->subset[val >> 5] |= 1 << (val & 31);
reader++;
@ -4025,12 +4025,12 @@ CvDTreeNode* CvDTree::read_node( const cv::FileNode& fnode, CvDTreeNode* parent
int i, depth;
if( fnode.empty() || !fnode.isMap() )
CV_ERROR( CV_StsParseError, "some of the tree elements are not stored properly" );
CV_ERROR( cv::Error::StsParseError, "some of the tree elements are not stored properly" );
CV_CALL( node = data->new_node( parent, 0, 0, 0 ));
depth = fnode[ "depth" ].empty() ? -1 : (int) fnode[ "depth" ];
if( depth != node->depth )
CV_ERROR( CV_StsParseError, "incorrect node depth" );
CV_ERROR( cv::Error::StsParseError, "incorrect node depth" );
node->sample_count = (int) fnode[ "sample_count" ];
node->value = (double) fnode[ "value" ];
@ -4051,7 +4051,7 @@ CvDTreeNode* CvDTree::read_node( const cv::FileNode& fnode, CvDTreeNode* parent
CvDTreeSplit* last_split = 0;
if( !splits.isSeq() )
CV_ERROR( CV_StsParseError, "splits tag must stored as a sequence" );
CV_ERROR( cv::Error::StsParseError, "splits tag must stored as a sequence" );
reader = splits.begin();
for( i = 0; i < (int) (*reader).size(); i++ )
@ -4137,7 +4137,7 @@ void CvDTree::read( const cv::FileNode& node, CvDTreeTrainData* _data )
tree_nodes = node[ "nodes" ];
if( tree_nodes.empty() || !tree_nodes.isSeq() )
CV_ERROR( CV_StsParseError, "nodes tag is missing" );
CV_ERROR( cv::Error::StsParseError, "nodes tag is missing" );
pruned_tree_idx = node[ "best_tree_idx" ].empty() ? -1 : node[ "best_tree_idx" ];
read_tree_nodes( tree_nodes );

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 );
if( !CV_IS_MAT(src) )
CV_Error( !src ? CV_StsNullPtr : CV_StsBadArg, "Input argument is not a valid matrix" );
CV_Error( !src ? cv::Error::StsNullPtr : cv::Error::StsBadArg, "Input argument is not a valid matrix" );
if( !CV_IS_MAT(dst) )
CV_Error( !dst ? CV_StsNullPtr : CV_StsBadArg,
CV_Error( !dst ? cv::Error::StsNullPtr : cv::Error::StsBadArg,
"The first output argument is not a valid matrix" );
int depth = CV_MAT_DEPTH(src->type);
int elem_size = CV_ELEM_SIZE(depth);
if( depth != CV_32F && depth != CV_64F )
CV_Error( CV_StsUnsupportedFormat, "The matrices must have 32f or 64f data type" );
CV_Error( cv::Error::StsUnsupportedFormat, "The matrices must have 32f or 64f data type" );
if( !CV_ARE_DEPTHS_EQ(src, dst) )
CV_Error( CV_StsUnmatchedFormats, "All the matrices must have the same data type" );
CV_Error( cv::Error::StsUnmatchedFormats, "All the matrices must have the same data type" );
if( jacobian )
{
if( !CV_IS_MAT(jacobian) )
CV_Error( CV_StsBadArg, "Jacobian is not a valid matrix" );
CV_Error( cv::Error::StsBadArg, "Jacobian is not a valid matrix" );
if( !CV_ARE_DEPTHS_EQ(src, jacobian) || CV_MAT_CN(jacobian->type) != 1 )
CV_Error( CV_StsUnmatchedFormats, "Jacobian must have 32fC1 or 64fC1 datatype" );
CV_Error( cv::Error::StsUnmatchedFormats, "Jacobian must have 32fC1 or 64fC1 datatype" );
if( (jacobian->rows != 9 || jacobian->cols != 3) &&
(jacobian->rows != 3 || jacobian->cols != 9))
CV_Error( CV_StsBadSize, "Jacobian must be 3x9 or 9x3" );
CV_Error( cv::Error::StsBadSize, "Jacobian must be 3x9 or 9x3" );
}
if( src->cols == 1 || src->rows == 1 )
@ -287,10 +287,10 @@ CV_IMPL int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian )
int step = src->rows > 1 ? src->step / elem_size : 1;
if( src->rows + src->cols*CV_MAT_CN(src->type) - 1 != 3 )
CV_Error( CV_StsBadSize, "Input matrix must be 1x3, 3x1 or 3x3" );
CV_Error( cv::Error::StsBadSize, "Input matrix must be 1x3, 3x1 or 3x3" );
if( dst->rows != 3 || dst->cols != 3 || CV_MAT_CN(dst->type) != 1 )
CV_Error( CV_StsBadSize, "Output matrix must be 3x3, single-channel floating point matrix" );
CV_Error( cv::Error::StsBadSize, "Output matrix must be 3x3, single-channel floating point matrix" );
Point3d r;
if( depth == CV_32F )
@ -368,7 +368,7 @@ CV_IMPL int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian )
if( (dst->rows != 1 || dst->cols*CV_MAT_CN(dst->type) != 3) &&
(dst->rows != 3 || dst->cols != 1 || CV_MAT_CN(dst->type) != 1))
CV_Error( CV_StsBadSize, "Output matrix must be 1x3 or 3x1" );
CV_Error( cv::Error::StsBadSize, "Output matrix must be 1x3 or 3x1" );
Matx33d R = cvarrToMat(src);
@ -490,7 +490,7 @@ CV_IMPL int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian )
}
else
{
CV_Error(CV_StsBadSize, "Input matrix must be 1x3 or 3x1 for a rotation vector, or 3x3 for a rotation matrix");
CV_Error(cv::Error::StsBadSize, "Input matrix must be 1x3 or 3x1 for a rotation vector, or 3x3 for a rotation matrix");
}
if( jacobian )
@ -553,13 +553,13 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
if( !CV_IS_MAT(objectPoints) || !CV_IS_MAT(r_vec) ||
!CV_IS_MAT(t_vec) || !CV_IS_MAT(A) ||
/*!CV_IS_MAT(distCoeffs) ||*/ !CV_IS_MAT(imagePoints) )
CV_Error( CV_StsBadArg, "One of required arguments is not a valid matrix" );
CV_Error( cv::Error::StsBadArg, "One of required arguments is not a valid matrix" );
int total = objectPoints->rows * objectPoints->cols * CV_MAT_CN(objectPoints->type);
if(total % 3 != 0)
{
//we have stopped support of homogeneous coordinates because it cause ambiguity in interpretation of the input data
CV_Error( CV_StsBadArg, "Homogeneous coordinates are not supported" );
CV_Error( cv::Error::StsBadArg, "Homogeneous coordinates are not supported" );
}
count = total / 3;
@ -576,7 +576,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
{
// matM = cvCreateMat( 1, count, CV_64FC3 );
// cvConvertPointsHomogeneous( objectPoints, matM );
CV_Error( CV_StsBadArg, "Homogeneous coordinates are not supported" );
CV_Error( cv::Error::StsBadArg, "Homogeneous coordinates are not supported" );
}
if( CV_IS_CONT_MAT(imagePoints->type) &&
@ -591,7 +591,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
else
{
// _m = cvCreateMat( 1, count, CV_64FC2 );
CV_Error( CV_StsBadArg, "Homogeneous coordinates are not supported" );
CV_Error( cv::Error::StsBadArg, "Homogeneous coordinates are not supported" );
}
M = (CvPoint3D64f*)matM->data.db;
@ -601,7 +601,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
(((r_vec->rows != 1 && r_vec->cols != 1) ||
r_vec->rows*r_vec->cols*CV_MAT_CN(r_vec->type) != 3) &&
((r_vec->rows != 3 && r_vec->cols != 3) || CV_MAT_CN(r_vec->type) != 1)))
CV_Error( CV_StsBadArg, "Rotation must be represented by 1x3 or 3x1 "
CV_Error( cv::Error::StsBadArg, "Rotation must be represented by 1x3 or 3x1 "
"floating-point rotation vector, or 3x3 rotation matrix" );
if( r_vec->rows == 3 && r_vec->cols == 3 )
@ -621,7 +621,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
if( (CV_MAT_DEPTH(t_vec->type) != CV_64F && CV_MAT_DEPTH(t_vec->type) != CV_32F) ||
(t_vec->rows != 1 && t_vec->cols != 1) ||
t_vec->rows*t_vec->cols*CV_MAT_CN(t_vec->type) != 3 )
CV_Error( CV_StsBadArg,
CV_Error( cv::Error::StsBadArg,
"Translation vector must be 1x3 or 3x1 floating-point vector" );
_t = cvMat( t_vec->rows, t_vec->cols, CV_MAKETYPE(CV_64F,CV_MAT_CN(t_vec->type)), t );
@ -629,7 +629,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
if( (CV_MAT_TYPE(A->type) != CV_64FC1 && CV_MAT_TYPE(A->type) != CV_32FC1) ||
A->rows != 3 || A->cols != 3 )
CV_Error( CV_StsBadArg, "Intrinsic parameters must be 3x3 floating-point matrix" );
CV_Error( cv::Error::StsBadArg, "Intrinsic parameters must be 3x3 floating-point matrix" );
cvConvert( A, &_a );
fx = a[0]; fy = a[4];
@ -649,7 +649,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
distCoeffs->rows*distCoeffs->cols*CV_MAT_CN(distCoeffs->type) != 8 &&
distCoeffs->rows*distCoeffs->cols*CV_MAT_CN(distCoeffs->type) != 12 &&
distCoeffs->rows*distCoeffs->cols*CV_MAT_CN(distCoeffs->type) != 14) )
CV_Error( CV_StsBadArg, cvDistCoeffErr );
CV_Error( cv::Error::StsBadArg, cvDistCoeffErr );
_k = cvMat( distCoeffs->rows, distCoeffs->cols,
CV_MAKETYPE(CV_64F,CV_MAT_CN(distCoeffs->type)), k );
@ -667,7 +667,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
(CV_MAT_TYPE(dpdr->type) != CV_32FC1 &&
CV_MAT_TYPE(dpdr->type) != CV_64FC1) ||
dpdr->rows != count*2 || dpdr->cols != 3 )
CV_Error( CV_StsBadArg, "dp/drot must be 2Nx3 floating-point matrix" );
CV_Error( cv::Error::StsBadArg, "dp/drot must be 2Nx3 floating-point matrix" );
if( CV_MAT_TYPE(dpdr->type) == CV_64FC1 )
{
@ -685,7 +685,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
(CV_MAT_TYPE(dpdt->type) != CV_32FC1 &&
CV_MAT_TYPE(dpdt->type) != CV_64FC1) ||
dpdt->rows != count*2 || dpdt->cols != 3 )
CV_Error( CV_StsBadArg, "dp/dT must be 2Nx3 floating-point matrix" );
CV_Error( cv::Error::StsBadArg, "dp/dT must be 2Nx3 floating-point matrix" );
if( CV_MAT_TYPE(dpdt->type) == CV_64FC1 )
{
@ -702,7 +702,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
if( !CV_IS_MAT(dpdf) ||
(CV_MAT_TYPE(dpdf->type) != CV_32FC1 && CV_MAT_TYPE(dpdf->type) != CV_64FC1) ||
dpdf->rows != count*2 || dpdf->cols != 2 )
CV_Error( CV_StsBadArg, "dp/df must be 2Nx2 floating-point matrix" );
CV_Error( cv::Error::StsBadArg, "dp/df must be 2Nx2 floating-point matrix" );
if( CV_MAT_TYPE(dpdf->type) == CV_64FC1 )
{
@ -719,7 +719,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
if( !CV_IS_MAT(dpdc) ||
(CV_MAT_TYPE(dpdc->type) != CV_32FC1 && CV_MAT_TYPE(dpdc->type) != CV_64FC1) ||
dpdc->rows != count*2 || dpdc->cols != 2 )
CV_Error( CV_StsBadArg, "dp/dc must be 2Nx2 floating-point matrix" );
CV_Error( cv::Error::StsBadArg, "dp/dc must be 2Nx2 floating-point matrix" );
if( CV_MAT_TYPE(dpdc->type) == CV_64FC1 )
{
@ -736,10 +736,10 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
if( !CV_IS_MAT(dpdk) ||
(CV_MAT_TYPE(dpdk->type) != CV_32FC1 && CV_MAT_TYPE(dpdk->type) != CV_64FC1) ||
dpdk->rows != count*2 || (dpdk->cols != 14 && dpdk->cols != 12 && dpdk->cols != 8 && dpdk->cols != 5 && dpdk->cols != 4 && dpdk->cols != 2) )
CV_Error( CV_StsBadArg, "dp/df must be 2Nx14, 2Nx12, 2Nx8, 2Nx5, 2Nx4 or 2Nx2 floating-point matrix" );
CV_Error( cv::Error::StsBadArg, "dp/df must be 2Nx14, 2Nx12, 2Nx8, 2Nx5, 2Nx4 or 2Nx2 floating-point matrix" );
if( !distCoeffs )
CV_Error( CV_StsNullPtr, "distCoeffs is NULL while dpdk is not" );
CV_Error( cv::Error::StsNullPtr, "distCoeffs is NULL while dpdk is not" );
if( CV_MAT_TYPE(dpdk->type) == CV_64FC1 )
{
@ -756,7 +756,7 @@ static void cvProjectPoints2Internal( const CvMat* objectPoints,
if( !CV_IS_MAT( dpdo ) || ( CV_MAT_TYPE( dpdo->type ) != CV_32FC1
&& CV_MAT_TYPE( dpdo->type ) != CV_64FC1 )
|| dpdo->rows != count * 2 || dpdo->cols != count * 3 )
CV_Error( CV_StsBadArg, "dp/do must be 2Nx3N floating-point matrix" );
CV_Error( cv::Error::StsBadArg, "dp/do must be 2Nx3N floating-point matrix" );
if( CV_MAT_TYPE( dpdo->type ) == CV_64FC1 )
{
@ -1283,10 +1283,10 @@ CV_IMPL void cvInitIntrinsicParams2D( const CvMat* objectPoints,
CV_MAT_TYPE(objectPoints->type) != CV_64FC3) ||
(CV_MAT_TYPE(imagePoints->type) != CV_32FC2 &&
CV_MAT_TYPE(imagePoints->type) != CV_64FC2) )
CV_Error( CV_StsUnsupportedFormat, "Both object points and image points must be 2D" );
CV_Error( cv::Error::StsUnsupportedFormat, "Both object points and image points must be 2D" );
if( objectPoints->rows != 1 || imagePoints->rows != 1 )
CV_Error( CV_StsBadSize, "object points and image points must be a single-row matrices" );
CV_Error( cv::Error::StsBadSize, "object points and image points must be a single-row matrices" );
matA.reset(cvCreateMat( 2*nimages, 2, CV_64F ));
_b.reset(cvCreateMat( 2*nimages, 1, CV_64F ));
@ -1395,27 +1395,27 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
// 0. check the parameters & allocate buffers
if( !CV_IS_MAT(objectPoints) || !CV_IS_MAT(imagePoints) ||
!CV_IS_MAT(npoints) || !CV_IS_MAT(cameraMatrix) || !CV_IS_MAT(distCoeffs) )
CV_Error( CV_StsBadArg, "One of required vector arguments is not a valid matrix" );
CV_Error( cv::Error::StsBadArg, "One of required vector arguments is not a valid matrix" );
if( imageSize.width <= 0 || imageSize.height <= 0 )
CV_Error( CV_StsOutOfRange, "image width and height must be positive" );
CV_Error( cv::Error::StsOutOfRange, "image width and height must be positive" );
if( CV_MAT_TYPE(npoints->type) != CV_32SC1 ||
(npoints->rows != 1 && npoints->cols != 1) )
CV_Error( CV_StsUnsupportedFormat,
CV_Error( cv::Error::StsUnsupportedFormat,
"the array of point counters must be 1-dimensional integer vector" );
if(flags & CALIB_TILTED_MODEL)
{
//when the tilted sensor model is used the distortion coefficients matrix must have 14 parameters
if (distCoeffs->cols*distCoeffs->rows != 14)
CV_Error( CV_StsBadArg, "The tilted sensor model must have 14 parameters in the distortion matrix" );
CV_Error( cv::Error::StsBadArg, "The tilted sensor model must have 14 parameters in the distortion matrix" );
}
else
{
//when the thin prism model is used the distortion coefficients matrix must have 12 parameters
if(flags & CALIB_THIN_PRISM_MODEL)
if (distCoeffs->cols*distCoeffs->rows != 12)
CV_Error( CV_StsBadArg, "Thin prism model must have 12 parameters in the distortion matrix" );
CV_Error( cv::Error::StsBadArg, "Thin prism model must have 12 parameters in the distortion matrix" );
}
nimages = npoints->rows*npoints->cols;
@ -1428,7 +1428,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
(CV_MAT_DEPTH(rvecs->type) != CV_32F && CV_MAT_DEPTH(rvecs->type) != CV_64F) ||
((rvecs->rows != nimages || (rvecs->cols*cn != 3 && rvecs->cols*cn != 9)) &&
(rvecs->rows != 1 || rvecs->cols != nimages || cn != 3)) )
CV_Error( CV_StsBadArg, "the output array of rotation vectors must be 3-channel "
CV_Error( cv::Error::StsBadArg, "the output array of rotation vectors must be 3-channel "
"1xn or nx1 array or 1-channel nx3 or nx9 array, where n is the number of views" );
}
@ -1439,7 +1439,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
(CV_MAT_DEPTH(tvecs->type) != CV_32F && CV_MAT_DEPTH(tvecs->type) != CV_64F) ||
((tvecs->rows != nimages || tvecs->cols*cn != 3) &&
(tvecs->rows != 1 || tvecs->cols != nimages || cn != 3)) )
CV_Error( CV_StsBadArg, "the output array of translation vectors must be 3-channel "
CV_Error( cv::Error::StsBadArg, "the output array of translation vectors must be 3-channel "
"1xn or nx1 array or 1-channel nx3 array, where n is the number of views" );
}
@ -1454,7 +1454,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
(stdDevs->rows != 1 || stdDevs->cols != (nimages*6 + NINTRINSIC) || cn != 1)) )
#define STR__(x) #x
#define STR_(x) STR__(x)
CV_Error( CV_StsBadArg, "the output array of standard deviations vectors must be 1-channel "
CV_Error( cv::Error::StsBadArg, "the output array of standard deviations vectors must be 1-channel "
"1x(n*6 + NINTRINSIC) or (n*6 + NINTRINSIC)x1 array, where n is the number of views,"
" NINTRINSIC = " STR_(CV_CALIB_NINTRINSIC));
}
@ -1462,7 +1462,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
if( (CV_MAT_TYPE(cameraMatrix->type) != CV_32FC1 &&
CV_MAT_TYPE(cameraMatrix->type) != CV_64FC1) ||
cameraMatrix->rows != 3 || cameraMatrix->cols != 3 )
CV_Error( CV_StsBadArg,
CV_Error( cv::Error::StsBadArg,
"Intrinsic parameters must be 3x3 floating-point matrix" );
if( (CV_MAT_TYPE(distCoeffs->type) != CV_32FC1 &&
@ -1473,14 +1473,14 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
distCoeffs->cols*distCoeffs->rows != 8 &&
distCoeffs->cols*distCoeffs->rows != 12 &&
distCoeffs->cols*distCoeffs->rows != 14) )
CV_Error( CV_StsBadArg, cvDistCoeffErr );
CV_Error( cv::Error::StsBadArg, cvDistCoeffErr );
for( i = 0; i < nimages; i++ )
{
ni = npoints->data.i[i*npstep];
if( ni < 4 )
{
CV_Error_( CV_StsOutOfRange, ("The number of points in the view #%d is < 4", i));
CV_Error_( cv::Error::StsOutOfRange, ("The number of points in the view #%d is < 4", i));
}
maxPoints = MAX( maxPoints, ni );
total += ni;
@ -1493,7 +1493,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
(CV_MAT_DEPTH(newObjPoints->type) != CV_32F && CV_MAT_DEPTH(newObjPoints->type) != CV_64F) ||
((newObjPoints->rows != maxPoints || newObjPoints->cols*cn != 3) &&
(newObjPoints->rows != 1 || newObjPoints->cols != maxPoints || cn != 3)) )
CV_Error( CV_StsBadArg, "the output array of refined object points must be 3-channel "
CV_Error( cv::Error::StsBadArg, "the output array of refined object points must be 3-channel "
"1xn or nx1 array or 1-channel nx3 array, where n is the number of object points per view" );
}
@ -1504,7 +1504,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
(CV_MAT_DEPTH(stdDevs->type) != CV_32F && CV_MAT_DEPTH(stdDevs->type) != CV_64F) ||
((stdDevs->rows != (nimages*6 + NINTRINSIC + maxPoints*3) || stdDevs->cols*cn != 1) &&
(stdDevs->rows != 1 || stdDevs->cols != (nimages*6 + NINTRINSIC + maxPoints*3) || cn != 1)) )
CV_Error( CV_StsBadArg, "the output array of standard deviations vectors must be 1-channel "
CV_Error( cv::Error::StsBadArg, "the output array of standard deviations vectors must be 1-channel "
"1x(n*6 + NINTRINSIC + m*3) or (n*6 + NINTRINSIC + m*3)x1 array, where n is the number of views,"
" NINTRINSIC = " STR_(CV_CALIB_NINTRINSIC) ", m is the number of object points per view");
}
@ -1544,15 +1544,15 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
{
cvConvert( cameraMatrix, &matA );
if( A(0, 0) <= 0 || A(1, 1) <= 0 )
CV_Error( CV_StsOutOfRange, "Focal length (fx and fy) must be positive" );
CV_Error( cv::Error::StsOutOfRange, "Focal length (fx and fy) must be positive" );
if( A(0, 2) < 0 || A(0, 2) >= imageSize.width ||
A(1, 2) < 0 || A(1, 2) >= imageSize.height )
CV_Error( CV_StsOutOfRange, "Principal point must be within the image" );
CV_Error( cv::Error::StsOutOfRange, "Principal point must be within the image" );
if( fabs(A(0, 1)) > 1e-5 )
CV_Error( CV_StsOutOfRange, "Non-zero skew is not supported by the function" );
CV_Error( cv::Error::StsOutOfRange, "Non-zero skew is not supported by the function" );
if( fabs(A(1, 0)) > 1e-5 || fabs(A(2, 0)) > 1e-5 ||
fabs(A(2, 1)) > 1e-5 || fabs(A(2,2)-1) > 1e-5 )
CV_Error( CV_StsOutOfRange,
CV_Error( cv::Error::StsOutOfRange,
"The intrinsic matrix must have [fx 0 cx; 0 fy cy; 0 0 1] shape" );
A(0, 1) = A(1, 0) = A(2, 0) = A(2, 1) = 0.;
A(2, 2) = 1.;
@ -1562,7 +1562,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
aspectRatio = A(0, 0)/A(1, 1);
if( aspectRatio < minValidAspectRatio || aspectRatio > maxValidAspectRatio )
CV_Error( CV_StsOutOfRange,
CV_Error( cv::Error::StsOutOfRange,
"The specified aspect ratio (= cameraMatrix[0][0] / cameraMatrix[1][1]) is incorrect" );
}
cvConvert( distCoeffs, &_k );
@ -1572,7 +1572,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
Scalar mean, sdv;
meanStdDev(matM, mean, sdv);
if( fabs(mean[2]) > 1e-5 || fabs(sdv[2]) > 1e-5 )
CV_Error( CV_StsBadArg,
CV_Error( cv::Error::StsBadArg,
"For non-planar calibration rigs the initial intrinsic matrix must be specified" );
for( i = 0; i < total; i++ )
matM.at<Point3d>(i).z = 0.;
@ -1582,7 +1582,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
aspectRatio = cvmGet(cameraMatrix,0,0);
aspectRatio /= cvmGet(cameraMatrix,1,1);
if( aspectRatio < minValidAspectRatio || aspectRatio > maxValidAspectRatio )
CV_Error( CV_StsOutOfRange,
CV_Error( cv::Error::StsOutOfRange,
"The specified aspect ratio (= cameraMatrix[0][0] / cameraMatrix[1][1]) is incorrect" );
}
CvMat _matM = cvMat(matM), m = cvMat(_m);
@ -1673,7 +1673,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
Mat mask = cvarrToMat(solver.mask);
int nparams_nz = countNonZero(mask);
if (nparams_nz >= 2 * total)
CV_Error_(CV_StsBadArg,
CV_Error_(cv::Error::StsBadArg,
("There should be less vars to optimize (having %d) than the number of residuals (%d = 2 per point)", nparams_nz, 2 * total));
// 2. initialize extrinsic parameters
@ -1889,10 +1889,10 @@ CV_IMPL double cvCalibrateCamera4( const CvMat* objectPoints,
CvMat* rvecs, CvMat* tvecs, CvMat* newObjPoints, int flags, CvTermCriteria termCrit )
{
if( !CV_IS_MAT(npoints) )
CV_Error( CV_StsBadArg, "npoints is not a valid matrix" );
CV_Error( cv::Error::StsBadArg, "npoints is not a valid matrix" );
if( CV_MAT_TYPE(npoints->type) != CV_32SC1 ||
(npoints->rows != 1 && npoints->cols != 1) )
CV_Error( CV_StsUnsupportedFormat,
CV_Error( cv::Error::StsUnsupportedFormat,
"the array of point counters must be 1-dimensional integer vector" );
bool releaseObject = iFixedPoint > 0 && iFixedPoint < npoints->data.i[0] - 1;
@ -1903,7 +1903,7 @@ CV_IMPL double cvCalibrateCamera4( const CvMat* objectPoints,
if( releaseObject )
{
if( !CV_IS_MAT(objectPoints) )
CV_Error( CV_StsBadArg, "objectPoints is not a valid matrix" );
CV_Error( cv::Error::StsBadArg, "objectPoints is not a valid matrix" );
Mat matM;
if(CV_MAT_CN(objectPoints->type) == 3) {
matM = cvarrToMat(objectPoints);
@ -1917,14 +1917,14 @@ CV_IMPL double cvCalibrateCamera4( const CvMat* objectPoints,
{
if( npoints->data.i[i * npstep] != ni )
{
CV_Error( CV_StsBadArg, "All objectPoints[i].size() should be equal when "
CV_Error( cv::Error::StsBadArg, "All objectPoints[i].size() should be equal when "
"object-releasing method is requested." );
}
Mat ocmp = matM.colRange(ni * i, ni * i + ni) != matM.colRange(0, ni);
ocmp = ocmp.reshape(1);
if( countNonZero(ocmp) )
{
CV_Error( CV_StsBadArg, "All objectPoints[i] should be identical when object-releasing"
CV_Error( cv::Error::StsBadArg, "All objectPoints[i] should be identical when object-releasing"
" method is requested." );
}
}
@ -1941,10 +1941,10 @@ void cvCalibrationMatrixValues( const CvMat *calibMatr, CvSize imgSize,
{
/* Validate parameters. */
if(calibMatr == 0)
CV_Error(CV_StsNullPtr, "Some of parameters is a NULL pointer!");
CV_Error(cv::Error::StsNullPtr, "Some of parameters is a NULL pointer!");
if(!CV_IS_MAT(calibMatr))
CV_Error(CV_StsUnsupportedFormat, "Input parameters must be matrices!");
CV_Error(cv::Error::StsUnsupportedFormat, "Input parameters must be matrices!");
double dummy = .0;
Point2d pp;
@ -2023,7 +2023,7 @@ static double cvStereoCalibrateImpl( const CvMat* _objectPoints, const CvMat* _i
(CV_MAT_DEPTH(rvecs->type) != CV_32F && CV_MAT_DEPTH(rvecs->type) != CV_64F) ||
((rvecs->rows != nimages || (rvecs->cols*cn != 3 && rvecs->cols*cn != 9)) &&
(rvecs->rows != 1 || rvecs->cols != nimages || cn != 3)) )
CV_Error( CV_StsBadArg, "the output array of rotation vectors must be 3-channel "
CV_Error( cv::Error::StsBadArg, "the output array of rotation vectors must be 3-channel "
"1xn or nx1 array or 1-channel nx3 or nx9 array, where n is the number of views" );
}
@ -2034,7 +2034,7 @@ static double cvStereoCalibrateImpl( const CvMat* _objectPoints, const CvMat* _i
(CV_MAT_DEPTH(tvecs->type) != CV_32F && CV_MAT_DEPTH(tvecs->type) != CV_64F) ||
((tvecs->rows != nimages || tvecs->cols*cn != 3) &&
(tvecs->rows != 1 || tvecs->cols != nimages || cn != 3)) )
CV_Error( CV_StsBadArg, "the output array of translation vectors must be 3-channel "
CV_Error( cv::Error::StsBadArg, "the output array of translation vectors must be 3-channel "
"1xn or nx1 array or 1-channel nx3 array, where n is the number of views" );
}
@ -3344,19 +3344,19 @@ cvDecomposeProjectionMatrix( const CvMat *projMatr, CvMat *calibMatr,
/* Validate parameters. */
if(projMatr == 0 || calibMatr == 0 || rotMatr == 0 || posVect == 0)
CV_Error(CV_StsNullPtr, "Some of parameters is a NULL pointer!");
CV_Error(cv::Error::StsNullPtr, "Some of parameters is a NULL pointer!");
if(!CV_IS_MAT(projMatr) || !CV_IS_MAT(calibMatr) || !CV_IS_MAT(rotMatr) || !CV_IS_MAT(posVect))
CV_Error(CV_StsUnsupportedFormat, "Input parameters must be matrices!");
CV_Error(cv::Error::StsUnsupportedFormat, "Input parameters must be matrices!");
if(projMatr->cols != 4 || projMatr->rows != 3)
CV_Error(CV_StsUnmatchedSizes, "Size of projection matrix must be 3x4!");
CV_Error(cv::Error::StsUnmatchedSizes, "Size of projection matrix must be 3x4!");
if(calibMatr->cols != 3 || calibMatr->rows != 3 || rotMatr->cols != 3 || rotMatr->rows != 3)
CV_Error(CV_StsUnmatchedSizes, "Size of calibration and rotation matrices must be 3x3!");
CV_Error(cv::Error::StsUnmatchedSizes, "Size of calibration and rotation matrices must be 3x3!");
if(posVect->cols != 1 || posVect->rows != 4)
CV_Error(CV_StsUnmatchedSizes, "Size of position vector must be 4x1!");
CV_Error(cv::Error::StsUnmatchedSizes, "Size of position vector must be 4x1!");
/* Compute position vector. */
cvSetZero(&tmpProjMatr); // Add zero row to make matrix square.
@ -3402,17 +3402,17 @@ static void collectCalibrationData( InputArrayOfArrays objectPoints,
{
Mat objectPoint = objectPoints.getMat(i);
if (objectPoint.empty())
CV_Error(CV_StsBadSize, "objectPoints should not contain empty vector of vectors of points");
CV_Error(cv::Error::StsBadSize, "objectPoints should not contain empty vector of vectors of points");
int numberOfObjectPoints = objectPoint.checkVector(3, CV_32F);
if (numberOfObjectPoints <= 0)
CV_Error(CV_StsUnsupportedFormat, "objectPoints should contain vector of vectors of points of type Point3f");
CV_Error(cv::Error::StsUnsupportedFormat, "objectPoints should contain vector of vectors of points of type Point3f");
Mat imagePoint1 = imagePoints1.getMat(i);
if (imagePoint1.empty())
CV_Error(CV_StsBadSize, "imagePoints1 should not contain empty vector of vectors of points");
CV_Error(cv::Error::StsBadSize, "imagePoints1 should not contain empty vector of vectors of points");
int numberOfImagePoints = imagePoint1.checkVector(2, CV_32F);
if (numberOfImagePoints <= 0)
CV_Error(CV_StsUnsupportedFormat, "imagePoints1 should contain vector of vectors of points of type Point2f");
CV_Error(cv::Error::StsUnsupportedFormat, "imagePoints1 should contain vector of vectors of points of type Point2f");
CV_CheckEQ(numberOfObjectPoints, numberOfImagePoints, "Number of object and image points must be equal");
total += numberOfObjectPoints;
@ -3467,14 +3467,14 @@ static void collectCalibrationData( InputArrayOfArrays objectPoints,
{
if( npoints.at<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." );
}
Mat ocmp = objPtMat.colRange(ni * i, ni * i + ni) != objPtMat.colRange(0, ni);
ocmp = ocmp.reshape(1);
if( countNonZero(ocmp) )
{
CV_Error( CV_StsBadArg, "All objectPoints[i] should be identical when object-releasing"
CV_Error( cv::Error::StsBadArg, "All objectPoints[i] should be identical when object-releasing"
" method is requested." );
}
}
@ -3884,7 +3884,7 @@ void cv::calibrationMatrixValues( InputArray _cameraMatrix, Size imageSize,
CV_INSTRUMENT_REGION();
if(_cameraMatrix.size() != Size(3, 3))
CV_Error(CV_StsUnmatchedSizes, "Size of cameraMatrix must be 3x3!");
CV_Error(cv::Error::StsUnmatchedSizes, "Size of cameraMatrix must be 3x3!");
Matx33d K = _cameraMatrix.getMat();

View File

@ -1041,7 +1041,7 @@ int solvePnPGeneric( InputArray _opoints, InputArray _ipoints,
vec_tvecs.push_back(tvec);
}*/
else
CV_Error(CV_StsBadArg, "The flags argument must be one of SOLVEPNP_ITERATIVE, SOLVEPNP_P3P, "
CV_Error(cv::Error::StsBadArg, "The flags argument must be one of SOLVEPNP_ITERATIVE, SOLVEPNP_P3P, "
"SOLVEPNP_EPNP, SOLVEPNP_DLS, SOLVEPNP_UPNP, SOLVEPNP_AP3P, SOLVEPNP_IPPE, SOLVEPNP_IPPE_SQUARE or SOLVEPNP_SQPNP");
CV_Assert(vec_rvecs.size() == vec_tvecs.size());

View File

@ -56,30 +56,30 @@ icvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2, CvMat* projPoints1, CvM
if( projMatr1 == 0 || projMatr2 == 0 ||
projPoints1 == 0 || projPoints2 == 0 ||
points4D == 0)
CV_Error( CV_StsNullPtr, "Some of parameters is a NULL pointer" );
CV_Error( cv::Error::StsNullPtr, "Some of parameters is a NULL pointer" );
if( !CV_IS_MAT(projMatr1) || !CV_IS_MAT(projMatr2) ||
!CV_IS_MAT(projPoints1) || !CV_IS_MAT(projPoints2) ||
!CV_IS_MAT(points4D) )
CV_Error( CV_StsUnsupportedFormat, "Input parameters must be matrices" );
CV_Error( cv::Error::StsUnsupportedFormat, "Input parameters must be matrices" );
int numPoints = projPoints1->cols;
if( numPoints < 1 )
CV_Error( CV_StsOutOfRange, "Number of points must be more than zero" );
CV_Error( cv::Error::StsOutOfRange, "Number of points must be more than zero" );
if( projPoints2->cols != numPoints || points4D->cols != numPoints )
CV_Error( CV_StsUnmatchedSizes, "Number of points must be the same" );
CV_Error( cv::Error::StsUnmatchedSizes, "Number of points must be the same" );
if( projPoints1->rows != 2 || projPoints2->rows != 2)
CV_Error( CV_StsUnmatchedSizes, "Number of proj points coordinates must be == 2" );
CV_Error( cv::Error::StsUnmatchedSizes, "Number of proj points coordinates must be == 2" );
if( points4D->rows != 4 )
CV_Error( CV_StsUnmatchedSizes, "Number of world points coordinates must be == 4" );
CV_Error( cv::Error::StsUnmatchedSizes, "Number of world points coordinates must be == 4" );
if( projMatr1->cols != 4 || projMatr1->rows != 3 ||
projMatr2->cols != 4 || projMatr2->rows != 3)
CV_Error( CV_StsUnmatchedSizes, "Size of projection matrices must be 3x4" );
CV_Error( cv::Error::StsUnmatchedSizes, "Size of projection matrices must be 3x4" );
// preallocate SVD matrices on stack
cv::Matx<double, 4, 4> matrA;
@ -147,30 +147,30 @@ icvCorrectMatches(CvMat *F_, CvMat *points1_, CvMat *points2_, CvMat *new_points
cv::Ptr<CvMat> F;
if (!CV_IS_MAT(F_) || !CV_IS_MAT(points1_) || !CV_IS_MAT(points2_) )
CV_Error( CV_StsUnsupportedFormat, "Input parameters must be matrices" );
CV_Error( cv::Error::StsUnsupportedFormat, "Input parameters must be matrices" );
if (!( F_->cols == 3 && F_->rows == 3))
CV_Error( CV_StsUnmatchedSizes, "The fundamental matrix must be a 3x3 matrix");
CV_Error( cv::Error::StsUnmatchedSizes, "The fundamental matrix must be a 3x3 matrix");
if (!(((F_->type & CV_MAT_TYPE_MASK) >> 3) == 0 ))
CV_Error( CV_StsUnsupportedFormat, "The fundamental matrix must be a single-channel matrix" );
CV_Error( cv::Error::StsUnsupportedFormat, "The fundamental matrix must be a single-channel matrix" );
if (!(points1_->rows == 1 && points2_->rows == 1 && points1_->cols == points2_->cols))
CV_Error( CV_StsUnmatchedSizes, "The point-matrices must have one row, and an equal number of columns" );
CV_Error( cv::Error::StsUnmatchedSizes, "The point-matrices must have one row, and an equal number of columns" );
if (((points1_->type & CV_MAT_TYPE_MASK) >> 3) != 1 )
CV_Error( CV_StsUnmatchedSizes, "The first set of points must contain two channels; one for x and one for y" );
CV_Error( cv::Error::StsUnmatchedSizes, "The first set of points must contain two channels; one for x and one for y" );
if (((points2_->type & CV_MAT_TYPE_MASK) >> 3) != 1 )
CV_Error( CV_StsUnmatchedSizes, "The second set of points must contain two channels; one for x and one for y" );
CV_Error( cv::Error::StsUnmatchedSizes, "The second set of points must contain two channels; one for x and one for y" );
if (new_points1 != NULL) {
CV_Assert(CV_IS_MAT(new_points1));
if (new_points1->cols != points1_->cols || new_points1->rows != 1)
CV_Error( CV_StsUnmatchedSizes, "The first output matrix must have the same dimensions as the input matrices" );
CV_Error( cv::Error::StsUnmatchedSizes, "The first output matrix must have the same dimensions as the input matrices" );
if (CV_MAT_CN(new_points1->type) != 2)
CV_Error( CV_StsUnsupportedFormat, "The first output matrix must have two channels; one for x and one for y" );
CV_Error( cv::Error::StsUnsupportedFormat, "The first output matrix must have two channels; one for x and one for y" );
}
if (new_points2 != NULL) {
CV_Assert(CV_IS_MAT(new_points2));
if (new_points2->cols != points2_->cols || new_points2->rows != 1)
CV_Error( CV_StsUnmatchedSizes, "The second output matrix must have the same dimensions as the input matrices" );
CV_Error( cv::Error::StsUnmatchedSizes, "The second output matrix must have the same dimensions as the input matrices" );
if (CV_MAT_CN(new_points2->type) != 2)
CV_Error( CV_StsUnsupportedFormat, "The second output matrix must have two channels; one for x and one for y" );
CV_Error( cv::Error::StsUnsupportedFormat, "The second output matrix must have two channels; one for x and one for y" );
}
// Make sure F uses double precision

View File

@ -149,49 +149,49 @@ void CV_CameraCalibrationBadArgTest::run( int /* start_from */ )
caller.initArgs();
caller.objPts_arg = noArray();
errors += run_test_case( CV_StsBadArg, "None passed in objPts", caller);
errors += run_test_case( cv::Error::StsBadArg, "None passed in objPts", caller);
caller.initArgs();
caller.imgPts_arg = noArray();
errors += run_test_case( CV_StsBadArg, "None passed in imgPts", caller );
errors += run_test_case( cv::Error::StsBadArg, "None passed in imgPts", caller );
caller.initArgs();
caller.cameraMatrix_arg = noArray();
errors += run_test_case( CV_StsBadArg, "Zero passed in cameraMatrix", caller );
errors += run_test_case( cv::Error::StsBadArg, "Zero passed in cameraMatrix", caller );
caller.initArgs();
caller.distCoeffs_arg = noArray();
errors += run_test_case( CV_StsBadArg, "Zero passed in distCoeffs", caller );
errors += run_test_case( cv::Error::StsBadArg, "Zero passed in distCoeffs", caller );
caller.initArgs();
caller.imageSize.width = -1;
errors += run_test_case( CV_StsOutOfRange, "Bad image width", caller );
errors += run_test_case( cv::Error::StsOutOfRange, "Bad image width", caller );
caller.initArgs();
caller.imageSize.height = -1;
errors += run_test_case( CV_StsOutOfRange, "Bad image height", caller );
errors += run_test_case( cv::Error::StsOutOfRange, "Bad image height", caller );
caller.initArgs();
caller.imgPts[0].clear();
errors += run_test_case( CV_StsBadSize, "Bad imgpts[0]", caller );
errors += run_test_case( cv::Error::StsBadSize, "Bad imgpts[0]", caller );
caller.imgPts[0] = caller.imgPts[1];
caller.initArgs();
caller.objPts[1].clear();
errors += run_test_case( CV_StsBadSize, "Bad objpts[1]", caller );
errors += run_test_case( cv::Error::StsBadSize, "Bad objpts[1]", caller );
caller.objPts[1] = caller.objPts[0];
caller.initArgs();
Mat badCM = Mat::zeros(4, 4, CV_64F);
caller.cameraMatrix_arg = badCM;
caller.flags = CALIB_USE_INTRINSIC_GUESS;
errors += run_test_case( CV_StsBadArg, "Bad camearaMatrix header", caller );
errors += run_test_case( cv::Error::StsBadArg, "Bad camearaMatrix header", caller );
caller.initArgs();
Mat badDC = Mat::zeros(10, 10, CV_64F);
caller.distCoeffs_arg = badDC;
caller.flags = CALIB_USE_INTRINSIC_GUESS;
errors += run_test_case( CV_StsBadArg, "Bad camearaMatrix header", caller );
errors += run_test_case( cv::Error::StsBadArg, "Bad camearaMatrix header", caller );
if (errors)
ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
@ -244,15 +244,15 @@ protected:
caller.initArgs();
caller.src_arg = noArray();
errors += run_test_case( CV_StsBadArg, "Src is empty matrix", caller );
errors += run_test_case( cv::Error::StsBadArg, "Src is empty matrix", caller );
caller.initArgs();
caller.src = Mat::zeros(3, 1, CV_8U);
errors += run_test_case( CV_StsUnsupportedFormat, "Bad src formart", caller );
errors += run_test_case( cv::Error::StsUnsupportedFormat, "Bad src formart", caller );
caller.initArgs();
caller.src = Mat::zeros(1, 1, CV_32F);
errors += run_test_case( CV_StsBadSize, "Bad src size", caller );
errors += run_test_case( cv::Error::StsBadSize, "Bad src size", caller );
if (errors)
ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
@ -331,57 +331,57 @@ protected:
caller.initArgs();
caller.objectPoints_arg = noArray();
errors += run_test_case( CV_StsBadArg, "Zero objectPoints", caller );
errors += run_test_case( cv::Error::StsBadArg, "Zero objectPoints", caller );
caller.initArgs();
caller.rvec_arg = noArray();
errors += run_test_case( CV_StsBadArg, "Zero r_vec", caller );
errors += run_test_case( cv::Error::StsBadArg, "Zero r_vec", caller );
caller.initArgs();
caller.tvec_arg = noArray();
errors += run_test_case( CV_StsBadArg, "Zero t_vec", caller );
errors += run_test_case( cv::Error::StsBadArg, "Zero t_vec", caller );
caller.initArgs();
caller.A_arg = noArray();
errors += run_test_case( CV_StsBadArg, "Zero camMat", caller );
errors += run_test_case( cv::Error::StsBadArg, "Zero camMat", caller );
caller.initArgs();
caller.imagePoints_arg = noArray();
errors += run_test_case( CV_StsBadArg, "Zero imagePoints", caller );
errors += run_test_case( cv::Error::StsBadArg, "Zero imagePoints", caller );
Mat save_rvec = caller.r_vec;
caller.initArgs();
caller.r_vec.create(2, 2, CV_32F);
errors += run_test_case( CV_StsBadArg, "Bad rvec format", caller );
errors += run_test_case( cv::Error::StsBadArg, "Bad rvec format", caller );
caller.initArgs();
caller.r_vec.create(1, 3, CV_8U);
errors += run_test_case( CV_StsBadArg, "Bad rvec format", caller );
errors += run_test_case( cv::Error::StsBadArg, "Bad rvec format", caller );
caller.r_vec = save_rvec;
/****************************/
Mat save_tvec = caller.t_vec;
caller.initArgs();
caller.t_vec.create(3, 3, CV_32F);
errors += run_test_case( CV_StsBadArg, "Bad tvec format", caller );
errors += run_test_case( cv::Error::StsBadArg, "Bad tvec format", caller );
caller.initArgs();
caller.t_vec.create(1, 3, CV_8U);
errors += run_test_case( CV_StsBadArg, "Bad tvec format", caller );
errors += run_test_case( cv::Error::StsBadArg, "Bad tvec format", caller );
caller.t_vec = save_tvec;
/****************************/
Mat save_A = caller.A;
caller.initArgs();
caller.A.create(2, 2, CV_32F);
errors += run_test_case( CV_StsBadArg, "Bad A format", caller );
errors += run_test_case( cv::Error::StsBadArg, "Bad A format", caller );
caller.A = save_A;
/****************************/
Mat save_DC = caller.distCoeffs;
caller.initArgs();
caller.distCoeffs.create(3, 3, CV_32F);
errors += run_test_case( CV_StsBadArg, "Bad distCoeffs format", caller );
errors += run_test_case( cv::Error::StsBadArg, "Bad distCoeffs format", caller );
caller.distCoeffs = save_DC;
if (errors)

View File

@ -106,15 +106,15 @@ void CV_UndistortPointsBadArgTest::run(int)
src_points = cv::cvarrToMat(&_src_points_orig);
src_points.create(2, 2, CV_32FC2);
errcount += run_test_case( CV_StsAssert, "Invalid input data matrix size" );
errcount += run_test_case( cv::Error::StsAssert, "Invalid input data matrix size" );
src_points = cv::cvarrToMat(&_src_points_orig);
src_points.create(1, 4, CV_64FC2);
errcount += run_test_case( CV_StsAssert, "Invalid input data matrix type" );
errcount += run_test_case( cv::Error::StsAssert, "Invalid input data matrix type" );
src_points = cv::cvarrToMat(&_src_points_orig);
src_points = cv::Mat();
errcount += run_test_case( CV_StsBadArg, "Input data matrix is not continuous" );
errcount += run_test_case( cv::Error::StsBadArg, "Input data matrix is not continuous" );
src_points = cv::cvarrToMat(&_src_points_orig);
//------------
@ -181,19 +181,19 @@ void CV_InitUndistortRectifyMapBadArgTest::run(int)
mapy = cv::cvarrToMat(&_mapy_orig);
mat_type = CV_64F;
errcount += run_test_case( CV_StsAssert, "Invalid map matrix type" );
errcount += run_test_case( cv::Error::StsAssert, "Invalid map matrix type" );
mat_type = mat_type_orig;
camera_mat.create(3, 2, CV_32F);
errcount += run_test_case( CV_StsAssert, "Invalid camera data matrix size" );
errcount += run_test_case( cv::Error::StsAssert, "Invalid camera data matrix size" );
camera_mat = cv::cvarrToMat(&_camera_mat_orig);
R.create(4, 3, CV_32F);
errcount += run_test_case( CV_StsAssert, "Invalid R data matrix size" );
errcount += run_test_case( cv::Error::StsAssert, "Invalid R data matrix size" );
R = cv::cvarrToMat(&_R_orig);
distortion_coeffs.create(6, 1, CV_32F);
errcount += run_test_case( CV_StsAssert, "Invalid distortion coefficients data matrix size" );
errcount += run_test_case( cv::Error::StsAssert, "Invalid distortion coefficients data matrix size" );
distortion_coeffs = cv::cvarrToMat(&_distortion_coeffs_orig);
//------------
@ -256,7 +256,7 @@ void CV_UndistortBadArgTest::run(int)
dst = cv::cvarrToMat(&_dst_orig);
camera_mat.create(5, 5, CV_64F);
errcount += run_test_case( CV_StsAssert, "Invalid camera data matrix size" );
errcount += run_test_case( cv::Error::StsAssert, "Invalid camera data matrix size" );
//------------
ts->set_failed_test_info(errcount > 0 ? cvtest::TS::FAIL_BAD_ARG_CHECK : cvtest::TS::OK);

View File

@ -70,7 +70,7 @@ namespace cv {
static void* OutOfMemoryError(size_t size)
{
CV_Error_(CV_StsNoMem, ("Failed to allocate %llu bytes", (unsigned long long)size));
CV_Error_(cv::Error::StsNoMem, ("Failed to allocate %llu bytes", (unsigned long long)size));
}
CV_EXPORTS cv::utils::AllocatorStatisticsInterface& getAllocatorStatistics();

View File

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

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 )
CV_Error_(CV_StsUnsupportedFormat,
CV_Error_(cv::Error::StsUnsupportedFormat,
("The combination of type=%d, dtype=%d and normType=%d is not supported",
type, dtype, normType));

View File

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

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);
break;
default:
CV_Error(CV_StsUnsupportedFormat,"");
CV_Error(cv::Error::StsUnsupportedFormat,"");
}
}
@ -788,7 +788,7 @@ int cv::borderInterpolate( int p, int len, int borderType )
else if( borderType == BORDER_CONSTANT )
p = -1;
else
CV_Error( CV_StsBadArg, "Unknown/unsupported border type" );
CV_Error( cv::Error::StsBadArg, "Unknown/unsupported border type" );
return p;
}

View File

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

View File

@ -3469,7 +3469,7 @@ Ptr<DFT2D> DFT2D::create(int width, int height, int depth,
{
if(width == 1 && nonzero_rows > 0 )
{
CV_Error( CV_StsNotImplemented,
CV_Error( cv::Error::StsNotImplemented,
"This mode (using nonzero_rows with a single-column matrix) breaks the function's logic, so it is prohibited.\n"
"For fast convolution/correlation use 2-column matrix or single-row matrix instead" );
}
@ -4317,7 +4317,7 @@ public:
if( len != prev_len )
{
if( len > 1 && (len & 1) )
CV_Error( CV_StsNotImplemented, "Odd-size DCT\'s are not implemented" );
CV_Error( cv::Error::StsNotImplemented, "Odd-size DCT\'s are not implemented" );
opt.nf = DFTFactorize( len, opt.factors );
bool inplace_transform = opt.factors[0] == opt.factors[opt.nf-1];

View File

@ -276,7 +276,7 @@ static void glob_rec(const cv::String& directory, const cv::String& wildchart, s
}
else
{
CV_Error_(CV_StsObjectNotFound, ("could not open directory: %s", directory.c_str()));
CV_Error_(cv::Error::StsObjectNotFound, ("could not open directory: %s", directory.c_str()));
}
}
#endif // OPENCV_HAVE_FILESYSTEM_SUPPORT

View File

@ -1191,7 +1191,7 @@ bool solve( InputArray _src, InputArray _src2arg, OutputArray _dst, int method )
Mat dst = _dst.getMat();
if( m < n )
CV_Error(CV_StsBadArg, "The function can not solve under-determined linear systems" );
CV_Error(cv::Error::StsBadArg, "The function can not solve under-determined linear systems" );
if( m == n )
is_normal = false;
@ -1515,7 +1515,7 @@ void SVD::backSubst( InputArray _w, InputArray _u, InputArray _vt,
vt.ptr<double>(), vt.step, true, rhs.ptr<double>(), rhs.step, nb,
dst.ptr<double>(), dst.step, buffer.data());
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;
value_str << src(cv::Range(badPt.y, badPt.y + 1), cv::Range(badPt.x, badPt.x + 1));
CV_Error_( CV_StsOutOfRange,
CV_Error_( cv::Error::StsOutOfRange,
("the value at (%d, %d)=%s is out of range [%f, %f)", badPt.x, badPt.y, value_str.c_str(), minVal, maxVal));
}
return false;

View File

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

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;
uint64 total1 = (uint64)total*s;
if( (uint64)total1 != (size_t)total1 )
CV_Error( CV_StsOutOfRange, "The total matrix size does not fit to \"size_t\" type" );
CV_Error( cv::Error::StsOutOfRange, "The total matrix size does not fit to \"size_t\" type" );
total = (size_t)total1;
}
}
@ -1072,9 +1072,9 @@ void Mat::push_back(const Mat& elems)
bool eq = size == elems.size;
size.p[0] = int(r);
if( !eq )
CV_Error(CV_StsUnmatchedSizes, "Pushed vector length is not equal to matrix row length");
CV_Error(cv::Error::StsUnmatchedSizes, "Pushed vector length is not equal to matrix row length");
if( type() != elems.type() )
CV_Error(CV_StsUnmatchedFormats, "Pushed vector type is not the same as matrix type");
CV_Error(cv::Error::StsUnmatchedFormats, "Pushed vector type is not the same as matrix type");
if( isSubmatrix() || dataend + step.p[0]*delta > datalimit )
reserve( std::max(r + delta, (r*3+1)/2) );
@ -1170,16 +1170,16 @@ Mat Mat::reshape(int new_cn, int new_rows) const
{
int total_size = total_width * rows;
if( !isContinuous() )
CV_Error( CV_BadStep,
CV_Error( cv::Error::BadStep,
"The matrix is not continuous, thus its number of rows can not be changed" );
if( (unsigned)new_rows > (unsigned)total_size )
CV_Error( CV_StsOutOfRange, "Bad new number of rows" );
CV_Error( cv::Error::StsOutOfRange, "Bad new number of rows" );
total_width = total_size / new_rows;
if( total_width * new_rows != total_size )
CV_Error( CV_StsBadArg, "The total number of matrix elements "
CV_Error( cv::Error::StsBadArg, "The total number of matrix elements "
"is not divisible by the new number of rows" );
hdr.rows = new_rows;
@ -1189,7 +1189,7 @@ Mat Mat::reshape(int new_cn, int new_rows) const
int new_width = total_width / new_cn;
if( new_width * new_cn != total_width )
CV_Error( CV_BadNumChannels,
CV_Error( cv::Error::BadNumChannels,
"The total width is not divisible by the new number of channels" );
hdr.cols = new_width;
@ -1231,13 +1231,13 @@ Mat Mat::reshape(int _cn, int _newndims, const int* _newsz) const
else if (i < dims)
newsz_buf[i] = this->size[i];
else
CV_Error(CV_StsOutOfRange, "Copy dimension (which has zero size) is not present in source matrix");
CV_Error(cv::Error::StsOutOfRange, "Copy dimension (which has zero size) is not present in source matrix");
total_elem1 *= (size_t)newsz_buf[i];
}
if (total_elem1 != total_elem1_ref)
CV_Error(CV_StsUnmatchedSizes, "Requested and source matrices have different count of elements");
CV_Error(cv::Error::StsUnmatchedSizes, "Requested and source matrices have different count of elements");
Mat hdr = *this;
hdr.flags = (hdr.flags & ~CV_MAT_CN_MASK) | ((_cn-1) << CV_CN_SHIFT);
@ -1246,7 +1246,7 @@ Mat Mat::reshape(int _cn, int _newndims, const int* _newsz) const
return hdr;
}
CV_Error(CV_StsNotImplemented, "Reshaping of n-dimensional non-continuous matrices is not supported yet");
CV_Error(cv::Error::StsNotImplemented, "Reshaping of n-dimensional non-continuous matrices is not supported yet");
// TBD
}

View File

@ -163,7 +163,7 @@ Mat cvarrToMat(const CvArr* arr, bool copyData,
{
const IplImage* iplimg = (const IplImage*)arr;
if( coiMode == 0 && iplimg->roi && iplimg->roi->coi > 0 )
CV_Error(CV_BadCOI, "COI is not supported by the function");
CV_Error(cv::Error::BadCOI, "COI is not supported by the function");
return iplImageToMat(iplimg, copyData);
}
if( CV_IS_SEQ(arr) )
@ -187,7 +187,7 @@ Mat cvarrToMat(const CvArr* arr, bool copyData,
cvCvtSeqToArray(seq, buf.ptr(), CV_WHOLE_SEQ);
return buf;
}
CV_Error(CV_StsBadArg, "Unknown array type");
CV_Error(cv::Error::StsBadArg, "Unknown array type");
}
void extractImageCOI(const CvArr* arr, OutputArray _ch, int coi)
@ -269,14 +269,14 @@ cvReduce( const CvArr* srcarr, CvArr* dstarr, int dim, int op )
dim = src.rows > dst.rows ? 0 : src.cols > dst.cols ? 1 : dst.cols == 1;
if( dim > 1 )
CV_Error( CV_StsOutOfRange, "The reduced dimensionality index is out of range" );
CV_Error( cv::Error::StsOutOfRange, "The reduced dimensionality index is out of range" );
if( (dim == 0 && (dst.cols != src.cols || dst.rows != 1)) ||
(dim == 1 && (dst.rows != src.rows || dst.cols != 1)) )
CV_Error( CV_StsBadSize, "The output array size is incorrect" );
CV_Error( cv::Error::StsBadSize, "The output array size is incorrect" );
if( src.channels() != dst.channels() )
CV_Error( CV_StsUnmatchedFormats, "Input and output arrays must have the same number of channels" );
CV_Error( cv::Error::StsUnmatchedFormats, "Input and output arrays must have the same number of channels" );
cv::reduce(src, dst, dim, op, dst.type());
}
@ -333,7 +333,7 @@ cvRange( CvArr* arr, double start, double end )
fdata[j] = (float)val;
}
else
CV_Error( CV_StsUnsupportedFormat, "The function only supports 32sC1 and 32fC1 datatypes" );
CV_Error( cv::Error::StsUnsupportedFormat, "The function only supports 32sC1 and 32fC1 datatypes" );
return arr;
}

View File

@ -21,7 +21,7 @@ static void checkOperandsExist(const Mat& a)
{
if (a.empty())
{
CV_Error(CV_StsBadArg, "Matrix operand is an empty matrix.");
CV_Error(cv::Error::StsBadArg, "Matrix operand is an empty matrix.");
}
}
@ -29,7 +29,7 @@ static void checkOperandsExist(const Mat& a, const Mat& b)
{
if (a.empty() || b.empty())
{
CV_Error(CV_StsBadArg, "One or more matrix operands are empty.");
CV_Error(cv::Error::StsBadArg, "One or more matrix operands are empty.");
}
}
@ -1456,7 +1456,7 @@ void MatOp_Bin::assign(const MatExpr& e, Mat& m, int _type) const
else if( e.flags == 'a' && !e.b.data )
cv::absdiff(e.a, e.s, dst);
else
CV_Error(CV_StsError, "Unknown operation");
CV_Error(cv::Error::StsError, "Unknown operation");
if( dst.data != m.data )
dst.convertTo(m, _type);
@ -1691,7 +1691,7 @@ void MatOp_Initializer::assign(const MatExpr& e, Mat& m, int _type) const
else if( e.flags == '1' )
m = Scalar(e.alpha);
else
CV_Error(CV_StsError, "Invalid matrix initializer type");
CV_Error(cv::Error::StsError, "Invalid matrix initializer type");
}
void MatOp_Initializer::multiply(const MatExpr& e, double s, MatExpr& res) const

View File

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

View File

@ -758,7 +758,7 @@ double norm( const SparseMat& src, int normType )
}
}
else
CV_Error( CV_StsUnsupportedFormat, "Only 32f and 64f are supported" );
CV_Error( cv::Error::StsUnsupportedFormat, "Only 32f and 64f are supported" );
if( normType == NORM_L2 )
result = std::sqrt(result);
@ -821,7 +821,7 @@ void minMaxLoc( const SparseMat& src, double* _minval, double* _maxval, int* _mi
*_maxval = maxval;
}
else
CV_Error( CV_StsUnsupportedFormat, "Only 32f and 64f are supported" );
CV_Error( cv::Error::StsUnsupportedFormat, "Only 32f and 64f are supported" );
if( _minidx && minidx )
for( i = 0; i < d; i++ )
@ -843,7 +843,7 @@ void normalize( const SparseMat& src, SparseMat& dst, double a, int norm_type )
scale = scale > DBL_EPSILON ? a/scale : 0.;
}
else
CV_Error( CV_StsBadArg, "Unknown/unsupported norm type" );
CV_Error( cv::Error::StsBadArg, "Unknown/unsupported norm type" );
src.convertTo( dst, -1, scale );
}

View File

@ -948,7 +948,7 @@ bool _InputArray::isContinuous(int i) const
if( k == CUDA_GPU_MAT )
return i < 0 ? ((const cuda::GpuMat*)obj)->isContinuous() : true;
CV_Error(CV_StsNotImplemented, "Unknown/unsupported array type");
CV_Error(cv::Error::StsNotImplemented, "Unknown/unsupported array type");
}
bool _InputArray::isSubmatrix(int i) const
@ -986,7 +986,7 @@ bool _InputArray::isSubmatrix(int i) const
return vv[i].isSubmatrix();
}
CV_Error(CV_StsNotImplemented, "");
CV_Error(cv::Error::StsNotImplemented, "");
}
size_t _InputArray::offset(int i) const
@ -1466,14 +1466,14 @@ void _OutputArray::create(int d, const int* sizes, int mtype, int i,
((std::vector<Vec<int, 128> >*)v)->resize(len);
break;
default:
CV_Error_(CV_StsBadArg, ("Vectors with element size %d are not supported. Please, modify OutputArray::create()\n", esz));
CV_Error_(cv::Error::StsBadArg, ("Vectors with element size %d are not supported. Please, modify OutputArray::create()\n", esz));
}
return;
}
if( k == NONE )
{
CV_Error(CV_StsNullPtr, "create() called for the missing output array" );
CV_Error(cv::Error::StsNullPtr, "create() called for the missing output array" );
}
if( k == STD_VECTOR_MAT )

View File

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

View File

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

View File

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

View File

@ -83,7 +83,7 @@ void KeyPoint::convert(const std::vector<KeyPoint>& keypoints, std::vector<Point
points2f[i] = keypoints[idx].pt;
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);
}
}

View File

@ -539,7 +539,7 @@ void setSize( UMat& m, int _dims, const int* _sz,
m.step.p[i] = total;
int64 total1 = (int64)total*s;
if( (uint64)total1 != (size_t)total1 )
CV_Error( CV_StsOutOfRange, "The total matrix size does not fit to \"size_t\" type" );
CV_Error( cv::Error::StsOutOfRange, "The total matrix size does not fit to \"size_t\" type" );
total = (size_t)total1;
}
}
@ -965,16 +965,16 @@ UMat UMat::reshape(int new_cn, int new_rows) const
{
int total_size = total_width * rows;
if( !isContinuous() )
CV_Error( CV_BadStep,
CV_Error( cv::Error::BadStep,
"The matrix is not continuous, thus its number of rows can not be changed" );
if( (unsigned)new_rows > (unsigned)total_size )
CV_Error( CV_StsOutOfRange, "Bad new number of rows" );
CV_Error( cv::Error::StsOutOfRange, "Bad new number of rows" );
total_width = total_size / new_rows;
if( total_width * new_rows != total_size )
CV_Error( CV_StsBadArg, "The total number of matrix elements "
CV_Error( cv::Error::StsBadArg, "The total number of matrix elements "
"is not divisible by the new number of rows" );
hdr.rows = new_rows;
@ -984,7 +984,7 @@ UMat UMat::reshape(int new_cn, int new_rows) const
int new_width = total_width / new_cn;
if( new_width * new_cn != total_width )
CV_Error( CV_BadNumChannels,
CV_Error( cv::Error::BadNumChannels,
"The total width is not divisible by the new number of channels" );
hdr.cols = new_width;
@ -1050,13 +1050,13 @@ UMat UMat::reshape(int _cn, int _newndims, const int* _newsz) const
else if (i < dims)
newsz_buf[i] = this->size[i];
else
CV_Error(CV_StsOutOfRange, "Copy dimension (which has zero size) is not present in source matrix");
CV_Error(cv::Error::StsOutOfRange, "Copy dimension (which has zero size) is not present in source matrix");
total_elem1 *= (size_t)newsz_buf[i];
}
if (total_elem1 != total_elem1_ref)
CV_Error(CV_StsUnmatchedSizes, "Requested and source matrices have different count of elements");
CV_Error(cv::Error::StsUnmatchedSizes, "Requested and source matrices have different count of elements");
UMat hdr = *this;
hdr.flags = (hdr.flags & ~CV_MAT_CN_MASK) | ((_cn-1) << CV_CN_SHIFT);
@ -1065,7 +1065,7 @@ UMat UMat::reshape(int _cn, int _newndims, const int* _newsz) const
return hdr;
}
CV_Error(CV_StsNotImplemented, "Reshaping of n-dimensional non-continuous matrices is not supported yet");
CV_Error(cv::Error::StsNotImplemented, "Reshaping of n-dimensional non-continuous matrices is not supported yet");
}
Mat UMat::getMat(AccessFlag accessFlags) const

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);
break;
default:
CV_Error(CV_StsUnsupportedFormat, "");
CV_Error(cv::Error::StsUnsupportedFormat, "");
}
}
}
@ -642,7 +642,7 @@ static void inRangeS(const Mat& src, const Scalar& lb, const Scalar& rb, Mat& ds
inRangeS_((const double*)sptr, lbuf.d, rbuf.d, dptr, total, cn);
break;
default:
CV_Error(CV_StsUnsupportedFormat, "");
CV_Error(cv::Error::StsUnsupportedFormat, "");
}
}
}

View File

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

View File

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

View File

@ -438,7 +438,7 @@ void Image2BlobParams::blobRectsToImageRects(const std::vector<Rect> &rBlob, std
}
}
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
if (group != 1)
CV_Error( CV_StsNotImplemented, " Grouped Conv1d or Depth-Wise Conv1d are not supported by "
CV_Error( cv::Error::StsNotImplemented, " Grouped Conv1d or Depth-Wise Conv1d are not supported by "
"TimVX Backend. Please try OpenCV Backend.");
tvConv = graph->CreateOperation<tim::vx::ops::Conv1d>(
tvConvWeightShape[2], tvPadType, (uint32_t)kernel_size[0],

View File

@ -450,7 +450,7 @@ Ptr<FastConv> initFastConv(
}
}
else
CV_Error(CV_StsUnsupportedFormat, "Unknown convolution type.");
CV_Error(cv::Error::StsUnsupportedFormat, "Unknown convolution type.");
// store bias; append some zero's to make sure that
// we can always read MR elements starting from any valid index

View File

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

View File

@ -244,7 +244,7 @@ bool OpConv::computeGroupCount()
group_z_ = 1;
}
else
CV_Error(CV_StsNotImplemented, "shader type is not supported at compute GroupCount.");
CV_Error(cv::Error::StsNotImplemented, "shader type is not supported at compute GroupCount.");
CV_Assert(group_x_ <= MAX_GROUP_COUNT_X);
CV_Assert(group_y_ <= MAX_GROUP_COUNT_Y);

View File

@ -182,7 +182,7 @@ bool OpNary::computeGroupCount()
}
else
{
CV_Error(CV_StsNotImplemented, "shader type is not supported at compute GroupCount.");
CV_Error(cv::Error::StsNotImplemented, "shader type is not supported at compute GroupCount.");
}
CV_Assert(group_x_ <= MAX_GROUP_COUNT_X);

View File

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

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_Error(CV_OpenGlNotSupported, "The library is compiled without OpenGL support");
CV_Error(cv::Error::OpenGlNotSupported, "The library is compiled without OpenGL support");
}
CV_IMPL void cvSetOpenGlContext(const char*)
{
CV_Error(CV_OpenGlNotSupported, "The library is compiled without OpenGL support");
CV_Error(cv::Error::OpenGlNotSupported, "The library is compiled without OpenGL support");
}
CV_IMPL void cvUpdateWindow(const char*)
{
CV_Error(CV_OpenGlNotSupported, "The library is compiled without OpenGL support");
CV_Error(cv::Error::OpenGlNotSupported, "The library is compiled without OpenGL support");
}
#endif // !HAVE_OPENGL
@ -1176,52 +1176,52 @@ static const char* NO_QT_ERR_MSG = "The library is compiled without QT support";
cv::QtFont cv::fontQt(const String&, int, Scalar, int, int, int)
{
CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG);
CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG);
}
void cv::addText( const Mat&, const String&, Point, const QtFont&)
{
CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG);
CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG);
}
void cv::addText(const Mat&, const String&, Point, const String&, int, Scalar, int, int, int)
{
CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG);
CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG);
}
void cv::displayStatusBar(const String&, const String&, int)
{
CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG);
CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG);
}
void cv::displayOverlay(const String&, const String&, int )
{
CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG);
CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG);
}
int cv::startLoop(int (*)(int argc, char *argv[]), int , char**)
{
CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG);
CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG);
}
void cv::stopLoop()
{
CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG);
CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG);
}
void cv::saveWindowParameters(const String&)
{
CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG);
CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG);
}
void cv::loadWindowParameters(const String&)
{
CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG);
CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG);
}
int cv::createButton(const String&, ButtonCallback, void*, int , bool )
{
CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG);
CV_Error(cv::Error::StsNotImplemented, NO_QT_ERR_MSG);
}
#endif

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)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
QMetaObject::invokeMethod(guiMainThread,
"putText",
@ -162,7 +162,7 @@ CV_IMPL void cvAddText(const CvArr* img, const char* text, CvPoint org, CvFont*
double cvGetRatioWindow_QT(const char* name)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
double result = -1;
QMetaObject::invokeMethod(guiMainThread,
@ -176,7 +176,7 @@ double cvGetRatioWindow_QT(const char* name)
double cvGetPropVisible_QT(const char* name) {
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
double result = 0;
@ -193,7 +193,7 @@ void cvSetRatioWindow_QT(const char* name,double prop_value)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
QMetaObject::invokeMethod(guiMainThread,
"setRatioWindow",
@ -205,7 +205,7 @@ void cvSetRatioWindow_QT(const char* name,double prop_value)
double cvGetPropWindow_QT(const char* name)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
double result = -1;
QMetaObject::invokeMethod(guiMainThread,
@ -221,7 +221,7 @@ double cvGetPropWindow_QT(const char* name)
void cvSetPropWindow_QT(const char* name,double prop_value)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
QMetaObject::invokeMethod(guiMainThread,
"setPropWindow",
@ -246,7 +246,7 @@ void setWindowTitle_QT(const String& winname, const String& title)
void cvSetModeWindow_QT(const char* name, double prop_value)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
QMetaObject::invokeMethod(guiMainThread,
"toggleFullScreen",
@ -258,7 +258,7 @@ void cvSetModeWindow_QT(const char* name, double prop_value)
CvRect cvGetWindowRect_QT(const char* name)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
CvRect result = cvRect(-1, -1, -1, -1);
@ -274,7 +274,7 @@ CvRect cvGetWindowRect_QT(const char* name)
double cvGetModeWindow_QT(const char* name)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
double result = -1;
@ -291,7 +291,7 @@ double cvGetModeWindow_QT(const char* name)
CV_IMPL void cvDisplayOverlay(const char* name, const char* text, int delayms)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
QMetaObject::invokeMethod(guiMainThread,
"displayInfo",
@ -305,7 +305,7 @@ CV_IMPL void cvDisplayOverlay(const char* name, const char* text, int delayms)
CV_IMPL void cvSaveWindowParameters(const char* name)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
QMetaObject::invokeMethod(guiMainThread,
"saveWindowParameters",
@ -317,7 +317,7 @@ CV_IMPL void cvSaveWindowParameters(const char* name)
CV_IMPL void cvLoadWindowParameters(const char* name)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
QMetaObject::invokeMethod(guiMainThread,
"loadWindowParameters",
@ -329,7 +329,7 @@ CV_IMPL void cvLoadWindowParameters(const char* name)
CV_IMPL void cvDisplayStatusBar(const char* name, const char* text, int delayms)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
QMetaObject::invokeMethod(guiMainThread,
"displayStatusBar",
@ -492,7 +492,7 @@ static CvTrackbar* icvFindTrackBarByName(const char* name_trackbar, const char*
QPointer<CvWindow> w = icvFindWindowByName(nameWinQt);
if (!w)
CV_Error(CV_StsNullPtr, "NULL window handler");
CV_Error(cv::Error::StsNullPtr, "NULL window handler");
if (w->param_gui_mode == CV_GUI_NORMAL)
return (CvTrackbar*) icvFindBarByName(w->myBarLayout, nameQt, type_CvTrackbar);
@ -575,7 +575,7 @@ CV_IMPL int cvNamedWindow(const char* name, int flags)
CV_IMPL void cvDestroyWindow(const char* name)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
QMetaObject::invokeMethod(guiMainThread,
"destroyWindow",
@ -598,7 +598,7 @@ CV_IMPL void cvDestroyAllWindows()
CV_IMPL void* cvGetWindowHandle(const char* name)
{
if (!name)
CV_Error( CV_StsNullPtr, "NULL name string" );
CV_Error( cv::Error::StsNullPtr, "NULL name string" );
return (void*) icvFindWindowByName(QLatin1String(name));
}
@ -607,7 +607,7 @@ CV_IMPL void* cvGetWindowHandle(const char* name)
CV_IMPL const char* cvGetWindowName(void* window_handle)
{
if( !window_handle )
CV_Error( CV_StsNullPtr, "NULL window handler" );
CV_Error( cv::Error::StsNullPtr, "NULL window handler" );
return ((CvWindow*)window_handle)->objectName().toLatin1().data();
}
@ -616,7 +616,7 @@ CV_IMPL const char* cvGetWindowName(void* window_handle)
CV_IMPL void cvMoveWindow(const char* name, int x, int y)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
QMetaObject::invokeMethod(guiMainThread,
"moveWindow",
autoBlockingConnection(),
@ -628,7 +628,7 @@ CV_IMPL void cvMoveWindow(const char* name, int x, int y)
CV_IMPL void cvResizeWindow(const char* name, int width, int height)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
QMetaObject::invokeMethod(guiMainThread,
"resizeWindow",
autoBlockingConnection(),
@ -641,7 +641,7 @@ CV_IMPL void cvResizeWindow(const char* name, int width, int height)
CV_IMPL int cvCreateTrackbar2(const char* name_bar, const char* window_name, int* val, int count, CvTrackbarCallback2 on_notify, void* userdata)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
QMetaObject::invokeMethod(guiMainThread,
"addSlider2",
@ -666,7 +666,7 @@ CV_IMPL int cvStartWindowThread()
CV_IMPL int cvCreateTrackbar(const char* name_bar, const char* window_name, int* value, int count, CvTrackbarCallback on_change)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
QMetaObject::invokeMethod(guiMainThread,
"addSlider",
@ -684,7 +684,7 @@ CV_IMPL int cvCreateTrackbar(const char* name_bar, const char* window_name, int*
CV_IMPL int cvCreateButton(const char* button_name, CvButtonCallback on_change, void* userdata, int button_type, int initial_button_state)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
if (initial_button_state < 0 || initial_button_state > 1)
return 0;
@ -750,7 +750,7 @@ CV_IMPL void cvSetMouseCallback(const char* window_name, CvMouseCallback on_mous
QPointer<CvWindow> w = icvFindWindowByName(QLatin1String(window_name));
if (!w)
CV_Error(CV_StsNullPtr, "NULL window handler");
CV_Error(cv::Error::StsNullPtr, "NULL window handler");
w->setMouseCallBack(on_mouse, param);
@ -780,7 +780,7 @@ CV_IMPL void cvShowImage(const char* name, const CvArr* arr)
CV_IMPL void cvSetOpenGlDrawCallback(const char* window_name, CvOpenGlDrawCallback callback, void* userdata)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
QMetaObject::invokeMethod(guiMainThread,
"setOpenGlDrawCallback",
@ -794,7 +794,7 @@ CV_IMPL void cvSetOpenGlDrawCallback(const char* window_name, CvOpenGlDrawCallba
CV_IMPL void cvSetOpenGlContext(const char* window_name)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
QMetaObject::invokeMethod(guiMainThread,
"setOpenGlContext",
@ -806,7 +806,7 @@ CV_IMPL void cvSetOpenGlContext(const char* window_name)
CV_IMPL void cvUpdateWindow(const char* window_name)
{
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
CV_Error( cv::Error::StsNullPtr, "NULL guiReceiver (please create a window)" );
QMetaObject::invokeMethod(guiMainThread,
"updateWindow",
@ -1036,7 +1036,7 @@ void GuiReceiver::toggleFullScreen(QString name, double arg2)
void GuiReceiver::createWindow(QString name, int flags)
{
if (!qApp)
CV_Error(CV_StsNullPtr, "NULL session handler" );
CV_Error(cv::Error::StsNullPtr, "NULL session handler" );
// Check the name in the storage
if (icvFindWindowByName(name.toLatin1().data()))
@ -1127,7 +1127,7 @@ void GuiReceiver::destroyWindow(QString name)
void GuiReceiver::destroyAllWindow()
{
if (!qApp)
CV_Error(CV_StsNullPtr, "NULL session handler" );
CV_Error(cv::Error::StsNullPtr, "NULL session handler" );
if (multiThreads)
{
@ -1256,7 +1256,7 @@ void GuiReceiver::addSlider2(QString bar_name, QString window_name, void* value,
return;
if (count <= 0) //count is the max value of the slider, so must be bigger than 0
CV_Error(CV_StsNullPtr, "Max value of the slider must be bigger than 0" );
CV_Error(cv::Error::StsNullPtr, "Max value of the slider must be bigger than 0" );
CvWindow::addSlider2(w, bar_name, (int*)value, count, (CvTrackbarCallback2) on_change, userdata);
}
@ -1286,10 +1286,10 @@ void GuiReceiver::addSlider(QString bar_name, QString window_name, void* value,
return;
if (!value)
CV_Error(CV_StsNullPtr, "NULL value pointer" );
CV_Error(cv::Error::StsNullPtr, "NULL value pointer" );
if (count <= 0) //count is the max value of the slider, so must be bigger than 0
CV_Error(CV_StsNullPtr, "Max value of the slider must be bigger than 0" );
CV_Error(cv::Error::StsNullPtr, "Max value of the slider must be bigger than 0" );
CvWindow::addSlider(w, bar_name, (int*)value, count, (CvTrackbarCallback) on_change);
}
@ -1703,7 +1703,7 @@ CvWindow::CvWindow(QString name, int arg2)
//3: my view
#ifndef HAVE_QT_OPENGL
if (arg2 & CV_WINDOW_OPENGL)
CV_Error( CV_OpenGlNotSupported, "Library was built without OpenGL support" );
CV_Error( cv::Error::OpenGlNotSupported, "Library was built without OpenGL support" );
mode_display = CV_MODE_NORMAL;
#else
mode_display = arg2 & CV_WINDOW_OPENGL ? CV_MODE_OPENGL : CV_MODE_NORMAL;
@ -2662,19 +2662,19 @@ void DefaultViewPort::startDisplayInfo(QString text, int delayms)
void DefaultViewPort::setOpenGlDrawCallback(CvOpenGlDrawCallback /*callback*/, void* /*userdata*/)
{
CV_Error(CV_OpenGlNotSupported, "Window doesn't support OpenGL");
CV_Error(cv::Error::OpenGlNotSupported, "Window doesn't support OpenGL");
}
void DefaultViewPort::makeCurrentOpenGlContext()
{
CV_Error(CV_OpenGlNotSupported, "Window doesn't support OpenGL");
CV_Error(cv::Error::OpenGlNotSupported, "Window doesn't support OpenGL");
}
void DefaultViewPort::updateGl()
{
CV_Error(CV_OpenGlNotSupported, "Window doesn't support OpenGL");
CV_Error(cv::Error::OpenGlNotSupported, "Window doesn't support OpenGL");
}
@ -2777,7 +2777,7 @@ void DefaultViewPort::saveView()
return;
}
CV_Error(CV_StsNullPtr, "file extension not recognized, please choose between JPG, JPEG, BMP or PNG");
CV_Error(cv::Error::StsNullPtr, "file extension not recognized, please choose between JPG, JPEG, BMP or PNG");
}
}

View File

@ -744,7 +744,7 @@ CvRect cvGetWindowRect_GTK(const char* name)
CV_LOCK_MUTEX();
const auto window = icvFindWindowByName(name);
if (!window)
CV_Error( CV_StsNullPtr, "NULL window" );
CV_Error( cv::Error::StsNullPtr, "NULL window" );
return cvRect(getImageRect_(window));
}
@ -786,7 +786,7 @@ double cvGetModeWindow_GTK(const char* name)//YV
CV_LOCK_MUTEX();
const auto window = icvFindWindowByName(name);
if (!window)
CV_Error( CV_StsNullPtr, "NULL window" );
CV_Error( cv::Error::StsNullPtr, "NULL window" );
double result = window->status;
return result;
@ -801,7 +801,7 @@ void cvSetModeWindow_GTK( const char* name, double prop_value)//Yannick Verdie
const auto window = icvFindWindowByName(name);
if (!window)
CV_Error( CV_StsNullPtr, "NULL window" );
CV_Error( cv::Error::StsNullPtr, "NULL window" );
setModeWindow_(window, (int)prop_value);
}
@ -917,11 +917,11 @@ namespace
// Try double-buffered visual
glconfig = gdk_gl_config_new_by_mode((GdkGLConfigMode)(GDK_GL_MODE_RGB | GDK_GL_MODE_DEPTH | GDK_GL_MODE_DOUBLE));
if (!glconfig)
CV_Error( CV_OpenGlApiCallError, "Can't Create A GL Device Context" );
CV_Error( cv::Error::OpenGlApiCallError, "Can't Create A GL Device Context" );
// Set OpenGL-capability to the widget
if (!gtk_widget_set_gl_capability(window->widget, glconfig, NULL, TRUE, GDK_GL_RGBA_TYPE))
CV_Error( CV_OpenGlApiCallError, "Can't Create A GL Device Context" );
CV_Error( cv::Error::OpenGlApiCallError, "Can't Create A GL Device Context" );
window->useGl = true;
}
@ -932,7 +932,7 @@ namespace
GdkGLDrawable* gldrawable = gtk_widget_get_gl_drawable(window->widget);
if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext))
CV_Error( CV_OpenGlApiCallError, "Can't Activate The GL Rendering Context" );
CV_Error( cv::Error::OpenGlApiCallError, "Can't Activate The GL Rendering Context" );
glViewport(0, 0, gtk_widget_get_allocated_width(window->widget), gtk_widget_get_allocated_height(window->widget));
@ -1050,7 +1050,7 @@ static std::shared_ptr<CvWindow> namedWindow_(const std::string& name, int flags
#ifndef HAVE_OPENGL
if (flags & CV_WINDOW_OPENGL)
CV_Error( CV_OpenGlNotSupported, "Library was built without OpenGL support" );
CV_Error( cv::Error::OpenGlNotSupported, "Library was built without OpenGL support" );
#else
if (flags & CV_WINDOW_OPENGL)
createGlContext(window);
@ -1131,16 +1131,16 @@ CV_IMPL void cvSetOpenGlContext(const char* name)
auto window = icvFindWindowByName(name);
if (!window)
CV_Error( CV_StsNullPtr, "NULL window" );
CV_Error( cv::Error::StsNullPtr, "NULL window" );
if (!window->useGl)
CV_Error( CV_OpenGlNotSupported, "Window doesn't support OpenGL" );
CV_Error( cv::Error::OpenGlNotSupported, "Window doesn't support OpenGL" );
glcontext = gtk_widget_get_gl_context(window->widget);
gldrawable = gtk_widget_get_gl_drawable(window->widget);
if (!gdk_gl_drawable_make_current(gldrawable, glcontext))
CV_Error( CV_OpenGlApiCallError, "Can't Activate The GL Rendering Context" );
CV_Error( cv::Error::OpenGlApiCallError, "Can't Activate The GL Rendering Context" );
}
CV_IMPL void cvUpdateWindow(const char* name)
@ -1168,7 +1168,7 @@ CV_IMPL void cvSetOpenGlDrawCallback(const char* name, CvOpenGlDrawCallback call
return;
if (!window->useGl)
CV_Error( CV_OpenGlNotSupported, "Window was created without OpenGL context" );
CV_Error( cv::Error::OpenGlNotSupported, "Window was created without OpenGL context" );
window->glDrawCallback = callback;
window->glDrawData = userdata;
@ -1384,7 +1384,7 @@ icvCreateTrackbar( const char* trackbar_name, const char* window_name,
CV_Assert(trackbar_name && "NULL trackbar name");
if( count <= 0 )
CV_Error( CV_StsOutOfRange, "Bad trackbar maximal value" );
CV_Error( cv::Error::StsOutOfRange, "Bad trackbar maximal value" );
CV_LOCK_MUTEX();
@ -1557,7 +1557,7 @@ CV_IMPL void cvSetTrackbarPos( const char* trackbar_name, const char* window_nam
const auto trackbar = icvFindTrackbarByName(window, trackbar_name);
if (!trackbar)
{
CV_Error( CV_StsNullPtr, "No trackbar found" );
CV_Error( cv::Error::StsNullPtr, "No trackbar found" );
}
return setTrackbarPos_(trackbar, pos);

View File

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

View File

@ -389,9 +389,9 @@ cvApproxChains( CvSeq* src_seq,
CvSeq *dst_seq = 0;
if( !src_seq || !storage )
CV_Error( CV_StsNullPtr, "" );
CV_Error( cv::Error::StsNullPtr, "" );
if( method > cv::CHAIN_APPROX_TC89_KCOS || method <= 0 || minimal_perimeter < 0 )
CV_Error( CV_StsOutOfRange, "" );
CV_Error( cv::Error::StsOutOfRange, "" );
while( src_seq != 0 )
{
@ -410,7 +410,7 @@ cvApproxChains( CvSeq* src_seq,
contour = icvApproximateChainTC89( (CvChain *) src_seq, sizeof( CvContour ), storage, method );
break;
default:
CV_Error( CV_StsOutOfRange, "" );
CV_Error( cv::Error::StsOutOfRange, "" );
}
if( contour->total > 0 )
@ -681,7 +681,7 @@ void cv::approxPolyDP( InputArray _curve, OutputArray _approxCurve,
//from being used.
if (epsilon < 0.0 || !(epsilon < 1e30))
{
CV_Error(CV_StsOutOfRange, "Epsilon not valid.");
CV_Error(cv::Error::StsOutOfRange, "Epsilon not valid.");
}
Mat curve = _curve.getMat();
@ -704,7 +704,7 @@ void cv::approxPolyDP( InputArray _curve, OutputArray _approxCurve,
else if( depth == CV_32F )
nout = approxPolyDP_(curve.ptr<Point2f>(), npoints, (Point2f*)buf, closed, epsilon, _stack);
else
CV_Error( CV_StsUnsupportedFormat, "" );
CV_Error( cv::Error::StsUnsupportedFormat, "" );
Mat(nout, 1, CV_MAKETYPE(depth, 2), buf).copyTo(_approxCurve);
}
@ -728,7 +728,7 @@ cvApproxPoly( const void* array, int header_size,
{
src_seq = (CvSeq*)array;
if( !CV_IS_SEQ_POLYLINE( src_seq ))
CV_Error( CV_StsBadArg, "Unsupported sequence type" );
CV_Error( cv::Error::StsBadArg, "Unsupported sequence type" );
recursive = parameter2;
@ -743,10 +743,10 @@ cvApproxPoly( const void* array, int header_size,
}
if( !storage )
CV_Error( CV_StsNullPtr, "NULL storage pointer " );
CV_Error( cv::Error::StsNullPtr, "NULL storage pointer " );
if( header_size < 0 )
CV_Error( CV_StsOutOfRange, "header_size is negative. "
CV_Error( cv::Error::StsOutOfRange, "header_size is negative. "
"Pass 0 to make the destination header_size == input header_size" );
if( header_size == 0 )
@ -756,12 +756,12 @@ cvApproxPoly( const void* array, int header_size,
{
if( CV_IS_SEQ_CHAIN( src_seq ))
{
CV_Error( CV_StsBadArg, "Input curves are not polygonal. "
CV_Error( cv::Error::StsBadArg, "Input curves are not polygonal. "
"Use cvApproxChains first" );
}
else
{
CV_Error( CV_StsBadArg, "Input curves have unknown type" );
CV_Error( cv::Error::StsBadArg, "Input curves have unknown type" );
}
}
@ -769,10 +769,10 @@ cvApproxPoly( const void* array, int header_size,
header_size = src_seq->header_size;
if( header_size < (int)sizeof(CvContour) )
CV_Error( CV_StsBadSize, "New header size must be non-less than sizeof(CvContour)" );
CV_Error( cv::Error::StsBadSize, "New header size must be non-less than sizeof(CvContour)" );
if( method != CV_POLY_APPROX_DP )
CV_Error( CV_StsOutOfRange, "Unknown approximation method" );
CV_Error( cv::Error::StsOutOfRange, "Unknown approximation method" );
while( src_seq != 0 )
{
@ -782,7 +782,7 @@ cvApproxPoly( const void* array, int header_size,
{
case CV_POLY_APPROX_DP:
if( parameter < 0 )
CV_Error( CV_StsOutOfRange, "Accuracy must be non-negative" );
CV_Error( cv::Error::StsOutOfRange, "Accuracy must be non-negative" );
CV_Assert( CV_SEQ_ELTYPE(src_seq) == CV_32SC2 ||
CV_SEQ_ELTYPE(src_seq) == CV_32FC2 );
@ -804,7 +804,7 @@ cvApproxPoly( const void* array, int header_size,
nout = cv::approxPolyDP_((cv::Point2f*)src, npoints,
(cv::Point2f*)dst, closed, parameter, stack);
else
CV_Error( CV_StsUnsupportedFormat, "" );
CV_Error( cv::Error::StsUnsupportedFormat, "" );
contour = cvCreateSeq( src_seq->flags, header_size,
src_seq->elem_size, storage );
@ -812,7 +812,7 @@ cvApproxPoly( const void* array, int header_size,
}
break;
default:
CV_Error( CV_StsBadArg, "Invalid approximation method" );
CV_Error( cv::Error::StsBadArg, "Invalid approximation method" );
}
CV_Assert( contour );

View File

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

View File

@ -1200,7 +1200,7 @@ Ptr<BaseRowFilter> getRowSumFilter(int srcType, int sumType, int ksize, int anch
if( sdepth == CV_64F && ddepth == CV_64F )
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)",
srcType, sumType));
}
@ -1241,7 +1241,7 @@ Ptr<BaseColumnFilter> getColumnSumFilter(int sumType, int dstType, int ksize, in
if( ddepth == CV_64F && sdepth == CV_64F )
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)",
sumType, dstType));
}
@ -1339,7 +1339,7 @@ Ptr<BaseRowFilter> getSqrRowSumFilter(int srcType, int sumType, int ksize, int a
if( sdepth == CV_64F && ddepth == CV_64F )
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)",
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)))
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)
{

View File

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

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

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 420: cvtPtr = cvtYUV420sp2RGB<2, 0, 4>; break;
case 421: cvtPtr = cvtYUV420sp2RGB<2, 1, 4>; break;
default: CV_Error( CV_StsBadFlag, "Unknown/unsupported color conversion code" ); break;
default: CV_Error( cv::Error::StsBadFlag, "Unknown/unsupported color conversion code" ); break;
};
cvtPtr(dst_data, dst_step, dst_width, dst_height, y_data, y_step, uv_data, uv_step);
@ -2069,7 +2069,7 @@ void cvtThreePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
case 32: cvtPtr = cvtYUV420p2RGB<2, 3>; break;
case 40: cvtPtr = cvtYUV420p2RGB<0, 4>; break;
case 42: cvtPtr = cvtYUV420p2RGB<2, 4>; break;
default: CV_Error( CV_StsBadFlag, "Unknown/unsupported color conversion code" ); break;
default: CV_Error( cv::Error::StsBadFlag, "Unknown/unsupported color conversion code" ); break;
};
cvtPtr(dst_data, dst_step, dst_width, dst_height, src_step, src_data, u, v, ustepIdx, vstepIdx);
@ -2139,7 +2139,7 @@ void cvtOnePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
case 4200: cvtPtr = cvtYUV422toRGB<2,0,0,4>; break;
case 4201: cvtPtr = cvtYUV422toRGB<2,0,1,4>; break;
case 4210: cvtPtr = cvtYUV422toRGB<2,1,0,4>; break;
default: CV_Error( CV_StsBadFlag, "Unknown/unsupported color conversion code" ); break;
default: CV_Error( cv::Error::StsBadFlag, "Unknown/unsupported color conversion code" ); break;
};
cvtPtr(dst_data, dst_step, src_data, src_step, width, height);
@ -2168,7 +2168,7 @@ void cvtOnePlaneBGRtoYUV(const uchar * src_data, size_t src_step,
case 4200: cvtPtr = cvtRGBtoYUV422<2,0,0,4>; break;
case 4201: cvtPtr = cvtRGBtoYUV422<2,0,1,4>; break;
case 4210: cvtPtr = cvtRGBtoYUV422<2,1,0,4>; break;
default: CV_Error( CV_StsBadFlag, "Unknown/unsupported color conversion code" ); break;
default: CV_Error( cv::Error::StsBadFlag, "Unknown/unsupported color conversion code" ); break;
};
cvtPtr(dst_data, dst_step, src_data, src_step, width, height);

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);
}
else{
CV_Error(CV_StsUnsupportedFormat, "the type of labels must be 16u or 32s");
CV_Error(cv::Error::StsUnsupportedFormat, "the type of labels must be 16u or 32s");
}
}
@ -5763,7 +5763,7 @@ int cv::connectedComponentsWithStats(InputArray img_, OutputArray _labels, Outpu
return connectedComponents_sub1(img, labels, connectivity, ccltype, sop);
}
else{
CV_Error(CV_StsUnsupportedFormat, "the type of labels must be 16u or 32s");
CV_Error(cv::Error::StsUnsupportedFormat, "the type of labels must be 16u or 32s");
return 0;
}
}

View File

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

View File

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

View File

@ -1708,7 +1708,7 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn)
else if( depth == CV_16U )
Bayer2Gray_<ushort, SIMDBayerStubInterpolator_<ushort> >(src, dst, code);
else
CV_Error(CV_StsUnsupportedFormat, "Bayer->Gray demosaicing only supports 8u and 16u types");
CV_Error(cv::Error::StsUnsupportedFormat, "Bayer->Gray demosaicing only supports 8u and 16u types");
break;
case COLOR_BayerBG2BGRA: case COLOR_BayerGB2BGRA: case COLOR_BayerRG2BGRA: case COLOR_BayerGR2BGRA:
@ -1735,7 +1735,7 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn)
else if( depth == CV_16U )
Bayer2RGB_<ushort, SIMDBayerStubInterpolator_<ushort> >(src, dst_, code);
else
CV_Error(CV_StsUnsupportedFormat, "Bayer->RGB demosaicing only supports 8u and 16u types");
CV_Error(cv::Error::StsUnsupportedFormat, "Bayer->RGB demosaicing only supports 8u and 16u types");
}
else
{
@ -1758,11 +1758,11 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn)
else if (depth == CV_16U)
Bayer2RGB_EdgeAware_T<ushort, SIMDBayerStubInterpolator_<ushort> >(src, dst, code);
else
CV_Error(CV_StsUnsupportedFormat, "Bayer->RGB Edge-Aware demosaicing only currently supports 8u and 16u types");
CV_Error(cv::Error::StsUnsupportedFormat, "Bayer->RGB Edge-Aware demosaicing only currently supports 8u and 16u types");
break;
default:
CV_Error( CV_StsBadFlag, "Unknown / unsupported color conversion code" );
CV_Error( cv::Error::StsBadFlag, "Unknown / unsupported color conversion code" );
}
}

View File

@ -101,7 +101,7 @@ static void getSobelKernels( OutputArray _kx, OutputArray _ky,
Mat ky = _ky.getMat();
if( _ksize % 2 == 0 || _ksize > 31 )
CV_Error( CV_StsOutOfRange, "The kernel size must be odd and not larger than 31" );
CV_Error( cv::Error::StsOutOfRange, "The kernel size must be odd and not larger than 31" );
std::vector<int> kerI(std::max(ksizeX, ksizeY) + 1);
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;
break;
default:
CV_Error(CV_StsBadArg, "Unknown metric type");
CV_Error(cv::Error::StsBadArg, "Unknown metric type");
}
}
@ -766,7 +766,7 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe
float _mask[5] = {0};
if( maskSize != cv::DIST_MASK_3 && maskSize != cv::DIST_MASK_5 && maskSize != cv::DIST_MASK_PRECISE )
CV_Error( CV_StsBadSize, "Mask size should be 3 or 5 or 0 (precise)" );
CV_Error( cv::Error::StsBadSize, "Mask size should be 3 or 5 or 0 (precise)" );
if ((distType == cv::DIST_C || distType == cv::DIST_L1) && !need_labels)
maskSize = cv::DIST_MASK_3;

View File

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

View File

@ -174,28 +174,28 @@ CV_IMPL float cvCalcEMD2( const CvArr* signature_arr1,
signature2 = cvGetMat( signature2, &sign_stub2 );
if( signature1->cols != signature2->cols )
CV_Error( CV_StsUnmatchedSizes, "The arrays must have equal number of columns (which is number of dimensions but 1)" );
CV_Error( cv::Error::StsUnmatchedSizes, "The arrays must have equal number of columns (which is number of dimensions but 1)" );
dims = signature1->cols - 1;
size1 = signature1->rows;
size2 = signature2->rows;
if( !CV_ARE_TYPES_EQ( signature1, signature2 ))
CV_Error( CV_StsUnmatchedFormats, "The array must have equal types" );
CV_Error( cv::Error::StsUnmatchedFormats, "The array must have equal types" );
if( CV_MAT_TYPE( signature1->type ) != CV_32FC1 )
CV_Error( CV_StsUnsupportedFormat, "The signatures must be 32fC1" );
CV_Error( cv::Error::StsUnsupportedFormat, "The signatures must be 32fC1" );
if( flow )
{
flow = cvGetMat( flow, &flow_stub );
if( flow->rows != size1 || flow->cols != size2 )
CV_Error( CV_StsUnmatchedSizes,
CV_Error( cv::Error::StsUnmatchedSizes,
"The flow matrix size does not match to the signatures' sizes" );
if( CV_MAT_TYPE( flow->type ) != CV_32FC1 )
CV_Error( CV_StsUnsupportedFormat, "The flow matrix must be 32fC1" );
CV_Error( cv::Error::StsUnsupportedFormat, "The flow matrix must be 32fC1" );
}
cost->data.fl = 0;
@ -206,28 +206,28 @@ CV_IMPL float cvCalcEMD2( const CvArr* signature_arr1,
if( cost_matrix )
{
if( dist_func )
CV_Error( CV_StsBadArg,
CV_Error( cv::Error::StsBadArg,
"Only one of cost matrix or distance function should be non-NULL in case of user-defined distance" );
if( lower_bound )
CV_Error( CV_StsBadArg,
CV_Error( cv::Error::StsBadArg,
"The lower boundary can not be calculated if the cost matrix is used" );
cost = cvGetMat( cost_matrix, &cost_stub );
if( cost->rows != size1 || cost->cols != size2 )
CV_Error( CV_StsUnmatchedSizes,
CV_Error( cv::Error::StsUnmatchedSizes,
"The cost matrix size does not match to the signatures' sizes" );
if( CV_MAT_TYPE( cost->type ) != CV_32FC1 )
CV_Error( CV_StsUnsupportedFormat, "The cost matrix must be 32fC1" );
CV_Error( cv::Error::StsUnsupportedFormat, "The cost matrix must be 32fC1" );
}
else if( !dist_func )
CV_Error( CV_StsNullPtr, "In case of user-defined distance Distance function is undefined" );
CV_Error( cv::Error::StsNullPtr, "In case of user-defined distance Distance function is undefined" );
}
else
{
if( dims == 0 )
CV_Error( CV_StsBadSize,
CV_Error( cv::Error::StsBadSize,
"Number of dimensions can be 0 only if a user-defined metric is used" );
user_param = (void *) (size_t)dims;
switch (dist_type)
@ -242,7 +242,7 @@ CV_IMPL float cvCalcEMD2( const CvArr* signature_arr1,
dist_func = icvDistC;
break;
default:
CV_Error( CV_StsBadFlag, "Bad or unsupported metric type" );
CV_Error( cv::Error::StsBadFlag, "Bad or unsupported metric type" );
}
}
@ -279,7 +279,7 @@ CV_IMPL float cvCalcEMD2( const CvArr* signature_arr1,
state.ssize, state.dsize, state.enter_x );
if( min_delta == CV_EMD_INF )
CV_Error( CV_StsNoConv, "" );
CV_Error( cv::Error::StsNoConv, "" );
/* if no negative deltamin, we found the optimal solution */
if( min_delta >= -eps )
@ -287,7 +287,7 @@ CV_IMPL float cvCalcEMD2( const CvArr* signature_arr1,
/* improve solution */
if(!icvNewSolution( &state ))
CV_Error( CV_StsNoConv, "" );
CV_Error( cv::Error::StsNoConv, "" );
}
}
@ -387,7 +387,7 @@ static int icvInitEMD( const float* signature1, int size1,
}
else if( weight < 0 )
CV_Error(CV_StsBadArg, "signature1 must not contain negative weights");
CV_Error(cv::Error::StsBadArg, "signature1 must not contain negative weights");
}
for( i = 0; i < size2; i++ )
@ -401,13 +401,13 @@ static int icvInitEMD( const float* signature1, int size1,
state->idx2[dsize++] = i;
}
else if( weight < 0 )
CV_Error(CV_StsBadArg, "signature2 must not contain negative weights");
CV_Error(cv::Error::StsBadArg, "signature2 must not contain negative weights");
}
if( ssize == 0 )
CV_Error(CV_StsBadArg, "signature1 must contain at least one non-zero value");
CV_Error(cv::Error::StsBadArg, "signature1 must contain at least one non-zero value");
if( dsize == 0 )
CV_Error(CV_StsBadArg, "signature2 must contain at least one non-zero value");
CV_Error(cv::Error::StsBadArg, "signature2 must contain at least one non-zero value");
/* if supply different than the demand, add a zero-cost dummy cluster */
diff = s_sum - d_sum;

View File

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

View File

@ -487,12 +487,12 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask,
if ( (cn != 1) && (cn != 3) )
{
CV_Error( CV_StsBadArg, "Number of channels in input image must be 1 or 3" );
CV_Error( cv::Error::StsBadArg, "Number of channels in input image must be 1 or 3" );
}
const int connectivity = flags & 255;
if( connectivity != 0 && connectivity != 4 && connectivity != 8 )
CV_Error( CV_StsBadFlag, "Connectivity must be 4, 0(=4) or 8" );
CV_Error( cv::Error::StsBadFlag, "Connectivity must be 4, 0(=4) or 8" );
if( _mask.empty() )
{
@ -513,13 +513,13 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask,
for( i = 0; i < cn; i++ )
{
if( loDiff[i] < 0 || upDiff[i] < 0 )
CV_Error( CV_StsBadArg, "lo_diff and up_diff must be non-negative" );
CV_Error( cv::Error::StsBadArg, "lo_diff and up_diff must be non-negative" );
is_simple = is_simple && fabs(loDiff[i]) < DBL_EPSILON && fabs(upDiff[i]) < DBL_EPSILON;
}
if( (unsigned)seedPoint.x >= (unsigned)size.width ||
(unsigned)seedPoint.y >= (unsigned)size.height )
CV_Error( CV_StsOutOfRange, "Seed point is outside of image" );
CV_Error( cv::Error::StsOutOfRange, "Seed point is outside of image" );
scalarToRawData( newVal, &nv_buf, type, 0);
size_t buffer_size = MAX( size.width, size.height ) * 2;
@ -550,7 +550,7 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask,
else if( type == CV_32FC3 )
floodFill_CnIR(img, seedPoint, Vec3f(nv_buf.f), &comp, flags, &buffer);
else
CV_Error( CV_StsUnsupportedFormat, "" );
CV_Error( cv::Error::StsUnsupportedFormat, "" );
if( rect )
*rect = comp.rect;
return comp.area;
@ -583,7 +583,7 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask,
ud_buf.f[i] = (float)upDiff[i];
}
else
CV_Error( CV_StsUnsupportedFormat, "" );
CV_Error( cv::Error::StsUnsupportedFormat, "" );
uchar newMaskVal = (uchar)((flags & 0xff00) == 0 ? 1 : ((flags >> 8) & 255));
@ -618,7 +618,7 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask,
Diff32fC3(ld_buf.f, ud_buf.f),
&comp, flags, &buffer);
else
CV_Error(CV_StsUnsupportedFormat, "");
CV_Error(cv::Error::StsUnsupportedFormat, "");
if( rect )
*rect = comp.rect;

View File

@ -87,7 +87,7 @@ CV_IMPL void
cvBoxPoints( CvBox2D box, CvPoint2D32f pt[4] )
{
if( !pt )
CV_Error( CV_StsNullPtr, "NULL vertex array pointer" );
CV_Error( cv::Error::StsNullPtr, "NULL vertex array pointer" );
cv::RotatedRect(box).points((cv::Point2f*)pt);
}

View File

@ -96,7 +96,7 @@ GMM::GMM( Mat& _model )
_model.setTo(Scalar(0));
}
else if( (_model.type() != CV_64FC1) || (_model.rows != 1) || (_model.cols != modelSize*componentsCount) )
CV_Error( CV_StsBadArg, "_model must have CV_64FC1 type, rows == 1 and cols == 13*componentsCount" );
CV_Error( cv::Error::StsBadArg, "_model must have CV_64FC1 type, rows == 1 and cols == 13*componentsCount" );
model = _model;
@ -329,18 +329,18 @@ static void calcNWeights( const Mat& img, Mat& leftW, Mat& upleftW, Mat& upW, Ma
static void checkMask( const Mat& img, const Mat& mask )
{
if( mask.empty() )
CV_Error( CV_StsBadArg, "mask is empty" );
CV_Error( cv::Error::StsBadArg, "mask is empty" );
if( mask.type() != CV_8UC1 )
CV_Error( CV_StsBadArg, "mask must have CV_8UC1 type" );
CV_Error( cv::Error::StsBadArg, "mask must have CV_8UC1 type" );
if( mask.cols != img.cols || mask.rows != img.rows )
CV_Error( CV_StsBadArg, "mask must have as many rows and cols as img" );
CV_Error( cv::Error::StsBadArg, "mask must have as many rows and cols as img" );
for( int y = 0; y < mask.rows; y++ )
{
for( int x = 0; x < mask.cols; x++ )
{
uchar val = mask.at<uchar>(y,x);
if( val!=GC_BGD && val!=GC_FGD && val!=GC_PR_BGD && val!=GC_PR_FGD )
CV_Error( CV_StsBadArg, "mask element value must be equal "
CV_Error( cv::Error::StsBadArg, "mask element value must be equal "
"GC_BGD or GC_FGD or GC_PR_BGD or GC_PR_FGD" );
}
}
@ -552,9 +552,9 @@ void cv::grabCut( InputArray _img, InputOutputArray _mask, Rect rect,
Mat& fgdModel = _fgdModel.getMatRef();
if( img.empty() )
CV_Error( CV_StsBadArg, "image is empty" );
CV_Error( cv::Error::StsBadArg, "image is empty" );
if( img.type() != CV_8UC3 )
CV_Error( CV_StsBadArg, "image must have CV_8UC3 type" );
CV_Error( cv::Error::StsBadArg, "image must have CV_8UC3 type" );
GMM bgdGMM( bgdModel ), fgdGMM( fgdModel );
Mat compIdxs( img.size(), CV_32SC1 );

View File

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

View File

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

View File

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

View File

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

View File

@ -158,7 +158,7 @@ double cv::matchShapes(InputArray contour1, InputArray contour2, int method, dou
}
break;
default:
CV_Error( CV_StsBadArg, "Unknown comparison method" );
CV_Error( cv::Error::StsBadArg, "Unknown comparison method" );
}
//If anyA and anyB are both true, the result is correct.

View File

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

View File

@ -584,7 +584,7 @@ cv::Moments cv::moments( InputArray _src, bool binary )
return contourMoments(mat);
if( cn > 1 )
CV_Error( CV_StsBadArg, "Invalid image type (must be single-channel)" );
CV_Error( cv::Error::StsBadArg, "Invalid image type (must be single-channel)" );
CV_IPP_RUN(!binary, ipp_moments(mat, m), m);
@ -599,7 +599,7 @@ cv::Moments cv::moments( InputArray _src, bool binary )
else if( depth == CV_64F )
func = momentsInTile<double, double, double>;
else
CV_Error( CV_StsUnsupportedFormat, "" );
CV_Error( cv::Error::StsUnsupportedFormat, "" );
Mat src0(mat);
@ -730,9 +730,9 @@ CV_IMPL double cvGetSpatialMoment( CvMoments * moments, int x_order, int y_order
int order = x_order + y_order;
if( !moments )
CV_Error( CV_StsNullPtr, "" );
CV_Error( cv::Error::StsNullPtr, "" );
if( (x_order | y_order) < 0 || order > 3 )
CV_Error( CV_StsOutOfRange, "" );
CV_Error( cv::Error::StsOutOfRange, "" );
return (&(moments->m00))[order + (order >> 1) + (order > 2) * 2 + y_order];
}
@ -743,9 +743,9 @@ CV_IMPL double cvGetCentralMoment( CvMoments * moments, int x_order, int y_order
int order = x_order + y_order;
if( !moments )
CV_Error( CV_StsNullPtr, "" );
CV_Error( cv::Error::StsNullPtr, "" );
if( (x_order | y_order) < 0 || order > 3 )
CV_Error( CV_StsOutOfRange, "" );
CV_Error( cv::Error::StsOutOfRange, "" );
return order >= 2 ? (&(moments->m00))[4 + order * 3 + y_order] :
order == 0 ? moments->m00 : 0;
@ -768,7 +768,7 @@ CV_IMPL double cvGetNormalizedCentralMoment( CvMoments * moments, int x_order, i
CV_IMPL void cvGetHuMoments( CvMoments * mState, CvHuMoments * HuState )
{
if( !mState || !HuState )
CV_Error( CV_StsNullPtr, "" );
CV_Error( cv::Error::StsNullPtr, "" );
double m00s = mState->inv_sqrt_m00, m00 = m00s * m00s, s2 = m00 * m00, s3 = s2 * m00s;

View File

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

View File

@ -753,7 +753,7 @@ Ptr<BaseRowFilter> getMorphologyRowFilter(int op, int type, int ksize, int ancho
DilateRowVec64f> >(ksize, anchor);
}
CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type));
CV_Error_( cv::Error::StsNotImplemented, ("Unsupported data type (=%d)", type));
}
Ptr<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);
}
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)
@ -838,7 +838,7 @@ Ptr<BaseFilter> getMorphologyFilter(int op, int type, const Mat& kernel, Point a
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

View File

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

View File

@ -1448,7 +1448,7 @@ void cv::pyrDown( InputArray _src, OutputArray _dst, const Size& _dsz, int borde
else if( depth == CV_64F )
func = pyrDown_< FltCast<double, 8> >;
else
CV_Error( CV_StsUnsupportedFormat, "" );
CV_Error( cv::Error::StsUnsupportedFormat, "" );
func( src, dst, borderType );
}
@ -1551,7 +1551,7 @@ void cv::pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz, int borderT
else if( depth == CV_64F )
func = pyrUp_< FltCast<double, 6> >;
else
CV_Error( CV_StsUnsupportedFormat, "" );
CV_Error( cv::Error::StsUnsupportedFormat, "" );
func( src, dst, borderType );
}
@ -1722,7 +1722,7 @@ CV_IMPL void
cvReleasePyramid( CvMat*** _pyramid, int extra_layers )
{
if( !_pyramid )
CV_Error( CV_StsNullPtr, "" );
CV_Error( cv::Error::StsNullPtr, "" );
if( *_pyramid )
for( int i = 0; i <= extra_layers; i++ )
@ -1743,7 +1743,7 @@ cvCreatePyramid( const CvArr* srcarr, int extra_layers, double rate,
CvMat stub, *src = cvGetMat( srcarr, &stub );
if( extra_layers < 0 )
CV_Error( CV_StsOutOfRange, "The number of extra layers must be non negative" );
CV_Error( cv::Error::StsOutOfRange, "The number of extra layers must be non negative" );
int i, layer_step, elem_size = CV_ELEM_SIZE(src->type);
cv::Size layer_size, size = cvGetMatSize(src);
@ -1770,7 +1770,7 @@ cvCreatePyramid( const CvArr* srcarr, int extra_layers, double rate,
}
if( bufsize < 0 )
CV_Error( CV_StsOutOfRange, "The buffer is too small to fit the pyramid" );
CV_Error( cv::Error::StsOutOfRange, "The buffer is too small to fit the pyramid" );
ptr = buf->data.ptr;
}

View File

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

View File

@ -245,7 +245,7 @@ static void rotatingCalipers( const Point2f* points, int n, int mode, float* out
base_b = lead_x;
break;
default:
CV_Error(CV_StsError, "main_element should be 0, 1, 2 or 3");
CV_Error(cv::Error::StsError, "main_element should be 0, 1, 2 or 3");
}
}
/* change base point of main edge */

View File

@ -417,7 +417,7 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center,
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);
else
CV_Error( CV_StsUnsupportedFormat, "Unsupported combination of input and output formats");
CV_Error( cv::Error::StsUnsupportedFormat, "Unsupported combination of input and output formats");
}
@ -473,7 +473,7 @@ cvSampleLine( const void* _img, CvPoint pt1, CvPoint pt2,
size_t pixsize = img.elemSize();
if( !buffer )
CV_Error( CV_StsNullPtr, "" );
CV_Error( cv::Error::StsNullPtr, "" );
for( int i = 0; i < li.count; i++, ++li )
{

View File

@ -348,7 +348,7 @@ void cv::pyrMeanShiftFiltering( InputArray _src, OutputArray _dst,
const int MAX_LEVELS = 8;
if( (unsigned)max_level > (unsigned)MAX_LEVELS )
CV_Error( CV_StsOutOfRange, "The number of pyramid levels is too large or negative" );
CV_Error( cv::Error::StsOutOfRange, "The number of pyramid levels is too large or negative" );
std::vector<cv::Mat> src_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 )
CV_Error( CV_StsUnsupportedFormat, "Only 8-bit, 3-channel images are supported" );
CV_Error( cv::Error::StsUnsupportedFormat, "Only 8-bit, 3-channel images are supported" );
if( src0.type() != dst0.type() )
CV_Error( CV_StsUnmatchedFormats, "The input and output images must have the same type" );
CV_Error( cv::Error::StsUnmatchedFormats, "The input and output images must have the same type" );
if( src0.size() != dst0.size() )
CV_Error( CV_StsUnmatchedSizes, "The input and output images must have the same size" );
CV_Error( cv::Error::StsUnmatchedSizes, "The input and output images must have the same size" );
if( !(termcrit.type & CV_TERMCRIT_ITER) )
termcrit.maxCount = 5;

View File

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

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 );
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. */

View File

@ -282,10 +282,10 @@ int Subdiv2D::locate(Point2f pt, int& _edge, int& _vertex)
int i, maxEdges = (int)(qedges.size() * 4);
if( qedges.size() < (size_t)4 )
CV_Error( CV_StsError, "Subdivision is empty" );
CV_Error( cv::Error::StsError, "Subdivision is empty" );
if( pt.x < topLeft.x || pt.y < topLeft.y || pt.x >= bottomRight.x || pt.y >= bottomRight.y )
CV_Error( CV_StsOutOfRange, "" );
CV_Error( cv::Error::StsOutOfRange, "" );
int edge = recentEdge;
CV_Assert(edge > 0);
@ -417,10 +417,10 @@ int Subdiv2D::insert(Point2f pt)
int location = locate( pt, curr_edge, curr_point );
if( location == PTLOC_ERROR )
CV_Error( CV_StsBadSize, "" );
CV_Error( cv::Error::StsBadSize, "" );
if( location == PTLOC_OUTSIDE_RECT )
CV_Error( CV_StsOutOfRange, "" );
CV_Error( cv::Error::StsOutOfRange, "" );
if( location == PTLOC_VERTEX )
return curr_point;
@ -434,7 +434,7 @@ int Subdiv2D::insert(Point2f pt)
else if( location == PTLOC_INSIDE )
;
else
CV_Error_(CV_StsError, ("Subdiv2D::locate returned invalid location = %d", location) );
CV_Error_(cv::Error::StsError, ("Subdiv2D::locate returned invalid location = %d", location) );
CV_Assert( curr_edge != 0 );
validGeometry = false;

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.height = getOptimalDFTSize(block_size.height + templ_size.height - 1);
if( dft_size.width <= 0 || dft_size.height <= 0 )
CV_Error( CV_StsOutOfRange, "the input arrays are too big" );
CV_Error( cv::Error::StsOutOfRange, "the input arrays are too big" );
// recompute block size
block_size.width = dft_size.width - templ_size.width + 1;
@ -602,7 +602,7 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
dftsize.width = std::max(getOptimalDFTSize(blocksize.width + templ.cols - 1), 2);
dftsize.height = getOptimalDFTSize(blocksize.height + templ.rows - 1);
if( dftsize.width <= 0 || dftsize.height <= 0 )
CV_Error( CV_StsOutOfRange, "the input arrays are too big" );
CV_Error( cv::Error::StsOutOfRange, "the input arrays are too big" );
// recompute block size
blocksize.width = dftsize.width - templ.cols + 1;

View File

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

View File

@ -51,19 +51,19 @@ CV_IMPL CvSeq* cvPointSeqFromMat( int seq_kind, const CvArr* arr,
CvMat* mat = (CvMat*)arr;
if( !CV_IS_MAT( mat ))
CV_Error( CV_StsBadArg, "Input array is not a valid matrix" );
CV_Error( cv::Error::StsBadArg, "Input array is not a valid matrix" );
if( CV_MAT_CN(mat->type) == 1 && mat->width == 2 )
mat = cvReshape(mat, &hdr, 2);
eltype = CV_MAT_TYPE( mat->type );
if( eltype != CV_32SC2 && eltype != CV_32FC2 )
CV_Error( CV_StsUnsupportedFormat,
CV_Error( cv::Error::StsUnsupportedFormat,
"The matrix can not be converted to point sequence because of "
"inappropriate element type" );
if( (mat->width != 1 && mat->height != 1) || !CV_IS_MAT_CONT(mat->type))
CV_Error( CV_StsBadArg,
CV_Error( cv::Error::StsBadArg,
"The matrix converted to point sequence must be "
"1-dimensional and continuous" );

View File

@ -1824,7 +1824,7 @@ void CV_ColorBayerTest::prepare_to_validation( int /*test_case_idx*/ )
else if( depth == CV_16U )
bayer2BGR_<ushort>(src, dst, fwd_code);
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() );
}
else
CV_Error( CV_StsBadArg, "Unknown operation" );
CV_Error( cv::Error::StsBadArg, "Unknown operation" );
}
cvReleaseStructuringElement( &element );

View File

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

View File

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

View File

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

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];
}; break;
default:
CV_Error(CV_StsUnmatchedFormats, "Response should be a 32fC1 or 32sC1 vector.");
CV_Error(cv::Error::StsUnmatchedFormats, "Response should be a 32fC1 or 32sC1 vector.");
}
if (!is_regression)
@ -283,7 +283,7 @@ CvGBTrees::train( const CvMat* _train_data, int _tflag,
sample_idx->data.i[active_samples_count++] = i;
} break;
default: CV_Error(CV_StsUnmatchedFormats, "_sample_idx should be a 32sC1, 8sC1 or 8uC1 vector.");
default: CV_Error(cv::Error::StsUnmatchedFormats, "_sample_idx should be a 32sC1, 8sC1 or 8uC1 vector.");
}
}
else
@ -1072,7 +1072,7 @@ void CvGBTrees::read_params( CvFileStorage* fs, CvFileNode* fnode )
if( params.loss_function_type < SQUARED_LOSS || params.loss_function_type > DEVIANCE_LOSS || params.loss_function_type == 2)
CV_ERROR( CV_StsBadArg, "Unknown loss function" );
CV_ERROR( cv::Error::StsBadArg, "Unknown loss function" );
params.weak_count = cvReadIntByName( fs, fnode, "ensemble_length" );
params.shrinkage = (float)cvReadRealByName( fs, fnode, "shrinkage", 0.1 );
@ -1082,7 +1082,7 @@ void CvGBTrees::read_params( CvFileStorage* fs, CvFileNode* fnode )
{
class_labels = (CvMat*)cvReadByName( fs, fnode, "class_labels" );
if( class_labels && !CV_IS_MAT(class_labels))
CV_ERROR( CV_StsParseError, "class_labels must stored as a matrix");
CV_ERROR( cv::Error::StsParseError, "class_labels must stored as a matrix");
}
data->is_classifier = 0;
@ -1105,7 +1105,7 @@ void CvGBTrees::write( CvFileStorage* fs, const char* name ) const
cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_ML_GBT );
if( !weak )
CV_ERROR( CV_StsBadArg, "The model has not been trained yet" );
CV_ERROR( cv::Error::StsBadArg, "The model has not been trained yet" );
write_params( fs );
cvWriteReal( fs, "base_value", base_value);
@ -1170,13 +1170,13 @@ void CvGBTrees::read( CvFileStorage* fs, CvFileNode* node )
trees_fnode = cvGetFileNodeByName( fs, node, s.c_str() );
if( !trees_fnode || !CV_NODE_IS_SEQ(trees_fnode->tag) )
CV_ERROR( CV_StsParseError, "<trees_x> tag is missing" );
CV_ERROR( cv::Error::StsParseError, "<trees_x> tag is missing" );
cvStartReadSeq( trees_fnode->data.seq, &reader );
ntrees = trees_fnode->data.seq->total;
if( ntrees != params.weak_count )
CV_ERROR( CV_StsUnmatchedSizes,
CV_ERROR( cv::Error::StsUnmatchedSizes,
"The number of trees stored does not match <ntrees> tag value" );
CV_CALL( storage = cvCreateMemStorage() );

View File

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

View File

@ -109,15 +109,15 @@ bool LogisticRegressionImpl::train(const Ptr<TrainData>& trainData, int)
CV_Assert( !_labels_i.empty() && !_data_i.empty());
if(_labels_i.cols != 1)
{
CV_Error( CV_StsBadArg, "labels should be a column matrix" );
CV_Error( cv::Error::StsBadArg, "labels should be a column matrix" );
}
if(_data_i.type() != CV_32FC1 || _labels_i.type() != CV_32FC1)
{
CV_Error( CV_StsBadArg, "data and labels must be a floating point matrix" );
CV_Error( cv::Error::StsBadArg, "data and labels must be a floating point matrix" );
}
if(_labels_i.rows != _data_i.rows)
{
CV_Error( CV_StsBadArg, "number of rows in data and labels should be equal" );
CV_Error( cv::Error::StsBadArg, "number of rows in data and labels should be equal" );
}
// class labels
@ -126,7 +126,7 @@ bool LogisticRegressionImpl::train(const Ptr<TrainData>& trainData, int)
int num_classes = (int) this->forward_mapper.size();
if(num_classes < 2)
{
CV_Error( CV_StsBadArg, "data should have at least 2 classes" );
CV_Error( cv::Error::StsBadArg, "data should have at least 2 classes" );
}
// add a column of ones to the data (bias/intercept term)
@ -174,7 +174,7 @@ bool LogisticRegressionImpl::train(const Ptr<TrainData>& trainData, int)
this->learnt_thetas = thetas.clone();
if( cvIsNaN( (double)sum(this->learnt_thetas)[0] ) )
{
CV_Error( CV_StsBadArg, "check training parameters. Invalid training classifier" );
CV_Error( cv::Error::StsBadArg, "check training parameters. Invalid training classifier" );
}
// success
@ -187,7 +187,7 @@ float LogisticRegressionImpl::predict(InputArray samples, OutputArray results, i
// check if learnt_mats array is populated
if(!this->isTrained())
{
CV_Error( CV_StsBadArg, "classifier should be trained first" );
CV_Error( cv::Error::StsBadArg, "classifier should be trained first" );
}
// coefficient matrix
@ -206,7 +206,7 @@ float LogisticRegressionImpl::predict(InputArray samples, OutputArray results, i
Mat data = samples.getMat();
if(data.type() != CV_32F)
{
CV_Error( CV_StsBadArg, "data must be of floating type" );
CV_Error( cv::Error::StsBadArg, "data must be of floating type" );
}
// add a column of ones to the data (bias/intercept term)
@ -327,7 +327,7 @@ double LogisticRegressionImpl::compute_cost(const Mat& _data, const Mat& _labels
if(cvIsNaN( cost ) == 1)
{
CV_Error( CV_StsBadArg, "check training parameters. Invalid training classifier" );
CV_Error( cv::Error::StsBadArg, "check training parameters. Invalid training classifier" );
}
return cost;
@ -398,12 +398,12 @@ Mat LogisticRegressionImpl::batch_gradient_descent(const Mat& _data, const Mat&
// implements batch gradient descent
if(this->params.alpha<=0)
{
CV_Error( CV_StsBadArg, "check training parameters (learning rate) for the classifier" );
CV_Error( cv::Error::StsBadArg, "check training parameters (learning rate) for the classifier" );
}
if(this->params.num_iters <= 0)
{
CV_Error( CV_StsBadArg, "number of iterations cannot be zero or a negative number" );
CV_Error( cv::Error::StsBadArg, "number of iterations cannot be zero or a negative number" );
}
int llambda = 0;
@ -439,12 +439,12 @@ Mat LogisticRegressionImpl::mini_batch_gradient_descent(const Mat& _data, const
if(this->params.mini_batch_size <= 0 || this->params.alpha == 0)
{
CV_Error( CV_StsBadArg, "check training parameters for the classifier" );
CV_Error( cv::Error::StsBadArg, "check training parameters for the classifier" );
}
if(this->params.num_iters <= 0)
{
CV_Error( CV_StsBadArg, "number of iterations cannot be zero or a negative number" );
CV_Error( cv::Error::StsBadArg, "number of iterations cannot be zero or a negative number" );
}
Mat theta_p = _init_theta.clone();
@ -551,7 +551,7 @@ void LogisticRegressionImpl::write(FileStorage& fs) const
// check if open
if(fs.isOpened() == 0)
{
CV_Error(CV_StsBadArg,"file can't open. Check file path");
CV_Error(cv::Error::StsBadArg,"file can't open. Check file path");
}
writeFormat(fs);
string desc = "Logistic Regression Classifier";
@ -574,7 +574,7 @@ void LogisticRegressionImpl::read(const FileNode& fn)
// check if empty
if(fn.empty())
{
CV_Error( CV_StsBadArg, "empty FileNode object" );
CV_Error( cv::Error::StsBadArg, "empty FileNode object" );
}
this->params.alpha = (double)fn["alpha"];

View File

@ -101,7 +101,7 @@ public:
norm(var_idx, __var_idx, NORM_INF) != 0 ||
cls_labels.size() != __cls_labels.size() ||
norm(cls_labels, __cls_labels, NORM_INF) != 0 )
CV_Error( CV_StsBadArg,
CV_Error( cv::Error::StsBadArg,
"The new training data is inconsistent with the original training data; varIdx and the class labels should be the same" );
}
@ -312,11 +312,11 @@ public:
bool rawOutput = (flags & RAW_OUTPUT) != 0;
if( samples.type() != CV_32F || samples.cols != nallvars )
CV_Error( CV_StsBadArg,
CV_Error( cv::Error::StsBadArg,
"The input samples must be 32f matrix with the number of columns = nallvars" );
if( (samples.rows > 1) && (! _results.needed()) )
CV_Error( CV_StsNullPtr,
CV_Error( cv::Error::StsNullPtr,
"When the number of input samples is >1, the output vector of results must be passed" );
if( _results.needed() )
@ -388,7 +388,7 @@ public:
fn["var_all"] >> nallvars;
if( nallvars <= 0 )
CV_Error( CV_StsParseError,
CV_Error( cv::Error::StsParseError,
"The field \"var_count\" of NBayes classifier is missing or non-positive" );
fn["var_idx"] >> var_idx;
@ -397,7 +397,7 @@ public:
int nclasses = (int)cls_labels.total(), i;
if( cls_labels.empty() || nclasses < 1 )
CV_Error( CV_StsParseError, "No or invalid \"cls_labels\" in NBayes classifier" );
CV_Error( cv::Error::StsParseError, "No or invalid \"cls_labels\" in NBayes classifier" );
FileNodeIterator
count_it = fn["count"].begin(),

View File

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

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