From 81d2ffa8b95f0dce0a89784d08fe3ba9501cca1e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 6 Jul 2015 10:01:13 +0200 Subject: initial camera-settings class --- opentrack/opencv-camera-dialog.hpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 opentrack/opencv-camera-dialog.hpp (limited to 'opentrack/opencv-camera-dialog.hpp') 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 +#include +#include +#include "opentrack/camera-names.hpp" + +template +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(""); + } +}; + -- cgit v1.2.3