Merge pull request #12878 from tompollok:3.4

pull/13097/head
Alexander Alekhin 7 years ago
commit 8675a8c743
  1. 6
      modules/calib3d/src/calibinit.cpp
  2. 24
      modules/core/src/command_line_parser.cpp
  3. 6
      modules/core/src/glob.cpp
  4. 6
      modules/core/src/lda.cpp
  5. 4
      modules/core/src/lut.cpp
  6. 6
      modules/core/src/matrix.cpp
  7. 4
      modules/core/src/mean.cpp
  8. 4
      modules/core/src/minmax.cpp
  9. 4
      modules/core/src/ocl.cpp
  10. 4
      modules/core/src/persistence_c.cpp
  11. 4
      modules/core/src/persistence_types.cpp
  12. 2
      modules/core/src/system.cpp
  13. 8
      modules/core/src/umatrix.cpp
  14. 4
      modules/features2d/src/fast.cpp
  15. 4
      modules/imgcodecs/src/bitstrm.cpp
  16. 19
      modules/imgcodecs/src/exif.cpp
  17. 12
      modules/imgcodecs/src/grfmt_bmp.cpp
  18. 36
      modules/imgcodecs/src/grfmt_pam.cpp
  19. 28
      modules/imgcodecs/src/grfmt_pxm.cpp
  20. 8
      modules/imgcodecs/src/grfmt_sunras.cpp
  21. 36
      modules/imgcodecs/src/loadsave.cpp
  22. 4
      modules/imgproc/src/accum.cpp
  23. 4
      modules/imgproc/src/box_filter.cpp
  24. 6
      modules/imgproc/src/contours.cpp
  25. 4
      modules/imgproc/src/deriv.cpp
  26. 4
      modules/imgproc/src/featureselect.cpp
  27. 8
      modules/imgproc/src/histogram.cpp
  28. 4
      modules/imgproc/src/imgwarp.cpp
  29. 4
      modules/imgproc/src/median_blur.cpp
  30. 4
      modules/imgproc/src/pyramids.cpp
  31. 4
      modules/imgproc/src/smooth.cpp
  32. 4
      modules/imgproc/src/thresh.cpp
  33. 12
      modules/objdetect/src/detection_based_tracker.cpp
  34. 14
      modules/objdetect/src/hog.cpp
  35. 4
      modules/ts/include/opencv2/ts/ts_ext.hpp
  36. 12
      modules/ts/src/ts_perf.cpp
  37. 4
      modules/video/src/lkpyramid.cpp
  38. 2
      modules/videoio/src/cap_cmu.cpp
  39. 22
      modules/videoio/src/cap_gphoto2.cpp
  40. 12
      samples/android/face-detection/jni/DetectionBasedTracker_jni.cpp
  41. 8
      samples/android/tutorial-4-opencl/jni/CLprocessor.cpp
  42. 2
      samples/cpp/detect_blob.cpp
  43. 2
      samples/cpp/detect_mser.cpp
  44. 2
      samples/cpp/live_detect_qrcode.cpp
  45. 4
      samples/cpp/matchmethod_orb_akaze_brisk.cpp
  46. 2
      samples/cpp/pca.cpp
  47. 2
      samples/directx/d3d10_interop.cpp
  48. 2
      samples/directx/d3d11_interop.cpp
  49. 2
      samples/directx/d3d9_interop.cpp
  50. 2
      samples/directx/d3d9ex_interop.cpp
  51. 2
      samples/directx/d3dsample.hpp
  52. 2
      samples/opencl/opencl-opencv-interop.cpp
  53. 4
      samples/opengl/opengl_interop.cpp
  54. 2
      samples/va_intel/va_intel_interop.cpp

@ -2236,13 +2236,13 @@ bool findCirclesGrid2(InputArray _image, Size patternSize,
void* oldCbkData; void* oldCbkData;
ErrorCallback oldCbk = redirectError(quiet_error, 0, &oldCbkData); // FIXIT not thread safe ErrorCallback oldCbk = redirectError(quiet_error, 0, &oldCbkData); // FIXIT not thread safe
#endif #endif
CV_TRY try
{ {
isFound = boxFinder.findHoles(); isFound = boxFinder.findHoles();
} }
CV_CATCH(Exception, e) catch (const cv::Exception &)
{ {
CV_UNUSED(e);
} }
#if BE_QUIET #if BE_QUIET
redirectError(oldCbk, oldCbkData); redirectError(oldCbk, oldCbkData);

@ -124,7 +124,7 @@ static void from_str(const String& str, int type, void* dst)
void CommandLineParser::getByName(const String& name, bool space_delete, int type, void* dst) const void CommandLineParser::getByName(const String& name, bool space_delete, int type, void* dst) const
{ {
CV_TRY try
{ {
for (size_t i = 0; i < impl->data.size(); i++) for (size_t i = 0; i < impl->data.size(); i++)
{ {
@ -149,19 +149,20 @@ void CommandLineParser::getByName(const String& name, bool space_delete, int typ
} }
} }
} }
CV_CATCH (Exception, e) catch (const Exception& e)
{ {
impl->error = true; impl->error = true;
impl->error_message = impl->error_message + "Parameter '"+ name + "': " + e.err + "\n"; impl->error_message = impl->error_message + "Parameter '"+ name + "': " + e.err + "\n";
return; return;
} }
CV_Error_(Error::StsBadArg, ("undeclared key '%s' requested", name.c_str())); CV_Error_(Error::StsBadArg, ("undeclared key '%s' requested", name.c_str()));
} }
void CommandLineParser::getByIndex(int index, bool space_delete, int type, void* dst) const void CommandLineParser::getByIndex(int index, bool space_delete, int type, void* dst) const
{ {
CV_TRY try
{ {
for (size_t i = 0; i < impl->data.size(); i++) for (size_t i = 0; i < impl->data.size(); i++)
{ {
@ -181,12 +182,13 @@ void CommandLineParser::getByIndex(int index, bool space_delete, int type, void*
} }
} }
} }
CV_CATCH(Exception, e) catch (const Exception& e)
{ {
impl->error = true; impl->error = true;
impl->error_message = impl->error_message + format("Parameter #%d: ", index) + e.err + "\n"; impl->error_message = impl->error_message + format("Parameter #%d: ", index) + e.err + "\n";
return; return;
} }
CV_Error_(Error::StsBadArg, ("undeclared position %d requested", index)); CV_Error_(Error::StsBadArg, ("undeclared position %d requested", index));
} }
@ -460,13 +462,14 @@ std::vector<String> CommandLineParser::Impl::split_range_string(const String& _s
std::vector<String> vec; std::vector<String> vec;
String word = ""; String word = "";
bool begin = false; bool begin = false;
while (!str.empty()) while (!str.empty())
{ {
if (str[0] == fs) if (str[0] == fs)
{ {
if (begin == true) if (begin == true)
{ {
CV_THROW (cv::Exception(CV_StsParseError, throw cv::Exception(CV_StsParseError,
String("error in split_range_string(") String("error in split_range_string(")
+ str + str
+ String(", ") + String(", ")
@ -475,7 +478,7 @@ std::vector<String> CommandLineParser::Impl::split_range_string(const String& _s
+ String(1, ss) + String(1, ss)
+ String(")"), + String(")"),
"", __FILE__, __LINE__ "", __FILE__, __LINE__
)); );
} }
begin = true; begin = true;
word = ""; word = "";
@ -486,7 +489,7 @@ std::vector<String> CommandLineParser::Impl::split_range_string(const String& _s
{ {
if (begin == false) if (begin == false)
{ {
CV_THROW (cv::Exception(CV_StsParseError, throw cv::Exception(CV_StsParseError,
String("error in split_range_string(") String("error in split_range_string(")
+ str + str
+ String(", ") + String(", ")
@ -495,7 +498,7 @@ std::vector<String> CommandLineParser::Impl::split_range_string(const String& _s
+ String(1, ss) + String(1, ss)
+ String(")"), + String(")"),
"", __FILE__, __LINE__ "", __FILE__, __LINE__
)); );
} }
begin = false; begin = false;
vec.push_back(word); vec.push_back(word);
@ -510,7 +513,7 @@ std::vector<String> CommandLineParser::Impl::split_range_string(const String& _s
if (begin == true) if (begin == true)
{ {
CV_THROW (cv::Exception(CV_StsParseError, throw cv::Exception(CV_StsParseError,
String("error in split_range_string(") String("error in split_range_string(")
+ str + str
+ String(", ") + String(", ")
@ -519,8 +522,9 @@ std::vector<String> CommandLineParser::Impl::split_range_string(const String& _s
+ String(1, ss) + String(1, ss)
+ String(")"), + String(")"),
"", __FILE__, __LINE__ "", __FILE__, __LINE__
)); );
} }
return vec; return vec;
} }

@ -231,7 +231,7 @@ static void glob_rec(const cv::String& directory, const cv::String& wildchart, s
if ((dir = opendir (directory.c_str())) != 0) if ((dir = opendir (directory.c_str())) != 0)
{ {
/* find all the files and directories within directory */ /* find all the files and directories within directory */
CV_TRY try
{ {
struct dirent *ent; struct dirent *ent;
while ((ent = readdir (dir)) != 0) while ((ent = readdir (dir)) != 0)
@ -255,10 +255,10 @@ static void glob_rec(const cv::String& directory, const cv::String& wildchart, s
result.push_back(entry); result.push_back(entry);
} }
} }
CV_CATCH_ALL catch (...)
{ {
closedir(dir); closedir(dir);
CV_RETHROW(); throw;
} }
closedir(dir); closedir(dir);
} }

@ -866,7 +866,7 @@ private:
d = alloc_1d<double> (n); d = alloc_1d<double> (n);
e = alloc_1d<double> (n); e = alloc_1d<double> (n);
ort = alloc_1d<double> (n); ort = alloc_1d<double> (n);
CV_TRY { try {
// Reduce to Hessenberg form. // Reduce to Hessenberg form.
orthes(); orthes();
// Reduce Hessenberg to real Schur form. // Reduce Hessenberg to real Schur form.
@ -884,10 +884,10 @@ private:
// Deallocate the memory by releasing all internal working data. // Deallocate the memory by releasing all internal working data.
release(); release();
} }
CV_CATCH_ALL catch (...)
{ {
release(); release();
CV_RETHROW(); throw;
} }
} }

@ -120,11 +120,11 @@ static bool openvx_LUT(Mat src, Mat dst, Mat _lut)
lut.copyFrom(_lut); lut.copyFrom(_lut);
ivx::IVX_CHECK_STATUS(vxuTableLookup(ctx, ia, lut, ib)); ivx::IVX_CHECK_STATUS(vxuTableLookup(ctx, ia, lut, ib));
} }
catch (ivx::RuntimeError & e) catch (const ivx::RuntimeError& e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }
catch (ivx::WrapperError & e) catch (const ivx::WrapperError& e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }

@ -416,7 +416,7 @@ Mat::Mat(const Mat& m, const Range& _rowRange, const Range& _colRange)
} }
*this = m; *this = m;
CV_TRY try
{ {
if( _rowRange != Range::all() && _rowRange != Range(0,rows) ) if( _rowRange != Range::all() && _rowRange != Range(0,rows) )
{ {
@ -436,10 +436,10 @@ Mat::Mat(const Mat& m, const Range& _rowRange, const Range& _colRange)
flags |= SUBMATRIX_FLAG; flags |= SUBMATRIX_FLAG;
} }
} }
CV_CATCH_ALL catch(...)
{ {
release(); release();
CV_RETHROW(); throw;
} }
updateContinuityFlag(); updateContinuityFlag();

@ -648,11 +648,11 @@ static bool ocl_meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv
pstddev[c] = 0; pstddev[c] = 0;
} }
} }
catch (ivx::RuntimeError & e) catch (const ivx::RuntimeError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }
catch (ivx::WrapperError & e) catch (const ivx::WrapperError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }

