diff --git a/modules/line_descriptor/src/LSDDetector.cpp b/modules/line_descriptor/src/LSDDetector.cpp index de4e784f8..c511ef651 100644 --- a/modules/line_descriptor/src/LSDDetector.cpp +++ b/modules/line_descriptor/src/LSDDetector.cpp @@ -104,7 +104,7 @@ inline void checkLineExtremes( cv::Vec4f& extremes, cv::Size imageSize ) void LSDDetector::detect( const Mat& image, CV_OUT std::vector& keylines, int scale, int numOctaves, const Mat& mask ) { if( mask.data != NULL && ( mask.size() != image.size() || mask.type() != CV_8UC1 ) ) - throw std::runtime_error( "Mask error while detecting lines: please check its dimensions and that data type is CV_8UC1" ); + CV_Error( Error::StsBadArg, "Mask error while detecting lines: please check its dimensions and that data type is CV_8UC1" ); else detectImpl( image, keylines, numOctaves, scale, mask ); @@ -118,7 +118,7 @@ void LSDDetector::detect( const std::vector& images, std::vector& keyline /*check whether image depth is different from 0 */ if( image.depth() != 0 ) - throw std::runtime_error( "Error, depth image!= 0" ); + CV_Error( Error::BadDepth, "Error, depth image!= 0" ); /* create a pointer to self */ LSDDetector *lsd = const_cast( this ); diff --git a/modules/line_descriptor/src/binary_descriptor.cpp b/modules/line_descriptor/src/binary_descriptor.cpp index 903d108d8..dfa2178be 100644 --- a/modules/line_descriptor/src/binary_descriptor.cpp +++ b/modules/line_descriptor/src/binary_descriptor.cpp @@ -338,11 +338,11 @@ int BinaryDescriptor::descriptorSize() const static inline int get2Pow( int i ) { if( i >= 0 && i <= 7 ) - return (int) pow( 2, (double) i ); - + return 1 << i; else { - throw std::runtime_error( "Invalid power argument" ); + CV_Error( Error::StsBadArg, "Invalid power argument" ); + return -1; } } @@ -421,7 +421,7 @@ void BinaryDescriptor::detect( const Mat& image, CV_OUT std::vector& ke } if( mask.data != NULL && ( mask.size() != image.size() || mask.type() != CV_8UC1 ) ) - throw std::runtime_error( "Mask error while detecting lines: please check its dimensions and that data type is CV_8UC1" ); + CV_Error( Error::StsBadArg, "Mask error while detecting lines: please check its dimensions and that data type is CV_8UC1" ); else detectImpl( image, keylines, mask ); @@ -441,7 +441,7 @@ void BinaryDescriptor::detect( const std::vector& images, std::vector& ke /*check whether image depth is different from 0 */ if( image.depth() != 0 ) - throw std::runtime_error( "Warning, depth image!= 0" ); + CV_Error( Error::BadDepth, "Warning, depth image!= 0" ); /* create a pointer to self */ BinaryDescriptor *bn = const_cast( this ); @@ -547,7 +547,7 @@ void BinaryDescriptor::computeImpl( const Mat& imageSrc, std::vector& k /*check whether image's depth is different from 0 */ if( image.depth() != 0 ) - throw std::runtime_error( "Error, depth of image != 0" ); + CV_Error( Error::BadDepth, "Error, depth of image != 0" ); /* keypoints list can't be empty */ if( keylines.size() == 0 )