summaryrefslogtreecommitdiffhomepage
path: root/tracker-easy
diff options
context:
space:
mode:
Diffstat (limited to 'tracker-easy')
-rw-r--r--tracker-easy/lang/nl_NL.ts56
-rw-r--r--tracker-easy/lang/ru_RU.ts56
-rw-r--r--tracker-easy/lang/stub.ts56
-rw-r--r--tracker-easy/lang/zh_CN.ts36
-rw-r--r--tracker-easy/settings.h13
-rw-r--r--tracker-easy/tracker-easy-dialog.cpp14
-rw-r--r--tracker-easy/tracker-easy-settings.ui27
-rw-r--r--tracker-easy/tracker-easy.cpp39
-rw-r--r--tracker-easy/tracker-easy.h4
9 files changed, 174 insertions, 127 deletions
diff --git a/tracker-easy/lang/nl_NL.ts b/tracker-easy/lang/nl_NL.ts
index f83e859a..21ea306e 100644
--- a/tracker-easy/lang/nl_NL.ts
+++ b/tracker-easy/lang/nl_NL.ts
@@ -138,26 +138,6 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>Color channels used</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Average</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Natural</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Red only</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Blue only</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>Maximum point diameter</source>
<translation type="unfinished"></translation>
</message>
@@ -255,10 +235,6 @@ Don&apos;t roll or change position.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Green only</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>Debug (full size preview)</source>
<translation type="unfinished"></translation>
</message>
@@ -274,5 +250,37 @@ Don&apos;t roll or change position.</source>
<source>Size in pixels of half the edge defining deadzone squares around tracked points</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Perspective-N-Point solver</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Make sure you pick a solver supporting the number of marker you are using. For three points detection use either P3P or AP3P.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>P3P</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>ITERATIVE</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>EPNP</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>DLS</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>UPNP</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>AP3P</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 0dbc8323..bc725e23 100644
--- a/tracker-easy/lang/ru_RU.ts
+++ b/tracker-easy/lang/ru_RU.ts
@@ -138,26 +138,6 @@
<translation>Полузнок устанавливает размер точек</translation>
</message>
<message>
- <source>Color channels used</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Average</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Natural</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Red only</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Blue only</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>Maximum point diameter</source>
<translation></translation>
</message>
@@ -260,10 +240,6 @@ ROLL или X/Y-смещения.</translation>
<translation>Параметры камеры:</translation>
</message>
<message>
- <source>Green only</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>Debug (full size preview)</source>
<translation type="unfinished"></translation>
</message>
@@ -279,5 +255,37 @@ ROLL или X/Y-смещения.</translation>
<source>Size in pixels of half the edge defining deadzone squares around tracked points</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Perspective-N-Point solver</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Make sure you pick a solver supporting the number of marker you are using. For three points detection use either P3P or AP3P.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>P3P</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>ITERATIVE</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>EPNP</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>DLS</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>UPNP</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>AP3P</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
</TS>
diff --git a/tracker-easy/lang/stub.ts b/tracker-easy/lang/stub.ts
index 32b314e9..75e29070 100644
--- a/tracker-easy/lang/stub.ts
+++ b/tracker-easy/lang/stub.ts
@@ -138,26 +138,6 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>Color channels used</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Average</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Natural</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Red only</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>Blue only</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>Maximum point diameter</source>
<translation type="unfinished"></translation>
</message>
@@ -255,10 +235,6 @@ Don&apos;t roll or change position.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Green only</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<source>Debug (full size preview)</source>
<translation type="unfinished"></translation>
</message>
@@ -274,5 +250,37 @@ Don&apos;t roll or change position.</source>
<source>Size in pixels of half the edge defining deadzone squares around tracked points</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Perspective-N-Point solver</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Make sure you pick a solver supporting the number of marker you are using. For three points detection use either P3P or AP3P.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>P3P</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>ITERATIVE</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>EPNP</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>DLS</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>UPNP</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>AP3P</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 f90e261f..68172059 100644
--- a/tracker-easy/lang/zh_CN.ts
+++ b/tracker-easy/lang/zh_CN.ts
@@ -226,52 +226,60 @@
<translation>设备信息:</translation>
</message>
<message>
- <source>Color channels used</source>
+ <source>Value</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Average</source>
+ <source>Use only yaw and pitch while calibrating.
+Don&apos;t roll or change position.</source>
+ <translation>用pitch和yaw校准。不要roll或者变换位置</translation>
+ </message>
+ <message>
+ <source>Debug (full size preview)</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Natural</source>
+ <source>Deadzone</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Red only</source>
+ <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>Blue only</source>
+ <source>Size in pixels of half the edge defining deadzone squares around tracked points</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Value</source>
+ <source>Perspective-N-Point solver</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Use only yaw and pitch while calibrating.
-Don&apos;t roll or change position.</source>
- <translation>用pitch和yaw校准。不要roll或者变换位置</translation>
+ <source>Make sure you pick a solver supporting the number of marker you are using. For three points detection use either P3P or AP3P.</source>
+ <translation type="unfinished"></translation>
</message>
<message>
- <source>Green only</source>
+ <source>P3P</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Debug (full size preview)</source>
+ <source>ITERATIVE</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Deadzone</source>
+ <source>EPNP</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>
+ <source>DLS</source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>Size in pixels of half the edge defining deadzone squares around tracked points</source>
+ <source>UPNP</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>AP3P</source>
<translation type="unfinished"></translation>
</message>
</context>
diff --git a/tracker-easy/settings.h b/tracker-easy/settings.h
index 53b80052..4d043e6a 100644
--- a/tracker-easy/settings.h
+++ b/tracker-easy/settings.h
@@ -1,19 +1,10 @@
#pragma once
#include "options/options.hpp"
+#include <opencv2/calib3d.hpp>
#include <QString>
-enum pt_color_type
-{
- // explicit values, gotta preserve the numbering in .ini
- // don't reuse when removing some of the modes
- pt_color_natural = 2,
- pt_color_red_only = 3,
- pt_color_average = 5,
- pt_color_blue_only = 6,
- pt_color_green_only = 7,
-};
namespace EasyTracker {
@@ -58,7 +49,7 @@ namespace EasyTracker {
value<bool> debug{ b, "debug", false };
value<bool> auto_threshold{ b, "automatic-threshold", true };
- value<pt_color_type> blob_color{ b, "blob-color", pt_color_natural };
+ value<int> PnpSolver{ b, "pnp-solver", cv::SOLVEPNP_P3P };
value<slider_value> threshold_slider{ b, "threshold-slider", { 128, 0, 255 } };
diff --git a/tracker-easy/tracker-easy-dialog.cpp b/tracker-easy/tracker-easy-dialog.cpp
index e3b72e38..36c5d99d 100644
--- a/tracker-easy/tracker-easy-dialog.cpp
+++ b/tracker-easy/tracker-easy-dialog.cpp
@@ -11,6 +11,7 @@
#include "video/camera.hpp"
#include <opencv2/core.hpp>
+#include <opencv2/calib3d.hpp>
#include <QString>
#include <QtGlobal>
@@ -95,18 +96,11 @@ namespace EasyTracker
connect(this, &Dialog::poll_tracker_info, this, &Dialog::poll_tracker_info_impl, Qt::DirectConnection);
- constexpr pt_color_type color_types[] = {
- pt_color_average,
- pt_color_natural,
- pt_color_red_only,
- pt_color_green_only,
- pt_color_blue_only,
- };
- for (unsigned k = 0; k < std::size(color_types); k++)
- ui.blob_color->setItemData(k, int(color_types[k]));
+ for (unsigned k = 0; k < cv::SOLVEPNP_MAX_COUNT; k++)
+ ui.comboBoxSolvers->setItemData(k, k);
- tie_setting(s.blob_color, ui.blob_color);
+ tie_setting(s.PnpSolver, ui.comboBoxSolvers);
tie_setting(s.threshold_slider, ui.threshold_value_display, [this](const slider_value& val) {
return threshold_display_text(int(val));
diff --git a/tracker-easy/tracker-easy-settings.ui b/tracker-easy/tracker-easy-settings.ui
index ffe6ebce..9ff929dc 100644
--- a/tracker-easy/tracker-easy-settings.ui
+++ b/tracker-easy/tracker-easy-settings.ui
@@ -198,7 +198,7 @@
</sizepolicy>
</property>
<property name="text">
- <string>Color channels used</string>
+ <string>Perspective-N-Point solver</string>
</property>
</widget>
</item>
@@ -242,36 +242,47 @@
</widget>
</item>
<item row="7" column="1">
- <widget class="QComboBox" name="blob_color">
+ <widget class="QComboBox" name="comboBoxSolvers">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="toolTip">
+ <string>Make sure you pick a solver supporting the number of marker you are using. For three points detection use either P3P or AP3P.</string>
+ </property>
+ <property name="currentText">
+ <string>P3P</string>
+ </property>
+ <item>
+ <property name="text">
+ <string>ITERATIVE</string>
+ </property>
+ </item>
<item>
<property name="text">
- <string>Average</string>
+ <string>EPNP</string>
</property>
</item>
<item>
<property name="text">
- <string>Natural</string>
+ <string>P3P</string>
</property>
</item>
<item>
<property name="text">
- <string>Red only</string>
+ <string>DLS</string>
</property>
</item>
<item>
<property name="text">
- <string>Green only</string>
+ <string>UPNP</string>
</property>
</item>
<item>
<property name="text">
- <string>Blue only</string>
+ <string>AP3P</string>
</property>
</item>
</widget>
@@ -1393,7 +1404,7 @@ Don't roll or change position.</string>
<tabstop>fov</tabstop>
<tabstop>debug</tabstop>
<tabstop>camera_settings</tabstop>
- <tabstop>blob_color</tabstop>
+ <tabstop>comboBoxSolvers</tabstop>
<tabstop>auto_threshold</tabstop>
<tabstop>threshold_slider</tabstop>
<tabstop>mindiam_spin</tabstop>
diff --git a/tracker-easy/tracker-easy.cpp b/tracker-easy/tracker-easy.cpp
index 199bf95a..ebc6e128 100644
--- a/tracker-easy/tracker-easy.cpp
+++ b/tracker-easy/tracker-easy.cpp
@@ -50,10 +50,13 @@ namespace EasyTracker
// Make sure deadzones are updated whenever the settings are changed
connect(&iSettings.DeadzoneRectHalfEdgeSize, value_::value_changed<int>(), this, &Tracker::UpdateDeadzones, Qt::DirectConnection);
+ UpdateDeadzones(iSettings.DeadzoneRectHalfEdgeSize);
- CreateModelFromSettings();
+ // Make sure solver is updated whenever the settings are changed
+ connect(&iSettings.PnpSolver, value_::value_changed<int>(), this, &Tracker::UpdateSolver, Qt::DirectConnection);
+ UpdateSolver(iSettings.PnpSolver);
- UpdateDeadzones(iSettings.DeadzoneRectHalfEdgeSize);
+ CreateModelFromSettings();
}
Tracker::~Tracker()
@@ -62,9 +65,12 @@ namespace EasyTracker
iThread.exit();
iThread.wait();
-
- QMutexLocker l(&camera_mtx);
- camera->stop();
+
+ if (camera)
+ {
+ QMutexLocker l(&camera_mtx);
+ camera->stop();
+ }
}
@@ -156,8 +162,6 @@ namespace EasyTracker
{
ever_success.store(true, std::memory_order_relaxed);
- // Solve P3P problem with OpenCV
-
//Bitmap origin is top left
iTrackedPoints.clear();
// Tracked points must match the order of the object model points.
@@ -233,15 +237,13 @@ namespace EasyTracker
}
}
-
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);
+ // Solve P3P problem with OpenCV
+ int solutionCount = cv::solveP3P(iModel, iTrackedPoints, iCameraMatrix, iDistCoeffsMatrix, iRotations, iTranslations, iSolver);
if (solutionCount > 0)
{
@@ -449,10 +451,23 @@ namespace EasyTracker
}
+ void Tracker::UpdateSolver(int aSolver)
+ {
+ QMutexLocker l(&center_lock);
+ iSolver = aSolver;
+ }
+
+
+
module_status Tracker::start_tracker(QFrame* video_frame)
{
- //video_frame->setAttribute(Qt::WA_NativeWindow);
+ // Check that we support that solver
+ if (iSolver!=cv::SOLVEPNP_P3P && iSolver != cv::SOLVEPNP_AP3P)
+ {
+ return module_status("Error: Solver not supported use either P3P or AP3P.");
+ }
+ //video_frame->setAttribute(Qt::WA_NativeWindow);
widget = std::make_unique<video_widget>(video_frame);
layout = std::make_unique<QHBoxLayout>(video_frame);
layout->setContentsMargins(0, 0, 0, 0);
diff --git a/tracker-easy/tracker-easy.h b/tracker-easy/tracker-easy.h
index bbafcefa..41226d23 100644
--- a/tracker-easy/tracker-easy.h
+++ b/tracker-easy/tracker-easy.h
@@ -69,6 +69,7 @@ namespace EasyTracker
void SetFps(int aFps);
void DoSetFps(int aFps);
void UpdateDeadzones(int aHalfEdgeSize);
+ void UpdateSolver(int aSolver);
QMutex camera_mtx;
QThread iThread;
@@ -98,6 +99,9 @@ namespace EasyTracker
int iDeadzoneEdge=0;
int iDeadzoneHalfEdge=0;
+ // Solver
+ int iSolver = cv::SOLVEPNP_P3P;
+
// Statistics
Timer iTimer;
Timer iFpsTimer;