@ -433,11 +433,11 @@ static bool openvx_minMaxIdx(Mat &src, double* minVal, double* maxVal, int* minI
ofs2idx(src, maxidx, maxIdx); ofs2idx(src, maxidx, maxIdx);
} }
} }
catch (ivx::RuntimeError & e) catch (const ivx::RuntimeError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }
catch (ivx::WrapperError & e) catch (const ivx::WrapperError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }

@ -894,11 +894,11 @@ bool useOpenCL()
CoreTLSData* data = getCoreTlsData().get(); CoreTLSData* data = getCoreTlsData().get();
if( data->useOpenCL < 0 ) if( data->useOpenCL < 0 )
{ {
CV_TRY try
{ {
data->useOpenCL = (int)(haveOpenCL() && Device::getDefault().ptr() && Device::getDefault().available()) ? 1 : 0; data->useOpenCL = (int)(haveOpenCL() && Device::getDefault().ptr() && Device::getDefault().available()) ? 1 : 0;
} }
CV_CATCH_ALL catch (...)
{ {
data->useOpenCL = 0; data->useOpenCL = 0;
} }

@ -417,7 +417,7 @@ cvOpenFileStorage( const char* query, CvMemStorage* dststorage, int flags, const
//mode = cvGetErrMode(); //mode = cvGetErrMode();
//cvSetErrMode( CV_ErrModeSilent ); //cvSetErrMode( CV_ErrModeSilent );
CV_TRY try
{ {
switch (fs->fmt) switch (fs->fmt)
{ {
@ -427,7 +427,7 @@ cvOpenFileStorage( const char* query, CvMemStorage* dststorage, int flags, const
default: break; default: break;
} }
} }
CV_CATCH_ALL catch (...)
{ {
fs->is_opened = true; fs->is_opened = true;
cvReleaseFileStorage( &fs ); cvReleaseFileStorage( &fs );

@ -756,11 +756,11 @@ static void* icvReadSeq( CvFileStorage* fs, CvFileNode* node )
flags |= CV_SEQ_FLAG_HOLE; flags |= CV_SEQ_FLAG_HOLE;
if( !strstr(flags_str, "untyped") ) if( !strstr(flags_str, "untyped") )
{ {
CV_TRY try
{ {
flags |= icvDecodeSimpleFormat(dt); flags |= icvDecodeSimpleFormat(dt);
} }
CV_CATCH_ALL catch (...)
{ {
} }
} }

@ -1025,7 +1025,7 @@ void error( const Exception& exc )
*p = 0; *p = 0;
} }
CV_THROW(exc); throw exc;
} }
void error(int _code, const String& _err, const char* _func, const char* _file, int _line) void error(int _code, const String& _err, const char* _func, const char* _file, int _line)

@ -367,11 +367,11 @@ UMat Mat::getUMat(int accessFlags, UMatUsageFlags usageFlags) const
new_u->originalUMatData = u; new_u->originalUMatData = u;
} }
bool allocated = false; bool allocated = false;
CV_TRY try
{ {
allocated = UMat::getStdAllocator()->allocate(new_u, accessFlags, usageFlags); allocated = UMat::getStdAllocator()->allocate(new_u, accessFlags, usageFlags);
} }
CV_CATCH(cv::Exception, e) catch (const cv::Exception& e)
{ {
fprintf(stderr, "Exception: %s\n", e.what()); fprintf(stderr, "Exception: %s\n", e.what());
} }
@ -442,12 +442,12 @@ void UMat::create(int d, const int* _sizes, int _type, UMatUsageFlags _usageFlag
a = a0; a = a0;
a0 = Mat::getDefaultAllocator(); a0 = Mat::getDefaultAllocator();
} }
CV_TRY try
{ {
u = a->allocate(dims, size, _type, 0, step.p, 0, usageFlags); u = a->allocate(dims, size, _type, 0, step.p, 0, usageFlags);
CV_Assert(u != 0); CV_Assert(u != 0);
} }
CV_CATCH_ALL catch(...)
{ {
if(a != a0) if(a != a0)
u = a0->allocate(dims, size, _type, 0, step.p, 0, usageFlags); u = a0->allocate(dims, size, _type, 0, step.p, 0, usageFlags);

@ -401,11 +401,11 @@ static bool openvx_FAST(InputArray _img, std::vector<KeyPoint>& keypoints,
img.swapHandle(); img.swapHandle();
#endif #endif
} }
catch (RuntimeError & e) catch (const RuntimeError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }
catch (WrapperError & e) catch (const WrapperError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }

@ -99,7 +99,7 @@ void RBaseStream::readBlock()
{ {
if( m_block_pos == 0 && m_current < m_end ) if( m_block_pos == 0 && m_current < m_end )
return; return;
CV_THROW (RBS_THROW_EOS); throw RBS_THROW_EOS;
} }
fseek( m_file, m_block_pos, SEEK_SET ); fseek( m_file, m_block_pos, SEEK_SET );
@ -107,7 +107,7 @@ void RBaseStream::readBlock()
m_end = m_start + readed; m_end = m_start + readed;
if( readed == 0 || m_current >= m_end ) if( readed == 0 || m_current >= m_end )
CV_THROW (RBS_THROW_EOS); throw RBS_THROW_EOS;
} }

