Merge pull request #3833 from sgrayb:houghline_bugfix
This commit is contained in:
commit
0f4d57d59e
@ -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,
|
|||||||
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user