From 0abd7625ad329e291f33f86c4771813dc34235c5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 17 Oct 2021 14:34:16 +0200 Subject: tracker/trackhat: measure points by area --- tracker-trackhat/frame.cpp | 8 +++----- tracker-trackhat/trackhat.hpp | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'tracker-trackhat') diff --git a/tracker-trackhat/frame.cpp b/tracker-trackhat/frame.cpp index 750c46df..28690fc4 100644 --- a/tracker-trackhat/frame.cpp +++ b/tracker-trackhat/frame.cpp @@ -85,6 +85,7 @@ void trackhat_preview::draw_points() void trackhat_frame::init_points(const trackHat_ExtendedPoints_t& points_, double min_size, double max_size) { trackHat_ExtendedPoints_t copy = points_; + points = {}; std::sort(std::begin(copy.m_point), std::end(copy.m_point), [](trackHat_ExtendedPoint_t p1, trackHat_ExtendedPoint_t p2) { @@ -100,11 +101,11 @@ void trackhat_frame::init_points(const trackHat_ExtendedPoints_t& points_, doubl point p = {}; - const double radius = std::sqrt(pt.m_area) / std::sqrt(M_PI); - if (i < 3 && radius >= min_size && radius <= max_size) + if (pt.m_area >= min_size && pt.m_area <= max_size) p.ok = true; p.brightness = pt.m_averageBrightness; + p.area = pt.m_area; p.W = std::max(1, pt.m_boundryRigth - pt.m_boundryLeft); p.H = std::max(1, pt.m_boundryDown - pt.m_boundryUp); p.x = trackhat_camera::sensor_size-1-pt.m_coordinateX; @@ -112,7 +113,4 @@ void trackhat_frame::init_points(const trackHat_ExtendedPoints_t& points_, doubl points[i++] = p; } - - for (; i < std::size(points); i++) - points[i] = {}; } diff --git a/tracker-trackhat/trackhat.hpp b/tracker-trackhat/trackhat.hpp index a6309f9c..01005e65 100644 --- a/tracker-trackhat/trackhat.hpp +++ b/tracker-trackhat/trackhat.hpp @@ -32,8 +32,8 @@ struct trackhat_settings : opts value threshold{b, "threshold", {0x97, 64, 0xff}}; value threshold_2{b, "threshold-2", {0x03, 1, 0xfe}}; value model{b, "model", model_mini_clip_left}; - value min_pt_size{b, "min-point-size", 2}; - value max_pt_size{b, "max-point-size", 8}; + value min_pt_size{b, "min-point-size", 10}; + value max_pt_size{b, "max-point-size", 50}; value enable_point_filter{b, "enable-point-filter", true }; value point_filter_coefficient{b, "point-filter-coefficient", { 1.5, 1, 4 }}; }; @@ -72,7 +72,7 @@ struct trackhat_metadata final : pt_runtime_traits struct point { - int brightness = 0, x, y, W, H; + int brightness = 0, area, x, y, W, H; bool ok = false; }; -- cgit v1.2.3