@ -80,15 +80,14 @@ ExifReader::~ExifReader()
*/ */
bool ExifReader::parse() bool ExifReader::parse()
{ {
CV_TRY { try {
m_exif = getExif(); m_exif = getExif();
if( !m_exif.empty() ) if( !m_exif.empty() )
{ {
return true; return true;
} }
return false; return false;
} CV_CATCH (ExifParsingError, e) { } catch (ExifParsingError&) {
CV_UNUSED(e);
return false; return false;
} }
} }
@ -152,11 +151,11 @@ std::map<int, ExifEntry_t > ExifReader::getExif()
case COM: case COM:
bytesToSkip = getFieldSize(); bytesToSkip = getFieldSize();
if (bytesToSkip < markerSize) { if (bytesToSkip < markerSize) {
CV_THROW (ExifParsingError()); throw ExifParsingError();
} }
m_stream.seekg( static_cast<long>( bytesToSkip - markerSize ), m_stream.cur ); m_stream.seekg( static_cast<long>( bytesToSkip - markerSize ), m_stream.cur );
if ( m_stream.fail() ) { if ( m_stream.fail() ) {
CV_THROW (ExifParsingError()); throw ExifParsingError();
} }
break; break;
@ -167,12 +166,12 @@ std::map<int, ExifEntry_t > ExifReader::getExif()
case APP1: //actual Exif Marker case APP1: //actual Exif Marker
exifSize = getFieldSize(); exifSize = getFieldSize();
if (exifSize <= offsetToTiffHeader) { if (exifSize <= offsetToTiffHeader) {
CV_THROW (ExifParsingError()); throw ExifParsingError();
} }
m_data.resize( exifSize - offsetToTiffHeader ); m_data.resize( exifSize - offsetToTiffHeader );
m_stream.seekg( static_cast<long>( offsetToTiffHeader ), m_stream.cur ); m_stream.seekg( static_cast<long>( offsetToTiffHeader ), m_stream.cur );
if ( m_stream.fail() ) { if ( m_stream.fail() ) {
CV_THROW (ExifParsingError()); throw ExifParsingError();
} }
m_stream.read( reinterpret_cast<char*>(&m_data[0]), exifSize - offsetToTiffHeader ); m_stream.read( reinterpret_cast<char*>(&m_data[0]), exifSize - offsetToTiffHeader );
exifFound = true; exifFound = true;
@ -416,7 +415,7 @@ std::string ExifReader::getString(const size_t offset) const
dataOffset = getU32( offset + 8 ); dataOffset = getU32( offset + 8 );
} }
if (dataOffset > m_data.size() || dataOffset + size > m_data.size()) { if (dataOffset > m_data.size() || dataOffset + size > m_data.size()) {
CV_THROW (ExifParsingError()); throw ExifParsingError();
} }
std::vector<uint8_t>::const_iterator it = m_data.begin() + dataOffset; std::vector<uint8_t>::const_iterator it = m_data.begin() + dataOffset;
std::string result( it, it + size ); //copy vector content into result std::string result( it, it + size ); //copy vector content into result
@ -433,7 +432,7 @@ std::string ExifReader::getString(const size_t offset) const
uint16_t ExifReader::getU16(const size_t offset) const uint16_t ExifReader::getU16(const size_t offset) const
{ {
if (offset + 1 >= m_data.size()) if (offset + 1 >= m_data.size())
CV_THROW (ExifParsingError()); throw ExifParsingError();
if( m_format == INTEL ) if( m_format == INTEL )
{ {
@ -451,7 +450,7 @@ uint16_t ExifReader::getU16(const size_t offset) const
uint32_t ExifReader::getU32(const size_t offset) const uint32_t ExifReader::getU32(const size_t offset) const
{ {
if (offset + 3 >= m_data.size()) if (offset + 3 >= m_data.size())
CV_THROW (ExifParsingError()); throw ExifParsingError();
if( m_format == INTEL ) if( m_format == INTEL )
{ {

@ -89,7 +89,7 @@ bool BmpDecoder::readHeader()
else if( !m_strm.open( m_filename )) else if( !m_strm.open( m_filename ))
return false; return false;
CV_TRY try
{ {
m_strm.skip( 10 ); m_strm.skip( 10 );
m_offset = m_strm.getDWord(); m_offset = m_strm.getDWord();
@ -173,9 +173,9 @@ bool BmpDecoder::readHeader()
} }
} }
} }
CV_CATCH_ALL catch(...)
{ {
CV_RETHROW(); throw;
} }
// in 32 bit case alpha channel is used - so require CV_8UC4 type // in 32 bit case alpha channel is used - so require CV_8UC4 type
m_type = iscolor ? (m_bpp == 32 ? CV_8UC4 : CV_8UC3 ) : CV_8UC1; m_type = iscolor ? (m_bpp == 32 ? CV_8UC4 : CV_8UC3 ) : CV_8UC1;
@ -225,7 +225,7 @@ bool BmpDecoder::readData( Mat& img )
} }
uchar *src = _src.data(), *bgr = _bgr.data(); uchar *src = _src.data(), *bgr = _bgr.data();
CV_TRY try
{ {
m_strm.setPos( m_offset ); m_strm.setPos( m_offset );
@ -490,9 +490,9 @@ decode_rle8_bad: ;
CV_Error(cv::Error::StsError, "Invalid/unsupported mode"); CV_Error(cv::Error::StsError, "Invalid/unsupported mode");
} }
} }
CV_CATCH_ALL catch(...)
{ {
CV_RETHROW(); throw;
} }
return result; return result;

