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/ftnoir_tracker_pt.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/ftnoir_tracker_pt.cpp')
-rw-r--r-- | tracker-pt/ftnoir_tracker_pt.cpp | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index 5c3e338a..8ed17a4f 100644 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -92,12 +92,24 @@ void Tracker_PT::run() ever_success = true; } - auto fun = [&](const vec2& p, const cv::Scalar& color) { + Affine X_CM; + { + QMutexLocker l(&data_mtx); + X_CM = point_tracker.pose(); + } + + Affine X_MH(mat33::eye(), vec3(s.t_MH_x, s.t_MH_y, s.t_MH_z)); // just copy pasted these lines from below + Affine X_GH = X_CM * X_MH; + vec3 p = X_GH.t; // head (center?) position in global space + vec2 p_(p[0] / p[2] * fx, p[1] / p[2] * fx); // projected to screen + static constexpr int len = 9; + static const cv::Scalar(0, 0, 255); - cv::Point p2(iround(p[0] * preview_frame.cols + preview_frame.cols/2), - iround(-p[1] * preview_frame.cols + preview_frame.rows/2)); + cv::Point p2(iround(p_[0] * preview_frame.cols + preview_frame.cols/2), + iround(-p_[1] * preview_frame.cols + preview_frame.rows/2)); + static const cv::Scalar color(0, 0, 255); cv::line(preview_frame, cv::Point(p2.x - len, p2.y), cv::Point(p2.x + len, p2.y), @@ -108,25 +120,6 @@ void Tracker_PT::run() cv::Point(p2.x, p2.y + len), color, 1); - }; - - for (unsigned i = 0; i < points.size(); i++) - { - fun(points[i], cv::Scalar(0, 255, 0)); - } - - { - Affine X_CM; - { - QMutexLocker l(&data_mtx); - X_CM = point_tracker.pose(); - } - - Affine X_MH(mat33::eye(), vec3(s.t_MH_x, s.t_MH_y, s.t_MH_z)); // just copy pasted these lines from below - Affine X_GH = X_CM * X_MH; - vec3 p = X_GH.t; // head (center?) position in global space - vec2 p_(p[0] / p[2] * fx, p[1] / p[2] * fx); // projected to screen - fun(p_, cv::Scalar(0, 0, 255)); } video_widget->update_image(preview_frame); |