From acdb0aaf27e2ca623a9e32ea7efcc484aecde498 Mon Sep 17 00:00:00 2001 From: Wim Vriend Date: Mon, 26 Nov 2012 21:00:55 +0000 Subject: Reversed the numTracker tryout to accomodate the secondary Tracker: the user-interface was confusing. Now, the 1st Tracker overwrites the values, if the same axis were selected in both trackers. git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@196 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb --- FTNoIR_Tracker_Base/ftnoir_tracker_base.h | 4 +- FTNoIR_Tracker_FD/FTNoIR_Tracker_FD.h | 4 +- FTNoIR_Tracker_FD/ftnoir_tracker_facedetect.cpp | 2 +- .../ftnoir_tracker_facedetect_dialog.cpp | 2 +- FTNoIR_Tracker_SM/FTNoIR_SM_Controls.ui | 29 +++- FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h | 16 +- FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp | 46 +----- .../ftnoir_tracker_faceapi_dialog.cpp | 102 +++--------- FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h | 4 +- FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp | 2 +- FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp | 2 +- FaceTrackNoIR/FaceTrackNoIR.cpp | 45 +++--- FaceTrackNoIR/FaceTrackNoIR.ui | 36 +++-- FaceTrackNoIR/tracker.cpp | 37 +++-- bin/Settings/ArmA.ini | 172 ++++++++++++--------- 15 files changed, 230 insertions(+), 273 deletions(-) diff --git a/FTNoIR_Tracker_Base/ftnoir_tracker_base.h b/FTNoIR_Tracker_Base/ftnoir_tracker_base.h index a3cd7ea8..396df4d1 100644 --- a/FTNoIR_Tracker_Base/ftnoir_tracker_base.h +++ b/FTNoIR_Tracker_Base/ftnoir_tracker_base.h @@ -52,7 +52,7 @@ struct ITracker { virtual ~ITracker() {} - virtual void Initialize( QFrame *videoframe, int numTracker ) = 0; + virtual void Initialize( QFrame *videoframe ) = 0; virtual void StartTracker( HWND parent_window ) = 0; virtual void StopTracker(bool exit) = 0; virtual bool GiveHeadPoseData(THeadPoseData *data) = 0; @@ -84,7 +84,7 @@ GetTracker(void); struct ITrackerDialog { virtual ~ITrackerDialog() {} - virtual void Initialize(QWidget *parent, int numTracker) = 0; + virtual void Initialize(QWidget *parent) = 0; virtual void registerTracker(ITracker *tracker) = 0; virtual void unRegisterTracker() = 0; }; diff --git a/FTNoIR_Tracker_FD/FTNoIR_Tracker_FD.h b/FTNoIR_Tracker_FD/FTNoIR_Tracker_FD.h index eccc7ad7..5b476758 100644 --- a/FTNoIR_Tracker_FD/FTNoIR_Tracker_FD.h +++ b/FTNoIR_Tracker_FD/FTNoIR_Tracker_FD.h @@ -37,7 +37,7 @@ public: FTNoIR_Tracker(); ~FTNoIR_Tracker(); - void Initialize( QFrame *videoframe, int numTracker ); + void Initialize( QFrame *videoframe ); void StartTracker( HWND parent_window ); void StopTracker( bool exit ); bool GiveHeadPoseData(THeadPoseData *data); // Returns true if confidence is good @@ -66,7 +66,7 @@ public: explicit TrackerControls(); virtual ~TrackerControls(); void Release(); // Member functions which are accessible from outside the DLL - void Initialize(QWidget *parent, int numTracker); + void Initialize(QWidget *parent); void registerTracker(ITracker *tracker) {}; void unRegisterTracker() {}; void NotifyZeroing(); diff --git a/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect.cpp b/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect.cpp index f5d7931d..620fb9fd 100644 --- a/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect.cpp +++ b/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect.cpp @@ -94,7 +94,7 @@ FTNoIR_Tracker::~FTNoIR_Tracker() //CloseHandle(hMutex); } -void FTNoIR_Tracker::Initialize( QFrame *videoframe, int numTracker ) +void FTNoIR_Tracker::Initialize( QFrame *videoframe ) { qDebug("FTNoIR_Tracker::Initialize()"); WaitForSingleObject(hMutex, INFINITE); diff --git a/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect_dialog.cpp b/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect_dialog.cpp index aaa95637..71b19242 100644 --- a/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect_dialog.cpp +++ b/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect_dialog.cpp @@ -117,7 +117,7 @@ void TrackerControls::Release() // // Initialize tracker-client-dialog // -void TrackerControls::Initialize(QWidget *parent, int numTracker) { +void TrackerControls::Initialize(QWidget *parent) { QPoint offsetpos(200, 200); if (parent) { diff --git a/FTNoIR_Tracker_SM/FTNoIR_SM_Controls.ui b/FTNoIR_Tracker_SM/FTNoIR_SM_Controls.ui index 170a4a46..9fa1b2e4 100644 --- a/FTNoIR_Tracker_SM/FTNoIR_SM_Controls.ui +++ b/FTNoIR_Tracker_SM/FTNoIR_SM_Controls.ui @@ -391,6 +391,31 @@ + + + + + 0 + 0 + + + + + 70 + 0 + + + + + 100 + 16777215 + + + + Save + + + @@ -406,7 +431,7 @@ - 100 + 70 0 @@ -431,7 +456,7 @@ - 100 + 70 0 diff --git a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h index e62009f5..ce8f5511 100644 --- a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h +++ b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h @@ -40,7 +40,7 @@ public: FTNoIR_Tracker(); ~FTNoIR_Tracker(); - void Initialize( QFrame *videoframe, int numTracker ); + void Initialize( QFrame *videoframe ); void StartTracker( HWND parent_window ); void StopTracker( bool exit ); bool GiveHeadPoseData(THeadPoseData *data); // Returns true if confidence is good @@ -56,7 +56,7 @@ private: HANDLE hSMMutex; QProcess *faceAPI; - int numTracker; +// int numTracker; bool bEnableRoll; bool bEnablePitch; bool bEnableYaw; @@ -82,7 +82,7 @@ public: virtual ~TrackerControls(); void showEvent ( QShowEvent * event ); - void Initialize(QWidget *parent, int numTracker); + void Initialize(QWidget *parent); void registerTracker(ITracker *tracker) { theTracker = (FTNoIR_Tracker *) tracker; // Accept the pointer to the Tracker }; @@ -93,7 +93,6 @@ public: private: Ui::UICSMClientControls ui; void loadSettings(); - void save(); bool SMCreateMapping(); void doCommand( int command ); void doCommand( int command, int value ); @@ -112,18 +111,11 @@ private: QTimer *timUpdateSettings; // Timer to display current settings FTNoIR_Tracker *theTracker; - int numTracker; // Primary (1) or secondary tracker (2) - - int numRoll; // Number of Tracker (1 or 2) which tracks this axis - int numPitch; - int numYaw; - int numX; - int numY; - int numZ; private slots: void doOK(); void doCancel(); + void save(); void settingChanged() { settingsDirty = true; }; void doTimUpdate(); void showSettings( int newState ); diff --git a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp index 23b973cb..f8320294 100644 --- a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp +++ b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp @@ -37,7 +37,6 @@ FTNoIR_Tracker::~FTNoIR_Tracker() UnmapViewOfFile ( pMemData ); } - numTracker = 1; bEnableRoll = true; bEnablePitch = true; bEnableYaw = true; @@ -57,7 +56,7 @@ FTNoIR_Tracker::~FTNoIR_Tracker() hSMMemMap = 0; } -void FTNoIR_Tracker::Initialize( QFrame *videoframe, int num) +void FTNoIR_Tracker::Initialize( QFrame *videoframe ) { qDebug() << "FTNoIR_Tracker::Initialize says: Starting "; @@ -68,7 +67,6 @@ void FTNoIR_Tracker::Initialize( QFrame *videoframe, int num) QMessageBox::warning(0,"FaceTrackNoIR Error","Memory mapping not created!",QMessageBox::Ok,QMessageBox::NoButton); } - numTracker = num; loadSettings(); if ( pMemData != NULL ) { @@ -167,12 +165,6 @@ bool FTNoIR_Tracker::GiveHeadPoseData(THeadPoseData *data) // Load the current Settings from the currently 'active' INI-file. // void FTNoIR_Tracker::loadSettings() { -int numRoll; // Number of Tracker (1 or 2) which tracks this axis -int numPitch; -int numYaw; -int numX; -int numY; -int numZ; qDebug() << "FTNoIR_Tracker::loadSettings says: Starting "; QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER) @@ -193,38 +185,14 @@ int numZ; dInvertY = (iniFile.value ( "InvertY", 0 ).toBool()) ? -1.0f : 1.0f; dInvertZ = (iniFile.value ( "InvertZ", 0 ).toBool()) ? -1.0f : 1.0f; - iniFile.endGroup (); - - iniFile.beginGroup ( "HeadTracker" ); - // - // Check if the Tracker is the Primary one. - // If the property is not found in the INI-file, set the value. - // - if (numTracker == 1) { - numRoll = iniFile.value ( "RollTracker", 1 ).toInt(); - numPitch = iniFile.value ( "PitchTracker", 1 ).toInt(); - numYaw = iniFile.value ( "YawTracker", 1 ).toInt(); - numX = iniFile.value ( "XTracker", 0 ).toInt(); - numY = iniFile.value ( "YTracker", 0 ).toInt(); - numZ = iniFile.value ( "ZTracker", 0 ).toInt(); - } - else { - numRoll = iniFile.value ( "RollTracker", 0 ).toInt(); - numPitch = iniFile.value ( "PitchTracker", 0 ).toInt(); - numYaw = iniFile.value ( "YawTracker", 0 ).toInt(); - numX = iniFile.value ( "XTracker", 0 ).toInt(); - numY = iniFile.value ( "YTracker", 0 ).toInt(); - numZ = iniFile.value ( "ZTracker", 0 ).toInt(); - } - bEnableRoll = (numRoll == numTracker); - bEnablePitch = (numPitch == numTracker); - bEnableYaw = (numYaw == numTracker); - bEnableX = (numX == numTracker); - bEnableY = (numY == numTracker); - bEnableZ = (numZ == numTracker); + bEnableRoll = iniFile.value ( "EnableRoll", 1 ).toBool(); + bEnablePitch = iniFile.value ( "EnablePitch", 1 ).toBool(); + bEnableYaw = iniFile.value ( "EnableYaw", 1 ).toBool(); + bEnableX = iniFile.value ( "EnableX", 1 ).toBool(); + bEnableY = iniFile.value ( "EnableY", 1 ).toBool(); + bEnableZ = iniFile.value ( "EnableZ", 1 ).toBool(); iniFile.endGroup (); - } // diff --git a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dialog.cpp b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dialog.cpp index f9d1047f..7d16b3e3 100644 --- a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dialog.cpp +++ b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dialog.cpp @@ -44,6 +44,7 @@ QWidget() connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); connect(ui.btnEngineStart, SIGNAL(clicked()), this, SLOT(doStartEngine())); connect(ui.btnEngineStop, SIGNAL(clicked()), this, SLOT(doStopEngine())); + connect(ui.btnSave, SIGNAL(clicked()), this, SLOT(save())); ui.cbxFilterSetting->addItem("None"); ui.cbxFilterSetting->addItem("Normal"); @@ -90,7 +91,7 @@ TrackerControls::~TrackerControls() { // // Initialize tracker-client-dialog // -void TrackerControls::Initialize(QWidget *parent, int num) { +void TrackerControls::Initialize(QWidget *parent) { QPoint offsetpos(200, 200); if (parent) { @@ -98,7 +99,6 @@ void TrackerControls::Initialize(QWidget *parent, int num) { } // Load the settings from the current .INI-file - numTracker = num; loadSettings(); show(); @@ -165,6 +165,7 @@ void TrackerControls::loadSettings() { iniFile.beginGroup ( "SMTracker" ); ui.cbxFilterSetting->setCurrentIndex(iniFile.value ( "FilterLevel", 1 ).toInt()); + ui.chkInvertRoll->setChecked(iniFile.value ( "InvertRoll", 0 ).toBool()); ui.chkInvertPitch->setChecked(iniFile.value ( "InvertPitch", 0 ).toBool()); ui.chkInvertYaw->setChecked(iniFile.value ( "InvertYaw", 0 ).toBool()); @@ -172,35 +173,13 @@ void TrackerControls::loadSettings() { ui.chkInvertY->setChecked(iniFile.value ( "InvertY", 0 ).toBool()); ui.chkInvertZ->setChecked(iniFile.value ( "InvertZ", 0 ).toBool()); - iniFile.endGroup (); + ui.chkEnableRoll->setChecked(iniFile.value ( "EnableRoll", 1 ).toBool()); + ui.chkEnablePitch->setChecked(iniFile.value ( "EnablePitch", 1 ).toBool()); + ui.chkEnableYaw->setChecked(iniFile.value ( "EnableYaw", 1 ).toBool()); + ui.chkEnableX->setChecked(iniFile.value ( "EnableX", 1 ).toBool()); + ui.chkEnableY->setChecked(iniFile.value ( "EnableY", 1 ).toBool()); + ui.chkEnableZ->setChecked(iniFile.value ( "EnableZ", 1 ).toBool()); - iniFile.beginGroup ( "HeadTracker" ); - // - // Check if the Tracker is the Primary one. - // If the property is not found in the INI-file, set the value. - // - if (numTracker == 1) { - numRoll = iniFile.value ( "RollTracker", 1 ).toInt(); - numPitch = iniFile.value ( "PitchTracker", 1 ).toInt(); - numYaw = iniFile.value ( "YawTracker", 1 ).toInt(); - numX = iniFile.value ( "XTracker", 0 ).toInt(); - numY = iniFile.value ( "YTracker", 0 ).toInt(); - numZ = iniFile.value ( "ZTracker", 0 ).toInt(); - } - else { - numRoll = iniFile.value ( "RollTracker", 0 ).toInt(); - numPitch = iniFile.value ( "PitchTracker", 0 ).toInt(); - numYaw = iniFile.value ( "YawTracker", 0 ).toInt(); - numX = iniFile.value ( "XTracker", 0 ).toInt(); - numY = iniFile.value ( "YTracker", 0 ).toInt(); - numZ = iniFile.value ( "ZTracker", 0 ).toInt(); - } - ui.chkEnableRoll->setChecked(numRoll == numTracker); - ui.chkEnablePitch->setChecked(numPitch == numTracker); - ui.chkEnableYaw->setChecked(numYaw == numTracker); - ui.chkEnableX->setChecked(numX == numTracker); - ui.chkEnableY->setChecked(numY == numTracker); - ui.chkEnableZ->setChecked(numZ == numTracker); iniFile.endGroup (); settingsDirty = false; @@ -224,62 +203,23 @@ void TrackerControls::save() { iniFile.setValue ( "InvertX", ui.chkInvertX->isChecked() ); iniFile.setValue ( "InvertY", ui.chkInvertY->isChecked() ); iniFile.setValue ( "InvertZ", ui.chkInvertZ->isChecked() ); - iniFile.endGroup (); - iniFile.beginGroup ( "HeadTracker" ); - if ( ui.chkEnableRoll->isChecked() ) { - iniFile.setValue ( "RollTracker", numTracker ); - } - else { - if (numRoll == numTracker) { - iniFile.setValue ( "RollTracker", 0 ); - } - } + iniFile.setValue ( "EnableRoll", ui.chkEnableRoll->isChecked() ); + iniFile.setValue ( "EnablePitch", ui.chkEnablePitch->isChecked() ); + iniFile.setValue ( "EnableYaw", ui.chkEnableYaw->isChecked() ); + iniFile.setValue ( "EnableX", ui.chkEnableX->isChecked() ); + iniFile.setValue ( "EnableY", ui.chkEnableY->isChecked() ); + iniFile.setValue ( "EnableZ", ui.chkEnableZ->isChecked() ); - if ( ui.chkEnablePitch->isChecked() ) { - iniFile.setValue ( "PitchTracker", numTracker ); - } - else { - if (numPitch == numTracker) { - iniFile.setValue ( "PitchTracker", 0 ); - } - } + iniFile.endGroup (); - if ( ui.chkEnableYaw->isChecked() ) { - iniFile.setValue ( "YawTracker", numTracker ); - } - else { - if (numYaw == numTracker) { - iniFile.setValue ( "YawTracker", 0 ); - } - } - if ( ui.chkEnableX->isChecked() ) { - iniFile.setValue ( "XTracker", numTracker ); - } - else { - if (numX == numTracker) { - iniFile.setValue ( "XTracker", 0 ); - } - } - if ( ui.chkEnableY->isChecked() ) { - iniFile.setValue ( "YTracker", numTracker ); - } - else { - if (numY == numTracker) { - iniFile.setValue ( "YTracker", 0 ); - } - } - if ( ui.chkEnableZ->isChecked() ) { - iniFile.setValue ( "ZTracker", numTracker ); - } - else { - if (numZ == numTracker) { - iniFile.setValue ( "ZTracker", 0 ); - } + // + // If the Tracker is active, let it load the new Settings. + // + if (theTracker) { + theTracker->loadSettings(); } - iniFile.endGroup (); - settingsDirty = false; } diff --git a/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h b/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h index 9e064474..b1638e7b 100644 --- a/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h +++ b/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h @@ -13,7 +13,7 @@ public: FTNoIR_Tracker(); ~FTNoIR_Tracker(); - void Initialize( QFrame *videoframe, int numTracker ); + void Initialize( QFrame *videoframe ); void StartTracker( HWND parent_window ); void StopTracker( bool exit ); bool GiveHeadPoseData(THeadPoseData *data); @@ -50,7 +50,7 @@ public: virtual ~TrackerControls(); void showEvent ( QShowEvent * event ); - void Initialize(QWidget *parent, int numTracker); + void Initialize(QWidget *parent); void registerTracker(ITracker *tracker) {}; void unRegisterTracker() {}; diff --git a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp index 31952b54..ecf0e5dd 100644 --- a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp +++ b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp @@ -118,7 +118,7 @@ quint16 senderPort; } } -void FTNoIR_Tracker::Initialize( QFrame *videoframe, int numTracker ) +void FTNoIR_Tracker::Initialize( QFrame *videoframe ) { qDebug() << "FTNoIR_Tracker::Initialize says: Starting "; loadSettings(); diff --git a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp index f65fb7c3..c5bee64f 100644 --- a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp +++ b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp @@ -59,7 +59,7 @@ TrackerControls::~TrackerControls() { // // Initialize tracker-client-dialog // -void TrackerControls::Initialize(QWidget *parent, int numTracker) { +void TrackerControls::Initialize(QWidget *parent) { QPoint offsetpos(100, 100); if (parent) { diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp index cee7d7b9..ebe75265 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.cpp +++ b/FaceTrackNoIR/FaceTrackNoIR.cpp @@ -245,7 +245,12 @@ QFrame *FaceTrackNoIR::getVideoWidget() { // QString FaceTrackNoIR::getCurrentProtocolName() { - return protocolFileList.at(ui.iconcomboProtocol->currentIndex()); + if (ui.iconcomboProtocol->currentIndex() < 0) { + return QString(""); + } + else { + return protocolFileList.at(ui.iconcomboProtocol->currentIndex()); + } } // @@ -253,7 +258,13 @@ QString FaceTrackNoIR::getCurrentProtocolName() // QString FaceTrackNoIR::getCurrentFilterName() { - return filterFileList.at(ui.iconcomboFilter->currentIndex()); + qDebug() << "getCurrentFilterName says: " << ui.iconcomboFilter->currentIndex(); + if (ui.iconcomboFilter->currentIndex() < 0) { + return QString(""); + } + else { + return filterFileList.at(ui.iconcomboFilter->currentIndex()); + } } // @@ -261,7 +272,12 @@ QString FaceTrackNoIR::getCurrentFilterName() // QString FaceTrackNoIR::getCurrentTrackerName() { - return trackerFileList.at(ui.iconcomboTrackerSource->currentIndex()); + if (ui.iconcomboTrackerSource->currentIndex() < 0) { + return QString(""); + } + else { + return trackerFileList.at(ui.iconcomboTrackerSource->currentIndex()); + } } // @@ -478,7 +494,7 @@ void FaceTrackNoIR::loadSettings() { // Put the filename in the window-title. // QFileInfo pathInfo ( currentFile ); - setWindowTitle ( "FaceTrackNoIR (1.7 alpha 6) - " + pathInfo.fileName() ); + setWindowTitle ( "FaceTrackNoIR (1.7 alpha 8) - " + pathInfo.fileName() ); // // Get a List of all the INI-files in the (currently active) Settings-folder. @@ -1007,7 +1023,7 @@ QString libName; if (ptrXyz) { pTrackerDialog = ptrXyz; - pTrackerDialog->Initialize( this, 1 ); + pTrackerDialog->Initialize( this ); // qDebug() << "FaceTrackNoIR::showTrackerSettings GetTrackerDialog Function Resolved!"; if (tracker) { pTrackerDialog->registerTracker( tracker->getTrackerPtr() ); @@ -1059,7 +1075,7 @@ QString libName; if (ptrXyz) { pSecondTrackerDialog = ptrXyz; - pSecondTrackerDialog->Initialize( this, 2 ); + pSecondTrackerDialog->Initialize( this ); // qDebug() << "FaceTrackNoIR::showTrackerSettings GetTrackerDialog Function Resolved!"; if (tracker) { pSecondTrackerDialog->registerTracker( tracker->getSecondTrackerPtr() ); @@ -1126,19 +1142,6 @@ importGetFilterDialog getIT; QLibrary *filterLib; QString libName; - //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) - - //// - //// Read the currently selected Filter from the INI-file. - //// - //iniFile.beginGroup ( "Filter" ); - //QString selectedFilterName = iniFile.value ( "Selection", "FTNoIR_Filter_EWMA2.dll" ).toString(); - //qDebug() << "createIconGroupBox says: selectedFilterName = " << selectedFilterName; - //iniFile.endGroup (); - // // Delete the existing QDialog // @@ -1147,12 +1150,12 @@ QString libName; pFilterDialog = NULL; } - // Show the appropriate Protocol-server Settings + // Get the currently selected Filter libName.clear(); libName = getCurrentFilterName(); // - // Load the Server-settings dialog (if any) and show it. + // Load the Filter-settings dialog (if any) and show it. // if (!libName.isEmpty()) { filterLib = new QLibrary(libName); diff --git a/FaceTrackNoIR/FaceTrackNoIR.ui b/FaceTrackNoIR/FaceTrackNoIR.ui index f04108a8..1cdd5891 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.ui +++ b/FaceTrackNoIR/FaceTrackNoIR.ui @@ -222,6 +222,9 @@ QGroupBox { 34 + + PointingHandCursor + Please help us: make gaming fun... @@ -459,7 +462,7 @@ Support FaceTrackNoIR! - 168 + 166 74 20 16 @@ -469,13 +472,13 @@ Support FaceTrackNoIR! color: rgb(0, 255, 0); - rotZ + roll - 167 + 168 35 20 16 @@ -485,15 +488,15 @@ Support FaceTrackNoIR! color: rgb(0, 255, 0); - rotX + yaw - 168 + 166 55 - 20 + 22 16 @@ -501,7 +504,7 @@ Support FaceTrackNoIR! color: rgb(0, 255, 0); - rotY + pitch @@ -652,7 +655,7 @@ border:none; - 120 + 118 60 21 16 @@ -663,15 +666,15 @@ border:none; color:white; - rotZ + roll - 120 + 118 40 - 21 + 22 16 @@ -680,13 +683,13 @@ color:white; border:none; - rotY + pitch - 120 + 118 20 21 16 @@ -697,7 +700,7 @@ border:none; color:white; - rotX + yaw @@ -1720,6 +1723,9 @@ background:none; 16777215 + + PointingHandCursor + Edit the Curve settings @@ -1784,7 +1790,7 @@ background:none; - Tracker Source(1st) + Tracker Source(1st = Master) diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp index a24b58f8..c8f297a0 100644 --- a/FaceTrackNoIR/tracker.cpp +++ b/FaceTrackNoIR/tracker.cpp @@ -171,7 +171,7 @@ QFrame *video_frame; if (ptrXyz) { pTracker = ptrXyz; - pTracker->Initialize( video_frame, 1 ); + pTracker->Initialize( video_frame ); qDebug() << "Tracker::setup Function Resolved!"; } } @@ -193,7 +193,7 @@ QFrame *video_frame; if (ptrXyz) { pSecondTracker = ptrXyz; - pSecondTracker->Initialize( NULL, 2 ); + pSecondTracker->Initialize( NULL ); qDebug() << "Tracker::setup Function Resolved!"; } } @@ -363,13 +363,13 @@ 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); -bool bInitialCenter = false; +bool bInitialCenter1 = true; +bool bInitialCenter2 = true; bool bTracker1Confid = false; bool bTracker2Confid = false; Tracker::do_tracking = true; // Start initially Tracker::do_center = false; // Center initially -// bInitialCenter = true; // // Test some Filter-stuff @@ -616,20 +616,24 @@ bool bTracker2Confid = false; newpose.y = 0.0f; newpose.z = 0.0f; - if (pTracker) { - bTracker1Confid = pTracker->GiveHeadPoseData(&newpose); - } - else { - bTracker1Confid = true; - } + // + // The second tracker serves as 'secondary'. So if an axis is written by the second tracker it CAN be overwritten by the Primary tracker. + // This is enforced by the sequence below. + // if (pSecondTracker) { bTracker2Confid = pSecondTracker->GiveHeadPoseData(&newpose); } else { bTracker2Confid = true; } + if (pTracker) { + bTracker1Confid = pTracker->GiveHeadPoseData(&newpose); + } + else { + bTracker1Confid = true; + } - Tracker::confid = (bTracker1Confid && bTracker2Confid); + Tracker::confid = (bTracker1Confid || bTracker2Confid); if ( Tracker::confid ) { addHeadPose(newpose); } @@ -637,14 +641,16 @@ bool bTracker2Confid = false; // // If Center is pressed, copy the current values to the offsets. // - if ((Tracker::do_center) || ((bInitialCenter) && (Tracker::confid))) { + if ((Tracker::do_center) || ((bInitialCenter1 && bTracker1Confid ) || (bInitialCenter2 && bTracker2Confid))) { MessageBeep (MB_ICONASTERISK); - if (pTracker) { + if (pTracker && bTracker1Confid) { pTracker->notifyCenter(); // Send 'center' to the tracker + bInitialCenter1 = false; } - if (pSecondTracker) { - pSecondTracker->notifyCenter(); // Send 'center' to the tracker + if (pSecondTracker && bTracker2Confid) { + pSecondTracker->notifyCenter(); // Send 'center' to the second tracker + bInitialCenter2 = false; } // @@ -658,7 +664,6 @@ bool bTracker2Confid = false; offset_camera.pitch = getSmoothFromList( &Pitch.rawList ); offset_camera.yaw = getSmoothFromList( &Yaw.rawList ); offset_camera.roll = getSmoothFromList( &Roll.rawList ); - bInitialCenter = false; } Tracker::do_center = false; diff --git a/bin/Settings/ArmA.ini b/bin/Settings/ArmA.ini index 350c6ec7..482d579e 100644 --- a/bin/Settings/ArmA.ini +++ b/bin/Settings/ArmA.ini @@ -25,40 +25,8 @@ powCurve=5 maxSmooth=70 [GameProtocol] -Selection=2 DLL=FTNoIR_Protocol_FT.dll - -[Curves] -Roll_point1=@Variant(\0\0\0\x1a\0\0\0\0\0\0\0\0@\b\0\0\0\0\0\0) -Roll_point2=@Variant(\0\0\0\x1a@R\xc0\0\0\0\0\0@A\x80\0\0\0\0\0) -Roll_point3=@Variant(\0\0\0\x1a@e`\0\0\0\0\0@G\0\0\0\0\0\0) -Roll_point4=@Variant(\0\0\0\x1a@e`\0\0\0\0\0@I\0\0\0\0\0\0) -Yaw_point1=@Variant(\0\0\0\x1a@ \0\0\0\0\0\0@&\0\0\0\0\0\0) -Yaw_point2="@Variant(\0\0\0\x1a@@\x80\0\0\0\0\0@;\0\0\0\0\0\0)" -Yaw_point3=@Variant(\0\0\0\x1a@L\x80\0\0\0\0\0@C\0\0\0\0\0\0) -Yaw_point4=@Variant(\0\0\0\x1a@U\0\0\0\0\0\0@I\0\0\0\0\0\0) -Pitch_point1=@Variant(\0\0\0\x1a@\x1c\0\0\0\0\0\0@ \0\0\0\0\0\0) -Pitch_point2=@Variant(\0\0\0\x1a@D\0\0\0\0\0\0@?\0\0\0\0\0\0) -Pitch_point3=@Variant(\0\0\0\x1a@P@\0\0\0\0\0@D\x80\0\0\0\0\0) -Pitch_point4=@Variant(\0\0\0\x1a@T\x80\0\0\0\0\0@I\0\0\0\0\0\0) -X_point1=@Variant(\0\0\0\x1a\0\0\0\0\0\0\0\0@\0\0\0\0\0\0\0) -X_point2=@Variant(\0\0\0\x1a@Z@\0\0\0\0\0@1\0\0\0\0\0\0) -X_point3=@Variant(\0\0\0\x1a@a@\0\0\0\0\0@?\0\0\0\0\0\0) -X_point4=@Variant(\0\0\0\x1a@d\xa0\0\0\0\0\0@I\0\0\0\0\0\0) -Y_point1=@Variant(\0\0\0\x1a\0\0\0\0\0\0\0\0@\0\0\0\0\0\0\0) -Y_point2=@Variant(\0\0\0\x1a@F\x80\0\0\0\0\0@E\0\0\0\0\0\0) -Y_point3=@Variant(\0\0\0\x1a@6\0\0\0\0\0\0@9\0\0\0\0\0\0) -Y_point4=@Variant(\0\0\0\x1a@P@\0\0\0\0\0@I\0\0\0\0\0\0) -Z_point1=@Variant(\0\0\0\x1a\0\0\0\0\0\0\0\0@&\0\0\0\0\0\0) -Z_point2=@Variant(\0\0\0\x1a@1\0\0\0\0\0\0@H\x80\0\0\0\0\0) -Z_point3=@Variant(\0\0\0\x1a@6\0\0\0\0\0\0@D\x80\0\0\0\0\0) -Z_point4=@Variant(\0\0\0\x1a@K\x80\0\0\0\0\0@I\0\0\0\0\0\0) -fixup_mx=0 -fixup_my=0 -fixup_mz=0 -fixup_x=0 -fixup_y=0 -fixup_z=0 +Selection=2 [KB_Shortcuts] Keycode_Center=199 @@ -95,65 +63,115 @@ MouseKey_StartStop=0 MouseKey_Inhibit=0 [TrackerSource] -Selection=2 +Selection=0 DLL=FTNoIR_Tracker_SM.dll +2ndDLL=None + +[FTIR] +useTIRViews=false +useDummyExe=true + +[SMTracker] +FilterLevel=1 + +[Filter] +DLL=FTNoIR_Filter_Accela.dll [Curves-Yaw] -point-count=1 -point-0-x=44.7297297297297 -point-0-y=134.357142857143 +point-count=2 +point-0-x=25 +point-0-y=90 +point-1-x=50 +point-1-y=180 [Curves-PitchUp] -point-count=1 -point-0-x=45.2702702702703 -point-0-y=169.714285714286 -point-1-x=22.1621621621622 -point-1-y=164.571428571429 -point-2-x=32.027027027027 -point-2-y=118.285714285714 -point-3-x=37.8378378378378 -point-3-y=150.428571428571 +point-count=2 +point-0-x=25 +point-0-y=90 +point-1-x=50 +point-1-y=180 [Curves-PitchDown] point-count=1 -point-0-x=47.2972972972973 -point-0-y=169.714285714286 -point-1-x=24.4594594594595 -point-1-y=70.7142857142857 -point-2-x=25.1351351351351 -point-2-y=137.571428571429 +point-0-x=19 +point-0-y=63 +point-1-x=50 +point-1-y=180 [Curves-Roll] -point-count=1 -point-0-x=37.7027027027027 -point-0-y=135 +point-count=2 +point-0-x=25 +point-0-y=90 +point-1-x=50 +point-1-y=180 [Curves-X] -point-count=1 -point-0-x=37.4324324324324 -point-0-y=83.5714285714286 +point-count=2 +point-0-x=11.75 +point-0-y=108 +point-1-x=29.75 +point-1-y=149 [Curves-Y] -point-count=1 -point-0-x=34.1891891891892 -point-0-y=82.9285714285714 +point-count=2 +point-0-x=25 +point-0-y=90 +point-1-x=50 +point-1-y=180 [Curves-Z] -point-count=1 -point-0-x=34.3243243243243 -point-0-y=75.2142857142857 +point-count=2 +point-0-x=25 +point-0-y=90 +point-1-x=50 +point-1-y=180 -[FTIR] -useTIRViews=false -useDummyExe=true - -[FaceDetectTracker] -RedetectMs=500 -CameraId=0 -VideoWidget=1 - -[SMTracker] -FilterLevel=1 +[Curves-Accela-Scaling-Rotation] +point-count=12 +point-0-x=0 +point-0-y=0 +point-1-x=0.308900523560209 +point-1-y=0.0666666666666667 +point-2-x=0.565445026178011 +point-2-y=0.226666666666667 +point-3-x=0.769633507853403 +point-3-y=0.506666666666667 +point-4-x=0.994764397905759 +point-4-y=1 +point-5-x=1.23560209424084 +point-5-y=1.61333333333333 +point-6-x=1.47643979057592 +point-6-y=2.37333333333333 +point-7-x=1.66492146596859 +point-7-y=3.12 +point-8-x=1.80628272251309 +point-8-y=3.92 +point-9-x=1.91623036649215 +point-9-y=4.70666666666667 +point-10-x=2.00523560209424 +point-10-y=5.44 +point-11-x=2.07329842931937 +point-11-y=6 -[Filter] -DLL=FTNoIR_Filter_EWMA2.dll +[Curves-Accela-Scaling-Translation] +point-count=10 +point-0-x=0 +point-0-y=0 +point-1-x=0.282722513089005 +point-1-y=0.08 +point-2-x=0.492146596858639 +point-2-y=0.306666666666667 +point-3-x=0.764397905759162 +point-3-y=0.84 +point-4-x=1.00523560209424 +point-4-y=1.62666666666667 +point-5-x=1.17277486910995 +point-5-y=2.78666666666667 +point-6-x=1.25130890052356 +point-6-y=3.6 +point-7-x=1.31937172774869 +point-7-y=4.29333333333333 +point-8-x=1.38219895287958 +point-8-y=4.90666666666667 +point-9-x=1.43455497382199 +point-9-y=5.65333333333333 -- cgit v1.2.3