diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-09-05 20:31:01 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-09-05 20:31:01 +0200 |
commit | dec625e51878c9167100837086f82fb0f78b0189 (patch) | |
tree | 43f0e083d0630952ae666f588e2b43c8f358ac4f /cv | |
parent | 420748abc9b5cd13b4f0d98068619e90d503450d (diff) |
tracker/{aruco,pt}: remove camera settings button
It's broken and users complain on the issue tracker.
Also fix tab stops.
Diffstat (limited to 'cv')
-rw-r--r-- | cv/camera-dialog.cpp | 71 | ||||
-rw-r--r-- | cv/camera-dialog.hpp | 37 |
2 files changed, 0 insertions, 108 deletions
diff --git a/cv/camera-dialog.cpp b/cv/camera-dialog.cpp deleted file mode 100644 index b422e63c..00000000 --- a/cv/camera-dialog.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright (c) 2015, Stanislaw Halik <sthalik@misaki.pl> - - * Permission to use, copy, modify, and/or distribute this - * software for any purpose with or without fee is hereby granted, - * provided that the above copyright notice and this permission - * notice appear in all copies. - */ - -#include "cv/camera-dialog.hpp" -#include <QDebug> -#include <QMutexLocker> - -void camera_dialog::maybe_grab_frame(cv::VideoCapture& cap) -{ - for (int i = 0; i < 60; i++) - { - if (cap.grab()) - break; - portable::sleep(50); - } -} - -camera_dialog::~camera_dialog() {} - -void camera_dialog::open_camera_settings(cv::VideoCapture* cap, const QString& camera_name, QMutex* camera_mtx) -{ -#ifdef _WIN32 - init_com_threading(); - - if (cap) - { - QMutexLocker l(camera_mtx); - - if (cap->isOpened()) - { - maybe_grab_frame(*cap); - cap->set(cv::CAP_PROP_SETTINGS, 1); - return; - } - } - - if (t.isActive()) - t.stop(); - - // don't hog the camera capture - if (!t.isSingleShot()) - QObject::connect(&t, &QTimer::timeout, [&]() -> void { delete_capture(); }); - - fake_capture = cv::VideoCapture(camera_name_to_index(camera_name)); - maybe_grab_frame(fake_capture); - fake_capture.set(cv::CAP_PROP_SETTINGS, 1); - - t.setSingleShot(true); - t.setInterval(5000); - - // HACK: we're not notified when it's safe to close the capture - t.start(); -#elif defined(__linux) - int idx = camera_name_to_index(camera_name); - QProcess::startDetached("qv4l2", QStringList() << "-d" << ("/dev/video" + QString::number(idx))); -#else - // nothing -#endif -} - -#ifdef _WIN32 -void camera_dialog::delete_capture() -{ - fake_capture.open(""); -} -#endif diff --git a/cv/camera-dialog.hpp b/cv/camera-dialog.hpp deleted file mode 100644 index c5896ca3..00000000 --- a/cv/camera-dialog.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (c) 2015, Stanislaw Halik <sthalik@misaki.pl> - - * Permission to use, copy, modify, and/or distribute this - * software for any purpose with or without fee is hereby granted, - * provided that the above copyright notice and this permission - * notice appear in all copies. - */ - -#pragma once - -#include "compat/camera-names.hpp" -#include "compat/sleep.hpp" -#include "compat/win32-com.hpp" - -#ifdef __linux -# include <QProcess> -#endif - -#ifdef _WIN32 -# include <QTimer> -#endif - -#include <opencv2/videoio.hpp> -#include <QMutex> - -class camera_dialog -{ - static void maybe_grab_frame(cv::VideoCapture& cap); -public: - virtual ~camera_dialog(); - void open_camera_settings(cv::VideoCapture*, const QString&, QMutex*); -#if defined(_WIN32) - cv::VideoCapture fake_capture; - QTimer t; - void delete_capture(); -#endif -}; |