Skip to content

Commit

Permalink
fix link error with static variables of vpCircleHoughTransform
Browse files Browse the repository at this point in the history
  • Loading branch information
SamFlt committed Feb 7, 2024
1 parent f75c627 commit 476ee4c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1160,8 +1160,8 @@ class VISP_EXPORT vpCircleHoughTransform
*/
friend VISP_EXPORT std::ostream &operator<<(std::ostream &os, const vpCircleHoughTransform &detector);

static const unsigned char edgeMapOn = 255;
static const unsigned char edgeMapOff = 0;
static const unsigned char edgeMapOn;
static const unsigned char edgeMapOff;

protected:
/**
Expand Down
38 changes: 21 additions & 17 deletions modules/imgproc/src/vpCircleHoughTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@

#include <visp3/imgproc/vpCircleHoughTransform.h>

// Static variables
const unsigned char vpCircleHoughTransform::edgeMapOn = 255;
const unsigned char vpCircleHoughTransform::edgeMapOff = 0;

#if (VISP_CXX_STANDARD == VISP_CXX_STANDARD_98)
namespace
{
Expand Down Expand Up @@ -249,7 +253,7 @@ vpCircleHoughTransform::detect(const vpImage<unsigned char> &I, const int &nbCir
auto hasBetterProba
= [](std::pair<size_t, float> a, std::pair<size_t, float> b) {
return (a.second > b.second);
};
};
#endif
std::sort(v_id_proba.begin(), v_id_proba.end(), hasBetterProba);

Expand Down Expand Up @@ -694,19 +698,19 @@ vpCircleHoughTransform::computeCenterCandidates()
const int &offsetX, const int &offsetY,
const int &nbCols, const int &nbRows,
vpImage<float> &accum, bool &hasToStop) {
if (((x - offsetX) < 0) ||
((x - offsetX) >= nbCols) ||
((y - offsetY) < 0) ||
((y - offsetY) >= nbRows)
) {
hasToStop = true;
}
else {
float dx = (x_orig - static_cast<float>(x));
float dy = (y_orig - static_cast<float>(y));
accum[y - offsetY][x - offsetX] += std::abs(dx) + std::abs(dy);
}
};
if (((x - offsetX) < 0) ||
((x - offsetX) >= nbCols) ||
((y - offsetY) < 0) ||
((y - offsetY) >= nbRows)

Check warning on line 704 in modules/imgproc/src/vpCircleHoughTransform.cpp

View check run for this annotation

Codecov / codecov/patch

modules/imgproc/src/vpCircleHoughTransform.cpp#L701-L704

Added lines #L701 - L704 were not covered by tests
) {
hasToStop = true;

Check warning on line 706 in modules/imgproc/src/vpCircleHoughTransform.cpp

View check run for this annotation

Codecov / codecov/patch

modules/imgproc/src/vpCircleHoughTransform.cpp#L706

Added line #L706 was not covered by tests
}
else {
float dx = (x_orig - static_cast<float>(x));
float dy = (y_orig - static_cast<float>(y));
accum[y - offsetY][x - offsetX] += std::abs(dx) + std::abs(dy);

Check warning on line 711 in modules/imgproc/src/vpCircleHoughTransform.cpp

View check run for this annotation

Codecov / codecov/patch

modules/imgproc/src/vpCircleHoughTransform.cpp#L709-L711

Added lines #L709 - L711 were not covered by tests
}
};

Check warning on line 713 in modules/imgproc/src/vpCircleHoughTransform.cpp

View check run for this annotation

Codecov / codecov/patch

modules/imgproc/src/vpCircleHoughTransform.cpp#L713

Added line #L713 was not covered by tests
#endif

updateAccumulator(x1, y1, x_low, y_low,
Expand Down Expand Up @@ -851,8 +855,8 @@ vpCircleHoughTransform::computeCenterCandidates()
#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
auto sortingCenters = [](const std::pair<std::pair<float, float>, float> &position_vote_a,
const std::pair<std::pair<float, float>, float> &position_vote_b) {
return position_vote_a.second > position_vote_b.second;
};
return position_vote_a.second > position_vote_b.second;

Check warning on line 858 in modules/imgproc/src/vpCircleHoughTransform.cpp

View check run for this annotation

Codecov / codecov/patch

modules/imgproc/src/vpCircleHoughTransform.cpp#L858

Added line #L858 was not covered by tests
};
#endif

std::sort(merged_peaks_position_votes.begin(), merged_peaks_position_votes.end(), sortingCenters);
Expand Down Expand Up @@ -988,7 +992,7 @@ vpCircleHoughTransform::computeCircleCandidates()
r_effective = weigthedSumRadius / votes;
}
return r_effective;
};
};
#endif

// Merging similar candidates
Expand Down

0 comments on commit 476ee4c

Please sign in to comment.