Skip to content

Commit

Permalink
Fix warning: comparing floating point with == or != is unsafe [-Wfloa…
Browse files Browse the repository at this point in the history
…t-equal]
  • Loading branch information
fspindle committed Nov 16, 2023
1 parent 09f4141 commit 3b4c882
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/imgproc/src/vpCircleHoughTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/

#include <limits>

#include <visp3/core/vpImageConvert.h>
#include <visp3/core/vpImageFilter.h>
#include <visp3/core/vpImageMorphology.h>
Expand Down Expand Up @@ -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<float>::epsilon())
&& (centersAccum[y][x] > centersAccum[y][x + 1])
) {
if (left < 0)
left = x;
Expand Down

0 comments on commit 3b4c882

Please sign in to comment.