diff options
author | Wim Vriend <facetracknoir@gmail.com> | 2013-01-02 18:54:06 +0000 |
---|---|---|
committer | Wim Vriend <facetracknoir@gmail.com> | 2013-01-02 18:54:06 +0000 |
commit | c681889ab4c37bfd0f049177459b7fda380fda51 (patch) | |
tree | f6072db0b2328b4df9e5214e3578baa43792b48e /FaceTrackNoIR | |
parent | 9593aa9c3c231add3dadabf0a1ea9f8182f88a79 (diff) |
Added 'enable axis' parameters to the Trackers. Added 'none' to filter-listbox.
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@203 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FaceTrackNoIR')
-rw-r--r-- | FaceTrackNoIR/FaceTrackNoIR.cpp | 128 | ||||
-rw-r--r-- | FaceTrackNoIR/FaceTrackNoIR.h | 2 | ||||
-rw-r--r-- | FaceTrackNoIR/FaceTrackNoIR.ui | 48 | ||||
-rw-r--r-- | FaceTrackNoIR/tracker.cpp | 57 | ||||
-rw-r--r-- | FaceTrackNoIR/tracker.h | 6 |
5 files changed, 97 insertions, 144 deletions
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp index 5494c918..41dee02f 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.cpp +++ b/FaceTrackNoIR/FaceTrackNoIR.cpp @@ -23,6 +23,8 @@ *********************************************************************************/
/*
Modifications (last one on top):
+ 20130101 - WVR: Added "None" to filter-listbox to remove "use advanced filtering".
+ 20121209 - WVR: Pre-v170 DLLs will not be added to the Listbox. Initial selection was changed (made case-insensitive).
20121014 - WVR: Added second Tracker Source for Arduino solution. The two will be mutually exclusive.
20120929 - WVR: Disable button Filter-settings when StartTracker.
20120918 - WVR: When AutoStart is TRUE, the program is not directly minimized any more.
@@ -137,10 +139,6 @@ void FaceTrackNoIR::setupFaceTrackNoIR() { connect(ui.btnShowServerControls, SIGNAL(clicked()), this, SLOT(showServerControls()));
connect(ui.btnShowFilterControls, SIGNAL(clicked()), this, SLOT(showFilterControls()));
- // button methods connect with methods in this class
- connect(ui.btnStartTracker, SIGNAL(clicked()), this, SLOT(startTracker()));
- connect(ui.btnStopTracker, SIGNAL(clicked()), this, SLOT(stopTracker()));
-
// Connect checkboxes
connect(ui.chkInvertYaw, SIGNAL(stateChanged(int)), this, SLOT(setInvertYaw(int)));
connect(ui.chkInvertRoll, SIGNAL(stateChanged(int)), this, SLOT(setInvertRoll(int)));
@@ -149,7 +147,9 @@ void FaceTrackNoIR::setupFaceTrackNoIR() { connect(ui.chkInvertY, SIGNAL(stateChanged(int)), this, SLOT(setInvertY(int)));
connect(ui.chkInvertZ, SIGNAL(stateChanged(int)), this, SLOT(setInvertZ(int)));
- connect(ui.chkUseEWMA, SIGNAL(stateChanged(int)), this, SLOT(setUseFilter(int)));
+ // button methods connect with methods in this class
+ connect(ui.btnStartTracker, SIGNAL(clicked()), this, SLOT(startTracker()));
+ connect(ui.btnStopTracker, SIGNAL(clicked()), this, SLOT(stopTracker()));
// Connect slider for smoothing
connect(ui.slideSmoothing, SIGNAL(valueChanged(int)), this, SLOT(setSmoothing(int)));
@@ -260,11 +260,11 @@ QString FaceTrackNoIR::getCurrentProtocolName() QString FaceTrackNoIR::getCurrentFilterName()
{
qDebug() << "getCurrentFilterName says: " << ui.iconcomboFilter->currentIndex();
- if (ui.iconcomboFilter->currentIndex() < 0) {
- return QString("");
+ if (ui.iconcomboFilter->currentIndex() <= 0) {
+ return QString("None");
}
else {
- return filterFileList.at(ui.iconcomboFilter->currentIndex());
+ return filterFileList.at(ui.iconcomboFilter->currentIndex() - 1 );
}
}
@@ -277,6 +277,7 @@ QString FaceTrackNoIR::getCurrentTrackerName() return QString("");
}
else {
+ qDebug() << "FaceTrackNoIR::getCurrentTrackerName libName = " << trackerFileList.at(ui.iconcomboTrackerSource->currentIndex());
return trackerFileList.at(ui.iconcomboTrackerSource->currentIndex());
}
}
@@ -403,7 +404,6 @@ void FaceTrackNoIR::save() { iniFile.setValue ( "invertX", ui.chkInvertX->isChecked() );
iniFile.setValue ( "invertY", ui.chkInvertY->isChecked() );
iniFile.setValue ( "invertZ", ui.chkInvertZ->isChecked() );
- iniFile.setValue ( "useEWMA", ui.chkUseEWMA->isChecked() );
iniFile.endGroup ();
iniFile.beginGroup ( "GameProtocol" );
@@ -495,7 +495,7 @@ void FaceTrackNoIR::loadSettings() { // Put the filename in the window-title.
//
QFileInfo pathInfo ( currentFile );
- setWindowTitle ( "FaceTrackNoIR (1.7 alpha 8) - " + pathInfo.fileName() );
+ setWindowTitle ( "FaceTrackNoIR (1.7 alpha 10) - " + pathInfo.fileName() );
//
// Get a List of all the INI-files in the (currently active) Settings-folder.
@@ -530,8 +530,6 @@ void FaceTrackNoIR::loadSettings() { ui.chkInvertX->setChecked (iniFile.value ( "invertX", 0 ).toBool());
ui.chkInvertY->setChecked (iniFile.value ( "invertY", 0 ).toBool());
ui.chkInvertZ->setChecked (iniFile.value ( "invertZ", 0 ).toBool());
- ui.chkUseEWMA->setChecked (iniFile.value ( "useEWMA", 1 ).toBool());
-
iniFile.endGroup ();
//
@@ -585,14 +583,15 @@ void FaceTrackNoIR::loadSettings() { }
iniFile.endGroup ();
- disconnect(ui.iconcomboProtocol, SIGNAL(currentIndexChanged(int)), this, SLOT(protocolSelected(int)));
+ //
+ // Find the Index of the DLL and set the selection.
+ //
for ( int i = 0; i < protocolFileList.size(); i++) {
- if (protocolFileList.at(i) == selectedProtocolName) {
+ if (protocolFileList.at(i).compare( selectedProtocolName, Qt::CaseInsensitive ) == 0) {
ui.iconcomboProtocol->setCurrentIndex( i );
+ break;
}
}
- connect(ui.iconcomboProtocol, SIGNAL(currentIndexChanged(int)), this, SLOT(protocolSelected(int)));
- protocolSelected( ui.iconcomboProtocol->currentIndex() );
//
// Read the currently selected Tracker from the INI-file.
@@ -623,10 +622,10 @@ void FaceTrackNoIR::loadSettings() { disconnect(ui.iconcomboTrackerSource, SIGNAL(currentIndexChanged(int)), this, SLOT(trackingSourceSelected(int)));
disconnect(ui.cbxSecondTrackerSource, SIGNAL(currentIndexChanged(int)), this, SLOT(trackingSourceSelected(int)));
for ( int i = 0; i < trackerFileList.size(); i++) {
- if (trackerFileList.at(i) == selectedTrackerName) {
+ if (trackerFileList.at(i).compare( selectedTrackerName, Qt::CaseInsensitive ) == 0) {
ui.iconcomboTrackerSource->setCurrentIndex( i );
}
- if (trackerFileList.at(i) == secondTrackerName) {
+ if (trackerFileList.at(i).compare( secondTrackerName, Qt::CaseInsensitive ) == 0) {
ui.cbxSecondTrackerSource->setCurrentIndex( i + 1 ); // The first value = "None", so add 1
}
}
@@ -641,13 +640,15 @@ void FaceTrackNoIR::loadSettings() { qDebug() << "createIconGroupBox says: selectedFilterName = " << selectedFilterName;
iniFile.endGroup ();
- disconnect(ui.iconcomboFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(filterSelected(int)));
+ //
+ // Find the Index of the DLL and set the selection.
+ //
for ( int i = 0; i < filterFileList.size(); i++) {
- if (filterFileList.at(i) == selectedFilterName) {
- ui.iconcomboFilter->setCurrentIndex( i );
+ if (filterFileList.at(i).compare( selectedFilterName, Qt::CaseInsensitive ) == 0) {
+ ui.iconcomboFilter->setCurrentIndex( i + 1 ); // The first value = "None", so add 1
+ break;
}
}
- connect(ui.iconcomboFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(filterSelected(int)));
settingsDirty = false;
}
@@ -704,8 +705,6 @@ void FaceTrackNoIR::startTracker( ) { //
tracker->setup();
tracker->setSmoothing ( ui.slideSmoothing->value() );
- tracker->setUseFilter (ui.chkUseEWMA->isChecked() );
-
tracker->setInvertYaw (ui.chkInvertYaw->isChecked() );
tracker->setInvertPitch (ui.chkInvertPitch->isChecked() );
tracker->setInvertRoll (ui.chkInvertRoll->isChecked() );
@@ -888,12 +887,6 @@ void FaceTrackNoIR::setInvertZ( int invert ) { settingsDirty = true;
}
-/** set Use Filter from the checkbox **/
-void FaceTrackNoIR::setUseFilter( int set ) {
- Tracker::setUseFilter ( (set != 0)?true:false );
- settingsDirty = true;
-}
-
/** Show the headpose in the widget (triggered by timer) **/
void FaceTrackNoIR::showHeadPose() {
THeadPoseData newdata;
@@ -1244,6 +1237,7 @@ importGetFilterDll getFilter; IFilterDllPtr pFilterDll; // Pointer to Filter info instance (in DLL)
importGetTrackerDll getTracker;
ITrackerDll *pTrackerDll; // Pointer to Tracker info instance (in DLL)
+QStringList listDLLs; // List of specific DLLs
QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
@@ -1258,19 +1252,18 @@ ITrackerDll *pTrackerDll; // Pointer to Tracker info instance (in DLL) filters.clear();
filters << "FTNoIR_Protocol_*.dll";
protocolFileList.clear();
- protocolFileList = settingsDir.entryList( filters, QDir::Files, QDir::Name );
+ listDLLs.clear();
+ listDLLs = settingsDir.entryList( filters, QDir::Files, QDir::Name );
//
// Add strings to the Listbox.
//
disconnect(ui.iconcomboProtocol, SIGNAL(currentIndexChanged(int)), this, SLOT(protocolSelected(int)));
ui.iconcomboProtocol->clear();
- for ( int i = 0; i < protocolFileList.size(); i++) {
-
-// qDebug() << "createIconGroupBox says: ProtocolName = " << protocolFileList.at(i);
+ for ( int i = 0; i < listDLLs.size(); i++) {
- // Show the appropriate Protocol-server Settings
- QLibrary *protocolLib = new QLibrary(protocolFileList.at(i));
+ // Try to load the DLL and get the Icon and Name
+ QLibrary *protocolLib = new QLibrary(listDLLs.at(i));
QString *protocolName = new QString("");
QIcon *protocolIcon = new QIcon();
@@ -1282,17 +1275,18 @@ ITrackerDll *pTrackerDll; // Pointer to Tracker info instance (in DLL) pProtocolDll = ptrXyz;
pProtocolDll->getFullName( protocolName );
pProtocolDll->getIcon( protocolIcon );
-// qDebug() << "FaceTrackNoIR::showServerControls GetProtocolDialog Function Resolved!";
+
+ //
+ // Add the Icon and the Name to the Listbox and update the fileList
+ //
+ ui.iconcomboProtocol->addItem(*protocolIcon, *protocolName );
+ protocolFileList.append(listDLLs.at(i));
}
- else {
- qDebug() << "FaceTrackNoIR::showServerControls Function NOT Resolved!";
- }
}
else {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "Protocol-DLL not loaded, please check if the DLL is version 1.7",QMessageBox::Ok,QMessageBox::NoButton);
+ QMessageBox::warning(0,"FaceTrackNoIR Error", "Protocol-DLL not loaded, please check if the DLL is version 1.7 \nand all dependencies are installed. \n(" + listDLLs.at(i) + ")",QMessageBox::Ok,QMessageBox::NoButton);
}
- ui.iconcomboProtocol->addItem(*protocolIcon, *protocolName );
}
connect(ui.iconcomboProtocol, SIGNAL(currentIndexChanged(int)), this, SLOT(protocolSelected(int)));
@@ -1302,19 +1296,20 @@ ITrackerDll *pTrackerDll; // Pointer to Tracker info instance (in DLL) filters.clear();
filters << "FTNoIR_Filter_*.dll";
filterFileList.clear();
- filterFileList = settingsDir.entryList( filters, QDir::Files, QDir::Name );
+ listDLLs.clear();
+ listDLLs = settingsDir.entryList( filters, QDir::Files, QDir::Name );
//
// Add strings to the Listbox.
//
disconnect(ui.iconcomboFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(filterSelected(int)));
ui.iconcomboFilter->clear();
- for ( int i = 0; i < filterFileList.size(); i++) {
+ ui.iconcomboFilter->addItem("None");
-// qDebug() << "createIconGroupBox says: FilterName = " << filterFileList.at(i);
+ for ( int i = 0; i < listDLLs.size(); i++) {
- // Show the appropriate Protocol-server Settings
- QLibrary *filterLib = new QLibrary(filterFileList.at(i));
+ // Try to load the DLL and get the Icon and Name
+ QLibrary *filterLib = new QLibrary(listDLLs.at(i));
QString *filterName = new QString("");
QIcon *filterIcon = new QIcon();
@@ -1326,17 +1321,18 @@ ITrackerDll *pTrackerDll; // Pointer to Tracker info instance (in DLL) pFilterDll = ptrXyz;
pFilterDll->getFullName( filterName );
pFilterDll->getIcon( filterIcon );
-// qDebug() << "FaceTrackNoIR::showServerControls GetFilterDialog Function Resolved!";
+
+ //
+ // Add the Icon and the Name to the Listbox and update the fileList
+ //
+ ui.iconcomboFilter->addItem(*filterIcon, *filterName );
+ filterFileList.append(listDLLs.at(i));
}
- else {
- qDebug() << "FaceTrackNoIR::showServerControls Function NOT Resolved!";
- }
}
else {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "Filter-DLL not loaded, please check if the DLL is version 1.7",QMessageBox::Ok,QMessageBox::NoButton);
+ QMessageBox::warning(0,"FaceTrackNoIR Error", "Filter-DLL not loaded, please check if the DLL is version 1.7 \nand all dependencies are installed. \n(" + listDLLs.at(i) + ")",QMessageBox::Ok,QMessageBox::NoButton);
}
- ui.iconcomboFilter->addItem(*filterIcon, *filterName );
}
connect(ui.iconcomboFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(filterSelected(int)));
@@ -1346,7 +1342,8 @@ ITrackerDll *pTrackerDll; // Pointer to Tracker info instance (in DLL) filters.clear();
filters << "FTNoIR_Tracker_*.dll";
trackerFileList.clear();
- trackerFileList = settingsDir.entryList( filters, QDir::Files, QDir::Name );
+ listDLLs.clear();
+ listDLLs = settingsDir.entryList( filters, QDir::Files, QDir::Name );
//
// Add strings to the Listbox(es).
@@ -1358,12 +1355,10 @@ ITrackerDll *pTrackerDll; // Pointer to Tracker info instance (in DLL) ui.cbxSecondTrackerSource->clear();
ui.cbxSecondTrackerSource->addItem("None");
- for ( int i = 0; i < trackerFileList.size(); i++) {
-
-// qDebug() << "createIconGroupBox says: TrackerName = " << trackerFileList.at(i);
+ for ( int i = 0; i < listDLLs.size(); i++) {
- // Show the appropriate Protocol-server Settings
- QLibrary *trackerLib = new QLibrary(trackerFileList.at(i));
+ // Try to load the DLL and get the Icon and Name
+ QLibrary *trackerLib = new QLibrary(listDLLs.at(i));
QString *trackerName = new QString("");
QIcon *trackerIcon = new QIcon();
@@ -1375,18 +1370,19 @@ ITrackerDll *pTrackerDll; // Pointer to Tracker info instance (in DLL) pTrackerDll = ptrXyz;
pTrackerDll->getFullName( trackerName );
pTrackerDll->getIcon( trackerIcon );
-// qDebug() << "FaceTrackNoIR::showServerControls GetTrackerDll Function Resolved!";
+
+ //
+ // Add the Icon and the Name to the Listbox and update the fileList
+ //
+ ui.iconcomboTrackerSource->addItem(*trackerIcon, *trackerName );
+ ui.cbxSecondTrackerSource->addItem(*trackerIcon, *trackerName );
+ trackerFileList.append(listDLLs.at(i));
}
- else {
- qDebug() << "FaceTrackNoIR::showServerControls Function NOT Resolved!";
- }
}
else {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "Facetracker-DLL not loaded, please check if the DLL is version 1.7",QMessageBox::Ok,QMessageBox::NoButton);
+ QMessageBox::warning(0,"FaceTrackNoIR Error", "Tracker-DLL not loaded, please check if the DLL is version 1.7 \nand all dependencies are installed. \n(" + listDLLs.at(i) + ")",QMessageBox::Ok,QMessageBox::NoButton);
}
- ui.iconcomboTrackerSource->addItem(*trackerIcon, *trackerName );
- ui.cbxSecondTrackerSource->addItem(*trackerIcon, *trackerName );
}
connect(ui.iconcomboTrackerSource, SIGNAL(currentIndexChanged(int)), this, SLOT(trackingSourceSelected(int)));
connect(ui.cbxSecondTrackerSource, SIGNAL(currentIndexChanged(int)), this, SLOT(trackingSourceSelected(int)));
diff --git a/FaceTrackNoIR/FaceTrackNoIR.h b/FaceTrackNoIR/FaceTrackNoIR.h index 52ea8418..756b5867 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.h +++ b/FaceTrackNoIR/FaceTrackNoIR.h @@ -150,7 +150,6 @@ private: void showKeyboardShortcuts();
void showCurveConfiguration();
- // invert checkboxes
void setInvertYaw( int invert );
void setInvertPitch( int invert );
void setInvertRoll( int invert );
@@ -158,7 +157,6 @@ private: void setInvertY( int invert );
void setInvertZ( int invert );
- void setUseFilter( int set );
void showHeadPose();
//smoothing slider
diff --git a/FaceTrackNoIR/FaceTrackNoIR.ui b/FaceTrackNoIR/FaceTrackNoIR.ui index 2a478809..20c2ee53 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.ui +++ b/FaceTrackNoIR/FaceTrackNoIR.ui @@ -1221,39 +1221,6 @@ color: rgb(0, 255, 0);</string> </property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
- <widget class="QLabel" name="lblSensYaw_5">
- <property name="minimumSize">
- <size>
- <width>95</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>150</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true">color:#ccc;
-background:none;</string>
- </property>
- <property name="text">
- <string>Use advanced filtering:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QCheckBox" name="chkUseEWMA">
- <property name="styleSheet">
- <string notr="true">background:none;</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
<widget class="QLabel" name="lblSensYaw_4">
<property name="minimumSize">
<size>
@@ -1276,7 +1243,7 @@ background:none;</string> </property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="0" column="1">
<widget class="QLabel" name="label">
<property name="styleSheet">
<string notr="true">color:#ccc;
@@ -1287,7 +1254,7 @@ background:none;</string> </property>
</widget>
</item>
- <item row="2" column="0">
+ <item row="1" column="0">
<widget class="QSlider" name="slideSmoothing">
<property name="minimumSize">
<size>
@@ -1315,7 +1282,7 @@ background:none;</string> </property>
</widget>
</item>
- <item row="2" column="1">
+ <item row="1" column="1">
<widget class="QSpinBox" name="spinSmoothing">
<property name="minimumSize">
<size>
@@ -1342,7 +1309,7 @@ background:none;</string> <widget class="QWidget" name="gridLayoutWidget_2">
<property name="geometry">
<rect>
- <x>200</x>
+ <x>190</x>
<y>20</y>
<width>211</width>
<height>81</height>
@@ -2059,7 +2026,7 @@ background:none;</string> </spacer>
</item>
<item row="1" column="2">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QPushButton" name="btnShortcuts">
<property name="minimumSize">
@@ -2081,8 +2048,7 @@ background:none;</string> <string>Edit the Keyboard and mouse shortcuts</string>
</property>
<property name="text">
- <string>Short-
-keys</string>
+ <string>Shortkeys</string>
</property>
<property name="icon">
<iconset resource="FaceTrackNoIR.qrc">
@@ -2131,7 +2097,7 @@ keys</string> </property>
<property name="iconSize">
<size>
- <width>70</width>
+ <width>120</width>
<height>24</height>
</size>
</property>
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp index 251f2274..1266ab01 100644 --- a/FaceTrackNoIR/tracker.cpp +++ b/FaceTrackNoIR/tracker.cpp @@ -68,12 +68,6 @@ #include "tracker.h"
#include "FaceTrackNoIR.h"
-//
-// Definitions for testing purposes
-//
-//#define USE_HEADPOSE_CALLBACK
-//#define USE_DEBUG_CLIENT
-
// Flags
bool Tracker::confid = false;
bool Tracker::do_tracking = true;
@@ -82,7 +76,6 @@ bool Tracker::do_inhibit = false; bool Tracker::do_game_zero = false;
bool Tracker::do_axis_reverse = false;
-bool Tracker::useFilter = false;
bool Tracker::setZero = true;
bool Tracker::setEngineStop = true;
HANDLE Tracker::hTrackMutex = 0;
@@ -156,7 +149,7 @@ QFrame *video_frame; //
video_frame = 0;
video_frame = mainApp->getVideoWidget();
- qDebug() << "Tracker::setup VideoFrame = " << video_frame;
+ qDebug() << "Tracker::Tracker VideoFrame = " << video_frame;
//
// Load the Tracker-engine DLL, get the tracker-class from it and do stuff...
@@ -166,6 +159,7 @@ QFrame *video_frame; if (!libName.isEmpty()) {
trackerLib = new QLibrary(libName);
getIT = (importGetTracker) trackerLib->resolve("GetTracker");
+ qDebug() << "Tracker::Tracker libName = " << libName;
if (getIT) {
ITracker *ptrXyz(getIT()); // Get the Class
@@ -225,28 +219,28 @@ QFrame *video_frame; }
}
-# ifdef USE_DEBUG_CLIENT
- debug_Client = QSharedPointer<ExcelServer>(new ExcelServer ( this )); // Create Excel protocol-server
-# endif
-
//
// Load the DLL with the filter-logic and retrieve a pointer to the Filter-class.
//
+ pFilter = NULL;
libName = mainApp->getCurrentFilterName();
- filterLib = new QLibrary(libName);
-
- getFilter = (importGetFilter) filterLib->resolve("GetFilter");
- if (getFilter) {
- IFilterPtr ptrXyz(getFilter());
- if (ptrXyz)
- {
- pFilter = ptrXyz;
- qDebug() << "Filter::setup Function Resolved!";
+
+ if ((!libName.isEmpty()) && (libName != "None")) {
+ filterLib = new QLibrary(libName);
+
+ getFilter = (importGetFilter) filterLib->resolve("GetFilter");
+ if (getFilter) {
+ IFilterPtr ptrXyz(getFilter());
+ if (ptrXyz)
+ {
+ pFilter = ptrXyz;
+ qDebug() << "Filter::setup Function Resolved!";
+ }
+ }
+ else {
+ QMessageBox::warning(0,"FaceTrackNoIR Error", "Filter-DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
+ return;
}
- }
- else {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "Filter-DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
- return;
}
// Load the settings from the INI-file
@@ -701,8 +695,10 @@ bool bTracker2Confid = false; // do the centering
target_camera = target_camera - offset_camera;
- if (Tracker::useFilter && pFilter) {
-// qDebug() << "Tracker::run() says target_camera.yaw = " << target_camera.yaw;
+ //
+ // Use advanced filtering, when a filter was selected.
+ //
+ if (pFilter) {
pFilter->FilterHeadPoseData(¤t_camera, &target_camera, &new_camera, Tracker::Pitch.newSample);
}
else {
@@ -711,7 +707,11 @@ bool bTracker2Confid = false; output_camera.x = X.invert * X.curvePtr->getValue(new_camera.x);
output_camera.y = Y.invert * Y.curvePtr->getValue(new_camera.y);
output_camera.z = Z.invert * Z.curvePtr->getValue(new_camera.z);
- bool altp = new_camera.pitch < 0;
+
+ //
+ // Determine, which curve (Up or Down) must be used for Pitch
+ //
+ bool altp = (new_camera.pitch < 0);
if (altp) {
output_camera.pitch = Pitch.invert * Pitch.curvePtrAlt->getValue(new_camera.pitch);
Pitch.curvePtr->setTrackingActive( false );
@@ -725,7 +725,6 @@ bool bTracker2Confid = false; output_camera.yaw = Yaw.invert * Yaw.curvePtr->getValue(new_camera.yaw);
output_camera.roll = Roll.invert * Roll.curvePtr->getValue(new_camera.roll);
-
X.curvePtr->setTrackingActive( true );
Y.curvePtr->setTrackingActive( true );
Z.curvePtr->setTrackingActive( true );
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h index fa5bf7ca..0ddd5df4 100644 --- a/FaceTrackNoIR/tracker.h +++ b/FaceTrackNoIR/tracker.h @@ -110,7 +110,6 @@ public: void initHeadPoseData(){
headPos = 0.0f;
-// offset_headPos = 0.0f;
invert = 0.0f;
red = 0.0f;
rawList.clear();
@@ -126,14 +125,12 @@ public: }
float headPos; // Current position (from faceTracker, radials or meters)
-// float offset_headPos; // Offset for centering
float invert; // Invert measured value (= 1.0f or -1.0f)
float red; // Reduction factor (used for EWMA-filtering, between 0.0f and 1.0f)
QList<float> rawList; // List of 'n' headPos values (used for moving average)
int maxItems; // Maximum number of elements in rawList
float prevPos; // Previous Position
float prevRawPos; // Previous Raw Position
-// QPainterPath curve; // Bezier curve to translate input -> output
FunctionConfig* curvePtr; // Function to translate input -> output
FunctionConfig* curvePtrAlt;
@@ -202,7 +199,6 @@ private: static HANDLE hTrackMutex; // Prevent reading/writing the headpose simultaneously
- static bool useFilter; // Use EWMA-filtering
static bool setZero; // Set to zero's, when OFF (one-shot)
static bool setEngineStop; // Stop tracker->engine, when OFF
@@ -250,7 +246,6 @@ public: static void setInvertY(bool invert) { Y.invert = invert?-1.0f:+1.0f; }
static void setInvertZ(bool invert) { Z.invert = invert?-1.0f:+1.0f; }
- static void setUseFilter(bool set) { useFilter = set; }
static void getHeadPose(THeadPoseData *data); // Return the current headpose data
static void getOutputHeadPose(THeadPoseData *data); // Return the current (processed) headpose data
static IFilterPtr getFilterPtr() { return pFilter; } // Return the pointer for the active Filter
@@ -270,7 +265,6 @@ public: static float getSmoothFromList ( QList<float> *rawList );
static float getDegreesFromRads ( float rads ) { return (rads * 57.295781f); }
static float getRadsFromDegrees ( float degrees ) { return (degrees * 0.017453f); }
-// static float getOutputFromCurve ( QPainterPath *curve, float input, float neutralzone, float maxinput );
// For now, use one slider for all
void setSmoothing(int x) {
|