diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-10-11 07:36:55 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-10-11 07:36:55 +0200 |
commit | 3e8b619aa87157bdfe245ce2110809ead8649dfa (patch) | |
tree | 7674eeb86d7261082823f9573c21681c7a732aec /tracker-pt/point_extractor.cpp | |
parent | 35c1983bf127baa43fcc7bf165f86817125a2923 (diff) |
tracker/pt: fix brain fart in extractor
It's multiplied by 3 just a few lines below. So ~2 is actually a
good lower bound.
Diffstat (limited to 'tracker-pt/point_extractor.cpp')
-rw-r--r-- | tracker-pt/point_extractor.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/tracker-pt/point_extractor.cpp b/tracker-pt/point_extractor.cpp index ee508b22..3b75cb1a 100644 --- a/tracker-pt/point_extractor.cpp +++ b/tracker-pt/point_extractor.cpp @@ -9,9 +9,7 @@ #include "point_extractor.h" #include <QDebug> -#ifdef DEBUG_EXTRACTION -# include "compat/timer.hpp" -#endif +#include "compat/util.hpp" #include <opencv2/videoio.hpp> @@ -61,15 +59,16 @@ void PointExtractor::extract_points(cv::Mat& frame, std::vector<vec2>& points) std::vector<int> { 256 }, std::vector<float> { 0, 256 }, false); - const int sz = hist.cols * hist.rows; - int thres = 255; - int cnt = 0; - constexpr double min_radius = 6; - constexpr double max_radius = 15; - const double radius = max(0., (max_radius-min_radius) * s.threshold / 256); - const int area = int(round(3 * M_PI * (min_radius + radius)*(min_radius+radius))); - auto ptr = reinterpret_cast<const float*>(hist.ptr(0)); - for (int i = sz-1; i > 1; i--) + + static constexpr double min_radius = 2.5; + static constexpr double max_radius = 15; + + const double radius = max(0., (max_radius-min_radius) * s.threshold / 255 + min_radius); + const float* ptr = reinterpret_cast<const float*>(hist.ptr(0)); + const unsigned area = unsigned(round(3 * M_PI * radius*radius)); + const unsigned sz = unsigned(hist.cols * hist.rows); + unsigned thres = 1; + for (unsigned i = sz-1, cnt = 0; i > 1; i--) { cnt += ptr[i]; if (cnt >= area) |