diff options
author | Wim Vriend <facetracknoir@gmail.com> | 2011-05-28 13:08:36 +0000 |
---|---|---|
committer | Wim Vriend <facetracknoir@gmail.com> | 2011-05-28 13:08:36 +0000 |
commit | 2852ec626fec6d4955a41202feec6be27e776e93 (patch) | |
tree | 6ec9fad989d838b19b44d326c597a0f07134cd7d /FTNoIR_Tracker_SM | |
parent | 8c8ddc7500db299c52ce8d818ab84ea65d64ddb6 (diff) |
Added filter setting faceAPI
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@84 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FTNoIR_Tracker_SM')
-rw-r--r-- | FTNoIR_Tracker_SM/FTNoIR_SM_Controls.ui | 12 | ||||
-rw-r--r-- | FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h | 12 | ||||
-rw-r--r-- | FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp | 42 |
3 files changed, 59 insertions, 7 deletions
diff --git a/FTNoIR_Tracker_SM/FTNoIR_SM_Controls.ui b/FTNoIR_Tracker_SM/FTNoIR_SM_Controls.ui index 5d1cc66b..2f699672 100644 --- a/FTNoIR_Tracker_SM/FTNoIR_SM_Controls.ui +++ b/FTNoIR_Tracker_SM/FTNoIR_SM_Controls.ui @@ -52,7 +52,7 @@ </property>
</spacer>
</item>
- <item row="2" column="1">
+ <item row="3" column="1">
<widget class="QPushButton" name="btnCameraSettings">
<property name="text">
<string>Camera</string>
@@ -80,6 +80,16 @@ </property>
</widget>
</item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Internal filtering:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QComboBox" name="cbxFilterSetting"/>
+ </item>
</layout>
</item>
<item>
diff --git a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h index 702f236e..4a26a824 100644 --- a/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h +++ b/FTNoIR_Tracker_SM/FTNoIR_Tracker_SM.h @@ -65,9 +65,11 @@ private: void save();
bool SMCreateMapping();
void doCommand( int command );
+ void doCommand( int command, int value );
/** helper **/
bool settingsDirty;
+ int prev_state; // Previous engine state
//
// global variables
@@ -82,7 +84,8 @@ private slots: void doOK();
void doCancel();
void settingChanged() { settingsDirty = true; };
- void showSettings();
+ void doTimUpdate();
+ void showSettings( int newState );
void doStartEngine(){
doCommand(FT_SM_START);
}
@@ -92,5 +95,12 @@ private slots: void doShowCam(){
doCommand(FT_SM_SHOW_CAM);
}
+ void doSetFilter(int value){
+ doCommand(FT_SM_SET_PAR_FILTER, value);
+ }
+
+signals:
+ void stateChanged(int newState);
+
};
diff --git a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp index 9834e78f..0998d90a 100644 --- a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp +++ b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp @@ -251,6 +251,11 @@ 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()));
+
+ ui.cbxFilterSetting->addItem("None");
+ ui.cbxFilterSetting->addItem("Normal");
+ ui.cbxFilterSetting->addItem("High");
+ connect(ui.cbxFilterSetting, SIGNAL(currentIndexChanged(int)), this, SLOT(doSetFilter( int )));
connect(ui.btnCameraSettings, SIGNAL(clicked()), this, SLOT(doShowCam()));
if (SMCreateMapping()) {
@@ -265,8 +270,9 @@ QWidget() //Setup the timer for showing the headpose.
timUpdateSettings = new QTimer(this);
- connect(timUpdateSettings, SIGNAL(timeout()), this, SLOT(showSettings()));
- timUpdateSettings->start(1000);
+ connect(timUpdateSettings, SIGNAL(timeout()), this, SLOT(doTimUpdate()));
+ timUpdateSettings->start(100);
+ connect(this, SIGNAL(stateChanged( int )), this, SLOT(showSettings( int )));
}
@@ -435,10 +441,22 @@ bool SMClientControls::SMCreateMapping() //
// Show the current engine-settings etc.
//
-void SMClientControls::showSettings()
+void SMClientControls::doTimUpdate()
+{
+ int state = pMemData->state;
+ if ( state != prev_state) {
+ emit stateChanged(state);
+ prev_state = state;
+ }
+}
+
+//
+// Show the current engine-settings etc.
+//
+void SMClientControls::showSettings( int newState )
{
qDebug() << "SMClientControls::showSettings says: Starting Function";
- switch (pMemData->state)
+ switch (newState)
{
case SM_API_ENGINE_STATE_TERMINATED:
ui._engine_state_label->setText("TERMINATED");
@@ -463,10 +481,11 @@ void SMClientControls::showSettings() break;
}
+ ui.cbxFilterSetting->setEnabled( (newState == SM_API_ENGINE_STATE_IDLE) );
}
//
-// Start the tracking Engine.
+// Send a command without parameter-value to the tracking Engine.
//
void SMClientControls::doCommand(int command)
{
@@ -477,6 +496,19 @@ void SMClientControls::doCommand(int command) return;
}
+//
+// Send a command with integer parameter-value to the tracking Engine.
+//
+void SMClientControls::doCommand(int command, int value)
+{
+ if ( (pMemData != NULL) && (WaitForSingleObject(hSMMutex, 100) == WAIT_OBJECT_0) ) {
+ pMemData->command = command; // Send command
+ pMemData->par_val_int = value;
+ ReleaseMutex(hSMMutex);
+ }
+ return;
+}
+
////////////////////////////////////////////////////////////////////////////////
// Factory function that creates instances if the Tracker-settings dialog object.
|