summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir/tracker.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-10-24 20:36:09 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-10-24 20:36:09 +0200
commite248b039d1110dddc5c3ee13172b75a818f6d265 (patch)
tree520a2780cd721810c1df117e3fc981defc9de342 /facetracknoir/tracker.cpp
parent542c5e475f151ba7f531e3128a3bcead247a317c (diff)
ignore confid values wrt submitting pose to game
Signed-off-by: Stanislaw Halik <sthalik@misaki.pl>
Diffstat (limited to 'facetracknoir/tracker.cpp')
-rw-r--r--facetracknoir/tracker.cpp83
1 files changed, 31 insertions, 52 deletions
diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp
index c0fe4eef..980415c8 100644
--- a/facetracknoir/tracker.cpp
+++ b/facetracknoir/tracker.cpp
@@ -35,8 +35,8 @@ Tracker::Tracker( FaceTrackNoIR *parent ) :
enabled(true)
{
// Retieve the pointer to the parent
- mainApp = parent;
- // Load the settings from the INI-file
+ mainApp = parent;
+ // Load the settings from the INI-file
}
Tracker::~Tracker()
@@ -60,12 +60,7 @@ static void get_curve(double pos, double& out, THeadPoseDOF& axis) {
/** QThread run method @override **/
void Tracker::run() {
- T6DOF target_camera;
- T6DOF new_camera;
-
- /** Direct Input variables **/
- T6DOF offset_camera;
- T6DOF gameoutput_camera;
+ T6DOF offset_camera, new_camera, gameoutput_camera, target_camera, target_camera2;
bool bTracker1Confid = false;
bool bTracker2Confid = false;
@@ -78,14 +73,10 @@ void Tracker::run() {
#endif
for (;;)
- {
+ {
if (should_quit)
break;
- //
- // The second tracker serves as 'secondary'. So if an axis is written by the second tracker it CAN be overwritten by the Primary tracker.
- // This is enforced by the sequence below.
- //
if (Libraries->pSecondTracker) {
bTracker2Confid = Libraries->pSecondTracker->GiveHeadPoseData(newpose);
}
@@ -97,57 +88,45 @@ void Tracker::run() {
{
QMutexLocker foo(&mtx);
const bool confid = bTracker1Confid || bTracker2Confid;
-
+
if ( confid ) {
for (int i = 0; i < 6; i++)
mainApp->axis(i).headPos = newpose[i];
}
-
- //
- // If Center is pressed, copy the current values to the offsets.
- //
+
if (do_center) {
- //
- // Only copy valid values
- //
for (int i = 0; i < 6; i++)
- offset_camera.axes[i] = mainApp->axis(i).headPos;
-
+ offset_camera.axes[i] = target_camera.axes[i];
+
do_center = false;
-
+
if (Libraries->pFilter)
Libraries->pFilter->Initialize();
}
-
- if (confid && enabled) {
- // get values
+
+ if (enabled && confid)
+ {
for (int i = 0; i < 6; i++)
target_camera.axes[i] = mainApp->axis(i).headPos;
-
- // do the centering
- target_camera = target_camera - offset_camera;
-
- //
- // Use advanced filtering, when a filter was selected.
- //
- if (Libraries->pFilter) {
- for (int i = 0; i < 6; i++)
- last_post_filter[i] = gameoutput_camera.axes[i];
- Libraries->pFilter->FilterHeadPoseData(target_camera.axes, new_camera.axes, last_post_filter);
- }
- else {
- new_camera = target_camera;
- }
-
- for (int i = 0; i < 6; i++) {
- get_curve(new_camera.axes[i], output_camera.axes[i], mainApp->axis(i));
- }
-
- // Send the headpose to the game
- if (Libraries->pProtocol) {
- gameoutput_camera = output_camera;
- Libraries->pProtocol->sendHeadposeToGame( gameoutput_camera.axes ); // degrees & centimeters
- }
+
+ target_camera2 = target_camera - offset_camera;
+ }
+
+ if (Libraries->pFilter) {
+ for (int i = 0; i < 6; i++)
+ last_post_filter[i] = gameoutput_camera.axes[i];
+ Libraries->pFilter->FilterHeadPoseData(target_camera2.axes, new_camera.axes, last_post_filter);
+ } else {
+ new_camera = target_camera2;
+ }
+
+ for (int i = 0; i < 6; i++) {
+ get_curve(new_camera.axes[i], output_camera.axes[i], mainApp->axis(i));
+ }
+
+ if (Libraries->pProtocol) {
+ gameoutput_camera = output_camera;
+ Libraries->pProtocol->sendHeadposeToGame( gameoutput_camera.axes ); // degrees & centimeters
}
}