diff options
author | Wim Vriend <facetracknoir@gmail.com> | 2012-11-26 21:00:55 +0000 |
---|---|---|
committer | Wim Vriend <facetracknoir@gmail.com> | 2012-11-26 21:00:55 +0000 |
commit | acdb0aaf27e2ca623a9e32ea7efcc484aecde498 (patch) | |
tree | 0f38a797e564c827c35d0bc2f70b3f33edc423c6 /FaceTrackNoIR | |
parent | bcd12abfc0474d489f5fd30358475086c60df1eb (diff) |
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
Diffstat (limited to 'FaceTrackNoIR')
-rw-r--r-- | FaceTrackNoIR/FaceTrackNoIR.cpp | 45 | ||||
-rw-r--r-- | FaceTrackNoIR/FaceTrackNoIR.ui | 36 | ||||
-rw-r--r-- | FaceTrackNoIR/tracker.cpp | 37 |
3 files changed, 66 insertions, 52 deletions
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 { <height>34</height>
</rect>
</property>
+ <property name="cursor">
+ <cursorShape>PointingHandCursor</cursorShape>
+ </property>
<property name="toolTip">
<string>Please help us: make gaming fun...</string>
</property>
@@ -459,7 +462,7 @@ Support FaceTrackNoIR!</string> <widget class="QLabel" name="lblRotZ">
<property name="geometry">
<rect>
- <x>168</x>
+ <x>166</x>
<y>74</y>
<width>20</width>
<height>16</height>
@@ -469,13 +472,13 @@ Support FaceTrackNoIR!</string> <string notr="true">color: rgb(0, 255, 0);</string>
</property>
<property name="text">
- <string>rotZ</string>
+ <string>roll</string>
</property>
</widget>
<widget class="QLabel" name="lblRotX">
<property name="geometry">
<rect>
- <x>167</x>
+ <x>168</x>
<y>35</y>
<width>20</width>
<height>16</height>
@@ -485,15 +488,15 @@ Support FaceTrackNoIR!</string> <string notr="true">color: rgb(0, 255, 0);</string>
</property>
<property name="text">
- <string>rotX</string>
+ <string>yaw</string>
</property>
</widget>
<widget class="QLabel" name="lblRotY">
<property name="geometry">
<rect>
- <x>168</x>
+ <x>166</x>
<y>55</y>
- <width>20</width>
+ <width>22</width>
<height>16</height>
</rect>
</property>
@@ -501,7 +504,7 @@ Support FaceTrackNoIR!</string> <string notr="true">color: rgb(0, 255, 0);</string>
</property>
<property name="text">
- <string>rotY</string>
+ <string>pitch</string>
</property>
</widget>
</widget>
@@ -652,7 +655,7 @@ border:none;</string> <widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
- <x>120</x>
+ <x>118</x>
<y>60</y>
<width>21</width>
<height>16</height>
@@ -663,15 +666,15 @@ border:none;</string> color:white;</string>
</property>
<property name="text">
- <string>rotZ</string>
+ <string>roll</string>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
- <x>120</x>
+ <x>118</x>
<y>40</y>
- <width>21</width>
+ <width>22</width>
<height>16</height>
</rect>
</property>
@@ -680,13 +683,13 @@ color:white;</string> border:none;</string>
</property>
<property name="text">
- <string>rotY</string>
+ <string>pitch</string>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
- <x>120</x>
+ <x>118</x>
<y>20</y>
<width>21</width>
<height>16</height>
@@ -697,7 +700,7 @@ border:none;</string> color:white;</string>
</property>
<property name="text">
- <string>rotX</string>
+ <string>yaw</string>
</property>
</widget>
<widget class="QLCDNumber" name="lcdNumRotY">
@@ -1720,6 +1723,9 @@ background:none;</string> <height>16777215</height>
</size>
</property>
+ <property name="cursor">
+ <cursorShape>PointingHandCursor</cursorShape>
+ </property>
<property name="toolTip">
<string>Edit the Curve settings</string>
</property>
@@ -1784,7 +1790,7 @@ background:none;</string> <string notr="true"/>
</property>
<property name="title">
- <string>Tracker Source(1st)</string>
+ <string>Tracker Source(1st = Master)</string>
</property>
<widget class="QComboBox" name="iconcomboTrackerSource">
<property name="geometry">
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;
|