From dec625e51878c9167100837086f82fb0f78b0189 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 5 Sep 2016 20:31:01 +0200 Subject: tracker/{aruco,pt}: remove camera settings button It's broken and users complain on the issue tracker. Also fix tab stops. --- cv/camera-dialog.cpp | 71 --------------------- cv/camera-dialog.hpp | 37 ----------- tracker-aruco/aruco-trackercontrols.ui | 81 ++++++++++++----------- tracker-aruco/ftnoir_tracker_aruco.cpp | 6 -- tracker-aruco/ftnoir_tracker_aruco.h | 7 +- tracker-pt/FTNoIR_PT_Controls.ui | 110 +++++++++++++------------------- tracker-pt/ftnoir_tracker_pt.h | 1 - tracker-pt/ftnoir_tracker_pt_dialog.cpp | 9 --- tracker-pt/ftnoir_tracker_pt_dialog.h | 6 +- 9 files changed, 94 insertions(+), 234 deletions(-) delete mode 100644 cv/camera-dialog.cpp delete mode 100644 cv/camera-dialog.hpp 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 - - * 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 -#include - -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 - - * 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 -#endif - -#ifdef _WIN32 -# include -#endif - -#include -#include - -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 -}; diff --git a/tracker-aruco/aruco-trackercontrols.ui b/tracker-aruco/aruco-trackercontrols.ui index 807fa909..ed1c1edf 100644 --- a/tracker-aruco/aruco-trackercontrols.ui +++ b/tracker-aruco/aruco-trackercontrols.ui @@ -10,7 +10,7 @@ 0 0 485 - 202 + 180 @@ -40,6 +40,20 @@ + + + + Camera name + + + + + + + Resolution + + + @@ -70,27 +84,6 @@ - - - - Camera name - - - - - - - Resolution - - - - - - - Diagonal FOV - - - @@ -131,6 +124,13 @@ + + + + Diagonal FOV + + + @@ -141,20 +141,6 @@ - - - - Camera settings - - - - - - - Open - - - @@ -174,6 +160,19 @@ + + + + Qt::Vertical + + + + 20 + 0 + + + + @@ -264,6 +263,16 @@ + + cameraFOV + cameraFPS + cameraName + resolution + cx + cy + cz + btn_calibrate + diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp index 4fc5405f..d59ac9be 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.cpp +++ b/tracker-aruco/ftnoir_tracker_aruco.cpp @@ -426,7 +426,6 @@ TrackerControls::TrackerControls() connect(ui.btn_calibrate, SIGNAL(clicked()), this, SLOT(toggleCalibrate())); connect(this, SIGNAL(destroyed()), this, SLOT(cleanupCalib())); connect(&calib_timer, SIGNAL(timeout()), this, SLOT(update_tracker_calibration())); - connect(ui.camera_settings, SIGNAL(clicked()), this, SLOT(camera_settings())); } void TrackerControls::toggleCalibrate() @@ -478,9 +477,4 @@ void TrackerControls::doCancel() close(); } -void TrackerControls::camera_settings() -{ - open_camera_settings(tracker ? &tracker->camera : nullptr, s.camera_name, tracker ? &tracker->camera_mtx : nullptr); -} - OPENTRACK_DECLARE_TRACKER(Tracker, TrackerControls, TrackerDll) diff --git a/tracker-aruco/ftnoir_tracker_aruco.h b/tracker-aruco/ftnoir_tracker_aruco.h index 1dd08cb1..101060f7 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.h +++ b/tracker-aruco/ftnoir_tracker_aruco.h @@ -11,11 +11,11 @@ #include "api/plugin-api.hpp" #include "include/markerdetector.h" -#include "cv/camera-dialog.hpp" #include "cv/video-widget.hpp" #include "cv/translation-calibrator.hpp" -#include +#include +#include #include #include @@ -106,7 +106,7 @@ private: static constexpr double alpha_ = .95; }; -class TrackerControls : public ITrackerDialog, protected camera_dialog +class TrackerControls : public ITrackerDialog { Q_OBJECT public: @@ -125,7 +125,6 @@ private slots: void toggleCalibrate(); void cleanupCalib(); void update_tracker_calibration(); - void camera_settings(); }; class TrackerDll : public Metadata diff --git a/tracker-pt/FTNoIR_PT_Controls.ui b/tracker-pt/FTNoIR_PT_Controls.ui index 54628964..2675f1a4 100644 --- a/tracker-pt/FTNoIR_PT_Controls.ui +++ b/tracker-pt/FTNoIR_PT_Controls.ui @@ -10,7 +10,7 @@ 0 0 424 - 579 + 568 @@ -83,25 +83,16 @@ - - + + - + 0 0 - - Desired capture height - - - px - - - 2000 - - - 10 + + Width @@ -118,19 +109,6 @@ - - - - - 0 - 0 - - - - Width - - - @@ -147,23 +125,25 @@ - - - - - - - - - + + - + 0 0 - - Dynamic pose resolution + + Desired capture height + + + px + + + 2000 + + + 10 @@ -193,6 +173,26 @@ + + + + + + + + + + + + 0 + 0 + + + + Dynamic pose resolution + + + @@ -241,19 +241,6 @@ - - - - - 0 - 0 - - - - 10 - - - @@ -270,23 +257,16 @@ - - - - Camera settings dialog - - - - - + + - + 0 0 - - Open + + 10 diff --git a/tracker-pt/ftnoir_tracker_pt.h b/tracker-pt/ftnoir_tracker_pt.h index 04a6646f..29902260 100644 --- a/tracker-pt/ftnoir_tracker_pt.h +++ b/tracker-pt/ftnoir_tracker_pt.h @@ -15,7 +15,6 @@ #include "point_extractor.h" #include "point_tracker.h" #include "compat/timer.hpp" -#include "cv/camera-dialog.hpp" #include "cv/video-widget.hpp" #include "compat/pi-constant.hpp" diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.cpp b/tracker-pt/ftnoir_tracker_pt_dialog.cpp index 88465c42..f5cabe4b 100644 --- a/tracker-pt/ftnoir_tracker_pt_dialog.cpp +++ b/tracker-pt/ftnoir_tracker_pt_dialog.cpp @@ -72,21 +72,12 @@ TrackerDialog_PT::TrackerDialog_PT() connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); - connect(ui.camera_settings, SIGNAL(clicked()), this, SLOT(camera_settings())); timer.start(250); connect(&calib_timer, &QTimer::timeout, this, &TrackerDialog_PT::trans_calib_step); calib_timer.setInterval(100); } -void TrackerDialog_PT::camera_settings() -{ - if (tracker) - open_camera_settings(static_cast(tracker->camera), s.camera_name, &tracker->camera_mtx); - else - open_camera_settings(nullptr, s.camera_name, nullptr); -} - void TrackerDialog_PT::startstop_trans_calib(bool start) { if (start) diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.h b/tracker-pt/ftnoir_tracker_pt_dialog.h index c13c1216..b57e32c3 100644 --- a/tracker-pt/ftnoir_tracker_pt_dialog.h +++ b/tracker-pt/ftnoir_tracker_pt_dialog.h @@ -12,15 +12,12 @@ #include "ftnoir_tracker_pt_settings.h" #include "ftnoir_tracker_pt.h" #include "ui_FTNoIR_PT_Controls.h" -#include "cv/camera-dialog.hpp" #include "cv/translation-calibrator.hpp" #include "cv/video-widget.hpp" #include -//----------------------------------------------------------------------------- -// The dialog that shows up when the user presses "Settings" -class TrackerDialog_PT : public ITrackerDialog, protected camera_dialog +class TrackerDialog_PT : public ITrackerDialog { Q_OBJECT public: @@ -35,7 +32,6 @@ public slots: void startstop_trans_calib(bool start); void trans_calib_step(); void poll_tracker_info(); - void camera_settings(); private: settings_pt s; Tracker_PT* tracker; -- cgit v1.2.3