summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--migration/20220105_00-pt-grayscale.cpp38
-rw-r--r--tracker-pt/FTNoIR_PT_Controls.ui4
-rw-r--r--tracker-pt/ftnoir_tracker_pt_dialog.cpp4
-rw-r--r--tracker-pt/lang/nl_NL.ts16
-rw-r--r--tracker-pt/lang/ru_RU.ts16
-rw-r--r--tracker-pt/lang/stub.ts16
-rw-r--r--tracker-pt/lang/zh_CN.ts16
-rw-r--r--tracker-pt/module/camera.cpp9
-rw-r--r--tracker-pt/module/point_extractor.cpp14
-rw-r--r--tracker-pt/pt-settings.hpp6
10 files changed, 83 insertions, 56 deletions
diff --git a/migration/20220105_00-pt-grayscale.cpp b/migration/20220105_00-pt-grayscale.cpp
new file mode 100644
index 00000000..44bdc470
--- /dev/null
+++ b/migration/20220105_00-pt-grayscale.cpp
@@ -0,0 +1,38 @@
+#include "migration.hpp"
+#include "options/options.hpp"
+
+using namespace migrations;
+using namespace options;
+
+#include "api/plugin-support.hpp"
+#include "compat/library-path.hpp"
+
+struct pt_color_grayscale : migration
+{
+ bundle b { make_bundle("tracker-pt") };
+ enum : int { pt_color_average = 5, pt_color_bt709 = 2, };
+
+ QString unique_date() const override
+ {
+ return "20220105_00";
+ }
+
+ QString name() const override
+ {
+ return "pt color enum";
+ }
+
+ bool should_run() const override
+ {
+ auto x = b->get_variant("blob-color").toInt();
+ return x == pt_color_average;
+ }
+
+ void run() override
+ {
+ b->store_kv("blob-color", QVariant::fromValue((int)pt_color_bt709));
+ b->save();
+ }
+};
+
+OPENTRACK_MIGRATION(pt_color_grayscale)
diff --git a/tracker-pt/FTNoIR_PT_Controls.ui b/tracker-pt/FTNoIR_PT_Controls.ui
index 015dcada..5a9b1963 100644
--- a/tracker-pt/FTNoIR_PT_Controls.ui
+++ b/tracker-pt/FTNoIR_PT_Controls.ui
@@ -157,12 +157,12 @@
</property>
<item>
<property name="text">
- <string>Average</string>
+ <string>Grayscale BT.709</string>
</property>
</item>
<item>
<property name="text">
- <string>Natural</string>
+ <string>Grayscale (from hardware)</string>
</property>
</item>
<item>
diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.cpp b/tracker-pt/ftnoir_tracker_pt_dialog.cpp
index 4f17f186..2bab280a 100644
--- a/tracker-pt/ftnoir_tracker_pt_dialog.cpp
+++ b/tracker-pt/ftnoir_tracker_pt_dialog.cpp
@@ -92,8 +92,8 @@ TrackerDialog_PT::TrackerDialog_PT(const QString& module_name) :
poll_tracker_info_impl();
constexpr pt_color_type color_types[] = {
- pt_color_average,
- pt_color_natural,
+ pt_color_bt709,
+ pt_color_hardware,
pt_color_red_only,
pt_color_green_only,
pt_color_blue_only,
diff --git a/tracker-pt/lang/nl_NL.ts b/tracker-pt/lang/nl_NL.ts
index 5b55148d..72cb5d6d 100644
--- a/tracker-pt/lang/nl_NL.ts
+++ b/tracker-pt/lang/nl_NL.ts
@@ -108,14 +108,6 @@
<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>
@@ -296,6 +288,14 @@ Don&apos;t roll or change position.</source>
<source>Limit</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Grayscale BT.709</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Grayscale (from hardware)</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 e53052d3..469fabd1 100644
--- a/tracker-pt/lang/ru_RU.ts
+++ b/tracker-pt/lang/ru_RU.ts
@@ -112,14 +112,6 @@
<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>
@@ -301,6 +293,14 @@ ROLL или X/Y-смещения.</translation>
<source>Limit</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Grayscale BT.709</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Grayscale (from hardware)</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 5d8e0e4a..e2781648 100644
--- a/tracker-pt/lang/stub.ts
+++ b/tracker-pt/lang/stub.ts
@@ -108,14 +108,6 @@
<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>
@@ -296,6 +288,14 @@ Don&apos;t roll or change position.</source>
<source>Limit</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Grayscale BT.709</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Grayscale (from hardware)</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 c35a63d2..8e04a130 100644
--- a/tracker-pt/lang/zh_CN.ts
+++ b/tracker-pt/lang/zh_CN.ts
@@ -200,14 +200,6 @@
<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>
@@ -296,6 +288,14 @@ Don&apos;t roll or change position.</source>
<source>Limit</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Grayscale BT.709</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Grayscale (from hardware)</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>pt_impl::TrackerDialog_PT</name>
diff --git a/tracker-pt/module/camera.cpp b/tracker-pt/module/camera.cpp
index 73c57f37..1beba474 100644
--- a/tracker-pt/module/camera.cpp
+++ b/tracker-pt/module/camera.cpp
@@ -104,14 +104,7 @@ bool Camera::start(const pt_settings& s)
info.width = res_x;
info.height = res_y;
info.use_mjpeg = use_mjpeg;
- switch (*s.blob_color)
- {
- case pt_color_natural:
- case pt_color_average:
- info.num_channels = 1; break;
- default:
- info.num_channels = 3; break;
- }
+ info.num_channels = s.blob_color == pt_color_hardware ? 1 : 3;
if (!cap->start(info))
goto fail;
diff --git a/tracker-pt/module/point_extractor.cpp b/tracker-pt/module/point_extractor.cpp
index fbb830d3..8c3ad7e9 100644
--- a/tracker-pt/module/point_extractor.cpp
+++ b/tracker-pt/module/point_extractor.cpp
@@ -175,18 +175,14 @@ void PointExtractor::color_to_grayscale(const cv::Mat& frame, cv::Mat1b& output)
filter_single_channel(frame, 0.5, -1, 0.5, output);
break;
}
- case pt_color_average:
- {
- const int W = frame.cols, H = frame.rows, sz = W*H;
- cv::reduce(frame.reshape(1, sz),
- output.reshape(1, sz),
- 1, cv::REDUCE_AVG);
- break;
- }
+ case pt_color_hardware:
+ eval_once(qDebug() << "camera driver doesn't support grayscale");
+ goto do_grayscale;
default:
eval_once(qDebug() << "wrong pt_color_type enum value" << int(s.blob_color));
[[fallthrough]];
- case pt_color_natural:
+ case pt_color_bt709:
+do_grayscale:
cv::cvtColor(frame, output, cv::COLOR_BGR2GRAY);
break;
}
diff --git a/tracker-pt/pt-settings.hpp b/tracker-pt/pt-settings.hpp
index cce2ba6b..54f13283 100644
--- a/tracker-pt/pt-settings.hpp
+++ b/tracker-pt/pt-settings.hpp
@@ -8,9 +8,9 @@ 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_bt709 = 2,
+ pt_color_hardware = 14,
pt_color_red_only = 3,
- pt_color_average = 5,
pt_color_blue_only = 6,
pt_color_green_only = 7,
pt_color_red_chromakey = 8,
@@ -63,7 +63,7 @@ struct pt_settings final : options::opts
value<bool> dynamic_pose { b, "dynamic-pose-resolution", false };
value<int> init_phase_timeout { b, "init-phase-timeout", 250 };
value<bool> auto_threshold { b, "automatic-threshold", true };
- value<pt_color_type> blob_color { b, "blob-color", pt_color_natural };
+ value<pt_color_type> blob_color { b, "blob-color", pt_color_bt709 };
value<bool> use_mjpeg { b, "use-mjpeg", false };
value<slider_value> threshold_slider { b, "threshold-slider", { 128, 0, 255 } };