From 3e8b619aa87157bdfe245ce2110809ead8649dfa Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 11 Oct 2016 07:36:55 +0200 Subject: 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. --- tracker-pt/point_extractor.cpp | 23 +++++++++++------------ tracker-pt/point_extractor.h | 9 +++------ 2 files changed, 14 insertions(+), 18 deletions(-) (limited to 'tracker-pt') 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 -#ifdef DEBUG_EXTRACTION -# include "compat/timer.hpp" -#endif +#include "compat/util.hpp" #include @@ -61,15 +59,16 @@ void PointExtractor::extract_points(cv::Mat& frame, std::vector& points) std::vector { 256 }, std::vector { 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(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(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) diff --git a/tracker-pt/point_extractor.h b/tracker-pt/point_extractor.h index 9ac2d695..a0afa45d 100644 --- a/tracker-pt/point_extractor.h +++ b/tracker-pt/point_extractor.h @@ -6,11 +6,10 @@ * copyright notice and this permission notice appear in all copies. */ -#ifndef POINTEXTRACTOR_H -#define POINTEXTRACTOR_H +#pragma once -#include -#include +#include +#include #include "ftnoir_tracker_pt_settings.h" @@ -48,5 +47,3 @@ private: std::vector blobs; }; - -#endif //POINTEXTRACTOR_H -- cgit v1.2.3