diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-16 08:59:21 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-16 08:59:21 +0100 |
commit | 6cf93c06abad63721bf66f695587a98377b6178d (patch) | |
tree | af029c638c9a62d6c34bc95a4dc3060c5d2f8921 /tracker-pt/point_extractor.cpp | |
parent | 88849a1ca4b7c253f7427d361443a496c1b5fe28 (diff) |
cv/video-frame, tracker/pt: add hidpi preview support
Diffstat (limited to 'tracker-pt/point_extractor.cpp')
-rw-r--r-- | tracker-pt/point_extractor.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tracker-pt/point_extractor.cpp b/tracker-pt/point_extractor.cpp index 0904d9cb..defdcedc 100644 --- a/tracker-pt/point_extractor.cpp +++ b/tracker-pt/point_extractor.cpp @@ -323,7 +323,9 @@ end: { blob& b = blobs[k]; - static const f offx = 10, offy = 7.5; + const f dpi = preview_frame.cols / f(320); + const f offx = 10 * dpi, offy = 7.5 * dpi; + const f cx = preview_frame.cols / f(frame.cols), cy = preview_frame.rows / f(frame.rows), c_ = (cx+cy)/2; @@ -337,7 +339,9 @@ end: ? cv::Scalar(192, 192, 192) : cv::Scalar(255, 255, 0); - cv::circle(preview_frame, p, iround((b.radius + 3.3) * c_ * c_fract), circle_color, 1, cv::LINE_AA, fract_bits); + const f overlay_size = dpi > 1.5 ? 2 : 1; + + cv::circle(preview_frame, p, iround((b.radius + 3.3) * c_ * c_fract), circle_color, overlay_size, cv::LINE_AA, fract_bits); char buf[16]; buf[sizeof(buf)-1] = '\0'; @@ -349,8 +353,8 @@ end: 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, - 1, text_color, 1); + cv::FONT_HERSHEY_PLAIN, overlay_size, text_color, + 1); } // End of mean shift code. At this point, blob positions are updated with hopefully less noisy less biased values. |