summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/ftnoir_tracker_pt.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-08-04 15:36:51 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-08-04 13:40:26 +0000
commita1356d3811ec57161f48e586f21c618f99a0b841 (patch)
tree770ec149eb429e71b1b1ef7d7550bb129a18f64d /tracker-pt/ftnoir_tracker_pt.cpp
parent299fb737fe711d00654ec5afe4cc2afdc742f279 (diff)
tracker/pt: fix center with dynamic pose set
It was necessary to center _twice_ in order to reset dynamic pose. Put a spinlock around the code.
Diffstat (limited to 'tracker-pt/ftnoir_tracker_pt.cpp')
-rw-r--r--tracker-pt/ftnoir_tracker_pt.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp
index 5f88786a..0d99ccd0 100644
--- a/tracker-pt/ftnoir_tracker_pt.cpp
+++ b/tracker-pt/ftnoir_tracker_pt.cpp
@@ -20,7 +20,7 @@
#include <QFile>
#include <QCoreApplication>
-using namespace types;
+namespace pt_module {
Tracker_PT::Tracker_PT(pointer<pt_runtime_traits> const& traits) :
traits { traits },
@@ -69,6 +69,9 @@ void Tracker_PT::run()
if (new_frame)
{
+ while (center_flag.test_and_set())
+ (void)0;
+
*preview_frame = *frame;
point_extractor->extract_points(*frame, *preview_frame, points);
@@ -113,6 +116,8 @@ void Tracker_PT::run()
preview_frame = traits->make_preview(w, h);
}
}
+
+ center_flag.clear();
}
}
qDebug() << "pt: thread stopped";
@@ -192,7 +197,13 @@ void Tracker_PT::data(double *data)
bool Tracker_PT::center()
{
+ while (center_flag.test_and_set())
+ (void)0;
+
point_tracker.reset_state();
+
+ center_flag.clear();
+
return false;
}
@@ -217,4 +228,4 @@ bool Tracker_PT::get_cam_info(pt_camera_info* info)
return ret;
}
-
+} // ns pt_module