summaryrefslogtreecommitdiffhomepage
path: root/FaceTrackNoIR
diff options
context:
space:
mode:
Diffstat (limited to 'FaceTrackNoIR')
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.cpp84
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.h2
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.ui67
-rw-r--r--FaceTrackNoIR/tracker.cpp56
-rw-r--r--FaceTrackNoIR/tracker.h5
5 files changed, 122 insertions, 92 deletions
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp
index 79c3969b..14cb6a9a 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.cpp
+++ b/FaceTrackNoIR/FaceTrackNoIR.cpp
@@ -32,6 +32,8 @@
#include "FaceTrackNoIR.h"
#include "tracker.h"
+//#define USE_VISAGE
+
//
// Setup the Main Dialog
//
@@ -43,7 +45,6 @@ QMainWindow(parent, flags)
//
// Initialize Widget handles, to prevent memory-access errors.
//
- _engine_controls = 0;
_keyboard_shortcuts = 0;
_preferences = 0;
_keyboard_shortcuts = 0;
@@ -155,6 +156,7 @@ void FaceTrackNoIR::setupFaceTrackNoIR() {
connect(timUpdateHeadPose, SIGNAL(timeout()), this, SLOT(showHeadPose()));
ui.txtTracking->setVisible(false);
ui.txtAxisReverse->setVisible(false);
+ ui.gameName->setText("");
}
/** destructor stops the engine and quits the faceapi **/
@@ -193,7 +195,7 @@ FaceTrackNoIR::~FaceTrackNoIR() {
//
void FaceTrackNoIR::getGameProgramName() {
if ( tracker != NULL ) {
- ui.cameraName->setText( tracker->getGameProgramName() );
+ ui.gameName->setText( tracker->getGameProgramName() );
}
}
@@ -539,6 +541,7 @@ void FaceTrackNoIR::startTracker( ) {
}
// Enable/disable Protocol-server Settings
+ ui.iconcomboTrackerSource->setEnabled ( false );
ui.iconcomboBox->setEnabled ( false );
ui.btnShowServerControls->setEnabled ( false );
@@ -604,6 +607,7 @@ void FaceTrackNoIR::stopTracker( ) {
ui.btnStopTracker->setEnabled ( false );
ui.btnShowEngineControls->setEnabled ( false );
ui.iconcomboBox->setEnabled ( true );
+ ui.iconcomboTrackerSource->setEnabled ( true );
// Enable/disable Protocol-server Settings
ui.btnShowServerControls->setEnabled ( true );
@@ -753,63 +757,61 @@ void FaceTrackNoIR::showHeadPoseWidget() {
void FaceTrackNoIR::showEngineControls() {
importGetTrackerDialog getIT;
QLibrary *trackerLib;
-
+QString libName;
qDebug() << "FaceTrackNoIR::showEngineControls started.";
//
// Delete the existing QDialog
//
- if (_engine_controls) {
- delete _engine_controls;
- _engine_controls = 0;
+ if (pTrackerDialog) {
+ pTrackerDialog.Release();
}
- qDebug() << "FaceTrackNoIR::showEngineControls after remove engine_controls.";
+ // Show the appropriate Tracker Settings
+ libName.clear();
- // Create new
- if (!_engine_controls)
- {
- switch (ui.iconcomboTrackerSource->currentIndex()) {
+ switch (ui.iconcomboTrackerSource->currentIndex()) {
case FT_SM_FACEAPI: // Face API
-// _engine_controls = new EngineControls( tracker->getEngine(), true, false, this, Qt::Dialog );
+ qDebug() << "FaceTrackNoIR::showEngineControls case FT_SM_FACEAPI.";
+ libName = QString("FTNoIR_Tracker_SM.dll");
break;
+
case FT_FTNOIR: // FTNoir server
qDebug() << "FaceTrackNoIR::showEngineControls case FT_FTNOIR.";
+ libName = QString("FTNoIR_Tracker_UDP.dll");
+ break;
- trackerLib = new QLibrary("FTNoIR_Tracker_UDP.dll");
+ default:
+ break;
+ }
- qDebug() << "FaceTrackNoIR::showEngineControls Loaded trackerLib." << trackerLib;
+ //
+ // Load the Server-settings dialog (if any) and show it.
+ //
+ if (!libName.isEmpty()) {
+ trackerLib = new QLibrary(libName);
- getIT = (importGetTrackerDialog) trackerLib->resolve("GetTrackerDialog");
+ qDebug() << "FaceTrackNoIR::showEngineControls Loaded trackerLib." << trackerLib;
- qDebug() << "FaceTrackNoIR::showEngineControls resolved?." << getIT;
+ getIT = (importGetTrackerDialog) trackerLib->resolve("GetTrackerDialog");
- if (getIT) {
- ITrackerDialogPtr ptrXyz(getIT());
- if (ptrXyz)
- {
- pTrackerDialog = ptrXyz;
- pTrackerDialog->Initialize( this );
- qDebug() << "FaceTrackNoIR::showEngineControls GetTrackerDialog Function Resolved!";
- }
- }
- else {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
- }
+ qDebug() << "FaceTrackNoIR::showEngineControls resolved?." << getIT;
- break;
- default:
- break;
+ if (getIT) {
+ ITrackerDialogPtr ptrXyz(getIT());
+ if (ptrXyz)
+ {
+ pTrackerDialog = ptrXyz;
+ pTrackerDialog->Initialize( this );
+ qDebug() << "FaceTrackNoIR::showEngineControls GetTrackerDialog Function Resolved!";
+ }
+ }
+ else {
+ QMessageBox::warning(0,"FaceTrackNoIR Error", "DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
}
-
- }
-
- // Show if already created
- if (_engine_controls) {
- _engine_controls->show();
- _engine_controls->raise();
}
+
}
/** toggles Server Controls Dialog **/
@@ -954,6 +956,12 @@ void FaceTrackNoIR::createIconGroupBox()
ui.iconcomboTrackerSource->addItem(QIcon(":/images/SeeingMachines.ico"), tr("Face API"));
ui.iconcomboTrackerSource->addItem(QIcon(":/images/FaceTrackNoIR.ico"), tr("FTNoir server"));
+
+# ifdef USE_VISAGE
+ ui.iconcomboTrackerSource->addItem(QIcon(":/images/Visage.ico"), tr("Visage Tracker"));
+# endif
+
+
}
//
diff --git a/FaceTrackNoIR/FaceTrackNoIR.h b/FaceTrackNoIR/FaceTrackNoIR.h
index 5ad2a348..9dc38071 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.h
+++ b/FaceTrackNoIR/FaceTrackNoIR.h
@@ -88,7 +88,7 @@ private:
/** Widget variables **/
QVBoxLayout *l;
- QWidget *_engine_controls;
+// QWidget *_engine_controls;
// QWidget *_server_controls;
QWidget *_preferences;
QWidget *_keyboard_shortcuts;
diff --git a/FaceTrackNoIR/FaceTrackNoIR.ui b/FaceTrackNoIR/FaceTrackNoIR.ui
index c4c6b228..ef21ab82 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.ui
+++ b/FaceTrackNoIR/FaceTrackNoIR.ui
@@ -1965,27 +1965,54 @@ opacity:100;</string>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
- <widget class="QLabel" name="cameraName">
- <property name="minimumSize">
- <size>
- <width>420</width>
- <height>30</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>600</width>
- <height>30</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true">color:#ccc;
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="cameraName">
+ <property name="minimumSize">
+ <size>
+ <width>420</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>600</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">color:#ccc;
background:none;</string>
- </property>
- <property name="text">
- <string>Camera Name</string>
- </property>
- </widget>
+ </property>
+ <property name="text">
+ <string>Camera Name</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="gameName">
+ <property name="minimumSize">
+ <size>
+ <width>420</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>600</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">color:#ccc;
+background:none;</string>
+ </property>
+ <property name="text">
+ <string>Game Name</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
<widget class="QPushButton" name="btnEditCurves">
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index 7beb1aa5..799c274e 100644
--- a/FaceTrackNoIR/tracker.cpp
+++ b/FaceTrackNoIR/tracker.cpp
@@ -152,6 +152,10 @@ QFrame *video_frame;
libName = QString("FTNoIR_Tracker_UDP.dll");
break;
+ case FT_VISAGE:
+ libName = QString("FTNoIR_Tracker_Visage.dll");
+ break;
+
default:
break;
}
@@ -342,6 +346,7 @@ bool lastGameZeroKey = false;
bool waitAxisReverse = false;
bool waitThroughZero = false;
double actualYaw = 0.0f;
+double actualZ = 0.0f;
T6DOF offset_camera(0,0,0,0,0,0);
T6DOF gamezero_camera(0,0,0,0,0,0);
T6DOF gameoutput_camera(0,0,0,0,0,0);
@@ -494,21 +499,24 @@ T6DOF gameoutput_camera(0,0,0,0,0,0);
//
// Check the state of the Axis Reverse key
//
- if ( isShortKeyPressed( &AxisReverseKey, &keystate[0] ) ) {
- if ((fabs(actualYaw) > 90.0f) && (!waitAxisReverse)) {
- Tracker::do_axis_reverse = !Tracker::do_axis_reverse;
- waitAxisReverse = true;
- }
- }
+ ////if ( isShortKeyPressed( &AxisReverseKey, &keystate[0] ) ) {
+ //// if ((fabs(actualYaw) > 90.0f) && (!waitAxisReverse)) {
+ //// Tracker::do_axis_reverse = !Tracker::do_axis_reverse;
+ //// waitAxisReverse = true;
+ //// }
+ ////}
}
}
//
// Reset the 'wait' flag. Moving above 90 with the key pressed, will (de-)activate Axis Reverse.
//
- if (fabs(actualYaw) < 85.0f) {
- waitAxisReverse = false;
- }
+ //////if (fabs(actualYaw) < 85.0f) {
+ ////// waitAxisReverse = false;
+ //////}
+ //// if {
+// qDebug() << "Tracker::run() says actualZ = " << actualZ;
+ Tracker::do_axis_reverse = ((fabs(actualYaw) > 90.0f) && (actualZ < -20.0f));
if (WaitForSingleObject(Tracker::hTrackMutex, 100) == WAIT_OBJECT_0) {
@@ -576,27 +584,9 @@ T6DOF gameoutput_camera(0,0,0,0,0,0);
// Reverse Axis.
//
actualYaw = output_camera.position.yaw; // Save the actual Yaw, otherwise we can't check for +90
+ actualZ = output_camera.position.z; // Also the Z
if (Tracker::do_axis_reverse) {
- if (fabs(actualYaw) < 5.0f) {
- waitThroughZero = true;
- }
- if (waitThroughZero) {
- output_camera.position.yaw *= -1.0f;
- }
- if (output_camera.position.yaw > 0.0f) {
- output_camera.position.yaw = 180.0f - output_camera.position.yaw;
- }
- else {
- output_camera.position.yaw = -180.0f - output_camera.position.yaw;
- }
- }
- else {
- if (fabs(actualYaw) < 5.0f) {
- waitThroughZero = false;
- }
- if (waitThroughZero) {
- output_camera.position.yaw *= -1.0f;
- }
+ output_camera.position.z = 100; // Max.
}
//
@@ -707,9 +697,13 @@ void Tracker::addHeadPose( THeadPoseData head_pose )
//
QString Tracker::getGameProgramName() {
QString str;
+char dest[100];
-// str = server_Game->GetProgramName();
- str = QString("");
+ str = QString("No protocol active?");
+ if (pProtocol) {
+ pProtocol->getNameFromGame( dest );
+ str = QString( dest );
+ }
return str;
}
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h
index 924f5542..79af07a1 100644
--- a/FaceTrackNoIR/tracker.h
+++ b/FaceTrackNoIR/tracker.h
@@ -79,7 +79,8 @@ enum FTNoIR_Client {
enum FTNoIR_Face_Tracker {
FT_SM_FACEAPI = 0,
- FT_FTNOIR = 1
+ FT_FTNOIR = 1,
+ FT_VISAGE = 2
};
enum FTNoIR_Tracker_Status {
@@ -213,7 +214,7 @@ public:
void loadSettings(); // Load settings from the INI-file
bool isShortKeyPressed( TShortKey *key, BYTE *keystate );
- static bool getTrackingActive() { return do_tracking; }
+ static bool getTrackingActive() { return do_tracking && confid; }
static bool getAxisReverse() { return do_axis_reverse; }
static bool getConfid() { return confid; }