@ -379,25 +379,25 @@ bool PAMDecoder::readHeader()
} }
else if( !m_strm.open( m_filename )) else if( !m_strm.open( m_filename ))
return false; return false;
CV_TRY try
{ {
byte = m_strm.getByte(); byte = m_strm.getByte();
if( byte != 'P' ) if( byte != 'P' )
CV_THROW( RBS_BAD_HEADER ); throw RBS_BAD_HEADER;
byte = m_strm.getByte(); byte = m_strm.getByte();
if (byte != '7') if (byte != '7')
CV_THROW( RBS_BAD_HEADER ); throw RBS_BAD_HEADER;
byte = m_strm.getByte(); byte = m_strm.getByte();
if (byte != '\n' && byte != '\r') if (byte != '\n' && byte != '\r')
CV_THROW( RBS_BAD_HEADER ); throw RBS_BAD_HEADER;
uint i; uint i;
memset (&flds, 0x00, sizeof (struct parsed_fields)); memset (&flds, 0x00, sizeof (struct parsed_fields));
do { do {
if (!ReadPAMHeaderLine(m_strm, fieldtype, value)) if (!ReadPAMHeaderLine(m_strm, fieldtype, value))
CV_THROW( RBS_BAD_HEADER ); throw RBS_BAD_HEADER;
switch (fieldtype) { switch (fieldtype) {
case PAM_HEADER_NONE: case PAM_HEADER_NONE:
case PAM_HEADER_COMMENT: case PAM_HEADER_COMMENT:
@ -407,32 +407,32 @@ bool PAMDecoder::readHeader()
break; break;
case PAM_HEADER_HEIGHT: case PAM_HEADER_HEIGHT:
if (flds.height) if (flds.height)
CV_THROW( RBS_BAD_HEADER ); throw RBS_BAD_HEADER;
if (!ParseNumber (value, &m_height)) if (!ParseNumber (value, &m_height))
CV_THROW( RBS_BAD_HEADER ); throw RBS_BAD_HEADER;
flds.height = true; flds.height = true;
break; break;
case PAM_HEADER_WIDTH: case PAM_HEADER_WIDTH:
if (flds.width) if (flds.width)
CV_THROW( RBS_BAD_HEADER ); throw RBS_BAD_HEADER;
if (!ParseNumber (value, &m_width)) if (!ParseNumber (value, &m_width))
CV_THROW( RBS_BAD_HEADER ); throw RBS_BAD_HEADER;
flds.width = true; flds.width = true;
break; break;
case PAM_HEADER_DEPTH: case PAM_HEADER_DEPTH:
if (flds.depth) if (flds.depth)
CV_THROW( RBS_BAD_HEADER ); throw RBS_BAD_HEADER;
if (!ParseNumber (value, &m_channels)) if (!ParseNumber (value, &m_channels))
CV_THROW( RBS_BAD_HEADER ); throw RBS_BAD_HEADER;
flds.depth = true; flds.depth = true;
break; break;
case PAM_HEADER_MAXVAL: case PAM_HEADER_MAXVAL:
if (flds.maxval) if (flds.maxval)
CV_THROW( RBS_BAD_HEADER ); throw RBS_BAD_HEADER;
if (!ParseNumber (value, &m_maxval)) if (!ParseNumber (value, &m_maxval))
CV_THROW( RBS_BAD_HEADER ); throw RBS_BAD_HEADER;
if ( m_maxval > 65535 ) if ( m_maxval > 65535 )
CV_THROW( RBS_BAD_HEADER ); throw RBS_BAD_HEADER;
if ( m_maxval > 255 ) { if ( m_maxval > 255 ) {
m_sampledepth = CV_16U; m_sampledepth = CV_16U;
} }
@ -451,7 +451,7 @@ bool PAMDecoder::readHeader()
} }
break; break;
default: default:
CV_THROW( RBS_BAD_HEADER ); throw RBS_BAD_HEADER;
} }
} while (fieldtype != PAM_HEADER_ENDHDR); } while (fieldtype != PAM_HEADER_ENDHDR);
@ -469,7 +469,7 @@ bool PAMDecoder::readHeader()
return true; return true;
} }
} CV_CATCH_ALL } catch(...)
{ {
} }
@ -512,7 +512,7 @@ bool PAMDecoder::readData( Mat& img )
} }
} }
CV_TRY try
{ {
m_strm.setPos( m_offset ); m_strm.setPos( m_offset );
@ -610,7 +610,7 @@ bool PAMDecoder::readData( Mat& img )
} }
res = true; res = true;
} CV_CATCH_ALL } catch(...)
{ {
} }

@ -150,11 +150,11 @@ bool PxMDecoder::readHeader()
else if( !m_strm.open( m_filename )) else if( !m_strm.open( m_filename ))
return false; return false;
CV_TRY try
{ {
int code = m_strm.getByte(); int code = m_strm.getByte();
if( code != 'P' ) if( code != 'P' )
CV_THROW (RBS_BAD_HEADER); throw RBS_BAD_HEADER;
code = m_strm.getByte(); code = m_strm.getByte();
switch( code ) switch( code )
@ -162,7 +162,7 @@ bool PxMDecoder::readHeader()
case '1': case '4': m_bpp = 1; break; case '1': case '4': m_bpp = 1; break;
case '2': case '5': m_bpp = 8; break; case '2': case '5': m_bpp = 8; break;
case '3': case '6': m_bpp = 24; break; case '3': case '6': m_bpp = 24; break;
default: CV_THROW (RBS_BAD_HEADER); default: throw RBS_BAD_HEADER;
} }
m_binary = code >= '4'; m_binary = code >= '4';
@ -173,7 +173,7 @@ bool PxMDecoder::readHeader()
m_maxval = m_bpp == 1 ? 1 : ReadNumber(m_strm); m_maxval = m_bpp == 1 ? 1 : ReadNumber(m_strm);
if( m_maxval > 65535 ) if( m_maxval > 65535 )
CV_THROW (RBS_BAD_HEADER); throw RBS_BAD_HEADER;
//if( m_maxval > 255 ) m_binary = false; nonsense //if( m_maxval > 255 ) m_binary = false; nonsense
if( m_maxval > 255 ) if( m_maxval > 255 )
@ -185,15 +185,14 @@ bool PxMDecoder::readHeader()
result = true; result = true;
} }
} }
CV_CATCH (cv::Exception, e) catch (const cv::Exception&)
{ {
CV_UNUSED(e); throw;
CV_RETHROW();
} }
CV_CATCH_ALL catch (...)
{ {
std::cerr << "PXM::readHeader(): unknown C++ exception" << std::endl << std::flush; std::cerr << "PXM::readHeader(): unknown C++ exception" << std::endl << std::flush;
CV_RETHROW(); throw;
} }
if( !result ) if( !result )
@ -233,7 +232,7 @@ bool PxMDecoder::readData( Mat& img )
FillGrayPalette( palette, m_bpp==1 ? 1 : 8 , m_bpp == 1 ); FillGrayPalette( palette, m_bpp==1 ? 1 : 8 , m_bpp == 1 );
} }
CV_TRY try
{ {
m_strm.setPos( m_offset ); m_strm.setPos( m_offset );
@ -359,15 +358,14 @@ bool PxMDecoder::readData( Mat& img )
CV_Error(Error::StsError, "m_bpp is not supported"); CV_Error(Error::StsError, "m_bpp is not supported");
} }
} }
CV_CATCH (cv::Exception, e) catch (const cv::Exception&)
{ {
CV_UNUSED(e); throw;
CV_RETHROW();
} }
CV_CATCH_ALL catch (...)
{ {
std::cerr << "PXM::readData(): unknown exception" << std::endl << std::flush; std::cerr << "PXM::readData(): unknown exception" << std::endl << std::flush;
CV_RETHROW(); throw;
} }
return result; return result;

@ -84,7 +84,7 @@ bool SunRasterDecoder::readHeader()
if( !m_strm.open( m_filename )) return false; if( !m_strm.open( m_filename )) return false;
CV_TRY try
{ {
m_strm.skip( 4 ); m_strm.skip( 4 );
m_width = m_strm.getDWord(); m_width = m_strm.getDWord();
@ -144,7 +144,7 @@ bool SunRasterDecoder::readHeader()
} }
} }
} }
CV_CATCH_ALL catch(...)
{ {
} }
@ -179,7 +179,7 @@ bool SunRasterDecoder::readData( Mat& img )
if( !color && m_maptype == RMT_EQUAL_RGB ) if( !color && m_maptype == RMT_EQUAL_RGB )
CvtPaletteToGray( m_palette, gray_palette, 1 << m_bpp ); CvtPaletteToGray( m_palette, gray_palette, 1 << m_bpp );
CV_TRY try
{ {
m_strm.setPos( m_offset ); m_strm.setPos( m_offset );
@ -376,7 +376,7 @@ bad_decoding_end:
CV_Error(Error::StsInternal, ""); CV_Error(Error::StsInternal, "");
} }
} }
CV_CATCH_ALL catch( ... )
{ {
} }

