From ddc63cdda186fe31435fde839c3d5b68040a0d0f Mon Sep 17 00:00:00 2001 From: Wim Vriend Date: Fri, 21 Sep 2012 11:09:15 +0000 Subject: Fixed centering when no filter is selected git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@154 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb --- FaceTrackNoIR/tracker.cpp | 25 +++++++++++++------------ FaceTrackNoIR/tracker.h | 4 ++-- 2 files changed, 15 insertions(+), 14 deletions(-) (limited to 'FaceTrackNoIR') diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp index e28fd7d7..5b387555 100644 --- a/FaceTrackNoIR/tracker.cpp +++ b/FaceTrackNoIR/tracker.cpp @@ -23,6 +23,7 @@ *********************************************************************************/ /* Modifications (last one on top): + 20120921 - WVR: Fixed centering when no filter is selected. 20120917 - WVR: Added Mouse-buttons to ShortKeys. 20120827 - WVR: Signal tracking = false to Curve-widget(s) when quitting run(). Also when Alternative Pitch curve is used. 20120805 - WVR: The FunctionConfig-widget is used to configure the Curves. It was tweaked some more, because the Accela filter now also @@ -619,12 +620,12 @@ T6DOF gameoutput_camera(0,0,0,0,0,0); pFilter->FilterHeadPoseData(¤t_camera.position, &target_camera.position, &new_camera.position, Tracker::Pitch.newSample); } else { - new_camera.position.x = getSmoothFromList( &X.rawList ) - X.offset_headPos; - new_camera.position.y = getSmoothFromList( &Y.rawList ) - Y.offset_headPos; - new_camera.position.z = getSmoothFromList( &Z.rawList ) - Z.offset_headPos; - new_camera.position.pitch = getSmoothFromList( &Pitch.rawList ) - Pitch.offset_headPos; - new_camera.position.yaw = getSmoothFromList( &Yaw.rawList ) - Yaw.offset_headPos; - new_camera.position.roll = getSmoothFromList( &Roll.rawList ) - Roll.offset_headPos; + new_camera.position.x = getSmoothFromList( &X.rawList ) - offset_camera.position.x; + new_camera.position.y = getSmoothFromList( &Y.rawList ) - offset_camera.position.y; + new_camera.position.z = getSmoothFromList( &Z.rawList ) - offset_camera.position.z; + new_camera.position.pitch = getSmoothFromList( &Pitch.rawList ) - offset_camera.position.pitch; + new_camera.position.yaw = getSmoothFromList( &Yaw.rawList ) - offset_camera.position.yaw; + new_camera.position.roll = getSmoothFromList( &Roll.rawList ) - offset_camera.position.roll; } output_camera.position.x = X.invert * X.curvePtr->getValue(new_camera.position.x); output_camera.position.y = Y.invert * Y.curvePtr->getValue(new_camera.position.y); @@ -826,13 +827,13 @@ void Tracker::addRaw2List ( QList *rawList, float maxIndex, float raw ) { // Get the raw headpose, so it can be displayed. // void Tracker::getHeadPose( THeadPoseData *data ) { - data->x = Tracker::X.headPos - Tracker::X.offset_headPos; // centimeters - data->y = Tracker::Y.headPos - Tracker::Y.offset_headPos; - data->z = Tracker::Z.headPos - Tracker::Z.offset_headPos; + data->x = Tracker::X.headPos; // centimeters + data->y = Tracker::Y.headPos; + data->z = Tracker::Z.headPos; - data->pitch = Tracker::Pitch.headPos- Tracker::Pitch.offset_headPos; // degrees - data->yaw = Tracker::Yaw.headPos- Tracker::Yaw.offset_headPos; - data->roll = Tracker::Roll.headPos - Tracker::Roll.offset_headPos; + data->pitch = Tracker::Pitch.headPos; // degrees + data->yaw = Tracker::Yaw.headPos; + data->roll = Tracker::Roll.headPos; } // diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h index df259708..d7c0506e 100644 --- a/FaceTrackNoIR/tracker.h +++ b/FaceTrackNoIR/tracker.h @@ -116,7 +116,7 @@ public: void initHeadPoseData(){ headPos = 0.0f; - offset_headPos = 0.0f; +// offset_headPos = 0.0f; invert = 0.0f; red = 0.0f; rawList.clear(); @@ -132,7 +132,7 @@ public: } float headPos; // Current position (from faceTracker, radials or meters) - float offset_headPos; // Offset for centering +// float offset_headPos; // Offset for centering float invert; // Invert measured value (= 1.0f or -1.0f) float red; // Reduction factor (used for EWMA-filtering, between 0.0f and 1.0f) QList rawList; // List of 'n' headPos values (used for moving average) -- cgit v1.2.3