diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-03-31 08:28:38 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-03-31 08:28:38 +0200 |
commit | 43c5c2e109868812f0d9365f08bc53acdb56d0d7 (patch) | |
tree | c61bbd92da08de57d6195c44e19d63aa92bb1b86 /ftnoir_filter_accela | |
parent | d7d37e480207bfa48da05172594f8a305345e4d4 (diff) |
accela: show exact parameter values in the ui
Diffstat (limited to 'ftnoir_filter_accela')
-rw-r--r-- | ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui | 154 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela.cpp | 27 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela.h | 3 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp | 21 |
4 files changed, 113 insertions, 92 deletions
diff --git a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui index 5638fefc..a10d2df4 100644 --- a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui +++ b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui @@ -9,15 +9,15 @@ <rect> <x>0</x> <y>0</y> - <width>479</width> - <height>255</height> + <width>501</width> + <height>302</height> </rect> </property> <property name="windowTitle"> <string>Accela filter settings</string> </property> <property name="windowIcon"> - <iconset resource="../ftnoir_filter_ewma2/ewma-filter.qrc"> + <iconset resource="../facetracknoir/ui-res.qrc"> <normaloff>:/images/filter-16.png</normaloff>:/images/filter-16.png</iconset> </property> <layout class="QVBoxLayout" name="verticalLayout"> @@ -30,91 +30,118 @@ <enum>QFrame::Raised</enum> </property> <layout class="QGridLayout" name="gridLayout_3"> - <item row="1" column="0"> - <widget class="QLabel" name="lblSensYaw_6"> + <item row="3" column="3"> + <widget class="QSlider" name="translation_slider"> + <property name="maximum"> + <number>99</number> + </property> + <property name="pageStep"> + <number>5</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksAbove</enum> + </property> + <property name="tickInterval"> + <number>25</number> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QSlider" name="rotation_slider"> + <property name="maximum"> + <number>99</number> + </property> + <property name="pageStep"> + <number>5</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksAbove</enum> + </property> + <property name="tickInterval"> + <number>25</number> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="styleSheet"> - <string notr="true">color:#0; -background:none;</string> - </property> <property name="text"> - <string>Rotation smoothing</string> + <string>Translation sensitivity</string> </property> </widget> </item> - <item row="3" column="1"> - <widget class="QComboBox" name="ewma"> - <item> - <property name="text"> - <string>None</string> - </property> - </item> - <item> - <property name="text"> - <string>Low</string> - </property> - </item> - <item> - <property name="text"> - <string>Normal</string> - </property> - </item> - <item> - <property name="text"> - <string>High</string> - </property> - </item> - <item> - <property name="text"> - <string>Extreme</string> - </property> - </item> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label"> + <item row="1" column="0"> + <widget class="QLabel" name="lblSensYaw_6"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> + <property name="styleSheet"> + <string notr="true">color:#0; +background:none;</string> + </property> <property name="text"> - <string>Translation smoothing</string> + <string>Rotation sensitivity</string> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QSlider" name="translation_slider"> - <property name="maximum"> - <number>99</number> + <item row="0" column="1"> + <widget class="QLabel" name="ewma_label"> + <property name="minimumSize"> + <size> + <width>32</width> + <height>0</height> + </size> </property> - <property name="pageStep"> - <number>5</number> + <property name="text"> + <string>0 ms</string> </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="rot_gain"> + <property name="text"> + <string>0°</string> </property> - <property name="tickPosition"> - <enum>QSlider::TicksAbove</enum> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Smoothing</string> </property> - <property name="tickInterval"> - <number>24</number> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLabel" name="trans_gain"> + <property name="text"> + <string>0mm</string> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QSlider" name="rotation_slider"> + <item row="0" column="3"> + <widget class="QSlider" name="ewma_slider"> <property name="maximum"> - <number>99</number> + <number>100</number> + </property> + <property name="singleStep"> + <number>10</number> </property> <property name="pageStep"> - <number>5</number> + <number>25</number> </property> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -123,14 +150,7 @@ background:none;</string> <enum>QSlider::TicksAbove</enum> </property> <property name="tickInterval"> - <number>24</number> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Spiking noise reduction</string> + <number>25</number> </property> </widget> </item> @@ -201,7 +221,7 @@ background:none;</string> <tabstop>buttonBox</tabstop> </tabstops> <resources> - <include location="../ftnoir_filter_ewma2/ewma-filter.qrc"/> + <include location="../facetracknoir/ui-res.qrc"/> </resources> <connections/> <slots> diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index 2fad523e..f6a2acea 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -42,36 +42,15 @@ void FTNoIR_Filter::filter(const double* input, double *output) const double rot_t = 7. * (1+s.rot_threshold) / 100.; const double trans_t = 5. * (1+s.trans_threshold) / 100.; - + const double dt = t.elapsed() * 1e-9; t.start(); - double RC; - - switch (s.ewma) - { - default: - case 0: // none - RC = 0; - break; - case 1: // low - RC = 0.06; - break; - case 2: // normal - RC = 0.11; - break; - case 3: // high - RC = 0.15; - break; - case 4: // extreme - RC = 0.20; - break; - } + const double RC = 2 * s.ewma / 1000.; // seconds + const double alpha = dt/(dt+RC); for (int i = 0; i < 6; i++) { - const double alpha = dt/(dt+RC); - smoothed_input[i] = smoothed_input[i] * (1.-alpha) + input[i] * alpha; const double in = smoothed_input[i]; diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index ec541088..98e5cf1f 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -55,6 +55,9 @@ private: private slots: void doOK(); void doCancel(); + void update_ewma_display(int value); + void update_rot_display(int value); + void update_trans_display(int value); }; class FTNoIR_FilterDll : public Metadata diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp index 4fbc482d..35c4b7fa 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp @@ -11,10 +11,14 @@ FilterControls::FilterControls() : ui.setupUi( this ); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); + + connect(ui.rotation_slider, SIGNAL(valueChanged(int)), this, SLOT(update_rot_display(int))); + connect(ui.translation_slider, SIGNAL(valueChanged(int)), this, SLOT(update_trans_display(int))); + connect(ui.ewma_slider, SIGNAL(valueChanged(int)), this, SLOT(update_ewma_display(int))); tie_setting(s.rot_threshold, ui.rotation_slider); tie_setting(s.trans_threshold, ui.translation_slider); - tie_setting(s.ewma, ui.ewma); + tie_setting(s.ewma, ui.ewma_slider); } void FilterControls::register_filter(IFilter* filter) @@ -46,6 +50,21 @@ void FilterControls::save() { s.b->save(); } +void FilterControls::update_rot_display(int value) +{ + ui.rot_gain->setText(QString::number(value * 7 / 100. + 1) + "°"); +} + +void FilterControls::update_trans_display(int value) +{ + ui.trans_gain->setText(QString::number(value * 5 / 100. + 1) + "mm"); +} + +void FilterControls::update_ewma_display(int value) +{ + ui.ewma_label->setText(QString::number(value * 2) + "ms"); +} + extern "C" OPENTRACK_EXPORT IFilterDialog* GetDialog() { return new FilterControls; |