@ -437,18 +437,18 @@ imread_( const String& filename, int flags, int hdrtype, Mat* mat=0 )
/// set the filename in the driver /// set the filename in the driver
decoder->setSource( filename ); decoder->setSource( filename );
CV_TRY try
{ {
// read the header to make sure it succeeds // read the header to make sure it succeeds
if( !decoder->readHeader() ) if( !decoder->readHeader() )
return 0; return 0;
} }
CV_CATCH (cv::Exception, e) catch (const cv::Exception& e)
{ {
std::cerr << "imread_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush; std::cerr << "imread_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
return 0; return 0;
} }
CV_CATCH_ALL catch (...)
{ {
std::cerr << "imread_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush; std::cerr << "imread_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
return 0; return 0;
@ -493,16 +493,16 @@ imread_( const String& filename, int flags, int hdrtype, Mat* mat=0 )
// read the image data // read the image data
bool success = false; bool success = false;
CV_TRY try
{ {
if (decoder->readData(*data)) if (decoder->readData(*data))
success = true; success = true;
} }
CV_CATCH (cv::Exception, e) catch (const cv::Exception& e)
{ {
std::cerr << "imread_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush; std::cerr << "imread_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
} }
CV_CATCH_ALL catch (...)
{ {
std::cerr << "imread_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush; std::cerr << "imread_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
} }
@ -559,18 +559,18 @@ imreadmulti_(const String& filename, int flags, std::vector<Mat>& mats)
decoder->setSource(filename); decoder->setSource(filename);
// read the header to make sure it succeeds // read the header to make sure it succeeds
CV_TRY try
{ {
// read the header to make sure it succeeds // read the header to make sure it succeeds
if( !decoder->readHeader() ) if( !decoder->readHeader() )
return 0; return 0;
} }
CV_CATCH (cv::Exception, e) catch (const cv::Exception& e)
{ {
std::cerr << "imreadmulti_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush; std::cerr << "imreadmulti_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
return 0; return 0;
} }
CV_CATCH_ALL catch (...)
{ {
std::cerr << "imreadmulti_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush; std::cerr << "imreadmulti_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
return 0; return 0;
@ -598,16 +598,16 @@ imreadmulti_(const String& filename, int flags, std::vector<Mat>& mats)
// read the image data // read the image data
Mat mat(size.height, size.width, type); Mat mat(size.height, size.width, type);
bool success = false; bool success = false;
CV_TRY try
{ {
if (decoder->readData(mat)) if (decoder->readData(mat))
success = true; success = true;
} }
CV_CATCH (cv::Exception, e) catch (const cv::Exception& e)
{ {
std::cerr << "imreadmulti_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush; std::cerr << "imreadmulti_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
} }
CV_CATCH_ALL catch (...)
{ {
std::cerr << "imreadmulti_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush; std::cerr << "imreadmulti_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
} }
@ -777,16 +777,16 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
} }
bool success = false; bool success = false;
CV_TRY try
{ {
if (decoder->readHeader()) if (decoder->readHeader())
success = true; success = true;
} }
CV_CATCH (cv::Exception, e) catch (const cv::Exception& e)
{ {
std::cerr << "imdecode_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush; std::cerr << "imdecode_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
} }
CV_CATCH_ALL catch (...)
{ {
std::cerr << "imdecode_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush; std::cerr << "imdecode_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
} }
@ -839,16 +839,16 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
} }
success = false; success = false;
CV_TRY try
{ {
if (decoder->readData(*data)) if (decoder->readData(*data))
success = true; success = true;
} }
CV_CATCH (cv::Exception, e) catch (const cv::Exception& e)
{ {
std::cerr << "imdecode_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush; std::cerr << "imdecode_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
} }
CV_CATCH_ALL catch (...)
{ {
std::cerr << "imdecode_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush; std::cerr << "imdecode_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
} }

@ -291,11 +291,11 @@ static bool openvx_accumulate(InputArray _src, InputOutputArray _dst, InputArray
srcImage.swapHandle(); dstImage.swapHandle(); srcImage.swapHandle(); dstImage.swapHandle();
#endif #endif
} }
catch (ivx::RuntimeError & e) catch (const ivx::RuntimeError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }
catch (ivx::WrapperError & e) catch (const ivx::WrapperError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }

@ -1559,11 +1559,11 @@ namespace cv
ivx::IVX_CHECK_STATUS(vxuBox3x3(ctx, ia, ib)); ivx::IVX_CHECK_STATUS(vxuBox3x3(ctx, ia, ib));
ctx.setImmediateBorder(prevBorder); ctx.setImmediateBorder(prevBorder);
} }
catch (ivx::RuntimeError & e) catch (const ivx::RuntimeError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }
catch (ivx::WrapperError & e) catch (const ivx::WrapperError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }

@ -1820,7 +1820,7 @@ cvFindContours_Impl( void* img, CvMemStorage* storage,
} }
else else
{ {
CV_TRY try
{ {
scanner = cvStartFindContours_Impl( img, storage, cntHeaderSize, mode, method, offset, scanner = cvStartFindContours_Impl( img, storage, cntHeaderSize, mode, method, offset,
needFillBorder); needFillBorder);
@ -1832,11 +1832,11 @@ cvFindContours_Impl( void* img, CvMemStorage* storage,
} }
while( contour != 0 ); while( contour != 0 );
} }
CV_CATCH_ALL catch(...)
{ {
if( scanner ) if( scanner )
cvEndFindContours(&scanner); cvEndFindContours(&scanner);
CV_RETHROW(); throw;
} }
*firstContour = cvEndFindContours( &scanner ); *firstContour = cvEndFindContours( &scanner );

@ -246,11 +246,11 @@ namespace cv
ivx::IVX_CHECK_STATUS(vxuSobel3x3(ctx, ia, NULL, ib)); ivx::IVX_CHECK_STATUS(vxuSobel3x3(ctx, ia, NULL, ib));
ctx.setImmediateBorder(prevBorder); ctx.setImmediateBorder(prevBorder);
} }
catch (ivx::RuntimeError & e) catch (const ivx::RuntimeError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }
catch (ivx::WrapperError & e) catch (const ivx::WrapperError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }

@ -342,11 +342,11 @@ static bool openvx_harris(Mat image, OutputArray _corners,
ovxImage.swapHandle(); ovxImage.swapHandle();
#endif #endif
} }
catch (RuntimeError & e) catch (const RuntimeError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }
catch (WrapperError & e) catch (const WrapperError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }

@ -793,11 +793,11 @@ namespace cv
img.swapHandle(); img.swapHandle();
#endif #endif
} }
catch (ivx::RuntimeError & e) catch (const ivx::RuntimeError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }
catch (ivx::WrapperError & e) catch (const ivx::WrapperError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }
@ -3313,11 +3313,11 @@ static bool openvx_equalize_hist(Mat srcMat, Mat dstMat)
srcImage.swapHandle(); dstImage.swapHandle(); srcImage.swapHandle(); dstImage.swapHandle();
#endif #endif
} }
catch (RuntimeError & e) catch (const RuntimeError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }
catch (WrapperError & e) catch (const WrapperError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }

@ -1598,12 +1598,12 @@ static bool openvx_remap(Mat src, Mat dst, Mat map1, Mat map2, int interpolation
ctx.setImmediateBorder(prevBorder); ctx.setImmediateBorder(prevBorder);
} }
catch (ivx::RuntimeError & e) catch (const ivx::RuntimeError & e)
{ {
CV_Error(CV_StsInternal, e.what()); CV_Error(CV_StsInternal, e.what());
return false; return false;
} }
catch (ivx::WrapperError & e) catch (const ivx::WrapperError & e)
{ {
CV_Error(CV_StsInternal, e.what()); CV_Error(CV_StsInternal, e.what());
return false; return false;

@ -1068,11 +1068,11 @@ static bool openvx_medianFilter(InputArray _src, OutputArray _dst, int ksize)
#endif #endif
ctx.setImmediateBorder(prevBorder); ctx.setImmediateBorder(prevBorder);
} }
catch (ivx::RuntimeError & e) catch (const ivx::RuntimeError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }
catch (ivx::WrapperError & e) catch (const ivx::WrapperError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }

@ -861,11 +861,11 @@ static bool openvx_pyrDown( InputArray _src, OutputArray _dst, const Size& _dsz,
srcImg.swapHandle(); dstImg.swapHandle(); srcImg.swapHandle(); dstImg.swapHandle();
#endif #endif
} }
catch (RuntimeError & e) catch (const RuntimeError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }
catch (WrapperError & e) catch (const WrapperError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }

@ -2305,11 +2305,11 @@ static bool openvx_gaussianBlur(InputArray _src, OutputArray _dst, Size ksize,
ivx::IVX_CHECK_STATUS(vxuGaussian3x3(ctx, ia, ib)); ivx::IVX_CHECK_STATUS(vxuGaussian3x3(ctx, ia, ib));
ctx.setImmediateBorder(prevBorder); ctx.setImmediateBorder(prevBorder);
} }
catch (ivx::RuntimeError & e) catch (const ivx::RuntimeError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }
catch (ivx::WrapperError & e) catch (const ivx::WrapperError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }

