summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStéphane Lenclud <github@lenclud.com>2019-04-20 18:59:59 +0200
committerStéphane Lenclud <github@lenclud.com>2019-04-20 18:59:59 +0200
commit72a0be25fa559f4cb8b2826f06837061f3b7b5a8 (patch)
tree62e0d23035e152cc719bde28d6bdd1ced16b13ba
parentabcbf64cf1d2ee09f27d82f38bfb632e2d2268b9 (diff)
Easy Tracker: Deadzone implementation to minimize noise.
Added Deadzone pixels size to settings. Clip and Custom model settings tabs disabled.
-rw-r--r--tracker-easy/lang/nl_NL.ts16
-rw-r--r--tracker-easy/lang/ru_RU.ts16
-rw-r--r--tracker-easy/lang/stub.ts16
-rw-r--r--tracker-easy/lang/zh_CN.ts16
-rw-r--r--tracker-easy/settings.h1
-rw-r--r--tracker-easy/tracker-easy-dialog.cpp1
-rw-r--r--tracker-easy/tracker-easy-settings.ui161
-rw-r--r--tracker-easy/tracker-easy.cpp115
-rw-r--r--tracker-easy/tracker-easy.h10
9 files changed, 243 insertions, 109 deletions
diff --git a/tracker-easy/lang/nl_NL.ts b/tracker-easy/lang/nl_NL.ts
index 1054e1f7..f83e859a 100644
--- a/tracker-easy/lang/nl_NL.ts
+++ b/tracker-easy/lang/nl_NL.ts
@@ -243,10 +243,6 @@ Don&apos;t roll or change position.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;FTNoIR PointTracker Plugin&lt;br/&gt;Version 1.1&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;by Patrick Ruoff&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://ftnoirpt.sourceforge.net/&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#0000ff;&quot;&gt;Manual (external)&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>Status</source>
<translation type="unfinished"></translation>
</message>
@@ -266,5 +262,17 @@ Don&apos;t roll or change position.</source>
<source>Debug (full size preview)</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Deadzone</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Easy Tracker&lt;br/&gt;Version 0.1&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;by Stéphane Lenclud&lt;/span&gt;&lt;/p&gt;&lt;p&gt;See &lt;a href=&quot;https://github.com/opentrack/opentrack/wiki/Easy-Tracker&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#9999AA;&quot;&gt;documentation on GitHub&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Size in pixels of half the edge defining deadzone squares around tracked points</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
</TS>
diff --git a/tracker-easy/lang/ru_RU.ts b/tracker-easy/lang/ru_RU.ts
index 66245b14..0dbc8323 100644
--- a/tracker-easy/lang/ru_RU.ts
+++ b/tracker-easy/lang/ru_RU.ts
@@ -248,10 +248,6 @@ ROLL или X/Y-смещения.</translation>
<translation>О программе</translation>
</message>
<message>
- <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;FTNoIR PointTracker Plugin&lt;br/&gt;Version 1.1&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;by Patrick Ruoff&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://ftnoirpt.sourceforge.net/&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#0000ff;&quot;&gt;Manual (external)&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
- <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;FTNoIR PointTracker Plugin&lt;br/&gt;Version 1.1&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;by Patrick Ruoff&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://ftnoirpt.sourceforge.net/&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#0000ff;&quot;&gt;Руководство (PointTracker)&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
- </message>
- <message>
<source>Status</source>
<translation>Статус</translation>
</message>
@@ -271,5 +267,17 @@ ROLL или X/Y-смещения.</translation>
<source>Debug (full size preview)</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Deadzone</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Easy Tracker&lt;br/&gt;Version 0.1&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;by Stéphane Lenclud&lt;/span&gt;&lt;/p&gt;&lt;p&gt;See &lt;a href=&quot;https://github.com/opentrack/opentrack/wiki/Easy-Tracker&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#9999AA;&quot;&gt;documentation on GitHub&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Size in pixels of half the edge defining deadzone squares around tracked points</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
</TS>
diff --git a/tracker-easy/lang/stub.ts b/tracker-easy/lang/stub.ts
index eca29787..32b314e9 100644
--- a/tracker-easy/lang/stub.ts
+++ b/tracker-easy/lang/stub.ts
@@ -243,10 +243,6 @@ Don&apos;t roll or change position.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;FTNoIR PointTracker Plugin&lt;br/&gt;Version 1.1&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;by Patrick Ruoff&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://ftnoirpt.sourceforge.net/&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#0000ff;&quot;&gt;Manual (external)&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>Status</source>
<translation type="unfinished"></translation>
</message>
@@ -266,5 +262,17 @@ Don&apos;t roll or change position.</source>
<source>Debug (full size preview)</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Deadzone</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Easy Tracker&lt;br/&gt;Version 0.1&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;by Stéphane Lenclud&lt;/span&gt;&lt;/p&gt;&lt;p&gt;See &lt;a href=&quot;https://github.com/opentrack/opentrack/wiki/Easy-Tracker&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#9999AA;&quot;&gt;documentation on GitHub&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Size in pixels of half the edge defining deadzone squares around tracked points</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
</TS>
diff --git a/tracker-easy/lang/zh_CN.ts b/tracker-easy/lang/zh_CN.ts
index 656cb8db..f90e261f 100644
--- a/tracker-easy/lang/zh_CN.ts
+++ b/tracker-easy/lang/zh_CN.ts
@@ -214,10 +214,6 @@
<translation>关于</translation>
</message>
<message>
- <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;FTNoIR PointTracker Plugin&lt;br/&gt;Version 1.1&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;by Patrick Ruoff&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://ftnoirpt.sourceforge.net/&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#0000ff;&quot;&gt;Manual (external)&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
- <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;FTNoIR PointTracker Plugin&lt;br/&gt;Version 1.1&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Patrick Ruoff&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://ftnoirpt.sourceforge.net/&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#0000ff;&quot;&gt;参考手册 (外部链接)&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
- </message>
- <message>
<source>Status</source>
<translation>状态</translation>
</message>
@@ -266,5 +262,17 @@ Don&apos;t roll or change position.</source>
<source>Debug (full size preview)</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Deadzone</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Easy Tracker&lt;br/&gt;Version 0.1&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;by Stéphane Lenclud&lt;/span&gt;&lt;/p&gt;&lt;p&gt;See &lt;a href=&quot;https://github.com/opentrack/opentrack/wiki/Easy-Tracker&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#9999AA;&quot;&gt;documentation on GitHub&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Size in pixels of half the edge defining deadzone squares around tracked points</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
</TS>
diff --git a/tracker-easy/settings.h b/tracker-easy/settings.h
index dcfb6be0..53b80052 100644
--- a/tracker-easy/settings.h
+++ b/tracker-easy/settings.h
@@ -34,6 +34,7 @@ namespace EasyTracker {
cam_fps{ b, "camera-fps", 30 };
value<double> min_point_size{ b, "min-point-size", 2.5 },
max_point_size{ b, "max-point-size", 50 };
+ value<int> DeadzoneRectHalfEdgeSize { b, "deadzone-rect-half-edge-size", 1 };
value<int> m01_x{ b, "m_01-x", 0 }, m01_y{ b, "m_01-y", 0 }, m01_z{ b, "m_01-z", 0 };
value<int> m02_x{ b, "m_02-x", 0 }, m02_y{ b, "m_02-y", 0 }, m02_z{ b, "m_02-z", 0 };
diff --git a/tracker-easy/tracker-easy-dialog.cpp b/tracker-easy/tracker-easy-dialog.cpp
index f56ddfdb..e3b72e38 100644
--- a/tracker-easy/tracker-easy-dialog.cpp
+++ b/tracker-easy/tracker-easy-dialog.cpp
@@ -45,6 +45,7 @@ namespace EasyTracker
tie_setting(s.min_point_size, ui.mindiam_spin);
tie_setting(s.max_point_size, ui.maxdiam_spin);
+ tie_setting(s.DeadzoneRectHalfEdgeSize, ui.spinDeadzone);
tie_setting(s.clip_by, ui.clip_bheight_spin);
tie_setting(s.clip_bz, ui.clip_blength_spin);
diff --git a/tracker-easy/tracker-easy-settings.ui b/tracker-easy/tracker-easy-settings.ui
index 4430020d..ffe6ebce 100644
--- a/tracker-easy/tracker-easy-settings.ui
+++ b/tracker-easy/tracker-easy-settings.ui
@@ -418,23 +418,27 @@
<string>Point extraction</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
- <item row="1" column="0">
- <widget class="QLabel" name="label">
+ <item row="3" column="1">
+ <widget class="QLabel" name="threshold_value_display">
<property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
- <string>Threshold</string>
- </property>
- <property name="buddy">
- <cstring>threshold_slider</cstring>
+ <string/>
</property>
</widget>
</item>
<item row="3" column="0">
+ <widget class="QLabel" name="label_14">
+ <property name="text">
+ <string>Value</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
@@ -450,8 +454,8 @@
</property>
</widget>
</item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_8">
+ <item row="1" column="1" colspan="2">
+ <widget class="QCheckBox" name="auto_threshold">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
@@ -459,14 +463,49 @@
</sizepolicy>
</property>
<property name="text">
- <string>Max size</string>
+ <string>Enable, slider sets point size</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Threshold</string>
</property>
<property name="buddy">
- <cstring>maxdiam_spin</cstring>
+ <cstring>threshold_slider</cstring>
</property>
</widget>
</item>
- <item row="1" column="1" colspan="2">
+ <item row="4" column="1">
+ <widget class="QDoubleSpinBox" name="mindiam_spin">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Minimum point diameter</string>
+ </property>
+ <property name="suffix">
+ <string> px</string>
+ </property>
+ <property name="decimals">
+ <number>1</number>
+ </property>
+ <property name="singleStep">
+ <double>0.100000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
<widget class="QSlider" name="threshold_slider">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
@@ -497,21 +536,30 @@
</property>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QCheckBox" name="auto_threshold">
+ <item row="5" column="1">
+ <widget class="QDoubleSpinBox" name="maxdiam_spin">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="text">
- <string>Enable, slider sets point size</string>
+ <property name="toolTip">
+ <string>Maximum point diameter</string>
+ </property>
+ <property name="suffix">
+ <string> px</string>
+ </property>
+ <property name="decimals">
+ <number>1</number>
+ </property>
+ <property name="singleStep">
+ <double>0.100000000000000</double>
</property>
</widget>
</item>
- <item row="0" column="0">
- <widget class="QLabel" name="label_11">
+ <item row="5" column="0">
+ <widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
@@ -519,71 +567,55 @@
</sizepolicy>
</property>
<property name="text">
- <string>Automatic threshold</string>
+ <string>Max size</string>
+ </property>
+ <property name="buddy">
+ <cstring>maxdiam_spin</cstring>
</property>
</widget>
</item>
- <item row="4" column="1">
- <widget class="QDoubleSpinBox" name="maxdiam_spin">
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="toolTip">
- <string>Maximum point diameter</string>
- </property>
- <property name="suffix">
- <string> px</string>
- </property>
- <property name="decimals">
- <number>1</number>
- </property>
- <property name="singleStep">
- <double>0.100000000000000</double>
+ <property name="text">
+ <string>Automatic threshold</string>
</property>
</widget>
</item>
- <item row="3" column="1">
- <widget class="QDoubleSpinBox" name="mindiam_spin">
+ <item row="6" column="0">
+ <widget class="QLabel" name="labelDeadzone">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="toolTip">
- <string>Minimum point diameter</string>
- </property>
- <property name="suffix">
- <string> px</string>
- </property>
- <property name="decimals">
- <number>1</number>
+ <property name="text">
+ <string>Deadzone</string>
</property>
- <property name="singleStep">
- <double>0.100000000000000</double>
+ <property name="buddy">
+ <cstring>maxdiam_spin</cstring>
</property>
</widget>
</item>
- <item row="2" column="1">
- <widget class="QLabel" name="threshold_value_display">
+ <item row="6" column="1">
+ <widget class="QSpinBox" name="spinDeadzone">
<property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="text">
- <string/>
+ <property name="toolTip">
+ <string>Size in pixels of half the edge defining deadzone squares around tracked points</string>
</property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_14">
- <property name="text">
- <string>Value</string>
+ <property name="suffix">
+ <string> px</string>
</property>
</widget>
</item>
@@ -599,6 +631,9 @@
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QTabWidget" name="model_tabs">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
@@ -609,7 +644,7 @@
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
- <number>0</number>
+ <number>2</number>
</property>
<property name="usesScrollButtons">
<bool>false</bool>
@@ -620,7 +655,10 @@
<property name="tabsClosable">
<bool>false</bool>
</property>
- <widget class="QWidget" name="tab_5">
+ <widget class="QWidget" name="tabClip">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<attribute name="title">
<string>Clip</string>
</attribute>
@@ -780,7 +818,7 @@
</item>
</layout>
</widget>
- <widget class="QWidget" name="tab_6">
+ <widget class="QWidget" name="tabCap">
<attribute name="title">
<string>Cap</string>
</attribute>
@@ -915,7 +953,10 @@
</item>
</layout>
</widget>
- <widget class="QWidget" name="tab_7">
+ <widget class="QWidget" name="tabCustom">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<attribute name="title">
<string>Custom</string>
</attribute>
@@ -1301,7 +1342,7 @@ Don't roll or change position.</string>
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;FTNoIR PointTracker Plugin&lt;br/&gt;Version 1.1&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;by Patrick Ruoff&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://ftnoirpt.sourceforge.net/&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#0000ff;&quot;&gt;Manual (external)&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Easy Tracker&lt;br/&gt;Version 0.1&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;by Stéphane Lenclud&lt;/span&gt;&lt;/p&gt;&lt;p&gt;See &lt;a href=&quot;https://github.com/opentrack/opentrack/wiki/Easy-Tracker&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#9999AA;&quot;&gt;documentation on GitHub&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
diff --git a/tracker-easy/tracker-easy.cpp b/tracker-easy/tracker-easy.cpp
index e0ab5f7c..199bf95a 100644
--- a/tracker-easy/tracker-easy.cpp
+++ b/tracker-easy/tracker-easy.cpp
@@ -48,7 +48,12 @@ namespace EasyTracker
// We could not get this working, nevermind
//connect(&iSettings.cam_fps, value_::value_changed<int>(), this, &Tracker::SetFps, Qt::DirectConnection);
+ // Make sure deadzones are updated whenever the settings are changed
+ connect(&iSettings.DeadzoneRectHalfEdgeSize, value_::value_changed<int>(), this, &Tracker::UpdateDeadzones, Qt::DirectConnection);
+
CreateModelFromSettings();
+
+ UpdateDeadzones(iSettings.DeadzoneRectHalfEdgeSize);
}
Tracker::~Tracker()
@@ -198,47 +203,79 @@ namespace EasyTracker
iTrackedPoints.push_back(iPoints[leftPointIndex]);
iTrackedPoints.push_back(iPoints[topPointIndex]);
- dbgout << "Object: " << iModel << "\n";
- dbgout << "Points: " << iTrackedPoints << "\n";
+ bool movedEnough = true;
+ // Check if we moved enough since last time we were here
+ // This is our deadzone management
+ if (iSettings.DeadzoneRectHalfEdgeSize != 0 // Check if deazones are enabled
+ && iTrackedRects.size() == iTrackedPoints.size())
+ {
+ movedEnough = false;
+ for (size_t i = 0; i < iTrackedPoints.size(); i++)
+ {
+ if (!iTrackedRects[i].contains(iTrackedPoints[i]))
+ {
+ movedEnough = true;
+ break;
+ }
+ }
+ }
+
+ if (movedEnough)
+ {
+ // Build deadzone rectangles if needed
+ iTrackedRects.clear();
+ if (iSettings.DeadzoneRectHalfEdgeSize != 0) // Check if deazones are enabled
+ {
+ for (const cv::Point& pt : iTrackedPoints)
+ {
+ cv::Rect rect(pt - cv::Point(iDeadzoneHalfEdge, iDeadzoneHalfEdge), cv::Size(iDeadzoneEdge, iDeadzoneEdge));
+ iTrackedRects.push_back(rect);
+ }
+ }
+
+ dbgout << "Object: " << iModel << "\n";
+ dbgout << "Points: " << iTrackedPoints << "\n";
- // TODO: try SOLVEPNP_AP3P too, make it a settings option?
- iAngles.clear();
- iBestSolutionIndex = -1;
- int solutionCount = cv::solveP3P(iModel, iTrackedPoints, iCameraMatrix, iDistCoeffsMatrix, iRotations, iTranslations, cv::SOLVEPNP_P3P);
- if (solutionCount > 0)
- {
- dbgout << "Solution count: " << solutionCount << "\n";
- int minPitch = std::numeric_limits<int>::max();
- // Find the solution we want amongst all possible ones
- for (int i = 0; i < solutionCount; i++)
+ // TODO: try SOLVEPNP_AP3P too, make it a settings option?
+ iAngles.clear();
+ iBestSolutionIndex = -1;
+ int solutionCount = cv::solveP3P(iModel, iTrackedPoints, iCameraMatrix, iDistCoeffsMatrix, iRotations, iTranslations, cv::SOLVEPNP_P3P);
+
+ if (solutionCount > 0)
{
- dbgout << "Translation:\n";
- dbgout << iTranslations.at(i);
- dbgout << "\n";
- dbgout << "Rotation:\n";
- //dbgout << rvecs.at(i);
- cv::Mat rotationCameraMatrix;
- cv::Rodrigues(iRotations[i], rotationCameraMatrix);
- cv::Vec3d angles;
- getEulerAngles(rotationCameraMatrix, angles);
- iAngles.push_back(angles);
-
- // Check if pitch is closest to zero
- int absolutePitch = std::abs(angles[0]);
- if (minPitch > absolutePitch)
+ dbgout << "Solution count: " << solutionCount << "\n";
+ int minPitch = std::numeric_limits<int>::max();
+ // Find the solution we want amongst all possible ones
+ for (int i = 0; i < solutionCount; i++)
{
- // The solution with pitch closest to zero is the one we want
- minPitch = absolutePitch;
- iBestSolutionIndex = i;
+ dbgout << "Translation:\n";
+ dbgout << iTranslations.at(i);
+ dbgout << "\n";
+ dbgout << "Rotation:\n";
+ //dbgout << rvecs.at(i);
+ cv::Mat rotationCameraMatrix;
+ cv::Rodrigues(iRotations[i], rotationCameraMatrix);
+ cv::Vec3d angles;
+ getEulerAngles(rotationCameraMatrix, angles);
+ iAngles.push_back(angles);
+
+ // Check if pitch is closest to zero
+ int absolutePitch = std::abs(angles[0]);
+ if (minPitch > absolutePitch)
+ {
+ // The solution with pitch closest to zero is the one we want
+ minPitch = absolutePitch;
+ iBestSolutionIndex = i;
+ }
+
+ dbgout << angles;
+ dbgout << "\n";
}
- dbgout << angles;
dbgout << "\n";
}
-
- dbgout << "\n";
}
}
@@ -274,6 +311,12 @@ namespace EasyTracker
iPreview.DrawCross(iPoints[topPointIndex]);
}
+ // Render our deadzone rects
+ for (const cv::Rect& rect : iTrackedRects)
+ {
+ cv::rectangle(iPreview.iFrameRgb,rect,cv::Scalar(255,0,0));
+ }
+
// Show full size preview pop-up
if (iSettings.debug)
{
@@ -397,6 +440,14 @@ namespace EasyTracker
iKf.Init(18, 6, 0, dt);
}
+ void Tracker::UpdateDeadzones(int aHalfEdgeSize)
+ {
+ QMutexLocker l(&center_lock);
+ iDeadzoneHalfEdge = aHalfEdgeSize;
+ iDeadzoneEdge = iDeadzoneHalfEdge * 2;
+ iTrackedRects.clear();
+ }
+
module_status Tracker::start_tracker(QFrame* video_frame)
{
diff --git a/tracker-easy/tracker-easy.h b/tracker-easy/tracker-easy.h
index 05fdb94a..bbafcefa 100644
--- a/tracker-easy/tracker-easy.h
+++ b/tracker-easy/tracker-easy.h
@@ -61,13 +61,14 @@ namespace EasyTracker
void CreateModelFromSettings();
void CreateCameraIntrinsicsMatrices();
void ProcessFrame();
-
+
//
bool maybe_reopen_camera();
void set_fov(int value);
void SetFps(int aFps);
void DoSetFps(int aFps);
+ void UpdateDeadzones(int aHalfEdgeSize);
QMutex camera_mtx;
QThread iThread;
@@ -93,6 +94,10 @@ namespace EasyTracker
std::atomic<bool> ever_success = false;
mutable QMutex center_lock, data_lock;
+ // Deadzone
+ int iDeadzoneEdge=0;
+ int iDeadzoneHalfEdge=0;
+
// Statistics
Timer iTimer;
Timer iFpsTimer;
@@ -108,6 +113,9 @@ namespace EasyTracker
std::vector<cv::Point3f> iModel;
// Bitmap points corresponding to model vertices
std::vector<cv::Point2f> iTrackedPoints;
+
+ std::vector<cv::Rect> iTrackedRects;
+
// Intrinsics camera matrix
cv::Mat iCameraMatrix;
// Intrinsics distortion coefficients as a matrix