summaryrefslogtreecommitdiffhomepage
path: root/FaceTrackNoIR
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2011-01-24 21:18:52 +0000
committerWim Vriend <facetracknoir@gmail.com>2011-01-24 21:18:52 +0000
commit5a63e2a7735fa982885b1164e35aedbaabf95047 (patch)
tree786a2317a3d51f9116006b44f5eea0f5ab249c2a /FaceTrackNoIR
parenta1126d63fe3068cc5651c8c3060647a33e4bb710 (diff)
EWMA2-filter implemented.
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@43 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FaceTrackNoIR')
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.cpp66
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.h9
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.ui686
-rw-r--r--FaceTrackNoIR/tracker.cpp47
-rw-r--r--FaceTrackNoIR/tracker.h14
5 files changed, 337 insertions, 485 deletions
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp
index fb48b149..cec69d44 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.cpp
+++ b/FaceTrackNoIR/FaceTrackNoIR.cpp
@@ -117,12 +117,9 @@ void FaceTrackNoIR::setupFaceTrackNoIR() {
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.minSmooth, SIGNAL(valueChanged(int)), this, SLOT(setMinSmooth(int)));
+ connect(ui.maxSmooth, SIGNAL(valueChanged(int)), this, SLOT(setMaxSmooth(int)));
+ connect(ui.powCurve, SIGNAL(valueChanged(int)), this, SLOT(setPowCurve(int)));
// Connect slider for smoothing
connect(ui.slideSmoothing, SIGNAL(valueChanged(int)), this, SLOT(setSmoothing(int)));
@@ -310,12 +307,9 @@ void FaceTrackNoIR::save() {
iniFile.setValue ( "invertY", ui.chkInvertY->isChecked() );
iniFile.setValue ( "invertZ", ui.chkInvertZ->isChecked() );
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.setValue ( "minSmooth", ui.minSmooth->value() );
+ iniFile.setValue ( "powCurve", ui.powCurve->value() );
+ iniFile.setValue ( "maxSmooth", ui.maxSmooth->value() );
iniFile.endGroup ();
iniFile.beginGroup ( "GameProtocol" );
@@ -429,12 +423,9 @@ void FaceTrackNoIR::loadSettings() {
ui.chkInvertY->setChecked (iniFile.value ( "invertY", 0 ).toBool());
ui.chkInvertZ->setChecked (iniFile.value ( "invertZ", 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());
- ui.redX->setValue (iniFile.value ( "redX", 70 ).toInt());
- ui.redY->setValue (iniFile.value ( "redY", 70 ).toInt());
- ui.redZ->setValue (iniFile.value ( "redZ", 70 ).toInt());
+ ui.minSmooth->setValue (iniFile.value ( "minSmooth", 2 ).toInt());
+ ui.powCurve->setValue (iniFile.value ( "powCurve", 10 ).toInt());
+ ui.maxSmooth->setValue (iniFile.value ( "maxSmooth", 10 ).toInt());
iniFile.endGroup ();
iniFile.beginGroup ( "GameProtocol" );
@@ -509,12 +500,9 @@ void FaceTrackNoIR::startTracker( ) {
tracker->setInvertY (ui.chkInvertY->isChecked() );
tracker->setInvertZ (ui.chkInvertZ->isChecked() );
- tracker->setRedYaw (ui.redYaw->value() );
- tracker->setRedPitch (ui.redPitch->value() );
- tracker->setRedRoll (ui.redRoll->value() );
- tracker->setRedX (ui.redX->value() );
- tracker->setRedY (ui.redY->value() );
- tracker->setRedZ (ui.redZ->value() );
+ tracker->setMinSmooth (ui.minSmooth->value() );
+ tracker->setPowCurve (ui.powCurve->value() );
+ tracker->setMaxSmooth (ui.maxSmooth->value() );
tracker->start( QThread::TimeCriticalPriority );
@@ -635,38 +623,20 @@ void FaceTrackNoIR::setUseFilter( int set ) {
}
/** set the redhold from the slider **/
-void FaceTrackNoIR::setRedYaw( int redh ) {
- Tracker::setRedYaw ( redh );
+void FaceTrackNoIR::setMinSmooth( int redh ) {
+ Tracker::setMinSmooth ( redh );
settingsDirty = true;
}
/** set the redhold from the slider **/
-void FaceTrackNoIR::setRedPitch( int redh ) {
- Tracker::setRedPitch ( redh );
+void FaceTrackNoIR::setPowCurve( int redh ) {
+ Tracker::setPowCurve ( redh );
settingsDirty = true;
}
/** set the redhold from the slider **/
-void FaceTrackNoIR::setRedRoll( int redh ) {
- Tracker::setRedRoll ( redh );
- settingsDirty = true;
-}
-
-/** set the redhold from the slider **/
-void FaceTrackNoIR::setRedX( int redh ) {
- Tracker::setRedX ( redh );
- settingsDirty = true;
-}
-
-/** set the redhold from the slider **/
-void FaceTrackNoIR::setRedY( int redh ) {
- Tracker::setRedY ( redh );
- settingsDirty = true;
-}
-
-/** set the redhold from the slider **/
-void FaceTrackNoIR::setRedZ( int redh ) {
- Tracker::setRedZ ( redh );
+void FaceTrackNoIR::setMaxSmooth( int redh ) {
+ Tracker::setMaxSmooth ( redh );
settingsDirty = true;
}
diff --git a/FaceTrackNoIR/FaceTrackNoIR.h b/FaceTrackNoIR/FaceTrackNoIR.h
index 984b09c0..c1d48a4b 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.h
+++ b/FaceTrackNoIR/FaceTrackNoIR.h
@@ -136,12 +136,9 @@ private:
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 setMinSmooth( int redh );
+ void setMaxSmooth( int redh );
+ void setPowCurve( int redh );
//smoothing slider
void setSmoothing( int smooth );
diff --git a/FaceTrackNoIR/FaceTrackNoIR.ui b/FaceTrackNoIR/FaceTrackNoIR.ui
index 15d960bd..22e5bcf4 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.ui
+++ b/FaceTrackNoIR/FaceTrackNoIR.ui
@@ -1244,115 +1244,17 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QLabel" name="lblSensYaw">
- <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="layoutDirection">
- <enum>Qt::RightToLeft</enum>
- </property>
- <property name="styleSheet">
- <string notr="true">color:#ccc;
-background:none;</string>
- </property>
- <property name="text">
- <string>Yaw</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="lblSensPitch">
- <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="layoutDirection">
- <enum>Qt::RightToLeft</enum>
- </property>
- <property name="styleSheet">
- <string notr="true">color:#ccc;
-background:none;</string>
- </property>
- <property name="text">
- <string>Pitch</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="lblSensRoll">
- <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="layoutDirection">
- <enum>Qt::RightToLeft</enum>
- </property>
- <property name="styleSheet">
- <string notr="true">color:#ccc;
-background:none;</string>
- </property>
- <property name="text">
- <string>Roll</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="lblSensitivity_2">
- <property name="minimumSize">
- <size>
- <width>110</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>Red.factor (100 = 1)</string>
- </property>
- </widget>
- </item>
<item row="1" column="1">
- <widget class="QSlider" name="redYaw">
+ <widget class="QSlider" name="minSmooth">
<property name="minimumSize">
<size>
<width>45</width>
<height>15</height>
</size>
</property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
<property name="maximum">
<number>100</number>
</property>
@@ -1360,7 +1262,7 @@ background:none;</string>
<number>10</number>
</property>
<property name="value">
- <number>70</number>
+ <number>2</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -1371,13 +1273,16 @@ background:none;</string>
</widget>
</item>
<item row="2" column="1">
- <widget class="QSlider" name="redPitch">
+ <widget class="QSlider" name="maxSmooth">
<property name="minimumSize">
<size>
<width>45</width>
<height>15</height>
</size>
</property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
<property name="maximum">
<number>100</number>
</property>
@@ -1385,7 +1290,7 @@ background:none;</string>
<number>10</number>
</property>
<property name="value">
- <number>70</number>
+ <number>10</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -1396,13 +1301,16 @@ background:none;</string>
</widget>
</item>
<item row="3" column="1">
- <widget class="QSlider" name="redRoll">
+ <widget class="QSlider" name="powCurve">
<property name="minimumSize">
<size>
<width>45</width>
<height>15</height>
</size>
</property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
<property name="maximum">
<number>100</number>
</property>
@@ -1410,7 +1318,7 @@ background:none;</string>
<number>10</number>
</property>
<property name="value">
- <number>70</number>
+ <number>10</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -1421,7 +1329,7 @@ background:none;</string>
</widget>
</item>
<item row="1" column="2">
- <widget class="QSpinBox" name="spinRedYaw">
+ <widget class="QSpinBox" name="spinMinSmooth">
<property name="minimumSize">
<size>
<width>40</width>
@@ -1431,6 +1339,9 @@ background:none;</string>
<property name="styleSheet">
<string notr="true">background:none;</string>
</property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
<property name="maximum">
<number>100</number>
</property>
@@ -1438,12 +1349,12 @@ background:none;</string>
<number>5</number>
</property>
<property name="value">
- <number>70</number>
+ <number>2</number>
</property>
</widget>
</item>
<item row="2" column="2">
- <widget class="QSpinBox" name="spinRedPitch">
+ <widget class="QSpinBox" name="spinMaxSmooth">
<property name="minimumSize">
<size>
<width>40</width>
@@ -1453,6 +1364,9 @@ background:none;</string>
<property name="styleSheet">
<string notr="true">background:none;</string>
</property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
<property name="maximum">
<number>100</number>
</property>
@@ -1460,12 +1374,12 @@ background:none;</string>
<number>5</number>
</property>
<property name="value">
- <number>70</number>
+ <number>10</number>
</property>
</widget>
</item>
<item row="3" column="2">
- <widget class="QSpinBox" name="spinRedRoll">
+ <widget class="QSpinBox" name="spinPowCurve">
<property name="minimumSize">
<size>
<width>40</width>
@@ -1482,42 +1396,58 @@ background:none;</string>
<number>5</number>
</property>
<property name="value">
- <number>70</number>
+ <number>10</number>
</property>
</widget>
</item>
<item row="1" column="3">
- <widget class="QCheckBox" name="chkInvertYaw">
+ <widget class="QLabel" name="lblInvert1">
+ <property name="minimumSize">
+ <size>
+ <width>35</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>16777215</height>
+ </size>
+ </property>
<property name="styleSheet">
- <string notr="true">background:none;</string>
+ <string notr="true">color:#ccc;
+background:none;</string>
</property>
<property name="text">
- <string/>
+ <string>frames</string>
</property>
</widget>
</item>
<item row="2" column="3">
- <widget class="QCheckBox" name="chkInvertPitch">
- <property name="styleSheet">
- <string notr="true">background:none;</string>
+ <widget class="QLabel" name="lblInvert1_4">
+ <property name="minimumSize">
+ <size>
+ <width>35</width>
+ <height>0</height>
+ </size>
</property>
- <property name="text">
- <string/>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>16777215</height>
+ </size>
</property>
- </widget>
- </item>
- <item row="3" column="3">
- <widget class="QCheckBox" name="chkInvertRoll">
<property name="styleSheet">
- <string notr="true">background:none;</string>
+ <string notr="true">color:#ccc;
+background:none;</string>
</property>
<property name="text">
- <string/>
+ <string>frames</string>
</property>
</widget>
</item>
- <item row="0" column="3">
- <widget class="QLabel" name="lblInvert1">
+ <item row="3" column="3">
+ <widget class="QLabel" name="lblInvert1_5">
<property name="minimumSize">
<size>
<width>0</width>
@@ -1535,99 +1465,90 @@ background:none;</string>
background:none;</string>
</property>
<property name="text">
- <string>Invert</string>
+ <string>pow</string>
</property>
</widget>
</item>
- </layout>
- </item>
- <item>
- <widget class="Line" name="line_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QGridLayout" name="gridEWMATranslations">
<item row="1" column="0">
- <widget class="QLabel" name="lblSensX">
+ <widget class="QLabel" name="lblInvert1_6">
<property name="minimumSize">
<size>
- <width>25</width>
+ <width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
- <width>150</width>
+ <width>30</width>
<height>16777215</height>
</size>
</property>
- <property name="layoutDirection">
- <enum>Qt::RightToLeft</enum>
- </property>
<property name="styleSheet">
<string notr="true">color:#ccc;
background:none;</string>
</property>
<property name="text">
- <string>X</string>
+ <string>Min.</string>
</property>
</widget>
</item>
<item row="2" column="0">
- <widget class="QLabel" name="lblSensY">
+ <widget class="QLabel" name="lblInvert1_7">
<property name="minimumSize">
<size>
- <width>25</width>
+ <width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
- <width>150</width>
+ <width>30</width>
<height>16777215</height>
</size>
</property>
- <property name="layoutDirection">
- <enum>Qt::RightToLeft</enum>
- </property>
<property name="styleSheet">
<string notr="true">color:#ccc;
background:none;</string>
</property>
<property name="text">
- <string>Y</string>
+ <string>Max.</string>
</property>
</widget>
</item>
<item row="3" column="0">
- <widget class="QLabel" name="lblSensZ">
+ <widget class="QLabel" name="lblInvert1_8">
<property name="minimumSize">
<size>
- <width>25</width>
+ <width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
- <width>150</width>
+ <width>30</width>
<height>16777215</height>
</size>
</property>
- <property name="layoutDirection">
- <enum>Qt::RightToLeft</enum>
- </property>
<property name="styleSheet">
<string notr="true">color:#ccc;
background:none;</string>
</property>
<property name="text">
- <string>Z</string>
+ <string>Curve</string>
</property>
</widget>
</item>
+ </layout>
+ </item>
+ <item>
+ <widget class="Line" name="line_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QGridLayout" name="gridEWMATranslations">
<item row="1" column="3">
<widget class="QCheckBox" name="chkInvertX">
<property name="styleSheet">
@@ -1681,158 +1602,219 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QSlider" name="redX">
+ <item row="1" column="2">
+ <widget class="QLabel" name="lblSensX">
<property name="minimumSize">
<size>
- <width>45</width>
- <height>15</height>
+ <width>25</width>
+ <height>0</height>
</size>
</property>
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="pageStep">
- <number>10</number>
+ <property name="maximumSize">
+ <size>
+ <width>150</width>
+ <height>16777215</height>
+ </size>
</property>
- <property name="value">
- <number>70</number>
+ <property name="layoutDirection">
+ <enum>Qt::RightToLeft</enum>
</property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <property name="styleSheet">
+ <string notr="true">color:#ccc;
+background:none;</string>
</property>
- <property name="tickPosition">
- <enum>QSlider::NoTicks</enum>
+ <property name="text">
+ <string>X</string>
</property>
</widget>
</item>
- <item row="2" column="1">
- <widget class="QSlider" name="redY">
+ <item row="2" column="2">
+ <widget class="QLabel" name="lblSensY">
<property name="minimumSize">
<size>
- <width>45</width>
- <height>15</height>
+ <width>25</width>
+ <height>0</height>
</size>
</property>
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="pageStep">
- <number>10</number>
+ <property name="maximumSize">
+ <size>
+ <width>150</width>
+ <height>16777215</height>
+ </size>
</property>
- <property name="value">
- <number>70</number>
+ <property name="layoutDirection">
+ <enum>Qt::RightToLeft</enum>
</property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <property name="styleSheet">
+ <string notr="true">color:#ccc;
+background:none;</string>
</property>
- <property name="tickPosition">
- <enum>QSlider::NoTicks</enum>
+ <property name="text">
+ <string>Y</string>
</property>
</widget>
</item>
- <item row="3" column="1">
- <widget class="QSlider" name="redZ">
+ <item row="3" column="2">
+ <widget class="QLabel" name="lblSensZ">
<property name="minimumSize">
<size>
- <width>45</width>
- <height>15</height>
+ <width>25</width>
+ <height>0</height>
</size>
</property>
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="pageStep">
- <number>10</number>
+ <property name="maximumSize">
+ <size>
+ <width>150</width>
+ <height>16777215</height>
+ </size>
</property>
- <property name="value">
- <number>70</number>
+ <property name="layoutDirection">
+ <enum>Qt::RightToLeft</enum>
</property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <property name="styleSheet">
+ <string notr="true">color:#ccc;
+background:none;</string>
</property>
- <property name="tickPosition">
- <enum>QSlider::NoTicks</enum>
+ <property name="text">
+ <string>Z</string>
</property>
</widget>
</item>
- <item row="1" column="2">
- <widget class="QSpinBox" name="spinRedX">
+ <item row="1" column="0">
+ <widget class="QLabel" name="lblSensYaw">
<property name="minimumSize">
<size>
- <width>40</width>
- <height>22</height>
+ <width>25</width>
+ <height>0</height>
</size>
</property>
- <property name="styleSheet">
- <string notr="true">background:none;</string>
+ <property name="maximumSize">
+ <size>
+ <width>150</width>
+ <height>16777215</height>
+ </size>
</property>
- <property name="maximum">
- <number>100</number>
+ <property name="layoutDirection">
+ <enum>Qt::RightToLeft</enum>
</property>
- <property name="singleStep">
- <number>5</number>
+ <property name="styleSheet">
+ <string notr="true">color:#ccc;
+background:none;</string>
</property>
- <property name="value">
- <number>70</number>
+ <property name="text">
+ <string>Yaw</string>
</property>
</widget>
</item>
- <item row="2" column="2">
- <widget class="QSpinBox" name="spinRedY">
+ <item row="2" column="0">
+ <widget class="QLabel" name="lblSensPitch">
<property name="minimumSize">
<size>
- <width>40</width>
- <height>22</height>
+ <width>25</width>
+ <height>0</height>
</size>
</property>
- <property name="styleSheet">
- <string notr="true">background:none;</string>
+ <property name="maximumSize">
+ <size>
+ <width>150</width>
+ <height>16777215</height>
+ </size>
</property>
- <property name="maximum">
- <number>100</number>
+ <property name="layoutDirection">
+ <enum>Qt::RightToLeft</enum>
</property>
- <property name="singleStep">
- <number>5</number>
+ <property name="styleSheet">
+ <string notr="true">color:#ccc;
+background:none;</string>
</property>
- <property name="value">
- <number>70</number>
+ <property name="text">
+ <string>Pitch</string>
</property>
</widget>
</item>
- <item row="3" column="2">
- <widget class="QSpinBox" name="spinRedZ">
+ <item row="3" column="0">
+ <widget class="QLabel" name="lblSensRoll">
<property name="minimumSize">
<size>
- <width>40</width>
- <height>22</height>
+ <width>25</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>150</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::RightToLeft</enum>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">color:#ccc;
+background:none;</string>
+ </property>
+ <property name="text">
+ <string>Roll</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="4">
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Minimum</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
</size>
</property>
+ </spacer>
+ </item>
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="chkInvertYaw">
<property name="styleSheet">
<string notr="true">background:none;</string>
</property>
- <property name="maximum">
- <number>100</number>
+ <property name="text">
+ <string/>
</property>
- <property name="singleStep">
- <number>5</number>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="chkInvertPitch">
+ <property name="styleSheet">
+ <string notr="true">background:none;</string>
</property>
- <property name="value">
- <number>70</number>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QCheckBox" name="chkInvertRoll">
+ <property name="styleSheet">
+ <string notr="true">background:none;</string>
+ </property>
+ <property name="text">
+ <string/>
</property>
</widget>
</item>
<item row="0" column="1">
- <widget class="QLabel" name="lblSensitivity_3">
+ <widget class="QLabel" name="lblInvert1_3">
<property name="minimumSize">
<size>
- <width>110</width>
+ <width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
- <width>150</width>
+ <width>30</width>
<height>16777215</height>
</size>
</property>
@@ -1841,42 +1823,12 @@ background:none;</string>
background:none;</string>
</property>
<property name="text">
- <string>Red.factor (100 = 1)</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="label_3">
- <property name="layoutDirection">
- <enum>Qt::RightToLeft</enum>
- </property>
- <property name="styleSheet">
- <string notr="true">color:#ccc;
-background:none;</string>
- </property>
- <property name="text">
- <string>EWMA</string>
+ <string>Invert</string>
</property>
</widget>
</item>
</layout>
</item>
- <item>
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Minimum</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
</layout>
</widget>
</item>
@@ -2244,12 +2196,12 @@ background:none;</string>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
- <x>776</x>
- <y>180</y>
+ <x>442</x>
+ <y>347</y>
</hint>
<hint type="destinationlabel">
- <x>832</x>
- <y>182</y>
+ <x>494</x>
+ <y>349</y>
</hint>
</hints>
</connection>
@@ -2260,204 +2212,108 @@ background:none;</string>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
- <x>832</x>
- <y>182</y>
- </hint>
- <hint type="destinationlabel">
- <x>776</x>
- <y>180</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>redYaw</sender>
- <signal>valueChanged(int)</signal>
- <receiver>spinRedYaw</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>492</x>
- <y>431</y>
- </hint>
- <hint type="destinationlabel">
- <x>543</x>
- <y>432</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>spinRedYaw</sender>
- <signal>valueChanged(int)</signal>
- <receiver>redYaw</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>532</x>
- <y>433</y>
- </hint>
- <hint type="destinationlabel">
- <x>481</x>
- <y>433</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>redPitch</sender>
- <signal>valueChanged(int)</signal>
- <receiver>spinRedPitch</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>486</x>
- <y>462</y>
- </hint>
- <hint type="destinationlabel">
- <x>540</x>
- <y>469</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>spinRedPitch</sender>
- <signal>valueChanged(int)</signal>
- <receiver>redPitch</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>533</x>
- <y>458</y>
- </hint>
- <hint type="destinationlabel">
- <x>501</x>
- <y>460</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>redRoll</sender>
- <signal>valueChanged(int)</signal>
- <receiver>spinRedRoll</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>498</x>
- <y>487</y>
- </hint>
- <hint type="destinationlabel">
- <x>542</x>
- <y>492</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>spinRedRoll</sender>
- <signal>valueChanged(int)</signal>
- <receiver>redRoll</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>537</x>
- <y>495</y>
+ <x>494</x>
+ <y>349</y>
</hint>
<hint type="destinationlabel">
- <x>504</x>
- <y>490</y>
+ <x>442</x>
+ <y>347</y>
</hint>
</hints>
</connection>
<connection>
- <sender>redX</sender>
+ <sender>minSmooth</sender>
<signal>valueChanged(int)</signal>
- <receiver>spinRedX</receiver>
+ <receiver>spinMinSmooth</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
- <x>803</x>
- <y>432</y>
+ <x>648</x>
+ <y>293</y>
</hint>
<hint type="destinationlabel">
- <x>847</x>
- <y>439</y>
+ <x>696</x>
+ <y>295</y>
</hint>
</hints>
</connection>
<connection>
- <sender>spinRedX</sender>
+ <sender>spinMinSmooth</sender>
<signal>valueChanged(int)</signal>
- <receiver>redX</receiver>
+ <receiver>minSmooth</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
- <x>844</x>
- <y>429</y>
+ <x>696</x>
+ <y>295</y>
</hint>
<hint type="destinationlabel">
- <x>800</x>
- <y>428</y>
+ <x>648</x>
+ <y>293</y>
</hint>
</hints>
</connection>
<connection>
- <sender>redY</sender>
+ <sender>maxSmooth</sender>
<signal>valueChanged(int)</signal>
- <receiver>spinRedY</receiver>
+ <receiver>spinMaxSmooth</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
- <x>785</x>
- <y>461</y>
+ <x>648</x>
+ <y>320</y>
</hint>
<hint type="destinationlabel">
- <x>851</x>
- <y>465</y>
+ <x>696</x>
+ <y>322</y>
</hint>
</hints>
</connection>
<connection>
- <sender>spinRedY</sender>
+ <sender>spinMaxSmooth</sender>
<signal>valueChanged(int)</signal>
- <receiver>redY</receiver>
+ <receiver>maxSmooth</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
- <x>845</x>
- <y>463</y>
+ <x>696</x>
+ <y>322</y>
</hint>
<hint type="destinationlabel">
- <x>792</x>
- <y>464</y>
+ <x>648</x>
+ <y>320</y>
</hint>
</hints>
</connection>
<connection>
- <sender>redZ</sender>
+ <sender>powCurve</sender>
<signal>valueChanged(int)</signal>
- <receiver>spinRedZ</receiver>
+ <receiver>spinPowCurve</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
- <x>794</x>
- <y>483</y>
+ <x>648</x>
+ <y>347</y>
</hint>
<hint type="destinationlabel">
- <x>845</x>
- <y>486</y>
+ <x>696</x>
+ <y>349</y>
</hint>
</hints>
</connection>
<connection>
- <sender>spinRedZ</sender>
+ <sender>spinPowCurve</sender>
<signal>valueChanged(int)</signal>
- <receiver>redZ</receiver>
+ <receiver>powCurve</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
- <x>843</x>
- <y>499</y>
+ <x>696</x>
+ <y>349</y>
</hint>
<hint type="destinationlabel">
- <x>805</x>
- <y>493</y>
+ <x>648</x>
+ <y>347</y>
</hint>
</hints>
</connection>
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index ab2f3b86..c054873d 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;
@@ -80,6 +80,10 @@ TShortKey Tracker::CenterKey; // ShortKey to Center headposition
TShortKey Tracker::StartStopKey; // ShortKey to Start/stop tracking
TShortKey Tracker::InhibitKey; // ShortKey to inhibit axis while tracking
+ITrackerPtr Tracker::pTracker; // Pointer to Tracker instance (in DLL)
+IFilterPtr Tracker::pFilter; // Pointer to Filter instance (in DLL)
+
+
/** constructor **/
Tracker::Tracker( int clientID, int facetrackerID ) {
importGetTracker getIT;
@@ -552,7 +556,6 @@ void Tracker::run() {
if (Tracker::do_tracking && Tracker::confid) {
// Pitch
- current_camera_position = new_camera_position; // Remember the latest position
target_camera_position.x = X.headPos - X.offset_headPos - X.initial_headPos;
target_camera_position.y = Y.headPos - Y.offset_headPos - Y.initial_headPos;
target_camera_position.z = Z.headPos - Z.offset_headPos - Z.initial_headPos;
@@ -607,11 +610,11 @@ void Tracker::run() {
// All Protocol server(s)
if (server_Game) {
server_Game->setVirtRotX ( new_camera_position.pitch ); // degrees
- //server_Game->setVirtRotY ( new_camera_position.yaw );
- //server_Game->setVirtRotZ ( new_camera_position.roll );
- //server_Game->setVirtPosX ( new_camera_position.x ); // centimeters
- //server_Game->setVirtPosY ( new_camera_position.y );
- //server_Game->setVirtPosZ ( new_camera_position.z );
+ server_Game->setVirtRotY ( new_camera_position.yaw );
+ server_Game->setVirtRotZ ( new_camera_position.roll );
+ server_Game->setVirtPosX ( new_camera_position.x ); // centimeters
+ server_Game->setVirtPosY ( new_camera_position.y );
+ server_Game->setVirtPosZ ( new_camera_position.z );
}
# ifdef USE_DEBUG_CLIENT
@@ -806,6 +809,36 @@ void Tracker::addRaw2List ( QList<float> *rawList, float maxIndex, float raw ) {
}
//
+// Set the filter-value from the GUI.
+//
+void Tracker::setMinSmooth ( int x ) {
+ if (Tracker::pFilter) {
+ Tracker::pFilter->setParameterValue(0, x);
+ qDebug() << "Tracker::setMinSmooth Min Smooting frames set to: " << x;
+ }
+}
+
+//
+// Set the filter-value from the GUI.
+//
+void Tracker::setMaxSmooth ( int x ) {
+ if (Tracker::pFilter) {
+ Tracker::pFilter->setParameterValue(1, x);
+ qDebug() << "Tracker::setMaxSmooth Max Smooting frames set to: " << x;
+ }
+}
+
+//
+// Set the filter-value from the GUI.
+//
+void Tracker::setPowCurve( int x ) {
+ if (Tracker::pFilter) {
+ Tracker::pFilter->setParameterValue(2, x);
+ qDebug() << "Tracker::setPowCurve Pow Curve set to: " << x;
+ }
+}
+
+//
// Get the Smoothed value from the QList.
//
float Tracker::getSmoothFromList ( QList<float> *rawList ) {
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h
index 49310a23..73d4161e 100644
--- a/FaceTrackNoIR/tracker.h
+++ b/FaceTrackNoIR/tracker.h
@@ -141,8 +141,8 @@ private:
APIScope *faceapi_scope;
QSharedPointer<EngineBase> _engine;
smEngineHandle _engine_handle;
- ITrackerPtr pTracker; // Pointer to Tracker instance (in DLL)
- IFilterPtr pFilter; // Pointer to Filter instance (in DLL)
+ static ITrackerPtr pTracker; // Pointer to Tracker instance (in DLL)
+ static IFilterPtr pFilter; // Pointer to Filter instance (in DLL)
/** static callback method for the head pose tracking **/
static void STDCALL receiveHeadPose(void *,smEngineHeadPoseData head_pose, smCameraVideoFrame video_frame);
@@ -222,13 +222,9 @@ public:
static void setInvertZ(bool invert) { Z.invert = invert?-1.0f:+1.0f; }
static void setUseFilter(bool set) { useFilter = set; }
-
- static void setRedYaw(int x) { Yaw.red = x/100.0f; }
- static void setRedPitch(int x) { Pitch.red = x/100.0f; }
- static void setRedRoll(int x) { Roll.red = x/100.0f; }
- static void setRedX(int x) { X.red = x/100.0f; }
- static void setRedY(int x) { Y.red = x/100.0f; }
- static void setRedZ(int x) { Z.red = x/100.0f; }
+ static void setMinSmooth(int x);
+ static void setMaxSmooth(int x);
+ static void setPowCurve(int x);
static float getSmoothFromList ( QList<float> *rawList );
static float getDegreesFromRads ( float rads ) { return (rads * 57.295781f); }