summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2010-06-07 20:33:48 +0000
committerWim Vriend <facetracknoir@gmail.com>2010-06-07 20:33:48 +0000
commit825b01cad1cbba6bfc9a54ea2a18bd8a021e8c93 (patch)
tree075e943d178cd4907f451ae059a9e260696a73bd
parent0bd63163e9ed2be18233da0c9d405bfd98c0d530 (diff)
Improvements
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@7 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.cpp2
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.ui184
-rw-r--r--FaceTrackNoIR/Release/tracker.objbin279315 -> 288812 bytes
-rw-r--r--FaceTrackNoIR/Release/vc90.idbbin2550784 -> 2558976 bytes
-rw-r--r--FaceTrackNoIR/Release/vc90.pdbbin2134016 -> 2027520 bytes
-rw-r--r--FaceTrackNoIR/tracker.cpp48
-rw-r--r--FaceTrackNoIR/tracker.h2
-rw-r--r--bin/FaceTrackNoIR.exebin456192 -> 457216 bytes
-rw-r--r--bin/Settings/ArmA.ini8
9 files changed, 148 insertions, 96 deletions
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp
index 18a06ecc..19af030e 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.cpp
+++ b/FaceTrackNoIR/FaceTrackNoIR.cpp
@@ -334,7 +334,7 @@ void FaceTrackNoIR::loadSettings() {
ui.chkInvertX->setChecked (iniFile.value ( "invertX", 0 ).toBool());
ui.chkInvertY->setChecked (iniFile.value ( "invertY", 0 ).toBool());
ui.chkInvertZ->setChecked (iniFile.value ( "invertZ", 0 ).toBool());
- ui.chkUseEWMA->setChecked (iniFile.value ( "useEWMA", 0 ).toBool());
+ ui.chkUseEWMA->setChecked (iniFile.value ( "useEWMA", 1 ).toBool());
ui.redYaw->setValue (iniFile.value ( "redYaw", 70 ).toInt());
ui.redPitch->setValue (iniFile.value ( "redPitch", 70 ).toInt());
ui.redRoll->setValue (iniFile.value ( "redRoll", 70 ).toInt());
diff --git a/FaceTrackNoIR/FaceTrackNoIR.ui b/FaceTrackNoIR/FaceTrackNoIR.ui
index 7e3088a3..0cab62bc 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.ui
+++ b/FaceTrackNoIR/FaceTrackNoIR.ui
@@ -940,11 +940,11 @@ color:#000;</string>
background:none;</string>
</property>
<property name="text">
- <string>Smoothing (samples)</string>
+ <string>Global settings</string>
</property>
</widget>
</item>
- <item row="1" column="0">
+ <item row="2" column="0">
<widget class="QSlider" name="slideSmoothing">
<property name="minimumSize">
<size>
@@ -972,7 +972,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="2" column="1">
<widget class="QSpinBox" name="spinSmoothing">
<property name="minimumSize">
<size>
@@ -988,6 +988,59 @@ background:none;</string>
</property>
</widget>
</item>
+ <item row="3" column="1">
+ <widget class="QCheckBox" name="chkUseEWMA">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="lblSensYaw_5">
+ <property name="minimumSize">
+ <size>
+ <width>25</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>150</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">color:#ccc;
+background:none;</string>
+ </property>
+ <property name="text">
+ <string>Use EWMA filtering:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="lblSensYaw_4">
+ <property name="minimumSize">
+ <size>
+ <width>25</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>150</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">color:#ccc;
+background:none;</string>
+ </property>
+ <property name="text">
+ <string>Smoothing (samples):</string>
+ </property>
+ </widget>
+ </item>
<item row="5" column="0">
<widget class="QSlider" name="slideNeutralZone">
<property name="minimumSize">
@@ -997,13 +1050,13 @@ background:none;</string>
</size>
</property>
<property name="minimum">
- <number>0</number>
+ <number>1</number>
</property>
<property name="maximum">
<number>45</number>
</property>
<property name="pageStep">
- <number>2</number>
+ <number>5</number>
</property>
<property name="value">
<number>5</number>
@@ -1027,43 +1080,16 @@ background:none;</string>
<property name="maximum">
<number>45</number>
</property>
- <property name="value">
+ <property name="singleStep">
<number>5</number>
</property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="lblSensYaw_4">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>150</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true">color:#ccc;
-background:none;</string>
- </property>
- <property name="text">
- <string>Rotation Neutral Zone (degr.)</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QCheckBox" name="chkUseEWMA">
- <property name="text">
- <string/>
+ <property name="value">
+ <number>5</number>
</property>
</widget>
</item>
- <item row="2" column="0">
- <widget class="QLabel" name="lblSensYaw_5">
+ <item row="4" column="0">
+ <widget class="QLabel" name="lblSensYaw_6">
<property name="minimumSize">
<size>
<width>25</width>
@@ -1081,7 +1107,7 @@ background:none;</string>
background:none;</string>
</property>
<property name="text">
- <string>Use EWMA filtering</string>
+ <string>Neutral Zone:</string>
</property>
</widget>
</item>
@@ -2311,8 +2337,6 @@ background:none;</string>
<tabstop>spinSensZ</tabstop>
<tabstop>slideSmoothing</tabstop>
<tabstop>spinSmoothing</tabstop>
- <tabstop>slideNeutralZone</tabstop>
- <tabstop>spinNeutralZone</tabstop>
<tabstop>headXLine</tabstop>
<tabstop>headRotXLine</tabstop>
<tabstop>headYLine</tabstop>
@@ -2517,50 +2541,18 @@ background:none;</string>
</hints>
</connection>
<connection>
- <sender>slideNeutralZone</sender>
- <signal>valueChanged(int)</signal>
- <receiver>spinNeutralZone</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>813</x>
- <y>238</y>
- </hint>
- <hint type="destinationlabel">
- <x>869</x>
- <y>240</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>spinNeutralZone</sender>
- <signal>valueChanged(int)</signal>
- <receiver>slideNeutralZone</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>869</x>
- <y>240</y>
- </hint>
- <hint type="destinationlabel">
- <x>813</x>
- <y>238</y>
- </hint>
- </hints>
- </connection>
- <connection>
<sender>slideSmoothing</sender>
<signal>valueChanged(int)</signal>
<receiver>spinSmoothing</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
- <x>813</x>
- <y>176</y>
+ <x>776</x>
+ <y>180</y>
</hint>
<hint type="destinationlabel">
- <x>869</x>
- <y>178</y>
+ <x>832</x>
+ <y>182</y>
</hint>
</hints>
</connection>
@@ -2571,12 +2563,12 @@ background:none;</string>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
- <x>869</x>
- <y>178</y>
+ <x>832</x>
+ <y>182</y>
</hint>
<hint type="destinationlabel">
- <x>813</x>
- <y>176</y>
+ <x>776</x>
+ <y>180</y>
</hint>
</hints>
</connection>
@@ -2772,5 +2764,37 @@ background:none;</string>
</hint>
</hints>
</connection>
+ <connection>
+ <sender>slideNeutralZone</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>spinNeutralZone</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>701</x>
+ <y>233</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>800</x>
+ <y>242</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>spinNeutralZone</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>slideNeutralZone</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>806</x>
+ <y>232</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>741</x>
+ <y>231</y>
+ </hint>
+ </hints>
+ </connection>
</connections>
</ui>
diff --git a/FaceTrackNoIR/Release/tracker.obj b/FaceTrackNoIR/Release/tracker.obj
index 1feae14e..a50afb5f 100644
--- a/FaceTrackNoIR/Release/tracker.obj
+++ b/FaceTrackNoIR/Release/tracker.obj
Binary files differ
diff --git a/FaceTrackNoIR/Release/vc90.idb b/FaceTrackNoIR/Release/vc90.idb
index b3f2574f..fbbc4b50 100644
--- a/FaceTrackNoIR/Release/vc90.idb
+++ b/FaceTrackNoIR/Release/vc90.idb
Binary files differ
diff --git a/FaceTrackNoIR/Release/vc90.pdb b/FaceTrackNoIR/Release/vc90.pdb
index 432b1e6a..3bb5b6da 100644
--- a/FaceTrackNoIR/Release/vc90.pdb
+++ b/FaceTrackNoIR/Release/vc90.pdb
Binary files differ
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index fc4a8d20..be428fac 100644
--- a/FaceTrackNoIR/tracker.cpp
+++ b/FaceTrackNoIR/tracker.cpp
@@ -23,6 +23,8 @@
*********************************************************************************/
/*
Modifications (last one on top):
+ 20100607 - WVR: Re-installed Rotation Neutral Zone and improved reaction
+ after 'start/stop'. MessageBeep when confidence is back...
20100604 - WVR: Created structure for DOF-data and changed timing of
ReceiveHeadPose end run().
20100602 - WVR: Implemented EWMA-filtering, according to the example of
@@ -120,7 +122,7 @@ void Tracker::setup(QWidget *head, FaceTrackNoIR *parent) {
registerHeadPoseCallback();
// some parameteres [optional]
- smHTSetHeadPosePredictionEnabled( _engine->handle(), true);
+ smHTSetHeadPosePredictionEnabled( _engine->handle(), false);
smHTSetLipTrackingEnabled( _engine->handle(), false);
smLoggingSetFileOutputEnable( false );
@@ -221,10 +223,31 @@ void Tracker::run() {
Tracker::do_tracking = !Tracker::do_tracking;
//
- // To start tracking again and be '0', execute Center command too
+ // To start tracking again and to be at '0', execute Center command too
//
if (Tracker::do_tracking) {
Tracker::do_center = true;
+
+ Tracker::set_initial = false;
+ Tracker::confid = false;
+
+ Pitch.rawList.clear();
+ Pitch.prevPos = 0.0f;
+ Yaw.rawList.clear();
+ Yaw.prevPos = 0.0f;
+ Roll.rawList.clear();
+ Roll.prevPos = 0.0f;
+ X.rawList.clear();
+ X.prevPos = 0.0f;
+ Y.rawList.clear();
+ Y.prevPos = 0.0f;
+ Z.rawList.clear();
+ Z.prevPos = 0.0f;
+
+ _engine->start();
+ }
+ else {
+ _engine->stop();
}
qDebug() << "Tracker::run() says BACK pressed, do_tracking =" << Tracker::do_tracking;
}
@@ -248,6 +271,7 @@ void Tracker::run() {
//
if(Tracker::set_initial == false) {
Tracker::Z.initial_headPos = Tracker::getHeadPosZ();
+ MessageBeep (MB_ICONASTERISK);
Tracker::set_initial = true;
}
@@ -276,7 +300,7 @@ void Tracker::run() {
//
// If Center is pressed, copy the current values to the offsets.
//
- if (Tracker::do_center) {
+ if (Tracker::do_center && Tracker::set_initial) {
Pitch.offset_headPos = getSmoothFromList( &Pitch.rawList );
Yaw.offset_headPos = getSmoothFromList( &Yaw.rawList );
Roll.offset_headPos = getSmoothFromList( &Roll.rawList );
@@ -290,7 +314,7 @@ void Tracker::run() {
Tracker::do_center = false;
}
- if (Tracker::do_tracking) {
+ if (Tracker::do_tracking && Tracker::confid) {
//
// Also send the Virtual Pose to FT-server and FG-server
//
@@ -388,28 +412,31 @@ void Tracker::receiveHeadPose(void *,smEngineHeadPoseData head_pose, smCameraVid
//
// Pitch
if (Tracker::useFilter) {
- Pitch.newPos = lowPassFilter ( Tracker::Pitch.headPos, &Pitch.prevPos, dT, Tracker::Pitch.red );
+ Pitch.newPos = lowPassFilter ( getCorrectedNewRaw ( Tracker::Pitch.headPos, rotNeutralZone ),
+ &Pitch.prevPos, dT, Tracker::Pitch.red );
}
else {
- Pitch.newPos = Tracker::Pitch.headPos;
+ Pitch.newPos = getCorrectedNewRaw ( Tracker::Pitch.headPos, rotNeutralZone );
}
addRaw2List ( &Pitch.rawList, Pitch.maxItems, Pitch.newPos );
// Yaw
if (Tracker::useFilter) {
- Yaw.newPos = lowPassFilter ( Tracker::Yaw.headPos, &Yaw.prevPos, dT, Tracker::Yaw.red );
+ Yaw.newPos = lowPassFilter ( getCorrectedNewRaw ( Tracker::Yaw.headPos, rotNeutralZone ),
+ &Yaw.prevPos, dT, Tracker::Yaw.red );
}
else {
- Yaw.newPos = Tracker::Yaw.headPos;
+ Yaw.newPos = getCorrectedNewRaw ( Tracker::Yaw.headPos, rotNeutralZone );
}
addRaw2List ( &Yaw.rawList, Yaw.maxItems, Yaw.newPos );
// Roll
if (Tracker::useFilter) {
- Roll.newPos = lowPassFilter ( Tracker::Roll.headPos, &Roll.prevPos, dT, Tracker::Roll.red );
+ Roll.newPos = lowPassFilter ( getCorrectedNewRaw (Tracker::Roll.headPos, rotNeutralZone ),
+ &Roll.prevPos, dT, Tracker::Roll.red );
}
else {
- Roll.newPos = Tracker::Roll.headPos;
+ Roll.newPos = getCorrectedNewRaw (Tracker::Roll.headPos, rotNeutralZone );
}
addRaw2List ( &Roll.rawList, Roll.maxItems, Roll.newPos );
@@ -474,6 +501,7 @@ bool Tracker::handleGameCommand ( int command ) {
case 1: // reset headtracker
if ( _engine ) {
_engine->stop();
+ Tracker::set_initial = false;
_engine->start();
}
break;
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h
index 9cf89114..dcb075f6 100644
--- a/FaceTrackNoIR/tracker.h
+++ b/FaceTrackNoIR/tracker.h
@@ -81,6 +81,7 @@ private:
static void STDCALL receiveHeadPose(void *,smEngineHeadPoseData head_pose, smCameraVideoFrame video_frame);
static void addRaw2List ( QList<float> *rawList, float maxIndex, float raw );
static float lowPassFilter ( float newvalue, float *oldvalue, float dt, float coeff);
+ static float getCorrectedNewRaw ( float NewRaw, float rotNeutral );
/** static member variables for saving the head pose **/
static THeadPoseDOF Pitch; // Head-rotation X-direction (Up/Down)
@@ -175,7 +176,6 @@ public:
static void setNeutralZone(int x) { rotNeutralZone = (x * 2.0f * 3.14159)/360.0f; }
float getSmoothFromList ( QList<float> *rawList );
- float getCorrectedNewRaw ( float NewRaw, float rotNeutral );
float getDegreesFromRads ( float rads ) { return ((rads * 360.0f)/ (2.0f * 3.14159)); }
// For now, use one slider for all
diff --git a/bin/FaceTrackNoIR.exe b/bin/FaceTrackNoIR.exe
index e6d33e2c..b9f293af 100644
--- a/bin/FaceTrackNoIR.exe
+++ b/bin/FaceTrackNoIR.exe
Binary files differ
diff --git a/bin/Settings/ArmA.ini b/bin/Settings/ArmA.ini
index dd72920f..b3c1bf42 100644
--- a/bin/Settings/ArmA.ini
+++ b/bin/Settings/ArmA.ini
@@ -1,9 +1,9 @@
[Tracking]
-Smooth=25
+Smooth=12
NeutralZone=5
-sensYaw=100
-sensPitch=100
-sensRoll=100
+sensYaw=110
+sensPitch=110
+sensRoll=110
sensX=100
sensY=100
sensZ=100