Skip to content

Commit 4d41317

Browse files
committed
C-API cleanup: use error codes enumeration
1 parent 19ae44a commit 4d41317

File tree

8 files changed

+11
-12
lines changed

8 files changed

+11
-12
lines changed

modules/bioinspired/src/retina_ocl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ bool RetinaOCLImpl::convertToColorPlanes(const UMat& input, UMat &output)
390390
}
391391
else
392392
{
393-
CV_Error(-1, "Retina ocl only support 1, 3, 4 channel input");
393+
CV_Error(cv::Error::StsError, "Retina ocl only support 1, 3, 4 channel input");
394394
}
395395
}
396396
void RetinaOCLImpl::convertToInterleaved(const UMat& input, bool colorMode, UMat &output)

modules/bioinspired/src/retinafasttonemapping.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class RetinaFastToneMappingImpl : public RetinaFastToneMapping
107107

108108
// basic error check
109109
if (nbPixels <= 0)
110-
throw cv::Exception(-1, "Bad retina size setup : size height and with must be superior to zero", "RetinaImpl::setup", "retinafasttonemapping.cpp", 0);
110+
CV_Error(cv::Error::StsError, "Bad retina size setup : size height and with must be superior to zero");
111111

112112
// resize buffers
113113
_inputBuffer.resize(nbPixels*3); // buffer supports gray images but also 3 channels color buffers... (larger is better...)
@@ -222,7 +222,7 @@ bool _convertCvMat2ValarrayBuffer(InputArray inputMat, std::valarray<float> &out
222222
const Mat inputMatToConvert=inputMat.getMat();
223223
// first check input consistency
224224
if (inputMatToConvert.empty())
225-
throw cv::Exception(-1, "RetinaImpl cannot be applied, input buffer is empty", "RetinaImpl::run", "RetinaImpl.h", 0);
225+
CV_Error(cv::Error::StsError, "RetinaImpl cannot be applied, input buffer is empty");
226226

227227
// retreive color mode from image input
228228
int imageNumberOfChannels = inputMatToConvert.channels();

modules/bioinspired/src/transientareassegmentationmodule.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,13 +417,13 @@ void TransientAreasSegmentationModuleImpl::run(InputArray inputToProcess, const
417417
errorMsg<<"Input matrix size does not match instance buffers setup !"
418418
<<"\n\t Input size is : "<<inputToSegment.rows*inputToSegment.cols
419419
<<"\n\t v.s. internalBuffer size is : "<< _inputToSegment.size();
420-
throw cv::Exception(-1, errorMsg.str().c_str(), "SegmentationModule::run", "SegmentationModule.cpp", 0);
420+
CV_Error(cv::Error::StsError, errorMsg.str().c_str());
421421
}
422422
if (channelIndex >= inputToSegment.channels())
423423
{
424424
std::stringstream errorMsg;
425425
errorMsg<<"Cannot access channel index "<<channelIndex<<" on the input matrix with channels quantity = "<<inputToSegment.channels();
426-
throw cv::Exception(-1, errorMsg.str().c_str(), "SegmentationModule::run", "SegmentationModule.cpp", 0);
426+
CV_Error(cv::Error::StsError, errorMsg.str().c_str());
427427
}
428428

429429
// create a cv::Mat header for the input valarray
@@ -538,7 +538,7 @@ bool TransientAreasSegmentationModuleImpl::_convertCvMat2ValarrayBuffer(InputArr
538538
const Mat inputMatToConvert=inputMat.getMat();
539539
// first check input consistency
540540
if (inputMatToConvert.empty())
541-
throw cv::Exception(-1, "RetinaImpl cannot be applied, input buffer is empty", "RetinaImpl::run", "RetinaImpl.h", 0);
541+
CV_Error(cv::Error::StsError, "RetinaImpl cannot be applied, input buffer is empty");
542542

543543
// retreive color mode from image input
544544
int imageNumberOfChannels = inputMatToConvert.channels();

modules/ml/src/svm.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,7 @@ ParamGrid SVM::getDefaultGrid( int param_id )
410410
grid.logStep = 7; // total iterations = 3
411411
}
412412
else
413-
cvError( cv::Error::StsBadArg, "SVM::getDefaultGrid", "Invalid type of parameter "
414-
"(use one of SVM::C, SVM::GAMMA et al.)", __FILE__, __LINE__ );
413+
CV_Error(cv::Error::StsBadArg, "Invalid type of parameter: use one of SVM::C, SVM::GAMMA et al.");
415414
return grid;
416415
}
417416

modules/tracking/src/trackerBoostingModel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void TrackerBoostingModel::responseToConfidenceMap( const std::vector<Mat>& resp
9090
{
9191
if( currentSample.empty() )
9292
{
93-
CV_Error( -1, "The samples in Model estimation are empty" );
93+
CV_Error( cv::Error::StsError, "The samples in Model estimation are empty" );
9494
}
9595

9696
for ( size_t i = 0; i < currentSample.size(); i++ )

modules/tracking/src/trackerFeature.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Ptr<TrackerContribFeature> TrackerContribFeature::create( const String& trackerF
8282
return Ptr<TrackerFeatureLBP>( new TrackerFeatureLBP() );
8383
}
8484

85-
CV_Error( -1, "Tracker feature type not supported" );
85+
CV_Error( cv::Error::StsError, "Tracker feature type not supported" );
8686
}
8787

8888
String TrackerContribFeature::getClassName() const

modules/tracking/src/trackerStateEstimator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Ptr<TrackerStateEstimator> TrackerStateEstimator::create( const String& trackeSt
5959
//return Ptr<TrackerStateEstimatorMILBoosting>( new TrackerStateEstimatorMILBoosting() );
6060
}
6161

62-
CV_Error( -1, "Tracker state estimator type not supported" );
62+
CV_Error( cv::Error::StsError, "Tracker state estimator type not supported" );
6363
}
6464

6565

modules/videostab/src/frame_source.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class VideoFileSourceImpl : public IFrameSource
6868
vc.release();
6969
vc.open(path_);
7070
if (!vc.isOpened())
71-
CV_Error(0, "can't open file: " + path_);
71+
CV_Error(cv::Error::StsError, "can't open file: " + path_);
7272
#else
7373
CV_Error(Error::StsNotImplemented, "OpenCV has been compiled without video I/O support");
7474
#endif

0 commit comments

Comments
 (0)