From 1a31ec8b8a4abb1c82317ae500998fc8228a50f8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 17 Oct 2021 14:30:21 +0200 Subject: tracker/pt: display points as ellipses --- tracker-pt/module/point_extractor.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tracker-pt/module/point_extractor.cpp b/tracker-pt/module/point_extractor.cpp index e679e7fc..be4823ad 100644 --- a/tracker-pt/module/point_extractor.cpp +++ b/tracker-pt/module/point_extractor.cpp @@ -250,14 +250,13 @@ static void draw_blobs(cv::Mat& preview_frame, const blob* blobs, unsigned nblob cv::Point p(iround(b.pos[0] * cx), iround(b.pos[1] * cy)); - auto circle_color = k >= PointModel::N_POINTS - ? cv::Scalar(192, 192, 192) - : cv::Scalar(255, 255, 0); + auto outline_color = k >= PointModel::N_POINTS + ? cv::Scalar(192, 192, 192) + : cv::Scalar(255, 255, 0); - const int overlay_size = iround(dpi); - - cv::circle(preview_frame, p, iround((b.radius + f(2)) * c), - circle_color, overlay_size, cv::LINE_AA); + cv::ellipse(preview_frame, p, + {iround(b.rect.width/(f)2+2*c), iround(b.rect.height/(f)2+2*c)}, + 0, 0, 360, outline_color, iround(dpi), cv::LINE_AA); char buf[16]; std::snprintf(buf, sizeof(buf), "%.2fpx", (double)b.radius); @@ -268,7 +267,7 @@ static void draw_blobs(cv::Mat& preview_frame, const blob* blobs, unsigned nblob cv::Point pos(iround(b.pos[0]*cx+offx), iround(b.pos[1]*cy+offy)); cv::putText(preview_frame, buf, pos, - cv::FONT_HERSHEY_PLAIN, overlay_size, text_color, + cv::FONT_HERSHEY_PLAIN, iround(dpi), text_color, 1); } } -- cgit v1.2.3