@ -1374,11 +1374,11 @@ static bool openvx_threshold(Mat src, Mat dst, int thresh, int maxval, int type)
} }
#endif #endif
} }
catch (ivx::RuntimeError & e) catch (const ivx::RuntimeError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }
catch (ivx::WrapperError & e) catch (const ivx::WrapperError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }

@ -284,23 +284,23 @@ bool cv::DetectionBasedTracker::SeparateDetectionWork::run()
} }
#define CATCH_ALL_AND_LOG(_block) \ #define CATCH_ALL_AND_LOG(_block) \
CV_TRY { \ try { \
_block; \ _block; \
} \ } \
CV_CATCH(cv::Exception, e) { \ catch(const cv::Exception& e) { \
LOGE0("\n %s: ERROR: OpenCV Exception caught: \n'%s'\n\n", CV_Func, e.what()); \ LOGE0("\n %s: ERROR: OpenCV Exception caught: \n'%s'\n\n", CV_Func, e.what()); \
} CV_CATCH(std::exception, e) { \ } catch(const std::exception& e) { \
LOGE0("\n %s: ERROR: Exception caught: \n'%s'\n\n", CV_Func, e.what()); \ LOGE0("\n %s: ERROR: Exception caught: \n'%s'\n\n", CV_Func, e.what()); \
} CV_CATCH_ALL { \ } catch(...) { \
LOGE0("\n %s: ERROR: UNKNOWN Exception caught\n\n", CV_Func); \ LOGE0("\n %s: ERROR: UNKNOWN Exception caught\n\n", CV_Func); \
} }
void* cv::workcycleObjectDetectorFunction(void* p) void* cv::workcycleObjectDetectorFunction(void* p)
{ {
CATCH_ALL_AND_LOG({ ((cv::DetectionBasedTracker::SeparateDetectionWork*)p)->workcycleObjectDetector(); }); CATCH_ALL_AND_LOG({ ((cv::DetectionBasedTracker::SeparateDetectionWork*)p)->workcycleObjectDetector(); });
CV_TRY{ try{
((cv::DetectionBasedTracker::SeparateDetectionWork*)p)->init(); ((cv::DetectionBasedTracker::SeparateDetectionWork*)p)->init();
} CV_CATCH_ALL { } catch(...) {
LOGE0("DetectionBasedTracker: workcycleObjectDetectorFunction: ERROR concerning pointer, received as the function parameter"); LOGE0("DetectionBasedTracker: workcycleObjectDetectorFunction: ERROR concerning pointer, received as the function parameter");
} }
return NULL; return NULL;

@ -3685,7 +3685,7 @@ void HOGDescriptor::readALTModel(String modelfile)
String eerr("file not exist"); String eerr("file not exist");
String efile(__FILE__); String efile(__FILE__);
String efunc(__FUNCTION__); String efunc(__FUNCTION__);
CV_THROW (Exception(Error::StsError, eerr, efile, efunc, __LINE__)); throw Exception(Error::StsError, eerr, efile, efunc, __LINE__);
} }
char version_buffer[10]; char version_buffer[10];
if (!fread (&version_buffer,sizeof(char),10,modelfl)) if (!fread (&version_buffer,sizeof(char),10,modelfl))
@ -3695,7 +3695,7 @@ void HOGDescriptor::readALTModel(String modelfile)
String efunc(__FUNCTION__); String efunc(__FUNCTION__);
fclose(modelfl); fclose(modelfl);
CV_THROW (Exception(Error::StsError, eerr, efile, efunc, __LINE__)); throw Exception(Error::StsError, eerr, efile, efunc, __LINE__);
} }
if(strcmp(version_buffer,"V6.01")) { if(strcmp(version_buffer,"V6.01")) {
String eerr("version does not match"); String eerr("version does not match");
@ -3703,14 +3703,14 @@ void HOGDescriptor::readALTModel(String modelfile)
String efunc(__FUNCTION__); String efunc(__FUNCTION__);
fclose(modelfl); fclose(modelfl);
CV_THROW (Exception(Error::StsError, eerr, efile, efunc, __LINE__)); throw Exception(Error::StsError, eerr, efile, efunc, __LINE__);
} }
/* read version number */ /* read version number */
int version = 0; int version = 0;
if (!fread (&version,sizeof(int),1,modelfl)) if (!fread (&version,sizeof(int),1,modelfl))
{ {
fclose(modelfl); fclose(modelfl);
CV_THROW (Exception()); throw Exception();
} }
if (version < 200) if (version < 200)
{ {
@ -3718,7 +3718,7 @@ void HOGDescriptor::readALTModel(String modelfile)
String efile(__FILE__); String efile(__FILE__);
String efunc(__FUNCTION__); String efunc(__FUNCTION__);
fclose(modelfl); fclose(modelfl);
CV_THROW (Exception()); throw Exception();
} }
int kernel_type; int kernel_type;
size_t nread; size_t nread;
@ -3764,7 +3764,7 @@ void HOGDescriptor::readALTModel(String modelfile)
if(nread != static_cast<size_t>(length) + 1) { if(nread != static_cast<size_t>(length) + 1) {
delete [] linearwt; delete [] linearwt;
fclose(modelfl); fclose(modelfl);
CV_THROW (Exception()); throw Exception();
} }
for(int i = 0; i < length; i++) for(int i = 0; i < length; i++)
@ -3775,7 +3775,7 @@ void HOGDescriptor::readALTModel(String modelfile)
delete [] linearwt; delete [] linearwt;
} else { } else {
fclose(modelfl); fclose(modelfl);
CV_THROW (Exception()); throw Exception();
} }
fclose(modelfl); fclose(modelfl);
} }

@ -36,7 +36,7 @@ extern int testThreads;
Body(); \ Body(); \
CV__TEST_CLEANUP \ CV__TEST_CLEANUP \
} \ } \
catch (cvtest::SkipTestException& e) \ catch (const cvtest::SkipTestException& e) \
{ \ { \
printf("[ SKIP ] %s\n", e.what()); \ printf("[ SKIP ] %s\n", e.what()); \
} \ } \
@ -84,7 +84,7 @@ extern int testThreads;
Body(); \ Body(); \
CV__TEST_CLEANUP \ CV__TEST_CLEANUP \
} \ } \
catch (cvtest::SkipTestException& e) \ catch (const cvtest::SkipTestException& e) \
{ \ { \
printf("[ SKIP ] %s\n", e.what()); \ printf("[ SKIP ] %s\n", e.what()); \
} \ } \

@ -232,7 +232,7 @@ void Regression::init(const std::string& testSuitName, const std::string& ext)
storageOutPath += ext; storageOutPath += ext;
} }
} }
catch(cv::Exception&) catch(const cv::Exception&)
{ {
LOGE("Failed to open sanity data for reading: %s", storageInPath.c_str()); LOGE("Failed to open sanity data for reading: %s", storageInPath.c_str());
} }
@ -1987,22 +1987,22 @@ void TestBase::RunPerfTestBody()
implConf.GetImpl(); implConf.GetImpl();
#endif #endif
} }
catch(SkipTestException&) catch(const SkipTestException&)
{ {
metrics.terminationReason = performance_metrics::TERM_SKIP_TEST; metrics.terminationReason = performance_metrics::TERM_SKIP_TEST;
return; return;
} }
catch(PerfSkipTestException&) catch(const PerfSkipTestException&)
{ {
metrics.terminationReason = performance_metrics::TERM_SKIP_TEST; metrics.terminationReason = performance_metrics::TERM_SKIP_TEST;
return; return;
} }
catch(PerfEarlyExitException&) catch(const PerfEarlyExitException&)
{ {
metrics.terminationReason = performance_metrics::TERM_INTERRUPT; metrics.terminationReason = performance_metrics::TERM_INTERRUPT;
return;//no additional failure logging return;//no additional failure logging
} }
catch(cv::Exception& e) catch(const cv::Exception& e)
{ {
metrics.terminationReason = performance_metrics::TERM_EXCEPTION; metrics.terminationReason = performance_metrics::TERM_EXCEPTION;
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
@ -2011,7 +2011,7 @@ void TestBase::RunPerfTestBody()
#endif #endif
FAIL() << "Expected: PerfTestBody() doesn't throw an exception.\n Actual: it throws cv::Exception:\n " << e.what(); FAIL() << "Expected: PerfTestBody() doesn't throw an exception.\n Actual: it throws cv::Exception:\n " << e.what();
} }
catch(std::exception& e) catch(const std::exception& e)
{ {
metrics.terminationReason = performance_metrics::TERM_EXCEPTION; metrics.terminationReason = performance_metrics::TERM_EXCEPTION;
FAIL() << "Expected: PerfTestBody() doesn't throw an exception.\n Actual: it throws std::exception:\n " << e.what(); FAIL() << "Expected: PerfTestBody() doesn't throw an exception.\n Actual: it throws std::exception:\n " << e.what();

@ -1191,11 +1191,11 @@ namespace
prevImg.swapHandle(); nextImg.swapHandle(); prevImg.swapHandle(); nextImg.swapHandle();
#endif #endif
} }
catch (RuntimeError & e) catch (const RuntimeError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }
catch (WrapperError & e) catch (const WrapperError & e)
{ {
VX_DbgThrow(e.what()); VX_DbgThrow(e.what());
} }

