diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-12-15 21:51:54 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-12-15 21:51:54 +0100 |
commit | 5d0ef7070a6338262f22397d6f492e6ddc6c4dbf (patch) | |
tree | 799e9a7e1c467df8d0d68db76df0858139b2e7cb /ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | |
parent | 0383bd9685bce8528c7ae7bd42762037552b6803 (diff) |
pt: visualize model center as another point
Diffstat (limited to 'ftnoir_tracker_pt/ftnoir_tracker_pt.cpp')
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 61216000..cfeefe38 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -74,7 +74,22 @@ void Tracker::run() { QMutexLocker lock(&mutex); - const std::vector<cv::Vec2f>& points = point_extractor.extract_points(frame); + std::vector<cv::Vec2f> points = point_extractor.extract_points(frame); + + if (points.size() == PointModel::N_POINTS) + point_tracker.track(points, PointModel(s), get_focal_length()); + + { + Affine CM; + pose(&CM); + cv::Vec3f MH(s.t_MH_x, s.t_MH_y, s.t_MH_z); + cv::Vec3f p = CM.t - MH; + float fx = get_focal_length(); + cv::Vec2f p_(p[0] / p[2] * fx, p[1] / p[2] * fx); + + points.push_back(p_); + } + for (auto p : points) { auto p2 = cv::Point(p[0] * frame.cols + frame.cols/2, -p[1] * frame.cols + frame.rows/2); @@ -90,8 +105,7 @@ void Tracker::run() color, 4); } - if (points.size() == PointModel::N_POINTS) - point_tracker.track(points, PointModel(s), get_focal_length()); + video_widget->update_image(frame); } #ifdef PT_PERF_LOG |