diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-03-03 11:53:09 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-03-03 11:53:09 +0100 |
commit | b7c69b1b1add8d5a0df52da8a8efd7f5d70dcd19 (patch) | |
tree | bfd0bc7b71575e078d86ae2e7bb92c7a8c1eb036 /tracker-pt/point_extractor.cpp | |
parent | e845694bdbe7e0bc56e59ea8c33850021664048d (diff) |
tracker/pt: show average point radius on the displayopentrack-2.3.1_fix3
Helps with choosing automatic threshold slider position.
Diffstat (limited to 'tracker-pt/point_extractor.cpp')
-rw-r--r-- | tracker-pt/point_extractor.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/tracker-pt/point_extractor.cpp b/tracker-pt/point_extractor.cpp index 8cd4e1f3..4bd92d44 100644 --- a/tracker-pt/point_extractor.cpp +++ b/tracker-pt/point_extractor.cpp @@ -194,14 +194,33 @@ void PointExtractor::extract_points(const cv::Mat& frame, cv::Mat& preview_frame blobs.push_back(b); { - char buf[64]; - sprintf(buf, "%.2fpx", radius); - static const vec2 off(10, 7.5); + static const f offx = 10, offy = 7.5; const f cx = preview_frame.cols / f(frame.cols), cy = preview_frame.rows / f(frame.rows); + cv::Point p(iround(b.pos[0] * cx), iround(b.pos[1] * cy)); + + static const cv::Scalar color(0, 255, 0); + + cv::circle(preview_frame, p, b.radius, color); + + { + const int len = iround(b.radius * 1.25) + 1; + cv::line(preview_frame, + cv::Point(p.x - len, p.y), + cv::Point(p.x + len, p.y), + color); + cv::line(preview_frame, + cv::Point(p.x, p.y - len), + cv::Point(p.x, p.y + len), + color); + } + + char buf[64]; + sprintf(buf, "%.2fpx", radius); + cv::putText(preview_frame, buf, - cv::Point(iround(b.pos[0]*cx+off[0]), iround(b.pos[1]*cy+off[1])), + cv::Point(iround(b.pos[0]*cx+offx), iround(b.pos[1]*cy+offy)), cv::FONT_HERSHEY_PLAIN, 1, cv::Scalar(0, 0, 255), |