@ -362,7 +362,7 @@ bool CvCaptureCAM_CMU::open( int _index )
CMU_numActiveCameras++; CMU_numActiveCameras++;
CMU_useCameraFlags[_index] = true; CMU_useCameraFlags[_index] = true;
} }
catch ( int ) catch (const int &)
{ {
return false; return false;
} }

@ -70,7 +70,7 @@ public:
return gp_result_as_string(result); return gp_result_as_string(result);
} }
friend std::ostream & operator<<(std::ostream & ostream, friend std::ostream & operator<<(std::ostream & ostream,
GPhoto2Exception & e) const GPhoto2Exception & e)
{ {
return ostream << e.method << ": " << e.what(); return ostream << e.method << ": " << e.what();
} }
@ -336,7 +336,7 @@ void DigitalCameraCapture::initContext()
CR(gp_camera_autodetect(allDevices, context)); CR(gp_camera_autodetect(allDevices, context));
CR(numDevices = gp_list_count(allDevices)); CR(numDevices = gp_list_count(allDevices));
} }
catch (GPhoto2Exception & e) catch (const GPhoto2Exception & e)
{ {
numDevices = 0; numDevices = 0;
} }
@ -389,7 +389,7 @@ DigitalCameraCapture::~DigitalCameraCapture()
gp_context_unref(context); gp_context_unref(context);
context = NULL; context = NULL;
} }
catch (GPhoto2Exception & e) catch (const GPhoto2Exception & e)
{ {
message(ERROR, "destruction error", e); message(ERROR, "destruction error", e);
} }
@ -442,7 +442,7 @@ bool DigitalCameraCapture::open(int index)
opened = true; opened = true;
return true; return true;
} }
catch (GPhoto2Exception & e) catch (const GPhoto2Exception & e)
{ {
message(WARNING, "opening device failed", e); message(WARNING, "opening device failed", e);
return false; return false;
@ -491,7 +491,7 @@ void DigitalCameraCapture::close()
rootWidget = NULL; rootWidget = NULL;
} }
} }
catch (GPhoto2Exception & e) catch (const GPhoto2Exception & e)
{ {
message(ERROR, "cannot close device properly", e); message(ERROR, "cannot close device properly", e);
} }
@ -664,7 +664,7 @@ double DigitalCameraCapture::getProperty(int propertyId) const
} }
} }
} }
catch (GPhoto2Exception & e) catch (const GPhoto2Exception & e)
{ {
char buf[128] = ""; char buf[128] = "";
sprintf(buf, "cannot get property: %d", propertyId); sprintf(buf, "cannot get property: %d", propertyId);
@ -807,7 +807,7 @@ bool DigitalCameraCapture::setProperty(int propertyId, double value)
CR(gp_widget_set_changed(widget, 0)); CR(gp_widget_set_changed(widget, 0));
} }
} }
catch (GPhoto2Exception & e) catch (const GPhoto2Exception & e)
{ {
char buf[128] = ""; char buf[128] = "";
sprintf(buf, "cannot set property: %d to %f", propertyId, value); sprintf(buf, "cannot set property: %d to %f", propertyId, value);
@ -849,7 +849,7 @@ bool DigitalCameraCapture::grabFrame()
capturedFrames++; capturedFrames++;
grabbedFrames.push_back(file); grabbedFrames.push_back(file);
} }
catch (GPhoto2Exception & e) catch (const GPhoto2Exception & e)
{ {
if (file) if (file)
gp_file_unref(file); gp_file_unref(file);
@ -873,7 +873,7 @@ bool DigitalCameraCapture::retrieveFrame(int, OutputArray outputFrame)
readFrameFromFile(file, outputFrame); readFrameFromFile(file, outputFrame);
CR(gp_file_unref(file)); CR(gp_file_unref(file));
} }
catch (GPhoto2Exception & e) catch (const GPhoto2Exception & e)
{ {
message(WARNING, "cannot read file grabbed from device", e); message(WARNING, "cannot read file grabbed from device", e);
return false; return false;
@ -914,7 +914,7 @@ int DigitalCameraCapture::findDevice(const char * deviceName) const
} }
} }
} }
catch (GPhoto2Exception & e) catch (const GPhoto2Exception & e)
{ {
; // pass ; // pass
} }
@ -980,7 +980,7 @@ CameraWidget * DigitalCameraCapture::findWidgetByName(
} }
return (it != end) ? it->second : NULL; return (it != end) ? it->second : NULL;
} }
catch (GPhoto2Exception & e) catch (const GPhoto2Exception & e)
{ {
message(WARNING, "error while searching for widget", e); message(WARNING, "error while searching for widget", e);
} }

