summaryrefslogtreecommitdiffhomepage
path: root/opentrack
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-07-06 10:01:13 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-07-06 10:46:01 +0200
commit81d2ffa8b95f0dce0a89784d08fe3ba9501cca1e (patch)
tree195f2130eef3ca81cb51e161d40045c81399f0ef /opentrack
parent6b1e8a3c434e9692257f21801c332a30dc2d5d48 (diff)
initial camera-settings class
Diffstat (limited to 'opentrack')
-rw-r--r--opentrack/opencv-camera-dialog.hpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/opentrack/opencv-camera-dialog.hpp b/opentrack/opencv-camera-dialog.hpp
new file mode 100644
index 00000000..3b700a70
--- /dev/null
+++ b/opentrack/opencv-camera-dialog.hpp
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <QMutex>
+#include <QMutexLocker>
+#include <opencv2/videoio.hpp>
+#include "opentrack/camera-names.hpp"
+
+template<typename tracker>
+class camera_dialog
+{
+ cv::VideoCapture fake_capture;
+public:
+ void open_camera_settings(cv::VideoCapture* cap, const QString& camera_name, QMutex* camera_mtx)
+ {
+ if (cap)
+ {
+ QMutexLocker l(camera_mtx);
+
+ if (cap->isOpened())
+ {
+ cap->set(cv::CAP_PROP_SETTINGS, 1);
+ return;
+ }
+ }
+
+ fake_capture = cv::VideoCapture(camera_name_to_index(camera_name));
+ fake_capture.set(cv::CAP_PROP_SETTINGS, 1);
+ // don't hog the camera capture
+ fake_capture.open("");
+ }
+};
+