summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2011-03-28 21:15:30 +0000
committerWim Vriend <facetracknoir@gmail.com>2011-03-28 21:15:30 +0000
commit43734bf0f9fa8531b817943756157a2c459886a8 (patch)
tree7eb4637767f8c10a35e80d4583a40a29d82b5d08
parent62a27051a8222ba2759af4afcaf86eb0321786c1 (diff)
Added the display for the output-pose, with the 'man in black'.
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@59 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
-rw-r--r--FTNoIR_PoseWidget/PoseWidget.qrc10
-rw-r--r--FTNoIR_PoseWidget/glwidget.cpp210
-rw-r--r--FTNoIR_PoseWidget/glwidget.h72
-rw-r--r--FTNoIR_PoseWidget/images/side1.bmpbin0 -> 44950 bytes
-rw-r--r--FTNoIR_PoseWidget/images/side1.pngbin0 -> 9018 bytes
-rw-r--r--FTNoIR_PoseWidget/images/side2.pngbin0 -> 2922 bytes
-rw-r--r--FTNoIR_PoseWidget/images/side3.pngbin0 -> 2922 bytes
-rw-r--r--FTNoIR_PoseWidget/images/side4.pngbin0 -> 2922 bytes
-rw-r--r--FTNoIR_PoseWidget/images/side5.pngbin0 -> 2922 bytes
-rw-r--r--FTNoIR_PoseWidget/images/side6.pngbin0 -> 4768 bytes
-rw-r--r--FTNoIR_Tracker_Base/ftnoir_tracker_base.h16
-rw-r--r--FaceTrackNoIR.suobin360960 -> 367104 bytes
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.cpp47
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.h6
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.ui98
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.vcproj235
-rw-r--r--FaceTrackNoIR/tracker.cpp156
-rw-r--r--FaceTrackNoIR/tracker.h6
-rw-r--r--bin/FaceTrackNoIR.exebin626688 -> 663552 bytes
-rw-r--r--bin/Settings/Wings of Prey.ini8
-rw-r--r--faceAPI/main.cpp3
21 files changed, 749 insertions, 118 deletions
diff --git a/FTNoIR_PoseWidget/PoseWidget.qrc b/FTNoIR_PoseWidget/PoseWidget.qrc
new file mode 100644
index 00000000..65038eba
--- /dev/null
+++ b/FTNoIR_PoseWidget/PoseWidget.qrc
@@ -0,0 +1,10 @@
+<RCC>
+ <qresource prefix="/">
+ <file>images/side1.png</file>
+ <file>images/side2.png</file>
+ <file>images/side3.png</file>
+ <file>images/side4.png</file>
+ <file>images/side5.png</file>
+ <file>images/side6.png</file>
+ </qresource>
+</RCC>
diff --git a/FTNoIR_PoseWidget/glwidget.cpp b/FTNoIR_PoseWidget/glwidget.cpp
new file mode 100644
index 00000000..55b65619
--- /dev/null
+++ b/FTNoIR_PoseWidget/glwidget.cpp
@@ -0,0 +1,210 @@
+/********************************************************************************
+* FaceTrackNoIR This program is a private project of the some enthusiastic *
+* gamers from Holland, who don't like to pay much for *
+* head-tracking. *
+* *
+* Copyright (C) 2010 Wim Vriend (Developing) *
+* Ron Hendriks (Researching and Testing) *
+* *
+* Homepage *
+* *
+* This program is free software; you can redistribute it and/or modify it *
+* under the terms of the GNU General Public License as published by the *
+* Free Software Foundation; either version 3 of the License, or (at your *
+* option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, but *
+* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
+* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
+* more details. *
+* *
+* Adopted this widget from the 'textures' sample of the Nokia Qt toolkit. *
+* *
+* You should have received a copy of the GNU General Public License along *
+* with this program; if not, see <http://www.gnu.org/licenses/>. *
+*********************************************************************************/
+
+#include <QtGui>
+#include <QtOpenGL>
+
+#include "glwidget.h"
+
+GLWidget::GLWidget(QWidget *parent, QGLWidget *shareWidget)
+ : QGLWidget(parent, shareWidget)
+{
+ clearColor = Qt::black;
+ xRot = 0;
+ yRot = 0;
+ zRot = 0;
+
+#ifdef QT_OPENGL_ES_2
+ program = 0;
+#endif
+}
+
+GLWidget::~GLWidget()
+{
+}
+
+QSize GLWidget::minimumSizeHint() const
+{
+ return QSize(60, 60);
+}
+
+QSize GLWidget::sizeHint() const
+{
+ return QSize(90, 90);
+}
+
+void GLWidget::rotateBy(int xAngle, int yAngle, int zAngle)
+{
+ xRot = xAngle;
+ yRot = yAngle;
+ zRot = zAngle;
+ updateGL();
+}
+
+void GLWidget::setClearColor(const QColor &color)
+{
+ clearColor = color;
+ updateGL();
+}
+
+void GLWidget::initializeGL()
+{
+ makeObject();
+
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_CULL_FACE);
+#ifndef QT_OPENGL_ES_2
+ glEnable(GL_TEXTURE_2D);
+#endif
+
+#ifdef QT_OPENGL_ES_2
+
+#define PROGRAM_VERTEX_ATTRIBUTE 0
+#define PROGRAM_TEXCOORD_ATTRIBUTE 1
+
+ QGLShader *vshader = new QGLShader(QGLShader::Vertex, this);
+ const char *vsrc =
+ "attribute highp vec4 vertex;\n"
+ "attribute mediump vec4 texCoord;\n"
+ "varying mediump vec4 texc;\n"
+ "uniform mediump mat4 matrix;\n"
+ "void main(void)\n"
+ "{\n"
+ " gl_Position = matrix * vertex;\n"
+ " texc = texCoord;\n"
+ "}\n";
+ vshader->compileSourceCode(vsrc);
+
+ QGLShader *fshader = new QGLShader(QGLShader::Fragment, this);
+ const char *fsrc =
+ "uniform sampler2D texture;\n"
+ "varying mediump vec4 texc;\n"
+ "void main(void)\n"
+ "{\n"
+ " gl_FragColor = texture2D(texture, texc.st);\n"
+ "}\n";
+ fshader->compileSourceCode(fsrc);
+
+ program = new QGLShaderProgram(this);
+ program->addShader(vshader);
+ program->addShader(fshader);
+ program->bindAttributeLocation("vertex", PROGRAM_VERTEX_ATTRIBUTE);
+ program->bindAttributeLocation("texCoord", PROGRAM_TEXCOORD_ATTRIBUTE);
+ program->link();
+
+ program->bind();
+ program->setUniformValue("texture", 0);
+
+#endif
+}
+
+void GLWidget::paintGL()
+{
+ qglClearColor(clearColor);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+#if !defined(QT_OPENGL_ES_2)
+
+ glLoadIdentity();
+ glTranslatef(0.0f, 0.0f, -10.0f);
+
+ glRotatef(xRot, 1.0f, 0.0f, 0.0f);
+ glRotatef(yRot, 0.0f, 1.0f, 0.0f);
+ glRotatef(-1.0f * zRot, 0.0f, 0.0f, 1.0f);
+
+ glVertexPointer(3, GL_FLOAT, 0, vertices.constData());
+ glTexCoordPointer(2, GL_FLOAT, 0, texCoords.constData());
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+
+#else
+
+ QMatrix4x4 m;
+ m.ortho(-0.5f, +0.5f, +0.5f, -0.5f, 4.0f, 15.0f);
+ m.translate(0.0f, 0.0f, -10.0f);
+ m.rotate(xRot / 16.0f, 1.0f, 0.0f, 0.0f);
+ m.rotate(yRot / 16.0f, 0.0f, 1.0f, 0.0f);
+ m.rotate(zRot / 16.0f, 0.0f, 0.0f, 1.0f);
+
+ program->setUniformValue("matrix", m);
+ program->enableAttributeArray(PROGRAM_VERTEX_ATTRIBUTE);
+ program->enableAttributeArray(PROGRAM_TEXCOORD_ATTRIBUTE);
+ program->setAttributeArray
+ (PROGRAM_VERTEX_ATTRIBUTE, vertices.constData());
+ program->setAttributeArray
+ (PROGRAM_TEXCOORD_ATTRIBUTE, texCoords.constData());
+
+#endif
+
+ for (int i = 0; i < 6; ++i) {
+ glBindTexture(GL_TEXTURE_2D, textures[i]);
+ glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4);
+ }
+}
+
+void GLWidget::resizeGL(int width, int height)
+{
+ int side = qMin(width, height);
+ glViewport((width - side) / 2, (height - side) / 2, side, side);
+
+#if !defined(QT_OPENGL_ES_2)
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+#ifndef QT_OPENGL_ES
+ glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0);
+#else
+ glOrthof(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0);
+#endif
+ glMatrixMode(GL_MODELVIEW);
+#endif
+}
+
+void GLWidget::makeObject()
+{
+ static const int coords[6][4][3] = {
+ { { +1, -1, -1 }, { -1, -1, -1 }, { -1, +1, -1 }, { +1, +1, -1 } },
+ { { +1, +1, -1 }, { -1, +1, -1 }, { -1, +1, +1 }, { +1, +1, +1 } },
+ { { +1, -1, +1 }, { +1, -1, -1 }, { +1, +1, -1 }, { +1, +1, +1 } },
+ { { -1, -1, -1 }, { -1, -1, +1 }, { -1, +1, +1 }, { -1, +1, -1 } },
+ { { +1, -1, +1 }, { -1, -1, +1 }, { -1, -1, -1 }, { +1, -1, -1 } },
+ { { -1, -1, +1 }, { +1, -1, +1 }, { +1, +1, +1 }, { -1, +1, +1 } }
+ };
+
+ for (int j=0; j < 6; ++j) {
+ textures[j] = bindTexture
+ (QPixmap(QString(":/images/side%1.png").arg(j + 1)), GL_TEXTURE_2D);
+ }
+
+ for (int i = 0; i < 6; ++i) {
+ for (int j = 0; j < 4; ++j) {
+ texCoords.append
+ (QVector2D(j == 0 || j == 3, j == 0 || j == 1));
+ vertices.append
+ (QVector3D(0.4 * coords[i][j][0], 0.4 * coords[i][j][1],
+ 0.02 * coords[i][j][2]));
+ }
+ }
+}
diff --git a/FTNoIR_PoseWidget/glwidget.h b/FTNoIR_PoseWidget/glwidget.h
new file mode 100644
index 00000000..cff8cb83
--- /dev/null
+++ b/FTNoIR_PoseWidget/glwidget.h
@@ -0,0 +1,72 @@
+/********************************************************************************
+* FaceTrackNoIR This program is a private project of the some enthusiastic *
+* gamers from Holland, who don't like to pay much for *
+* head-tracking. *
+* *
+* Copyright (C) 2010 Wim Vriend (Developing) *
+* Ron Hendriks (Researching and Testing) *
+* *
+* Homepage *
+* *
+* This program is free software; you can redistribute it and/or modify it *
+* under the terms of the GNU General Public License as published by the *
+* Free Software Foundation; either version 3 of the License, or (at your *
+* option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, but *
+* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
+* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
+* more details. *
+* *
+* Adopted this widget from the 'textures' sample of the Nokia Qt toolkit. *
+* *
+* You should have received a copy of the GNU General Public License along *
+* with this program; if not, see <http://www.gnu.org/licenses/>. *
+*********************************************************************************/
+
+#ifndef GLWIDGET_H
+#define GLWIDGET_H
+
+#include <QtGui>
+#include <QGLWidget>
+
+class QGLShaderProgram;
+
+class GLWidget : public QGLWidget
+{
+ Q_OBJECT
+
+public:
+ GLWidget(QWidget *parent = 0, QGLWidget *shareWidget = 0);
+ ~GLWidget();
+
+ QSize minimumSizeHint() const;
+ QSize sizeHint() const;
+ void rotateBy(int xAngle, int yAngle, int zAngle);
+ void setClearColor(const QColor &color);
+
+signals:
+ void clicked();
+
+protected:
+ void initializeGL();
+ void paintGL();
+ void resizeGL(int width, int height);
+
+private:
+ void makeObject();
+
+ QColor clearColor;
+ QPoint lastPos;
+ int xRot;
+ int yRot;
+ int zRot;
+ GLuint textures[6];
+ QVector<QVector3D> vertices;
+ QVector<QVector2D> texCoords;
+#ifdef QT_OPENGL_ES_2
+ QGLShaderProgram *program;
+#endif
+};
+
+#endif
diff --git a/FTNoIR_PoseWidget/images/side1.bmp b/FTNoIR_PoseWidget/images/side1.bmp
new file mode 100644
index 00000000..29c28d80
--- /dev/null
+++ b/FTNoIR_PoseWidget/images/side1.bmp
Binary files differ
diff --git a/FTNoIR_PoseWidget/images/side1.png b/FTNoIR_PoseWidget/images/side1.png
new file mode 100644
index 00000000..e0315b77
--- /dev/null
+++ b/FTNoIR_PoseWidget/images/side1.png
Binary files differ
diff --git a/FTNoIR_PoseWidget/images/side2.png b/FTNoIR_PoseWidget/images/side2.png
new file mode 100644
index 00000000..67eb060b
--- /dev/null
+++ b/FTNoIR_PoseWidget/images/side2.png
Binary files differ
diff --git a/FTNoIR_PoseWidget/images/side3.png b/FTNoIR_PoseWidget/images/side3.png
new file mode 100644
index 00000000..67eb060b
--- /dev/null
+++ b/FTNoIR_PoseWidget/images/side3.png
Binary files differ
diff --git a/FTNoIR_PoseWidget/images/side4.png b/FTNoIR_PoseWidget/images/side4.png
new file mode 100644
index 00000000..67eb060b
--- /dev/null
+++ b/FTNoIR_PoseWidget/images/side4.png
Binary files differ
diff --git a/FTNoIR_PoseWidget/images/side5.png b/FTNoIR_PoseWidget/images/side5.png
new file mode 100644
index 00000000..67eb060b
--- /dev/null
+++ b/FTNoIR_PoseWidget/images/side5.png
Binary files differ
diff --git a/FTNoIR_PoseWidget/images/side6.png b/FTNoIR_PoseWidget/images/side6.png
new file mode 100644
index 00000000..f4160001
--- /dev/null
+++ b/FTNoIR_PoseWidget/images/side6.png
Binary files differ
diff --git a/FTNoIR_Tracker_Base/ftnoir_tracker_base.h b/FTNoIR_Tracker_Base/ftnoir_tracker_base.h
index 93fd5140..df7ec2c4 100644
--- a/FTNoIR_Tracker_Base/ftnoir_tracker_base.h
+++ b/FTNoIR_Tracker_Base/ftnoir_tracker_base.h
@@ -14,6 +14,22 @@ struct THeadPoseData {
};
#pragma pack(pop)
+//
+// Structure to hold all 6 DOF's
+//
+class T6DOF {
+public:
+ void initHeadPoseData(){
+ position.x = 0.0f;
+ position.y = 0.0f;
+ position.z = 0.0f;
+ position.yaw = 0.0f;
+ position.pitch = 0.0f;
+ position.roll = 0.0f;
+ }
+ THeadPoseData position;
+};
+
// COM-Like abstract interface.
// This interface doesn't require __declspec(dllexport/dllimport) specifier.
// Method calls are dispatched via virtual table.
diff --git a/FaceTrackNoIR.suo b/FaceTrackNoIR.suo
index 9e3ca2db..982e6626 100644
--- a/FaceTrackNoIR.suo
+++ b/FaceTrackNoIR.suo
Binary files differ
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp
index 029ed5b7..51acf6ec 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.cpp
+++ b/FaceTrackNoIR/FaceTrackNoIR.cpp
@@ -23,6 +23,7 @@
*********************************************************************************/
/*
Modifications (last one on top):
+ 20110328 - WVR: Added the display for output-pose.
20110207 - WVR: RadioButtons for 'Stop engine' added. It is now possible to choose Stop or Keep tracking.
20110109 - WVR: Added minimizeTaskBar option added. It is now possible to choose minimized or tray.
*/
@@ -34,6 +35,7 @@
#include "FGServer.h"
#include "FTNServer.h"
+
//
// Setup the Main Dialog
//
@@ -67,6 +69,14 @@ QMainWindow(parent, flags)
startTracker();
showMinimized();
}
+
+ Q_INIT_RESOURCE(PoseWidget);
+ _pose_display = new GLWidget(ui.widget4logo, 0);
+ _pose_display->rotateBy(0, 0, 0);
+
+ ui.lcdNumOutputRotX->setVisible(false);
+ ui.lcdNumOutputRotY->setVisible(false);
+ ui.lcdNumOutputRotZ->setVisible(false);
}
/** sets up all objects and connections to buttons */
@@ -148,7 +158,6 @@ void FaceTrackNoIR::setupFaceTrackNoIR() {
//Setup the timer for showing the headpose.
timUpdateHeadPose = new QTimer(this);
connect(timUpdateHeadPose, SIGNAL(timeout()), this, SLOT(showHeadPose()));
- timUpdateHeadPose->start(10);
}
/** destructor stops the engine and quits the faceapi **/
@@ -180,7 +189,6 @@ FaceTrackNoIR::~FaceTrackNoIR() {
break;
}
}
-
}
//
@@ -562,16 +570,31 @@ void FaceTrackNoIR::startTracker( ) {
timMinimizeFTN->setSingleShot( true );
timMinimizeFTN->start(timevalue);
}
+
+ //
+ // Start the timer to update the head-pose (digits and 'man in black')
+ //
+ timUpdateHeadPose->start(10);
+ ui.lcdNumOutputRotX->setVisible(true);
+ ui.lcdNumOutputRotY->setVisible(true);
+ ui.lcdNumOutputRotZ->setVisible(true);
}
/** stop tracking the face **/
void FaceTrackNoIR::stopTracker( ) {
//
- // Delete the video-display.
+ // Stop displaying the head-pose.
//
-// ui.video_frame->hide();
+ timUpdateHeadPose->stop();
+ _pose_display->rotateBy(0, 0, 0);
+ ui.lcdNumOutputRotX->setVisible(false);
+ ui.lcdNumOutputRotY->setVisible(false);
+ ui.lcdNumOutputRotZ->setVisible(false);
+ //
+ // Delete the tracker (after stopping things and all).
+ //
if ( tracker ) {
qDebug() << "stopTracker says: Deleting tracker!";
delete tracker;
@@ -651,6 +674,10 @@ void FaceTrackNoIR::setUseFilter( int set ) {
void FaceTrackNoIR::showHeadPose() {
THeadPoseData newdata;
+ //
+ // Get the pose and also display it.
+ // Updating the pose from within the Tracker-class caused crashes...
+ //
Tracker::getHeadPose(&newdata);
ui.lcdNumX->display((double) (((int)(newdata.x * 10.0f))/10.0f));
ui.lcdNumY->display((double) (((int)(newdata.y * 10.0f))/10.0f));
@@ -659,6 +686,18 @@ THeadPoseData newdata;
ui.lcdNumRotX->display((double) (((int)(newdata.yaw * 10.0f))/10.0f));
ui.lcdNumRotY->display((double) (((int)(newdata.pitch * 10.0f))/10.0f));
ui.lcdNumRotZ->display((double) (((int)(newdata.roll * 10.0f))/10.0f));
+
+ //
+ // Get the output-pose and also display it.
+ //
+ if (_pose_display) {
+ Tracker::getOutputHeadPose(&newdata);
+ _pose_display->rotateBy(newdata.pitch, newdata.yaw, newdata.roll);
+
+ ui.lcdNumOutputRotX->display((double) (((int)(newdata.yaw * 10.0f))/10.0f));
+ ui.lcdNumOutputRotY->display((double) (((int)(newdata.pitch * 10.0f))/10.0f));
+ ui.lcdNumOutputRotZ->display((double) (((int)(newdata.roll * 10.0f))/10.0f));
+ }
}
/** set the redhold from the slider **/
diff --git a/FaceTrackNoIR/FaceTrackNoIR.h b/FaceTrackNoIR/FaceTrackNoIR.h
index 7f73b5af..68c9a744 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.h
+++ b/FaceTrackNoIR/FaceTrackNoIR.h
@@ -35,6 +35,8 @@
#include <QDialog>
#include <QUrl>
+#include "../FTNoIR_PoseWidget/glwidget.h"
+
#include "ui_FaceTrackNoIR.h"
#include "ui_FTNoIR_KeyboardShortcuts.h"
#include "ui_FTNoIR_Preferences.h"
@@ -83,14 +85,14 @@ private:
ITrackerDialogPtr pTrackerDialog; // Pointer to Tracker dialog instance (in DLL)
- /** face api variables **/
-// VideoDisplayWidget *_display;
+ /** Widget variables **/
QVBoxLayout *l;
QWidget *_engine_controls;
QWidget *_server_controls;
QWidget *_preferences;
QWidget *_keyboard_shortcuts;
QWidget *_curve_config;
+ GLWidget *_pose_display;
/** QT objects **/
QDialog aboutDialog;
diff --git a/FaceTrackNoIR/FaceTrackNoIR.ui b/FaceTrackNoIR/FaceTrackNoIR.ui
index dd307544..48d231ac 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.ui
+++ b/FaceTrackNoIR/FaceTrackNoIR.ui
@@ -11,7 +11,7 @@
<x>0</x>
<y>0</y>
<width>925</width>
- <height>398</height>
+ <height>396</height>
</rect>
</property>
<property name="sizePolicy">
@@ -238,45 +238,89 @@ Support FaceTrackNoIR!</string>
</size>
</property>
</widget>
- <widget class="QFrame" name="logoInstitute">
+ <widget class="QLCDNumber" name="lcdNumOutputRotX">
<property name="geometry">
<rect>
- <x>0</x>
- <y>0</y>
- <width>90</width>
- <height>90</height>
+ <x>100</x>
+ <y>60</y>
+ <width>41</width>
+ <height>21</height>
</rect>
</property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <property name="autoFillBackground">
+ <bool>false</bool>
</property>
- <property name="minimumSize">
- <size>
- <width>90</width>
- <height>90</height>
- </size>
+ <property name="styleSheet">
+ <string notr="true">color: rgb(0, 255, 0);</string>
</property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>90</height>
- </size>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <property name="numDigits">
+ <number>3</number>
+ </property>
+ <property name="segmentStyle">
+ <enum>QLCDNumber::Flat</enum>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" name="lcdNumOutputRotY">
+ <property name="geometry">
+ <rect>
+ <x>150</x>
+ <y>60</y>
+ <width>41</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
</property>
<property name="styleSheet">
- <string notr="true">QFrame#logoInstitute {
- background:#595959 url(UIElements/logoFaceTrackNoIR.png) no-repeat;
-border:none;
-}</string>
+ <string notr="true">color: rgb(0, 255, 0);</string>
</property>
<property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
+ <enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
+ <property name="numDigits">
+ <number>3</number>
+ </property>
+ <property name="segmentStyle">
+ <enum>QLCDNumber::Flat</enum>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" name="lcdNumOutputRotZ">
+ <property name="geometry">
+ <rect>
+ <x>200</x>
+ <y>60</y>
+ <width>41</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">color: rgb(0, 255, 0);</string>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <property name="numDigits">
+ <number>3</number>
+ </property>
+ <property name="segmentStyle">
+ <enum>QLCDNumber::Flat</enum>
+ </property>
</widget>
</widget>
</item>
@@ -1019,7 +1063,7 @@ color:white;</string>
</item>
</layout>
</item>
- <item row="3" column="0">
+ <item row="4" column="0">
<widget class="QWidget" name="bubbleBigWidget" native="true">
<property name="minimumSize">
<size>
diff --git a/FaceTrackNoIR/FaceTrackNoIR.vcproj b/FaceTrackNoIR/FaceTrackNoIR.vcproj
index 10245e4b..10d2f8c7 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.vcproj
+++ b/FaceTrackNoIR/FaceTrackNoIR.vcproj
@@ -70,7 +70,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="QtMain.lib QtCore4.lib QtGui4.lib QtNetwork4.lib Strmiids.lib Ws2_32.lib QBezierConfigurator.lib FSUIPC_User.lib"
+ AdditionalDependencies="opengl32.lib QtMain.lib QtCore4.lib QtGui4.lib QtOpenGL4.lib QtNetwork4.lib Strmiids.lib Ws2_32.lib QBezierConfigurator.lib FSUIPC_User.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
AdditionalLibraryDirectories=""
GenerateManifest="true"
@@ -151,7 +151,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="qtmaind.lib QtCored4.lib QtGuid4.lib QtNetworkd4.lib Strmiids.lib QBezierConfigurator.lib FSUIPC_User.lib"
+ AdditionalDependencies="qtmaind.lib QtCored4.lib QtGuid4.lib QtOpenGL4.lib QtNetworkd4.lib Strmiids.lib QBezierConfigurator.lib FSUIPC_User.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
AdditionalLibraryDirectories="$(QTDIR)\lib"
IgnoreAllDefaultLibraries="false"
@@ -232,6 +232,10 @@
>
</File>
<File
+ RelativePath="..\FTNoIR_PoseWidget\glwidget.cpp"
+ >
+ </File>
+ <File
RelativePath=".\main.cpp"
>
</File>
@@ -500,6 +504,32 @@
>
</File>
<File
+ RelativePath="..\FTNoIR_PoseWidget\glwidget.h"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Moc&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; &quot;$(InputPath)&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot; -DQT_CORE_LIB -DQT_DLL -DQT_GUI_LIB -DQT_LARGEFILE_SUPPORT -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_THREAD_SUPPORT -DUNICODE -DWIN32 -I&quot;$(QTDIR)\include\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;$(QTDIR)\include\QtOpenGL\.&quot; -I&quot;$(QTDIR)\include\QtTest\.&quot; -I&quot;$(QTDIR)\include\QtWebKit\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Filter_EWMA2\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Tracker_UDP\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Tracker_UDP\GeneratedFiles\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;.\GeneratedFiles\.&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
+ Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Moc&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; &quot;$(InputPath)&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot; -DQT_CORE_LIB -DQT_DLL -DQT_GUI_LIB -DQT_LARGEFILE_SUPPORT -DQT_OPENGL_LIB -DQT_THREAD_SUPPORT -DUNICODE -DWIN32 -I&quot;$(QTDIR)\include\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;$(QTDIR)\include\QtOpenGL\.&quot; -I&quot;$(QTDIR)\include\QtTest\.&quot; -I&quot;$(QTDIR)\include\QtWebKit\.&quot; -I&quot;.\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;.\GeneratedFiles\.&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
+ Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath=".\PPJIoctl.h"
>
</File>
@@ -873,6 +903,26 @@
</FileConfiguration>
</File>
<File
+ RelativePath=".\GeneratedFiles\qrc_PoseWidget.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath=".\GeneratedFiles\ui_FaceTrackNoIR.h"
>
</File>
@@ -1022,6 +1072,18 @@
</FileConfiguration>
</File>
<File
+ RelativePath=".\GeneratedFiles\Release\moc_glwidget.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath=".\GeneratedFiles\Release\moc_PPJoyServer.cpp"
>
<FileConfiguration
@@ -1205,6 +1267,29 @@
</FileConfiguration>
</File>
<File
+ RelativePath=".\GeneratedFiles\Debug\moc_glwidget.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\$(InputName)1.obj"
+ XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\$(InputName)1.obj"
+ XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath=".\GeneratedFiles\Debug\moc_PPJoyServer.cpp"
>
<FileConfiguration
@@ -1302,9 +1387,155 @@
>
</File>
<File
+ RelativePath="..\FTNoIR_PoseWidget\PoseWidget.qrc"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Rcc&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -name &quot;$(InputName)&quot; -no-compress &quot;$(InputPath)&quot; -o .\GeneratedFiles\qrc_$(InputName).cpp&#x0D;&#x0A;"
+ AdditionalDependencies="$(InputPath);..\FTNoIR_PoseWidget\images\side1.png;..\FTNoIR_PoseWidget\images\side2.png;..\FTNoIR_PoseWidget\images\side3.png;..\FTNoIR_PoseWidget\images\side4.png;..\FTNoIR_PoseWidget\images\side5.png;..\FTNoIR_PoseWidget\images\side6.png"
+ Outputs=".\GeneratedFiles\qrc_$(InputName).cpp"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Rcc&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -name &quot;$(InputName)&quot; -no-compress &quot;$(InputPath)&quot; -o .\GeneratedFiles\qrc_$(InputName).cpp&#x0D;&#x0A;"
+ AdditionalDependencies="$(InputPath);..\FTNoIR_PoseWidget\images\side1.png;..\FTNoIR_PoseWidget\images\side2.png;..\FTNoIR_PoseWidget\images\side3.png;..\FTNoIR_PoseWidget\images\side4.png;..\FTNoIR_PoseWidget\images\side5.png;..\FTNoIR_PoseWidget\images\side6.png"
+ Outputs=".\GeneratedFiles\qrc_$(InputName).cpp"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath=".\images\SeeingMachines.ico"
>
</File>
+ <File
+ RelativePath="..\FTNoIR_PoseWidget\images\side1.png"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\FTNoIR_PoseWidget\images\side2.png"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\FTNoIR_PoseWidget\images\side3.png"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\FTNoIR_PoseWidget\images\side4.png"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\FTNoIR_PoseWidget\images\side5.png"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\FTNoIR_PoseWidget\images\side6.png"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
</Filter>
<File
RelativePath=".\FaceTrackNoIR.rc"
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index 01739389..38c72437 100644
--- a/FaceTrackNoIR/tracker.cpp
+++ b/FaceTrackNoIR/tracker.cpp
@@ -23,6 +23,8 @@
*********************************************************************************/
/*
Modifications (last one on top):
+ 20110328 - WVR: Changed the camera-structs into class-instances. This makes initialisation
+ easier and hopefully solves the remaining 'start-up problem'.
20110313 - WVR: Removed 'set_initial'. Less is more.
20110109 - WVR: Added setZero option to define behaviour after STOP tracking via shortkey.
20110104 - WVR: Removed a few nasty bugs (it was impossible to stop tracker without crash).
@@ -66,6 +68,12 @@ bool Tracker::setZero = true;
bool Tracker::setEngineStop = true;
HANDLE Tracker::hTrackMutex = 0;
+
+T6DOF Tracker::current_camera; // Used for filtering
+T6DOF Tracker::target_camera;
+T6DOF Tracker::new_camera;
+T6DOF Tracker::output_camera; // Position sent to game protocol
+
THeadPoseDOF Tracker::Pitch; // One structure for each of 6DOF's
THeadPoseDOF Tracker::Yaw;
THeadPoseDOF Tracker::Roll;
@@ -309,32 +317,12 @@ void Tracker::run() {
bool lastStartStopKey = false;
bool lastInhibitKey = false;
- THeadPoseData current_camera_position; // Used for filtering
- THeadPoseData target_camera_position;
- THeadPoseData new_camera_position;
-
Tracker::do_center = true; // Center initially
- current_camera_position.x = 0.0f;
- current_camera_position.y = 0.0f;
- current_camera_position.z = 0.0f;
- current_camera_position.yaw = 0.0f;
- current_camera_position.pitch = 0.0f;
- current_camera_position.roll = 0.0f;
-
- target_camera_position.x = 0.0f;
- target_camera_position.y = 0.0f;
- target_camera_position.z = 0.0f;
- target_camera_position.yaw = 0.0f;
- target_camera_position.pitch = 0.0f;
- target_camera_position.roll = 0.0f;
-
- new_camera_position.x = 0.0f;
- new_camera_position.y = 0.0f;
- new_camera_position.z = 0.0f;
- new_camera_position.yaw = 0.0f;
- new_camera_position.pitch = 0.0f;
- new_camera_position.roll = 0.0f;
+ current_camera.initHeadPoseData();
+ target_camera.initHeadPoseData();
+ new_camera.initHeadPoseData();
+ output_camera.initHeadPoseData();
//
// Test some Filter-stuff
@@ -432,12 +420,9 @@ void Tracker::run() {
Z.rawList.clear();
Z.prevPos = 0.0f;
- current_camera_position.x = 0.0f;
- current_camera_position.y = 0.0f;
- current_camera_position.z = 0.0f;
- current_camera_position.yaw = 0.0f;
- current_camera_position.pitch = 0.0f;
- current_camera_position.roll = 0.0f;
+ current_camera.initHeadPoseData();
+ target_camera.initHeadPoseData();
+ new_camera.initHeadPoseData();
pTracker->StartTracker( mainApp->winId() );
}
@@ -503,41 +488,41 @@ void Tracker::run() {
if (Tracker::do_tracking && Tracker::confid) {
// Pitch
- target_camera_position.x = getSmoothFromList( &X.rawList ) - X.offset_headPos;
- target_camera_position.y = getSmoothFromList( &Y.rawList ) - Y.offset_headPos;
- target_camera_position.z = getSmoothFromList( &Z.rawList ) - Z.offset_headPos;
- target_camera_position.pitch = getSmoothFromList( &Pitch.rawList ) - Pitch.offset_headPos;
- target_camera_position.yaw = getSmoothFromList( &Yaw.rawList ) - Yaw.offset_headPos;
- target_camera_position.roll = getSmoothFromList( &Roll.rawList ) - Roll.offset_headPos;
+ target_camera.position.x = getSmoothFromList( &X.rawList ) - X.offset_headPos;
+ target_camera.position.y = getSmoothFromList( &Y.rawList ) - Y.offset_headPos;
+ target_camera.position.z = getSmoothFromList( &Z.rawList ) - Z.offset_headPos;
+ target_camera.position.pitch = getSmoothFromList( &Pitch.rawList ) - Pitch.offset_headPos;
+ target_camera.position.yaw = getSmoothFromList( &Yaw.rawList ) - Yaw.offset_headPos;
+ target_camera.position.roll = getSmoothFromList( &Roll.rawList ) - Roll.offset_headPos;
if (Tracker::useFilter && pFilter) {
- pFilter->FilterHeadPoseData(&current_camera_position, &target_camera_position, &new_camera_position, Tracker::Pitch.newSample);
+ pFilter->FilterHeadPoseData(&current_camera.position, &target_camera.position, &new_camera.position, Tracker::Pitch.newSample);
}
else {
- new_camera_position.x = getSmoothFromList( &X.rawList ) - X.offset_headPos;
- new_camera_position.y = getSmoothFromList( &Y.rawList ) - Y.offset_headPos;
- new_camera_position.z = getSmoothFromList( &Z.rawList ) - Z.offset_headPos;
- new_camera_position.pitch = getSmoothFromList( &Pitch.rawList ) - Pitch.offset_headPos;
- new_camera_position.yaw = getSmoothFromList( &Yaw.rawList ) - Yaw.offset_headPos;
- new_camera_position.roll = getSmoothFromList( &Roll.rawList ) - Roll.offset_headPos;
+ output_camera.position.x = getSmoothFromList( &X.rawList ) - X.offset_headPos;
+ output_camera.position.y = getSmoothFromList( &Y.rawList ) - Y.offset_headPos;
+ output_camera.position.z = getSmoothFromList( &Z.rawList ) - Z.offset_headPos;
+ output_camera.position.pitch = getSmoothFromList( &Pitch.rawList ) - Pitch.offset_headPos;
+ output_camera.position.yaw = getSmoothFromList( &Yaw.rawList ) - Yaw.offset_headPos;
+ output_camera.position.roll = getSmoothFromList( &Roll.rawList ) - Roll.offset_headPos;
}
- new_camera_position.x = X.invert * getOutputFromCurve(&X.curve, new_camera_position.x, X.NeutralZone, X.MaxInput);
- new_camera_position.y = Y.invert * getOutputFromCurve(&Y.curve, new_camera_position.y, Y.NeutralZone, Y.MaxInput);
- new_camera_position.z = Z.invert * getOutputFromCurve(&Z.curve, new_camera_position.z, Z.NeutralZone, Z.MaxInput);
- new_camera_position.pitch = Pitch.invert * getOutputFromCurve(&Pitch.curve, new_camera_position.pitch, Pitch.NeutralZone, Pitch.MaxInput);
- new_camera_position.yaw = Yaw.invert * getOutputFromCurve(&Yaw.curve, new_camera_position.yaw, Yaw.NeutralZone, Yaw.MaxInput);
- new_camera_position.roll = Roll.invert * getOutputFromCurve(&Roll.curve, new_camera_position.roll, Roll.NeutralZone, Roll.MaxInput);
+ output_camera.position.x = X.invert * getOutputFromCurve(&X.curve, new_camera.position.x, X.NeutralZone, X.MaxInput);
+ output_camera.position.y = Y.invert * getOutputFromCurve(&Y.curve, new_camera.position.y, Y.NeutralZone, Y.MaxInput);
+ output_camera.position.z = Z.invert * getOutputFromCurve(&Z.curve, new_camera.position.z, Z.NeutralZone, Z.MaxInput);
+ output_camera.position.pitch = Pitch.invert * getOutputFromCurve(&Pitch.curve, new_camera.position.pitch, Pitch.NeutralZone, Pitch.MaxInput);
+ output_camera.position.yaw = Yaw.invert * getOutputFromCurve(&Yaw.curve, new_camera.position.yaw, Yaw.NeutralZone, Yaw.MaxInput);
+ output_camera.position.roll = Roll.invert * getOutputFromCurve(&Roll.curve, new_camera.position.roll, Roll.NeutralZone, Roll.MaxInput);
//
// Reset value for the selected axis, if inhibition is active
//
if (Tracker::do_inhibit) {
- if (InhibitKey.doPitch) new_camera_position.pitch = 0.0f;
- if (InhibitKey.doYaw) new_camera_position.yaw = 0.0f;
- if (InhibitKey.doRoll) new_camera_position.roll = 0.0f;
- if (InhibitKey.doX) new_camera_position.x = 0.0f;
- if (InhibitKey.doY) new_camera_position.y = 0.0f;
- if (InhibitKey.doZ) new_camera_position.z = 0.0f;
+ if (InhibitKey.doPitch) output_camera.position.pitch = 0.0f;
+ if (InhibitKey.doYaw) output_camera.position.yaw = 0.0f;
+ if (InhibitKey.doRoll) output_camera.position.roll = 0.0f;
+ if (InhibitKey.doX) output_camera.position.x = 0.0f;
+ if (InhibitKey.doY) output_camera.position.y = 0.0f;
+ if (InhibitKey.doZ) output_camera.position.z = 0.0f;
}
//
@@ -545,32 +530,32 @@ void Tracker::run() {
//
// Free-track
if (selectedClient == FREE_TRACK) {
- server_Game->setHeadRotX( new_camera_position.pitch ); // degrees
- server_Game->setHeadRotY( new_camera_position.yaw );
- server_Game->setHeadRotZ( new_camera_position.roll );
+ server_Game->setHeadRotX( output_camera.position.pitch ); // degrees
+ server_Game->setHeadRotY( output_camera.position.yaw );
+ server_Game->setHeadRotZ( output_camera.position.roll );
- server_Game->setHeadPosX( new_camera_position.x ); // centimeters
- server_Game->setHeadPosY( new_camera_position.y );
- server_Game->setHeadPosZ( new_camera_position.z );
+ server_Game->setHeadPosX( output_camera.position.x ); // centimeters
+ server_Game->setHeadPosY( output_camera.position.y );
+ server_Game->setHeadPosZ( output_camera.position.z );
}
// 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->setVirtRotX ( output_camera.position.pitch ); // degrees
+ server_Game->setVirtRotY ( output_camera.position.yaw );
+ server_Game->setVirtRotZ ( output_camera.position.roll );
+ server_Game->setVirtPosX ( output_camera.position.x ); // centimeters
+ server_Game->setVirtPosY ( output_camera.position.y );
+ server_Game->setVirtPosZ ( output_camera.position.z );
}
-// headRotXLine->setText(QString("%1").arg( new_camera_position.pitch, 0, 'f', 1)); // show degrees
-// headRotYLine->setText(QString("%1").arg( new_camera_position.yaw, 0, 'f', 1));
-// headRotZLine->setText(QString("%1").arg( new_camera_position.roll, 0, 'f', 1));
+// headRotXLine->setText(QString("%1").arg( new_camera.position.pitch, 0, 'f', 1)); // show degrees
+// headRotYLine->setText(QString("%1").arg( new_camera.position.yaw, 0, 'f', 1));
+// headRotZLine->setText(QString("%1").arg( new_camera.position.roll, 0, 'f', 1));
//
-//// headXLine->setText(QString("%1").arg( new_camera_position.x, 0, 'f', 1)); // show centimeters
-// headYLine->setText(QString("%1").arg( new_camera_position.y, 0, 'f', 1));
-// headZLine->setText(QString("%1").arg( new_camera_position.z, 0, 'f', 1));
+//// headXLine->setText(QString("%1").arg( new_camera.position.x, 0, 'f', 1)); // show centimeters
+// headYLine->setText(QString("%1").arg( new_camera.position.y, 0, 'f', 1));
+// headZLine->setText(QString("%1").arg( new_camera.position.z, 0, 'f', 1));
# ifdef USE_DEBUG_CLIENT
@@ -582,12 +567,12 @@ void Tracker::run() {
debug_Client->setHeadPosY( Tracker::Y.headPos );
debug_Client->setHeadPosZ( Tracker::Z.headPos );
- debug_Client->setVirtRotX ( new_camera_position.pitch ); // degrees
- debug_Client->setVirtRotY ( new_camera_position.yaw );
- debug_Client->setVirtRotZ ( new_camera_position.roll );
- debug_Client->setVirtPosX ( new_camera_position.x ); // centimeters
- debug_Client->setVirtPosY ( new_camera_position.y );
- debug_Client->setVirtPosZ ( new_camera_position.z );
+ debug_Client->setVirtRotX ( new_camera.position.pitch ); // degrees
+ debug_Client->setVirtRotY ( new_camera.position.yaw );
+ debug_Client->setVirtRotZ ( new_camera.position.roll );
+ debug_Client->setVirtPosX ( new_camera.position.x ); // centimeters
+ debug_Client->setVirtPosY ( new_camera.position.y );
+ debug_Client->setVirtPosZ ( new_camera.position.z );
# endif
@@ -749,6 +734,19 @@ void Tracker::getHeadPose( THeadPoseData *data ) {
}
//
+// Set the filter-value from the GUI.
+//
+void Tracker::getOutputHeadPose( THeadPoseData *data ) {
+ data->x = output_camera.position.x; // centimeters
+ data->y = output_camera.position.y;
+ data->z = output_camera.position.z;
+
+ data->pitch = output_camera.position.pitch; // degrees
+ data->yaw = output_camera.position.yaw;
+ data->roll = output_camera.position.roll;
+}
+
+//
// Get the Smoothed value from the QList.
//
float Tracker::getSmoothFromList ( QList<float> *rawList ) {
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h
index bd29bf9f..3b7d7ca8 100644
--- a/FaceTrackNoIR/tracker.h
+++ b/FaceTrackNoIR/tracker.h
@@ -151,6 +151,11 @@ private:
FTNoIR_Client selectedClient;
FTNoIR_Face_Tracker selectedTracker;
+ static T6DOF current_camera; // Used for filtering
+ static T6DOF target_camera;
+ static T6DOF new_camera;
+ static T6DOF output_camera;
+
static ITrackerPtr pTracker; // Pointer to Tracker instance (in DLL)
static IFilterPtr pFilter; // Pointer to Filter instance (in DLL)
@@ -222,6 +227,7 @@ public:
static void setPowCurve(int x);
static void getHeadPose(THeadPoseData *data); // Return the current headpose data
+ static void getOutputHeadPose(THeadPoseData *data); // Return the current (processed) headpose data
static float getSmoothFromList ( QList<float> *rawList );
static float getDegreesFromRads ( float rads ) { return (rads * 57.295781f); }
diff --git a/bin/FaceTrackNoIR.exe b/bin/FaceTrackNoIR.exe
index 8231caf5..75adfa6f 100644
--- a/bin/FaceTrackNoIR.exe
+++ b/bin/FaceTrackNoIR.exe
Binary files differ
diff --git a/bin/Settings/Wings of Prey.ini b/bin/Settings/Wings of Prey.ini
index 75ed83bb..57b16b37 100644
--- a/bin/Settings/Wings of Prey.ini
+++ b/bin/Settings/Wings of Prey.ini
@@ -54,10 +54,10 @@ Yaw_point1=@Variant(\0\0\0\x1a@\x10\0\0\0\0\0\0@\x14\0\0\0\0\0\0)
Yaw_point2=@Variant(\0\0\0\x1a@`\xe0\0\0\0\0\0@A\x80\0\0\0\0\0)
Yaw_point3=@Variant(\0\0\0\x1a@f\0\0\0\0\0\0@:\0\0\0\0\0\0)
Yaw_point4=@Variant(\0\0\0\x1a@f\x80\0\0\0\0\0@I\0\0\0\0\0\0)
-Pitch_point1=@Variant(\0\0\0\x1a@\x16\0\0\0\0\0\0@\x16\0\0\0\0\0\0)
-Pitch_point2=@Variant(\0\0\0\x1a@X\x80\0\0\0\0\0@:\0\0\0\0\0\0)
-Pitch_point3=@Variant(\0\0\0\x1a@e\x80\0\0\0\0\0@3\0\0\0\0\0\0)
-Pitch_point4=@Variant(\0\0\0\x1a@f\x80\0\0\0\0\0@I\0\0\0\0\0\0)
+Pitch_point1=@Variant(\0\0\0\x1a@\x18\0\0\0\0\0\0@\x18\0\0\0\0\0\0)
+Pitch_point2=@Variant(\0\0\0\x1a@M@\0\0\0\0\0@0\0\0\0\0\0\0)
+Pitch_point3=@Variant(\0\0\0\x1a@R\x80\0\0\0\0\0@7\0\0\0\0\0\0)
+Pitch_point4=@Variant(\0\0\0\x1a@W \0\0\0\0\0@I\0\0\0\0\0\0)
Roll_point1=@Variant(\0\0\0\x1a@\x10\0\0\0\0\0\0@\x14\0\0\0\0\0\0)
Roll_point2=@Variant(\0\0\0\x1a@^\xc0\0\0\0\0\0@?\0\0\0\0\0\0)
Roll_point3=@Variant(\0\0\0\x1a@d@\0\0\0\0\0@B\0\0\0\0\0\0)
diff --git a/faceAPI/main.cpp b/faceAPI/main.cpp
index e60535fe..6d02b355 100644
--- a/faceAPI/main.cpp
+++ b/faceAPI/main.cpp
@@ -383,6 +383,9 @@ void run()
THROW_ON_ERROR(smEngineStart(engine_handle)); // Start tracking
}
pMemData->command = 0; // Reset
+
+ THROW_ON_ERROR(smEngineShowCameraControlPanel(engine_handle));
+
break;
case FT_SM_STOP: