diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-12-09 18:45:48 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-12-09 18:45:48 +0100 |
commit | a26f0a51ccc21067dbacf6f9f5bcd8d4fe6dd15e (patch) | |
tree | 631fdc8a57db6cbaba89a30eba528125b303fac5 /tracker-pt/point_extractor.cpp | |
parent | aa6b0e3841991272668ea02b1a7166c03e59e84a (diff) |
tracker/pt: show right overlay wrt frame size
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 272e73c0..d18ba513 100644 --- a/tracker-pt/point_extractor.cpp +++ b/tracker-pt/point_extractor.cpp @@ -195,16 +195,20 @@ void PointExtractor::extract_points(cv::Mat& frame, std::vector<vec2>& points) blob b(radius, cv::Vec2d(m10 / N, m01 / N), N/sqrt(double(cnt)), rect); blobs.push_back(b); + + static constexpr int frame_size = 400; + const int size = std::max(1, iround(std::sqrt(frame.rows*frame.rows + frame.cols*frame.cols) / frame_size)); + { char buf[64]; sprintf(buf, "%.2fpx", radius); cv::putText(frame, buf, - cv::Point((int)round(b.pos[0]+30), (int)round(b.pos[1]+20)), - cv::FONT_HERSHEY_DUPLEX, - 1, + cv::Point((int)round(b.pos[0]+15*size), (int)round(b.pos[1]+10*size)), + cv::FONT_HERSHEY_PLAIN, + size, cv::Scalar(0, 0, 255), - 1); + 2); } if (idx >= max_blobs) goto end; |