summaryrefslogtreecommitdiffhomepage
path: root/tracker-easy
diff options
context:
space:
mode:
Diffstat (limited to 'tracker-easy')
-rw-r--r--tracker-easy/lang/nl_NL.ts20
-rw-r--r--tracker-easy/lang/ru_RU.ts20
-rw-r--r--tracker-easy/lang/stub.ts20
-rw-r--r--tracker-easy/lang/zh_CN.ts20
-rw-r--r--tracker-easy/settings.h2
-rw-r--r--tracker-easy/tracker-easy-dialog.cpp3
-rw-r--r--tracker-easy/tracker-easy-settings.ui129
-rw-r--r--tracker-easy/tracker-easy.cpp58
8 files changed, 213 insertions, 59 deletions
diff --git a/tracker-easy/lang/nl_NL.ts b/tracker-easy/lang/nl_NL.ts
index fe73b271..9c4e1843 100644
--- a/tracker-easy/lang/nl_NL.ts
+++ b/tracker-easy/lang/nl_NL.ts
@@ -206,5 +206,25 @@
<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 1.0&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>Auto center</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Use P3P or AP3P for three and four points setup. Use EPNP or ITERATIVE for five points setup. Inconsistent configuration will result in undefined behavior.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Auto center timeout</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>If no valid pose can be determined after that much time the center pose will be used.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source> ms</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 022acd68..6499415f 100644
--- a/tracker-easy/lang/ru_RU.ts
+++ b/tracker-easy/lang/ru_RU.ts
@@ -206,5 +206,25 @@
<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 1.0&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>Auto center</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Use P3P or AP3P for three and four points setup. Use EPNP or ITERATIVE for five points setup. Inconsistent configuration will result in undefined behavior.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Auto center timeout</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>If no valid pose can be determined after that much time the center pose will be used.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source> ms</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
</TS>
diff --git a/tracker-easy/lang/stub.ts b/tracker-easy/lang/stub.ts
index 60c84d35..7b6facec 100644
--- a/tracker-easy/lang/stub.ts
+++ b/tracker-easy/lang/stub.ts
@@ -206,5 +206,25 @@
<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 1.0&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>Auto center</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Use P3P or AP3P for three and four points setup. Use EPNP or ITERATIVE for five points setup. Inconsistent configuration will result in undefined behavior.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Auto center timeout</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>If no valid pose can be determined after that much time the center pose will be used.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source> ms</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 ee89b5b6..bbd8aff1 100644
--- a/tracker-easy/lang/zh_CN.ts
+++ b/tracker-easy/lang/zh_CN.ts
@@ -206,5 +206,25 @@
<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 1.0&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>Auto center</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Use P3P or AP3P for three and four points setup. Use EPNP or ITERATIVE for five points setup. Inconsistent configuration will result in undefined behavior.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Auto center timeout</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>If no valid pose can be determined after that much time the center pose will be used.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source> ms</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
</TS>
diff --git a/tracker-easy/settings.h b/tracker-easy/settings.h
index 5a4dff84..b0f14417 100644
--- a/tracker-easy/settings.h
+++ b/tracker-easy/settings.h
@@ -44,6 +44,8 @@ namespace EasyTracker {
value<int> fov{ b, "camera-fov", 56 };
value<bool> debug{ b, "debug", false };
+ value<bool> iAutoCenter{ b, "iAutoCenter", true };
+ value<int> iAutoCenterTimeout{ b, "iAutoCenterTimeout", 1000 };
value<int> PnpSolver{ b, "pnp-solver", cv::SOLVEPNP_P3P };
diff --git a/tracker-easy/tracker-easy-dialog.cpp b/tracker-easy/tracker-easy-dialog.cpp
index d1aafee1..8c8356d1 100644
--- a/tracker-easy/tracker-easy-dialog.cpp
+++ b/tracker-easy/tracker-easy-dialog.cpp
@@ -72,6 +72,9 @@ namespace EasyTracker
tie_setting(s.debug, ui.debug);
+ tie_setting(s.iAutoCenter, ui.iCheckBoxAutoCenter);
+ tie_setting(s.iAutoCenterTimeout, ui.iSpinBoxAutoCenterTimeout);
+
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK()));
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel()));
diff --git a/tracker-easy/tracker-easy-settings.ui b/tracker-easy/tracker-easy-settings.ui
index c6c3fbd7..451b3e54 100644
--- a/tracker-easy/tracker-easy-settings.ui
+++ b/tracker-easy/tracker-easy-settings.ui
@@ -61,7 +61,7 @@
<locale language="English" country="UnitedStates"/>
</property>
<property name="currentIndex">
- <number>2</number>
+ <number>0</number>
</property>
<widget class="QWidget" name="tabTracker">
<attribute name="title">
@@ -289,8 +289,21 @@
<property name="title">
<string>Settings</string>
</property>
- <layout class="QGridLayout" name="gridLayout_7">
- <item row="2" column="0">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Debug (full size preview)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
@@ -306,24 +319,24 @@
</property>
</widget>
</item>
- <item row="5" column="0">
- <widget class="QLabel" name="labelDeadzone">
+ <item row="5" column="2">
+ <widget class="QSpinBox" name="mindiam_spin">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="text">
- <string>Deadzone</string>
+ <property name="toolTip">
+ <string>Minimum point diameter</string>
</property>
- <property name="buddy">
- <cstring>maxdiam_spin</cstring>
+ <property name="suffix">
+ <string> px</string>
</property>
</widget>
</item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_8">
+ <item row="2" column="2">
+ <widget class="QCheckBox" name="iCheckBoxAutoCenter">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
@@ -331,12 +344,25 @@
</sizepolicy>
</property>
<property name="text">
- <string>Max size</string>
+ <string/>
</property>
</widget>
</item>
- <item row="0" column="0">
- <widget class="QLabel" name="label_5">
+ <item row="1" column="2">
+ <widget class="QCheckBox" name="debug">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_13">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
@@ -344,12 +370,12 @@
</sizepolicy>
</property>
<property name="text">
- <string>Debug (full size preview)</string>
+ <string>Auto center</string>
</property>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QCheckBox" name="debug">
+ <item row="6" column="0">
+ <widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
@@ -357,11 +383,27 @@
</sizepolicy>
</property>
<property name="text">
- <string/>
+ <string>Max size</string>
</property>
</widget>
</item>
- <item row="1" column="0">
+ <item row="7" column="2">
+ <widget class="QSpinBox" name="spinDeadzone">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Size in pixels of half the edge defining deadzone squares around tracked points</string>
+ </property>
+ <property name="suffix">
+ <string> px</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
<widget class="QLabel" name="label_12">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
@@ -369,12 +411,15 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Use P3P or AP3P for three and four points setup. Use EPNP or ITERATIVE for five points setup. Inconsistent configuration will result in undefined behavior.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
<property name="text">
<string>Perspective-N-Point solver</string>
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="4" column="2">
<widget class="QComboBox" name="comboBoxSolvers">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
@@ -420,23 +465,23 @@
</item>
</widget>
</item>
- <item row="5" column="1">
- <widget class="QSpinBox" name="spinDeadzone">
+ <item row="7" 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>Size in pixels of half the edge defining deadzone squares around tracked points</string>
+ <property name="text">
+ <string>Deadzone</string>
</property>
- <property name="suffix">
- <string> px</string>
+ <property name="buddy">
+ <cstring>maxdiam_spin</cstring>
</property>
</widget>
</item>
- <item row="3" column="1">
+ <item row="6" column="2">
<widget class="QSpinBox" name="maxdiam_spin">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
@@ -452,8 +497,24 @@
</property>
</widget>
</item>
- <item row="2" column="1">
- <widget class="QSpinBox" name="mindiam_spin">
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_14">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Auto center timeout</string>
+ </property>
+ <property name="buddy">
+ <cstring>mindiam_spin</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <widget class="QSpinBox" name="iSpinBoxAutoCenterTimeout">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
@@ -461,10 +522,16 @@
</sizepolicy>
</property>
<property name="toolTip">
- <string>Minimum point diameter</string>
+ <string>If no valid pose can be determined after that much time the center pose will be used.</string>
</property>
<property name="suffix">
- <string> px</string>
+ <string> ms</string>
+ </property>
+ <property name="maximum">
+ <number>3600000</number>
+ </property>
+ <property name="singleStep">
+ <number>500</number>
</property>
</widget>
</item>
diff --git a/tracker-easy/tracker-easy.cpp b/tracker-easy/tracker-easy.cpp
index 1bb6b5e1..e13bdf37 100644
--- a/tracker-easy/tracker-easy.cpp
+++ b/tracker-easy/tracker-easy.cpp
@@ -118,33 +118,6 @@ namespace EasyTracker
}
///
- /// Create our model from settings specifications
- ///
- void Tracker::UpdateModel()
- {
- infout << "Update model";
-
- QMutexLocker lock(&iProcessLock);
- // Construct the points defining the object we want to detect based on settings.
- // We are converting them from millimeters to centimeters.
- // TODO: Need to support clip too. That's cap only for now.
- iModel.clear();
- iModel.push_back(cv::Point3f(iSettings.iVertexTopX / 10.0, iSettings.iVertexTopY / 10.0, iSettings.iVertexTopZ / 10.0)); // Top
- iModel.push_back(cv::Point3f(iSettings.iVertexRightX / 10.0, iSettings.iVertexRightY / 10.0, iSettings.iVertexRightZ / 10.0)); // Right
- iModel.push_back(cv::Point3f(iSettings.iVertexLeftX / 10.0, iSettings.iVertexLeftY / 10.0, iSettings.iVertexLeftZ / 10.0)); // Left
-
- if (iSettings.iCustomModelFour)
- {
- iModel.push_back(cv::Point3f(iSettings.iVertexCenterX / 10.0, iSettings.iVertexCenterY / 10.0, iSettings.iVertexCenterZ / 10.0)); // Center
- }
- else if (iSettings.iCustomModelFive)
- {
- iModel.push_back(cv::Point3f(iSettings.iVertexTopRightX / 10.0, iSettings.iVertexTopRightY / 10.0, iSettings.iVertexTopRightZ / 10.0)); // Top Right
- iModel.push_back(cv::Point3f(iSettings.iVertexTopLeftX / 10.0, iSettings.iVertexTopLeftY / 10.0, iSettings.iVertexTopLeftZ / 10.0)); // Top Left
- }
- }
-
- ///
void Tracker::CreateCameraIntrinsicsMatrices()
{
// Create our camera matrix
@@ -700,6 +673,34 @@ namespace EasyTracker
iKf.Init(18, 6, 0, dt);
}
+
+ ///
+ /// Create our model from settings specifications
+ ///
+ void Tracker::UpdateModel()
+ {
+ infout << "Update model";
+
+ QMutexLocker lock(&iProcessLock);
+ // Construct the points defining the object we want to detect based on settings.
+ // We are converting them from millimeters to centimeters.
+ // TODO: Need to support clip too. That's cap only for now.
+ iModel.clear();
+ iModel.push_back(cv::Point3f(iSettings.iVertexTopX / 10.0, iSettings.iVertexTopY / 10.0, iSettings.iVertexTopZ / 10.0)); // Top
+ iModel.push_back(cv::Point3f(iSettings.iVertexRightX / 10.0, iSettings.iVertexRightY / 10.0, iSettings.iVertexRightZ / 10.0)); // Right
+ iModel.push_back(cv::Point3f(iSettings.iVertexLeftX / 10.0, iSettings.iVertexLeftY / 10.0, iSettings.iVertexLeftZ / 10.0)); // Left
+
+ if (iSettings.iCustomModelFour)
+ {
+ iModel.push_back(cv::Point3f(iSettings.iVertexCenterX / 10.0, iSettings.iVertexCenterY / 10.0, iSettings.iVertexCenterZ / 10.0)); // Center
+ }
+ else if (iSettings.iCustomModelFive)
+ {
+ iModel.push_back(cv::Point3f(iSettings.iVertexTopRightX / 10.0, iSettings.iVertexTopRightY / 10.0, iSettings.iVertexTopRightZ / 10.0)); // Top Right
+ iModel.push_back(cv::Point3f(iSettings.iVertexTopLeftX / 10.0, iSettings.iVertexTopLeftY / 10.0, iSettings.iVertexTopLeftZ / 10.0)); // Top Left
+ }
+ }
+
///
/// Take a copy of the settings needed by our thread to avoid deadlocks
///
@@ -715,6 +716,7 @@ namespace EasyTracker
iDebug = iSettings.debug;
}
+ ///
module_status Tracker::start_tracker(QFrame* video_frame)
{
// Check that we support that solver
@@ -773,7 +775,7 @@ namespace EasyTracker
QMutexLocker l(&iDataLock);
// If there was no new data recently then we provide center data.
// Basically, if our user remove her hat, we will go back to center position until she puts it back on.
- if (iBestTime.elapsed_seconds() > 1)
+ if (iSettings.iAutoCenter && iBestTime.elapsed_ms() > iSettings.iAutoCenterTimeout)
{
// Reset to center until we get new data
FeedData(aData, iCenterAngles, iCenterTranslation);