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 --- FaceTrackNoIR/FaceTrackNoIR.cpp | 45 ++++++++++++++++++++++------------------- FaceTrackNoIR/FaceTrackNoIR.ui | 36 +++++++++++++++++++-------------- FaceTrackNoIR/tracker.cpp | 37 ++++++++++++++++++--------------- 3 files changed, 66 insertions(+), 52 deletions(-) (limited to 'FaceTrackNoIR') 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; -- cgit v1.2.3