diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2021-10-17 14:34:16 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-03-29 00:04:48 +0200 |
commit | 0abd7625ad329e291f33f86c4771813dc34235c5 (patch) | |
tree | 3db488adf748b2072c7776513ceecc9b086d3cee /tracker-trackhat | |
parent | 377a965bbb2661d6fa08dfc05e37c43ee172452f (diff) |
tracker/trackhat: measure points by area
Diffstat (limited to 'tracker-trackhat')
-rw-r--r-- | tracker-trackhat/frame.cpp | 8 | ||||
-rw-r--r-- | tracker-trackhat/trackhat.hpp | 6 |
2 files changed, 6 insertions, 8 deletions
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<slider_value> threshold{b, "threshold", {0x97, 64, 0xff}}; value<slider_value> threshold_2{b, "threshold-2", {0x03, 1, 0xfe}}; value<model_type> model{b, "model", model_mini_clip_left}; - value<double> min_pt_size{b, "min-point-size", 2}; - value<double> max_pt_size{b, "max-point-size", 8}; + value<double> min_pt_size{b, "min-point-size", 10}; + value<double> max_pt_size{b, "max-point-size", 50}; value<bool> enable_point_filter{b, "enable-point-filter", true }; value<slider_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; }; |