From 984e76e12954166a8b225b27660388824ba0969d Mon Sep 17 00:00:00 2001 From: rlagneau Date: Mon, 8 Jan 2024 11:24:24 +0100 Subject: [PATCH] [FIX] Fixed a bug in the computation of the circle perfectness --- modules/imgproc/src/vpCircleHoughTransform.cpp | 4 ++-- tutorial/imgproc/hough-transform/tutorial-circle-hough.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/imgproc/src/vpCircleHoughTransform.cpp b/modules/imgproc/src/vpCircleHoughTransform.cpp index 9a457f74a5..7a15b56999 100644 --- a/modules/imgproc/src/vpCircleHoughTransform.cpp +++ b/modules/imgproc/src/vpCircleHoughTransform.cpp @@ -705,8 +705,8 @@ vpCircleHoughTransform::computeCircleCandidates() for (auto edgePoint : m_edgePointsList) { // For each center candidate CeC_i, compute the distance with each edge point EP_j d_ij = dist(CeC_i; EP_j) - float rx = edgePoint.first - centerCandidate.first; - float ry = edgePoint.second - centerCandidate.second; + float rx = edgePoint.second - centerCandidate.second; + float ry = edgePoint.first - centerCandidate.first; float r2 = rx * rx + ry * ry; if ((r2 > rmin2) && (r2 < rmax2)) { float gx = m_dIx[edgePoint.first][edgePoint.second]; diff --git a/tutorial/imgproc/hough-transform/tutorial-circle-hough.cpp b/tutorial/imgproc/hough-transform/tutorial-circle-hough.cpp index d89f7bcb51..e6f3b84e7e 100644 --- a/tutorial/imgproc/hough-transform/tutorial-circle-hough.cpp +++ b/tutorial/imgproc/hough-transform/tutorial-circle-hough.cpp @@ -70,7 +70,7 @@ int main(int argc, char **argv) const int def_dilatationKernelSize = 5; const float def_centerThresh = 70.f; const float def_circleProbaThresh = 0.725f; - const float def_circlePerfectness = 0.65f; + const float def_circlePerfectness = 0.85f; const float def_centerDistanceThresh = 5.f; const float def_radiusDifferenceThresh = 5.f; const int def_averagingWindowSize = 5;