diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-03-25 15:38:18 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-03-25 15:38:18 +0100 |
commit | 105069bb20284abb3ded7a50ac317cea2c758fe9 (patch) | |
tree | c77d5aa1e61a701b65114e8231580cdaef35e9bc | |
parent | d53ef58b1f043a8f356a1ed1d8c713d202e92cae (diff) |
pt: don't return zeros when last frame had no result
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 8 | ||||
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 8b5bb328..acf4daa0 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -23,7 +23,7 @@ Tracker::Tracker() commands(0), video_widget(NULL), video_frame(NULL), - success(false) + ever_success(false) { connect(s.b.get(), SIGNAL(saving()), this, SLOT(apply_settings())); } @@ -77,7 +77,9 @@ void Tracker::run() std::vector<cv::Vec2f> points = point_extractor.extract_points(frame); - success = points.size() == PointModel::N_POINTS; + bool success = points.size() == PointModel::N_POINTS; + + ever_success |= success; if (success) point_tracker.track(points, PointModel(s), get_focal_length(), s.dynamic_pose); @@ -162,7 +164,7 @@ void Tracker::StopTracker(bool exit) void Tracker::data(THeadPoseData *data) { - if (success) + if (ever_success) { Affine X_CM = pose(); diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.h b/ftnoir_tracker_pt/ftnoir_tracker_pt.h index 7fce812d..349cf2c8 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.h @@ -72,7 +72,7 @@ private: settings s; Timer time; - volatile bool success; + volatile bool ever_success; static constexpr double rad2deg = 180.0/3.14159265; static constexpr double deg2rad = 3.14159265/180.0; |