From 8ed9819713ad50b006097a2a6135b04a8e7d95fe Mon Sep 17 00:00:00 2001 From: quantumwebx <131485434+quantumwebx@users.noreply.github.com> Date: Sat, 17 Feb 2024 03:30:42 +0530 Subject: [PATCH] Fix bias in HoughLines with even number of rho discretization steps #25038 --- README.md | 1 + modules/imgproc/src/hough.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e812c37393..0bbf182043 100644 --- a/README.md +++ b/README.md @@ -34,3 +34,4 @@ Please read the [contribution guidelines](https://github.com/opencv/opencv/wiki/ * [Follow OpenCV on Mastodon](http://mastodon.social/@opencv) in the Fediverse * [Follow OpenCV on Twitter](https://twitter.com/opencvlive) * [OpenCV.ai](https://opencv.ai): Computer Vision and AI development services from the OpenCV team. + diff --git a/modules/imgproc/src/hough.cpp b/modules/imgproc/src/hough.cpp index 9961e9aace..d5793446d1 100644 --- a/modules/imgproc/src/hough.cpp +++ b/modules/imgproc/src/hough.cpp @@ -214,7 +214,7 @@ HoughLinesStandard( InputArray src, OutputArray lines, int type, int idx = _sort_buf[i]; int n = cvFloor(idx*scale) - 1; int r = idx - (n+1)*(numrho+2) - 1; - line.rho = (r - (numrho - 1)*0.5f) * rho; + line.rho = (r - (numrho - 1)/2) * rho; line.angle = static_cast(min_theta) + n * theta; if (type == CV_32FC2) {