diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-12-31 08:57:39 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-12-31 08:57:39 +0100 |
commit | faec4fed35fc7e30ba50143a4f7cdbbd68fb0508 (patch) | |
tree | 3aa3495628dd452a34e027b8e3525f23537dcbb7 /ftnoir_filter_ewma2/ftnoir_filter_ewma2.h | |
parent | f32f731518ffe2a2b3f7463eda6cf01b7e09eab3 (diff) |
ewma use settings framework
Diffstat (limited to 'ftnoir_filter_ewma2/ftnoir_filter_ewma2.h')
-rw-r--r-- | ftnoir_filter_ewma2/ftnoir_filter_ewma2.h | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h index 7c98b2cb..6e9a7f9a 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h @@ -31,35 +31,35 @@ #include "ui_ftnoir_ewma_filtercontrols.h"
#include <QWidget>
#include <QMutex>
+#include "facetracknoir/options.hpp"
+using namespace options;
+
+struct settings {
+ pbundle b;
+ value<int> kMinSmoothing, kMaxSmoothing, kSmoothingScaleCurve;
+ settings() :
+ b(bundle("ewma-filter")),
+ kMinSmoothing(b, "min-smoothing", 15),
+ kMaxSmoothing(b, "max-smoothing", 50),
+ kSmoothingScaleCurve(b, "smoothing-scale-curve", 10)
+ {}
+};
+
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//
-// EWMA Filter: Exponentially Weighted Moving Average filter with dynamic smoothing parameter
-//
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class FTNoIR_Filter : public IFilter
{
public:
FTNoIR_Filter();
void reset() {}
-
void FilterHeadPoseData(const double *target_camera_position,
double *new_camera_position);
- void receiveSettings(double smin, double smax, double sexpt);
-
+ void receiveSettings();
private:
- void loadSettings(); // Load the settings from the INI-file
- double newHeadPose; // Structure with new headpose
-
bool first_run;
double alpha_smoothing;
double alpha[6];
-
- double kMinSmoothing;
- double kMaxSmoothing;
- double kSmoothingScaleCurve;
double current_camera_position[6];
- QMutex mutex;
+ settings s;
};
//*******************************************************************************************************
@@ -71,26 +71,19 @@ class FilterControls: public QWidget, public IFilterDialog {
Q_OBJECT
public:
- explicit FilterControls();
- void showEvent (QShowEvent *);
+ FilterControls();
void registerFilter(IFilter* flt);
void unregisterFilter();
private:
Ui::UICFilterControls ui;
- void loadSettings();
void save();
-
- /** helper **/
- bool settingsDirty;
-
+ settings s;
FTNoIR_Filter* pFilter;
private slots:
void doOK();
void doCancel();
- void settingChanged() { settingsDirty = true; }
- void settingChanged( int ) { settingsDirty = true; }
};
//*******************************************************************************************************
@@ -99,8 +92,6 @@ private slots: class FTNoIR_FilterDll : public Metadata
{
public:
- FTNoIR_FilterDll();
- ~FTNoIR_FilterDll();
void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("EWMA Filter Mk2"); }
void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("EWMA"); }
void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Exponentially Weighted Moving Average filter with dynamic smoothing parameter"); }
|