@ -88,7 +88,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker
//trackingDetector->setMinObjectSize(Size(faceSize, faceSize)); //trackingDetector->setMinObjectSize(Size(faceSize, faceSize));
} }
} }
catch(cv::Exception& e) catch(const cv::Exception& e)
{ {
LOGD("nativeCreateObject caught cv::Exception: %s", e.what()); LOGD("nativeCreateObject caught cv::Exception: %s", e.what());
jclass je = jenv->FindClass("org/opencv/core/CvException"); jclass je = jenv->FindClass("org/opencv/core/CvException");
@ -121,7 +121,7 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker_
delete (DetectorAgregator*)thiz; delete (DetectorAgregator*)thiz;
} }
} }
catch(cv::Exception& e) catch(const cv::Exception& e)
{ {
LOGD("nativeestroyObject caught cv::Exception: %s", e.what()); LOGD("nativeestroyObject caught cv::Exception: %s", e.what());
jclass je = jenv->FindClass("org/opencv/core/CvException"); jclass je = jenv->FindClass("org/opencv/core/CvException");
@ -147,7 +147,7 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker_
{ {
((DetectorAgregator*)thiz)->tracker->run(); ((DetectorAgregator*)thiz)->tracker->run();
} }
catch(cv::Exception& e) catch(const cv::Exception& e)
{ {
LOGD("nativeStart caught cv::Exception: %s", e.what()); LOGD("nativeStart caught cv::Exception: %s", e.what());
jclass je = jenv->FindClass("org/opencv/core/CvException"); jclass je = jenv->FindClass("org/opencv/core/CvException");
@ -173,7 +173,7 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker_
{ {
((DetectorAgregator*)thiz)->tracker->stop(); ((DetectorAgregator*)thiz)->tracker->stop();
} }
catch(cv::Exception& e) catch(const cv::Exception& e)
{ {
LOGD("nativeStop caught cv::Exception: %s", e.what()); LOGD("nativeStop caught cv::Exception: %s", e.what());
jclass je = jenv->FindClass("org/opencv/core/CvException"); jclass je = jenv->FindClass("org/opencv/core/CvException");
@ -203,7 +203,7 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker_
//((DetectorAgregator*)thiz)->trackingDetector->setMinObjectSize(Size(faceSize, faceSize)); //((DetectorAgregator*)thiz)->trackingDetector->setMinObjectSize(Size(faceSize, faceSize));
} }
} }
catch(cv::Exception& e) catch(const cv::Exception& e)
{ {
LOGD("nativeStop caught cv::Exception: %s", e.what()); LOGD("nativeStop caught cv::Exception: %s", e.what());
jclass je = jenv->FindClass("org/opencv/core/CvException"); jclass je = jenv->FindClass("org/opencv/core/CvException");
@ -233,7 +233,7 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker_
((DetectorAgregator*)thiz)->tracker->getObjects(RectFaces); ((DetectorAgregator*)thiz)->tracker->getObjects(RectFaces);
*((Mat*)faces) = Mat(RectFaces, true); *((Mat*)faces) = Mat(RectFaces, true);
} }
catch(cv::Exception& e) catch(const cv::Exception& e)
{ {
LOGD("nativeCreateObject caught cv::Exception: %s", e.what()); LOGD("nativeCreateObject caught cv::Exception: %s", e.what());
jclass je = jenv->FindClass("org/opencv/core/CvException"); jclass je = jenv->FindClass("org/opencv/core/CvException");

@ -63,11 +63,11 @@ void dumpCLinfo()
i, name.c_str(), (type==CL_DEVICE_TYPE_GPU ? "GPU" : "CPU"), extensions.c_str() ); i, name.c_str(), (type==CL_DEVICE_TYPE_GPU ? "GPU" : "CPU"), extensions.c_str() );
} }
} }
catch(cl::Error& e) catch(const cl::Error& e)
{ {
LOGE( "OpenCL info: error while gathering OpenCL info: %s (%d)", e.what(), e.err() ); LOGE( "OpenCL info: error while gathering OpenCL info: %s (%d)", e.what(), e.err() );
} }
catch(std::exception& e) catch(const std::exception& e)
{ {
LOGE( "OpenCL info: error while gathering OpenCL info: %s", e.what() ); LOGE( "OpenCL info: error while gathering OpenCL info: %s", e.what() );
} }
@ -130,11 +130,11 @@ extern "C" void initCL()
LOGE("Can't init OpenCV with OpenCL TAPI"); LOGE("Can't init OpenCV with OpenCL TAPI");
haveOpenCL = true; haveOpenCL = true;
} }
catch(cl::Error& e) catch(const cl::Error& e)
{ {
LOGE("cl::Error: %s (%d)", e.what(), e.err()); LOGE("cl::Error: %s (%d)", e.what(), e.err());
} }
catch(std::exception& e) catch(const std::exception& e)
{ {
LOGE("std::exception: %s", e.what()); LOGE("std::exception: %s", e.what());
} }

@ -192,7 +192,7 @@ int main(int argc, char *argv[])
imshow("Original", img); imshow("Original", img);
waitKey(); waitKey();
} }
catch (Exception& e) catch (const Exception& e)
{ {
cout << "Feature : " << *itDesc << "\n"; cout << "Feature : " << *itDesc << "\n";
cout << e.msg << endl; cout << e.msg << endl;

@ -523,7 +523,7 @@ int main(int argc, char *argv[])
imshow(winName, result); imshow(winName, result);
imshow("Original", img); imshow("Original", img);
} }
catch (Exception& e) catch (const Exception& e)
{ {
cout << "Feature: " << *itDesc << "\n"; cout << "Feature: " << *itDesc << "\n";
cout << e.msg << endl; cout << e.msg << endl;

@ -175,7 +175,7 @@ int showImageQRCodeDetect(string in, string out)
{ {
imwrite(out, color_src, compression_params); imwrite(out, color_src, compression_params);
} }
catch (cv::Exception& ex) catch (const cv::Exception& ex)
{ {
cout << "Exception converting image to PNG format: "; cout << "Exception converting image to PNG format: ";
cout << ex.what() << '\n'; cout << ex.what() << '\n';

@ -147,7 +147,7 @@ int main(int argc, char *argv[])
desMethCmp.push_back(cumSumDist2); desMethCmp.push_back(cumSumDist2);
waitKey(); waitKey();
} }
catch (Exception& e) catch (const Exception& e)
{ {
cout << e.msg << endl; cout << e.msg << endl;
cout << "Cumulative distance cannot be computed." << endl; cout << "Cumulative distance cannot be computed." << endl;
@ -155,7 +155,7 @@ int main(int argc, char *argv[])
} }
} }
} }
catch (Exception& e) catch (const Exception& e)
{ {
cout << "Feature : " << *itDesc << "\n"; cout << "Feature : " << *itDesc << "\n";
if (itMatcher != typeAlgoMatch.end()) if (itMatcher != typeAlgoMatch.end())

@ -141,7 +141,7 @@ int main(int argc, char** argv)
// Read in the data. This can fail if not valid // Read in the data. This can fail if not valid
try { try {
read_imgList(imgList, images); read_imgList(imgList, images);
} catch (cv::Exception& e) { } catch (const cv::Exception& e) {
cerr << "Error opening file \"" << imgList << "\". Reason: " << e.msg << endl; cerr << "Error opening file \"" << imgList << "\". Reason: " << e.msg << endl;
exit(1); exit(1);
} }

@ -260,7 +260,7 @@ public:
} }
} // try } // try
catch (cv::Exception& e) catch (const cv::Exception& e)
{ {
std::cerr << "Exception: " << e.what() << std::endl; std::cerr << "Exception: " << e.what() << std::endl;
return 10; return 10;

@ -378,7 +378,7 @@ public:
} }
} // try } // try
catch (cv::Exception& e) catch (const cv::Exception& e)
{ {
std::cerr << "Exception: " << e.what() << std::endl; std::cerr << "Exception: " << e.what() << std::endl;
cleanup(); cleanup();

@ -225,7 +225,7 @@ public:
} }
} // try } // try
catch (cv::Exception& e) catch (const cv::Exception& e)
{ {
std::cerr << "Exception: " << e.what() << std::endl; std::cerr << "Exception: " << e.what() << std::endl;
return 10; return 10;

@ -226,7 +226,7 @@ public:
} // try } // try
catch (cv::Exception& e) catch (const cv::Exception& e)
{ {
std::cerr << "Exception: " << e.what() << std::endl; std::cerr << "Exception: " << e.what() << std::endl;
return 10; return 10;

@ -158,7 +158,7 @@ int d3d_app(int argc, char** argv, std::string& title)
return app.run(); return app.run();
} }
catch (cv::Exception& e) catch (const cv::Exception& e)
{ {
std::cerr << "Exception: " << e.what() << std::endl; std::cerr << "Exception: " << e.what() << std::endl;
return 10; return 10;

@ -676,7 +676,7 @@ int App::initVideoSource()
throw std::runtime_error(std::string("specify video source")); throw std::runtime_error(std::string("specify video source"));
} }
catch (std::exception e) catch (const std::exception e)
{ {
cerr << "ERROR: " << e.what() << std::endl; cerr << "ERROR: " << e.what() << std::endl;
return -1; return -1;

@ -325,7 +325,7 @@ public:
} }
catch (cv::Exception& e) catch (const cv::Exception& e)
{ {
std::cerr << "Exception: " << e.what() << std::endl; std::cerr << "Exception: " << e.what() << std::endl;
return 10; return 10;
@ -520,7 +520,7 @@ int main(int argc, char** argv)
app.create(); app.create();
return app.run(); return app.run();
} }
catch (cv::Exception& e) catch (const cv::Exception& e)
{ {
cerr << "Exception: " << e.what() << endl; cerr << "Exception: " << e.what() << endl;
return 10; return 10;

@ -256,7 +256,7 @@ int main(int argc, char** argv)
std::cout << "Interop " << (doInterop ? "ON " : "OFF") << ": processing time, msec: " << time << std::endl; std::cout << "Interop " << (doInterop ? "ON " : "OFF") << ": processing time, msec: " << time << std::endl;
} }
catch (std::exception& ex) catch (const std::exception& ex)
{ {
std::cerr << "ERROR: " << ex.what() << std::endl; std::cerr << "ERROR: " << ex.what() << std::endl;
} }

Loading…
Cancel
Save