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/ftnoir_tracker_pt.cpp | |
parent | aa6b0e3841991272668ea02b1a7166c03e59e84a (diff) |
tracker/pt: show right overlay wrt frame size
Diffstat (limited to 'tracker-pt/ftnoir_tracker_pt.cpp')
-rw-r--r-- | tracker-pt/ftnoir_tracker_pt.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index 9b78a16a..d0f65e7b 100644 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -135,16 +135,23 @@ void Tracker_PT::run() auto fun = [&](const vec2& p, const cv::Scalar& color) { using std::round; + using std::sqrt; + using std::max; + + static constexpr int frame_size = 400; + const int size = max(1, iround(sqrt(frame.rows*frame.rows + frame.cols*frame.cols) / frame_size)); + const int len = size * 10; + cv::Point p2(int(round(p[0] * frame_.cols + frame_.cols/2)), int(round(-p[1] * frame_.cols + frame_.rows/2))); cv::line(frame_, - cv::Point(p2.x - 20, p2.y), - cv::Point(p2.x + 20, p2.y), + cv::Point(p2.x - len, p2.y), + cv::Point(p2.x + len, p2.y), color, 2); cv::line(frame_, - cv::Point(p2.x, p2.y - 20), - cv::Point(p2.x, p2.y + 20), + cv::Point(p2.x, p2.y - len), + cv::Point(p2.x, p2.y + len), color, 2); }; |