diff options
author | Wim Vriend <facetracknoir@gmail.com> | 2011-01-18 21:51:48 +0000 |
---|---|---|
committer | Wim Vriend <facetracknoir@gmail.com> | 2011-01-18 21:51:48 +0000 |
commit | 2a3ec553d3737f2d94c32c3372ebac5333819ddd (patch) | |
tree | 27adabc715afe26600fcc2558b2a57dcab8d82e9 /FaceTrackNoIR | |
parent | d0132f5e3881a6cb09bfe41326831d36527b7321 (diff) |
Profile selection items added in the Main form.
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@39 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FaceTrackNoIR')
-rw-r--r-- | FaceTrackNoIR/Debug/BuildLog.htm | bin | 32430 -> 30550 bytes | |||
-rw-r--r-- | FaceTrackNoIR/Debug/FTServer.obj | bin | 112552 -> 112552 bytes | |||
-rw-r--r-- | FaceTrackNoIR/Debug/main.obj | bin | 167871 -> 167943 bytes | |||
-rw-r--r-- | FaceTrackNoIR/Debug/moc_FTServer.obj | bin | 66888 -> 66888 bytes | |||
-rw-r--r-- | FaceTrackNoIR/Debug/moc_tracker.obj | bin | 166418 -> 166554 bytes | |||
-rw-r--r-- | FaceTrackNoIR/Debug/mt.dep | 2 | ||||
-rw-r--r-- | FaceTrackNoIR/Debug/tracker.obj | bin | 410641 -> 413066 bytes | |||
-rw-r--r-- | FaceTrackNoIR/ExcelServer.cpp | 22 | ||||
-rw-r--r-- | FaceTrackNoIR/FTNoIR_cxx_protocolserver.h | 9 | ||||
-rw-r--r-- | FaceTrackNoIR/FaceTrackNoIR.cpp | 63 | ||||
-rw-r--r-- | FaceTrackNoIR/FaceTrackNoIR.h | 2 | ||||
-rw-r--r-- | FaceTrackNoIR/FaceTrackNoIR.ui | 71 | ||||
-rw-r--r-- | FaceTrackNoIR/tracker.cpp | 21 | ||||
-rw-r--r-- | FaceTrackNoIR/tracker.h | 2 |
14 files changed, 171 insertions, 21 deletions
diff --git a/FaceTrackNoIR/Debug/BuildLog.htm b/FaceTrackNoIR/Debug/BuildLog.htm Binary files differindex 8e1ff11f..5edbad60 100644 --- a/FaceTrackNoIR/Debug/BuildLog.htm +++ b/FaceTrackNoIR/Debug/BuildLog.htm diff --git a/FaceTrackNoIR/Debug/FTServer.obj b/FaceTrackNoIR/Debug/FTServer.obj Binary files differindex 7b150608..4c10fe9d 100644 --- a/FaceTrackNoIR/Debug/FTServer.obj +++ b/FaceTrackNoIR/Debug/FTServer.obj diff --git a/FaceTrackNoIR/Debug/main.obj b/FaceTrackNoIR/Debug/main.obj Binary files differindex 606d4b13..3e1bd4e3 100644 --- a/FaceTrackNoIR/Debug/main.obj +++ b/FaceTrackNoIR/Debug/main.obj diff --git a/FaceTrackNoIR/Debug/moc_FTServer.obj b/FaceTrackNoIR/Debug/moc_FTServer.obj Binary files differindex 430d91b2..c65e85ad 100644 --- a/FaceTrackNoIR/Debug/moc_FTServer.obj +++ b/FaceTrackNoIR/Debug/moc_FTServer.obj diff --git a/FaceTrackNoIR/Debug/moc_tracker.obj b/FaceTrackNoIR/Debug/moc_tracker.obj Binary files differindex c444fd14..4b3d94fd 100644 --- a/FaceTrackNoIR/Debug/moc_tracker.obj +++ b/FaceTrackNoIR/Debug/moc_tracker.obj diff --git a/FaceTrackNoIR/Debug/mt.dep b/FaceTrackNoIR/Debug/mt.dep index 406f9682..f1a7b210 100644 --- a/FaceTrackNoIR/Debug/mt.dep +++ b/FaceTrackNoIR/Debug/mt.dep @@ -1 +1 @@ -Manifest resource last updated at 21:57:49.28 on ma 03-01-2011
+Manifest resource last updated at 22:38:23.47 on di 18-01-2011
diff --git a/FaceTrackNoIR/Debug/tracker.obj b/FaceTrackNoIR/Debug/tracker.obj Binary files differindex f6e3d396..520a2178 100644 --- a/FaceTrackNoIR/Debug/tracker.obj +++ b/FaceTrackNoIR/Debug/tracker.obj diff --git a/FaceTrackNoIR/ExcelServer.cpp b/FaceTrackNoIR/ExcelServer.cpp index 097be513..0f046e98 100644 --- a/FaceTrackNoIR/ExcelServer.cpp +++ b/FaceTrackNoIR/ExcelServer.cpp @@ -62,7 +62,7 @@ SYSTEMTIME now; QFile data(QCoreApplication::applicationDirPath() + "\\output.txt");
if (data.open(QFile::WriteOnly | QFile::Append)) {
QTextStream out(&data);
- out << newHeadPoseTime << "\t" << headRotX << "\t" << virtRotX << "\t" << headRotY << "\t" << virtRotY << "\t" << headRotZ << "\t" << virtRotZ << '\n';
+ out << newHeadPoseTime << "\t" << newSample << "\t" << confidence << "\t" << dT << "\t" << smoothvalue << "\t" << headRotX << "\t" << virtRotX << "\t" << prev_value << '\n';
}
}
@@ -75,9 +75,25 @@ bool ExcelServer::checkServerInstallationOK( HANDLE handle ) // Use this for some debug-output to file...
QFile data(QCoreApplication::applicationDirPath() + "\\output.txt");
if (data.open(QFile::WriteOnly)) {
+
+
+ //
+ // Get the settings for the header
+ //
+ QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
+
+ QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
+ QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
+
+ iniFile.beginGroup ( "Tracking" );
+ int smoothing = iniFile.value ( "Smooth", 10 ).toInt();
+ bool useEWMA = iniFile.value ( "useEWMA", 1 ).toBool();
+ iniFile.endGroup ();
+
QTextStream out(&data);
- out << "Time" << "\t" << "RotX (Pitch)" << "\t" << "RotX (Pitch)" << "\t" << "RotY (Yaw)" << "\t" << "RotY (Yaw)" << "\t" << "RotY (Roll)" << "\t" << "RotY (Roll)" << '\n';
- out << "(long)" << "\t" << "Raw" << "\t" << "Filtered" << "\t" << "Raw" << "\t" << "Filtered" << "\t" << "Raw" << "\t" << "Filtered" << '\n';
+ out << "Smoothing = \t" << smoothing << "\n" << "EWMA used = \t" << useEWMA << "\n" << "\n";
+ out << "Time" << "\t" << "New Sample" << "\t" << "Confidence" << "\t" << "dT" << "\t" << "Smoothed" << "\t" << "RotX (Pitch)" << "\t" << "RotX (Pitch)" << "\t" << "Previous" << '\n';
+ out << "(long)" << "\t" << "(bool)" << "\t" << "(float)" << "\t" << "(float)" << "\t" << "(float)" << "\t" << "Raw" << "\t" << "Filtered" << "\t" << "-" << '\n';
}
return true;
diff --git a/FaceTrackNoIR/FTNoIR_cxx_protocolserver.h b/FaceTrackNoIR/FTNoIR_cxx_protocolserver.h index a14b198d..6548a82f 100644 --- a/FaceTrackNoIR/FTNoIR_cxx_protocolserver.h +++ b/FaceTrackNoIR/FTNoIR_cxx_protocolserver.h @@ -88,6 +88,15 @@ namespace v4friend float prevRotY;
float prevRotZ;
+ //
+ // Values for analysis of tracking...
+ //
+ float confidence;
+ float smoothvalue;
+ float prev_value;
+ bool newSample;
+ float dT;
+
private:
ProtocolServerBase(const ProtocolServerBase &);
ProtocolServerBase &operator=(const ProtocolServerBase &);
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp index fda8ea84..fb48b149 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.cpp +++ b/FaceTrackNoIR/FaceTrackNoIR.cpp @@ -80,8 +80,11 @@ void FaceTrackNoIR::setupFaceTrackNoIR() { // menu objects will be connected with the functions in FaceTrackNoIR class
connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(open()));
+ connect(ui.btnLoad, SIGNAL(clicked()), this, SLOT(open()));
connect(ui.actionSave, SIGNAL(triggered()), this, SLOT(save()));
+ connect(ui.btnSave, SIGNAL(clicked()), this, SLOT(save()));
connect(ui.actionSave_As, SIGNAL(triggered()), this, SLOT(saveAs()));
+ connect(ui.btnSaveAs, SIGNAL(clicked()), this, SLOT(saveAs()));
connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(exit()));
connect(ui.actionPreferences, SIGNAL(triggered()), this, SLOT(showPreferences()));
@@ -132,14 +135,16 @@ void FaceTrackNoIR::setupFaceTrackNoIR() { createActions();
createTrayIcon();
- connect(ui.iconcomboTrackerSource, SIGNAL(currentIndexChanged(int)), this, SLOT(trackingSourceSelected(int)));
- connect(ui.iconcomboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setIcon(int)));
connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
//Load the tracker-settings, from the INI-file
loadSettings();
trayIcon->show();
+ connect(ui.iconcomboProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(profileSelected(int)));
+ connect(ui.iconcomboTrackerSource, SIGNAL(currentIndexChanged(int)), this, SLOT(trackingSourceSelected(int)));
+ connect(ui.iconcomboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setIcon(int)));
+
//Setup the timer for automatically minimizing after StartTracker.
timMinimizeFTN = new QTimer(this);
connect(timMinimizeFTN, SIGNAL(timeout()), this, SLOT(showMinimized()));
@@ -349,7 +354,7 @@ void FaceTrackNoIR::saveAs() // Remove the file, if it already exists.
//
QFileInfo newFileInfo ( fileName );
- if (newFileInfo.exists()) {
+ if ((newFileInfo.exists()) && (oldFile != fileName)) {
QFile newFileFile ( fileName );
newFileFile.remove();
}
@@ -385,6 +390,34 @@ void FaceTrackNoIR::loadSettings() { QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
+ //
+ // Put the filename in the window-title.
+ //
+ QFileInfo pathInfo ( currentFile );
+ setWindowTitle ( "FaceTrackNoIR (1.5) - " + pathInfo.fileName() );
+
+ //
+ // Get a List of all the INI-files in the (currently active) Settings-folder.
+ //
+ QDir settingsDir( pathInfo.dir() );
+ QStringList filters;
+ filters << "*.ini";
+ iniFileList.clear();
+ iniFileList = settingsDir.entryList( filters, QDir::Files, QDir::Name );
+
+ //
+ // Add strings to the Listbox.
+ //
+ disconnect(ui.iconcomboProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(profileSelected(int)));
+ ui.iconcomboProfile->clear();
+ for ( int i = 0; i < iniFileList.size(); i++) {
+ ui.iconcomboProfile->addItem(iniFileList.at(i));
+ if (iniFileList.at(i) == pathInfo.fileName()) {
+ ui.iconcomboProfile->setCurrentIndex( i );
+ }
+ }
+ connect(ui.iconcomboProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(profileSelected(int)));
+
qDebug() << "loadSettings says: iniFile = " << currentFile;
iniFile.beginGroup ( "Tracking" );
@@ -414,11 +447,6 @@ void FaceTrackNoIR::loadSettings() { iniFile.endGroup ();
settingsDirty = false;
-
- // Put the filename in the window-title
- QFileInfo pathInfo ( currentFile );
- setWindowTitle ( "FaceTrackNoIR (1.5) - " + pathInfo.fileName() );
-
}
/** show support page in web-browser **/
@@ -916,6 +944,25 @@ void FaceTrackNoIR::trackingSourceSelected(int index) }
}
+//
+// Handle changes of the Profile selection
+//
+void FaceTrackNoIR::profileSelected(int index)
+{
+ //
+ // Read the current INI-file setting, to get the folder in which it's located...
+ //
+ QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
+ QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
+ QFileInfo pathInfo ( currentFile );
+
+ //
+ // Get a List of all the INI-files in the (currently active) Settings-folder.
+ //
+ settings.setValue ("SettingsFile", pathInfo.absolutePath() + "/" + iniFileList.at(ui.iconcomboProfile->currentIndex()));
+ loadSettings();
+}
+
//
// Constructor for FaceTrackNoIR=Preferences-dialog
diff --git a/FaceTrackNoIR/FaceTrackNoIR.h b/FaceTrackNoIR/FaceTrackNoIR.h index 8be8b6d6..984b09c0 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.h +++ b/FaceTrackNoIR/FaceTrackNoIR.h @@ -65,6 +65,7 @@ private: Ui::FaceTrackNoIRClass ui;
Tracker *tracker;
QTimer *timMinimizeFTN;
+ QStringList iniFileList; // List of INI-files, that are present in the Settings folder
/** face api variables **/
VideoDisplayWidget *_display;
@@ -114,6 +115,7 @@ private: void setIcon(int index);
void iconActivated(QSystemTrayIcon::ActivationReason reason);
void trackingSourceSelected(int index);
+ void profileSelected(int index);
void showVideoWidget();
void showHeadPoseWidget();
diff --git a/FaceTrackNoIR/FaceTrackNoIR.ui b/FaceTrackNoIR/FaceTrackNoIR.ui index 56660d49..15d960bd 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.ui +++ b/FaceTrackNoIR/FaceTrackNoIR.ui @@ -10,7 +10,7 @@ <rect>
<x>0</x>
<y>0</y>
- <width>923</width>
+ <width>925</width>
<height>371</height>
</rect>
</property>
@@ -808,7 +808,7 @@ border:none; <property name="title">
<string>Profile</string>
</property>
- <widget class="QComboBox" name="iconcomboTrackerSource_2">
+ <widget class="QComboBox" name="iconcomboProfile">
<property name="geometry">
<rect>
<x>10</x>
@@ -824,7 +824,70 @@ border:none; <number>-1</number>
</property>
<property name="maxVisibleItems">
- <number>3</number>
+ <number>10</number>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="btnSaveAs">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>80</y>
+ <width>161</width>
+ <height>23</height>
+ </rect>
+ </property>
+ <property name="toolTip">
+ <string>Change tracker settings</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="text">
+ <string>Save As ...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="btnLoad">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>50</y>
+ <width>75</width>
+ <height>23</height>
+ </rect>
+ </property>
+ <property name="toolTip">
+ <string>Start the Tracker</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="text">
+ <string>Load</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="btnSave">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>96</x>
+ <y>50</y>
+ <width>75</width>
+ <height>23</height>
+ </rect>
+ </property>
+ <property name="toolTip">
+ <string>Stop the Tracker</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="text">
+ <string>Save</string>
</property>
</widget>
</widget>
@@ -1950,7 +2013,7 @@ background:none;</string> <rect>
<x>0</x>
<y>0</y>
- <width>923</width>
+ <width>925</width>
<height>21</height>
</rect>
</property>
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp index 633af24e..d1ebe6ea 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;
@@ -489,6 +489,7 @@ void Tracker::run() { // Pitch
if (Tracker::useFilter) {
rotX = lowPassFilter ( getSmoothFromList( &Pitch.rawList ) - Pitch.offset_headPos - Pitch.initial_headPos,
+// rotX = lowPassFilter ( getSmoothFromList( &Pitch.rawList ),
&Pitch.prevPos, dT, Tracker::Pitch.red );
}
else {
@@ -615,13 +616,21 @@ void Tracker::run() { }
}
}
- ReleaseMutex(Tracker::hTrackMutex);
- server_Game->sendHeadposeToGame();
# ifdef USE_DEBUG_CLIENT
- debug_Client->sendHeadposeToGame();
+ debug_Client->confidence = Tracker::Pitch.confidence;
+ debug_Client->newSample = Tracker::Pitch.newSample;
+ debug_Client->smoothvalue = getSmoothFromList( &Pitch.rawList );
+ debug_Client->prev_value = Tracker::Pitch.prevPos;
+ debug_Client->dT = dT;
+ debug_Client->sendHeadposeToGame(); // Log to Excel
+ Tracker::Pitch.newSample = false;
# endif
+ ReleaseMutex(Tracker::hTrackMutex);
+ server_Game->sendHeadposeToGame();
+
+
//for lower cpu load
usleep(10000);
yieldCurrentThread();
@@ -664,6 +673,8 @@ void Tracker::addHeadPose( smEngineHeadPoseData head_pose ) // Pitch
Tracker::Pitch.headPos = head_pose.head_rot.x_rads * 57.295781f; // degrees
addRaw2List ( &Pitch.rawList, Pitch.maxItems, Tracker::Pitch.headPos );
+ Tracker::Pitch.confidence = head_pose.confidence; // Just this one ...
+ Tracker::Pitch.newSample = true;
// Yaw
Tracker::Yaw.headPos = head_pose.head_rot.y_rads * 57.295781f; // degrees
@@ -781,7 +792,7 @@ float Tracker::getCorrectedNewRaw ( float NewRaw, float rotNeutral ) { // The code was adopted from Melchior Franz, who created it for FlightGear (aircraft.nas).
//
// The function takes the new value, the delta-time (sec) and a weighing coefficient (>0 and <1)
-// All previou values are taken into account, the weight of this is determined by 'coeff'.
+// All previous values are taken into account, the weight of this is determined by 'coeff'.
//
float Tracker::lowPassFilter ( float newvalue, float *oldvalue, float dt, float coeff) {
float c = 0.0f;
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h index 49d24f86..b7a653d9 100644 --- a/FaceTrackNoIR/tracker.h +++ b/FaceTrackNoIR/tracker.h @@ -94,6 +94,8 @@ struct THeadPoseDOF { QPainterPath curve; // Bezier curve to translate input -> output
int NeutralZone; // Neutral zone
int MaxInput; // Maximum raw input
+ float confidence; // Current confidence
+ bool newSample; // Indicate new sample from tracker
};
//
|