diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-11-26 19:43:01 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-11-26 19:45:02 +0100 |
commit | 324f47f0740dda04cc37674d817b1bfcd1a7ec48 (patch) | |
tree | 5f05f10f25f9ee3414f2a630e5e206de3b68f54c /facetracknoir | |
parent | 56c199090d3b84a187a788e0ce47ac5965e06484 (diff) |
use tracker-declared Hz
Diffstat (limited to 'facetracknoir')
-rw-r--r-- | facetracknoir/tracker.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index b4e73e08..6c48b17a 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -16,6 +16,7 @@ #include "facetracknoir.h"
#include <opencv2/core/core.hpp>
#include <cmath>
+#include <algorithm>
#if defined(_WIN32)
# include <windows.h>
@@ -59,6 +60,16 @@ void Tracker::run() { double newpose[6] = {0};
double last_post_filter[6] ;
+ int sleep_ms = 15;
+
+ if (Libraries->pTracker)
+ sleep_ms = std::min(sleep_ms, 1000 / Libraries->pTracker->preferredHz());
+
+ if (Libraries->pSecondTracker)
+ sleep_ms = std::min(sleep_ms, 1000 / Libraries->pSecondTracker->preferredHz());
+
+ qDebug() << "tracker Hz:" << 1000 / sleep_ms;
+
#if defined(_WIN32)
(void) timeBeginPeriod(1);
#endif
@@ -156,7 +167,7 @@ void Tracker::run() { }
}
- msleep(15);
+ msleep(sleep_ms);
}
#if defined(_WIN32)
(void) timeEndPeriod(1);
|