summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tracker-neuralnet/ftnoir_tracker_neuralnet.cpp16
-rw-r--r--tracker-neuralnet/ftnoir_tracker_neuralnet.h3
-rw-r--r--tracker-neuralnet/lang/nl_NL.ts4
-rw-r--r--tracker-neuralnet/lang/ru_RU.ts4
-rw-r--r--tracker-neuralnet/lang/stub.ts4
-rw-r--r--tracker-neuralnet/lang/zh_CN.ts4
-rw-r--r--tracker-neuralnet/neuralnet-trackercontrols.ui52
-rw-r--r--video-opencv/impl-camera.cpp17
-rw-r--r--video-opencv/impl.hpp3
-rw-r--r--video-opencv/settings.hpp13
10 files changed, 104 insertions, 16 deletions
diff --git a/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp b/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp
index d8077326..cbfb3496 100644
--- a/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp
+++ b/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp
@@ -750,6 +750,22 @@ NeuralNetDialog::NeuralNetDialog() :
tie_setting(settings_.force_fps, ui_.cameraFPS);
#endif
+ {
+ const struct {
+ QString label;
+ exposure_preset preset;
+ } presets[] = {
+ { QStringLiteral("Near (1-4ft)"), exposure_preset::near },
+ { QStringLiteral("Far (4-8ft)"), exposure_preset::far },
+ { QStringLiteral("Custom"), exposure_preset::ignored },
+ };
+
+ for (const auto& [label, preset] : presets)
+ ui_.exposure_preset->addItem(label, int(preset));
+
+ tie_setting(cs_.exposure_preset, ui_.exposure_preset);
+ }
+
connect(ui_.buttonBox, SIGNAL(accepted()), this, SLOT(doOK()));
connect(ui_.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel()));
connect(ui_.camera_settings, SIGNAL(clicked()), this, SLOT(camera_settings()));
diff --git a/tracker-neuralnet/ftnoir_tracker_neuralnet.h b/tracker-neuralnet/ftnoir_tracker_neuralnet.h
index df71a7a8..d44a9953 100644
--- a/tracker-neuralnet/ftnoir_tracker_neuralnet.h
+++ b/tracker-neuralnet/ftnoir_tracker_neuralnet.h
@@ -20,6 +20,7 @@
#include "compat/timer.hpp"
#include "video/camera.hpp"
#include "cv/affine.hpp"
+#include "video-opencv/settings.hpp"
#include <QObject>
#include <QThread>
@@ -176,6 +177,8 @@ private:
Ui::Form ui_;
Settings settings_;
+ dshow_camera_settings cs_;
+
// Calibration code mostly taken from point tracker
QTimer calib_timer_;
TranslationCalibrator trans_calib_;
diff --git a/tracker-neuralnet/lang/nl_NL.ts b/tracker-neuralnet/lang/nl_NL.ts
index 25742b8f..09a2ebd7 100644
--- a/tracker-neuralnet/lang/nl_NL.ts
+++ b/tracker-neuralnet/lang/nl_NL.ts
@@ -40,6 +40,10 @@ Don&apos;t roll or change position.</source>
<source>Up</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Exposure preset</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>neuralnet_tracker_ns::NeuralNetDialog</name>
diff --git a/tracker-neuralnet/lang/ru_RU.ts b/tracker-neuralnet/lang/ru_RU.ts
index 5b311a19..3b1bb257 100644
--- a/tracker-neuralnet/lang/ru_RU.ts
+++ b/tracker-neuralnet/lang/ru_RU.ts
@@ -40,6 +40,10 @@ Don&apos;t roll or change position.</source>
<source>Up</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Exposure preset</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>neuralnet_tracker_ns::NeuralNetDialog</name>
diff --git a/tracker-neuralnet/lang/stub.ts b/tracker-neuralnet/lang/stub.ts
index 62ce527b..8461ce0f 100644
--- a/tracker-neuralnet/lang/stub.ts
+++ b/tracker-neuralnet/lang/stub.ts
@@ -40,6 +40,10 @@ Don&apos;t roll or change position.</source>
<source>Up</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Exposure preset</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>neuralnet_tracker_ns::NeuralNetDialog</name>
diff --git a/tracker-neuralnet/lang/zh_CN.ts b/tracker-neuralnet/lang/zh_CN.ts
index 39a6c0e2..4b24f3db 100644
--- a/tracker-neuralnet/lang/zh_CN.ts
+++ b/tracker-neuralnet/lang/zh_CN.ts
@@ -40,6 +40,10 @@ Don&apos;t roll or change position.</source>
<source>Up</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>Exposure preset</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>neuralnet_tracker_ns::NeuralNetDialog</name>
diff --git a/tracker-neuralnet/neuralnet-trackercontrols.ui b/tracker-neuralnet/neuralnet-trackercontrols.ui
index 01fdd4bd..c03f866c 100644
--- a/tracker-neuralnet/neuralnet-trackercontrols.ui
+++ b/tracker-neuralnet/neuralnet-trackercontrols.ui
@@ -10,21 +10,14 @@
<x>0</x>
<y>0</y>
<width>445</width>
- <height>226</height>
+ <height>355</height>
</rect>
</property>
<property name="windowTitle">
<string>Tracker settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="8" column="0">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- <item row="6" column="0">
+ <item row="7" column="0">
<widget class="QLabel" name="resolution_display">
<property name="autoFillBackground">
<bool>true</bool>
@@ -260,7 +253,7 @@ Don't roll or change position.</string>
</layout>
</widget>
</item>
- <item row="4" column="0">
+ <item row="5" column="0">
<widget class="QPushButton" name="camera_settings">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -273,6 +266,45 @@ Don't roll or change position.</string>
</property>
</widget>
</item>
+ <item row="9" column="0">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Camera settings</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Exposure preset</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="exposure_preset">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
</layout>
</widget>
<resources/>
diff --git a/video-opencv/impl-camera.cpp b/video-opencv/impl-camera.cpp
index 543f9dff..9e749d75 100644
--- a/video-opencv/impl-camera.cpp
+++ b/video-opencv/impl-camera.cpp
@@ -47,12 +47,17 @@ bool cam::start(info& args)
if (args.use_mjpeg)
cap->set(cv::CAP_PROP_FOURCC, cv::VideoWriter::fourcc('M', 'J', 'P', 'G'));
-#if 1
- cap->set(cv::CAP_PROP_AUTO_EXPOSURE, 0);
- //cap->set(cv::CAP_PROP_SHARPNESS, 0);
- if (auto exp = cap->get(cv::CAP_PROP_EXPOSURE); exp > -4 || exp < -5)
- cap->set(cv::CAP_PROP_EXPOSURE, -5);
-#endif
+ if (s.exposure_preset != exposure_preset::ignored)
+ {
+ cap->set(cv::CAP_PROP_AUTO_EXPOSURE, 0);
+ //cap->set(cv::CAP_PROP_SHARPNESS, 0);
+ switch (s.exposure_preset)
+ {
+ case exposure_preset::near: cap->set(cv::CAP_PROP_EXPOSURE, -5); break;
+ case exposure_preset::far: cap->set(cv::CAP_PROP_EXPOSURE, -4); break;
+ default: break;
+ }
+ }
if (!cap->isOpened())
goto fail;
diff --git a/video-opencv/impl.hpp b/video-opencv/impl.hpp
index ed5499b0..88ae069d 100644
--- a/video-opencv/impl.hpp
+++ b/video-opencv/impl.hpp
@@ -8,6 +8,7 @@
#pragma once
#include "video/camera.hpp"
+#include "settings.hpp"
#include <optional>
#include <opencv2/videoio.hpp>
@@ -46,6 +47,8 @@ static constexpr int video_capture_backend =
bool get_frame_();
+ dshow_camera_settings s;
+
std::optional<cv::VideoCapture> cap;
cv::Mat mat;
frame frame_;
diff --git a/video-opencv/settings.hpp b/video-opencv/settings.hpp
new file mode 100644
index 00000000..69fb5705
--- /dev/null
+++ b/video-opencv/settings.hpp
@@ -0,0 +1,13 @@
+#pragma once
+#include "options/value.hpp"
+using namespace options;
+
+enum class exposure_preset : int {
+ near, far, ignored,
+ DEFAULT = near,
+};
+
+struct dshow_camera_settings final {
+ bundle b = make_bundle("video-camera");
+ value<exposure_preset> exposure_preset{b, "exposure-preset", exposure_preset::near};
+};