Merge pull request #22466 from sturkmen72:patch-4

Improvement on error handling for HoughCircles
pull/21745/head
Alexander Smorkalov 2 years ago committed by GitHub
commit b26fc6f31b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      modules/imgproc/src/hough.cpp

@ -2293,6 +2293,9 @@ static void HoughCircles( InputArray _image, OutputArray _circles,
break; break;
case HOUGH_GRADIENT_ALT: case HOUGH_GRADIENT_ALT:
{ {
if( param2 >= 1 )
CV_Error( Error::StsOutOfRange, "when using HOUGH_GRADIENT_ALT method, param2 parameter must be smaller than 1.0" );
std::vector<EstimatedCircle> circles; std::vector<EstimatedCircle> circles;
Mat image = _image.getMat(); Mat image = _image.getMat();
HoughCirclesAlt(image, circles, dp, minDist, minRadius, maxRadius, param1, param2); HoughCirclesAlt(image, circles, dp, minDist, minRadius, maxRadius, param1, param2);
@ -2320,7 +2323,7 @@ static void HoughCircles( InputArray _image, OutputArray _circles,
} }
break; break;
default: default:
CV_Error( Error::StsBadArg, "Unrecognized method id. Actually only CV_HOUGH_GRADIENT is supported." ); CV_Error( Error::StsBadArg, "Unrecognized method id. Actually supported methods are HOUGH_GRADIENT and HOUGH_GRADIENT_ALT" );
} }
} }

Loading…
Cancel
Save