diff --git a/modules/imgproc/src/vpCircleHoughTransform.cpp b/modules/imgproc/src/vpCircleHoughTransform.cpp index f1be206cd4..ea4839c104 100644 --- a/modules/imgproc/src/vpCircleHoughTransform.cpp +++ b/modules/imgproc/src/vpCircleHoughTransform.cpp @@ -28,6 +28,8 @@ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ +#include + #include #include #include @@ -476,9 +478,9 @@ vpCircleHoughTransform::computeCenterCandidates() for (int y = 0; y < nbRowsAccum; y++) { int left = -1; for (int x = 0; x < nbColsAccum; x++) { - if (centersAccum[y][x] >= m_algoParams.m_centerThresh - && centersAccum[y][x] == centerCandidatesMaxima[y][x] - && centersAccum[y][x] > centersAccum[y][x + 1] + if ((centersAccum[y][x] >= m_algoParams.m_centerThresh) + && (std::fabs(centersAccum[y][x] - centerCandidatesMaxima[y][x]) < std::numeric_limits::epsilon()) + && (centersAccum[y][x] > centersAccum[y][x + 1]) ) { if (left < 0) left = x;