Commit 3d2c0ed9 authored by Scott Graybill's avatar Scott Graybill

Removed check on limits. A common use of HoughLines would be to restrict theta…

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.
parent 930808c2
...@@ -90,11 +90,8 @@ HoughLinesStandard( const Mat& img, float rho, float theta, ...@@ -90,11 +90,8 @@ HoughLinesStandard( const Mat& img, float rho, float theta,
int width = img.cols; int width = img.cols;
int height = img.rows; int height = img.rows;
if (max_theta < 0 || max_theta > CV_PI ) { if (max_theta < min_theta ) {
CV_Error( CV_StsBadArg, "max_theta must fall between 0 and pi" ); CV_Error( CV_StsBadArg, "max_theta must be greater than min_theta" );
}
if (min_theta < 0 || min_theta > max_theta ) {
CV_Error( CV_StsBadArg, "min_theta must fall between 0 and max_theta" );
} }
int numangle = cvRound((max_theta - min_theta) / theta); int numangle = cvRound((max_theta - min_theta) / theta);
int numrho = cvRound(((width + height) * 2 + 1) / rho); int numrho = cvRound(((width + height) * 2 + 1) / rho);
...@@ -178,7 +175,7 @@ HoughLinesStandard( const Mat& img, float rho, float theta, ...@@ -178,7 +175,7 @@ HoughLinesStandard( const Mat& img, float rho, float theta,
int n = cvFloor(idx*scale) - 1; int n = cvFloor(idx*scale) - 1;
int r = idx - (n+1)*(numrho+2) - 1; int r = idx - (n+1)*(numrho+2) - 1;
line.rho = (r - (numrho - 1)*0.5f) * rho; line.rho = (r - (numrho - 1)*0.5f) * rho;
line.angle = n * theta; line.angle = static_cast<float>(min_theta) + n * theta;
lines.push_back(Vec2f(line.rho, line.angle)); lines.push_back(Vec2f(line.rho, line.angle));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment