diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2021-10-17 15:17:36 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-03-29 00:04:48 +0200 |
commit | 5ee257b417f5da0aad0e88b512ea5738c8367d09 (patch) | |
tree | 4f40591a0546438dc1103fff214a2be52b620518 /tracker-trackhat | |
parent | bc5584d601110b5215650d41a693ce64d69ca4cb (diff) |
tracker/trackhat: add point area display
Diffstat (limited to 'tracker-trackhat')
-rw-r--r-- | tracker-trackhat/frame.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tracker-trackhat/frame.cpp b/tracker-trackhat/frame.cpp index 28690fc4..d8fae002 100644 --- a/tracker-trackhat/frame.cpp +++ b/tracker-trackhat/frame.cpp @@ -65,7 +65,7 @@ void trackhat_preview::draw_points() continue; constexpr int sz = trackhat_camera::sensor_size; - constexpr f scaling_factor = 5; + constexpr f scaling_factor = 10; const int x = pt.x * frame_bgr.cols / sz, y = pt.y * frame_bgr.rows / sz; const f dpi = (f)frame_bgr.cols / f(320); const int W = std::max(1, iround(pt.W * frame_bgr.cols * scaling_factor / sz)), @@ -79,6 +79,17 @@ void trackhat_preview::draw_points() 0, 0, 360, point_color, -1, cv::LINE_AA); cv::ellipse(frame_bgr, {x, y}, {iround(W + 2*dpi), iround(H + 2*dpi)}, 0, 0, 360, outline_color, iround(dpi), cv::LINE_AA); + + char buf[16]; + std::snprintf(buf, sizeof(buf), "%dpx", pt.area); + auto text_color = pt.ok + ? cv::Scalar(0, 0, 255) + : cv::Scalar(160, 160, 160); + const int offx = iround(W + 9*dpi), offy = H*3/2; + + cv::putText(frame_bgr, buf, {x+offx, y+offy}, + cv::FONT_HERSHEY_PLAIN, iround(dpi), text_color, + 1); } } |