summaryrefslogtreecommitdiffhomepage
path: root/FaceTrackNoIR
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 /FaceTrackNoIR
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
Diffstat (limited to 'FaceTrackNoIR')
-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
6 files changed, 434 insertions, 114 deletions
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); }