summaryrefslogtreecommitdiffhomepage
path: root/FaceTrackNoIR/tracker.cpp
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2011-01-18 21:51:48 +0000
committerWim Vriend <facetracknoir@gmail.com>2011-01-18 21:51:48 +0000
commit2a3ec553d3737f2d94c32c3372ebac5333819ddd (patch)
tree27adabc715afe26600fcc2558b2a57dcab8d82e9 /FaceTrackNoIR/tracker.cpp
parentd0132f5e3881a6cb09bfe41326831d36527b7321 (diff)
Profile selection items added in the Main form.
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@39 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FaceTrackNoIR/tracker.cpp')
-rw-r--r--FaceTrackNoIR/tracker.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index 633af24e..d1ebe6ea 100644
--- a/FaceTrackNoIR/tracker.cpp
+++ b/FaceTrackNoIR/tracker.cpp
@@ -53,7 +53,7 @@
// Definitions for testing purposes
//
#define USE_HEADPOSE_CALLBACK
-#define USE_DEBUG_CLIENT
+//#define USE_DEBUG_CLIENT
using namespace sm::faceapi;
using namespace sm::faceapi::qt;
@@ -489,6 +489,7 @@ void Tracker::run() {
// Pitch
if (Tracker::useFilter) {
rotX = lowPassFilter ( getSmoothFromList( &Pitch.rawList ) - Pitch.offset_headPos - Pitch.initial_headPos,
+// rotX = lowPassFilter ( getSmoothFromList( &Pitch.rawList ),
&Pitch.prevPos, dT, Tracker::Pitch.red );
}
else {
@@ -615,13 +616,21 @@ void Tracker::run() {
}
}
}
- ReleaseMutex(Tracker::hTrackMutex);
- server_Game->sendHeadposeToGame();
# ifdef USE_DEBUG_CLIENT
- debug_Client->sendHeadposeToGame();
+ debug_Client->confidence = Tracker::Pitch.confidence;
+ debug_Client->newSample = Tracker::Pitch.newSample;
+ debug_Client->smoothvalue = getSmoothFromList( &Pitch.rawList );
+ debug_Client->prev_value = Tracker::Pitch.prevPos;
+ debug_Client->dT = dT;
+ debug_Client->sendHeadposeToGame(); // Log to Excel
+ Tracker::Pitch.newSample = false;
# endif
+ ReleaseMutex(Tracker::hTrackMutex);
+ server_Game->sendHeadposeToGame();
+
+
//for lower cpu load
usleep(10000);
yieldCurrentThread();
@@ -664,6 +673,8 @@ void Tracker::addHeadPose( smEngineHeadPoseData head_pose )
// Pitch
Tracker::Pitch.headPos = head_pose.head_rot.x_rads * 57.295781f; // degrees
addRaw2List ( &Pitch.rawList, Pitch.maxItems, Tracker::Pitch.headPos );
+ Tracker::Pitch.confidence = head_pose.confidence; // Just this one ...
+ Tracker::Pitch.newSample = true;
// Yaw
Tracker::Yaw.headPos = head_pose.head_rot.y_rads * 57.295781f; // degrees
@@ -781,7 +792,7 @@ float Tracker::getCorrectedNewRaw ( float NewRaw, float rotNeutral ) {
// The code was adopted from Melchior Franz, who created it for FlightGear (aircraft.nas).
//
// The function takes the new value, the delta-time (sec) and a weighing coefficient (>0 and <1)
-// All previou values are taken into account, the weight of this is determined by 'coeff'.
+// All previous values are taken into account, the weight of this is determined by 'coeff'.
//
float Tracker::lowPassFilter ( float newvalue, float *oldvalue, float dt, float coeff) {
float c = 0.0f;