summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/ftnoir_tracker_pt.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-07-19 08:10:42 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-07-19 08:10:42 +0200
commit0b6289589656e957c070d46b65ef4e93707324f3 (patch)
tree0131cca6948035c1281a261fe8666013558e144d /tracker-pt/ftnoir_tracker_pt.cpp
parent223ff7abf556d7af4b1aeb63a4dc1664fd9d6161 (diff)
tracker/pt: reduce locking
Diffstat (limited to 'tracker-pt/ftnoir_tracker_pt.cpp')
-rw-r--r--tracker-pt/ftnoir_tracker_pt.cpp40
1 files changed, 33 insertions, 7 deletions
diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp
index c58f3f6f..48dc19c5 100644
--- a/tracker-pt/ftnoir_tracker_pt.cpp
+++ b/tracker-pt/ftnoir_tracker_pt.cpp
@@ -20,10 +20,11 @@
//-----------------------------------------------------------------------------
Tracker_PT::Tracker_PT() :
- video_widget(NULL),
- video_frame(NULL),
- ever_success(false),
- commands(0)
+ video_widget(nullptr),
+ video_frame(nullptr),
+ point_count(0),
+ commands(0),
+ ever_success(false)
{
connect(s.b.get(), SIGNAL(saving()), this, SLOT(apply_settings()));
}
@@ -102,9 +103,11 @@ void Tracker_PT::run()
if (new_frame && !frame_.empty())
{
- const auto& points = point_extractor.extract_points(frame_);
+ point_extractor.extract_points(frame_, points);
+ point_count = points.size();
f fx;
+
if (!get_focal_length(fx))
continue;
@@ -116,8 +119,6 @@ void Tracker_PT::run()
ever_success = true;
}
- Affine X_CM = pose();
-
std::function<void(const vec2&, const cv::Scalar)> fun = [&](const vec2& p, const cv::Scalar color)
{
using std::round;
@@ -141,6 +142,12 @@ void Tracker_PT::run()
}
{
+ 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
@@ -236,6 +243,25 @@ void Tracker_PT::data(double *data)
}
}
+Affine Tracker_PT::pose()
+{
+ QMutexLocker l(&data_mtx);
+
+ return point_tracker.pose();
+}
+
+int Tracker_PT::get_n_points()
+{
+ return int(point_count);
+}
+
+bool Tracker_PT::get_cam_info(CamInfo* info)
+{
+ QMutexLocker lock(&camera_mtx);
+
+ return camera.get_info(*info);
+}
+
#include "ftnoir_tracker_pt_dialog.h"
OPENTRACK_DECLARE_TRACKER(Tracker_PT, TrackerDialog_PT, TrackerDll)