From 3d2c0ed97fdc59a444fe587fded32a02332cc6cf Mon Sep 17 00:00:00 2001 From: Scott Graybill Date: Fri, 13 Mar 2015 17:04:13 -0700 Subject: [PATCH] Removed check on limits. A common use of HoughLines would be to restrict theta to be between a small negative number and a small positive number, e.g. -pi/16 to pi/16. This wasn't possible with the previous checks. --- modules/imgproc/src/hough.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/modules/imgproc/src/hough.cpp b/modules/imgproc/src/hough.cpp index 5172024b7..e11df27f0 100644 --- a/modules/imgproc/src/hough.cpp +++ b/modules/imgproc/src/hough.cpp @@ -90,11 +90,8 @@ HoughLinesStandard( const Mat& img, float rho, float theta, int width = img.cols; int height = img.rows; - if (max_theta < 0 || max_theta > CV_PI ) { - CV_Error( CV_StsBadArg, "max_theta must fall between 0 and pi" ); - } - if (min_theta < 0 || min_theta > max_theta ) { - CV_Error( CV_StsBadArg, "min_theta must fall between 0 and max_theta" ); + if (max_theta < min_theta ) { + CV_Error( CV_StsBadArg, "max_theta must be greater than min_theta" ); } int numangle = cvRound((max_theta - min_theta) / theta); int numrho = cvRound(((width + height) * 2 + 1) / rho); @@ -178,7 +175,7 @@ HoughLinesStandard( const Mat& img, float rho, float theta, int n = cvFloor(idx*scale) - 1; int r = idx - (n+1)*(numrho+2) - 1; line.rho = (r - (numrho - 1)*0.5f) * rho; - line.angle = n * theta; + line.angle = static_cast(min_theta) + n * theta; lines.push_back(Vec2f(line.rho, line.angle)); } }