Get rid of exit() calls in algorithms and tests

pull/1243/head
Vladislav Sovrasov 8 years ago
parent 0b4fc0618c
commit 1537cbb9d8
  1. 5
      modules/line_descriptor/include/opencv2/line_descriptor/descriptor.hpp
  2. 24
      modules/plot/src/plot.cpp
  3. 7
      modules/sfm/test/test_common.cpp
  4. 16
      modules/surface_matching/src/ppf_helpers.cpp

@ -747,10 +747,7 @@ class CV_EXPORTS BinaryDescriptor : public Algorithm
/* check parameters */ /* check parameters */
if( n < 0 || k < 0 || k > n || p <= 0.0 || p >= 1.0 ) if( n < 0 || k < 0 || k > n || p <= 0.0 || p >= 1.0 )
{ CV_Error(Error::StsBadArg, "nfa: wrong n, k or p values.\n");
std::cout << "nfa: wrong n, k or p values." << std::endl;
exit( 0 );
}
/* trivial cases */ /* trivial cases */
if( n == 0 || k == 0 ) if( n == 0 || k == 0 )
return -logNT; return -logNT;

@ -62,17 +62,9 @@ namespace cv
Mat _plotData = plotData.getMat(); Mat _plotData = plotData.getMat();
//if the matrix is not Nx1 or 1xN //if the matrix is not Nx1 or 1xN
if(_plotData.cols > 1 && _plotData.rows > 1) if(_plotData.cols > 1 && _plotData.rows > 1)
{ CV_Error(Error::StsBadArg, "ERROR: Plot data must be a 1xN or Nx1 matrix.\n");
std::cout << "ERROR: Plot data must be a 1xN or Nx1 matrix." << std::endl;
exit(0);
}
//if the matrix type is not CV_64F CV_Assert(_plotData.type() == CV_64F);
if(_plotData.type() != CV_64F)
{
std::cout << "ERROR: Plot data type must be double (CV_64F)." << std::endl;
exit(0);
}
//in case we have a row matrix than needs to be transposed //in case we have a row matrix than needs to be transposed
if(_plotData.cols > _plotData.rows) if(_plotData.cols > _plotData.rows)
@ -98,17 +90,9 @@ namespace cv
Mat _plotDataY = plotDataY_.getMat(); Mat _plotDataY = plotDataY_.getMat();
//f the matrix is not Nx1 or 1xN //f the matrix is not Nx1 or 1xN
if((_plotDataX.cols > 1 && _plotDataX.rows > 1) || (_plotDataY.cols > 1 && _plotDataY.rows > 1)) if((_plotDataX.cols > 1 && _plotDataX.rows > 1) || (_plotDataY.cols > 1 && _plotDataY.rows > 1))
{ CV_Error(Error::StsBadArg, "ERROR: Plot data must be a 1xN or Nx1 matrix.\n");
std::cout << "ERROR: Plot data must be a 1xN or Nx1 matrix." << std::endl;
exit(0);
}
//if the matrix type is not CV_64F CV_Assert(_plotDataX.type() == CV_64F && _plotDataY.type() == CV_64F);
if(_plotDataX.type() != CV_64F || _plotDataY.type() != CV_64F)
{
std::cout << "ERROR: Plot data type must be double (CV_64F)." << std::endl;
exit(0);
}
//in case we have a row matrix than needs to be transposed //in case we have a row matrix than needs to be transposed
if(_plotDataX.cols > _plotDataX.rows) if(_plotDataX.cols > _plotDataX.rows)

@ -86,11 +86,8 @@ parser_2D_tracks(const string &_filename, std::vector<Mat> &points2d )
ifstream myfile(_filename.c_str()); ifstream myfile(_filename.c_str());
if (!myfile.is_open()) if (!myfile.is_open())
{ CV_Error(cv::Error::StsError, string("Unable to read file: ") + _filename + "\n");
cout << "Unable to read file: " << _filename << endl; else {
exit(0);
} else {
double x, y; double x, y;
string line_str; string line_str;

@ -114,12 +114,8 @@ void writePLY(Mat PC, const char* FileName)
{ {
std::ofstream outFile( FileName ); std::ofstream outFile( FileName );
if ( !outFile ) if ( !outFile.is_open() )
{ CV_Error(Error::StsError, String("Error opening output file: ") + String(FileName) + "\n");
//cerr << "Error opening output file: " << FileName << "!" << endl;
printf("Error opening output file: %s!\n", FileName);
exit( 1 );
}
//// ////
// Header // Header
@ -167,12 +163,8 @@ void writePLYVisibleNormals(Mat PC, const char* FileName)
{ {
std::ofstream outFile(FileName); std::ofstream outFile(FileName);
if (!outFile) if (!outFile.is_open())
{ CV_Error(Error::StsError, String("Error opening output file: ") + String(FileName) + "\n");
//cerr << "Error opening output file: " << FileName << "!" << endl;
printf("Error opening output file: %s!\n", FileName);
exit(1);
}
//// ////
// Header // Header

Loading…
Cancel
Save