From f4b1e06604c74bb56a88c7e9284c77ffbd1acc78 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 6 Jul 2015 12:44:13 +0200 Subject: make "make_dylib_instance" part of public API For @gagagu. Issue: #151 --- opentrack/plugin-support.hpp | 9 +++++++++ opentrack/selected-libraries.cpp | 15 +++------------ 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'opentrack') diff --git a/opentrack/plugin-support.hpp b/opentrack/plugin-support.hpp index 627bce6a..32f79e0e 100644 --- a/opentrack/plugin-support.hpp +++ b/opentrack/plugin-support.hpp @@ -247,3 +247,12 @@ private: return ret; } }; + +template +mem make_dylib_instance(mem lib) +{ + mem ret; + if (lib != nullptr && lib->Constructor) + ret = mem(reinterpret_cast(reinterpret_cast(lib->Constructor)())); + return ret; +} diff --git a/opentrack/selected-libraries.cpp b/opentrack/selected-libraries.cpp index 7617ce90..c39ee3f5 100644 --- a/opentrack/selected-libraries.cpp +++ b/opentrack/selected-libraries.cpp @@ -5,22 +5,13 @@ SelectedLibraries::~SelectedLibraries() { } -template -static mem make_instance(mem lib) -{ - mem ret; - if (lib != nullptr && lib->Constructor) - ret = mem(reinterpret_cast(reinterpret_cast(lib->Constructor)())); - return ret; -} - SelectedLibraries::SelectedLibraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f) : pTracker(nullptr), pFilter(nullptr), pProtocol(nullptr), correct(false) { - pProtocol = make_instance(p); + pProtocol = make_dylib_instance(p); if (!pProtocol) { @@ -35,8 +26,8 @@ SelectedLibraries::SelectedLibraries(QFrame* frame, dylibptr t, dylibptr p, dyli return; } - pTracker = make_instance(t); - pFilter = make_instance(f); + pTracker = make_dylib_instance(t); + pFilter = make_dylib_instance(f); if (!pTracker) { -- cgit v1.2.3 From 71b9202dbd592996478cb3ab67a84c23fd98368e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 7 Jul 2015 07:45:35 +0200 Subject: opentrack-api: add copyright notices Code without a license defaults to having all rights reserved. --- opentrack/mappings.hpp | 7 +++++++ opentrack/options.hpp | 2 +- opentrack/plugin-support.hpp | 4 ++-- opentrack/selected-libraries.hpp | 8 ++++++++ opentrack/shortcuts.h | 8 ++++++++ opentrack/simple-mat.hpp | 8 ++++++++ opentrack/state.hpp | 8 ++++++++ opentrack/thread.hpp | 8 ++++++++ opentrack/timer.hpp | 8 ++++++++ opentrack/tracker.h | 8 ++++++++ opentrack/work.hpp | 8 ++++++++ 11 files changed, 74 insertions(+), 3 deletions(-) (limited to 'opentrack') diff --git a/opentrack/mappings.hpp b/opentrack/mappings.hpp index 3336dcd8..650e6f99 100644 --- a/opentrack/mappings.hpp +++ b/opentrack/mappings.hpp @@ -1,3 +1,10 @@ +/* Copyright (c) 2014-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 diff --git a/opentrack/options.hpp b/opentrack/options.hpp index a10ba382..f4deb8a1 100644 --- a/opentrack/options.hpp +++ b/opentrack/options.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014 Stanislaw Halik +/* Copyright (c) 2013-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 diff --git a/opentrack/plugin-support.hpp b/opentrack/plugin-support.hpp index 32f79e0e..ec8bb3c8 100644 --- a/opentrack/plugin-support.hpp +++ b/opentrack/plugin-support.hpp @@ -1,5 +1,3 @@ -#pragma once - /* Copyright (c) 2015 Stanislaw Halik * * Permission to use, copy, modify, and/or distribute this software for any @@ -7,6 +5,8 @@ * copyright notice and this permission notice appear in all copies. */ +#pragma once + #include "plugin-api.hpp" #include "options.hpp" diff --git a/opentrack/selected-libraries.hpp b/opentrack/selected-libraries.hpp index ffaf882c..2813cd27 100644 --- a/opentrack/selected-libraries.hpp +++ b/opentrack/selected-libraries.hpp @@ -1,3 +1,11 @@ +/* Copyright (c) 2014-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 "opentrack/plugin-support.hpp" diff --git a/opentrack/shortcuts.h b/opentrack/shortcuts.h index ee0d9777..520042f0 100644 --- a/opentrack/shortcuts.h +++ b/opentrack/shortcuts.h @@ -1,3 +1,11 @@ +/* Copyright (c) 2014-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 #include diff --git a/opentrack/simple-mat.hpp b/opentrack/simple-mat.hpp index 1cea967e..e111305a 100644 --- a/opentrack/simple-mat.hpp +++ b/opentrack/simple-mat.hpp @@ -1,3 +1,11 @@ +/* Copyright (c) 2014-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 #include diff --git a/opentrack/state.hpp b/opentrack/state.hpp index bfbf113e..e4cb0f04 100644 --- a/opentrack/state.hpp +++ b/opentrack/state.hpp @@ -1,3 +1,11 @@ +/* Copyright (c) 2014-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 diff --git a/opentrack/thread.hpp b/opentrack/thread.hpp index b1db9158..946f2972 100644 --- a/opentrack/thread.hpp +++ b/opentrack/thread.hpp @@ -1,3 +1,11 @@ +/* Copyright (c) 2014-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 diff --git a/opentrack/timer.hpp b/opentrack/timer.hpp index eb956213..fd710499 100644 --- a/opentrack/timer.hpp +++ b/opentrack/timer.hpp @@ -1,3 +1,11 @@ +/* Copyright (c) 2014-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 #if defined (_WIN32) diff --git a/opentrack/tracker.h b/opentrack/tracker.h index d4dc149f..8aeaf1c5 100644 --- a/opentrack/tracker.h +++ b/opentrack/tracker.h @@ -1,3 +1,11 @@ +/* Copyright (c) 2014-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 diff --git a/opentrack/work.hpp b/opentrack/work.hpp index eb5bd4ff..39eb12fb 100644 --- a/opentrack/work.hpp +++ b/opentrack/work.hpp @@ -1,3 +1,11 @@ +/* Copyright (c) 2014-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 "opentrack/main-settings.hpp" -- cgit v1.2.3 From 511e095fa3b944b2016560e6bb21e3f0413aa1a4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 7 Jul 2015 11:24:40 +0200 Subject: includes relative to project top directory --- ftnoir_protocol_ft/ftnoir_protocol_ft.h | 2 +- opentrack/mappings.hpp | 2 +- opentrack/tracker.h | 2 +- qfunctionconfigurator/functionconfig.h | 2 +- qfunctionconfigurator/qfunctionconfigurator.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'opentrack') diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h index ade6ac75..3fe9952d 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h @@ -38,7 +38,7 @@ #include #include "compat/compat.h" #include "opentrack/options.hpp" -#include "../freetrackclient/fttypes.h" +#include "freetrackclient/fttypes.h" using namespace options; struct settings : opts { diff --git a/opentrack/mappings.hpp b/opentrack/mappings.hpp index 650e6f99..85d9900c 100644 --- a/opentrack/mappings.hpp +++ b/opentrack/mappings.hpp @@ -10,7 +10,7 @@ #include #include "options.hpp" using namespace options; -#include "../qfunctionconfigurator/functionconfig.h" +#include "qfunctionconfigurator/functionconfig.h" #include "main-settings.hpp" class Mapping { diff --git a/opentrack/tracker.h b/opentrack/tracker.h index 8aeaf1c5..453357c4 100644 --- a/opentrack/tracker.h +++ b/opentrack/tracker.h @@ -17,7 +17,7 @@ #include "simple-mat.hpp" #include "selected-libraries.hpp" -#include "../qfunctionconfigurator/functionconfig.h" +#include "qfunctionconfigurator/functionconfig.h" #include "main-settings.hpp" #include "options.hpp" diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h index 4ce5efee..bd8be140 100644 --- a/qfunctionconfigurator/functionconfig.h +++ b/qfunctionconfigurator/functionconfig.h @@ -14,7 +14,7 @@ #include #include #include -#include "../opentrack/qcopyable-mutex.hpp" +#include "opentrack/qcopyable-mutex.hpp" class Map { private: diff --git a/qfunctionconfigurator/qfunctionconfigurator.cpp b/qfunctionconfigurator/qfunctionconfigurator.cpp index e1c40396..11eb8a71 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.cpp +++ b/qfunctionconfigurator/qfunctionconfigurator.cpp @@ -1,4 +1,4 @@ -#include "../opentrack/options.hpp" +#include "opentrack/options.hpp" using namespace options; #include "qfunctionconfigurator/qfunctionconfigurator.h" #include -- cgit v1.2.3 From cdbe9e8ea3283dde4667098e8b35f09b94cbcfc4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 7 Jul 2015 11:49:12 +0200 Subject: camera dialog: don't crash due to race condition We have no idea when the capture can be closed, so wait for three seconds instead. --- opentrack/opencv-camera-dialog.hpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'opentrack') diff --git a/opentrack/opencv-camera-dialog.hpp b/opentrack/opencv-camera-dialog.hpp index 3b700a70..6218f125 100644 --- a/opentrack/opencv-camera-dialog.hpp +++ b/opentrack/opencv-camera-dialog.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -9,6 +10,14 @@ template class camera_dialog { cv::VideoCapture fake_capture; + QTimer t; + +private: + void delete_capture() + { + fake_capture.open(""); + } + public: void open_camera_settings(cv::VideoCapture* cap, const QString& camera_name, QMutex* camera_mtx) { @@ -23,10 +32,20 @@ public: } } + if (t.isActive()) + return; + + // don't hog the camera capture + if (!t.isSingleShot()) + QObject::connect(&t, &QTimer::timeout, [&]() -> void { delete_capture(); }); + + t.setSingleShot(true); + t.setInterval(3000); + 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(""); + // HACK: we're not notified when it's safe to close the capture + t.start(); } }; -- cgit v1.2.3 From daef1862f1ef7a1332253ee427b9726316ba6328 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 7 Jul 2015 13:59:49 +0200 Subject: tracker: camera angle affected translation twice --- opentrack/tracker.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'opentrack') diff --git a/opentrack/tracker.cpp b/opentrack/tracker.cpp index c124111f..0d4d8c2c 100644 --- a/opentrack/tracker.cpp +++ b/opentrack/tracker.cpp @@ -106,7 +106,6 @@ void Tracker::logic() dmat<3, 1> t { value(0), value(1), value(2) }; r = cam * r; - t = cam * t; bool can_center = false; -- cgit v1.2.3