diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-09 19:15:44 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-10 03:18:58 +0100 |
commit | 42fcec5437f832c6cf0df2c6eaba89d6710d2610 (patch) | |
tree | 810ebda25d14ab13bfb0cfcfec26266666544dbc | |
parent | 6388d767f4510a3771909a91ad72ad4963d029db (diff) |
tracker/pt: reset dynamic pose on center
-rw-r--r-- | tracker-pt/ftnoir_tracker_pt.cpp | 6 | ||||
-rw-r--r-- | tracker-pt/ftnoir_tracker_pt.h | 2 | ||||
-rw-r--r-- | tracker-pt/point_tracker.cpp | 8 | ||||
-rw-r--r-- | tracker-pt/point_tracker.h | 3 |
4 files changed, 17 insertions, 2 deletions
diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index 5975f701..1fbd4373 100644 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -223,6 +223,12 @@ void Tracker_PT::data(double *data) } } +bool Tracker_PT::center() +{ + point_tracker.reset_state(); + return false; +} + Affine Tracker_PT::pose() { QMutexLocker l(&data_mtx); diff --git a/tracker-pt/ftnoir_tracker_pt.h b/tracker-pt/ftnoir_tracker_pt.h index 78bab215..35da957b 100644 --- a/tracker-pt/ftnoir_tracker_pt.h +++ b/tracker-pt/ftnoir_tracker_pt.h @@ -43,11 +43,13 @@ class Tracker_PT : public QThread, public ITracker friend class camera_dialog; friend class ::TrackerDialog_PT; + public: Tracker_PT(); ~Tracker_PT() override; module_status start_tracker(QFrame* parent_window) override; void data(double* data) override; + bool center() override; Affine pose(); int get_n_points(); diff --git a/tracker-pt/point_tracker.cpp b/tracker-pt/point_tracker.cpp index ed57235d..139e282d 100644 --- a/tracker-pt/point_tracker.cpp +++ b/tracker-pt/point_tracker.cpp @@ -84,7 +84,7 @@ void PointModel::get_d_order(const vec2* points, unsigned* d_order, const vec2& } -PointTracker::PointTracker() : init_phase(true), prev_order_valid(false) +PointTracker::PointTracker() { } @@ -407,3 +407,9 @@ vec2 PointTracker::project(const vec3& v_M, f focal_length, const Affine& X_CM) return vec2(focal_length*v_C[0]/v_C[2], focal_length*v_C[1]/v_C[2]); } +void PointTracker::reset_state() +{ + prev_order_valid = false; + init_phase = true; +} + diff --git a/tracker-pt/point_tracker.h b/tracker-pt/point_tracker.h index 2b142632..3c94535f 100644 --- a/tracker-pt/point_tracker.h +++ b/tracker-pt/point_tracker.h @@ -62,6 +62,7 @@ public: Affine pose() { return X_CM; } vec2 project(const vec3& v_M, f focal_length); vec2 project(const vec3& v_M, f focal_length, const Affine& X_CM); + void reset_state(); private: // the points in model order @@ -77,7 +78,7 @@ private: Affine X_CM; // transform from model to camera Timer t; - bool init_phase, prev_order_valid; + bool init_phase = true, prev_order_valid = false; }; } // ns types |