From 9e403da98b9ca8f43f928b9f5c899aba7fa5471d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 28 Mar 2022 23:19:34 +0200 Subject: tracker/pt: add point filter deadzone --- tracker-pt/FTNoIR_PT_Controls.ui | 121 +++++++++++++++++++++++++------- tracker-pt/ftnoir_tracker_pt_dialog.cpp | 6 ++ tracker-pt/lang/nl_NL.ts | 4 ++ tracker-pt/lang/ru_RU.ts | 4 ++ tracker-pt/lang/stub.ts | 4 ++ tracker-pt/lang/zh_CN.ts | 4 ++ tracker-pt/point-filter.cpp | 6 +- tracker-pt/pt-settings.hpp | 1 + 8 files changed, 121 insertions(+), 29 deletions(-) diff --git a/tracker-pt/FTNoIR_PT_Controls.ui b/tracker-pt/FTNoIR_PT_Controls.ui index 5a9b1963..7abfe088 100644 --- a/tracker-pt/FTNoIR_PT_Controls.ui +++ b/tracker-pt/FTNoIR_PT_Controls.ui @@ -9,10 +9,16 @@ 0 0 - 387 - 658 + 413 + 683 + + + 0 + 0 + + PointTracker Settings @@ -647,26 +653,35 @@ Point filter - - + + - + 0 0 - - Filter point centers prior to pose estimation. + + 0 - - Enable + + 99 + + + 1 + + + 10 + + + Qt::Horizontal - - + + - + 0 0 @@ -684,14 +699,7 @@ QAbstractSpinBox::NoButtons - 999.990000000000009 - - - - - - - Limit + 1.000000000000000 @@ -699,7 +707,7 @@ - 0 + 10 0 @@ -720,8 +728,63 @@ - - + + + + + 0 + 0 + + + + Filter point centers prior to pose estimation. + + + Enable + + + + + + + Limit + + + + + + + + 2 + 0 + + + + Qt::NoFocus + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + QAbstractSpinBox::NoButtons + + + 999.990000000000009 + + + + + + + Deadzone + + + + + 0 @@ -732,21 +795,21 @@ 0 - 99 + 100 1 - 10 + 3 Qt::Horizontal - - + + 0 @@ -765,6 +828,9 @@ QAbstractSpinBox::NoButtons + + px + 1.000000000000000 @@ -1638,6 +1704,7 @@ Don't roll or change position. enable_point_filter point_filter_slider point_filter_limit_slider + point_filter_deadzone_slider model_tabs clip_tlength_spin clip_theight_spin diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.cpp b/tracker-pt/ftnoir_tracker_pt_dialog.cpp index 2bab280a..160eb831 100644 --- a/tracker-pt/ftnoir_tracker_pt_dialog.cpp +++ b/tracker-pt/ftnoir_tracker_pt_dialog.cpp @@ -126,6 +126,12 @@ TrackerDialog_PT::TrackerDialog_PT(const QString& module_name) : [this] { ui.point_filter_limit_label->setValue(*s.point_filter_limit); }, Qt::QueuedConnection); ui.point_filter_label->setValue(*s.point_filter_coefficient); ui.point_filter_limit_label->setValue(*s.point_filter_limit); + + tie_setting(s.point_filter_deadzone, ui.point_filter_deadzone_slider); + ui.point_filter_deadzone_label->setValue(*s.point_filter_deadzone); + + connect(&s.point_filter_deadzone, value_::value_changed(), ui.point_filter_deadzone_label, + [this] { ui.point_filter_deadzone_label->setValue(*s.point_filter_deadzone); }, Qt::QueuedConnection); } QString TrackerDialog_PT::threshold_display_text(int threshold_value) diff --git a/tracker-pt/lang/nl_NL.ts b/tracker-pt/lang/nl_NL.ts index 72cb5d6d..368b97a0 100644 --- a/tracker-pt/lang/nl_NL.ts +++ b/tracker-pt/lang/nl_NL.ts @@ -296,6 +296,10 @@ Don't roll or change position. Grayscale (from hardware) + + Deadzone + + pt_impl::TrackerDialog_PT diff --git a/tracker-pt/lang/ru_RU.ts b/tracker-pt/lang/ru_RU.ts index 469fabd1..43dca4cf 100644 --- a/tracker-pt/lang/ru_RU.ts +++ b/tracker-pt/lang/ru_RU.ts @@ -301,6 +301,10 @@ ROLL или X/Y-смещения. Grayscale (from hardware) + + Deadzone + + pt_impl::TrackerDialog_PT diff --git a/tracker-pt/lang/stub.ts b/tracker-pt/lang/stub.ts index e2781648..9cb5daa7 100644 --- a/tracker-pt/lang/stub.ts +++ b/tracker-pt/lang/stub.ts @@ -296,6 +296,10 @@ Don't roll or change position. Grayscale (from hardware) + + Deadzone + + pt_impl::TrackerDialog_PT diff --git a/tracker-pt/lang/zh_CN.ts b/tracker-pt/lang/zh_CN.ts index 8e04a130..668672c1 100644 --- a/tracker-pt/lang/zh_CN.ts +++ b/tracker-pt/lang/zh_CN.ts @@ -296,6 +296,10 @@ Don't roll or change position. Grayscale (from hardware) + + Deadzone + + pt_impl::TrackerDialog_PT diff --git a/tracker-pt/point-filter.cpp b/tracker-pt/point-filter.cpp index 7548d515..b03562ed 100644 --- a/tracker-pt/point-filter.cpp +++ b/tracker-pt/point-filter.cpp @@ -40,12 +40,14 @@ const PointOrder& point_filter::operator()(const PointOrder& input) return A * pow((f)10, (f)-log10_pos) * rest; ); - f dist = 0; + f dist = 0, dz = (float)s.point_filter_deadzone / 800; // sqrt(640^2 + 480^2) for (unsigned i = 0; i < 3; i++) { vec2 tmp = input[i] - state_[i]; - dist = std::max(dist, sqrt(tmp.dot(tmp))); + f x = sqrt(tmp.dot(tmp)); + x = std::max((f)0, x - dz); + dist = std::max(dist, x); } if (dist < (f)1e-6) diff --git a/tracker-pt/pt-settings.hpp b/tracker-pt/pt-settings.hpp index 54f13283..6f7a18d5 100644 --- a/tracker-pt/pt-settings.hpp +++ b/tracker-pt/pt-settings.hpp @@ -71,6 +71,7 @@ struct pt_settings final : options::opts value enable_point_filter{ b, "enable-point-filter", false }; value point_filter_coefficient { b, "point-filter-coefficient", { 1.0, 0, 4 } }; value point_filter_limit { b, "point-filter-limit", { 0.1, 0.01, 1 }}; + value point_filter_deadzone { b, "point-filter-deadzone", {0, 0, 1} }; explicit pt_settings(const QString& name) : opts(name) {} }; -- cgit v1.2.3