summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-03-28 23:19:34 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-04-19 14:52:14 +0200
commit9e403da98b9ca8f43f928b9f5c899aba7fa5471d (patch)
treef9a26c798e3c884c3543e2215bd741163b501dfe
parent8a3a1b9510d20dfb81c3c737779bb9de3c73f15a (diff)
tracker/pt: add point filter deadzone
-rw-r--r--tracker-pt/FTNoIR_PT_Controls.ui121
-rw-r--r--tracker-pt/ftnoir_tracker_pt_dialog.cpp6
-rw-r--r--tracker-pt/lang/nl_NL.ts4
-rw-r--r--tracker-pt/lang/ru_RU.ts4
-rw-r--r--tracker-pt/lang/stub.ts4
-rw-r--r--tracker-pt/lang/zh_CN.ts4
-rw-r--r--tracker-pt/point-filter.cpp6
-rw-r--r--tracker-pt/pt-settings.hpp1
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 @@
<rect>
<x>0</x>
<y>0</y>
- <width>387</width>
- <height>658</height>
+ <width>413</width>
+ <height>683</height>
</rect>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="windowTitle">
<string>PointTracker Settings</string>
</property>
@@ -647,26 +653,35 @@
<string>Point filter</string>
</property>
<layout class="QGridLayout" name="gridLayout_12">
- <item row="0" column="0">
- <widget class="QCheckBox" name="enable_point_filter">
+ <item row="1" column="1">
+ <widget class="QSlider" name="point_filter_limit_slider">
<property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="toolTip">
- <string>Filter point centers prior to pose estimation.</string>
+ <property name="minimum">
+ <number>0</number>
</property>
- <property name="text">
- <string>Enable</string>
+ <property name="maximum">
+ <number>99</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ <property name="pageStep">
+ <number>10</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
- <item row="0" column="2">
- <widget class="QDoubleSpinBox" name="point_filter_label">
+ <item row="1" column="2">
+ <widget class="QDoubleSpinBox" name="point_filter_limit_label">
<property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -684,14 +699,7 @@
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
- <double>999.990000000000009</double>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_15">
- <property name="text">
- <string>Limit</string>
+ <double>1.000000000000000</double>
</property>
</widget>
</item>
@@ -699,7 +707,7 @@
<widget class="QSlider" name="point_filter_slider">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
- <horstretch>0</horstretch>
+ <horstretch>10</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
@@ -720,8 +728,63 @@
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QSlider" name="point_filter_limit_slider">
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="enable_point_filter">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Filter point centers prior to pose estimation.</string>
+ </property>
+ <property name="text">
+ <string>Enable</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_15">
+ <property name="text">
+ <string>Limit</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QDoubleSpinBox" name="point_filter_label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>2</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="buttonSymbols">
+ <enum>QAbstractSpinBox::NoButtons</enum>
+ </property>
+ <property name="maximum">
+ <double>999.990000000000009</double>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_30">
+ <property name="text">
+ <string>Deadzone</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QSlider" name="point_filter_deadzone_slider">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
@@ -732,21 +795,21 @@
<number>0</number>
</property>
<property name="maximum">
- <number>99</number>
+ <number>100</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="pageStep">
- <number>10</number>
+ <number>3</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
- <item row="1" column="2">
- <widget class="QDoubleSpinBox" name="point_filter_limit_label">
+ <item row="2" column="2">
+ <widget class="QDoubleSpinBox" name="point_filter_deadzone_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
@@ -765,6 +828,9 @@
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
+ <property name="suffix">
+ <string> px</string>
+ </property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
@@ -1638,6 +1704,7 @@ Don't roll or change position.</string>
<tabstop>enable_point_filter</tabstop>
<tabstop>point_filter_slider</tabstop>
<tabstop>point_filter_limit_slider</tabstop>
+ <tabstop>point_filter_deadzone_slider</tabstop>
<tabstop>model_tabs</tabstop>
<tabstop>clip_tlength_spin</tabstop>
<tabstop>clip_theight_spin</tabstop>
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<slider_value>(), 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&apos;t roll or change position.</source>
<source>Grayscale (from hardware)</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Deadzone</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>pt_impl::TrackerDialog_PT</name>
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-смещения.</translation>
<source>Grayscale (from hardware)</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Deadzone</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>pt_impl::TrackerDialog_PT</name>
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&apos;t roll or change position.</source>
<source>Grayscale (from hardware)</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Deadzone</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>pt_impl::TrackerDialog_PT</name>
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&apos;t roll or change position.</source>
<source>Grayscale (from hardware)</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Deadzone</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>pt_impl::TrackerDialog_PT</name>
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<bool> enable_point_filter{ b, "enable-point-filter", false };
value<slider_value> point_filter_coefficient { b, "point-filter-coefficient", { 1.0, 0, 4 } };
value<slider_value> point_filter_limit { b, "point-filter-limit", { 0.1, 0.01, 1 }};
+ value<slider_value> point_filter_deadzone { b, "point-filter-deadzone", {0, 0, 1} };
explicit pt_settings(const QString& name) : opts(name) {}
};