summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2010-06-02 18:49:45 +0000
committerWim Vriend <facetracknoir@gmail.com>2010-06-02 18:49:45 +0000
commitf42d2321973dd6949700cb4d272a13da3c1fc2a4 (patch)
tree2dec5d98bfe2bd2885ad738e355dfb37c0523d6c
parent49d80a3e2497bdc75fa5d8b24cea7a02e4e2f96e (diff)
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@5 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
-rw-r--r--FaceTrackNoIR/FTServer.cpp2
-rw-r--r--FaceTrackNoIR/FaceApp.cpp48
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.cpp84
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.h16
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.ui176
-rw-r--r--FaceTrackNoIR/GeneratedFiles/ui_FaceTrackNoIR.h318
-rw-r--r--FaceTrackNoIR/tracker.cpp146
-rw-r--r--FaceTrackNoIR/tracker.h32
-rw-r--r--bin/FaceTrackNoIR.exebin454656 -> 456192 bytes
-rw-r--r--bin/Settings/ArmA.ini21
10 files changed, 477 insertions, 366 deletions
diff --git a/FaceTrackNoIR/FTServer.cpp b/FaceTrackNoIR/FTServer.cpp
index 578317a1..ebf16458 100644
--- a/FaceTrackNoIR/FTServer.cpp
+++ b/FaceTrackNoIR/FTServer.cpp
@@ -140,7 +140,7 @@ void FTServer::run() {
}
// just for lower cpu load
- msleep(40);
+ msleep(30);
yieldCurrentThread();
pMemData->data.DataID += 1;
}
diff --git a/FaceTrackNoIR/FaceApp.cpp b/FaceTrackNoIR/FaceApp.cpp
index d21360d3..433e9b2d 100644
--- a/FaceTrackNoIR/FaceApp.cpp
+++ b/FaceTrackNoIR/FaceApp.cpp
@@ -17,19 +17,19 @@ bool FaceApp::winEventFilter( MSG * msg, long * result )
}
}
- if (msgType == WM_HOTKEY) {
- switch ( msg->wParam ) {
- case 777:
- qDebug() << "FaceApp::winEventFilter says: HOME pressed";
- break;
- case 778:
- qDebug() << "FaceApp::winEventFilter says: END pressed";
- break;
- default:
- qDebug() << "FaceApp::winEventFilter says: unknown HotKey pressed";
- break;
- }
- }
+ ////if (msgType == WM_HOTKEY) {
+ //// switch ( msg->wParam ) {
+ //// case 777:
+ //// qDebug() << "FaceApp::winEventFilter says: HOME pressed";
+ //// break;
+ //// case 778:
+ //// qDebug() << "FaceApp::winEventFilter says: END pressed";
+ //// break;
+ //// default:
+ //// qDebug() << "FaceApp::winEventFilter says: unknown HotKey pressed";
+ //// break;
+ //// }
+ ////}
return( false );
}
@@ -42,16 +42,16 @@ void FaceApp::SetupEventFilter( FaceTrackNoIR *window ) {
msgID_FTClient = RegisterWindowMessageA ( FT_PROGRAMID );
qDebug() << "FaceApp::SetupEventFilter says: Message ID =" << msgID_FTClient;
- if ( RegisterHotKey( window->winId(), 777, MOD_WIN, VK_HOME ) ) {
- qDebug() << "FaceApp::SetupEventFilter says: RegisterHotKey HOME =" << VK_HOME;
- }
- if ( RegisterHotKey( window->winId(), 778, MOD_WIN, VK_END ) ) {
- qDebug() << "FaceApp::SetupEventFilter says: RegisterHotKey END =" << VK_END;
- }
-
- QAbstractEventDispatcher *evtdis = QAbstractEventDispatcher::instance();
- if (evtdis != NULL) {
- qDebug() << "FaceApp::SetupEventFilter says: EventDispatcher found!";
- }
+ ////if ( RegisterHotKey( window->winId(), 777, MOD_WIN, VK_HOME ) ) {
+ //// qDebug() << "FaceApp::SetupEventFilter says: RegisterHotKey HOME =" << VK_HOME;
+ ////}
+ ////if ( RegisterHotKey( window->winId(), 778, MOD_WIN, VK_END ) ) {
+ //// qDebug() << "FaceApp::SetupEventFilter says: RegisterHotKey END =" << VK_END;
+ ////}
+ ////
+ ////QAbstractEventDispatcher *evtdis = QAbstractEventDispatcher::instance();
+ ////if (evtdis != NULL) {
+ //// qDebug() << "FaceApp::SetupEventFilter says: EventDispatcher found!";
+ ////}
} \ No newline at end of file
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp
index f68dcfe1..0183d3f9 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.cpp
+++ b/FaceTrackNoIR/FaceTrackNoIR.cpp
@@ -82,13 +82,15 @@ void FaceTrackNoIR::setupFaceTrackNoIR() {
connect(ui.chkInvertY, SIGNAL(stateChanged(int)), this, SLOT(setInvertY(int)));
connect(ui.chkInvertZ, SIGNAL(stateChanged(int)), this, SLOT(setInvertZ(int)));
- // Connect sliders for threshold
- connect(ui.thresYaw, SIGNAL(valueChanged(int)), this, SLOT(setThreshYaw(int)));
- connect(ui.thresRoll, SIGNAL(valueChanged(int)), this, SLOT(setThreshRoll(int)));
- connect(ui.thresPitch, SIGNAL(valueChanged(int)), this, SLOT(setThreshPitch(int)));
- connect(ui.thresX, SIGNAL(valueChanged(int)), this, SLOT(setThreshX(int)));
- connect(ui.thresY, SIGNAL(valueChanged(int)), this, SLOT(setThreshY(int)));
- connect(ui.thresZ, SIGNAL(valueChanged(int)), this, SLOT(setThreshZ(int)));
+ connect(ui.chkUseEWMA, SIGNAL(stateChanged(int)), this, SLOT(setUseFilter(int)));
+
+ // Connect sliders for reduction factor
+ connect(ui.redYaw, SIGNAL(valueChanged(int)), this, SLOT(setRedYaw(int)));
+ connect(ui.redRoll, SIGNAL(valueChanged(int)), this, SLOT(setRedRoll(int)));
+ connect(ui.redPitch, SIGNAL(valueChanged(int)), this, SLOT(setRedPitch(int)));
+ connect(ui.redX, SIGNAL(valueChanged(int)), this, SLOT(setRedX(int)));
+ connect(ui.redY, SIGNAL(valueChanged(int)), this, SLOT(setRedY(int)));
+ connect(ui.redZ, SIGNAL(valueChanged(int)), this, SLOT(setRedZ(int)));
connect(ui.slideNeutralZone, SIGNAL(valueChanged(int)), this, SLOT(setNeutralZone(int)));
@@ -269,12 +271,13 @@ void FaceTrackNoIR::save() {
iniFile.setValue ( "invertX", ui.chkInvertX->isChecked() );
iniFile.setValue ( "invertY", ui.chkInvertY->isChecked() );
iniFile.setValue ( "invertZ", ui.chkInvertZ->isChecked() );
- iniFile.setValue ( "thresYaw", ui.thresYaw->value() );
- iniFile.setValue ( "thresPitch", ui.thresPitch->value() );
- iniFile.setValue ( "thresRoll", ui.thresRoll->value() );
- iniFile.setValue ( "thresX", ui.thresX->value() );
- iniFile.setValue ( "thresY", ui.thresY->value() );
- iniFile.setValue ( "thresZ", ui.thresZ->value() );
+ iniFile.setValue ( "useEWMA", ui.chkUseEWMA->isChecked() );
+ iniFile.setValue ( "redYaw", ui.redYaw->value() );
+ iniFile.setValue ( "redPitch", ui.redPitch->value() );
+ iniFile.setValue ( "redRoll", ui.redRoll->value() );
+ iniFile.setValue ( "redX", ui.redX->value() );
+ iniFile.setValue ( "redY", ui.redY->value() );
+ iniFile.setValue ( "redZ", ui.redZ->value() );
iniFile.endGroup ();
iniFile.beginGroup ( "GameProtocol" );
@@ -331,12 +334,13 @@ 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.thresYaw->setValue (iniFile.value ( "thresYaw", 100 ).toInt());
- ui.thresPitch->setValue (iniFile.value ( "thresPitch", 100 ).toInt());
- ui.thresRoll->setValue (iniFile.value ( "thresRoll", 100 ).toInt());
- ui.thresX->setValue (iniFile.value ( "thresX", 100 ).toInt());
- ui.thresY->setValue (iniFile.value ( "thresY", 100 ).toInt());
- ui.thresZ->setValue (iniFile.value ( "thresZ", 100 ).toInt());
+ ui.chkUseEWMA->setChecked (iniFile.value ( "useEWMA", 0 ).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());
+ ui.redX->setValue (iniFile.value ( "redX", 70 ).toInt());
+ ui.redY->setValue (iniFile.value ( "redY", 70 ).toInt());
+ ui.redZ->setValue (iniFile.value ( "redZ", 70 ).toInt());
iniFile.endGroup ();
iniFile.beginGroup ( "GameProtocol" );
@@ -510,39 +514,45 @@ void FaceTrackNoIR::setInvertZ( int invert ) {
settingsDirty = true;
}
-/** set the threshold from the slider **/
-void FaceTrackNoIR::setThreshYaw( int thresh ) {
- Tracker::setThresYaw ( thresh );
+/** set Use Filter from the checkbox **/
+void FaceTrackNoIR::setUseFilter( int set ) {
+ Tracker::setUseFilter ( (set != 0)?true:false );
+ settingsDirty = true;
+}
+
+/** set the redhold from the slider **/
+void FaceTrackNoIR::setRedYaw( int redh ) {
+ Tracker::setRedYaw ( redh );
settingsDirty = true;
}
-/** set the threshold from the slider **/
-void FaceTrackNoIR::setThreshPitch( int thresh ) {
- Tracker::setThresPitch ( thresh );
+/** set the redhold from the slider **/
+void FaceTrackNoIR::setRedPitch( int redh ) {
+ Tracker::setRedPitch ( redh );
settingsDirty = true;
}
-/** set the threshold from the slider **/
-void FaceTrackNoIR::setThreshRoll( int thresh ) {
- Tracker::setThresRoll ( thresh );
+/** set the redhold from the slider **/
+void FaceTrackNoIR::setRedRoll( int redh ) {
+ Tracker::setRedRoll ( redh );
settingsDirty = true;
}
-/** set the threshold from the slider **/
-void FaceTrackNoIR::setThreshX( int thresh ) {
- Tracker::setThresX ( thresh );
+/** set the redhold from the slider **/
+void FaceTrackNoIR::setRedX( int redh ) {
+ Tracker::setRedX ( redh );
settingsDirty = true;
}
-/** set the threshold from the slider **/
-void FaceTrackNoIR::setThreshY( int thresh ) {
- Tracker::setThresY ( thresh );
+/** set the redhold from the slider **/
+void FaceTrackNoIR::setRedY( int redh ) {
+ Tracker::setRedY ( redh );
settingsDirty = true;
}
-/** set the threshold from the slider **/
-void FaceTrackNoIR::setThreshZ( int thresh ) {
- Tracker::setThresZ ( thresh );
+/** set the redhold from the slider **/
+void FaceTrackNoIR::setRedZ( int redh ) {
+ Tracker::setRedZ ( redh );
settingsDirty = true;
}
diff --git a/FaceTrackNoIR/FaceTrackNoIR.h b/FaceTrackNoIR/FaceTrackNoIR.h
index f5f87fc9..e8ddda12 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.h
+++ b/FaceTrackNoIR/FaceTrackNoIR.h
@@ -118,13 +118,15 @@ private:
void setInvertY( int invert );
void setInvertZ( int invert );
- // threshold sliders
- void setThreshYaw( int thresh );
- void setThreshPitch( int thresh );
- void setThreshRoll( int thresh );
- void setThreshX( int thresh );
- void setThreshY( int thresh );
- void setThreshZ( int thresh );
+ void setUseFilter( int set );
+
+ // reduction factor sliders
+ void setRedYaw( int redh );
+ void setRedPitch( int redh );
+ void setRedRoll( int redh );
+ void setRedX( int redh );
+ void setRedY( int redh );
+ void setRedZ( int redh );
void setNeutralZone( int angle );
diff --git a/FaceTrackNoIR/FaceTrackNoIR.ui b/FaceTrackNoIR/FaceTrackNoIR.ui
index 47f6475c..7e3088a3 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.ui
+++ b/FaceTrackNoIR/FaceTrackNoIR.ui
@@ -988,7 +988,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="4" column="0">
+ <item row="5" column="0">
<widget class="QSlider" name="slideNeutralZone">
<property name="minimumSize">
<size>
@@ -1016,7 +1016,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="4" column="1">
+ <item row="5" column="1">
<widget class="QSpinBox" name="spinNeutralZone">
<property name="minimumSize">
<size>
@@ -1032,7 +1032,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="2" column="0">
+ <item row="3" column="0">
<widget class="QLabel" name="lblSensYaw_4">
<property name="minimumSize">
<size>
@@ -1055,6 +1055,36 @@ background:none;</string>
</property>
</widget>
</item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="chkUseEWMA">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" 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>
</layout>
</item>
<item>
@@ -1721,7 +1751,7 @@ background:none;</string>
</widget>
</item>
<item row="1" column="3">
- <widget class="QSlider" name="thresYaw">
+ <widget class="QSlider" name="redYaw">
<property name="minimumSize">
<size>
<width>50</width>
@@ -1729,13 +1759,13 @@ background:none;</string>
</size>
</property>
<property name="maximum">
- <number>500</number>
+ <number>100</number>
</property>
<property name="pageStep">
<number>10</number>
</property>
<property name="value">
- <number>100</number>
+ <number>70</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -1746,7 +1776,7 @@ background:none;</string>
</widget>
</item>
<item row="3" column="3">
- <widget class="QSlider" name="thresPitch">
+ <widget class="QSlider" name="redPitch">
<property name="minimumSize">
<size>
<width>50</width>
@@ -1754,13 +1784,13 @@ background:none;</string>
</size>
</property>
<property name="maximum">
- <number>500</number>
+ <number>100</number>
</property>
<property name="pageStep">
<number>10</number>
</property>
<property name="value">
- <number>100</number>
+ <number>70</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -1771,7 +1801,7 @@ background:none;</string>
</widget>
</item>
<item row="4" column="3">
- <widget class="QSlider" name="thresRoll">
+ <widget class="QSlider" name="redRoll">
<property name="minimumSize">
<size>
<width>50</width>
@@ -1779,13 +1809,13 @@ background:none;</string>
</size>
</property>
<property name="maximum">
- <number>500</number>
+ <number>100</number>
</property>
<property name="pageStep">
<number>10</number>
</property>
<property name="value">
- <number>100</number>
+ <number>70</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -1796,7 +1826,7 @@ background:none;</string>
</widget>
</item>
<item row="1" column="4">
- <widget class="QSpinBox" name="spinThresYaw">
+ <widget class="QSpinBox" name="spinRedYaw">
<property name="minimumSize">
<size>
<width>50</width>
@@ -1804,18 +1834,18 @@ background:none;</string>
</size>
</property>
<property name="maximum">
- <number>500</number>
+ <number>100</number>
</property>
<property name="singleStep">
- <number>10</number>
+ <number>5</number>
</property>
<property name="value">
- <number>100</number>
+ <number>70</number>
</property>
</widget>
</item>
<item row="3" column="4">
- <widget class="QSpinBox" name="spinThresPitch">
+ <widget class="QSpinBox" name="spinRedPitch">
<property name="minimumSize">
<size>
<width>50</width>
@@ -1823,18 +1853,18 @@ background:none;</string>
</size>
</property>
<property name="maximum">
- <number>500</number>
+ <number>100</number>
</property>
<property name="singleStep">
- <number>10</number>
+ <number>5</number>
</property>
<property name="value">
- <number>100</number>
+ <number>70</number>
</property>
</widget>
</item>
<item row="4" column="4">
- <widget class="QSpinBox" name="spinThresRoll">
+ <widget class="QSpinBox" name="spinRedRoll">
<property name="minimumSize">
<size>
<width>50</width>
@@ -1842,13 +1872,13 @@ background:none;</string>
</size>
</property>
<property name="maximum">
- <number>500</number>
+ <number>100</number>
</property>
<property name="singleStep">
- <number>10</number>
+ <number>5</number>
</property>
<property name="value">
- <number>100</number>
+ <number>70</number>
</property>
</widget>
</item>
@@ -1856,7 +1886,7 @@ background:none;</string>
<widget class="QLabel" name="lblSensitivity_2">
<property name="minimumSize">
<size>
- <width>100</width>
+ <width>110</width>
<height>0</height>
</size>
</property>
@@ -1871,12 +1901,12 @@ background:none;</string>
background:none;</string>
</property>
<property name="text">
- <string>Threshold (100 = 1)</string>
+ <string>Red.factor (100 = 1)</string>
</property>
</widget>
</item>
<item row="1" column="9">
- <widget class="QSlider" name="thresX">
+ <widget class="QSlider" name="redX">
<property name="minimumSize">
<size>
<width>50</width>
@@ -1884,13 +1914,13 @@ background:none;</string>
</size>
</property>
<property name="maximum">
- <number>500</number>
+ <number>100</number>
</property>
<property name="pageStep">
<number>10</number>
</property>
<property name="value">
- <number>100</number>
+ <number>70</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -1901,7 +1931,7 @@ background:none;</string>
</widget>
</item>
<item row="3" column="9">
- <widget class="QSlider" name="thresY">
+ <widget class="QSlider" name="redY">
<property name="minimumSize">
<size>
<width>50</width>
@@ -1909,13 +1939,13 @@ background:none;</string>
</size>
</property>
<property name="maximum">
- <number>500</number>
+ <number>100</number>
</property>
<property name="pageStep">
<number>10</number>
</property>
<property name="value">
- <number>100</number>
+ <number>70</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -1926,7 +1956,7 @@ background:none;</string>
</widget>
</item>
<item row="4" column="9">
- <widget class="QSlider" name="thresZ">
+ <widget class="QSlider" name="redZ">
<property name="minimumSize">
<size>
<width>50</width>
@@ -1934,13 +1964,13 @@ background:none;</string>
</size>
</property>
<property name="maximum">
- <number>500</number>
+ <number>100</number>
</property>
<property name="pageStep">
<number>10</number>
</property>
<property name="value">
- <number>100</number>
+ <number>70</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -1951,7 +1981,7 @@ background:none;</string>
</widget>
</item>
<item row="1" column="10">
- <widget class="QSpinBox" name="spinThresX">
+ <widget class="QSpinBox" name="spinRedX">
<property name="minimumSize">
<size>
<width>50</width>
@@ -1959,18 +1989,18 @@ background:none;</string>
</size>
</property>
<property name="maximum">
- <number>500</number>
+ <number>100</number>
</property>
<property name="singleStep">
- <number>10</number>
+ <number>5</number>
</property>
<property name="value">
- <number>100</number>
+ <number>70</number>
</property>
</widget>
</item>
<item row="3" column="10">
- <widget class="QSpinBox" name="spinThresY">
+ <widget class="QSpinBox" name="spinRedY">
<property name="minimumSize">
<size>
<width>50</width>
@@ -1978,18 +2008,18 @@ background:none;</string>
</size>
</property>
<property name="maximum">
- <number>500</number>
+ <number>100</number>
</property>
<property name="singleStep">
- <number>10</number>
+ <number>5</number>
</property>
<property name="value">
- <number>100</number>
+ <number>70</number>
</property>
</widget>
</item>
<item row="4" column="10">
- <widget class="QSpinBox" name="spinThresZ">
+ <widget class="QSpinBox" name="spinRedZ">
<property name="minimumSize">
<size>
<width>50</width>
@@ -1997,13 +2027,13 @@ background:none;</string>
</size>
</property>
<property name="maximum">
- <number>500</number>
+ <number>100</number>
</property>
<property name="singleStep">
- <number>10</number>
+ <number>5</number>
</property>
<property name="value">
- <number>100</number>
+ <number>70</number>
</property>
</widget>
</item>
@@ -2011,7 +2041,7 @@ background:none;</string>
<widget class="QLabel" name="lblSensitivity_3">
<property name="minimumSize">
<size>
- <width>100</width>
+ <width>110</width>
<height>0</height>
</size>
</property>
@@ -2026,7 +2056,7 @@ background:none;</string>
background:none;</string>
</property>
<property name="text">
- <string>Threshold (100 = 1)</string>
+ <string>Red.factor (100 = 1)</string>
</property>
</widget>
</item>
@@ -2551,9 +2581,9 @@ background:none;</string>
</hints>
</connection>
<connection>
- <sender>thresYaw</sender>
+ <sender>redYaw</sender>
<signal>valueChanged(int)</signal>
- <receiver>spinThresYaw</receiver>
+ <receiver>spinRedYaw</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
@@ -2567,9 +2597,9 @@ background:none;</string>
</hints>
</connection>
<connection>
- <sender>spinThresYaw</sender>
+ <sender>spinRedYaw</sender>
<signal>valueChanged(int)</signal>
- <receiver>thresYaw</receiver>
+ <receiver>redYaw</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
@@ -2583,9 +2613,9 @@ background:none;</string>
</hints>
</connection>
<connection>
- <sender>thresPitch</sender>
+ <sender>redPitch</sender>
<signal>valueChanged(int)</signal>
- <receiver>spinThresPitch</receiver>
+ <receiver>spinRedPitch</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
@@ -2599,9 +2629,9 @@ background:none;</string>
</hints>
</connection>
<connection>
- <sender>spinThresPitch</sender>
+ <sender>spinRedPitch</sender>
<signal>valueChanged(int)</signal>
- <receiver>thresPitch</receiver>
+ <receiver>redPitch</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
@@ -2615,9 +2645,9 @@ background:none;</string>
</hints>
</connection>
<connection>
- <sender>thresRoll</sender>
+ <sender>redRoll</sender>
<signal>valueChanged(int)</signal>
- <receiver>spinThresRoll</receiver>
+ <receiver>spinRedRoll</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
@@ -2631,9 +2661,9 @@ background:none;</string>
</hints>
</connection>
<connection>
- <sender>spinThresRoll</sender>
+ <sender>spinRedRoll</sender>
<signal>valueChanged(int)</signal>
- <receiver>thresRoll</receiver>
+ <receiver>redRoll</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
@@ -2647,9 +2677,9 @@ background:none;</string>
</hints>
</connection>
<connection>
- <sender>thresX</sender>
+ <sender>redX</sender>
<signal>valueChanged(int)</signal>
- <receiver>spinThresX</receiver>
+ <receiver>spinRedX</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
@@ -2663,9 +2693,9 @@ background:none;</string>
</hints>
</connection>
<connection>
- <sender>spinThresX</sender>
+ <sender>spinRedX</sender>
<signal>valueChanged(int)</signal>
- <receiver>thresX</receiver>
+ <receiver>redX</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
@@ -2679,9 +2709,9 @@ background:none;</string>
</hints>
</connection>
<connection>
- <sender>thresY</sender>
+ <sender>redY</sender>
<signal>valueChanged(int)</signal>
- <receiver>spinThresY</receiver>
+ <receiver>spinRedY</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
@@ -2695,9 +2725,9 @@ background:none;</string>
</hints>
</connection>
<connection>
- <sender>spinThresY</sender>
+ <sender>spinRedY</sender>
<signal>valueChanged(int)</signal>
- <receiver>thresY</receiver>
+ <receiver>redY</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
@@ -2711,9 +2741,9 @@ background:none;</string>
</hints>
</connection>
<connection>
- <sender>thresZ</sender>
+ <sender>redZ</sender>
<signal>valueChanged(int)</signal>
- <receiver>spinThresZ</receiver>
+ <receiver>spinRedZ</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
@@ -2727,9 +2757,9 @@ background:none;</string>
</hints>
</connection>
<connection>
- <sender>spinThresZ</sender>
+ <sender>spinRedZ</sender>
<signal>valueChanged(int)</signal>
- <receiver>thresZ</receiver>
+ <receiver>redZ</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
diff --git a/FaceTrackNoIR/GeneratedFiles/ui_FaceTrackNoIR.h b/FaceTrackNoIR/GeneratedFiles/ui_FaceTrackNoIR.h
index 1f36d463..1adf2690 100644
--- a/FaceTrackNoIR/GeneratedFiles/ui_FaceTrackNoIR.h
+++ b/FaceTrackNoIR/GeneratedFiles/ui_FaceTrackNoIR.h
@@ -1,7 +1,7 @@
/********************************************************************************
** Form generated from reading UI file 'FaceTrackNoIR.ui'
**
-** Created: Tue 1. Jun 21:00:16 2010
+** Created: Wed 2. Jun 19:35:54 2010
** by: Qt User Interface Compiler version 4.6.2
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
@@ -94,6 +94,8 @@ public:
QSlider *slideNeutralZone;
QSpinBox *spinNeutralZone;
QLabel *lblSensYaw_4;
+ QCheckBox *chkUseEWMA;
+ QLabel *lblSensYaw_5;
QSpacerItem *horizontalSpacer_3;
QSpacerItem *verticalSpacer;
QHBoxLayout *horizontalLayout_11;
@@ -133,19 +135,19 @@ public:
QLabel *lblInvert1_2;
QCheckBox *chkInvertY;
QCheckBox *chkInvertZ;
- QSlider *thresYaw;
- QSlider *thresPitch;
- QSlider *thresRoll;
- QSpinBox *spinThresYaw;
- QSpinBox *spinThresPitch;
- QSpinBox *spinThresRoll;
+ QSlider *redYaw;
+ QSlider *redPitch;
+ QSlider *redRoll;
+ QSpinBox *spinRedYaw;
+ QSpinBox *spinRedPitch;
+ QSpinBox *spinRedRoll;
QLabel *lblSensitivity_2;
- QSlider *thresX;
- QSlider *thresY;
- QSlider *thresZ;
- QSpinBox *spinThresX;
- QSpinBox *spinThresY;
- QSpinBox *spinThresZ;
+ QSlider *redX;
+ QSlider *redY;
+ QSlider *redZ;
+ QSpinBox *spinRedX;
+ QSpinBox *spinRedY;
+ QSpinBox *spinRedZ;
QLabel *lblSensitivity_3;
QLabel *lblSensitivity_4;
QSpacerItem *horizontalSpacer_13;
@@ -564,7 +566,7 @@ public:
slideNeutralZone->setOrientation(Qt::Horizontal);
slideNeutralZone->setTickPosition(QSlider::NoTicks);
- gridLayout_2->addWidget(slideNeutralZone, 4, 0, 1, 1);
+ gridLayout_2->addWidget(slideNeutralZone, 5, 0, 1, 1);
spinNeutralZone = new QSpinBox(widget);
spinNeutralZone->setObjectName(QString::fromUtf8("spinNeutralZone"));
@@ -572,7 +574,7 @@ public:
spinNeutralZone->setMaximum(45);
spinNeutralZone->setValue(5);
- gridLayout_2->addWidget(spinNeutralZone, 4, 1, 1, 1);
+ gridLayout_2->addWidget(spinNeutralZone, 5, 1, 1, 1);
lblSensYaw_4 = new QLabel(widget);
lblSensYaw_4->setObjectName(QString::fromUtf8("lblSensYaw_4"));
@@ -581,7 +583,21 @@ public:
lblSensYaw_4->setStyleSheet(QString::fromUtf8("color:#ccc;\n"
"background:none;"));
- gridLayout_2->addWidget(lblSensYaw_4, 2, 0, 1, 1);
+ gridLayout_2->addWidget(lblSensYaw_4, 3, 0, 1, 1);
+
+ chkUseEWMA = new QCheckBox(widget);
+ chkUseEWMA->setObjectName(QString::fromUtf8("chkUseEWMA"));
+
+ gridLayout_2->addWidget(chkUseEWMA, 2, 1, 1, 1);
+
+ lblSensYaw_5 = new QLabel(widget);
+ lblSensYaw_5->setObjectName(QString::fromUtf8("lblSensYaw_5"));
+ lblSensYaw_5->setMinimumSize(QSize(25, 0));
+ lblSensYaw_5->setMaximumSize(QSize(150, 16777215));
+ lblSensYaw_5->setStyleSheet(QString::fromUtf8("color:#ccc;\n"
+"background:none;"));
+
+ gridLayout_2->addWidget(lblSensYaw_5, 2, 0, 1, 1);
horizontalLayout_3->addLayout(gridLayout_2);
@@ -883,138 +899,138 @@ public:
gridLayout->addWidget(chkInvertZ, 4, 11, 1, 1);
- thresYaw = new QSlider(bubbleBigWidget);
- thresYaw->setObjectName(QString::fromUtf8("thresYaw"));
- thresYaw->setMinimumSize(QSize(50, 15));
- thresYaw->setMaximum(500);
- thresYaw->setPageStep(10);
- thresYaw->setValue(100);
- thresYaw->setOrientation(Qt::Horizontal);
- thresYaw->setTickPosition(QSlider::NoTicks);
-
- gridLayout->addWidget(thresYaw, 1, 3, 1, 1);
-
- thresPitch = new QSlider(bubbleBigWidget);
- thresPitch->setObjectName(QString::fromUtf8("thresPitch"));
- thresPitch->setMinimumSize(QSize(50, 15));
- thresPitch->setMaximum(500);
- thresPitch->setPageStep(10);
- thresPitch->setValue(100);
- thresPitch->setOrientation(Qt::Horizontal);
- thresPitch->setTickPosition(QSlider::NoTicks);
-
- gridLayout->addWidget(thresPitch, 3, 3, 1, 1);
-
- thresRoll = new QSlider(bubbleBigWidget);
- thresRoll->setObjectName(QString::fromUtf8("thresRoll"));
- thresRoll->setMinimumSize(QSize(50, 15));
- thresRoll->setMaximum(500);
- thresRoll->setPageStep(10);
- thresRoll->setValue(100);
- thresRoll->setOrientation(Qt::Horizontal);
- thresRoll->setTickPosition(QSlider::NoTicks);
-
- gridLayout->addWidget(thresRoll, 4, 3, 1, 1);
-
- spinThresYaw = new QSpinBox(bubbleBigWidget);
- spinThresYaw->setObjectName(QString::fromUtf8("spinThresYaw"));
- spinThresYaw->setMinimumSize(QSize(50, 22));
- spinThresYaw->setMaximum(500);
- spinThresYaw->setSingleStep(10);
- spinThresYaw->setValue(100);
-
- gridLayout->addWidget(spinThresYaw, 1, 4, 1, 1);
-
- spinThresPitch = new QSpinBox(bubbleBigWidget);
- spinThresPitch->setObjectName(QString::fromUtf8("spinThresPitch"));
- spinThresPitch->setMinimumSize(QSize(50, 22));
- spinThresPitch->setMaximum(500);
- spinThresPitch->setSingleStep(10);
- spinThresPitch->setValue(100);
-
- gridLayout->addWidget(spinThresPitch, 3, 4, 1, 1);
-
- spinThresRoll = new QSpinBox(bubbleBigWidget);
- spinThresRoll->setObjectName(QString::fromUtf8("spinThresRoll"));
- spinThresRoll->setMinimumSize(QSize(50, 22));
- spinThresRoll->setMaximum(500);
- spinThresRoll->setSingleStep(10);
- spinThresRoll->setValue(100);
-
- gridLayout->addWidget(spinThresRoll, 4, 4, 1, 1);
+ redYaw = new QSlider(bubbleBigWidget);
+ redYaw->setObjectName(QString::fromUtf8("redYaw"));
+ redYaw->setMinimumSize(QSize(50, 15));
+ redYaw->setMaximum(100);
+ redYaw->setPageStep(10);
+ redYaw->setValue(70);
+ redYaw->setOrientation(Qt::Horizontal);
+ redYaw->setTickPosition(QSlider::NoTicks);
+
+ gridLayout->addWidget(redYaw, 1, 3, 1, 1);
+
+ redPitch = new QSlider(bubbleBigWidget);
+ redPitch->setObjectName(QString::fromUtf8("redPitch"));
+ redPitch->setMinimumSize(QSize(50, 15));
+ redPitch->setMaximum(100);
+ redPitch->setPageStep(10);
+ redPitch->setValue(70);
+ redPitch->setOrientation(Qt::Horizontal);
+ redPitch->setTickPosition(QSlider::NoTicks);
+
+ gridLayout->addWidget(redPitch, 3, 3, 1, 1);
+
+ redRoll = new QSlider(bubbleBigWidget);
+ redRoll->setObjectName(QString::fromUtf8("redRoll"));
+ redRoll->setMinimumSize(QSize(50, 15));
+ redRoll->setMaximum(100);
+ redRoll->setPageStep(10);
+ redRoll->setValue(70);
+ redRoll->setOrientation(Qt::Horizontal);
+ redRoll->setTickPosition(QSlider::NoTicks);
+
+ gridLayout->addWidget(redRoll, 4, 3, 1, 1);
+
+ spinRedYaw = new QSpinBox(bubbleBigWidget);
+ spinRedYaw->setObjectName(QString::fromUtf8("spinRedYaw"));
+ spinRedYaw->setMinimumSize(QSize(50, 22));
+ spinRedYaw->setMaximum(100);
+ spinRedYaw->setSingleStep(5);
+ spinRedYaw->setValue(70);
+
+ gridLayout->addWidget(spinRedYaw, 1, 4, 1, 1);
+
+ spinRedPitch = new QSpinBox(bubbleBigWidget);
+ spinRedPitch->setObjectName(QString::fromUtf8("spinRedPitch"));
+ spinRedPitch->setMinimumSize(QSize(50, 22));
+ spinRedPitch->setMaximum(100);
+ spinRedPitch->setSingleStep(5);
+ spinRedPitch->setValue(70);
+
+ gridLayout->addWidget(spinRedPitch, 3, 4, 1, 1);
+
+ spinRedRoll = new QSpinBox(bubbleBigWidget);
+ spinRedRoll->setObjectName(QString::fromUtf8("spinRedRoll"));
+ spinRedRoll->setMinimumSize(QSize(50, 22));
+ spinRedRoll->setMaximum(100);
+ spinRedRoll->setSingleStep(5);
+ spinRedRoll->setValue(70);
+
+ gridLayout->addWidget(spinRedRoll, 4, 4, 1, 1);
lblSensitivity_2 = new QLabel(bubbleBigWidget);
lblSensitivity_2->setObjectName(QString::fromUtf8("lblSensitivity_2"));
- lblSensitivity_2->setMinimumSize(QSize(100, 0));
+ lblSensitivity_2->setMinimumSize(QSize(110, 0));
lblSensitivity_2->setMaximumSize(QSize(150, 16777215));
lblSensitivity_2->setStyleSheet(QString::fromUtf8("color:#ccc;\n"
"background:none;"));
gridLayout->addWidget(lblSensitivity_2, 0, 3, 1, 1);
- thresX = new QSlider(bubbleBigWidget);
- thresX->setObjectName(QString::fromUtf8("thresX"));
- thresX->setMinimumSize(QSize(50, 15));
- thresX->setMaximum(500);
- thresX->setPageStep(10);
- thresX->setValue(100);
- thresX->setOrientation(Qt::Horizontal);
- thresX->setTickPosition(QSlider::NoTicks);
-
- gridLayout->addWidget(thresX, 1, 9, 1, 1);
-
- thresY = new QSlider(bubbleBigWidget);
- thresY->setObjectName(QString::fromUtf8("thresY"));
- thresY->setMinimumSize(QSize(50, 15));
- thresY->setMaximum(500);
- thresY->setPageStep(10);
- thresY->setValue(100);
- thresY->setOrientation(Qt::Horizontal);
- thresY->setTickPosition(QSlider::NoTicks);
-
- gridLayout->addWidget(thresY, 3, 9, 1, 1);
-
- thresZ = new QSlider(bubbleBigWidget);
- thresZ->setObjectName(QString::fromUtf8("thresZ"));
- thresZ->setMinimumSize(QSize(50, 15));
- thresZ->setMaximum(500);
- thresZ->setPageStep(10);
- thresZ->setValue(100);
- thresZ->setOrientation(Qt::Horizontal);
- thresZ->setTickPosition(QSlider::NoTicks);
-
- gridLayout->addWidget(thresZ, 4, 9, 1, 1);
-
- spinThresX = new QSpinBox(bubbleBigWidget);
- spinThresX->setObjectName(QString::fromUtf8("spinThresX"));
- spinThresX->setMinimumSize(QSize(50, 22));
- spinThresX->setMaximum(500);
- spinThresX->setSingleStep(10);
- spinThresX->setValue(100);
-
- gridLayout->addWidget(spinThresX, 1, 10, 1, 1);
-
- spinThresY = new QSpinBox(bubbleBigWidget);
- spinThresY->setObjectName(QString::fromUtf8("spinThresY"));
- spinThresY->setMinimumSize(QSize(50, 22));
- spinThresY->setMaximum(500);
- spinThresY->setSingleStep(10);
- spinThresY->setValue(100);
-
- gridLayout->addWidget(spinThresY, 3, 10, 1, 1);
-
- spinThresZ = new QSpinBox(bubbleBigWidget);
- spinThresZ->setObjectName(QString::fromUtf8("spinThresZ"));
- spinThresZ->setMinimumSize(QSize(50, 22));
- spinThresZ->setMaximum(500);
- spinThresZ->setSingleStep(10);
- spinThresZ->setValue(100);
-
- gridLayout->addWidget(spinThresZ, 4, 10, 1, 1);
+ redX = new QSlider(bubbleBigWidget);
+ redX->setObjectName(QString::fromUtf8("redX"));
+ redX->setMinimumSize(QSize(50, 15));
+ redX->setMaximum(100);
+ redX->setPageStep(10);
+ redX->setValue(70);
+ redX->setOrientation(Qt::Horizontal);
+ redX->setTickPosition(QSlider::NoTicks);
+
+ gridLayout->addWidget(redX, 1, 9, 1, 1);
+
+ redY = new QSlider(bubbleBigWidget);
+ redY->setObjectName(QString::fromUtf8("redY"));
+ redY->setMinimumSize(QSize(50, 15));
+ redY->setMaximum(100);
+ redY->setPageStep(10);
+ redY->setValue(70);
+ redY->setOrientation(Qt::Horizontal);
+ redY->setTickPosition(QSlider::NoTicks);
+
+ gridLayout->addWidget(redY, 3, 9, 1, 1);
+
+ redZ = new QSlider(bubbleBigWidget);
+ redZ->setObjectName(QString::fromUtf8("redZ"));
+ redZ->setMinimumSize(QSize(50, 15));
+ redZ->setMaximum(100);
+ redZ->setPageStep(10);
+ redZ->setValue(70);
+ redZ->setOrientation(Qt::Horizontal);
+ redZ->setTickPosition(QSlider::NoTicks);
+
+ gridLayout->addWidget(redZ, 4, 9, 1, 1);
+
+ spinRedX = new QSpinBox(bubbleBigWidget);
+ spinRedX->setObjectName(QString::fromUtf8("spinRedX"));
+ spinRedX->setMinimumSize(QSize(50, 22));
+ spinRedX->setMaximum(100);
+ spinRedX->setSingleStep(5);
+ spinRedX->setValue(70);
+
+ gridLayout->addWidget(spinRedX, 1, 10, 1, 1);
+
+ spinRedY = new QSpinBox(bubbleBigWidget);
+ spinRedY->setObjectName(QString::fromUtf8("spinRedY"));
+ spinRedY->setMinimumSize(QSize(50, 22));
+ spinRedY->setMaximum(100);
+ spinRedY->setSingleStep(5);
+ spinRedY->setValue(70);
+
+ gridLayout->addWidget(spinRedY, 3, 10, 1, 1);
+
+ spinRedZ = new QSpinBox(bubbleBigWidget);
+ spinRedZ->setObjectName(QString::fromUtf8("spinRedZ"));
+ spinRedZ->setMinimumSize(QSize(50, 22));
+ spinRedZ->setMaximum(100);
+ spinRedZ->setSingleStep(5);
+ spinRedZ->setValue(70);
+
+ gridLayout->addWidget(spinRedZ, 4, 10, 1, 1);
lblSensitivity_3 = new QLabel(bubbleBigWidget);
lblSensitivity_3->setObjectName(QString::fromUtf8("lblSensitivity_3"));
- lblSensitivity_3->setMinimumSize(QSize(100, 0));
+ lblSensitivity_3->setMinimumSize(QSize(110, 0));
lblSensitivity_3->setMaximumSize(QSize(150, 16777215));
lblSensitivity_3->setStyleSheet(QString::fromUtf8("color:#ccc;\n"
"background:none;"));
@@ -1118,18 +1134,18 @@ public:
QObject::connect(spinNeutralZone, SIGNAL(valueChanged(int)), slideNeutralZone, SLOT(setValue(int)));
QObject::connect(slideSmoothing, SIGNAL(valueChanged(int)), spinSmoothing, SLOT(setValue(int)));
QObject::connect(spinSmoothing, SIGNAL(valueChanged(int)), slideSmoothing, SLOT(setValue(int)));
- QObject::connect(thresYaw, SIGNAL(valueChanged(int)), spinThresYaw, SLOT(setValue(int)));
- QObject::connect(spinThresYaw, SIGNAL(valueChanged(int)), thresYaw, SLOT(setValue(int)));
- QObject::connect(thresPitch, SIGNAL(valueChanged(int)), spinThresPitch, SLOT(setValue(int)));
- QObject::connect(spinThresPitch, SIGNAL(valueChanged(int)), thresPitch, SLOT(setValue(int)));
- QObject::connect(thresRoll, SIGNAL(valueChanged(int)), spinThresRoll, SLOT(setValue(int)));
- QObject::connect(spinThresRoll, SIGNAL(valueChanged(int)), thresRoll, SLOT(setValue(int)));
- QObject::connect(thresX, SIGNAL(valueChanged(int)), spinThresX, SLOT(setValue(int)));
- QObject::connect(spinThresX, SIGNAL(valueChanged(int)), thresX, SLOT(setValue(int)));
- QObject::connect(thresY, SIGNAL(valueChanged(int)), spinThresY, SLOT(setValue(int)));
- QObject::connect(spinThresY, SIGNAL(valueChanged(int)), thresY, SLOT(setValue(int)));
- QObject::connect(thresZ, SIGNAL(valueChanged(int)), spinThresZ, SLOT(setValue(int)));
- QObject::connect(spinThresZ, SIGNAL(valueChanged(int)), thresZ, SLOT(setValue(int)));
+ QObject::connect(redYaw, SIGNAL(valueChanged(int)), spinRedYaw, SLOT(setValue(int)));
+ QObject::connect(spinRedYaw, SIGNAL(valueChanged(int)), redYaw, SLOT(setValue(int)));
+ QObject::connect(redPitch, SIGNAL(valueChanged(int)), spinRedPitch, SLOT(setValue(int)));
+ QObject::connect(spinRedPitch, SIGNAL(valueChanged(int)), redPitch, SLOT(setValue(int)));
+ QObject::connect(redRoll, SIGNAL(valueChanged(int)), spinRedRoll, SLOT(setValue(int)));
+ QObject::connect(spinRedRoll, SIGNAL(valueChanged(int)), redRoll, SLOT(setValue(int)));
+ QObject::connect(redX, SIGNAL(valueChanged(int)), spinRedX, SLOT(setValue(int)));
+ QObject::connect(spinRedX, SIGNAL(valueChanged(int)), redX, SLOT(setValue(int)));
+ QObject::connect(redY, SIGNAL(valueChanged(int)), spinRedY, SLOT(setValue(int)));
+ QObject::connect(spinRedY, SIGNAL(valueChanged(int)), redY, SLOT(setValue(int)));
+ QObject::connect(redZ, SIGNAL(valueChanged(int)), spinRedZ, SLOT(setValue(int)));
+ QObject::connect(spinRedZ, SIGNAL(valueChanged(int)), redZ, SLOT(setValue(int)));
iconcomboTrackerSource->setCurrentIndex(-1);
iconcomboBox->setCurrentIndex(-1);
@@ -1195,6 +1211,8 @@ public:
groupGameProtocol->setTitle(QApplication::translate("FaceTrackNoIRClass", "Game protocol", 0, QApplication::UnicodeUTF8));
lblSensYaw_3->setText(QApplication::translate("FaceTrackNoIRClass", "Smoothing (samples)", 0, QApplication::UnicodeUTF8));
lblSensYaw_4->setText(QApplication::translate("FaceTrackNoIRClass", "Rotation Neutral Zone (degr.)", 0, QApplication::UnicodeUTF8));
+ chkUseEWMA->setText(QString());
+ lblSensYaw_5->setText(QApplication::translate("FaceTrackNoIRClass", "Use EWMA filtering", 0, QApplication::UnicodeUTF8));
cameraName->setText(QApplication::translate("FaceTrackNoIRClass", "Camera Name", 0, QApplication::UnicodeUTF8));
lblSensitivity->setText(QApplication::translate("FaceTrackNoIRClass", "Sensitivity (100 = x1)", 0, QApplication::UnicodeUTF8));
lblSensYaw->setText(QApplication::translate("FaceTrackNoIRClass", "Yaw", 0, QApplication::UnicodeUTF8));
@@ -1211,8 +1229,8 @@ public:
lblInvert1_2->setText(QApplication::translate("FaceTrackNoIRClass", "Invert", 0, QApplication::UnicodeUTF8));
chkInvertY->setText(QString());
chkInvertZ->setText(QString());
- lblSensitivity_2->setText(QApplication::translate("FaceTrackNoIRClass", "Threshold (100 = 1)", 0, QApplication::UnicodeUTF8));
- lblSensitivity_3->setText(QApplication::translate("FaceTrackNoIRClass", "Threshold (100 = 1)", 0, QApplication::UnicodeUTF8));
+ lblSensitivity_2->setText(QApplication::translate("FaceTrackNoIRClass", "Red.factor (100 = 1)", 0, QApplication::UnicodeUTF8));
+ lblSensitivity_3->setText(QApplication::translate("FaceTrackNoIRClass", "Red.factor (100 = 1)", 0, QApplication::UnicodeUTF8));
lblSensitivity_4->setText(QApplication::translate("FaceTrackNoIRClass", "Sensitivity (100 = x1)", 0, QApplication::UnicodeUTF8));
menuFile->setTitle(QApplication::translate("FaceTrackNoIRClass", "File", 0, QApplication::UnicodeUTF8));
menuAbout->setTitle(QApplication::translate("FaceTrackNoIRClass", "About", 0, QApplication::UnicodeUTF8));
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index c22961bd..377f605d 100644
--- a/FaceTrackNoIR/tracker.cpp
+++ b/FaceTrackNoIR/tracker.cpp
@@ -55,6 +55,7 @@ float Tracker::offset_headRotZ = 0.0f;
// Flags
bool Tracker::confid = false;
+bool Tracker::newdata = false;
bool Tracker::set_initial = false;
bool Tracker::do_tracking = true;
bool Tracker::do_center = false;
@@ -73,12 +74,14 @@ float Tracker::invertX = 1.0f;
float Tracker::invertY = 1.0f;
float Tracker::invertZ = 1.0f;
-float Tracker::thresYaw = 1.0f;
-float Tracker::thresPitch = 1.0f;
-float Tracker::thresRoll = 1.0f;
-float Tracker::thresX = 1.0f;
-float Tracker::thresY = 1.0f;
-float Tracker::thresZ = 1.0f;
+bool Tracker::useFilter = false;
+
+float Tracker::redYaw = 0.7f;
+float Tracker::redPitch = 0.7f;
+float Tracker::redRoll = 0.7f;
+float Tracker::redX = 0.7f;
+float Tracker::redY = 0.7f;
+float Tracker::redZ = 0.7f;
float Tracker::rotNeutralZone = 0.087f; // Neutral Zone for rotations (rad)
@@ -200,6 +203,12 @@ void Tracker::run() {
float newY = 0.0f;
float newZ = 0.0f;
+ //QFile data("output.txt");
+ //if (data.open(QFile::WriteOnly | QFile::Truncate)) {
+ // QTextStream out(&data);
+ // out << "Polling results";
+ //}
+
//
// Setup the DirectInput for keyboard strokes
//
@@ -274,7 +283,7 @@ void Tracker::run() {
}
//if the confidence is good enough the headpose will be updated **/
- if (Tracker::confid) {
+ if (Tracker::confid && Tracker::newdata) {
//
// Most games need an offset to the initial position and NOT the
@@ -295,48 +304,67 @@ void Tracker::run() {
headRotZLine->setText(QString("%1").arg(Tracker::getHeadRotZ()*100, 0, 'f', 1));
//// listener.setTrackedPosition(QPoint(Tracker::getHeadPosX()-50, Tracker::getHeadPosY()-37.5));
- server_FT->setHeadRotX( Tracker::headRotX ); // rads (?)
+ //
+ // Copy the Raw values directly to Free-track server
+ //
+ server_FT->setHeadRotX( Tracker::headRotX ); // rads
server_FT->setHeadRotY( Tracker::headRotY );
server_FT->setHeadRotZ( Tracker::headRotZ );
- server_FT->setHeadPosX( Tracker::headPosX * 1000.0f); // From m to mm
+ server_FT->setHeadPosX( Tracker::headPosX * 1000.0f); // From m to mm
server_FT->setHeadPosY( Tracker::headPosY * 1000.0f);
server_FT->setHeadPosZ( ( Tracker::headPosZ - Tracker::initial_headPosZ ) * 1000.0f);
//
- // Add the raw values to the QList, so they can be smoothed.
- // The raw value that enters the QList is first (evt.) inverted and corrected for Neutral Zone.
+ // Calculate the new values, applying a low-pass filter.
+ // Add the values to their respective QList, for further smoothing
//
- newPitch = Tracker::headRotX;
- if ( (fabs (newPitch - prevPitch) ) < Tracker::thresPitch ) { // delta smaller than threshold?
- newPitch = prevPitch;
+ if (Tracker::useFilter) {
+ newPitch = lowPassFilter ( Tracker::headRotX, &prevPitch, 0.020f, Tracker::redPitch );
}
else {
- prevPitch = newPitch;
+ newPitch = Tracker::headRotX;
}
- addRaw2List ( &rawPitchList, intMaxPitchItems, getCorrectedNewRaw ( Tracker::invertPitch * newPitch , Tracker::rotNeutralZone ) );
-
- newYaw = Tracker::headRotY;
- if ( (fabs (newYaw - prevYaw) ) < Tracker::thresYaw ) { // delta smaller than threshold?
- newYaw = prevYaw;
+ addRaw2List ( &rawPitchList, intMaxPitchItems, newPitch );
+ //QTextStream out(&data);
+ //out << "Raw:" << Tracker::headRotX << " filtered:" << newPitch << endl;
+ if (Tracker::useFilter) {
+ newYaw = lowPassFilter ( Tracker::headRotY, &prevYaw, 0.020f, Tracker::redYaw );
}
else {
- prevYaw = newYaw;
+ newYaw = Tracker::headRotY;
}
- addRaw2List ( &rawYawList, intMaxYawItems, getCorrectedNewRaw ( Tracker::invertYaw * newYaw, Tracker::rotNeutralZone ) );
-
- newRoll = Tracker::headRotZ;
- if ( (fabs (newRoll - prevRoll) ) < Tracker::thresRoll ) { // delta smaller than threshold?
- newRoll = prevRoll;
+ addRaw2List ( &rawYawList, intMaxYawItems, newYaw );
+ if (Tracker::useFilter) {
+ newRoll = lowPassFilter ( Tracker::headRotZ, &prevRoll, 0.020f, Tracker::redRoll );
+ }
+ else {
+ newRoll = Tracker::headRotZ;
+ }
+ addRaw2List ( &rawRollList, intMaxRollItems, newRoll );
+ if (Tracker::useFilter) {
+ newX = lowPassFilter ( Tracker::headPosX, &prevX, 0.020f, Tracker::redX );
+ }
+ else {
+ newX = Tracker::headPosX;
+ }
+ addRaw2List ( &rawXList, intMaxXItems, newX );
+ if (Tracker::useFilter) {
+ newY = lowPassFilter ( Tracker::headPosY, &prevY, 0.020f, Tracker::redY );
+ }
+ else {
+ newY = Tracker::headPosY;
+ }
+ addRaw2List ( &rawYList, intMaxYItems, newY );
+ if (Tracker::useFilter) {
+ newZ = lowPassFilter ( Tracker::headPosZ, &prevZ, 0.020f, Tracker::redZ );
}
else {
- prevRoll = newRoll;
+ newZ = Tracker::headPosZ;
}
- addRaw2List ( &rawRollList, intMaxRollItems, getCorrectedNewRaw ( Tracker::invertRoll * newRoll , Tracker::rotNeutralZone ) );
+ addRaw2List ( &rawZList, intMaxZItems, newZ );
- addRaw2List ( &rawXList, intMaxXItems, Tracker::invertX * Tracker::headPosX * 1000.0f );
- addRaw2List ( &rawYList, intMaxYItems, Tracker::invertY * Tracker::headPosY * 1000.0f );
- addRaw2List ( &rawZList, intMaxZItems, ( Tracker::invertZ * Tracker::headPosZ - Tracker::initial_headPosZ ) * 1000.0f );
+ Tracker::newdata = false; // Reset flag for ReceiveHeadPose
}
//
@@ -356,19 +384,19 @@ void Tracker::run() {
//
// Also send the Virtual Pose to FT-server and FG-server
//
- server_FT->setVirtRotX ( Tracker::sensPitch * getSmoothFromList( &rawPitchList ) - offset_headRotX );
- server_FT->setVirtRotY ( Tracker::sensYaw * getSmoothFromList( &rawYawList ) - offset_headRotY );
- server_FT->setVirtRotZ ( Tracker::sensRoll * getSmoothFromList( &rawRollList ) - offset_headRotZ );
- server_FT->setVirtPosX ( Tracker::sensX * getSmoothFromList( &rawXList ) - offset_headPosX );
- server_FT->setVirtPosY ( Tracker::sensY * getSmoothFromList( &rawYList ) - offset_headPosY );
- server_FT->setVirtPosZ ( Tracker::sensZ * getSmoothFromList( &rawZList ) - offset_headPosZ );
-
- server_FG->setVirtRotX ( getDegreesFromRads ( Tracker::sensPitch * getSmoothFromList( &rawPitchList ) - offset_headRotX ) );
- server_FG->setVirtRotY ( getDegreesFromRads ( Tracker::sensYaw * getSmoothFromList( &rawYawList ) - offset_headRotY ) );
- server_FG->setVirtRotZ ( getDegreesFromRads ( Tracker::sensRoll * getSmoothFromList( &rawRollList ) - offset_headRotZ ) );
- server_FG->setVirtPosX ( ( Tracker::sensX * getSmoothFromList( &rawXList ) - offset_headPosX ) / 1000.0f );
- server_FG->setVirtPosY ( ( Tracker::sensY * getSmoothFromList( &rawYList ) - offset_headPosY ) / 1000.0f );
- server_FG->setVirtPosZ ( ( Tracker::sensZ * getSmoothFromList( &rawZList ) - offset_headPosZ ) / 1000.0f );
+ server_FT->setVirtRotX ( Tracker::invertPitch * Tracker::sensPitch * (getSmoothFromList( &rawPitchList ) - offset_headRotX) );
+ server_FT->setVirtRotY ( Tracker::invertYaw * Tracker::sensYaw * (getSmoothFromList( &rawYawList ) - offset_headRotY) );
+ server_FT->setVirtRotZ ( Tracker::invertRoll * Tracker::sensRoll * (getSmoothFromList( &rawRollList ) - offset_headRotZ) );
+ server_FT->setVirtPosX ( ( Tracker::invertX * Tracker::sensX * (getSmoothFromList( &rawXList ) - offset_headPosX) ) * 1000.0f);
+ server_FT->setVirtPosY ( ( Tracker::invertY * Tracker::sensY * (getSmoothFromList( &rawYList ) - offset_headPosY) ) * 1000.0f );
+ server_FT->setVirtPosZ ( ( Tracker::invertZ * Tracker::sensZ * (getSmoothFromList( &rawZList ) - offset_headPosZ) ) * 1000.0f );
+
+ server_FG->setVirtRotX ( getDegreesFromRads ( Tracker::invertPitch * Tracker::sensPitch * (getSmoothFromList( &rawPitchList ) - offset_headRotX) ) );
+ server_FG->setVirtRotY ( getDegreesFromRads ( Tracker::invertYaw * Tracker::sensYaw * (getSmoothFromList( &rawYawList ) - offset_headRotY) ) );
+ server_FG->setVirtRotZ ( getDegreesFromRads ( Tracker::invertRoll * Tracker::sensRoll * (getSmoothFromList( &rawRollList ) - offset_headRotZ) ) );
+ server_FG->setVirtPosX ( Tracker::invertX * Tracker::sensX * (getSmoothFromList( &rawXList ) - offset_headPosX) );
+ server_FG->setVirtPosY ( Tracker::invertY * Tracker::sensY * (getSmoothFromList( &rawYList ) - offset_headPosY) );
+ server_FG->setVirtPosZ ( Tracker::invertZ * Tracker::sensZ * (getSmoothFromList( &rawZList ) - offset_headPosZ) );
}
else {
//
@@ -381,16 +409,16 @@ void Tracker::run() {
server_FT->setVirtPosY ( 0.0f );
server_FT->setVirtPosZ ( 0.0f );
- server_FG->setVirtRotX( 0.0f );
- server_FG->setVirtRotY( 0.0f );
- server_FG->setVirtRotZ( 0.0f );
+ server_FG->setVirtRotX ( 0.0f );
+ server_FG->setVirtRotY ( 0.0f );
+ server_FG->setVirtRotZ ( 0.0f );
server_FG->setVirtPosX ( 0.0f );
server_FG->setVirtPosY ( 0.0f );
server_FG->setVirtPosZ ( 0.0f );
}
//for lower cpu load
- msleep(50);
+ msleep(20);
yieldCurrentThread();
}
}
@@ -415,13 +443,12 @@ void Tracker::receiveHeadPose(void *,smEngineHeadPoseData head_pose, smCameraVid
Tracker::setHeadRotX(head_pose.head_rot.x_rads);
Tracker::setHeadRotY(head_pose.head_rot.y_rads);
Tracker::setHeadRotZ(head_pose.head_rot.z_rads);
-
} else {
Tracker::confid = false;
-
}
+ Tracker::newdata = true; // Set flag for run()
// for lower cpu load
- msleep(50);
+ msleep(40);
yieldCurrentThread();
}
@@ -520,3 +547,20 @@ float Tracker::getCorrectedNewRaw ( float NewRaw, float rotNeutral ) {
}
}
+
+//
+// Implementation of an Exponentially Weighed Moving Average, used to serve as a low-pass filter.
+// 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)
+//
+float Tracker::lowPassFilter ( float newvalue, float *oldvalue, float dt, float coeff) {
+float c = 0.0f;
+float fil = 0.0f;
+
+ c = dt / (coeff + dt);
+ fil = (newvalue * c) + (*oldvalue * (1 - c));
+ *oldvalue = fil;
+
+ return fil;
+}
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h
index 0103e8f2..8614d2e6 100644
--- a/FaceTrackNoIR/tracker.h
+++ b/FaceTrackNoIR/tracker.h
@@ -85,6 +85,7 @@ private:
// Flags to start/stop/reset tracking
static bool confid;
+ static bool newdata;
static bool set_initial; // initial headpose is set
static bool do_tracking; // Start/stop tracking, using MINUS key on keyboard
static bool do_center; // Center head-position, using EQUALS key on keyboard
@@ -104,13 +105,15 @@ private:
static float invertY;
static float invertZ;
- /** Thresholds to remove jitter **/
- static float thresYaw;
- static float thresPitch;
- static float thresRoll;
- static float thresX;
- static float thresY;
- static float thresZ;
+ static bool useFilter;
+
+ /** Factors to remove jitter **/
+ static float redYaw;
+ static float redPitch;
+ static float redRoll;
+ static float redX;
+ static float redY;
+ static float redZ;
static float rotNeutralZone; // Neutral Zone for rotations (rad).
@@ -196,18 +199,21 @@ public:
static void setInvertY(bool invert) { invertY = invert?-1.0f:+1.0f; }
static void setInvertZ(bool invert) { invertZ = invert?-1.0f:+1.0f; }
- static void setThresYaw(int x) { thresYaw = x/100.0f; }
- static void setThresPitch(int x) { thresPitch = x/100.0f; }
- static void setThresRoll(int x) { thresRoll = x/100.0f; }
- static void setThresX(int x) { thresX = x/100.0f; }
- static void setThresY(int x) { thresY = x/100.0f; }
- static void setThresZ(int x) { thresZ = x/100.0f; }
+ static void setUseFilter(bool set) { useFilter = set; }
+
+ static void setRedYaw(int x) { redYaw = x/100.0f; }
+ static void setRedPitch(int x) { redPitch = x/100.0f; }
+ static void setRedRoll(int x) { redRoll = x/100.0f; }
+ static void setRedX(int x) { redX = x/100.0f; }
+ static void setRedY(int x) { redY = x/100.0f; }
+ static void setRedZ(int x) { redZ = x/100.0f; }
static void setNeutralZone(int x) { rotNeutralZone = (x * 2.0f * 3.14159)/360.0f; }
void addRaw2List ( QList<float> *rawList, float maxIndex, float raw );
float getSmoothFromList ( QList<float> *rawList );
float getCorrectedNewRaw ( float NewRaw, float rotNeutral );
+ float lowPassFilter ( float newvalue, float *oldvalue, float dt, float coeff);
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 6990d208..9a5929e6 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 7c799589..0f3ea35d 100644
--- a/bin/Settings/ArmA.ini
+++ b/bin/Settings/ArmA.ini
@@ -1,9 +1,9 @@
[Tracking]
-Smooth=10
+Smooth=11
NeutralZone=5
-sensYaw=90
-sensPitch=90
-sensRoll=90
+sensYaw=100
+sensPitch=100
+sensRoll=100
sensX=70
sensY=70
sensZ=40
@@ -13,12 +13,13 @@ invertRoll=true
invertX=false
invertY=false
invertZ=false
-thresYaw=2
-thresPitch=2
-thresRoll=2
-thresX=100
-thresY=100
-thresZ=100
+redYaw=70
+redPitch=70
+redRoll=70
+redX=70
+redY=70
+redZ=70
+useEWMA=true
[GameProtocol]
Selection=0