From d6086d8203ae4f4b45f3d97960788d603fc78e16 Mon Sep 17 00:00:00 2001 From: Wim Vriend Date: Mon, 9 Jan 2012 17:01:44 +0000 Subject: Implemented filter-settings changeably while Tracker is active. Should also be handy to have a IFilterPtr, for logging... git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@99 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb --- FaceTrackNoIR/FaceApp.h | 1 + FaceTrackNoIR/FaceTrackNoIR.cpp | 29 +- FaceTrackNoIR/FaceTrackNoIR.h | 5 - FaceTrackNoIR/FaceTrackNoIR.ui | 1329 ++++++++++++++------------------------- FaceTrackNoIR/tracker.cpp | 32 +- FaceTrackNoIR/tracker.h | 13 +- 6 files changed, 462 insertions(+), 947 deletions(-) (limited to 'FaceTrackNoIR') diff --git a/FaceTrackNoIR/FaceApp.h b/FaceTrackNoIR/FaceApp.h index 75eb6df2..39fd4b2f 100644 --- a/FaceTrackNoIR/FaceApp.h +++ b/FaceTrackNoIR/FaceApp.h @@ -21,6 +21,7 @@ private: int msgID_FTClient; int msgID_FTIR_Register; int msgID_FTIR_UnRegister; + int msgID_FilterSettingChanged; }; #endif // FACEAPP_H diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp index 58c60362..73d201c3 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.cpp +++ b/FaceTrackNoIR/FaceTrackNoIR.cpp @@ -133,11 +133,6 @@ void FaceTrackNoIR::setupFaceTrackNoIR() { connect(ui.chkUseEWMA, SIGNAL(stateChanged(int)), this, SLOT(setUseFilter(int))); - // Connect sliders for reduction factor - connect(ui.minSmooth, SIGNAL(valueChanged(int)), this, SLOT(setMinSmooth(int))); - connect(ui.maxSmooth, SIGNAL(valueChanged(int)), this, SLOT(setMaxSmooth(int))); - connect(ui.powCurve, SIGNAL(valueChanged(int)), this, SLOT(setPowCurve(int))); - // Connect slider for smoothing connect(ui.slideSmoothing, SIGNAL(valueChanged(int)), this, SLOT(setSmoothing(int))); @@ -528,10 +523,6 @@ void FaceTrackNoIR::startTracker( ) { tracker->setInvertY (ui.chkInvertY->isChecked() ); tracker->setInvertZ (ui.chkInvertZ->isChecked() ); - tracker->setMinSmooth (ui.minSmooth->value() ); - tracker->setPowCurve (ui.powCurve->value() ); - tracker->setMaxSmooth (ui.maxSmooth->value() ); - tracker->start( QThread::TimeCriticalPriority ); ui.headPoseWidget->show(); @@ -745,24 +736,6 @@ THeadPoseData newdata; } } -/** set the redhold from the slider **/ -void FaceTrackNoIR::setMinSmooth( int redh ) { - Tracker::setMinSmooth ( redh ); - settingsDirty = true; -} - -/** set the redhold from the slider **/ -void FaceTrackNoIR::setPowCurve( int redh ) { - Tracker::setPowCurve ( redh ); - settingsDirty = true; -} - -/** set the redhold from the slider **/ -void FaceTrackNoIR::setMaxSmooth( int redh ) { - Tracker::setMaxSmooth ( redh ); - settingsDirty = true; -} - /** set the smoothing from the slider **/ void FaceTrackNoIR::setSmoothing( int smooth ) { @@ -959,7 +932,7 @@ QLibrary *filterLib; if (ptrXyz) { pFilterDialog = ptrXyz; - pFilterDialog->Initialize( this ); + pFilterDialog->Initialize( this, Tracker::getFilterPtr() ); qDebug() << "FaceTrackNoIR::showFilterControls GetFilterDialog Function Resolved!"; } else { diff --git a/FaceTrackNoIR/FaceTrackNoIR.h b/FaceTrackNoIR/FaceTrackNoIR.h index c17d21d7..93403be7 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.h +++ b/FaceTrackNoIR/FaceTrackNoIR.h @@ -162,11 +162,6 @@ private: void setUseFilter( int set ); void showHeadPose(); - // EWMA filter sliders - void setMinSmooth( int redh ); - void setMaxSmooth( int redh ); - void setPowCurve( int redh ); - //smoothing slider void setSmoothing( int smooth ); diff --git a/FaceTrackNoIR/FaceTrackNoIR.ui b/FaceTrackNoIR/FaceTrackNoIR.ui index 7cb74b0a..7fa1f42c 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.ui +++ b/FaceTrackNoIR/FaceTrackNoIR.ui @@ -11,7 +11,7 @@ 0 0 925 - 528 + 428 @@ -1073,6 +1073,18 @@ color: rgb(0, 255, 0); + + + 206 + 120 + + + + + 210 + 120 + + Profile @@ -1160,793 +1172,429 @@ color: rgb(0, 255, 0); - - - - - - - 620 - 115 - - - - - 667 - 115 - - - - true - - - background: url("UIElements/bubble_2_big.png") no-repeat; -opacity:100; - - - - - - - - - 25 - 0 - - - - - 150 - 16777215 - - - - color:#ccc; -background:none; - - - Global settings - - - - - - - - 95 - 0 - - - - - 150 - 16777215 - - - - color:#ccc; -background:none; - - - Use EWMA filtering: - - - - - - - background:none; - - - - - - - - - - - 25 - 0 - - - - - 150 - 16777215 - - - - color:#ccc; -background:none; - - - Smoothing: - - - - - - - - 50 - 15 - - - - 1 - - - 50 - - - 5 - - - 10 - - - Qt::Horizontal - - - QSlider::NoTicks - - - - - - - - 35 - 22 - - - - background:none; - - - 1 - - - 50 - - - 10 - - - - - - - color:#ccc; -background:none; - - - (samples) - - - - - - - - - false - - - - - - QFrame::Sunken - - - Qt::Vertical + + + + + 206 + 120 + + + + + 16777215 + 120 + + + + Global Settings + + + + + 9 + 20 + 171 + 80 + - - - - - - - - Qt::RightToLeft - - - color:#ccc; -background:none; - - - EWMA - - - - - - - - 45 - 15 - - - - 1 - - - 100 - - - 10 - - - 2 - - - Qt::Horizontal - - - QSlider::NoTicks - - - - - - - - 45 - 15 - - - - 1 - - - 100 - - - 10 - - - 10 - - - Qt::Horizontal - - - QSlider::NoTicks - - - - - - - - 45 - 15 - - - - 1 - - - 100 - - - 10 - - - 10 - - - Qt::Horizontal - - - QSlider::NoTicks - - - - - - - - 40 - 22 - - - - background:none; - - - 1 - - - 100 - - - 5 - - - 2 - - - - - - - - 40 - 22 - - - - background:none; - - - 1 - - - 100 - - - 5 - - - 10 - - - - - - - - 40 - 22 - - - - background:none; - - - 100 - - - 5 - - - 10 - - - - - - - - 35 - 0 - - - - - 30 - 16777215 - - - - color:#ccc; -background:none; - - - frames - - - - - - - - 35 - 0 - - - - - 30 - 16777215 - - - - color:#ccc; -background:none; - - - frames - - - - - - - - 0 - 0 - - - - - 30 - 16777215 - - - - color:#ccc; -background:none; - - - pow - - - - - - - - 0 - 0 - - - - - 30 - 16777215 - - - - color:#ccc; + + + + + + 95 + 0 + + + + + 150 + 16777215 + + + + color:#ccc; background:none; - - - Min. - - - - - - - - 0 - 0 - - - - - 30 - 16777215 - - - - color:#ccc; + + + Use advanced filtering: + + + + + + + background:none; + + + + + + + + + + + 25 + 0 + + + + + 150 + 16777215 + + + + color:#ccc; background:none; - - - Max. - - - - - - - - 0 - 0 - - - - - 30 - 16777215 - - - - color:#ccc; + + + Smoothing: + + + + + + + color:#ccc; background:none; - - - Curve - - - - - - - - - Qt::Vertical - + + + (samples) + + + + + + + + 50 + 15 + + + + 1 + + + 50 + + + 5 + + + 10 + + + Qt::Horizontal + + + QSlider::NoTicks + + + + + + + + 35 + 22 + + + + background:none; + + + 1 + + + 50 + + + 10 + + + + - - - - - - - background:none; - - - - - - - - - - - 0 - 0 - - - - - 30 - 16777215 - - - - color:#ccc; + + + + 200 + 20 + 211 + 81 + + + + + + + + 25 + 0 + + + + + 150 + 16777215 + + + + Qt::RightToLeft + + + color:#ccc; background:none; - - - Invert - - - - - - - background:none; - - - - - - - - - - background:none; - - - - - - - - - - - 25 - 0 - - - - - 150 - 16777215 - - - - Qt::RightToLeft - - - color:#ccc; + + + Roll + + + + + + + background:none; + + + + + + + + + + + 25 + 0 + + + + + 150 + 16777215 + + + + Qt::RightToLeft + + + color:#ccc; background:none; - - - X - - - - - - - - 25 - 0 - - - - - 150 - 16777215 - - - - Qt::RightToLeft - - - color:#ccc; + + + Z + + + + + + + background:none; + + + + + + + + + + + 25 + 0 + + + + + 150 + 16777215 + + + + Qt::RightToLeft + + + color:#ccc; background:none; - - - Y - - - - - - - - 25 - 0 - - - - - 150 - 16777215 - - - - Qt::RightToLeft - - - color:#ccc; + + + Pitch + + + + + + + background:none; + + + + + + + + + + + 25 + 0 + + + + + 150 + 16777215 + + + + Qt::RightToLeft + + + color:#ccc; background:none; - - - Z - - - - - - - - 25 - 0 - - - - - 150 - 16777215 - - - - Qt::RightToLeft - - - color:#ccc; + + + Y + + + + + + + background:none; + + + + + + + + + + + 25 + 0 + + + + + 150 + 16777215 + + + + Qt::RightToLeft + + + color:#ccc; background:none; - - - Yaw - - - - - - - - 25 - 0 - - - - - 150 - 16777215 - - - - Qt::RightToLeft - - - color:#ccc; + + + Yaw + + + + + + + background:none; + + + + + + + + + + + 25 + 0 + + + + + 150 + 16777215 + + + + Qt::RightToLeft + + + color:#ccc; background:none; - - - Pitch - - - - - - - - 25 - 0 - - - - - 150 - 16777215 - - - - Qt::RightToLeft - - - color:#ccc; + + + X + + + + + + + background:none; + + + + + + + + + + + 0 + 0 + + + + + 30 + 16777215 + + + + color:#ccc; background:none; - - - Roll - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 20 - 20 - - - - - - - - background:none; - - - - - - - - - - background:none; - - - - - - - - - - background:none; - - - - - - - - - - - 0 - 0 - - - - - 30 - 16777215 - - - - color:#ccc; + + + Invert + + + + + + + + 0 + 0 + + + + + 30 + 16777215 + + + + color:#ccc; background:none; - - - Invert - - - - - - - + + + Invert + + + + + + + + @@ -2110,6 +1758,12 @@ background:none; 120 + + + 16777215 + 120 + + @@ -2205,7 +1859,13 @@ background:none; 190 - 100 + 120 + + + + + 16777215 + 120 @@ -2262,7 +1922,13 @@ background:none; 190 - 100 + 120 + + + + + 16777215 + 120 @@ -2316,6 +1982,19 @@ background:none; + + + + Qt::Vertical + + + + 20 + 30 + + + + @@ -2580,101 +2259,5 @@ background:none; - - minSmooth - valueChanged(int) - spinMinSmooth - setValue(int) - - - 643 - 333 - - - 691 - 335 - - - - - spinMinSmooth - valueChanged(int) - minSmooth - setValue(int) - - - 691 - 335 - - - 643 - 333 - - - - - maxSmooth - valueChanged(int) - spinMaxSmooth - setValue(int) - - - 643 - 360 - - - 691 - 362 - - - - - spinMaxSmooth - valueChanged(int) - maxSmooth - setValue(int) - - - 691 - 362 - - - 643 - 360 - - - - - powCurve - valueChanged(int) - spinPowCurve - setValue(int) - - - 643 - 387 - - - 691 - 389 - - - - - spinPowCurve - valueChanged(int) - powCurve - setValue(int) - - - 691 - 389 - - - 643 - 387 - - - diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp index 59f6680b..70754a1c 100644 --- a/FaceTrackNoIR/tracker.cpp +++ b/FaceTrackNoIR/tracker.cpp @@ -507,7 +507,7 @@ T6DOF gameoutput_camera(0,0,0,0,0,0); // // Reset the 'wait' flag. Moving above 90 with the key pressed, will (de-)activate Axis Reverse. // - qDebug() << "Tracker::run() says actualZ = " << actualZ << ", terwijl Z_Pos4 = " << Z_Pos4ReverseAxis; +// qDebug() << "Tracker::run() says actualZ = " << actualZ << ", terwijl Z_Pos4 = " << Z_Pos4ReverseAxis; if (useAxisReverse) { Tracker::do_axis_reverse = ((fabs(actualYaw) > YawAngle4ReverseAxis) && (actualZ < Z_Pos4ReverseAxis)); } @@ -743,36 +743,6 @@ void Tracker::addRaw2List ( QList *rawList, float maxIndex, float raw ) { rawList->prepend ( raw ); } -// -// Set the filter-value from the GUI. -// -void Tracker::setMinSmooth ( int x ) { - if (Tracker::pFilter) { - Tracker::pFilter->setParameterValue(0, x); - qDebug() << "Tracker::setMinSmooth Min Smooting frames set to: " << x; - } -} - -// -// Set the filter-value from the GUI. -// -void Tracker::setMaxSmooth ( int x ) { - if (Tracker::pFilter) { - Tracker::pFilter->setParameterValue(1, x); - qDebug() << "Tracker::setMaxSmooth Max Smooting frames set to: " << x; - } -} - -// -// Set the filter-value from the GUI. -// -void Tracker::setPowCurve( int x ) { - if (Tracker::pFilter) { - Tracker::pFilter->setParameterValue(2, x); - qDebug() << "Tracker::setPowCurve Pow Curve set to: " << x; - } -} - // // Get the raw headpose, so it can be displayed. // diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h index dd8a961b..b9a39eba 100644 --- a/FaceTrackNoIR/tracker.h +++ b/FaceTrackNoIR/tracker.h @@ -41,7 +41,7 @@ #include "..\ftnoir_tracker_base\FTNoIR_Tracker_base.h" #include "..\ftnoir_protocol_base\FTNoIR_Protocol_base.h" #include "..\ftnoir_filter_base\FTNoIR_Filter_base.h" -#include "AutoClosePtr.h" +//#include "AutoClosePtr.h" // 1a. COM-Like usage with smart pointer. // No need to call `ITracker::Release'; the instance will @@ -50,8 +50,7 @@ typedef AutoClosePtr ITrackerPtr; typedef ITracker *(WINAPI *importGetTracker)(void); typedef AutoClosePtr IProtocolPtr; typedef IProtocol *(WINAPI *importGetProtocol)(void); -typedef AutoClosePtr IFilterPtr; -typedef IFilter *(WINAPI *importGetFilter)(void); + // include the DirectX Library files #pragma comment (lib, "dinput8.lib") @@ -162,9 +161,6 @@ private: static void addHeadPose( THeadPoseData head_pose ); static void addRaw2List ( QList *rawList, float maxIndex, float raw ); -// static float lowPassFilter ( float newvalue, float *oldvalue, float dt, float coeff); -// static float rateLimiter ( float newvalue, float *oldvalue, float dt, float max_rate); -// static float getCorrectedNewRaw ( float NewRaw, float rotNeutral ); /** static member variables for saving the head pose **/ static THeadPoseDOF Pitch; // Head-rotation X-direction (Up/Down) @@ -232,12 +228,9 @@ public: static void setInvertZ(bool invert) { Z.invert = invert?-1.0f:+1.0f; } static void setUseFilter(bool set) { useFilter = set; } - static void setMinSmooth(int x); - static void setMaxSmooth(int x); - static void setPowCurve(int x); - 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; } static float getSmoothFromList ( QList *rawList ); static float getDegreesFromRads ( float rads ) { return (rads * 57.295781f); } -- cgit v1.2.3