From b2092cb165cfcbdb8d82cb25d379b953600134c8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 16 Jun 2014 03:00:24 +0200 Subject: Revert "update lerp api in filters" This reverts commit a8a21e5618023b2eda49ad013030479528635c54. --- ftnoir_filter_accela/ftnoir_filter_accela.cpp | 4 ++-- ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index b07290e2..a82ff077 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -32,7 +32,7 @@ void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position, { for (int j = 0; j < 3; j++) last_output[j][i] = target_camera_position[i]; - l.write(target_camera_position, target_camera_position, new_camera_position); + l.write(target_camera_position, new_camera_position); } first_run = false; @@ -63,7 +63,7 @@ void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position, } } - l.write(target_camera_position, last_output[0], new_camera_position); + l.write(last_output[0], new_camera_position); } extern "C" FTNOIR_FILTER_BASE_EXPORT IFilter* CALLING_CONVENTION GetConstructor() diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp index d3cb2c32..dcc1475c 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp @@ -71,7 +71,7 @@ void FTNoIR_Filter::FilterHeadPoseData(const double *target_camera_position, for (int i=0;i<6;i++) { delta[i] = 0.0; noise[i] = 0.0; - l.write(target_camera_position, target_camera_position, new_camera_position); + l.write(target_camera_position, new_camera_position); } first_run=false; return; @@ -100,7 +100,7 @@ void FTNoIR_Filter::FilterHeadPoseData(const double *target_camera_position, } } - l.write(target_camera_position, pos, new_camera_position); + l.write(pos, new_camera_position); } extern "C" FTNOIR_FILTER_BASE_EXPORT IFilter* CALLING_CONVENTION GetConstructor() -- cgit v1.2.3 From fa48b03e334e4f70a8f8bac7c7df2513c1cba0b8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 16 Jun 2014 03:00:26 +0200 Subject: Revert "lerp: didn't work at all, now does" This reverts commit a21435cb6fe163d6579f3fd3d42ad11c54037036. --- facetracknoir/lerp.hpp | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/facetracknoir/lerp.hpp b/facetracknoir/lerp.hpp index 0123832a..70d5995c 100644 --- a/facetracknoir/lerp.hpp +++ b/facetracknoir/lerp.hpp @@ -2,52 +2,37 @@ #include "facetracknoir/timer.hpp" #include <algorithm> -#include <cmath> class lerp { private: - static const constexpr double eps = 1e-2; - double last[2][6], cam[6], dt; + double last[2][6], dt; Timer t; public: lerp() : - last { {0,0,0,0,0,0}, {0,0,0,0,0,0} }, cam {0,0,0,0,0,0}, dt(1) + last { {0,0,0,0,0,0}, {0,0,0,0,0,0} }, dt(1) { } bool idempotentp(const double* input) { for (int i = 0; i < 6; i++) - { - double diff = fabs(cam[i] - input[i]); - if (diff > eps) + if (last[0][i] != input[i]) return false; - } return true; } - void write(const double* cam_, const double* input, double* output) + void write(const double* input, double* output) { - const double q = t.elapsed(); - const double d = q/dt; + const double q = dt; + dt = std::max(1, t.start()); - bool idem = idempotentp(cam_); + const double c = std::max(std::min(1.0, q/(double)dt), 0.0); - if (!idem) + for (int i = 0; i < 6; i++) { - dt = q; - t.start(); + last[1][i] = last[0][i]; + last[0][i] = input[i]; } - const double c = std::max(std::min(1.0, d), 0.0); - - if (!idem) - for (int i = 0; i < 6; i++) - { - last[1][i] = last[0][i]; - last[0][i] = input[i]; - cam[i] = cam_[i]; - } - for (int i = 0; i < 6; i++) output[i] = last[1][i] + (last[0][i] - last[1][i]) * c; } -- cgit v1.2.3 From b82ddb17360d66ad7270ad58409f53a6e1900437 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 16 Jun 2014 03:00:27 +0200 Subject: Revert "update accela, ewma to use lerp class" This reverts commit 7428b028ffd95c229c57f8089b97e6bd0af34339. --- ftnoir_filter_accela/ftnoir_filter_accela.cpp | 63 +++++++++++++++++---------- ftnoir_filter_accela/ftnoir_filter_accela.h | 5 +-- ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp | 55 +++++++++++++---------- ftnoir_filter_ewma2/ftnoir_filter_ewma2.h | 3 +- 4 files changed, 76 insertions(+), 50 deletions(-) diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index a82ff077..9fcf4b92 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -30,40 +30,57 @@ void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position, { for (int i = 0; i < 6; i++) { + new_camera_position[i] = target_camera_position[i]; + last_input[i] = target_camera_position[i]; for (int j = 0; j < 3; j++) last_output[j][i] = target_camera_position[i]; - l.write(target_camera_position, new_camera_position); } first_run = false; - return; - } + return; + } + + bool new_frame = false; - if (!l.idempotentp(target_camera_position)) + for (int i = 0; i < 6; i++) { - for (int i=0;i<6;i++) + if (target_camera_position[i] != last_input[i]) { - const double vec = target_camera_position[i] - last_output[0][i]; - const double vec2 = target_camera_position[i] - last_output[1][i]; - const double vec3 = target_camera_position[i] - last_output[2][i]; - const int sign = vec < 0 ? -1 : 1; - const double a = i >= 3 ? s.rotation_alpha : s.translation_alpha; - const double a2 = a * s.second_order_alpha; - const double a3 = a * s.third_order_alpha; - const double deadzone = i >= 3 ? s.rot_deadzone : s.trans_deadzone; - const double velocity = - parabola(a, vec, deadzone, s.expt) + - parabola(a2, vec2, deadzone, s.expt) + - parabola(a3, vec3, deadzone, s.expt); - const double result = last_output[0][i] + velocity; - const bool done = sign > 0 ? result >= target_camera_position[i] : result <= target_camera_position[i]; - last_output[2][i] = last_output[1][i]; - last_output[1][i] = last_output[0][i]; - last_output[0][i] = done ? target_camera_position[i] : result; + new_frame = true; + break; } } - l.write(last_output[0], new_camera_position); + if (!new_frame) + { + for (int i = 0; i < 6; i++) + new_camera_position[i] = last_output[0][i]; + return; + } + + for (int i = 0; i < 6; i++) + last_input[i] = target_camera_position[i]; + + for (int i=0;i<6;i++) + { + const double vec = target_camera_position[i] - last_output[0][i]; + const double vec2 = target_camera_position[i] - last_output[1][i]; + const double vec3 = target_camera_position[i] - last_output[2][i]; + const int sign = vec < 0 ? -1 : 1; + const double a = i >= 3 ? s.rotation_alpha : s.translation_alpha; + const double a2 = a * s.second_order_alpha; + const double a3 = a * s.third_order_alpha; + const double deadzone = i >= 3 ? s.rot_deadzone : s.trans_deadzone; + const double velocity = + parabola(a, vec, deadzone, s.expt) + + parabola(a2, vec2, deadzone, s.expt) + + parabola(a3, vec3, deadzone, s.expt); + const double result = last_output[0][i] + velocity; + const bool done = sign > 0 ? result >= target_camera_position[i] : result <= target_camera_position[i]; + last_output[2][i] = last_output[1][i]; + last_output[1][i] = last_output[0][i]; + last_output[0][i] = new_camera_position[i] = done ? target_camera_position[i] : result; + } } extern "C" FTNOIR_FILTER_BASE_EXPORT IFilter* CALLING_CONVENTION GetConstructor() diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index 2187fd01..8cf7fe66 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -2,7 +2,6 @@ #include "ftnoir_filter_base/ftnoir_filter_base.h" #include "ui_ftnoir_accela_filtercontrols.h" #include "facetracknoir/global-settings.h" -#include "facetracknoir/lerp.hpp" #include <QMutex> #define ACCELA_SMOOTHING_ROTATION 60.0 @@ -45,11 +44,11 @@ public: void receiveSettings() { s.b->reload(); } + private: - lerp l; settings s; bool first_run; - double last_output[3][6]; + double last_input[6], last_output[3][6]; }; class FilterControls: public QWidget, public IFilterDialog diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp index dcc1475c..c073bfa4 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp @@ -64,43 +64,54 @@ void FTNoIR_Filter::FilterHeadPoseData(const double *target_camera_position, { double new_delta, new_noise, norm_noise; double alpha; - double pos[6]; //On the first run, initialize to output=target and return. if (first_run==true) { for (int i=0;i<6;i++) { + new_camera_position[i] = target_camera_position[i]; + current_camera_position[i] = target_camera_position[i]; delta[i] = 0.0; noise[i] = 0.0; - l.write(target_camera_position, new_camera_position); } first_run=false; return; } - if (!l.idempotentp(target_camera_position)) + bool new_frame = false; + + for (int i = 0; i < 6; i++) { - double cur[6]; - l.get_state(cur); - // Calculate the new camera position. - for (int i=0;i<6;i++) { - // Calculate the current and smoothed delta. - new_delta = target_camera_position[i]-cur[i]; - delta[i] = delta_smoothing*new_delta + (1.0-delta_smoothing)*delta[i]; - // Calculate the current and smoothed noise variance. - new_noise = delta[i]*delta[i]; - noise[i] = noise_smoothing*new_noise + (1.0-noise_smoothing)*noise[i]; - // Normalise the noise between 0->1 for 0->9 variances (0->3 stddevs). - norm_noise = std::min<double>(new_noise/(9.0*noise[i]), 1.0); - // Calculate the alpha from the normalized noise. - // TODO(abo): change kSmoothingScaleCurve to a float where 1.0 is sqrt(norm_noise). - alpha = 1.0/(s.kMinSmoothing+(1.0-pow(norm_noise,s.kSmoothingScaleCurve/20.0))*(s.kMaxSmoothing-s.kMinSmoothing)); - // Update the current camera position to the new position. - double value = alpha*target_camera_position[i] + (1.0-alpha)*cur[i]; - pos[i] = value; + if (target_camera_position[i] != current_camera_position[i]) + { + new_frame = true; + break; } } - l.write(pos, new_camera_position); + if (!new_frame) + { + for (int i = 0; i < 6; i++) + new_camera_position[i] = current_camera_position[i]; + return; + } + + // Calculate the new camera position. + for (int i=0;i<6;i++) { + // Calculate the current and smoothed delta. + new_delta = target_camera_position[i]-current_camera_position[i]; + delta[i] = delta_smoothing*new_delta + (1.0-delta_smoothing)*delta[i]; + // Calculate the current and smoothed noise variance. + new_noise = delta[i]*delta[i]; + noise[i] = noise_smoothing*new_noise + (1.0-noise_smoothing)*noise[i]; + // Normalise the noise between 0->1 for 0->9 variances (0->3 stddevs). + norm_noise = std::min<double>(new_noise/(9.0*noise[i]), 1.0); + // Calculate the alpha from the normalized noise. + // TODO(abo): change kSmoothingScaleCurve to a float where 1.0 is sqrt(norm_noise). + alpha = 1.0/(s.kMinSmoothing+(1.0-pow(norm_noise,s.kSmoothingScaleCurve/20.0))*(s.kMaxSmoothing-s.kMinSmoothing)); + // Update the current camera position to the new position. + double pos = alpha*target_camera_position[i] + (1.0-alpha)*current_camera_position[i]; + new_camera_position[i] = current_camera_position[i] = pos; + } } extern "C" FTNOIR_FILTER_BASE_EXPORT IFilter* CALLING_CONVENTION GetConstructor() diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h index ea25a135..bde3e79c 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h @@ -32,7 +32,6 @@ #include <QWidget> #include <QMutex> #include "facetracknoir/options.h" -#include "facetracknoir/lerp.hpp" using namespace options; struct settings { @@ -62,8 +61,8 @@ private: double noise_smoothing; double delta[6]; double noise[6]; + double current_camera_position[6]; settings s; - lerp l; }; class FilterControls: public QWidget, public IFilterDialog -- cgit v1.2.3 From 4d3df8df632d9230389fa2ffec6c4b28fa2985ff Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 16 Jun 2014 03:00:27 +0200 Subject: Revert "lerp class to simplify filter flow" This reverts commit 5409f26675a444170b3a68fc9750742cc68aaa1d. --- facetracknoir/lerp.hpp | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 facetracknoir/lerp.hpp diff --git a/facetracknoir/lerp.hpp b/facetracknoir/lerp.hpp deleted file mode 100644 index 70d5995c..00000000 --- a/facetracknoir/lerp.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include "facetracknoir/timer.hpp" -#include <algorithm> - -class lerp { -private: - double last[2][6], dt; - Timer t; -public: - lerp() : - last { {0,0,0,0,0,0}, {0,0,0,0,0,0} }, dt(1) - { - } - bool idempotentp(const double* input) - { - for (int i = 0; i < 6; i++) - if (last[0][i] != input[i]) - return false; - return true; - } - - void write(const double* input, double* output) - { - const double q = dt; - dt = std::max(1, t.start()); - - const double c = std::max(std::min(1.0, q/(double)dt), 0.0); - - for (int i = 0; i < 6; i++) - { - last[1][i] = last[0][i]; - last[0][i] = input[i]; - } - - for (int i = 0; i < 6; i++) - output[i] = last[1][i] + (last[0][i] - last[1][i]) * c; - } - - void get_state(double* state) - { - for (int i = 0; i < 6; i++) - state[i] = last[0][i]; - } -}; -- cgit v1.2.3 From 68be87bc0a611fc374f10a1e9ba1d8cfda0979c4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 16 Jun 2014 03:24:11 +0200 Subject: accela: ignore whether frame is idempotent or not --- ftnoir_filter_accela/ftnoir_filter_accela.cpp | 22 ---------------------- ftnoir_filter_accela/ftnoir_filter_accela.h | 2 +- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index 9fcf4b92..c9965f2d 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -31,7 +31,6 @@ void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position, for (int i = 0; i < 6; i++) { new_camera_position[i] = target_camera_position[i]; - last_input[i] = target_camera_position[i]; for (int j = 0; j < 3; j++) last_output[j][i] = target_camera_position[i]; } @@ -40,27 +39,6 @@ void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position, return; } - bool new_frame = false; - - for (int i = 0; i < 6; i++) - { - if (target_camera_position[i] != last_input[i]) - { - new_frame = true; - break; - } - } - - if (!new_frame) - { - for (int i = 0; i < 6; i++) - new_camera_position[i] = last_output[0][i]; - return; - } - - for (int i = 0; i < 6; i++) - last_input[i] = target_camera_position[i]; - for (int i=0;i<6;i++) { const double vec = target_camera_position[i] - last_output[0][i]; diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index 8cf7fe66..125c1a39 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -48,7 +48,7 @@ public: private: settings s; bool first_run; - double last_input[6], last_output[3][6]; + double last_output[3][6]; }; class FilterControls: public QWidget, public IFilterDialog -- cgit v1.2.3 From 790cb945566e0575cbdd2962cc3189db26f0c0ee Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 11 Jul 2014 11:31:42 +0200 Subject: dedup export defs --- ftnoir_filter_base/ftnoir_filter_base_global.h | 18 +++--------------- ftnoir_protocol_base/ftnoir_protocol_base_global.h | 18 +++--------------- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/ftnoir_filter_base/ftnoir_filter_base_global.h b/ftnoir_filter_base/ftnoir_filter_base_global.h index a1a13315..09172756 100644 --- a/ftnoir_filter_base/ftnoir_filter_base_global.h +++ b/ftnoir_filter_base/ftnoir_filter_base_global.h @@ -1,16 +1,4 @@ -#ifndef FTNOIR_FILTER_BASE_GLOBAL_H -#define FTNOIR_FILTER_BASE_GLOBAL_H +#pragma once +#include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#include <QtGlobal> - -#ifndef OPENTRACK_MAIN -# if !defined(_MSC_VER) -# define FTNOIR_FILTER_BASE_EXPORT __attribute__ ((visibility ("default"))) -# else -# define FTNOIR_FILTER_BASE_EXPORT Q_DECL_EXPORT -#endif -#else -# define FTNOIR_FILTER_BASE_EXPORT Q_DECL_IMPORT -#endif - -#endif // FTNOIR_FILTER_BASE_GLOBAL_H +#define FTNOIR_FILTER_BASE_EXPORT FTNOIR_TRACKER_BASE_EXPORT diff --git a/ftnoir_protocol_base/ftnoir_protocol_base_global.h b/ftnoir_protocol_base/ftnoir_protocol_base_global.h index 06386c7f..24f3f6c9 100644 --- a/ftnoir_protocol_base/ftnoir_protocol_base_global.h +++ b/ftnoir_protocol_base/ftnoir_protocol_base_global.h @@ -1,16 +1,4 @@ -#ifndef FTNOIR_PROTOCOL_BASE_GLOBAL_H -#define FTNOIR_PROTOCOL_BASE_GLOBAL_H +#pragma once +#include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#include <QtGlobal> - -#ifndef OPENTRACK_MAIN -# if !defined(_MSC_VER) -# define FTNOIR_PROTOCOL_BASE_EXPORT __attribute__ ((visibility ("default"))) -# else -# define FTNOIR_PROTOCOL_BASE_EXPORT Q_DECL_EXPORT -#endif -#else -# define FTNOIR_PROTOCOL_BASE_EXPORT Q_DECL_IMPORT -#endif - -#endif // FTNOIR_PROTOCOL_BASE_GLOBAL_H +#define FTNOIR_PROTOCOL_BASE_EXPORT FTNOIR_TRACKER_BASE_EXPORT -- cgit v1.2.3 From 23614e1e5aa464e91abba2bfe9d902392bd40c46 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 11 Jul 2014 11:32:17 +0200 Subject: adapt rift to needlessly changed api in sdk 0.3.x --- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 100 ++++++++++++---------------- ftnoir_tracker_rift/ftnoir_tracker_rift.h | 9 ++- 2 files changed, 45 insertions(+), 64 deletions(-) diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index b548db71..14b8db67 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -1,53 +1,31 @@ /* Copyright: "i couldn't care less what anyone does with the 5 lines of code i wrote" - mm0zct */ #include "ftnoir_tracker_rift.h" #include "facetracknoir/global-settings.h" -#include "OVR.h" +#include "OVR_CAPI.h" +#include "Kernel/OVR_Math.h" #include <cstdio> using namespace OVR; -Rift_Tracker::Rift_Tracker() +Rift_Tracker::Rift_Tracker() : + should_quit(false), old_yaw(0), hmd(nullptr) { - should_quit = false; - pManager = NULL; - pSensor = NULL; - pSFusion = NULL; - old_yaw = 0; } Rift_Tracker::~Rift_Tracker() { - if (pSensor) - pSensor->Release(); - if (pSFusion) - delete pSFusion; - if (pManager) - pManager->Release(); - System::Destroy(); + ovrHmd_Destroy(hmd); + ovr_Shutdown(); } void Rift_Tracker::StartTracker(QFrame*) { - System::Init(Log::ConfigureDefaultLog(LogMask_All)); - pManager = DeviceManager::Create(); - if (pManager != NULL) + ovr_Initialize(); + hmd = ovrHmd_Create(0); + if (hmd) { - DeviceEnumerator<OVR::SensorDevice> enumerator = pManager->EnumerateDevices<OVR::SensorDevice>(); - if (enumerator.IsAvailable()) - { - pSensor = enumerator.CreateDevice(); - - if (pSensor){ - pSFusion = new OVR::SensorFusion(); - pSFusion->Reset(); - pSFusion->AttachToSensor(pSensor); - }else{ - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to create Rift sensor",QMessageBox::Ok,QMessageBox::NoButton); - } - - }else{ - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to enumerate Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); - } + ovrHmd_GetDesc(hmd, &hmdDesc); + ovrHmd_StartSensor(hmd, ovrSensorCap_Orientation| ovrSensorCap_YawCorrection | ovrSensorCap_Position, ovrSensorCap_Orientation); }else{ QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); } @@ -56,32 +34,36 @@ void Rift_Tracker::StartTracker(QFrame*) void Rift_Tracker::GetHeadPoseData(double *data) { - if (pSFusion != NULL && pSensor != NULL) { - Quatf hmdOrient = pSFusion->GetOrientation(); - double newHeadPose[6]; - - float yaw = 0.0f; - float pitch = 0.0f; - float roll = 0.0f; - hmdOrient.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &pitch , &roll); - newHeadPose[Pitch] = pitch; - newHeadPose[Roll] = roll; - newHeadPose[Yaw] = yaw; - if (s.useYawSpring) - { - newHeadPose[Yaw] = old_yaw*s.persistence + (yaw-old_yaw); - if(newHeadPose[Yaw]>s.deadzone)newHeadPose[Yaw]-= s.constant_drift; - if(newHeadPose[Yaw]<-s.deadzone)newHeadPose[Yaw]+= s.constant_drift; - old_yaw=yaw; - } - if (s.bEnableYaw) { - data[Yaw] = newHeadPose[Yaw] * 57.295781f; - } - if (s.bEnablePitch) { - data[Pitch] = newHeadPose[Pitch] * 57.295781f; - } - if (s.bEnableRoll) { - data[Roll] = newHeadPose[Roll] * 57.295781f; + if (hmd) + { + frameTiming = ovrHmd_BeginFrameTiming(hmd, 0); + ovrSensorState ss = ovrHmd_GetSensorState(hmd, frameTiming.ScanoutMidpointSeconds); + if(ss.StatusFlags & (ovrStatus_OrientationTracked | ovrStatus_PositionTracked)){ + ovrPosef pose = ss.Predicted.Pose; + Quatf quat = pose.Orientation; + float yaw, pitch, roll; + double newHeadPose[6] = {0}; + quat.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &pitch, &roll); + if (s.useYawSpring) + { + newHeadPose[Yaw] = old_yaw*s.persistence + (yaw-old_yaw); + if(newHeadPose[Yaw]>s.deadzone)newHeadPose[Yaw]-= s.constant_drift; + if(newHeadPose[Yaw]<-s.deadzone)newHeadPose[Yaw]+= s.constant_drift; + old_yaw=yaw; + } + if (s.bEnableYaw) { + data[Yaw] = newHeadPose[Yaw] * 57.295781f; + } + if (s.bEnablePitch) { + data[Pitch] = newHeadPose[Pitch] * 57.295781f; + } + if (s.bEnableRoll) { + data[Roll] = newHeadPose[Roll] * 57.295781f; + } + ovrHmd_EndFrameTiming(hmd); + newHeadPose[Pitch] = pitch; + newHeadPose[Roll] = roll; + newHeadPose[Yaw] = yaw; } } } diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index 7162b7ca..26496bc2 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -40,12 +40,11 @@ protected: void run(); // qthread override run method private: - static bool isInitialised; - OVR::DeviceManager* pManager; - OVR::SensorDevice* pSensor; - OVR::SensorFusion* pSFusion; - settings s; double old_yaw; + ovrHmd hmd; + ovrHmdDesc hmdDesc; + ovrFrameTiming frameTiming; + settings s; }; class TrackerControls: public QWidget, public ITrackerDialog -- cgit v1.2.3 From 1f4751d5fc47dc469500854e9763d9796c847b57 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 11 Jul 2014 11:32:28 +0200 Subject: print some debug on win32 as well --- facetracknoir/global-settings.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/facetracknoir/global-settings.cpp b/facetracknoir/global-settings.cpp index 3b627860..36c14f09 100644 --- a/facetracknoir/global-settings.cpp +++ b/facetracknoir/global-settings.cpp @@ -87,9 +87,13 @@ DynamicLibrary::DynamicLibrary(const QString& filename) #if defined(_WIN32) QString fullPath = QCoreApplication::applicationDirPath() + "/" + this->filename; handle = new QLibrary(fullPath); + qDebug() << handle->errorString(); Dialog = (SETTINGS_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetDialog" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); + qDebug() << handle->errorString(); Constructor = (NULLARY_DYNAMIC_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetConstructor" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); + qDebug() << handle->errorString(); Metadata = (METADATA_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetMetadata" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); + qDebug() << handle->errorString(); #else QByteArray latin1 = QFile::encodeName(filename); handle = dlopen(latin1.constData(), RTLD_NOW | -- cgit v1.2.3 From c2ff0cd3851efdd789ab1840e8da7f50429840d4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 11 Jul 2014 11:45:55 +0200 Subject: decruft build breakage --- ftnoir_filter_kalman/ftnoir_filter_kalman.h | 3 --- 1 file changed, 3 deletions(-) mode change 100644 => 100755 ftnoir_filter_kalman/ftnoir_filter_kalman.h diff --git a/ftnoir_filter_kalman/ftnoir_filter_kalman.h b/ftnoir_filter_kalman/ftnoir_filter_kalman.h old mode 100644 new mode 100755 index f2a1b4ec..6c737b4b --- a/ftnoir_filter_kalman/ftnoir_filter_kalman.h +++ b/ftnoir_filter_kalman/ftnoir_filter_kalman.h @@ -8,9 +8,6 @@ #ifndef INCLUDED_FTN_FILTER_H #define INCLUDED_FTN_FILTER_H -#undef FTNOIR_TRACKER_BASE_LIB -#define FTNOIR_TRACKER_BASE_EXPORT Q_DECL_IMPORT - #include "ftnoir_filter_base/ftnoir_filter_base.h" #include "ui_ftnoir_kalman_filtercontrols.h" #include "facetracknoir/global-settings.h" -- cgit v1.2.3 From b87a7d0a25821e439e06a439eb4518395afbf7ed Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 11 Jul 2014 12:06:54 +0200 Subject: main ui: change profile cbx content when dir switch --- facetracknoir/facetracknoir.cpp | 17 +++++++---------- facetracknoir/facetracknoir.h | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 893e79cd..00a7b95e 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -104,7 +104,7 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : pProtocolDialog(NULL), pFilterDialog(NULL), kbd_quit(QKeySequence("Ctrl+Q"), this), - looping(false) + looping(0) { ui.setupUi(this); setFixedSize(size()); @@ -256,10 +256,8 @@ void FaceTrackNoIR::open() { QSettings settings("opentrack"); settings.setValue ("SettingsFile", QFileInfo(fileName).absoluteFilePath()); } - looping = true; fill_profile_cbx(); loadSettings(); - looping = false; } } @@ -286,7 +284,7 @@ void FaceTrackNoIR::save() { void FaceTrackNoIR::saveAs() { - looping = true; + looping++; QSettings settings("opentrack"); QString oldFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); @@ -311,7 +309,7 @@ void FaceTrackNoIR::saveAs() save(); } - looping = false; + looping--; fill_profile_cbx(); } @@ -584,6 +582,7 @@ void FaceTrackNoIR::fill_profile_cbx() { if (looping) return; + looping++; QSettings settings("opentrack"); QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); qDebug() << "Config file now" << currentFile; @@ -594,12 +593,10 @@ void FaceTrackNoIR::fill_profile_cbx() filters << "*.ini"; auto iniFileList = settingsDir.entryList( filters, QDir::Files, QDir::Name ); ui.iconcomboProfile->clear(); - for ( int i = 0; i < iniFileList.size(); i++) { + for ( int i = 0; i < iniFileList.size(); i++) ui.iconcomboProfile->addItem(QIcon(":/images/settings16.png"), iniFileList.at(i)); - if (iniFileList.at(i) == pathInfo.fileName()) { - ui.iconcomboProfile->setCurrentIndex( i ); - } - } + ui.iconcomboProfile->setCurrentText(pathInfo.fileName()); + looping--; } void FaceTrackNoIR::profileSelected(int index) diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 50a6e0ec..192b00b6 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -139,7 +139,7 @@ private: void bind_keyboard_shortcut(QxtGlobalShortcut&, key_opts& k); #endif void fill_profile_cbx(); - bool looping; + int looping; private slots: void open(); -- cgit v1.2.3 From fff9b880283f26d226eb1aa1a3bebf8a06d7d21b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 11 Jul 2014 12:12:35 +0200 Subject: some java-ism dirt nap --- facetracknoir/tracker.cpp | 1 - ftnoir_tracker_udp/ftnoir_tracker_udp.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 094264ff..dfe9bc1d 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -87,7 +87,6 @@ static void t_compensate(double* input, double* output, bool rz) output[i] = ret.at<double>(i); } -/** QThread run method @override **/ void Tracker::run() { T6DOF offset_camera; diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp index 02ae21f0..97b2448b 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp @@ -39,7 +39,6 @@ FTNoIR_Tracker::~FTNoIR_Tracker() wait(); } -/** QThread run @override **/ void FTNoIR_Tracker::run() { forever { if (should_quit) -- cgit v1.2.3 From c76dc2c8cea78285460fea7f98b9c64904242f9a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 11 Jul 2014 12:31:27 +0200 Subject: fix symbol visibility issue --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b2e9f99..21a865f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,8 @@ if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) endif() endif() +add_definitions(-DOPENTRACK_MAIN) + if(APPLE) set(apple-frameworks "-stdlib=libc++ -framework Cocoa -framework CoreFoundation -lobjc -lz -framework Carbon") set(CMAKE_SHARED_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_SHARED_LINKER_FLAGS}") @@ -549,7 +551,6 @@ if(SDK_GOOGLE_BREAKPAD) "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/common.lib") endif() endif() -set_target_properties(opentrack PROPERTIES COMPILE_FLAGS -DOPENTRACK_MAIN) # make install -- cgit v1.2.3 From 34edd40043a35135f02fe227459b7481ef570c33 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 11 Jul 2014 12:33:39 +0200 Subject: fix typo breaking whole build --- ftnoir_tracker_base/ftnoir_tracker_base_global.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftnoir_tracker_base/ftnoir_tracker_base_global.h b/ftnoir_tracker_base/ftnoir_tracker_base_global.h index e717d845..ded9209b 100644 --- a/ftnoir_tracker_base/ftnoir_tracker_base_global.h +++ b/ftnoir_tracker_base/ftnoir_tracker_base_global.h @@ -4,7 +4,7 @@ #include <QtGlobal> #ifndef FTNOIR_TRACKER_BASE_EXPORT -# ifndef OPENTRACK_MAIN +# ifdef OPENTRACK_MAIN # if !defined(_MSC_VER) # define FTNOIR_TRACKER_BASE_EXPORT __attribute__ ((visibility ("default"))) # else -- cgit v1.2.3 From 93f8e4c2f3b28282c1b019466e16d70024137f5a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 11 Jul 2014 13:23:35 +0200 Subject: hide internal symbols on all GNU toolchain platforms --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 21a865f4..7bf0f201 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ if(APPLE) set(CMAKE_STATIC_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_STATIC_LINKER_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_EXE_LINKER_FLAGS}") set(CMAKE_MODULE_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_MODULE_LINKER_FLAGS}") - set(CMAKE_CXX_FLAGS " -stdlib=libc++ -std=c++11 ${CMAKE_CXX_FLAGS} -fvisibility=hidden") + set(CMAKE_CXX_FLAGS " -stdlib=libc++ ${CMAKE_CXX_FLAGS} ") endif() SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) @@ -211,7 +211,7 @@ macro(opentrack_library n) if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) SET_TARGET_PROPERTIES(${n} PROPERTIES LINK_FLAGS "${foolib_LINK} -Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/${version-script}-version-script.txt" - COMPILE_FLAGS "${foolib_COMPILE}" + COMPILE_FLAGS "${foolib_COMPILE} -fvisibility=hidden -fvisibility-inlines-hidden" ) else() set_target_properties(${n} PROPERTIES LINK_FLAGS "${foolib_LINK}" COMPILE_FLAGS "${foolib_COMPILE}") -- cgit v1.2.3 From b4987cedd591e43d1b5f77f93a8ff748f0b21ca6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 11 Jul 2014 13:23:46 +0200 Subject: how did this ever work? --- ftnoir_tracker_base/ftnoir_tracker_base_global.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftnoir_tracker_base/ftnoir_tracker_base_global.h b/ftnoir_tracker_base/ftnoir_tracker_base_global.h index ded9209b..df793f30 100644 --- a/ftnoir_tracker_base/ftnoir_tracker_base_global.h +++ b/ftnoir_tracker_base/ftnoir_tracker_base_global.h @@ -6,7 +6,7 @@ #ifndef FTNOIR_TRACKER_BASE_EXPORT # ifdef OPENTRACK_MAIN # if !defined(_MSC_VER) -# define FTNOIR_TRACKER_BASE_EXPORT __attribute__ ((visibility ("default"))) +# define FTNOIR_TRACKER_BASE_EXPORT __attribute__ ((visibility ("default"))) Q_DECL_EXPORT # else # define FTNOIR_TRACKER_BASE_EXPORT Q_DECL_EXPORT # endif -- cgit v1.2.3 From 5f9494fa021582f725fed487162cdb043c607a50 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 11 Jul 2014 13:25:16 +0200 Subject: dedup cpp define --- CMakeLists.txt | 2 -- ftnoir_tracker_base/ftnoir_tracker_base_global.h | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bf0f201..cbab479b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,8 +26,6 @@ if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) endif() endif() -add_definitions(-DOPENTRACK_MAIN) - if(APPLE) set(apple-frameworks "-stdlib=libc++ -framework Cocoa -framework CoreFoundation -lobjc -lz -framework Carbon") set(CMAKE_SHARED_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_SHARED_LINKER_FLAGS}") diff --git a/ftnoir_tracker_base/ftnoir_tracker_base_global.h b/ftnoir_tracker_base/ftnoir_tracker_base_global.h index df793f30..6d6a1918 100644 --- a/ftnoir_tracker_base/ftnoir_tracker_base_global.h +++ b/ftnoir_tracker_base/ftnoir_tracker_base_global.h @@ -4,7 +4,7 @@ #include <QtGlobal> #ifndef FTNOIR_TRACKER_BASE_EXPORT -# ifdef OPENTRACK_MAIN +# ifdef IN_OPENTRACK # if !defined(_MSC_VER) # define FTNOIR_TRACKER_BASE_EXPORT __attribute__ ((visibility ("default"))) Q_DECL_EXPORT # else -- cgit v1.2.3 From 4dc41d3d8642d90d52b667dd05b4f99735f83a37 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 11 Jul 2014 17:23:20 +0200 Subject: integrate PT axis of rotation estimation into AR --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 11 ++++- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 70 ++++++++++++++++++++++++--- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 11 +++++ ftnoir_tracker_aruco/trans_calib.cpp | 44 +++++++++++++++++ ftnoir_tracker_aruco/trans_calib.h | 39 +++++++++++++++ 5 files changed, 166 insertions(+), 9 deletions(-) create mode 100644 ftnoir_tracker_aruco/trans_calib.cpp create mode 100644 ftnoir_tracker_aruco/trans_calib.h diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 1d5a4241..be237e3c 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>615</width> - <height>326</height> + <width>636</width> + <height>346</height> </rect> </property> <property name="sizePolicy"> @@ -110,6 +110,13 @@ </property> </widget> </item> + <item row="4" column="1"> + <widget class="QPushButton" name="btn_calibrate"> + <property name="text"> + <string>Calibrate</string> + </property> + </widget> + </item> </layout> </widget> </item> diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index ae7ca0b5..756278cd 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -137,12 +137,20 @@ void Tracker::StartTracker(QFrame* videoframe) #define HT_PI 3.1415926535 +void Tracker::getRT(cv::Matx33f& r_, cv::Vec3f& t_) +{ + QMutexLocker l(&mtx); + + r_ = r; + t_ = t; +} + void Tracker::run() { - int res = s.resolution; - if (res < 0 || res >= (int)(sizeof(resolution_choices) / sizeof(resolution_tuple))) - res = 0; - resolution_tuple r = resolution_choices[res]; + int rint = s.resolution; + if (rint < 0 || rint >= (int)(sizeof(resolution_choices) / sizeof(resolution_tuple))) + rint = 0; + resolution_tuple res = resolution_choices[rint]; int fps; switch (static_cast<int>(s.force_fps)) { @@ -164,10 +172,10 @@ void Tracker::run() break; } camera = cv::VideoCapture(s.camera_index); - if (r.width) + if (res.width) { - camera.set(CV_CAP_PROP_FRAME_WIDTH, r.width); - camera.set(CV_CAP_PROP_FRAME_HEIGHT, r.height); + camera.set(CV_CAP_PROP_FRAME_WIDTH, res.width); + camera.set(CV_CAP_PROP_FRAME_HEIGHT, res.height); } if (fps) camera.set(CV_CAP_PROP_FPS, fps); @@ -340,6 +348,9 @@ void Tracker::run() pose[Yaw] = euler[1]; pose[Pitch] = -euler[0]; pose[Roll] = euler[2]; + + rotation_matrix.convertTo(r, CV_32FC1); + tvec.convertTo(t, CV_32FC1); } std::vector<cv::Point2f> repr2; @@ -446,6 +457,8 @@ extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDial TrackerControls::TrackerControls() { tracker = nullptr; + calibrating = false; + calib_timer.setInterval(100); ui.setupUi(this); setAttribute(Qt::WA_NativeWindow, true); tie_setting(s.camera_index, ui.cameraName); @@ -466,6 +479,49 @@ TrackerControls::TrackerControls() connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); ui.cameraName->addItems(get_camera_names()); + + 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())); +} + +void TrackerControls::toggleCalibrate() +{ + if (!calibrating) + { + calibrator.reset(); + calib_timer.start(); + } else { + cleanupCalib(); + } + calibrating = !calibrating; +} + +void TrackerControls::cleanupCalib() +{ + if (calibrating) + { + calib_timer.stop(); + auto pos = calibrator.get_estimate() * .1; + s.headpos_x = pos(0); + s.headpos_y = pos(1); + s.headpos_z = pos(2); + } +} + +void TrackerControls::update_tracker_calibration() +{ + if (calibrating && tracker) + { + cv::Matx33f r; + cv::Vec3f t; + tracker->getRT(r, t); + calibrator.update(r, t); + auto pos = calibrator.get_estimate() * .1; + s.headpos_x = pos(0); + s.headpos_y = pos(1); + s.headpos_z = pos(2); + } } void TrackerControls::doOK() diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 4cab84b5..f1fcc326 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -16,9 +16,11 @@ #include <QMutex> #include <QHBoxLayout> #include <QDialog> +#include <QTimer> #include <opencv2/opencv.hpp> #include <opencv/highgui.h> #include "facetracknoir/options.h" +#include "ftnoir_tracker_aruco/trans_calib.h" using namespace options; struct settings { @@ -58,6 +60,7 @@ public: void GetHeadPoseData(double *data); void run(); void reload() { s.b->reload(); } + void getRT(cv::Matx33f& r, cv::Vec3f& t); private: QMutex mtx; volatile bool stop; @@ -67,6 +70,8 @@ private: double pose[6]; cv::Mat frame; cv::VideoCapture camera; + cv::Matx33f r; + cv::Vec3f t; }; // Widget that has controls for FTNoIR protocol client-settings. @@ -85,9 +90,15 @@ private: Ui::Form ui; Tracker* tracker; settings s; + TranslationCalibrator calibrator; + bool calibrating; + QTimer calib_timer; private slots: void doOK(); void doCancel(); + void toggleCalibrate(); + void cleanupCalib(); + void update_tracker_calibration(); }; #endif diff --git a/ftnoir_tracker_aruco/trans_calib.cpp b/ftnoir_tracker_aruco/trans_calib.cpp new file mode 100644 index 00000000..dd18399a --- /dev/null +++ b/ftnoir_tracker_aruco/trans_calib.cpp @@ -0,0 +1,44 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 "trans_calib.h" + +using namespace cv; + +//----------------------------------------------------------------------------- +TranslationCalibrator::TranslationCalibrator() +{ + reset(); +} + +void TranslationCalibrator::reset() +{ + P = Matx66f::zeros(); + y = Vec6f(0,0,0, 0,0,0); +} + +void TranslationCalibrator::update(const Matx33f& R_CM_k, const Vec3f& t_CM_k) +{ + Matx<float, 6,3> H_k_T = Matx<float, 6,3>::zeros(); + for (int i=0; i<3; ++i) { + for (int j=0; j<3; ++j) { + H_k_T(i,j) = R_CM_k(j,i); + } + } + for (int i=0; i<3; ++i) + { + H_k_T(3+i,i) = 1.0; + } + P += H_k_T * H_k_T.t(); + y += H_k_T * t_CM_k; +} + +Vec3f TranslationCalibrator::get_estimate() +{ + Vec6f x = P.inv() * y; + return Vec3f(x[0], x[1], x[2]); +} diff --git a/ftnoir_tracker_aruco/trans_calib.h b/ftnoir_tracker_aruco/trans_calib.h new file mode 100644 index 00000000..f2521690 --- /dev/null +++ b/ftnoir_tracker_aruco/trans_calib.h @@ -0,0 +1,39 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#ifndef TRANSCALIB_H +#define TRANSCALIB_H + +#include <opencv2/opencv.hpp> + +//----------------------------------------------------------------------------- +// Calibrates the translation from head to model = t_MH +// by recursive least squares / +// kalman filter in information form with identity noise covariance +// measurement equation when head position = t_CH is fixed: +// (R_CM_k , Id)*(-t_MH, t_CH) = t_CM_k + +class TranslationCalibrator +{ +public: + TranslationCalibrator(); + + // reset the calibration process + void reset(); + + // update the current estimate + void update(const cv::Matx33f& R_CM_k, const cv::Vec3f& t_CM_k); + + // get the current estimate for t_MH + cv::Vec3f get_estimate(); + +protected: + cv::Matx66f P; // normalized precision matrix = inverse covariance + cv::Vec6f y; // P*(-t_MH, t_CH) +}; + +#endif //TRANSCALIB_H \ No newline at end of file -- cgit v1.2.3 From 578f1fbba96fe238430605907abf0e98e035cf20 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 11 Jul 2014 20:07:57 +0200 Subject: rm explicit switch, use timer state --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 8 +++----- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 1 - 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 756278cd..c3c8170c 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -457,7 +457,6 @@ extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDial TrackerControls::TrackerControls() { tracker = nullptr; - calibrating = false; calib_timer.setInterval(100); ui.setupUi(this); setAttribute(Qt::WA_NativeWindow, true); @@ -487,19 +486,18 @@ TrackerControls::TrackerControls() void TrackerControls::toggleCalibrate() { - if (!calibrating) + if (!calib_timer.isActive()) { calibrator.reset(); calib_timer.start(); } else { cleanupCalib(); } - calibrating = !calibrating; } void TrackerControls::cleanupCalib() { - if (calibrating) + if (calib_timer.isActive()) { calib_timer.stop(); auto pos = calibrator.get_estimate() * .1; @@ -511,7 +509,7 @@ void TrackerControls::cleanupCalib() void TrackerControls::update_tracker_calibration() { - if (calibrating && tracker) + if (calib_timer.isActive() && tracker) { cv::Matx33f r; cv::Vec3f t; diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index f1fcc326..f2207aef 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -91,7 +91,6 @@ private: Tracker* tracker; settings s; TranslationCalibrator calibrator; - bool calibrating; QTimer calib_timer; private slots: void doOK(); -- cgit v1.2.3 From 959d584a667654494e6655502e6be60973a502f2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 11 Jul 2014 20:20:19 +0200 Subject: udp tracker: drop ui port range constraint --- ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui b/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui index 5c602792..6f81a50b 100644 --- a/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui +++ b/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui @@ -39,10 +39,10 @@ <item row="1" column="1"> <widget class="QSpinBox" name="spinPortNumber"> <property name="minimum"> - <number>5550</number> + <number>0</number> </property> <property name="maximum"> - <number>10000</number> + <number>65535</number> </property> </widget> </item> @@ -77,8 +77,8 @@ <rect> <x>10</x> <y>20</y> - <width>147</width> - <height>68</height> + <width>150</width> + <height>73</height> </rect> </property> <layout class="QGridLayout" name="gridLayout_2"> -- cgit v1.2.3 From cc8146215b034aa5e92ad0313db096aba3e73499 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 18 Jul 2014 19:21:52 +0200 Subject: Rift logic broken, reorder Submitted-by: Chris Thompson (mm0zct) --- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index 14b8db67..219b0d7c 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -51,6 +51,9 @@ void Rift_Tracker::GetHeadPoseData(double *data) if(newHeadPose[Yaw]<-s.deadzone)newHeadPose[Yaw]+= s.constant_drift; old_yaw=yaw; } + newHeadPose[Pitch] = pitch; + newHeadPose[Roll] = roll; + newHeadPose[Yaw] = yaw; if (s.bEnableYaw) { data[Yaw] = newHeadPose[Yaw] * 57.295781f; } @@ -61,9 +64,6 @@ void Rift_Tracker::GetHeadPoseData(double *data) data[Roll] = newHeadPose[Roll] * 57.295781f; } ovrHmd_EndFrameTiming(hmd); - newHeadPose[Pitch] = pitch; - newHeadPose[Roll] = roll; - newHeadPose[Yaw] = yaw; } } } -- cgit v1.2.3 From 25804c1f4a5cd9374e4f4caaa6a6039d28b1e64a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 18 Jul 2014 19:25:37 +0200 Subject: Rift: no need for temporary array, inline it --- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index 219b0d7c..0a2ded7d 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -42,26 +42,24 @@ void Rift_Tracker::GetHeadPoseData(double *data) ovrPosef pose = ss.Predicted.Pose; Quatf quat = pose.Orientation; float yaw, pitch, roll; - double newHeadPose[6] = {0}; quat.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &pitch, &roll); if (s.useYawSpring) { - newHeadPose[Yaw] = old_yaw*s.persistence + (yaw-old_yaw); - if(newHeadPose[Yaw]>s.deadzone)newHeadPose[Yaw]-= s.constant_drift; - if(newHeadPose[Yaw]<-s.deadzone)newHeadPose[Yaw]+= s.constant_drift; + yaw = old_yaw*s.persistence + (yaw-old_yaw); + if(yaw > s.deadzone) + yaw -= s.constant_drift; + if(yaw < -s.deadzone) + yaw += s.constant_drift; old_yaw=yaw; } - newHeadPose[Pitch] = pitch; - newHeadPose[Roll] = roll; - newHeadPose[Yaw] = yaw; if (s.bEnableYaw) { - data[Yaw] = newHeadPose[Yaw] * 57.295781f; + data[Yaw] = yaw * 57.295781f; } if (s.bEnablePitch) { - data[Pitch] = newHeadPose[Pitch] * 57.295781f; + data[Pitch] = pitch * 57.295781f; } if (s.bEnableRoll) { - data[Roll] = newHeadPose[Roll] * 57.295781f; + data[Roll] = roll * 57.295781f; } ovrHmd_EndFrameTiming(hmd); } -- cgit v1.2.3 From b68868247aea33b2e26b80058fc5a48df69ba53a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 27 Jul 2014 15:48:12 +0200 Subject: nix nonsensical typedef naming --- facetracknoir/global-settings.cpp | 16 ++++++++-------- facetracknoir/global-settings.h | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/facetracknoir/global-settings.cpp b/facetracknoir/global-settings.cpp index 36c14f09..9c84945b 100644 --- a/facetracknoir/global-settings.cpp +++ b/facetracknoir/global-settings.cpp @@ -31,34 +31,34 @@ SelectedLibraries::SelectedLibraries(IDynamicLibraryProvider* mainApp) : correct = false; if (!mainApp) return; - NULLARY_DYNAMIC_FUNCTION ptr; + CTOR_FUNPTR ptr; DynamicLibrary* lib; lib = mainApp->current_tracker1(); if (lib && lib->Constructor) { - ptr = (NULLARY_DYNAMIC_FUNCTION) lib->Constructor; + ptr = (CTOR_FUNPTR) lib->Constructor; pTracker = (ITracker*) ptr(); } lib = mainApp->current_tracker2(); if (lib && lib->Constructor) { - ptr = (NULLARY_DYNAMIC_FUNCTION) lib->Constructor; + ptr = (CTOR_FUNPTR) lib->Constructor; pSecondTracker = (ITracker*) ptr(); } lib = mainApp->current_protocol(); if (lib && lib->Constructor) { - ptr = (NULLARY_DYNAMIC_FUNCTION) lib->Constructor; + ptr = (CTOR_FUNPTR) lib->Constructor; pProtocol = (IProtocol*) ptr(); } lib = mainApp->current_filter(); if (lib && lib->Constructor) { - ptr = (NULLARY_DYNAMIC_FUNCTION) lib->Constructor; + ptr = (CTOR_FUNPTR) lib->Constructor; pFilter = (IFilter*) ptr(); } @@ -109,13 +109,13 @@ DynamicLibrary::DynamicLibrary(const QString& filename) { fprintf(stderr, "Error, if any: %s\n", dlerror()); fflush(stderr); - Dialog = (SETTINGS_FUNCTION) dlsym(handle, "GetDialog"); + Dialog = (DIALOG_FUNPTR) dlsym(handle, "GetDialog"); fprintf(stderr, "Error, if any: %s\n", dlerror()); fflush(stderr); - Constructor = (NULLARY_DYNAMIC_FUNCTION) dlsym(handle, "GetConstructor"); + Constructor = (CTOR_FUNPTR) dlsym(handle, "GetConstructor"); fprintf(stderr, "Error, if any: %s\n", dlerror()); fflush(stderr); - Metadata = (METADATA_FUNCTION) dlsym(handle, "GetMetadata"); + Metadata = (METADATA_FUNPTR) dlsym(handle, "GetMetadata"); fprintf(stderr, "Error, if any: %s\n", dlerror()); fflush(stderr); } else { diff --git a/facetracknoir/global-settings.h b/facetracknoir/global-settings.h index 6b04b73b..4394d1a0 100644 --- a/facetracknoir/global-settings.h +++ b/facetracknoir/global-settings.h @@ -52,17 +52,17 @@ extern SelectedLibraries* Libraries; struct Metadata; -extern "C" typedef void* (CALLING_CONVENTION * NULLARY_DYNAMIC_FUNCTION)(void); -extern "C" typedef Metadata* (CALLING_CONVENTION* METADATA_FUNCTION)(void); -extern "C" typedef void* (CALLING_CONVENTION* SETTINGS_FUNCTION)(void); +extern "C" typedef void* (CALLING_CONVENTION * CTOR_FUNPTR)(void); +extern "C" typedef Metadata* (CALLING_CONVENTION* METADATA_FUNPTR)(void); +extern "C" typedef void* (CALLING_CONVENTION* DIALOG_FUNPTR)(void); class DynamicLibrary { public: DynamicLibrary(const QString& filename); virtual ~DynamicLibrary(); - SETTINGS_FUNCTION Dialog; - NULLARY_DYNAMIC_FUNCTION Constructor; - METADATA_FUNCTION Metadata; + DIALOG_FUNPTR Dialog; + CTOR_FUNPTR Constructor; + METADATA_FUNPTR Metadata; QString filename; private: #if defined(_WIN32) -- cgit v1.2.3 From 41c2933a5ab2a2592a8d4dffb91b6db3a02f3c9b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 27 Jul 2014 16:21:31 +0200 Subject: rename file so that name makes any sense --- FTNoIR_Tracker_PT/ftnoir_tracker_pt.h | 2 +- FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp | 2 +- FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h | 2 +- facetracknoir/facetracknoir.h | 2 +- facetracknoir/global-settings.cpp | 136 --------------------- facetracknoir/global-settings.h | 93 -------------- facetracknoir/plugin-support.cpp | 136 +++++++++++++++++++++ facetracknoir/plugin-support.h | 93 ++++++++++++++ facetracknoir/tracker.h | 2 +- ftnoir_filter_accela/ftnoir_filter_accela.cpp | 2 +- ftnoir_filter_accela/ftnoir_filter_accela.h | 2 +- .../ftnoir_filter_accela_dialog.cpp | 2 +- ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp | 2 +- ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp | 2 +- ftnoir_filter_ewma2/ftnoir_filter_ewma2.h | 2 +- ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp | 2 +- ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp | 2 +- ftnoir_filter_kalman/ftnoir_filter_kalman.h | 2 +- ftnoir_filter_kalman/kalman.cpp | 2 +- ftnoir_protocol_fg/ftnoir_protocol_fg.cpp | 2 +- ftnoir_protocol_fg/ftnoir_protocol_fg.h | 2 +- ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp | 2 +- ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp | 2 +- ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp | 2 +- ftnoir_protocol_ftn/ftnoir_protocol_ftn.h | 2 +- ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp | 2 +- ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp | 2 +- .../ftnoir_protocol_libevdev.cpp | 2 +- .../ftnoir_protocol_libevdev.h | 2 +- .../ftnoir_protocol_libevdev_dialog.cpp | 2 +- .../ftnoir_protocol_libevdev_dll.cpp | 2 +- ftnoir_protocol_wine/ftnoir_protocol_wine.h | 2 +- .../ftnoir_protocol_wine_dialog.cpp | 2 +- ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp | 2 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 +- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 2 +- ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h | 2 +- ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp | 2 +- ftnoir_tracker_hydra/ftnoir_tracker_hydra.h | 2 +- .../ftnoir_tracker_hydra_dialog.cpp | 2 +- ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp | 2 +- ftnoir_tracker_udp/ftnoir_tracker_udp.cpp | 2 +- ftnoir_tracker_udp/ftnoir_tracker_udp.h | 2 +- ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp | 2 +- ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp | 2 +- opentrack-api/opentrack-guts.h | 2 +- 46 files changed, 272 insertions(+), 272 deletions(-) delete mode 100644 facetracknoir/global-settings.cpp delete mode 100644 facetracknoir/global-settings.h create mode 100644 facetracknoir/plugin-support.cpp create mode 100644 facetracknoir/plugin-support.h diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h index 190ed76a..79f16629 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h @@ -10,7 +10,7 @@ #ifdef OPENTRACK_API # include "ftnoir_tracker_base/ftnoir_tracker_base.h" -# include "facetracknoir/global-settings.h" +# include "facetracknoir/plugin-support.h" #endif #include "ftnoir_tracker_pt_settings.h" #include "frame_observer.h" diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp index f3fbbef7..15e830a4 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp @@ -31,7 +31,7 @@ void TrackerDll::getIcon(QIcon *icon) #ifdef OPENTRACK_API -# include "facetracknoir/global-settings.h" +# include "facetracknoir/plugin-support.h" extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() #else # pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0") diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h index 1d30e7e5..22e1ff29 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h @@ -7,7 +7,7 @@ #if defined(OPENTRACK_API) # include "ftnoir_tracker_base/ftnoir_tracker_base.h" -# include "facetracknoir/global-settings.h" +# include "facetracknoir/plugin-support.h" #else # include "../ftnoir_tracker_base/ftnoir_tracker_base.h" #endif diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 192b00b6..ca8084c2 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -55,7 +55,7 @@ using namespace options; #include "facetracknoir/main-settings.hpp" -#include "global-settings.h" +#include "facetracknoir/plugin-support.h" #include "tracker.h" #include "facetracknoir/shortcuts.h" diff --git a/facetracknoir/global-settings.cpp b/facetracknoir/global-settings.cpp deleted file mode 100644 index 9c84945b..00000000 --- a/facetracknoir/global-settings.cpp +++ /dev/null @@ -1,136 +0,0 @@ -#include "global-settings.h" - -#if !(defined(_WIN32)) -# include <dlfcn.h> -#endif - -SelectedLibraries* Libraries = NULL; - -SelectedLibraries::~SelectedLibraries() -{ - if (pTracker) { - delete pTracker; - pTracker = NULL; - } - - if (pSecondTracker) { - delete pSecondTracker; - pSecondTracker = NULL; - } - - if (pFilter) - delete pFilter; - - if (pProtocol) - delete pProtocol; -} - -SelectedLibraries::SelectedLibraries(IDynamicLibraryProvider* mainApp) : - pTracker(NULL), pSecondTracker(NULL), pFilter(NULL), pProtocol(NULL) -{ - correct = false; - if (!mainApp) - return; - CTOR_FUNPTR ptr; - DynamicLibrary* lib; - - lib = mainApp->current_tracker1(); - - if (lib && lib->Constructor) { - ptr = (CTOR_FUNPTR) lib->Constructor; - pTracker = (ITracker*) ptr(); - } - - lib = mainApp->current_tracker2(); - - if (lib && lib->Constructor) { - ptr = (CTOR_FUNPTR) lib->Constructor; - pSecondTracker = (ITracker*) ptr(); - } - - lib = mainApp->current_protocol(); - - if (lib && lib->Constructor) { - ptr = (CTOR_FUNPTR) lib->Constructor; - pProtocol = (IProtocol*) ptr(); - } - - lib = mainApp->current_filter(); - - if (lib && lib->Constructor) { - ptr = (CTOR_FUNPTR) lib->Constructor; - pFilter = (IFilter*) ptr(); - } - - // Check if the Protocol-server files were installed OK. - // Some servers also create a memory-mapping, for Inter Process Communication. - // The handle of the MainWindow is sent to 'The Game', so it can send a message back. - - if (pProtocol) - if(!pProtocol->checkServerInstallationOK()) - return; - - // retrieve pointers to the User Interface and the main Application - if (pTracker) { - pTracker->StartTracker( mainApp->get_video_widget() ); - } - if (pSecondTracker) { - pSecondTracker->StartTracker( mainApp->get_video_widget() ); - } - - correct = true; -} - -DynamicLibrary::DynamicLibrary(const QString& filename) -{ - this->filename = filename; -#if defined(_WIN32) - QString fullPath = QCoreApplication::applicationDirPath() + "/" + this->filename; - handle = new QLibrary(fullPath); - qDebug() << handle->errorString(); - Dialog = (SETTINGS_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetDialog" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); - qDebug() << handle->errorString(); - Constructor = (NULLARY_DYNAMIC_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetConstructor" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); - qDebug() << handle->errorString(); - Metadata = (METADATA_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetMetadata" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); - qDebug() << handle->errorString(); -#else - QByteArray latin1 = QFile::encodeName(filename); - handle = dlopen(latin1.constData(), RTLD_NOW | -# ifdef __linux - RTLD_DEEPBIND -# elif defined(__APPLE__) - RTLD_LOCAL|RTLD_FIRST|RTLD_NOW -# else - 0 -# endif - ); - if (handle) - { - fprintf(stderr, "Error, if any: %s\n", dlerror()); - fflush(stderr); - Dialog = (DIALOG_FUNPTR) dlsym(handle, "GetDialog"); - fprintf(stderr, "Error, if any: %s\n", dlerror()); - fflush(stderr); - Constructor = (CTOR_FUNPTR) dlsym(handle, "GetConstructor"); - fprintf(stderr, "Error, if any: %s\n", dlerror()); - fflush(stderr); - Metadata = (METADATA_FUNPTR) dlsym(handle, "GetMetadata"); - fprintf(stderr, "Error, if any: %s\n", dlerror()); - fflush(stderr); - } else { - fprintf(stderr, "Error, if any: %s\n", dlerror()); - fflush(stderr); - } -#endif -} - -DynamicLibrary::~DynamicLibrary() -{ -#if defined(_WIN32) - handle->unload(); -#else - if (handle) - (void) dlclose(handle); -#endif -} diff --git a/facetracknoir/global-settings.h b/facetracknoir/global-settings.h deleted file mode 100644 index 4394d1a0..00000000 --- a/facetracknoir/global-settings.h +++ /dev/null @@ -1,93 +0,0 @@ -#pragma once - -#if defined(_WIN32) -# define CALLING_CONVENTION_SUFFIX_VOID_FUNCTION "@0" -# ifdef _MSC_VER -# define MAYBE_STDCALL_UNDERSCORE "_" -#else -# define MAYBE_STDCALL_UNDERSCORE "" -# endif -#else -# define CALLING_CONVENTION_SUFFIX_VOID_FUNCTION "" -# define MAYBE_STDCALL_UNDERSCORE "" -#endif - -#ifdef _MSC_VER -# define virt_override -#else -# define virt_override override -#endif - -#include <cstdio> - -#include <QWidget> -#include <QDebug> -#include <QString> -#include <QLibrary> -#include <QFrame> -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#include "ftnoir_filter_base/ftnoir_filter_base.h" -#include "ftnoir_protocol_base/ftnoir_protocol_base.h" - -#if defined(_WIN32) -# define CALLING_CONVENTION __stdcall -#else -# define CALLING_CONVENTION -#endif - -class IDynamicLibraryProvider; - -struct SelectedLibraries { -public: - ITracker* pTracker; - ITracker* pSecondTracker; - IFilter* pFilter; - IProtocol* pProtocol; - SelectedLibraries(IDynamicLibraryProvider* main = NULL); - ~SelectedLibraries(); - bool correct; -}; - -extern SelectedLibraries* Libraries; - -struct Metadata; - -extern "C" typedef void* (CALLING_CONVENTION * CTOR_FUNPTR)(void); -extern "C" typedef Metadata* (CALLING_CONVENTION* METADATA_FUNPTR)(void); -extern "C" typedef void* (CALLING_CONVENTION* DIALOG_FUNPTR)(void); - -class DynamicLibrary { -public: - DynamicLibrary(const QString& filename); - virtual ~DynamicLibrary(); - DIALOG_FUNPTR Dialog; - CTOR_FUNPTR Constructor; - METADATA_FUNPTR Metadata; - QString filename; -private: -#if defined(_WIN32) - QLibrary* handle; -#else - void* handle; -#endif -}; - -struct Metadata -{ - Metadata() {} - virtual ~Metadata() {} - - virtual void getFullName(QString *strToBeFilled) = 0; - virtual void getShortName(QString *strToBeFilled) = 0; - virtual void getDescription(QString *strToBeFilled) = 0; - virtual void getIcon(QIcon *icon) = 0; -}; - -class IDynamicLibraryProvider { -public: - virtual DynamicLibrary* current_tracker1() = 0; - virtual DynamicLibrary* current_tracker2() = 0; - virtual DynamicLibrary* current_protocol() = 0; - virtual DynamicLibrary* current_filter() = 0; - virtual QFrame* get_video_widget() = 0; -}; diff --git a/facetracknoir/plugin-support.cpp b/facetracknoir/plugin-support.cpp new file mode 100644 index 00000000..09e1c200 --- /dev/null +++ b/facetracknoir/plugin-support.cpp @@ -0,0 +1,136 @@ +#include "plugin-support.h" + +#if !(defined(_WIN32)) +# include <dlfcn.h> +#endif + +SelectedLibraries* Libraries = NULL; + +SelectedLibraries::~SelectedLibraries() +{ + if (pTracker) { + delete pTracker; + pTracker = NULL; + } + + if (pSecondTracker) { + delete pSecondTracker; + pSecondTracker = NULL; + } + + if (pFilter) + delete pFilter; + + if (pProtocol) + delete pProtocol; +} + +SelectedLibraries::SelectedLibraries(IDynamicLibraryProvider* mainApp) : + pTracker(NULL), pSecondTracker(NULL), pFilter(NULL), pProtocol(NULL) +{ + correct = false; + if (!mainApp) + return; + CTOR_FUNPTR ptr; + DynamicLibrary* lib; + + lib = mainApp->current_tracker1(); + + if (lib && lib->Constructor) { + ptr = (CTOR_FUNPTR) lib->Constructor; + pTracker = (ITracker*) ptr(); + } + + lib = mainApp->current_tracker2(); + + if (lib && lib->Constructor) { + ptr = (CTOR_FUNPTR) lib->Constructor; + pSecondTracker = (ITracker*) ptr(); + } + + lib = mainApp->current_protocol(); + + if (lib && lib->Constructor) { + ptr = (CTOR_FUNPTR) lib->Constructor; + pProtocol = (IProtocol*) ptr(); + } + + lib = mainApp->current_filter(); + + if (lib && lib->Constructor) { + ptr = (CTOR_FUNPTR) lib->Constructor; + pFilter = (IFilter*) ptr(); + } + + // Check if the Protocol-server files were installed OK. + // Some servers also create a memory-mapping, for Inter Process Communication. + // The handle of the MainWindow is sent to 'The Game', so it can send a message back. + + if (pProtocol) + if(!pProtocol->checkServerInstallationOK()) + return; + + // retrieve pointers to the User Interface and the main Application + if (pTracker) { + pTracker->StartTracker( mainApp->get_video_widget() ); + } + if (pSecondTracker) { + pSecondTracker->StartTracker( mainApp->get_video_widget() ); + } + + correct = true; +} + +DynamicLibrary::DynamicLibrary(const QString& filename) +{ + this->filename = filename; +#if defined(_WIN32) + QString fullPath = QCoreApplication::applicationDirPath() + "/" + this->filename; + handle = new QLibrary(fullPath); + qDebug() << handle->errorString(); + Dialog = (SETTINGS_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetDialog" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); + qDebug() << handle->errorString(); + Constructor = (NULLARY_DYNAMIC_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetConstructor" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); + qDebug() << handle->errorString(); + Metadata = (METADATA_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetMetadata" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); + qDebug() << handle->errorString(); +#else + QByteArray latin1 = QFile::encodeName(filename); + handle = dlopen(latin1.constData(), RTLD_NOW | +# ifdef __linux + RTLD_DEEPBIND +# elif defined(__APPLE__) + RTLD_LOCAL|RTLD_FIRST|RTLD_NOW +# else + 0 +# endif + ); + if (handle) + { + fprintf(stderr, "Error, if any: %s\n", dlerror()); + fflush(stderr); + Dialog = (DIALOG_FUNPTR) dlsym(handle, "GetDialog"); + fprintf(stderr, "Error, if any: %s\n", dlerror()); + fflush(stderr); + Constructor = (CTOR_FUNPTR) dlsym(handle, "GetConstructor"); + fprintf(stderr, "Error, if any: %s\n", dlerror()); + fflush(stderr); + Metadata = (METADATA_FUNPTR) dlsym(handle, "GetMetadata"); + fprintf(stderr, "Error, if any: %s\n", dlerror()); + fflush(stderr); + } else { + fprintf(stderr, "Error, if any: %s\n", dlerror()); + fflush(stderr); + } +#endif +} + +DynamicLibrary::~DynamicLibrary() +{ +#if defined(_WIN32) + handle->unload(); +#else + if (handle) + (void) dlclose(handle); +#endif +} diff --git a/facetracknoir/plugin-support.h b/facetracknoir/plugin-support.h new file mode 100644 index 00000000..4394d1a0 --- /dev/null +++ b/facetracknoir/plugin-support.h @@ -0,0 +1,93 @@ +#pragma once + +#if defined(_WIN32) +# define CALLING_CONVENTION_SUFFIX_VOID_FUNCTION "@0" +# ifdef _MSC_VER +# define MAYBE_STDCALL_UNDERSCORE "_" +#else +# define MAYBE_STDCALL_UNDERSCORE "" +# endif +#else +# define CALLING_CONVENTION_SUFFIX_VOID_FUNCTION "" +# define MAYBE_STDCALL_UNDERSCORE "" +#endif + +#ifdef _MSC_VER +# define virt_override +#else +# define virt_override override +#endif + +#include <cstdio> + +#include <QWidget> +#include <QDebug> +#include <QString> +#include <QLibrary> +#include <QFrame> +#include "ftnoir_tracker_base/ftnoir_tracker_base.h" +#include "ftnoir_filter_base/ftnoir_filter_base.h" +#include "ftnoir_protocol_base/ftnoir_protocol_base.h" + +#if defined(_WIN32) +# define CALLING_CONVENTION __stdcall +#else +# define CALLING_CONVENTION +#endif + +class IDynamicLibraryProvider; + +struct SelectedLibraries { +public: + ITracker* pTracker; + ITracker* pSecondTracker; + IFilter* pFilter; + IProtocol* pProtocol; + SelectedLibraries(IDynamicLibraryProvider* main = NULL); + ~SelectedLibraries(); + bool correct; +}; + +extern SelectedLibraries* Libraries; + +struct Metadata; + +extern "C" typedef void* (CALLING_CONVENTION * CTOR_FUNPTR)(void); +extern "C" typedef Metadata* (CALLING_CONVENTION* METADATA_FUNPTR)(void); +extern "C" typedef void* (CALLING_CONVENTION* DIALOG_FUNPTR)(void); + +class DynamicLibrary { +public: + DynamicLibrary(const QString& filename); + virtual ~DynamicLibrary(); + DIALOG_FUNPTR Dialog; + CTOR_FUNPTR Constructor; + METADATA_FUNPTR Metadata; + QString filename; +private: +#if defined(_WIN32) + QLibrary* handle; +#else + void* handle; +#endif +}; + +struct Metadata +{ + Metadata() {} + virtual ~Metadata() {} + + virtual void getFullName(QString *strToBeFilled) = 0; + virtual void getShortName(QString *strToBeFilled) = 0; + virtual void getDescription(QString *strToBeFilled) = 0; + virtual void getIcon(QIcon *icon) = 0; +}; + +class IDynamicLibraryProvider { +public: + virtual DynamicLibrary* current_tracker1() = 0; + virtual DynamicLibrary* current_tracker2() = 0; + virtual DynamicLibrary* current_protocol() = 0; + virtual DynamicLibrary* current_filter() = 0; + virtual QFrame* get_video_widget() = 0; +}; diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index 46440c32..49e7f302 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -10,7 +10,7 @@ #include <QPainterPath> #include <QDebug> #include <QMutex> -#include "global-settings.h" +#include "plugin-support.h" #include <ftnoir_tracker_base/ftnoir_tracker_types.h> #include <vector> diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index c9965f2d..08e64667 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -9,7 +9,7 @@ #include <cmath> #include <QDebug> #include <QMutexLocker> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" using namespace std; FTNoIR_Filter::FTNoIR_Filter() : first_run(true) diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index 125c1a39..4a9136b5 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -1,7 +1,7 @@ #pragma once #include "ftnoir_filter_base/ftnoir_filter_base.h" #include "ui_ftnoir_accela_filtercontrols.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include <QMutex> #define ACCELA_SMOOTHING_ROTATION 60.0 diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp index ca321891..41b6022b 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp @@ -3,7 +3,7 @@ #include <QDebug> #include <algorithm> #include <QDoubleSpinBox> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" FilterControls::FilterControls() : accela_filter(nullptr) diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp index a024e789..d42baef7 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp @@ -1,5 +1,5 @@ #include "ftnoir_filter_accela.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" extern "C" FTNOIR_FILTER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp index c073bfa4..1001514d 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp @@ -26,7 +26,7 @@ #include "math.h" #include <QDebug> #include <QWidget> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include <algorithm> #include <QMutexLocker> diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h index bde3e79c..c08b0dd9 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h @@ -27,7 +27,7 @@ #define INCLUDED_FTN_FILTER_H #include "ftnoir_filter_base/ftnoir_filter_base.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include "ui_ftnoir_ewma_filtercontrols.h" #include <QWidget> #include <QMutex> diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp index fb02354e..c042d12c 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp @@ -25,7 +25,7 @@ #include "ftnoir_filter_ewma2.h" #include <cmath> #include <QDebug> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include "ui_ftnoir_ewma_filtercontrols.h" FilterControls::FilterControls() : diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp index 6ef7768e..106bf4c6 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp @@ -23,7 +23,7 @@ * * ********************************************************************************/ #include "ftnoir_filter_ewma2.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" extern "C" FTNOIR_FILTER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { diff --git a/ftnoir_filter_kalman/ftnoir_filter_kalman.h b/ftnoir_filter_kalman/ftnoir_filter_kalman.h index 6c737b4b..e4b27d1f 100755 --- a/ftnoir_filter_kalman/ftnoir_filter_kalman.h +++ b/ftnoir_filter_kalman/ftnoir_filter_kalman.h @@ -10,7 +10,7 @@ #include "ftnoir_filter_base/ftnoir_filter_base.h" #include "ui_ftnoir_kalman_filtercontrols.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include <opencv2/opencv.hpp> #include <vector> #include <QString> diff --git a/ftnoir_filter_kalman/kalman.cpp b/ftnoir_filter_kalman/kalman.cpp index bef6ddad..81ee1df2 100644 --- a/ftnoir_filter_kalman/kalman.cpp +++ b/ftnoir_filter_kalman/kalman.cpp @@ -5,7 +5,7 @@ * copyright notice and this permission notice appear in all copies. */ #include "ftnoir_filter_kalman.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include <QDebug> #include <math.h> diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp index 0ef6b50f..15a79131 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp @@ -26,7 +26,7 @@ * It is based on the (Linux) example made by Melchior FRANZ. * ********************************************************************************/ #include "ftnoir_protocol_fg.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include <ftnoir_tracker_base/ftnoir_tracker_types.h> // For Todd and Arda Kutlu diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.h b/ftnoir_protocol_fg/ftnoir_protocol_fg.h index dca1f245..f24331d9 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg.h +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.h @@ -32,7 +32,7 @@ #include <QThread> #include <QUdpSocket> #include <QMessageBox> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include "facetracknoir/options.h" using namespace options; diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp index 1c3e5ef8..d9c596b7 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp @@ -28,7 +28,7 @@ #include "ftnoir_protocol_fg.h" #include <QObject> #include <QFile> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" //******************************************************************************************************* // FaceTrackNoIR Client Settings-dialog. diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp index 3125f136..b7e286fd 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp @@ -24,7 +24,7 @@ ********************************************************************************/ #include "ftnoir_protocol_fg.h" #include <QDebug> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp index e93a751e..4f71eb89 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp @@ -27,7 +27,7 @@ ********************************************************************************/ #include "ftnoir_protocol_ftn.h" #include <QFile> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" /** constructor **/ FTNoIR_Protocol::FTNoIR_Protocol() diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h index 99e6c6a1..2e3c270a 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h @@ -34,7 +34,7 @@ #include <QUdpSocket> #include <QMessageBox> #include <math.h> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include "facetracknoir/options.h" using namespace options; diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp index 37db314f..6afe20f2 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp @@ -23,7 +23,7 @@ * * ********************************************************************************/ #include "ftnoir_protocol_ftn.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" FTNControls::FTNControls() : QWidget() diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp index 99689432..fdc2f4ca 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp @@ -23,7 +23,7 @@ * * ********************************************************************************/ #include "ftnoir_protocol_ftn.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp index 70fde395..d2a8e5bf 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp @@ -1,5 +1,5 @@ #include "ftnoir_protocol_libevdev.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" //#include "ftnoir_tracker_base/ftnoir_tracker_types.h" #include <cstdio> #include <algorithm> diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h index 66f53547..c9c80c5f 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h @@ -9,7 +9,7 @@ #include "ui_ftnoir_libevdev_controls.h" #include <QMessageBox> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" extern "C" { # include <libevdev/libevdev.h> diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp index bb54c354..b63cc0c7 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp @@ -1,5 +1,5 @@ #include "ftnoir_protocol_libevdev.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" LibevdevControls::LibevdevControls() : QWidget() { diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp index 79a22d5e..639b93d7 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp @@ -1,6 +1,6 @@ #include "ftnoir_protocol_libevdev.h" #include <QDebug> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() { } diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.h b/ftnoir_protocol_wine/ftnoir_protocol_wine.h index 50d2bc0c..70a2b0d0 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine.h +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.h @@ -39,7 +39,7 @@ #include <QMutex> #include <QMutexLocker> #include <QFile> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include "compat/compat.h" #include "ftnoir_protocol_wine/wine-shm.h" diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp index ecbc2137..29d46219 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp @@ -1,6 +1,6 @@ #include "ftnoir_protocol_wine.h" #include <QDebug> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" //******************************************************************************************************* // FaceTrackNoIR Client Settings-dialog. diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp index dd7f17a6..4b00d7dc 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp @@ -1,6 +1,6 @@ #include "ftnoir_protocol_wine.h" #include <QDebug> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() { } diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index c3c8170c..5e983f4f 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -8,7 +8,7 @@ #include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "ftnoir_tracker_aruco.h" #include "ui_aruco-trackercontrols.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include <cmath> #include <QMutexLocker> #include <aruco.h> @@ -457,7 +457,7 @@ extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDial TrackerControls::TrackerControls() { tracker = nullptr; - calib_timer.setInterval(100); + calib_timer.setInterval(200); ui.setupUi(this); setAttribute(Qt::WA_NativeWindow, true); tie_setting(s.camera_index, ui.cameraName); diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 76a6ba71..3f67953e 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -4,7 +4,7 @@ #include "ftnoir_tracker_ht.h" #include "ftnoir_tracker_ht_dll.h" #include "ui_ht-trackercontrols.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include <cmath> #if defined(_WIN32) diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h b/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h index ffdc5262..af2ec00c 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h @@ -6,7 +6,7 @@ */ #include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" //----------------------------------------------------------------------------- class TrackerDll : public Metadata diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp index 70af2893..6345ac57 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp @@ -1,6 +1,6 @@ /* Copyright: "i couldn't care less what anyone does with the 5 lines of code i wrote" - mm0zct */ #include "ftnoir_tracker_hydra.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include "facetracknoir/rotation.h" #include <cstdio> #ifdef _WIN32 diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h index 05a8b076..90574a4b 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h @@ -3,7 +3,7 @@ #include <QMessageBox> #include <QWaitCondition> #include <math.h> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include "facetracknoir/options.h" using namespace options; diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp index 14be2c37..6c98a0a1 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp @@ -1,5 +1,5 @@ #include "ftnoir_tracker_hydra.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" TrackerControls::TrackerControls() : QWidget() diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp index a2cc7c01..f0939081 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp @@ -1,7 +1,7 @@ /* Copyright: "i couldn't care less what anyone does with the 5 lines of code i wrote" - mm0zct */ #include "ftnoir_tracker_hydra.h" #include <QDebug> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" void FTNoIR_TrackerDll::getFullName(QString *strToBeFilled) { diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp index 97b2448b..1b6d9ddd 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp @@ -23,7 +23,7 @@ * * ********************************************************************************/ #include "ftnoir_tracker_udp.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" FTNoIR_Tracker::FTNoIR_Tracker() : should_quit(false) { diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.h b/ftnoir_tracker_udp/ftnoir_tracker_udp.h index 62eb67df..2854e942 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.h +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.h @@ -6,7 +6,7 @@ #include <QMutex> #include <QWaitCondition> #include <math.h> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include "facetracknoir/options.h" using namespace options; diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp index 8d1b99f2..17b174e8 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp @@ -23,7 +23,7 @@ * * ********************************************************************************/ #include "ftnoir_tracker_udp.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" TrackerControls::TrackerControls() : QWidget() diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp index 22dc7daa..3d6fbc28 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp @@ -24,7 +24,7 @@ ********************************************************************************/ #include "ftnoir_tracker_udp.h" #include <QDebug> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" void FTNoIR_TrackerDll::getFullName(QString *strToBeFilled) { diff --git a/opentrack-api/opentrack-guts.h b/opentrack-api/opentrack-guts.h index c8e3309a..c7134a6a 100644 --- a/opentrack-api/opentrack-guts.h +++ b/opentrack-api/opentrack-guts.h @@ -12,7 +12,7 @@ #include <QString> #include <QApplication> #include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include <memory> typedef ITracker* opentrack_tracker; -- cgit v1.2.3 From c78eed3db6a74f802b93e7e17942bbac1b736ffa Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 27 Jul 2014 19:22:33 +0200 Subject: Finish rename for all platforms --- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp | 2 +- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h | 2 +- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp | 2 +- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp | 2 +- ftnoir_protocol_ft/ftnoir_protocol_ft.h | 2 +- ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp | 2 +- ftnoir_protocol_mouse/ftnoir_protocol_mouse.h | 2 +- ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp | 2 +- ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp | 2 +- ftnoir_protocol_sc/ftnoir_protocol_sc.cpp | 2 +- ftnoir_protocol_sc/ftnoir_protocol_sc.h | 2 +- ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp | 2 +- ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp | 2 +- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp | 2 +- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h | 2 +- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp | 2 +- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp | 2 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h | 2 +- ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 2 +- ftnoir_tracker_joystick/ftnoir_tracker_joystick.h | 2 +- ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp | 2 +- ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp | 2 +- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 2 +- ftnoir_tracker_rift/ftnoir_tracker_rift.h | 2 +- ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp | 2 +- ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp index 632d502a..a91c75c0 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp @@ -25,7 +25,7 @@ * to games, using the FSUIPC.dll. * ********************************************************************************/ #include "ftnoir_protocol_fsuipc.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" /** constructor **/ FTNoIR_Protocol::FTNoIR_Protocol() diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h index ff8d3b7f..dcdd8098 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h @@ -31,7 +31,7 @@ #include <windows.h> #include <stdlib.h> #include "FSUIPC_User.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include "ftnoir_protocol_base/ftnoir_protocol_base.h" #include "ui_ftnoir_fsuipccontrols.h" #include <QMessageBox> diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp index d97cff99..89823499 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp @@ -23,7 +23,7 @@ * * ********************************************************************************/ #include "ftnoir_protocol_fsuipc.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" FSUIPCControls::FSUIPCControls() : QWidget() diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp index 57b174c5..6cffc4f3 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp @@ -23,7 +23,7 @@ * * ********************************************************************************/ #include "ftnoir_protocol_fsuipc.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata(void) { diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h index 0af9ff07..01682e69 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h @@ -27,7 +27,7 @@ #pragma once #include "ftnoir_protocol_base/ftnoir_protocol_base.h" #include "ui_ftnoir_ftcontrols.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include "fttypes.h" #include <QMessageBox> #include <QSettings> diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp index cc8aa11e..52f9b53b 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp @@ -27,7 +27,7 @@ * but no face-tracking. * ********************************************************************************/ #include "ftnoir_protocol_mouse.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" void FTNoIR_Protocol::sendHeadposeToGame(const double *headpose ) { double fMouse_X = 0; diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h index 01f283d3..f1e752b0 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h @@ -40,7 +40,7 @@ #include <QFile> #include <windows.h> #include <winuser.h> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include "facetracknoir/options.h" using namespace options; diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp index 22b7024c..63524de9 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp @@ -23,7 +23,7 @@ * * ********************************************************************************/ #include "ftnoir_protocol_mouse.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" MOUSEControls::MOUSEControls() : _proto(nullptr) { diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp index 54f6b307..0f63b290 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp @@ -23,7 +23,7 @@ * * ********************************************************************************/ #include "ftnoir_protocol_mouse.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp index 2714e980..7de762ac 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp @@ -27,7 +27,7 @@ * must be treated as such... * ********************************************************************************/ #include "ftnoir_protocol_sc.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" importSimConnect_CameraSetRelative6DOF FTNoIR_Protocol::simconnect_set6DOF; HANDLE FTNoIR_Protocol::hSimConnect = 0; // Handle to SimConnect diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.h b/ftnoir_protocol_sc/ftnoir_protocol_sc.h index a13c0097..758ca1ec 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.h +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.h @@ -29,7 +29,7 @@ #pragma once #undef _WIN32_WINNT #define _WIN32_WINNT 0x0502 -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" // // Prevent the SimConnect manifest from being merged in the application-manifest // This is necessary to run FaceTrackNoIR on a PC without FSX diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp index c7428d77..ea55cc1b 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp @@ -24,7 +24,7 @@ ********************************************************************************/ #include "ftnoir_protocol_sc.h" #include <QDebug> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" SCControls::SCControls() : QWidget() diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp index 0a52fa96..e4741d42 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp @@ -24,7 +24,7 @@ ********************************************************************************/ #include "ftnoir_protocol_sc.h" #include <QDebug> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp index a3a5cb5f..5f469e7f 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp @@ -1,5 +1,5 @@ #include "ftnoir_protocol_vjoy.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include <ftnoir_tracker_base/ftnoir_tracker_types.h> /** constructor **/ diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h index 873b4e3c..24a4e28f 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h @@ -33,7 +33,7 @@ #include <QMessageBox> #include <QSettings> #include <math.h> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include <windows.h> #define FT_PROGRAMID "FT_ProgramID" diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp index febb7b18..66aa559e 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp @@ -1,5 +1,5 @@ #include "ftnoir_protocol_vjoy.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" VJoyControls::VJoyControls() : QWidget() { diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp index 5cb5ef05..180cd683 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp @@ -1,6 +1,6 @@ #include "ftnoir_protocol_vjoy.h" #include <QDebug> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() { } diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h index ffdc5262..af2ec00c 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h @@ -6,7 +6,7 @@ */ #include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" //----------------------------------------------------------------------------- class TrackerDll : public Metadata diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index f9789dce..806ba91e 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -1,5 +1,5 @@ #include "ftnoir_tracker_joystick.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #undef NDEBUG #include <QMutexLocker> diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h index 06d06186..2c1bc731 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h @@ -16,7 +16,7 @@ #include <QMutex> #include <QFrame> #include <cmath> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #ifndef DIRECTINPUT_VERSION # define DIRECTINPUT_VERSION 0x800 #endif diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp index b0766634..7f24a8f1 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp @@ -1,5 +1,5 @@ #include "ftnoir_tracker_joystick.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" static BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext ) { diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp index 325d24a4..f5867fea 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp @@ -1,6 +1,6 @@ #include "ftnoir_tracker_joystick.h" #include <QDebug> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" void FTNoIR_TrackerDll::getFullName(QString *strToBeFilled) { diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index 0a2ded7d..1c38e0fa 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -1,6 +1,6 @@ /* Copyright: "i couldn't care less what anyone does with the 5 lines of code i wrote" - mm0zct */ #include "ftnoir_tracker_rift.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include "OVR_CAPI.h" #include "Kernel/OVR_Math.h" #include <cstdio> diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index 26496bc2..54a8bcad 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -4,7 +4,7 @@ #include <QMessageBox> #include <QWaitCondition> #include <cmath> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" #include "OVR.h" #include <memory> #include "facetracknoir/options.h" diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp index ad532100..0c249257 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp @@ -1,5 +1,5 @@ #include "ftnoir_tracker_rift.h" -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" TrackerControls::TrackerControls() : QWidget() diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp index 2b24411c..3edee290 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp @@ -1,7 +1,7 @@ /* Copyright: "i couldn't care less what anyone does with the 5 lines of code i wrote" - mm0zct */ #include "ftnoir_tracker_rift.h" #include <QDebug> -#include "facetracknoir/global-settings.h" +#include "facetracknoir/plugin-support.h" FTNoIR_TrackerDll::FTNoIR_TrackerDll() { //populate the description strings -- cgit v1.2.3 From 7bf7e2af2f6f62251eafc5ddd08db6effd3df751 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 27 Jul 2014 19:48:13 +0200 Subject: further rename fixes --- CMakeLists.txt | 2 +- facetracknoir/plugin-support.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cbab479b..e12f1c84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -217,7 +217,7 @@ macro(opentrack_library n) install(TARGETS ${n} RUNTIME DESTINATION . LIBRARY DESTINATION .) endmacro() -file(GLOB opentrack-lib-c "opentrack-api/*.cpp" "facetracknoir/global-settings.cpp" "opentrack-api/*.h" "facetracknoir/global-settings.h") +file(GLOB opentrack-lib-c "opentrack-api/*.cpp" "facetracknoir/global-settings.cpp" "opentrack-api/*.h" "facetracknoir/plugin-support.cpp") opentrack_module(opentrack-bin facetracknoir) opentrack_module(opentrack-pose-widget ftnoir_posewidget) diff --git a/facetracknoir/plugin-support.cpp b/facetracknoir/plugin-support.cpp index 09e1c200..5d810ed1 100644 --- a/facetracknoir/plugin-support.cpp +++ b/facetracknoir/plugin-support.cpp @@ -88,11 +88,11 @@ DynamicLibrary::DynamicLibrary(const QString& filename) QString fullPath = QCoreApplication::applicationDirPath() + "/" + this->filename; handle = new QLibrary(fullPath); qDebug() << handle->errorString(); - Dialog = (SETTINGS_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetDialog" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); + Dialog = (DIALOG_FUNPTR) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetDialog" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); qDebug() << handle->errorString(); - Constructor = (NULLARY_DYNAMIC_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetConstructor" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); + Constructor = (CTOR_FUNPTR) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetConstructor" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); qDebug() << handle->errorString(); - Metadata = (METADATA_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetMetadata" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); + Metadata = (METADATA_FUNPTR) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetMetadata" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); qDebug() << handle->errorString(); #else QByteArray latin1 = QFile::encodeName(filename); -- cgit v1.2.3 From b3b44a7f8e6c1365a0c917517501866ac3c5f684 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 28 Jul 2014 12:14:59 +0200 Subject: rift: position tracking, logic fixes --- ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui | 266 +++++++++++++-------- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 19 +- ftnoir_tracker_rift/ftnoir_tracker_rift.h | 5 +- ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp | 4 + 4 files changed, 188 insertions(+), 106 deletions(-) diff --git a/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui b/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui index a9168239..62edbec5 100644 --- a/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui +++ b/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>209</width> - <height>288</height> + <width>532</width> + <height>481</height> </rect> </property> <property name="sizePolicy"> @@ -33,15 +33,149 @@ <bool>false</bool> </property> <layout class="QGridLayout" name="gridLayout_2"> + <item row="2" column="0"> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Yaw spring</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QCheckBox" name="yawSpring"> + <property name="text"> + <string>Enable</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Persistence</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QDoubleSpinBox" name="persistence"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>23</height> + </size> + </property> + <property name="decimals"> + <number>5</number> + </property> + <property name="minimum"> + <double>0.900000000000000</double> + </property> + <property name="maximum"> + <double>1.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.001000000000000</double> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Constant drift</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QDoubleSpinBox" name="constantDrift"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>23</height> + </size> + </property> + <property name="decimals"> + <number>5</number> + </property> + <property name="minimum"> + <double>0.000100000000000</double> + </property> + <property name="maximum"> + <double>0.100000000000000</double> + </property> + <property name="singleStep"> + <double>0.001000000000000</double> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Deadzone</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QDoubleSpinBox" name="deadzone"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>23</height> + </size> + </property> + <property name="decimals"> + <number>5</number> + </property> + <property name="maximum"> + <double>0.100000000000000</double> + </property> + <property name="singleStep"> + <double>0.010000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="3" column="0"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> <item row="0" column="0"> <widget class="QGroupBox" name="groupBox_3"> <property name="title"> - <string>Enable Axis</string> + <string>Axes</string> </property> <property name="flat"> <bool>false</bool> </property> <layout class="QFormLayout" name="formLayout_2"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::ExpandingFieldsGrow</enum> + </property> <item row="0" column="0"> <widget class="QLabel" name="label_6"> <property name="sizePolicy"> @@ -150,140 +284,78 @@ </property> </widget> </item> - </layout> - </widget> - </item> - <item row="1" column="0"> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Yaw spring</string> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QCheckBox" name="yawSpring"> - <property name="text"> - <string>Enable</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Persistence</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QDoubleSpinBox" name="persistence"> + <item row="3" column="0"> + <widget class="QLabel" name="label_7"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>23</height> - </size> - </property> - <property name="decimals"> - <number>5</number> - </property> - <property name="minimum"> - <double>0.900000000000000</double> - </property> - <property name="maximum"> - <double>1.000000000000000</double> - </property> - <property name="singleStep"> - <double>0.001000000000000</double> + <property name="text"> + <string>X</string> </property> </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_2"> + <item row="3" column="1"> + <widget class="QCheckBox" name="chkEnableX"> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> <property name="text"> - <string>Constant drift</string> + <string/> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QDoubleSpinBox" name="constantDrift"> + <item row="4" column="0"> + <widget class="QLabel" name="label_8"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>23</height> - </size> - </property> - <property name="decimals"> - <number>5</number> - </property> - <property name="minimum"> - <double>0.000100000000000</double> - </property> - <property name="maximum"> - <double>0.100000000000000</double> - </property> - <property name="singleStep"> - <double>0.001000000000000</double> + <property name="text"> + <string>Y</string> </property> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_3"> + <item row="4" column="1"> + <widget class="QCheckBox" name="chkEnableY"> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> <property name="text"> - <string>Deadzone</string> + <string/> </property> </widget> </item> - <item row="3" column="1"> - <widget class="QDoubleSpinBox" name="deadzone"> + <item row="5" column="0"> + <widget class="QLabel" name="label_10"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>23</height> - </size> - </property> - <property name="decimals"> - <number>5</number> + <property name="text"> + <string>Z</string> </property> - <property name="maximum"> - <double>0.100000000000000</double> + </widget> + </item> + <item row="5" column="1"> + <widget class="QCheckBox" name="chkEnableZ"> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> </property> - <property name="singleStep"> - <double>0.010000000000000</double> + <property name="text"> + <string/> </property> </widget> </item> </layout> </widget> </item> - <item row="2" column="0"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> </layout> </widget> <resources/> diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index 1c38e0fa..ba035467 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -38,7 +38,8 @@ void Rift_Tracker::GetHeadPoseData(double *data) { frameTiming = ovrHmd_BeginFrameTiming(hmd, 0); ovrSensorState ss = ovrHmd_GetSensorState(hmd, frameTiming.ScanoutMidpointSeconds); - if(ss.StatusFlags & (ovrStatus_OrientationTracked | ovrStatus_PositionTracked)){ + ovrHmd_EndFrameTiming(hmd); + if(ss.StatusFlags & ovrStatus_OrientationTracked) { ovrPosef pose = ss.Predicted.Pose; Quatf quat = pose.Orientation; float yaw, pitch, roll; @@ -52,16 +53,18 @@ void Rift_Tracker::GetHeadPoseData(double *data) yaw += s.constant_drift; old_yaw=yaw; } - if (s.bEnableYaw) { + if (s.bEnableYaw) data[Yaw] = yaw * 57.295781f; - } - if (s.bEnablePitch) { + if (s.bEnablePitch) data[Pitch] = pitch * 57.295781f; - } - if (s.bEnableRoll) { + if (s.bEnableRoll) data[Roll] = roll * 57.295781f; - } - ovrHmd_EndFrameTiming(hmd); + if (s.bEnableX) + data[TX] = pose.Position.x * 1e-2; + if (s.bEnableY) + data[TY] = pose.Position.y * 1e-2; + if (s.bEnableX) + data[TZ] = pose.Position.z * 1e-2; } } } diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index 54a8bcad..e351b5fe 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -12,13 +12,16 @@ using namespace options; struct settings { pbundle b; - value<bool> bEnableYaw, bEnablePitch, bEnableRoll, useYawSpring; + value<bool> bEnableYaw, bEnablePitch, bEnableRoll, bEnableX, bEnableY, bEnableZ, useYawSpring; value<double> constant_drift, persistence, deadzone; settings() : b(bundle("Rift")), bEnableYaw(b, "EnableYaw", true), bEnablePitch(b, "EnablePitch", true), bEnableRoll(b, "EnableRoll", true), + bEnableX(b, "EnableX", true), + bEnableY(b, "EnableY", true), + bEnableZ(b, "EnableZ", true), useYawSpring(b, "yaw-spring", false), constant_drift(b, "constant-drift", 0.000005), persistence(b, "persistence", 0.99999), diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp index 0c249257..b7ec9784 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp @@ -14,6 +14,10 @@ QWidget() tie_setting(s.bEnablePitch, ui.chkEnablePitch); tie_setting(s.bEnableRoll, ui.chkEnableRoll); + tie_setting(s.bEnableX, ui.chkEnableX); + tie_setting(s.bEnableY, ui.chkEnableY); + tie_setting(s.bEnableZ, ui.chkEnableZ); + tie_setting(s.constant_drift, ui.constantDrift); tie_setting(s.deadzone, ui.deadzone); tie_setting(s.persistence, ui.persistence); -- cgit v1.2.3 From 83f757afdbaa6cf6f8ab7792e2543ae78ac6ecc9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 28 Jul 2014 12:32:52 +0200 Subject: rift: fix typo (XXX still unknown the unit of position) --- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index ba035467..031eff32 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -60,11 +60,11 @@ void Rift_Tracker::GetHeadPoseData(double *data) if (s.bEnableRoll) data[Roll] = roll * 57.295781f; if (s.bEnableX) - data[TX] = pose.Position.x * 1e-2; + data[TX] = pose.Position.x * 1e-3; if (s.bEnableY) - data[TY] = pose.Position.y * 1e-2; + data[TY] = pose.Position.y * 1e-3; if (s.bEnableX) - data[TZ] = pose.Position.z * 1e-2; + data[TZ] = pose.Position.z * 1e-3; } } } -- cgit v1.2.3 From 3ecfadcb3ae7a3bf4bcf03f551970213a7afba21 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 28 Jul 2014 12:59:18 +0200 Subject: ftclient: remove/simplify some of broken logic --- freetrackclient/freetrackclient.cpp | 54 ++++++------------------------------- 1 file changed, 8 insertions(+), 46 deletions(-) diff --git a/freetrackclient/freetrackclient.cpp b/freetrackclient/freetrackclient.cpp index 395f017d..816e7b65 100644 --- a/freetrackclient/freetrackclient.cpp +++ b/freetrackclient/freetrackclient.cpp @@ -54,8 +54,6 @@ static HANDLE hFTMutex = 0; static const char* dllVersion = "1.0.0.0"; static const char* dllProvider = "FreeTrack"; -static unsigned short gameid = 0; - // // DllMain gets called, when the DLL is (un)loaded or a process attaches. // @@ -89,31 +87,11 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) #pragma comment(linker, "/export:FTGetData@4=FTGetData") FT_EXPORT(bool) FTGetData(PFreetrackData data) { - static int prevDataID = 0; - static int dlyTrackingOff = 0; - - // dbg_report("NP_GetData called."); if (FTCreateMapping() == false) return false; if (hFTMutex && WaitForSingleObject(hFTMutex, 5) == WAIT_OBJECT_0) { if (pMemData) { - - // - // When FaceTrackNoIR does not update frames (any more), don't update the data. - // - if (prevDataID != pMemData->data.DataID) { - memcpy(data, &pMemData->data, sizeof(TFreeTrackData)); - dlyTrackingOff = 0; - } - else { - dlyTrackingOff++; - if (dlyTrackingOff > 20) { - dlyTrackingOff = 100; - } - } - prevDataID = pMemData->data.DataID; - // // Limit the range of DataID // @@ -122,11 +100,6 @@ FT_EXPORT(bool) FTGetData(PFreetrackData data) } data->DataID = pMemData->data.DataID; - // - // Send the ID to FaceTrackNoIR, so it can display the game-name. - // This could be a FreeTrack-specific ID - // - pMemData->GameID = gameid; } ReleaseMutex(hFTMutex); } @@ -145,8 +118,6 @@ FT_EXPORT(bool) FTGetData(PFreetrackData data) FT_EXPORT(void) FTReportName( int name ) { dbg_report("FTReportName request (ID = %d).\n", name); - gameid = name; // They might have really passed the name here... but they didn't! - return; } /****************************************************************** @@ -199,24 +170,15 @@ FT_EXPORT(bool) FTCreateMapping(void) sizeof( FTMemMap ), (LPCSTR) FT_MM_DATA ); - if ( ( hFTMemMap != 0 ) && ( GetLastError() == ERROR_ALREADY_EXISTS ) ) { - dbg_report("FTCreateMapping: Mapping already exists.\n"); - CloseHandle( hFTMemMap ); - hFTMemMap = 0; - } + if (hFTMemMap == NULL) + { + pMemData = NULL; + return false; + } + + pMemData = (FTMemMap *) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof( FTMemMap ) ); + hFTMutex = CreateMutexA(NULL, false, FREETRACK_MUTEX); - // - // Create a new FileMapping, Read/Write access - // - hFTMemMap = OpenFileMappingA( FILE_MAP_WRITE , false , (LPCSTR) FT_MM_DATA ); - if ( ( hFTMemMap != 0 ) ) { - dbg_report("FTCreateMapping: Mapping opened.\n"); - pMemData = (FTMemMap *) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof( FTMemMap ) ); - hFTMutex = CreateMutexA(NULL, false, FREETRACK_MUTEX); - } - else { - return false; - } return true; } -- cgit v1.2.3 From ed33bf91fc5999eb55442524458585be3fc608e4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 28 Jul 2014 13:22:30 +0200 Subject: build system bug not relevant anymore --- compat/qt-bug-appeasement.cpp | 1 - facetracknoir/qt-moc.h | 10 ---------- 2 files changed, 11 deletions(-) delete mode 100644 compat/qt-bug-appeasement.cpp delete mode 100644 facetracknoir/qt-moc.h diff --git a/compat/qt-bug-appeasement.cpp b/compat/qt-bug-appeasement.cpp deleted file mode 100644 index 9a86ac0a..00000000 --- a/compat/qt-bug-appeasement.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "facetracknoir/qt-moc.h" diff --git a/facetracknoir/qt-moc.h b/facetracknoir/qt-moc.h deleted file mode 100644 index 8ccfffe8..00000000 --- a/facetracknoir/qt-moc.h +++ /dev/null @@ -1,10 +0,0 @@ -#include <QObject> - -// this file exists only such that cmake qt automoc is appeased - -class AutomocMe : public QObject { - Q_OBJECT -private: - virtual void foo() = 0; - AutomocMe() {} -}; -- cgit v1.2.3 From ab2cd9acdaa6ce3b2f356ac858e52485e65c2186 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 29 Aug 2014 07:47:49 +0200 Subject: Update freetrack game definitions --- bin/settings/facetracknoir supported games.csv | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/settings/facetracknoir supported games.csv b/bin/settings/facetracknoir supported games.csv index 91b9e6e6..d0b737b8 100644 --- a/bin/settings/facetracknoir supported games.csv +++ b/bin/settings/facetracknoir supported games.csv @@ -22,6 +22,7 @@ No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID 19;America's Army 3;FreeTrack20;V170;;;14203;00133F3206BCEA252BB700 20;ANAG 3D;FreeTrack20;V160;;;20250;0014E2D1D7780A72166300 21;Apache: Air Assault;FreeTrack20;V160;V;paleta77;1875;001591D997A2D912AAA200 +519;Apex Motorsports;FreeTrack20;V160;;;3675;02078F3159271BBE676800 22;Aprisoft Gartenplaner;FreeTrack20;V160;;;20014;0016F2F27A5762FA937A00 23;Aprisoft Traumhaus Designer;FreeTrack20;V160;;;20013;00174655E792BB825B9300 498;ARI;FreeTrack20;V160;;;20795;01F23FB9A61044E206E200 @@ -121,6 +122,7 @@ No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID 108;EMS Simulations;FreeTrack20;V160;;;20390;006CA59E687D1589DE8500 109;Enemy Engaged 2;FreeTrack20;V160;;;2102;006D010873EA635AEDC800 110;Enemy Engaged: Commanche vs Hokum;FreeTrack20;V160;;;2101;006E157D789379636AED00 +524;Enemy Starfighter;FreeTrack20;V160;;;3725;020C7EF3AC4F08C8787600 111;Envision TE;FreeTrack20;V160;;;20320;006FD13C2A863CAF26AB00 112;EON Reality;FreeTrack20;V160;;;20410;0070B6C6142771F82EE900 113;eSigma;FreeTrack20;V160;;;20700;0071950F9AA60DAD2E9F00 @@ -183,6 +185,7 @@ No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID 162;GTR;FreeTrack20;V160;;;3901;00A2FD6BFE39A881B85B00 163;GTR2 EVO;FreeTrack20;V160;V;zild1221 ;0;00A34B0FC37B2198F96300 164;Gun Commander;FreeTrack20;V160;;;2675;00A4E2D1D77E319FEE8600 +520;H1Z1;FreeTrack20;V170;;;6004;1774F090B1BA9E782D0800 165;Half Life 2;FreeTrack20;V160;;;7806;00A556BA018130AF365500 166;Halo;FreeTrack20;V160;;;3801;00A656BA018130AF3F9C00 502;hapTEL;FreeTrack20;V160;;;20805;01F63ADE510A20446B6A00 @@ -191,6 +194,7 @@ No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID 499;Harry's Hard Choices Interactive;FreeTrack20;V160;;;20800;01F33A21BAE3DB6D48A000 169;HAWX;FreeTrack20;V160;V;EmBeES ;0;00A9D615A9C8B088717000 170;Herissons (Paris France);FreeTrack20;V160;;;20001;00AAEA1CBED8C20B430B00 +523;hiCRANE2;FreeTrack20;V160;;;20835;020BA8FC8C7DFFA1381A00 171;HOBI;FreeTrack20;V160;;;20335;00ABB253777F1779168900 172;HoverAssault;FreeTrack20;V160;;;5303;00AC521358E3AA832A4000 173;HPC;FreeTrack20;V160;;;20600;00AD0FC9FF8D0A7CEF9500 @@ -233,8 +237,10 @@ No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID 476;KAI FLight Simulator;FreeTrack20;V160;;;20725;01DCC522132A5C01EDE500 208;Key Macro View;FreeTrack20;V160;;;12001;00D016BC08431B1EF90100 209;kiwi.vg;FreeTrack20;V160;;;20395;00D1409A430AB33633E900 +521;Kongsberg GlobalSim;FreeTrack20;V160;;;20825;0209B2C573D990BF764700 210;L-3;FreeTrack20;V160;;;20465;00D2F885EFA8DE67878B00 211;L-3 Communications;FreeTrack20;V160;;;20051;00D3D6E585F92F765E7800 +522;LG Electronics;FreeTrack20;V160;;;20830;020A3678F5833D513DCA00 212;Lionhead MGS Game Research;FreeTrack20;V160;;;15301;00D4C1BBF9227B238AE200 213;Live For Speed;FreeTrack20;V160;V;zild1221 ;7101;00D528228526A833521300 214;Live for Speed S2;FreeTrack20;V160;;;11601;00D63752FBC8235B923500 @@ -252,8 +258,8 @@ No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID 225;ManuVAR;FreeTrack20;V160;;;20455;00E153FE1E901CB0448800 226;MaqSIM4;FreeTrack20;V160;;;20026;00E28F54A207D29B611700 227;Mech Tactical Sim;FreeTrack20;V160;;;9501;00E3F3E85B1A8E34A53300 -516;MechWarrior Online;FreeTrack20;V170;;;3026;0BD2E0DCBC723836CD2400 228;Mechwarrior Online;FreeTrack20;V170;;;3025;00E414954226DB5D8CE200 +516;MechWarrior Online;FreeTrack20;V170;;;3026;0BD2E0DCBC723836CD2400 229;Medical Image Visualization;FreeTrack20;V160;;;20295;00E59343488532A5359B00 230;Meggitt Defense Systems;FreeTrack20;V160;;;20045;00E6926ED9122AB22AF300 231;MetaVR;FreeTrack20;V160;;;20545;00E7C5BEE48120A8308800 @@ -453,6 +459,7 @@ No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID 407;ULAN;FreeTrack20;V160;;;20645;01974ADE68E16780D97A00 473;Underwater Navigation;FreeTrack20;V160;;;20715;01D9FE2B94FB03772DE200 408;Unity 3D Plugin;FreeTrack20;V160;;;20430;0198D24C3F9B3B9C31BF00 +525;Unity 64-bit;FreeTrack20;V160;;;3750;020DC8AB18AF3539FA5200 409;Untitled 10tacle;FreeTrack20;V160;;;13701;0199FFE9E886F28728AA00 410;Untitled 3D People;FreeTrack20;V160;;;15501;019A6925968D38AD23A900 411;Untitled Apportmedia;FreeTrack20;V160;;;6801;019B3C2C1C9728B738B700 @@ -505,6 +512,7 @@ No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID 452;World Racing 2;FreeTrack20;V160;;;7201;01C41AAF68A2BA836AAE00 453;WWII Battle Tanks: T-34 vs. Tiger;FreeTrack20;V160;;;11102;01C5432C29C257F1963100 454;X Motor Racing;FreeTrack20;V160;;;1150;01C669259690E98629A900 +526;X-Camera;FreeTrack20;V160;;;3775;020E1C4055DE39CBC03D00 458;X-Cockpit for X-Plane;FreeTrack20;V160;;;2901;01CA1C76F8BF4852999300 459;X-Plane (32 and 64 bit);FreeTrack20;V160;V;EmBeES ;7701;01CB3FD0FC9D90FB943300 460;X-Plane 6DOF Plugin;FreeTrack20;V160;;;10101;01CCA15F28AF7963596300 -- cgit v1.2.3 From 8211006f5a44dffe1bb32ebe4aad8e3344e81aa1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 30 Aug 2014 09:17:53 +0200 Subject: remove redundant cache vars --- CMakeLists.txt | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e12f1c84..f0e401aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ project(opentrack) -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.11) +cmake_policy(SET CMP0020 NEW) include(CMakeParseArguments) @@ -58,10 +59,6 @@ if(WIN32 AND MSVC) set(SDK_GOOGLE_BREAKPAD "" CACHE PATH "google-breakpad for crash reporting") endif() -if(MINGW) - set(SDK_MINGW_PREFIX "" CACHE PATH "mingw prefix") -endif() - if(SDK_GOOGLE_BREAKPAD AND WIN32) add_definitions(-DOPENTRACK_BREAKPAD) include_directories("${SDK_GOOGLE_BREAKPAD}/src/client/windows/handler") @@ -105,18 +102,9 @@ SET(SDK_RIFT "" CACHE PATH "libOVR path") include_directories(${CMAKE_SOURCE_DIR}) -if(MINGW) - # qt scripts are broken - set(Qt5Gui_user32_LIBRARY ${SDK_MINGW_PREFIX}/mingw/lib/libuser32.a) - set(Qt5Gui_opengl32_LIBRARY ${SDK_MINGW_PREFIX}/mingw/lib/libopengl32.a) - set(Qt5Gui_glu32_LIBRARY ${SDK_MINGW_PREFIX}/mingw/lib/libglu32.a) - set(Qt5Gui_gdi32_LIBRARY ${SDK_MINGW_PREFIX}/mingw/lib/libgdi32.a) -endif() - find_package(OpenCV REQUIRED) find_package(Qt5 REQUIRED COMPONENTS Core Xml Network Widgets Gui ${maybe-serial-port} QUIET) -cmake_policy(SET CMP0020 NEW) include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS}) add_definitions(${Qt5Core_DEFINITIONS} ${Qt5Xml_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS}) @@ -130,12 +118,7 @@ set(SDK_ARUCO_LIBPATH "" CACHE FILEPATH "Path to Aruco static library") SET(SDK_OPENCV_STATIC FALSE CACHE BOOL "Whether OpenCV is statically linked") if(WIN32) set(SDK_SIMCONNECT "" CACHE PATH "Path to SimConnect SDK") - set(SDK_DIRECTX "" CACHE PATH "Path to DirectX SDK") set(SDK_FSUIPC "" CACHE PATH "Path to FSUIPC") - if(SDK_DIRECTX) - include_directories("${SDK_DIRECTX}/Include") - link_directories("${SDK_DIRECTX}/Lib") - endif() endif() if(NOT WIN32) -- cgit v1.2.3 From ac0e2cce53c078235331f00dc79b65d333c90e76 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 30 Aug 2014 09:18:23 +0200 Subject: use our own clock_gettime on win32 --- facetracknoir/timer.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/facetracknoir/timer.hpp b/facetracknoir/timer.hpp index e3fa38de..24d62e37 100644 --- a/facetracknoir/timer.hpp +++ b/facetracknoir/timer.hpp @@ -2,8 +2,7 @@ #include <time.h> #if defined (_WIN32) # include <windows.h> -# define CLOCK_MONOTONIC 0 -static inline void clock_gettime(int, struct timespec* ts) +static inline void opentrack_clock_gettime(int, struct timespec* ts) { static LARGE_INTEGER freq; @@ -20,7 +19,7 @@ static inline void clock_gettime(int, struct timespec* ts) ts->tv_sec = d.QuadPart / 1000000000L; ts->tv_nsec = d.QuadPart % 1000000000L; } - +# define clock_gettime opentrack_clock_gettime #else # if defined(__MACH__) # define CLOCK_MONOTONIC 0 -- cgit v1.2.3 From 6a7ed00c65c216e53b2f42edc2c71e93d8f4b7de Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 30 Aug 2014 09:25:19 +0200 Subject: remove capt obvious comments --- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp | 4 ---- ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp | 1 - ftnoir_protocol_wine/ftnoir_protocol_wine.cpp | 2 -- 3 files changed, 7 deletions(-) diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp index a91c75c0..572843c5 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp @@ -27,7 +27,6 @@ #include "ftnoir_protocol_fsuipc.h" #include "facetracknoir/plugin-support.h" -/** constructor **/ FTNoIR_Protocol::FTNoIR_Protocol() { prevPosX = 0.0f; @@ -43,9 +42,6 @@ FTNoIR_Protocol::~FTNoIR_Protocol() FSUIPCLib.unload(); } -// -// Scale the measured value to the Joystick values -// int FTNoIR_Protocol::scale2AnalogLimits( float x, float min_x, float max_x ) { double y; double local_x; diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp index 4f71eb89..af6f63f3 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp @@ -29,7 +29,6 @@ #include <QFile> #include "facetracknoir/plugin-support.h" -/** constructor **/ FTNoIR_Protocol::FTNoIR_Protocol() { } diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp index 58ffe974..83986b42 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp @@ -4,7 +4,6 @@ #include <sys/stat.h> /* For mode constants */ #include <fcntl.h> /* For O_* constants */ -/** constructor **/ FTNoIR_Protocol::FTNoIR_Protocol() : lck_shm(WINE_SHM_NAME, WINE_MTX_NAME, sizeof(WineSHM)), shm(NULL), gameid(0) { if (lck_shm.success()) { @@ -14,7 +13,6 @@ FTNoIR_Protocol::FTNoIR_Protocol() : lck_shm(WINE_SHM_NAME, WINE_MTX_NAME, sizeo wrapper.start("wine", QStringList() << (QCoreApplication::applicationDirPath() + "/opentrack-wrapper-wine.exe.so")); } -/** destructor **/ FTNoIR_Protocol::~FTNoIR_Protocol() { if (shm) { -- cgit v1.2.3 From 31f526c28a48edf7dca470a3cb068dc80f4014de Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 30 Aug 2014 09:30:29 +0200 Subject: remove capt obvious comments --- ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h | 1 - ftnoir_protocol_mouse/ftnoir_protocol_mouse.h | 4 ---- ftnoir_protocol_sc/ftnoir_protocol_sc.h | 4 ---- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp | 2 -- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h | 3 --- ftnoir_protocol_wine/ftnoir_protocol_wine.cpp | 13 ------------- ftnoir_protocol_wine/ftnoir_protocol_wine.h | 4 ---- ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp | 9 --------- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 9 --------- ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp | 9 --------- ftnoir_tracker_udp/ftnoir_tracker_udp.h | 4 ---- 11 files changed, 62 deletions(-) diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h index c9c80c5f..cb40959d 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h @@ -33,7 +33,6 @@ private: struct libevdev_uinput* uidev; }; -// Widget that has controls for FTNoIR protocol client-settings. class LibevdevControls: public QWidget, public IProtocolDialog { Q_OBJECT diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h index f1e752b0..e096bf50 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h @@ -71,7 +71,6 @@ private: struct settings s; }; -// Widget that has controls for FTNoIR protocol client-settings. class MOUSEControls: public QWidget, public IProtocolDialog { Q_OBJECT @@ -92,9 +91,6 @@ private slots: void doCancel(); }; -//******************************************************************************************************* -// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol -//******************************************************************************************************* class FTNoIR_ProtocolDll : public Metadata { public: diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.h b/ftnoir_protocol_sc/ftnoir_protocol_sc.h index 758ca1ec..d6185428 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.h +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.h @@ -128,7 +128,6 @@ private: settings s; }; -// Widget that has controls for FTNoIR protocol client-settings. class SCControls: public QWidget, public IProtocolDialog { Q_OBJECT @@ -144,9 +143,6 @@ private slots: void doCancel(); }; -//******************************************************************************************************* -// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol -//******************************************************************************************************* class FTNoIR_ProtocolDll : public Metadata { public: diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp index 5f469e7f..33dd35ae 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp @@ -2,13 +2,11 @@ #include "facetracknoir/plugin-support.h" #include <ftnoir_tracker_base/ftnoir_tracker_types.h> -/** constructor **/ FTNoIR_Protocol::FTNoIR_Protocol() { VJoy_Initialize("", ""); } -/** destructor **/ FTNoIR_Protocol::~FTNoIR_Protocol() { VJoy_Shutdown(); diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h index 24a4e28f..6ef828d4 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h @@ -72,9 +72,6 @@ private slots: void doCancel(); }; -//******************************************************************************************************* -// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol -//******************************************************************************************************* class FTNoIR_ProtocolDll : public Metadata { public: diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp index 83986b42..3208795c 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp @@ -50,24 +50,11 @@ void FTNoIR_Protocol::sendHeadposeToGame( const double *headpose ) { } } -// -// Check if the Client DLL exists and load it (to test it), if so. -// Returns 'true' if all seems OK. -// bool FTNoIR_Protocol::checkServerInstallationOK() { return lck_shm.success(); } -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Protocol object. - -// Export both decorated and undecorated names. -// GetProtocol - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetProtocol@0 - Common name decoration for __stdcall functions in C language. -//#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0") - extern "C" FTNOIR_PROTOCOL_BASE_EXPORT void* CALLING_CONVENTION GetConstructor() { return (IProtocol*) new FTNoIR_Protocol; diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.h b/ftnoir_protocol_wine/ftnoir_protocol_wine.h index 70a2b0d0..bde1c100 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine.h +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.h @@ -64,7 +64,6 @@ private: QMutex game_name_mutex; }; -// Widget that has controls for FTNoIR protocol client-settings. class FTControls: public QWidget, public IProtocolDialog { Q_OBJECT @@ -81,9 +80,6 @@ private slots: void doCancel(); }; -//******************************************************************************************************* -// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol -//******************************************************************************************************* class FTNoIR_ProtocolDll : public Metadata { public: diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp index 4b00d7dc..7bab1651 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp @@ -10,15 +10,6 @@ FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll() } -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Protocol object. - -// Export both decorated and undecorated names. -// GetProtocolDll - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetProtocolDll@0 - Common name decoration for __stdcall functions in C language. -//#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0") - extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_ProtocolDll; diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 5e983f4f..84b7eed3 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -440,15 +440,6 @@ extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructo return new Tracker; } -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Tracker-settings dialog object. - -// Export both decorated and undecorated names. -// GetTrackerDialog - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetTrackerDialog@0 - Common name decoration for __stdcall functions in C language. -//#pragma comment(linker, "/export:GetTrackerDialog=_GetTrackerDialog@0") - extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) { return new TrackerControls; diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp index f0939081..b14b865c 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp @@ -23,15 +23,6 @@ void FTNoIR_TrackerDll::getIcon(QIcon *icon) *icon = QIcon(":/images/facetracknoir.png"); } -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Tracker object. - -// Export both decorated and undecorated names. -// GetTrackerDll - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetTrackerDll@0 - Common name decoration for __stdcall functions in C language. -//#pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0") - extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_TrackerDll; diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.h b/ftnoir_tracker_udp/ftnoir_tracker_udp.h index 2854e942..c093c940 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.h +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.h @@ -46,7 +46,6 @@ private: settings s; }; -// Widget that has controls for FTNoIR protocol client-settings. class TrackerControls: public QWidget, public ITrackerDialog { Q_OBJECT @@ -63,9 +62,6 @@ private slots: void doCancel(); }; -//******************************************************************************************************* -// FaceTrackNoIR Tracker DLL. Functions used to get general info on the Tracker -//******************************************************************************************************* class FTNoIR_TrackerDll : public Metadata { public: -- cgit v1.2.3 From 512d269886e2d27c105157ef0db926fe03d48f70 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 30 Aug 2014 10:18:35 +0200 Subject: update API to OVR 0.4.1 --- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 20 +++++++++++--------- ftnoir_tracker_rift/ftnoir_tracker_rift.h | 8 ++++---- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index 031eff32..ea268f12 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -24,11 +24,12 @@ void Rift_Tracker::StartTracker(QFrame*) hmd = ovrHmd_Create(0); if (hmd) { - ovrHmd_GetDesc(hmd, &hmdDesc); - ovrHmd_StartSensor(hmd, ovrSensorCap_Orientation| ovrSensorCap_YawCorrection | ovrSensorCap_Position, ovrSensorCap_Orientation); - }else{ - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); - } + ovrHmd_ConfigureTracking(hmd, ovrTrackingCap_Orientation | ovrTrackingCap_MagYawCorrection | ovrTrackingCap_Position, ovrTrackingCap_Orientation); + } + else + { + QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); + } } @@ -36,11 +37,12 @@ void Rift_Tracker::GetHeadPoseData(double *data) { if (hmd) { - frameTiming = ovrHmd_BeginFrameTiming(hmd, 0); - ovrSensorState ss = ovrHmd_GetSensorState(hmd, frameTiming.ScanoutMidpointSeconds); - ovrHmd_EndFrameTiming(hmd); + ovrHSWDisplayState hsw; + if (ovrHmd_GetHSWDisplayState(hmd, &hsw), hsw.Displayed) + ovrHmd_DismissHSWDisplay(hmd); + ovrTrackingState ss = ovrHmd_GetTrackingState(hmd, frameTiming.ScanoutMidpointSeconds); if(ss.StatusFlags & ovrStatus_OrientationTracked) { - ovrPosef pose = ss.Predicted.Pose; + auto pose = ss.HeadPose.ThePose; Quatf quat = pose.Orientation; float yaw, pitch, roll; quat.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &pitch, &roll); diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index e351b5fe..3e26abdb 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -33,11 +33,11 @@ class Rift_Tracker : public ITracker { public: Rift_Tracker(); - virtual ~Rift_Tracker() virt_override; + virtual ~Rift_Tracker() override; - void StartTracker(QFrame *) virt_override; - void GetHeadPoseData(double *data) virt_override; - virtual int preferredHz() virt_override { return 250; } + void StartTracker(QFrame *) override; + void GetHeadPoseData(double *data) override; + virtual int preferredHz() override { return 250; } volatile bool should_quit; protected: void run(); // qthread override run method -- cgit v1.2.3 From 0027139d8348e07e6a2d9734489964961294fe22 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 30 Aug 2014 10:19:10 +0200 Subject: remove MSVC support Leave as-is to avoid unconditionally assuming GNU extensions and ABI --- CMakeLists.txt | 99 +++--------------------- facetracknoir/facetracknoir.cpp | 2 +- facetracknoir/main.cpp | 26 ------- facetracknoir/plugin-support.h | 8 +- ftnoir_filter_kalman/ftnoir_filter_kalman.h | 8 +- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h | 2 +- ftnoir_protocol_sc/ftnoir_protocol_sc.cpp | 2 +- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h | 11 --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- ftnoir_tracker_base/ftnoir_tracker_base_global.h | 2 +- ftnoir_tracker_hydra/ftnoir_tracker_hydra.h | 6 +- opentrack-api/context.cpp | 2 +- 12 files changed, 26 insertions(+), 144 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f0e401aa..647a3449 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,10 @@ project(opentrack) cmake_minimum_required(VERSION 2.8.11) cmake_policy(SET CMP0020 NEW) +if(MSVC) + message(FATAL_ERROR "Support for MSVC removed due to incomplete C++11 support") +endif() + include(CMakeParseArguments) set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/cmake/") @@ -47,43 +51,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) add_definitions(-DOPENTRACK_API -DIN_OPENTRACK) -if(MSVC) - add_definitions(-DNOMINMAX) -endif() - if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) add_definitions(-std=c++11) endif() -if(WIN32 AND MSVC) - set(SDK_GOOGLE_BREAKPAD "" CACHE PATH "google-breakpad for crash reporting") -endif() - -if(SDK_GOOGLE_BREAKPAD AND WIN32) - add_definitions(-DOPENTRACK_BREAKPAD) - include_directories("${SDK_GOOGLE_BREAKPAD}/src/client/windows/handler") - include_directories("${SDK_GOOGLE_BREAKPAD}/src/") -endif() - -if(WIN32 AND DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700) - find_path (WIN8_SDK_ROOT_DIR - Include/um/windows.h - PATHS - "$ENV{ProgramFiles}/Windows Kits/8.0" - "$ENV{ProgramFiles(x86)}/Windows Kits/8.0" - DOC "Windows 8 SDK root directory" - ) - - if(WIN8_SDK_ROOT_DIR) - SET(CMAKE_LIBRARY_PATH "${WIN8_SDK_ROOT_DIR}/Lib/win8/um/x86") - endif() -endif() - -if(WIN32 AND DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700) - SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") - SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO") - SET (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO") -endif() if(UNIX) set(SDK_ENABLE_LIBEVDEV FALSE CACHE BOOL "libevdev virtual joystick protocol support (probably Linux only)") @@ -162,15 +133,7 @@ set(EXTRA-MOCS "${CMAKE_SOURCE_DIR}/facetracknoir/options.h") function(link_with_dinput8 n) if(WIN32) - if(MSVC) - target_link_libraries(${n} - "${CMAKE_SOURCE_DIR}/dinput/dinput8.lib" - "${CMAKE_SOURCE_DIR}/dinput/dxguid.lib" - "${CMAKE_SOURCE_DIR}/dinput/strmiids.lib" - uuid) - else() - target_link_libraries(${n} dinput8 dxguid strmiids) - endif() + target_link_libraries(${n} dinput8 dxguid strmiids) endif() endfunction() @@ -306,11 +269,7 @@ opentrack_library(opentrack-proto-fgfs) if(SDK_VJOY) include_directories(${SDK_VJOY}) opentrack_library(opentrack-proto-vjoy) - if(MSVC) - target_link_libraries(opentrack-proto-vjoy ${MY_QT_LIBS} "${SDK_VJOY}/VJoy.lib") - else() - target_link_libraries(opentrack-proto-vjoy ${MY_QT_LIBS} "${SDK_VJOY}/VJoy.dll") - endif() + target_link_libraries(opentrack-proto-vjoy ${MY_QT_LIBS} "${SDK_VJOY}/VJoy.dll") endif() if(SDK_ENABLE_LIBEVDEV) @@ -321,9 +280,6 @@ if(SDK_ENABLE_LIBEVDEV) endif() if(SDK_FSUIPC) - if(MSVC) - set(link-flags "/NODEFAULTLIB:libc") - endif() opentrack_library(opentrack-proto-fsuipc LINK "${link-flags}") target_link_libraries(opentrack-proto-fsuipc "${SDK_FSUIPC}/FSUIPC_User.lib") endif() @@ -384,12 +340,6 @@ if(SDK_ARUCO_LIBPATH) include_directories(${CMAKE_SOURCE_DIR}/ftnoir_tracker_aruco/include) opentrack_library(opentrack-tracker-aruco) target_link_libraries(opentrack-tracker-aruco ${SDK_ARUCO_LIBPATH} ${OpenCV_LIBS}) - if(WIN32 AND MSVC) - target_link_libraries(opentrack-tracker-aruco - "${CMAKE_SOURCE_DIR}/dinput/dxguid.lib" - "${CMAKE_SOURCE_DIR}/dinput/strmiids.lib" - uuid) - endif() endif() link_with_dinput8(opentrack-tracker-ht) @@ -411,24 +361,16 @@ if(SDK_RIFT) set(link-flags "-framework CoreFoundation -framework CoreGraphics -framework IOKit -framework Quartz") set(c-flags "-fno-strict-aliasing") else() - if(MSVC) - set(link-flags "/NODEFAULTLIB:LIBCMT") - else() - set(c-flags "-fno-strict-aliasing") - endif() + set(c-flags "-fno-strict-aliasing") endif() opentrack_library(opentrack-tracker-rift LINK "${link-flags}" COMPILE "${c-flags}") - if(MSVC) - target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/Lib/Win32/libovr.lib" winmm.lib setupapi.lib) + if(WIN32) + target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" winmm setupapi ws2_32 imagehlp wbemuuid) else() - if(WIN32) - target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" winmm setupapi) + if(NOT APPLE) + target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" udev Xinerama) else() - if(NOT APPLE) - target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" udev Xinerama) - else() - target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a") - endif() + target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a") endif() endif() endif() @@ -516,22 +458,11 @@ if(CMAKE_SYSTEM STREQUAL LINUX) link_libraries(rt) endif() -if(MSVC) - SET_TARGET_PROPERTIES(opentrack PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup") -endif() target_link_libraries(opentrack opentrack-pose-widget opentrack-spline-widget ${MY_QT_LIBS} ${QXT_QXTCORE_LIB_RELEASE} ${QXT_QXTWIDGETS_LIB_RELEASE}) if(NOT WIN32) target_link_libraries(opentrack dl) target_link_libraries(opentrack-api dl) endif() -if(SDK_GOOGLE_BREAKPAD) - if(MSVC) - target_link_libraries(opentrack - "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/crash_generation_client.lib" - "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/exception_handler.lib" - "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/common.lib") - endif() -endif() # make install @@ -573,9 +504,3 @@ endif() if(WIN32) install(FILES "${CMAKE_SOURCE_DIR}/bin/cleye.config" DESTINATION .) endif() - -if(MSVC) - file(GLOB pdbs1 "${CMAKE_BINARY_DIR}/Release/*.pdb") - file(GLOB pdbs2 "${CMAKE_BINARY_DIR}/*.pdb") - install(FILES ${pdbs1} ${pdbs2} DESTINATION .) -endif() diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 00a7b95e..d717b3be 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -44,7 +44,7 @@ #include <iostream> #ifdef _MSC_VER -# define LIB_PREFIX "" +# error "No support for MSVC anymore" #else # define LIB_PREFIX "lib" #endif diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp index 3143a093..9bf11b32 100644 --- a/facetracknoir/main.cpp +++ b/facetracknoir/main.cpp @@ -32,34 +32,8 @@ #include <QStringList> #include <memory> -#if defined(_WIN32) && defined(_MSC_VER) -# include <windows.h> -# ifdef OPENTRACK_BREAKPAD -# include <exception_handler.h> -using namespace google_breakpad; -bool dumpCallback(const wchar_t* dump_path, - const wchar_t* minidump_id, - void* context, - EXCEPTION_POINTERS* exinfo, - MDRawAssertionInfo* assertion, - bool succeeded) -{ - MessageBoxA(GetDesktopWindow(), - "Generating crash dump!\r\n" - "Please send the .dmp file to <sthalik@misaki.pl> to help us improve the code.", - "opentrack crashed :(", - MB_OK | MB_ICONERROR); - return succeeded; -} - -# endif -#endif - int main(int argc, char** argv) { -#if defined(OPENTRACK_BREAKPAD) && defined(_MSC_VER) - auto handler = new ExceptionHandler(L".", nullptr, dumpCallback, nullptr, -1); -#endif QApplication::setAttribute(Qt::AA_X11InitThreads, true); QApplication app(argc, argv); auto w = std::make_shared<FaceTrackNoIR>(); diff --git a/facetracknoir/plugin-support.h b/facetracknoir/plugin-support.h index 4394d1a0..1c63151a 100644 --- a/facetracknoir/plugin-support.h +++ b/facetracknoir/plugin-support.h @@ -3,7 +3,7 @@ #if defined(_WIN32) # define CALLING_CONVENTION_SUFFIX_VOID_FUNCTION "@0" # ifdef _MSC_VER -# define MAYBE_STDCALL_UNDERSCORE "_" +# error "No support for MSVC anymore" #else # define MAYBE_STDCALL_UNDERSCORE "" # endif @@ -12,12 +12,6 @@ # define MAYBE_STDCALL_UNDERSCORE "" #endif -#ifdef _MSC_VER -# define virt_override -#else -# define virt_override override -#endif - #include <cstdio> #include <QWidget> diff --git a/ftnoir_filter_kalman/ftnoir_filter_kalman.h b/ftnoir_filter_kalman/ftnoir_filter_kalman.h index e4b27d1f..9964d6f2 100755 --- a/ftnoir_filter_kalman/ftnoir_filter_kalman.h +++ b/ftnoir_filter_kalman/ftnoir_filter_kalman.h @@ -25,9 +25,9 @@ class FTNOIR_FILTER_BASE_EXPORT FTNoIR_Filter : public IFilter { public: FTNoIR_Filter(); - void reset() virt_override; + void reset() override; void FilterHeadPoseData(const double *target_camera_position, - double *new_camera_position) virt_override; + double *new_camera_position) override; cv::KalmanFilter kalman; double prev_position[6]; double prev2_filter_pos[6]; @@ -56,8 +56,8 @@ public: show(); } Ui::KalmanUICFilterControls ui; - virtual void registerFilter(IFilter*) virt_override {} - virtual void unregisterFilter() virt_override {} + virtual void registerFilter(IFilter*) override {} + virtual void unregisterFilter() override {} public slots: void doOK(); void doCancel(); diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h index dcdd8098..6e0db58c 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h @@ -67,7 +67,7 @@ class FTNoIR_Protocol : public IProtocol { public: FTNoIR_Protocol(); - virtual ~FTNoIR_Protocol() virt_override; + virtual ~FTNoIR_Protocol() override; bool checkServerInstallationOK(); void sendHeadposeToGame(const double* headpose); QString getGameName() { diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp index 7de762ac..c53aa49c 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp @@ -103,7 +103,7 @@ public: actx.lpResourceName = MAKEINTRESOURCEA(resid); actx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID; #ifdef _MSC_VER -# define PREFIX "" +# error "MSVC support removed" #else # define PREFIX "lib" #endif diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h index 6ef828d4..c36b15f3 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h @@ -106,17 +106,6 @@ typedef struct _JOYSTICK_STATE UINT32 Buttons; // 32 Buttons } JOYSTICK_STATE, * PJOYSTICK_STATE; -#include <poppack.h> - -#undef EXTERN_C -#if _MSC_VER -# define EXTERN_C -#else -# define EXTERN_C extern "C" -#endif -#if _MSC_VER -# pragma comment(linker, "/implib:vjoy.def") -#endif EXTERN_C BOOL __stdcall VJoy_Initialize(PCHAR name, PCHAR serial); EXTERN_C VOID __stdcall VJoy_Shutdown(); EXTERN_C BOOL __stdcall VJoy_UpdateJoyState(int id, PJOYSTICK_STATE pJoyState); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 84b7eed3..18301b6a 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -325,7 +325,7 @@ void Tracker::run() last_roi.height = std::min<int>(grayscale.rows - last_roi.y, last_roi.height); } - cv::solvePnP(obj_points, m, intrinsics, dist_coeffs, rvec, tvec, !first, cv::ITERATIVE); + cv::solvePnP(obj_points, m, intrinsics, dist_coeffs, rvec, tvec, !first, cv::SOLVEPNP_ITERATIVE); first = false; cv::Mat rotation_matrix = cv::Mat::zeros(3, 3, CV_64FC1); cv::Mat junk1(3, 3, CV_64FC1), junk2(3, 3, CV_64FC1); diff --git a/ftnoir_tracker_base/ftnoir_tracker_base_global.h b/ftnoir_tracker_base/ftnoir_tracker_base_global.h index 6d6a1918..5b53ba82 100644 --- a/ftnoir_tracker_base/ftnoir_tracker_base_global.h +++ b/ftnoir_tracker_base/ftnoir_tracker_base_global.h @@ -8,7 +8,7 @@ # if !defined(_MSC_VER) # define FTNOIR_TRACKER_BASE_EXPORT __attribute__ ((visibility ("default"))) Q_DECL_EXPORT # else -# define FTNOIR_TRACKER_BASE_EXPORT Q_DECL_EXPORT +# error "MSVC support removed" # endif # else # define FTNOIR_TRACKER_BASE_EXPORT Q_DECL_IMPORT diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h index 90574a4b..7819dd67 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h @@ -26,8 +26,8 @@ class Hydra_Tracker : public ITracker public: Hydra_Tracker(); ~Hydra_Tracker(); - void StartTracker(QFrame *) virt_override; - void GetHeadPoseData(double *data) virt_override; + void StartTracker(QFrame *) override; + void GetHeadPoseData(double *data) override; volatile bool should_quit; protected: void run(); // qthread override run method @@ -36,7 +36,7 @@ private: bool isCalibrated; double newHeadPose[6]; // Structure with new headpose QMutex mutex; - virtual int preferredHz() virt_override { return 250; } + virtual int preferredHz() override { return 250; } }; class TrackerControls: public QWidget, public ITrackerDialog diff --git a/opentrack-api/context.cpp b/opentrack-api/context.cpp index 04fa5ac2..b706ad3a 100644 --- a/opentrack-api/context.cpp +++ b/opentrack-api/context.cpp @@ -12,7 +12,7 @@ #include <iostream> #ifdef _MSC_VER -# define LIB_PREFIX "" +# error "MSVC support removed" #else # define LIB_PREFIX "lib" #endif -- cgit v1.2.3 From 580f17da5a01434489f0996656091d325623501c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 31 Aug 2014 12:51:11 +0200 Subject: fix ovr 0.4 api usage --- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 2 +- ftnoir_tracker_rift/ftnoir_tracker_rift.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index ea268f12..be0ee689 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -40,7 +40,7 @@ void Rift_Tracker::GetHeadPoseData(double *data) ovrHSWDisplayState hsw; if (ovrHmd_GetHSWDisplayState(hmd, &hsw), hsw.Displayed) ovrHmd_DismissHSWDisplay(hmd); - ovrTrackingState ss = ovrHmd_GetTrackingState(hmd, frameTiming.ScanoutMidpointSeconds); + ovrTrackingState ss = ovrHmd_GetTrackingState(hmd, 0); if(ss.StatusFlags & ovrStatus_OrientationTracked) { auto pose = ss.HeadPose.ThePose; Quatf quat = pose.Orientation; diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index 3e26abdb..ee51b2cb 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -45,8 +45,6 @@ protected: private: double old_yaw; ovrHmd hmd; - ovrHmdDesc hmdDesc; - ovrFrameTiming frameTiming; settings s; }; -- cgit v1.2.3 From 97a12d7cee865bfcf6854e0ca0d5cc79f6c8b3b0 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 31 Aug 2014 12:51:22 +0200 Subject: remove notice for unused former dependency --- 3rdparty-notices/GOOGLE-BREAKPAD-COPYING.txt | 29 ---------------------------- 1 file changed, 29 deletions(-) delete mode 100644 3rdparty-notices/GOOGLE-BREAKPAD-COPYING.txt diff --git a/3rdparty-notices/GOOGLE-BREAKPAD-COPYING.txt b/3rdparty-notices/GOOGLE-BREAKPAD-COPYING.txt deleted file mode 100644 index 80f54ae2..00000000 --- a/3rdparty-notices/GOOGLE-BREAKPAD-COPYING.txt +++ /dev/null @@ -1,29 +0,0 @@ -Copyright (c) 2006, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -- cgit v1.2.3 From fe0cef91f3f610f980aa2a170fad9457659f6a2f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 31 Aug 2014 13:43:14 +0200 Subject: remnants of MSVC kludge support --- dinput/dinput8.lib | Bin 19978 -> 0 bytes dinput/dxguid.lib | Bin 105732 -> 0 bytes dinput/strmiids.lib | Bin 272820 -> 0 bytes 3 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 dinput/dinput8.lib delete mode 100644 dinput/dxguid.lib delete mode 100644 dinput/strmiids.lib diff --git a/dinput/dinput8.lib b/dinput/dinput8.lib deleted file mode 100644 index 3fad62fb..00000000 Binary files a/dinput/dinput8.lib and /dev/null differ diff --git a/dinput/dxguid.lib b/dinput/dxguid.lib deleted file mode 100644 index 8397d134..00000000 Binary files a/dinput/dxguid.lib and /dev/null differ diff --git a/dinput/strmiids.lib b/dinput/strmiids.lib deleted file mode 100644 index 8d921239..00000000 Binary files a/dinput/strmiids.lib and /dev/null differ -- cgit v1.2.3 From 369d744a705501c7445b7a530afde2d87b5bbff3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 31 Aug 2014 13:57:01 +0200 Subject: update credits --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 04704cfe..f0c98fb9 100644 --- a/README.md +++ b/README.md @@ -43,15 +43,13 @@ Don't be afraid to submit an issue/feature request if the need arises. # Credits -- Stanisław Halik +- Stanisław Halik (maintainer) - Chris Thompson (aka mm0zct) -- Donovan Baarda +- Donovan Baarda (filtering/control theory expert) - Ryan Spicer (OSX tester, contributor) - Patrick Ruoff (PT tracker) -- FuraX49 (hatire arduino tracker) - Ulf Schreiber (PT tracker) - uglyDwarf (high CON) -- George Trigonakis (tester) - Wim Vriend (historically) - Ron Hendriks (historically) -- cgit v1.2.3 From 95a88d4ae96f319a50d8f14a3b8728b89ed1eb8a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 31 Aug 2014 13:53:45 +0200 Subject: remove opentrack-api, no consumers --- CMakeLists.txt | 14 ----- opentrack-api/context.cpp | 112 ---------------------------------- opentrack-api/gnuc-version-script.txt | 12 ---- opentrack-api/opentrack-guts.h | 57 ----------------- opentrack-api/opentrack.h | 58 ------------------ opentrack-api/trackers.cpp | 38 ------------ 6 files changed, 291 deletions(-) delete mode 100644 opentrack-api/context.cpp delete mode 100644 opentrack-api/gnuc-version-script.txt delete mode 100644 opentrack-api/opentrack-guts.h delete mode 100644 opentrack-api/opentrack.h delete mode 100644 opentrack-api/trackers.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 647a3449..5827e0c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,8 +163,6 @@ macro(opentrack_library n) install(TARGETS ${n} RUNTIME DESTINATION . LIBRARY DESTINATION .) endmacro() -file(GLOB opentrack-lib-c "opentrack-api/*.cpp" "facetracknoir/global-settings.cpp" "opentrack-api/*.h" "facetracknoir/plugin-support.cpp") - opentrack_module(opentrack-bin facetracknoir) opentrack_module(opentrack-pose-widget ftnoir_posewidget) opentrack_module(opentrack-spline-widget qfunctionconfigurator) @@ -430,16 +428,6 @@ if(APPLE) SET_TARGET_PROPERTIES(opentrack-qxt-mini PROPERTIES LINK_FLAGS "-framework Carbon -framework CoreFoundation") endif() -add_library(opentrack-api SHARED ${opentrack-lib-c}) -target_link_libraries(opentrack-api ${MY_QT_LIBS}) -if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) - SET_TARGET_PROPERTIES(opentrack-api PROPERTIES - LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/opentrack-api/gnuc-version-script.txt" - COMPILE_FLAGS "-fvisibility=protected -fvisibility-inlines-hidden" - COMPILE_DEFINITIONS IN_OPENTRACK_API - ) -endif() - set_target_properties(opentrack PROPERTIES COMPILE_DEFINITIONS OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\") if(UNIX OR APPLE) @@ -461,7 +449,6 @@ endif() target_link_libraries(opentrack opentrack-pose-widget opentrack-spline-widget ${MY_QT_LIBS} ${QXT_QXTCORE_LIB_RELEASE} ${QXT_QXTWIDGETS_LIB_RELEASE}) if(NOT WIN32) target_link_libraries(opentrack dl) - target_link_libraries(opentrack-api dl) endif() # make install @@ -488,7 +475,6 @@ if(NOT WIN32 AND SDK_WINE_PREFIX) endif() install(TARGETS - opentrack-api opentrack-compat opentrack-csv opentrack-pose-widget diff --git a/opentrack-api/context.cpp b/opentrack-api/context.cpp deleted file mode 100644 index b706ad3a..00000000 --- a/opentrack-api/context.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include "opentrack-guts.h" -#include "opentrack.h" - -#if defined(__APPLE__) -# define SONAME "dylib" -#elif defined(_WIN32) -# define SONAME "dll" -#else -# define SONAME "so" -#endif - -#include <iostream> - -#ifdef _MSC_VER -# error "MSVC support removed" -#else -# define LIB_PREFIX "lib" -#endif - -static Metadata* get_metadata(DynamicLibrary* lib, QString& longName, QIcon& icon) -{ - Metadata* meta; - if (!lib->Metadata || ((meta = lib->Metadata()), !meta)) - return NULL; - meta->getFullName(&longName); - meta->getIcon(&icon); - return meta; -} - -static QList<opentrack_meta> list_files(QString filter) -{ - QList<opentrack_meta> ret; - QStringList filenames = QDir((qApp->applicationDirPath())).entryList( - QStringList() << (LIB_PREFIX + filter + ("*." SONAME)), - QDir::Files, QDir::Name ); - for ( int i = 0; i < filenames.size(); i++) { - QIcon icon; - QString long_name; - QString str = filenames.at(i); - DynamicLibrary* lib = new DynamicLibrary(str); - qDebug() << "Loading" << str; - std::cout.flush(); - Metadata* meta; - if (!(meta = get_metadata(lib, long_name, icon))) - { - delete lib; - continue; - } - /* TODO perhaps return full name and somesuch */ - delete meta; - QString prefix(LIB_PREFIX + filter); - QString suffix("." SONAME); - if (str.size() > prefix.size() + suffix.size() && str.startsWith(prefix) && str.endsWith(suffix)) - { - auto str2 = str.mid(prefix.size(), str.size() - prefix.size() - suffix.size()); - opentrack_meta item(str2, lib); - ret.push_back(item); - } - } - - return ret; -} - -opentrack_ctx::opentrack_ctx(int argc, char** argv, void* window_parent) : - app(argc, argv), - meta_list(list_files("opentrack-tracker-")), - fake_frame(window_parent) -{ - const int count = meta_list.size(); - list = new char*[count + 1]; - for (int i = 0; i < count; i++) - { - QByteArray tmp = meta_list.at(i).path.toUtf8(); - int len = tmp.size(); - auto foo = new char[len+1]; - for (int j = 0; j < len; j++) - foo[j] = tmp.at(j); - foo[len] = '\0'; - list[i] = foo; - } - list[count] = NULL; -} - -opentrack_ctx::~opentrack_ctx() -{ - for (int i = 0; list[i]; i++) - { - delete[] list[i]; - } - delete[] list; -} - -extern "C" -{ - -OPENTRACK_EXPORT const char** opentrack_enum_trackers(opentrack ctx) -{ - return const_cast<const char**>(ctx->list); -} - -OPENTRACK_EXPORT opentrack opentrack_make_ctx(int argc, char** argv, void* window_parent) -{ - return new opentrack_ctx(argc, argv, window_parent); -} - -OPENTRACK_EXPORT void opentrack_finalize_ctx(opentrack foo) -{ - delete foo; -} - -} - diff --git a/opentrack-api/gnuc-version-script.txt b/opentrack-api/gnuc-version-script.txt deleted file mode 100644 index cd3a568d..00000000 --- a/opentrack-api/gnuc-version-script.txt +++ /dev/null @@ -1,12 +0,0 @@ -{ - global: - opentrack_make_ctx; - opentrack_finalize_ctx; - opentrack_enum_trackers; - opentrack_make_tracker; - opentrack_tracker_start; - opentrack_tracker_tick; - opentrack_finalize_tracker; - local: - *; -}; diff --git a/opentrack-api/opentrack-guts.h b/opentrack-api/opentrack-guts.h deleted file mode 100644 index c7134a6a..00000000 --- a/opentrack-api/opentrack-guts.h +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once - -#include <QFrame> -#include <QDir> -#include <QList> -#include <QStringList> -#include <QDebug> -#include <QIcon> -#include <QShowEvent> -#include <iostream> -#include <cstring> -#include <QString> -#include <QApplication> -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#include "facetracknoir/plugin-support.h" -#include <memory> - -typedef ITracker* opentrack_tracker; - -class opentrack_meta { -public: - QString path; - std::shared_ptr<DynamicLibrary> lib; - - opentrack_meta(QString& path, DynamicLibrary* lib) : - path(path), lib(lib) - {} -}; - -class MyFrame : public QFrame { - Q_OBJECT -public: - MyFrame(void* parent) - { - if (parent == (void*) -1) - { - show(); - setVisible(false); - hide(); - } - else - { - create((WId) parent); - } - } - explicit MyFrame() {} -}; - -typedef class opentrack_ctx { -public: - QApplication app; - char** list; - QList<opentrack_meta> meta_list; - MyFrame fake_frame; - opentrack_ctx(int argc, char** argv, void* window_parent); - ~opentrack_ctx(); -} *opentrack; diff --git a/opentrack-api/opentrack.h b/opentrack-api/opentrack.h deleted file mode 100644 index 88ba6cf0..00000000 --- a/opentrack-api/opentrack.h +++ /dev/null @@ -1,58 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif -#ifndef IN_OPENTRACK -/* opaque pointers, forward definitions */ -struct opentrack_opaque_ctx; -typedef struct opentrack_opaque_ctx* opentrack; -struct opentrack_opaque_tracker; -typedef struct opentrack_opaque_tracker* opentrack_tracker; -#endif - -#ifdef IN_OPENTRACK -# ifdef _WIN32 -# define OPENTRACK_EXPORT __declspec(dllexport) -# else -# define OPENTRACK_EXPORT -# endif -#else -# ifdef _WIN32 -# define OPENTRACK_EXPORT __declspec(dllimport) -# else -# define OPENTRACK_EXPORT -# endif -#endif - -/* for `opentrack_tracker_tick', individual headpose elts */ -#ifndef IN_OPENTRACK -enum opentrack_dof { - TX = 0, - TY, - TZ, - Yaw, - Pitch, - Roll, - DOF_count -}; -#endif - -OPENTRACK_EXPORT opentrack opentrack_make_ctx(int argc, char** argv, void* window_parent); -OPENTRACK_EXPORT void opentrack_finalize_ctx(opentrack self); - -/* no need to free the return value; invalid to modify it */ -OPENTRACK_EXPORT const char** opentrack_enum_trackers(opentrack self); - -/* - * don't `opentrack_tracker_tick an unstarted tracker, it's invalid to do so - * it's also invalid to start a finalized tracker - */ -OPENTRACK_EXPORT opentrack_tracker opentrack_make_tracker(opentrack ctx, const char* name); -OPENTRACK_EXPORT void opentrack_tracker_start(opentrack self, opentrack_tracker tracker); -OPENTRACK_EXPORT void opentrack_tracker_tick(opentrack_tracker tracker, double* headpose); -OPENTRACK_EXPORT void opentrack_finalize_tracker(opentrack_tracker tracker); -#ifdef __cplusplus -} -#endif - diff --git a/opentrack-api/trackers.cpp b/opentrack-api/trackers.cpp deleted file mode 100644 index 5027ec1d..00000000 --- a/opentrack-api/trackers.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "opentrack-guts.h" -#include "opentrack.h" - -extern "C" { - -opentrack_tracker OPENTRACK_EXPORT opentrack_make_tracker(opentrack ctx, const char* name) -{ - for (int i = 0; i < ctx->meta_list.size(); i++) - { - auto meta = ctx->meta_list.at(i); - if (ctx->meta_list.at(i).path == name) - { - ITracker* foo = static_cast<ITracker*>(meta.lib->Constructor()); - return foo; - } - } - return NULL; -} - -void OPENTRACK_EXPORT opentrack_finalize_tracker(opentrack_tracker tracker) -{ - delete tracker; -} - -void OPENTRACK_EXPORT opentrack_tracker_start(opentrack self, opentrack_tracker tracker) -{ - // hot damn, this is problematic! - // need to pass QFrame from somewhere - return tracker->StartTracker(&self->fake_frame); -} - -void OPENTRACK_EXPORT opentrack_tracker_tick(opentrack_tracker tracker, double* headpose) -{ - tracker->GetHeadPoseData(headpose); - QApplication::processEvents(0, 5); -} - -} -- cgit v1.2.3 From 565c330eeece2edf93e9fa53d4fab27045ca9b3d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 31 Aug 2014 14:08:57 +0200 Subject: remove dead code --- facetracknoir/options.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/facetracknoir/options.h b/facetracknoir/options.h index 3fd0e767..474d4ec2 100644 --- a/facetracknoir/options.h +++ b/facetracknoir/options.h @@ -26,12 +26,6 @@ #include <QLabel> #include <QCoreApplication> -#ifdef __GNUC__ -# define ov override -#else -# define ov -#endif - #include <QDebug> namespace options { -- cgit v1.2.3 From a6c631e21997b7862c9481b6fe99410987ff037f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 31 Aug 2014 14:09:21 +0200 Subject: iterations update calib state, no need to do twice --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 18301b6a..176fd9b1 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -489,13 +489,7 @@ void TrackerControls::toggleCalibrate() void TrackerControls::cleanupCalib() { if (calib_timer.isActive()) - { calib_timer.stop(); - auto pos = calibrator.get_estimate() * .1; - s.headpos_x = pos(0); - s.headpos_y = pos(1); - s.headpos_z = pos(2); - } } void TrackerControls::update_tracker_calibration() -- cgit v1.2.3 From b2167e6cba93106e3e6fa4a8337ebadbf049c1f8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 31 Aug 2014 15:26:25 +0200 Subject: most TODO items stale, move rest to issue tracker --- TODO.txt | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 TODO.txt diff --git a/TODO.txt b/TODO.txt deleted file mode 100644 index e9eb232a..00000000 --- a/TODO.txt +++ /dev/null @@ -1,29 +0,0 @@ -20131023 sh - Low-hanging fruit: Go through all forms and replace ok/cancel with - QButtonBox which works better with layouts. -20131020 sh - Add unit testing by means of batch execution, protocol/filter that does - nothing, add separate executables for readers of specific protocols, - and run continuous integration every time commit happens that day. - - Add statically-typed settings trees, convert result to qsettings-enabled - ini files. Use metadata props in order to get class name for ini section. - Required here are also arrays of settings. Use QList<T> for template - specialization. -20131019 mm0zct - Ship more then one profile for configuring the curves etc. - There are two main user bases, HMD and traditional monitor+webcam users, - each wants a drastically different curve profile (HMD is 1:1 on all axes) - Also re:boost, I'd rather avoid extra library dependences if possible. - - Rift tracker could do with positional estimation using intertial sensors. - Rift could do with a return-yaw-to-centre hotkey that's not the global all-axis option. - Hydra is really just a hack just now, could be improved a lot. - - Add per-tracker hotkey support -20131011 sh - low-hanging fruit: default saving profiles to a directory in user home, - not into global stuffies - - as for build system, low-hanging fruit is writing functions/macrology - for all the repetition out there. -- cgit v1.2.3 From db59542cbb2fc3c2ac1b40928d514113bced8b0b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 6 Sep 2014 03:50:52 -0700 Subject: rename case --- CMakeLists.txt | 2 +- FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui | 1790 ------------------------ FTNoIR_Tracker_PT/Resources/Logo_IR.png | Bin 10386 -> 0 bytes FTNoIR_Tracker_PT/Resources/cap_front.png | Bin 1164 -> 0 bytes FTNoIR_Tracker_PT/Resources/cap_side.png | Bin 1733 -> 0 bytes FTNoIR_Tracker_PT/Resources/clip_front.png | Bin 571 -> 0 bytes FTNoIR_Tracker_PT/Resources/clip_side.png | Bin 2677 -> 0 bytes FTNoIR_Tracker_PT/boost-compat.h | 5 - FTNoIR_Tracker_PT/camera.cpp | 351 ----- FTNoIR_Tracker_PT/camera.h | 145 -- FTNoIR_Tracker_PT/doc/index.htm | 262 ---- FTNoIR_Tracker_PT/doc/logo.png | Bin 10386 -> 0 bytes FTNoIR_Tracker_PT/doc/ptrack.ico | Bin 4286 -> 0 bytes FTNoIR_Tracker_PT/doc/settings1.png | Bin 25013 -> 0 bytes FTNoIR_Tracker_PT/doc/settings2.png | Bin 26841 -> 0 bytes FTNoIR_Tracker_PT/doc/settings3.png | Bin 29547 -> 0 bytes FTNoIR_Tracker_PT/doc/style.css | 131 -- FTNoIR_Tracker_PT/frame_observer.cpp | 18 - FTNoIR_Tracker_PT/frame_observer.h | 76 - FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp | 265 ---- FTNoIR_Tracker_PT/ftnoir_tracker_pt.h | 95 -- FTNoIR_Tracker_PT/ftnoir_tracker_pt.qrc | 9 - FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp | 321 ----- FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h | 70 - FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp | 42 - FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h | 27 - FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h | 90 -- FTNoIR_Tracker_PT/point_extractor.cpp | 163 --- FTNoIR_Tracker_PT/point_extractor.h | 35 - FTNoIR_Tracker_PT/point_tracker.cpp | 380 ----- FTNoIR_Tracker_PT/point_tracker.h | 129 -- FTNoIR_Tracker_PT/pt_video_widget.cpp | 64 - FTNoIR_Tracker_PT/pt_video_widget.h | 71 - FTNoIR_Tracker_PT/trans_calib.cpp | 44 - FTNoIR_Tracker_PT/trans_calib.h | 39 - ftnoir_tracker_pt/FTNoIR_PT_Controls.ui | 1790 ++++++++++++++++++++++++ ftnoir_tracker_pt/Resources/Logo_IR.png | Bin 0 -> 10386 bytes ftnoir_tracker_pt/Resources/cap_front.png | Bin 0 -> 1164 bytes ftnoir_tracker_pt/Resources/cap_side.png | Bin 0 -> 1733 bytes ftnoir_tracker_pt/Resources/clip_front.png | Bin 0 -> 571 bytes ftnoir_tracker_pt/Resources/clip_side.png | Bin 0 -> 2677 bytes ftnoir_tracker_pt/boost-compat.h | 5 + ftnoir_tracker_pt/camera.cpp | 351 +++++ ftnoir_tracker_pt/camera.h | 145 ++ ftnoir_tracker_pt/doc/index.htm | 262 ++++ ftnoir_tracker_pt/doc/logo.png | Bin 0 -> 10386 bytes ftnoir_tracker_pt/doc/ptrack.ico | Bin 0 -> 4286 bytes ftnoir_tracker_pt/doc/settings1.png | Bin 0 -> 25013 bytes ftnoir_tracker_pt/doc/settings2.png | Bin 0 -> 26841 bytes ftnoir_tracker_pt/doc/settings3.png | Bin 0 -> 29547 bytes ftnoir_tracker_pt/doc/style.css | 131 ++ ftnoir_tracker_pt/frame_observer.cpp | 18 + ftnoir_tracker_pt/frame_observer.h | 76 + ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 265 ++++ ftnoir_tracker_pt/ftnoir_tracker_pt.h | 95 ++ ftnoir_tracker_pt/ftnoir_tracker_pt.qrc | 9 + ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp | 321 +++++ ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h | 70 + ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp | 42 + ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h | 27 + ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h | 90 ++ ftnoir_tracker_pt/point_extractor.cpp | 163 +++ ftnoir_tracker_pt/point_extractor.h | 35 + ftnoir_tracker_pt/point_tracker.cpp | 380 +++++ ftnoir_tracker_pt/point_tracker.h | 129 ++ ftnoir_tracker_pt/pt_video_widget.cpp | 64 + ftnoir_tracker_pt/pt_video_widget.h | 71 + ftnoir_tracker_pt/trans_calib.cpp | 44 + ftnoir_tracker_pt/trans_calib.h | 39 + 69 files changed, 4623 insertions(+), 4623 deletions(-) delete mode 100644 FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui delete mode 100644 FTNoIR_Tracker_PT/Resources/Logo_IR.png delete mode 100644 FTNoIR_Tracker_PT/Resources/cap_front.png delete mode 100644 FTNoIR_Tracker_PT/Resources/cap_side.png delete mode 100644 FTNoIR_Tracker_PT/Resources/clip_front.png delete mode 100644 FTNoIR_Tracker_PT/Resources/clip_side.png delete mode 100644 FTNoIR_Tracker_PT/boost-compat.h delete mode 100644 FTNoIR_Tracker_PT/camera.cpp delete mode 100644 FTNoIR_Tracker_PT/camera.h delete mode 100644 FTNoIR_Tracker_PT/doc/index.htm delete mode 100644 FTNoIR_Tracker_PT/doc/logo.png delete mode 100644 FTNoIR_Tracker_PT/doc/ptrack.ico delete mode 100644 FTNoIR_Tracker_PT/doc/settings1.png delete mode 100644 FTNoIR_Tracker_PT/doc/settings2.png delete mode 100644 FTNoIR_Tracker_PT/doc/settings3.png delete mode 100644 FTNoIR_Tracker_PT/doc/style.css delete mode 100644 FTNoIR_Tracker_PT/frame_observer.cpp delete mode 100644 FTNoIR_Tracker_PT/frame_observer.h delete mode 100644 FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp delete mode 100644 FTNoIR_Tracker_PT/ftnoir_tracker_pt.h delete mode 100644 FTNoIR_Tracker_PT/ftnoir_tracker_pt.qrc delete mode 100644 FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp delete mode 100644 FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h delete mode 100644 FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp delete mode 100644 FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h delete mode 100644 FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h delete mode 100644 FTNoIR_Tracker_PT/point_extractor.cpp delete mode 100644 FTNoIR_Tracker_PT/point_extractor.h delete mode 100644 FTNoIR_Tracker_PT/point_tracker.cpp delete mode 100644 FTNoIR_Tracker_PT/point_tracker.h delete mode 100644 FTNoIR_Tracker_PT/pt_video_widget.cpp delete mode 100644 FTNoIR_Tracker_PT/pt_video_widget.h delete mode 100644 FTNoIR_Tracker_PT/trans_calib.cpp delete mode 100644 FTNoIR_Tracker_PT/trans_calib.h create mode 100644 ftnoir_tracker_pt/FTNoIR_PT_Controls.ui create mode 100644 ftnoir_tracker_pt/Resources/Logo_IR.png create mode 100644 ftnoir_tracker_pt/Resources/cap_front.png create mode 100644 ftnoir_tracker_pt/Resources/cap_side.png create mode 100644 ftnoir_tracker_pt/Resources/clip_front.png create mode 100644 ftnoir_tracker_pt/Resources/clip_side.png create mode 100644 ftnoir_tracker_pt/boost-compat.h create mode 100644 ftnoir_tracker_pt/camera.cpp create mode 100644 ftnoir_tracker_pt/camera.h create mode 100644 ftnoir_tracker_pt/doc/index.htm create mode 100644 ftnoir_tracker_pt/doc/logo.png create mode 100644 ftnoir_tracker_pt/doc/ptrack.ico create mode 100644 ftnoir_tracker_pt/doc/settings1.png create mode 100644 ftnoir_tracker_pt/doc/settings2.png create mode 100644 ftnoir_tracker_pt/doc/settings3.png create mode 100644 ftnoir_tracker_pt/doc/style.css create mode 100644 ftnoir_tracker_pt/frame_observer.cpp create mode 100644 ftnoir_tracker_pt/frame_observer.h create mode 100644 ftnoir_tracker_pt/ftnoir_tracker_pt.cpp create mode 100644 ftnoir_tracker_pt/ftnoir_tracker_pt.h create mode 100644 ftnoir_tracker_pt/ftnoir_tracker_pt.qrc create mode 100644 ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp create mode 100644 ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h create mode 100644 ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp create mode 100644 ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h create mode 100644 ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h create mode 100644 ftnoir_tracker_pt/point_extractor.cpp create mode 100644 ftnoir_tracker_pt/point_extractor.h create mode 100644 ftnoir_tracker_pt/point_tracker.cpp create mode 100644 ftnoir_tracker_pt/point_tracker.h create mode 100644 ftnoir_tracker_pt/pt_video_widget.cpp create mode 100644 ftnoir_tracker_pt/pt_video_widget.h create mode 100644 ftnoir_tracker_pt/trans_calib.cpp create mode 100644 ftnoir_tracker_pt/trans_calib.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 5827e0c1..5f79c7cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -189,7 +189,7 @@ opentrack_module(opentrack-proto-libevdev ftnoir_protocol_libevdev) opentrack_module(opentrack-tracker-ht ftnoir_tracker_ht) opentrack_module(opentrack-tracker-aruco ftnoir_tracker_aruco) -opentrack_module(opentrack-tracker-pt FTNoIR_Tracker_PT) +opentrack_module(opentrack-tracker-pt ftnoir_tracker_pt) opentrack_module(opentrack-tracker-udp ftnoir_tracker_udp) opentrack_module(opentrack-tracker-joystick ftnoir_tracker_joystick) opentrack_module(opentrack-tracker-rift ftnoir_tracker_rift) diff --git a/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui b/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui deleted file mode 100644 index 0bbec7e1..00000000 --- a/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui +++ /dev/null @@ -1,1790 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UICPTClientControls</class> - <widget class="QWidget" name="UICPTClientControls"> - <property name="windowModality"> - <enum>Qt::NonModal</enum> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>459</width> - <height>621</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="windowTitle"> - <string>PointTracker Settings</string> - </property> - <property name="windowIcon"> - <iconset resource="ftnoir_tracker_pt.qrc"> - <normaloff>:/Resources/Logo_IR.png</normaloff>:/Resources/Logo_IR.png</iconset> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="sizeConstraint"> - <enum>QLayout::SetFixedSize</enum> - </property> - <item> - <widget class="QTabWidget" name="tabWidget"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tab"> - <attribute name="title"> - <string>General</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <widget class="QGroupBox" name="groupBox_6"> - <property name="title"> - <string>Tracker Thread</string> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label_43"> - <property name="text"> - <string>Auto-reset time</string> - </property> - <property name="buddy"> - <cstring>reset_spin</cstring> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="reset_spin"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Time until automatic reset of tracker's internal state when no valid tracking result is found</string> - </property> - <property name="suffix"> - <string>ms</string> - </property> - <property name="maximum"> - <number>9999</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_17"> - <property name="text"> - <string>Dynamic Pose Resolution</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="dynpose_check"> - <property name="toolTip"> - <string/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QPushButton" name="reset_button"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="toolTip"> - <string>Reset the tracker's internal state</string> - </property> - <property name="text"> - <string>Reset</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_3"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>85</height> - </size> - </property> - <property name="title"> - <string>Enable Axis</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <item> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>Roll:</string> - </property> - <property name="buddy"> - <cstring>chkEnableRoll</cstring> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_9"> - <property name="text"> - <string>Pitch:</string> - </property> - <property name="buddy"> - <cstring>chkEnablePitch</cstring> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_11"> - <property name="text"> - <string>Yaw:</string> - </property> - <property name="buddy"> - <cstring>chkEnableYaw</cstring> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QCheckBox" name="chkEnableRoll"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="chkEnablePitch"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QCheckBox" name="chkEnableYaw"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLabel" name="label_14"> - <property name="text"> - <string>X:</string> - </property> - <property name="buddy"> - <cstring>chkEnableX</cstring> - </property> - </widget> - </item> - <item row="0" column="4"> - <widget class="QCheckBox" name="chkEnableX"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLabel" name="label_15"> - <property name="text"> - <string>Y:</string> - </property> - <property name="buddy"> - <cstring>chkEnableY</cstring> - </property> - </widget> - </item> - <item row="1" column="4"> - <widget class="QCheckBox" name="chkEnableY"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLabel" name="label_16"> - <property name="text"> - <string>Z:</string> - </property> - <property name="buddy"> - <cstring>chkEnableZ</cstring> - </property> - </widget> - </item> - <item row="2" column="4"> - <widget class="QCheckBox" name="chkEnableZ"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="2"> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Minimum</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="2"> - <spacer name="horizontalSpacer_5"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Minimum</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="2" column="2"> - <spacer name="horizontalSpacer_8"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Minimum</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_4"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_2"> - <attribute name="title"> - <string>Camera</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_7"> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="toolTip"> - <string>The camera device used as input</string> - </property> - <property name="title"> - <string>Camera Settings</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QLabel" name="label_2"> - <property name="minimumSize"> - <size> - <width>55</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Device</string> - </property> - <property name="buddy"> - <cstring>camdevice_combo</cstring> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="camdevice_combo"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Camera device used as input</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_8"> - <item> - <layout class="QGridLayout" name="gridLayout_8"> - <item row="0" column="0"> - <widget class="QLabel" name="label_36"> - <property name="minimumSize"> - <size> - <width>55</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Resolution</string> - </property> - </widget> - </item> - <item row="0" column="5"> - <widget class="QLabel" name="label_37"> - <property name="text"> - <string>FPS</string> - </property> - <property name="buddy"> - <cstring>fps_spin</cstring> - </property> - </widget> - </item> - <item row="0" column="6"> - <widget class="QSpinBox" name="fps_spin"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Desired capture framerate</string> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_41"> - <property name="text"> - <string>x</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="res_x_spin"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Desired capture width</string> - </property> - <property name="maximum"> - <number>2000</number> - </property> - <property name="singleStep"> - <number>10</number> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QSpinBox" name="res_y_spin"> - <property name="toolTip"> - <string>Desired capture height</string> - </property> - <property name="maximum"> - <number>2000</number> - </property> - <property name="singleStep"> - <number>10</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_34"> - <property name="text"> - <string>F/W</string> - </property> - <property name="buddy"> - <cstring>f_dspin</cstring> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QDoubleSpinBox" name="f_dspin"> - <property name="toolTip"> - <string>The camera's focal length devided by its sensor width</string> - </property> - <property name="decimals"> - <number>2</number> - </property> - <property name="singleStep"> - <double>0.100000000000000</double> - </property> - </widget> - </item> - <item row="0" column="4"> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="0" column="7"> - <spacer name="horizontalSpacer_9"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_7"/> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_4"> - <property name="title"> - <string>Camera Orientation</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_8"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_6"> - <item> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="1" column="0"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Pitch</string> - </property> - <property name="buddy"> - <cstring>campitch_spin</cstring> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="campitch_spin"> - <property name="contextMenuPolicy"> - <enum>Qt::DefaultContextMenu</enum> - </property> - <property name="toolTip"> - <string>The angle the camera is facing upwards</string> - </property> - <property name="minimum"> - <number>-99</number> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_20"> - <property name="text"> - <string>Yaw</string> - </property> - <property name="buddy"> - <cstring>camyaw_spin</cstring> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="camyaw_spin"> - <property name="contextMenuPolicy"> - <enum>Qt::DefaultContextMenu</enum> - </property> - <property name="toolTip"> - <string>The angle the camera is facing leftwards</string> - </property> - <property name="minimum"> - <number>-99</number> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="label_21"> - <property name="text"> - <string>deg (positve = leftwards)</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="camroll_combo"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>Rotation of the camera image</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>deg (positive = upwards)</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_19"> - <property name="text"> - <string>deg</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_18"> - <property name="text"> - <string>Roll</string> - </property> - <property name="buddy"> - <cstring>camroll_combo</cstring> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_10"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>Point Extraction</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Threshold</string> - </property> - <property name="buddy"> - <cstring>threshold_slider</cstring> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="threshold_slider"> - <property name="toolTip"> - <string>Intensity threshold for point extraction</string> - </property> - <property name="maximum"> - <number>255</number> - </property> - <property name="value"> - <number>127</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_secondary"> - <item> - <widget class="QLabel" name="label_secondary"> - <property name="text"> - <string>Hysteresis</string> - </property> - <property name="buddy"> - <cstring>threshold_secondary_slider</cstring> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="threshold_secondary_slider"> - <property name="toolTip"> - <string>Per pixel hysteresis width (leave left if there is little difference between dot and non-dot, move right for increased stability against pixel noise)</string> - </property> - <property name="maximum"> - <number>255</number> - </property> - <property name="pageStep"> - <number>1</number> - </property> - <property name="value"> - <number>100</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>Min Diameter</string> - </property> - <property name="buddy"> - <cstring>mindiam_spin</cstring> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="mindiam_spin"> - <property name="toolTip"> - <string>Minimum point diameter</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_12"> - <property name="text"> - <string>px</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>Max Diameter</string> - </property> - <property name="buddy"> - <cstring>maxdiam_spin</cstring> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="maxdiam_spin"> - <property name="toolTip"> - <string>Maximum point diameter</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_13"> - <property name="text"> - <string>px</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_4"> - <attribute name="title"> - <string>Model</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_16"> - <item> - <widget class="QTabWidget" name="model_tabs"> - <property name="tabShape"> - <enum>QTabWidget::Rounded</enum> - </property> - <property name="currentIndex"> - <number>2</number> - </property> - <property name="usesScrollButtons"> - <bool>false</bool> - </property> - <property name="documentMode"> - <bool>false</bool> - </property> - <property name="tabsClosable"> - <bool>false</bool> - </property> - <widget class="QWidget" name="tab_5"> - <attribute name="title"> - <string>Clip</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_13"> - <item> - <widget class="QGroupBox" name="groupBox_8"> - <property name="title"> - <string>Model Dimensions (mm)</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_16"> - <item> - <widget class="QWidget" name="widget_4" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>160</height> - </size> - </property> - <widget class="QLabel" name="label_44"> - <property name="geometry"> - <rect> - <x>30</x> - <y>30</y> - <width>71</width> - <height>111</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/clip_side.png</pixmap> - </property> - </widget> - <widget class="QSpinBox" name="clip_theight_spin"> - <property name="geometry"> - <rect> - <x>100</x> - <y>50</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - <widget class="QSpinBox" name="clip_tlength_spin"> - <property name="geometry"> - <rect> - <x>60</x> - <y>10</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - <widget class="QSpinBox" name="clip_bheight_spin"> - <property name="geometry"> - <rect> - <x>100</x> - <y>90</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - <widget class="QLabel" name="label_50"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>46</width> - <height>13</height> - </rect> - </property> - <property name="text"> - <string>Side</string> - </property> - </widget> - <widget class="QSpinBox" name="clip_blength_spin"> - <property name="geometry"> - <rect> - <x>40</x> - <y>140</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - <widget class="QLabel" name="label_52"> - <property name="geometry"> - <rect> - <x>70</x> - <y>70</y> - <width>16</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>R</string> - </property> - </widget> - </widget> - </item> - <item> - <widget class="QWidget" name="widget_3" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>140</height> - </size> - </property> - <widget class="QLabel" name="label_51"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>46</width> - <height>13</height> - </rect> - </property> - <property name="text"> - <string>Front</string> - </property> - </widget> - <widget class="QLabel" name="label_45"> - <property name="geometry"> - <rect> - <x>40</x> - <y>30</y> - <width>21</width> - <height>111</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/clip_front.png</pixmap> - </property> - </widget> - <widget class="QLabel" name="label_53"> - <property name="geometry"> - <rect> - <x>60</x> - <y>70</y> - <width>16</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>R</string> - </property> - </widget> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_6"> - <attribute name="title"> - <string>Cap</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_14"> - <item> - <widget class="QGroupBox" name="groupBox_9"> - <property name="title"> - <string>Model Dimensions (mm)</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_15"> - <item> - <widget class="QWidget" name="widget" native="true"> - <property name="minimumSize"> - <size> - <width>140</width> - <height>130</height> - </size> - </property> - <widget class="QLabel" name="label_46"> - <property name="geometry"> - <rect> - <x>20</x> - <y>50</y> - <width>111</width> - <height>81</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/cap_side.png</pixmap> - </property> - </widget> - <widget class="QSpinBox" name="cap_height_spin"> - <property name="geometry"> - <rect> - <x>30</x> - <y>80</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - <widget class="QLabel" name="label_54"> - <property name="geometry"> - <rect> - <x>130</x> - <y>50</y> - <width>16</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>R</string> - </property> - </widget> - <widget class="QLabel" name="label_48"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>46</width> - <height>13</height> - </rect> - </property> - <property name="text"> - <string>Side</string> - </property> - </widget> - <widget class="QSpinBox" name="cap_length_spin"> - <property name="geometry"> - <rect> - <x>50</x> - <y>40</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </widget> - </item> - <item> - <widget class="QWidget" name="widget_2" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>130</height> - </size> - </property> - <widget class="QLabel" name="label_49"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>46</width> - <height>13</height> - </rect> - </property> - <property name="text"> - <string>Front</string> - </property> - </widget> - <widget class="QLabel" name="label_55"> - <property name="geometry"> - <rect> - <x>30</x> - <y>50</y> - <width>16</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>R</string> - </property> - </widget> - <widget class="QLabel" name="label_47"> - <property name="geometry"> - <rect> - <x>10</x> - <y>50</y> - <width>81</width> - <height>81</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/cap_front.png</pixmap> - </property> - </widget> - <widget class="QSpinBox" name="cap_width_spin"> - <property name="geometry"> - <rect> - <x>50</x> - <y>30</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_7"> - <attribute name="title"> - <string>Custom</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_15"> - <item> - <widget class="QGroupBox" name="groupBox_7"> - <property name="title"> - <string>Model Dimensions (mm)</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_12"> - <item> - <widget class="QLabel" name="label_56"> - <property name="text"> - <string><html><head/><body><p>Location of the two remaining model points<br/>with respect to the reference point in default pose</p></body></html></string> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer_4"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_14"> - <item> - <spacer name="horizontalSpacer_14"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QGridLayout" name="gridLayout_4"> - <item row="3" column="2"> - <widget class="QSpinBox" name="m1z_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLabel" name="label_58"> - <property name="text"> - <string>y:</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QSpinBox" name="m1y_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLabel" name="label_57"> - <property name="text"> - <string>z:</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_60"> - <property name="text"> - <string>M1:</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QSpinBox" name="m1x_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="label_63"> - <property name="text"> - <string>x:</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_15"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QGridLayout" name="gridLayout_5"> - <item row="1" column="2"> - <widget class="QSpinBox" name="m2x_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="label_67"> - <property name="text"> - <string>x:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLabel" name="label_69"> - <property name="text"> - <string>z:</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QSpinBox" name="m2y_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLabel" name="label_70"> - <property name="text"> - <string>y:</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_64"> - <property name="text"> - <string>M2:</string> - </property> - </widget> - </item> - <item row="3" column="2"> - <widget class="QSpinBox" name="m2z_spin"> - <property name="suffix"> - <string/> - </property> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_16"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer_3"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_10"> - <property name="title"> - <string>Model Position (mm)</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_11"> - <item> - <widget class="QLabel" name="label_59"> - <property name="text"> - <string><html><head/><body><p>Translation from head center to model reference point<br/> in default pose</p></body></html></string> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_17"> - <item> - <spacer name="horizontalSpacer_17"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QGridLayout" name="gridLayout_6"> - <item row="3" column="1"> - <widget class="QSpinBox" name="tz_spin"> - <property name="suffix"> - <string/> - </property> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_61"> - <property name="text"> - <string>x:</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_62"> - <property name="text"> - <string>y:</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_66"> - <property name="text"> - <string>z:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="ty_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="tx_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_18"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="tcalib_button"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Calibrate</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_19"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_3"> - <attribute name="title"> - <string>About</string> - </attribute> - <widget class="QLabel" name="label_10"> - <property name="geometry"> - <rect> - <x>30</x> - <y>30</y> - <width>161</width> - <height>111</height> - </rect> - </property> - <property name="text"> - <string><html><head/><body><p><span style=" font-weight:600;">FTNoIR PointTracker Plugin<br/>Version 1.1</span></p><p><span style=" font-weight:600;">by Patrick Ruoff</span></p><p><a href="http://ftnoirpt.sourceforge.net/"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">Manual (external)</span></a></p></body></html></string> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - <widget class="QLabel" name="label_35"> - <property name="geometry"> - <rect> - <x>200</x> - <y>30</y> - <width>141</width> - <height>141</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/Logo_IR.png</pixmap> - </property> - </widget> - </widget> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_5"> - <property name="title"> - <string>Status</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <item> - <layout class="QFormLayout" name="formLayout"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="label_38"> - <property name="text"> - <string>Camera Info:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="caminfo_label"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>120</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Extracted Points:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="pointinfo_label"> - <property name="minimumSize"> - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QPushButton" name="btnApply"> - <property name="text"> - <string>Save</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_6"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="ok_button"> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="text"> - <string>Ok</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="cancel_button"> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="text"> - <string>Cancel</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <tabstops> - <tabstop>tabWidget</tabstop> - <tabstop>reset_spin</tabstop> - <tabstop>chkEnableRoll</tabstop> - <tabstop>chkEnablePitch</tabstop> - <tabstop>chkEnableYaw</tabstop> - <tabstop>chkEnableX</tabstop> - <tabstop>chkEnableY</tabstop> - <tabstop>chkEnableZ</tabstop> - <tabstop>camdevice_combo</tabstop> - <tabstop>res_x_spin</tabstop> - <tabstop>res_y_spin</tabstop> - <tabstop>fps_spin</tabstop> - <tabstop>f_dspin</tabstop> - <tabstop>camroll_combo</tabstop> - <tabstop>campitch_spin</tabstop> - <tabstop>camyaw_spin</tabstop> - <tabstop>threshold_slider</tabstop> - <tabstop>mindiam_spin</tabstop> - <tabstop>maxdiam_spin</tabstop> - <tabstop>model_tabs</tabstop> - <tabstop>clip_tlength_spin</tabstop> - <tabstop>clip_theight_spin</tabstop> - <tabstop>clip_bheight_spin</tabstop> - <tabstop>clip_blength_spin</tabstop> - <tabstop>cap_length_spin</tabstop> - <tabstop>cap_height_spin</tabstop> - <tabstop>cap_width_spin</tabstop> - <tabstop>m1x_spin</tabstop> - <tabstop>m1y_spin</tabstop> - <tabstop>m1z_spin</tabstop> - <tabstop>m2x_spin</tabstop> - <tabstop>m2y_spin</tabstop> - <tabstop>m2z_spin</tabstop> - <tabstop>tx_spin</tabstop> - <tabstop>ty_spin</tabstop> - <tabstop>tz_spin</tabstop> - <tabstop>tcalib_button</tabstop> - <tabstop>ok_button</tabstop> - <tabstop>cancel_button</tabstop> - </tabstops> - <resources> - <include location="ftnoir_tracker_pt.qrc"/> - </resources> - <connections> - <connection> - <sender>dynpose_check</sender> - <signal>toggled(bool)</signal> - <receiver>reset_spin</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>172</x> - <y>110</y> - </hint> - <hint type="destinationlabel"> - <x>351</x> - <y>112</y> - </hint> - </hints> - </connection> - </connections> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> diff --git a/FTNoIR_Tracker_PT/Resources/Logo_IR.png b/FTNoIR_Tracker_PT/Resources/Logo_IR.png deleted file mode 100644 index 95032a25..00000000 Binary files a/FTNoIR_Tracker_PT/Resources/Logo_IR.png and /dev/null differ diff --git a/FTNoIR_Tracker_PT/Resources/cap_front.png b/FTNoIR_Tracker_PT/Resources/cap_front.png deleted file mode 100644 index 14207a67..00000000 Binary files a/FTNoIR_Tracker_PT/Resources/cap_front.png and /dev/null differ diff --git a/FTNoIR_Tracker_PT/Resources/cap_side.png b/FTNoIR_Tracker_PT/Resources/cap_side.png deleted file mode 100644 index 5ad4ee65..00000000 Binary files a/FTNoIR_Tracker_PT/Resources/cap_side.png and /dev/null differ diff --git a/FTNoIR_Tracker_PT/Resources/clip_front.png b/FTNoIR_Tracker_PT/Resources/clip_front.png deleted file mode 100644 index 04880138..00000000 Binary files a/FTNoIR_Tracker_PT/Resources/clip_front.png and /dev/null differ diff --git a/FTNoIR_Tracker_PT/Resources/clip_side.png b/FTNoIR_Tracker_PT/Resources/clip_side.png deleted file mode 100644 index 72667ac7..00000000 Binary files a/FTNoIR_Tracker_PT/Resources/clip_side.png and /dev/null differ diff --git a/FTNoIR_Tracker_PT/boost-compat.h b/FTNoIR_Tracker_PT/boost-compat.h deleted file mode 100644 index 612f2c4d..00000000 --- a/FTNoIR_Tracker_PT/boost-compat.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once -#include <memory> -namespace boost { - using std::shared_ptr; -} diff --git a/FTNoIR_Tracker_PT/camera.cpp b/FTNoIR_Tracker_PT/camera.cpp deleted file mode 100644 index 754533c5..00000000 --- a/FTNoIR_Tracker_PT/camera.cpp +++ /dev/null @@ -1,351 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - - #if defined(OPENTRACK_API) && defined(_WIN32) -#include <windows.h> -#include <dshow.h> -#endif - -#include "camera.h" -#include <string> -#include <QDebug> - -using namespace cv; - -#if defined(OPENTRACK_API) && (defined(__unix) || defined(__linux) || defined(__APPLE__)) -#include <unistd.h> -#endif - -#ifdef OPENTRACK_API -void get_camera_device_names(std::vector<std::string>& device_names) { -# if defined(_WIN32) - // Create the System Device Enumerator. - HRESULT hr; - ICreateDevEnum *pSysDevEnum = NULL; - hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **)&pSysDevEnum); - if (FAILED(hr)) - { - return; - } - // Obtain a class enumerator for the video compressor category. - IEnumMoniker *pEnumCat = NULL; - hr = pSysDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEnumCat, 0); - - if (hr == S_OK) { - // Enumerate the monikers. - IMoniker *pMoniker = NULL; - ULONG cFetched; - while (pEnumCat->Next(1, &pMoniker, &cFetched) == S_OK) { - IPropertyBag *pPropBag; - hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pPropBag); - if (SUCCEEDED(hr)) { - // To retrieve the filter's friendly name, do the following: - VARIANT varName; - VariantInit(&varName); - hr = pPropBag->Read(L"FriendlyName", &varName, 0); - if (SUCCEEDED(hr)) - { - auto wstr = std::wstring(varName.bstrVal); - auto str = std::string(wstr.begin(), wstr.end()); - device_names.push_back(str); - } - VariantClear(&varName); - - ////// To create an instance of the filter, do the following: - ////IBaseFilter *pFilter; - ////hr = pMoniker->BindToObject(NULL, NULL, IID_IBaseFilter, - //// (void**)&pFilter); - // Now add the filter to the graph. - //Remember to release pFilter later. - pPropBag->Release(); - } - pMoniker->Release(); - } - pEnumCat->Release(); - } - pSysDevEnum->Release(); -# else - for (int i = 0; i < 16; i++) { - char buf[128]; - sprintf(buf, "/dev/video%d", i); - if (access(buf, R_OK | W_OK) == 0) { - device_names.push_back(std::string(buf)); - } - } -# endif -} -#else -// ---------------------------------------------------------------------------- -void get_camera_device_names(std::vector<std::string>& device_names) -{ - videoInput VI; - VI.listDevices(); - std::string device_name; - for(int index = 0; ; ++index) { - device_name = VI.getDeviceName(index); - if (device_name.empty()) break; - device_names.push_back(device_name); - } -} -#endif - -// ---------------------------------------------------------------------------- -void Camera::set_device_index(int index) -{ - if (desired_index != index) - { - desired_index = index; - _set_device_index(); - - // reset fps - dt_valid = 0; - dt_mean = 0; - active_index = index; - } -} - -void Camera::set_f(float f) -{ - if (cam_desired.f != f) - { - cam_desired.f = f; - _set_f(); - } -} -void Camera::set_fps(int fps) -{ - if (cam_desired.fps != fps) - { - cam_desired.fps = fps; - _set_fps(); - } -} - -void Camera::set_res(int x_res, int y_res) -{ - if (cam_desired.res_x != x_res || cam_desired.res_y != y_res) - { - cam_desired.res_x = x_res; - cam_desired.res_y = y_res; - _set_res(); - _set_fps(); - } -} - -bool Camera::get_frame(float dt, cv::Mat* frame) -{ - bool new_frame = _get_frame(frame); - // measure fps of valid frames - const float dt_smoothing_const = 0.9; - dt_valid += dt; - if (new_frame) - { - dt_mean = dt_smoothing_const * dt_mean + (1.0 - dt_smoothing_const) * dt_valid; - cam_info.fps = 1.0 / dt_mean; - dt_valid = 0; - } - return new_frame; -} - -// ---------------------------------------------------------------------------- -#ifdef OPENTRACK_API -void CVCamera::start() -{ - cap = new VideoCapture(desired_index); - // extract camera info - if (cap->isOpened()) - { - active = true; - active_index = desired_index; - cam_info.res_x = cap->get(CV_CAP_PROP_FRAME_WIDTH); - cam_info.res_y = cap->get(CV_CAP_PROP_FRAME_HEIGHT); - } else { - delete cap; - cap = nullptr; - } -} - -void CVCamera::stop() -{ - if (cap) - { - cap->release(); - delete cap; - } - active = false; -} - -bool CVCamera::_get_frame(Mat* frame) -{ - if (cap && cap->isOpened()) - { - Mat img; - /* - * XXX some Windows webcams fail to decode first - * frames and then some every once in a while - * -sh - */ - for (int i = 0; i < 100 && !cap->read(img); i++) - ;; - - if (img.empty()) - return false; - - *frame = img; - return true; - } - return false; -} - -void CVCamera::_set_index() -{ - if (active) restart(); -} - -void CVCamera::_set_f() -{ - cam_info.f = cam_desired.f; -} - -void CVCamera::_set_fps() -{ - if (cap) cap->set(CV_CAP_PROP_FPS, cam_desired.fps); -} - -void CVCamera::_set_res() -{ - if (cap) - { - cap->set(CV_CAP_PROP_FRAME_WIDTH, cam_desired.res_x); - cap->set(CV_CAP_PROP_FRAME_HEIGHT, cam_desired.res_y); - cam_info.res_x = cap->get(CV_CAP_PROP_FRAME_WIDTH); - cam_info.res_y = cap->get(CV_CAP_PROP_FRAME_HEIGHT); - } -} -void CVCamera::_set_device_index() -{ - if (cap) - { - cap->release(); - delete cap; - } - cap = new VideoCapture(desired_index); -} - -#else -// ---------------------------------------------------------------------------- -VICamera::VICamera() : frame_buffer(NULL) -{ - VI.listDevices(); -} - -void VICamera::start() -{ - if (desired_index >= 0) - { - if (cam_desired.res_x == 0 || cam_desired.res_y == 0) - VI.setupDevice(desired_index); - else - VI.setupDevice(desired_index, cam_desired.res_x, cam_desired.res_y); - - active = true; - active_index = desired_index; - - cam_info.res_x = VI.getWidth(active_index); - cam_info.res_y = VI.getHeight(active_index); - new_frame = cv::Mat(cam_info.res_y, cam_info.res_x, CV_8UC3); - // If matrix is not continuous we have to copy manually via frame_buffer - if (!new_frame.isContinuous()) { - unsigned int size = VI.getSize(active_index); - frame_buffer = new unsigned char[size]; - } - } -} - -void VICamera::stop() -{ - if (active) - { - VI.stopDevice(active_index); - } - if (frame_buffer) - { - delete[] frame_buffer; - frame_buffer = NULL; - } - active = false; -} - -bool VICamera::_get_frame(Mat* frame) -{ - if (active && VI.isFrameNew(active_index)) - { - if (new_frame.isContinuous()) - { - VI.getPixels(active_index, new_frame.data, false, true); - } - else - { - // If matrix is not continuous we have to copy manually via frame_buffer - VI.getPixels(active_index, frame_buffer, false, true); - new_frame = cv::Mat(cam_info.res_y, cam_info.res_x, CV_8UC3, frame_buffer).clone(); - } - *frame = new_frame; - return true; - } - return false; -} - -void VICamera::_set_device_index() -{ - if (active) restart(); -} - -void VICamera::_set_f() -{ - cam_info.f = cam_desired.f; -} - -void VICamera::_set_fps() -{ - bool was_active = active; - if (active) stop(); - VI.setIdealFramerate(desired_index, cam_desired.fps); - if (was_active) start(); -} - -void VICamera::_set_res() -{ - if (active) restart(); -} -#endif - -// ---------------------------------------------------------------------------- -Mat FrameRotation::rotate_frame(Mat frame) -{ - switch (rotation) - { - case CLOCKWISE: - { - Mat dst; - transpose(frame, dst); - flip(dst, dst, 1); - return dst; - } - - case COUNTER_CLOCKWISE: - { - Mat dst; - transpose(frame, dst); - flip(dst, dst, 0); - return dst; - } - - default: - return frame; - } -} diff --git a/FTNoIR_Tracker_PT/camera.h b/FTNoIR_Tracker_PT/camera.h deleted file mode 100644 index ea68c387..00000000 --- a/FTNoIR_Tracker_PT/camera.h +++ /dev/null @@ -1,145 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - -#ifndef CAMERA_H -#define CAMERA_H - -#include <opencv2/opencv.hpp> -#ifndef OPENTRACK_API -# include <boost/shared_ptr.hpp> -#else -# include "FTNoIR_Tracker_PT/boost-compat.h" -# include <opencv2/highgui/highgui.hpp> -# include <opencv2/highgui/highgui_c.h> -#endif -#include <string> - -// ---------------------------------------------------------------------------- -void get_camera_device_names(std::vector<std::string>& device_names); - - -// ---------------------------------------------------------------------------- -struct CamInfo -{ - CamInfo() : res_x(0), res_y(0), fps(0), f(1) {} - - int res_x; - int res_y; - int fps; - float f; // (focal length) / (sensor width) -}; - -// ---------------------------------------------------------------------------- -// Base class for cameras, calculates the frame rate -class Camera -{ -public: - Camera() : dt_valid(0), dt_mean(0), desired_index(0), active_index(-1), active(false) {} - virtual ~Camera() {} - - // start/stop capturing - virtual void start() = 0; - virtual void stop() = 0; - void restart() { stop(); start(); } - - // calls corresponding template methods and reinitializes frame rate calculation - void set_device_index(int index); - void set_f(float f); - void set_fps(int fps); - void set_res(int x_res, int y_res); - - // gets a frame from the camera, dt: time since last call in seconds - bool get_frame(float dt, cv::Mat* frame); - - // WARNING: returned references are valid as long as object - const CamInfo& get_info() const { return cam_info; } - const CamInfo& get_desired() const { return cam_desired; } - -protected: - // get a frame from the camera - virtual bool _get_frame(cv::Mat* frame) = 0; - - // update the camera using cam_desired, write res and f to cam_info if successful - virtual void _set_device_index() = 0; - virtual void _set_f() = 0; - virtual void _set_fps() = 0; - virtual void _set_res() = 0; - - float dt_valid; - float dt_mean; - int desired_index; - int active_index; - bool active; - CamInfo cam_info; - CamInfo cam_desired; -}; - - -// ---------------------------------------------------------------------------- -// camera based on OpenCV's videoCapture -#ifdef OPENTRACK_API -class CVCamera : public Camera -{ -public: - CVCamera() : cap(NULL) {} - ~CVCamera() { stop(); } - - virtual void start(); - virtual void stop(); - -protected: - virtual bool _get_frame(cv::Mat* frame); - virtual void _set_index(); - virtual void _set_f(); - virtual void _set_fps(); - virtual void _set_res(); - virtual void _set_device_index(); - - cv::VideoCapture* cap; -}; -#else -// ---------------------------------------------------------------------------- -// Camera based on the videoInput library -class VICamera : public Camera -{ -public: - VICamera(); - ~VICamera() { stop(); } - - virtual void start(); - virtual void stop(); - -protected: - virtual bool _get_frame(cv::Mat* frame); - virtual void _set_device_index(); - virtual void _set_f(); - virtual void _set_fps(); - virtual void _set_res(); - - videoInput VI; - cv::Mat new_frame; - unsigned char* frame_buffer; -}; -#endif - -enum RotationType -{ - CLOCKWISE = 0, - ZERO = 1, - COUNTER_CLOCKWISE = 2 -}; - -// ---------------------------------------------------------------------------- -class FrameRotation -{ -public: - RotationType rotation; - - cv::Mat rotate_frame(cv::Mat frame); -}; - -#endif //CAMERA_H diff --git a/FTNoIR_Tracker_PT/doc/index.htm b/FTNoIR_Tracker_PT/doc/index.htm deleted file mode 100644 index 87b7356f..00000000 --- a/FTNoIR_Tracker_PT/doc/index.htm +++ /dev/null @@ -1,262 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - -<head> - <title>FTNoIR PointTracker Help</title> - - <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> - - <meta name="author" - content="Patrick Ruoff (C14)"/> - <meta name="keywords" - content="facetracknoir infrared point model tracker plugin"/> - <meta name="description" - content="Pointtracker plugin for FaceTrackNoIR"/> - - <link rel="shortcut icon" href="ptrack.ico" type="image/vnd.microsoft.icon" /> - <link rel="stylesheet" type="text/css" href="style.css" /> -</head> - -<body> -<div id="navbar"> -<ul class="navbar"> -<li class="navbar"><a class="navbar" href="#about">About</a></li> -<li class="navbar"><a class="navbar" href="#settings">Settings</a></li> -<li class="navbar"><a class="navbar" href="#setup">Filter Setup</a></li> -<li class="navbar"><a class="navbar" href="#support">Support</a></li> -<li class="navbar"><a class="navbar" href="#changelog">ChangeLog</a></li> -<li class="navbar"><a class="navbar" href="#build_instructions">Build Instructions</a></li> -</ul> -</div> - -<div id="content"> -<div style="text-align:center"><h1>FaceTrackNoIR PointTracker Plugin</h1><img src="logo.png" alt="PointTracker Plugin Logo" /></div> - -<a class="nav" id="about"></a> -<h2>About</h2> -<div class="indent"> -<p> -PointTracker is a plugin for the free head tracking software <a href="http://facetracknoir.sourceforge.net">FaceTrackNoIR</a> -which introduces the capability to track a (typically IR-) point model comprising 3 bright points to FaceTrackNoIR, -much like the popular free tracking software <a href="http://www.free-track.net/">Freetrack</a> does.<br/> -It was created as a stable modular alternative to Freetrack, which has some stability issues with newer systems and seems to be no longer actively developped. -</p> -</div> - -<a class="nav" id="settings"></a> -<h2>Settings</h2> -<div class="indent"> -<p> -This section desribes the various settings of the PointTracker plugin in detail. -</p> - -<img src="settings1.png" alt="Settings Pane 1"/> -<dl> -<dt>Show VideoWidget</dt><dd>Whether the video widget is updated or not. It may save some performance to turn this off when not needed</dd> -<dt>Sleep time</dt><dd>Time the tracking thread sleeps after each processed image. It's inverse should be below the framefrate you want to achieve. -(check the framerate in the status region when tracker is active, in case the sleep time is too high, the framerate will decrease). -Low values will result in more CPU-load.</dd> -<dt>Dynamic Pose Resolution</dt><dd>Whether the point correspondence and pose ambiquity is resolved using a more sophisticated dynamic algorithm (constant velocity prediction) or a simple static resolution. -Dynamic pose resolution can capture more extreme poses but may occasionally get stuck in a wrong pose estimates so that a reset of the internal state becomes neccessary.</dd> -<dt>Auto-reset time</dt><dd>If no valid tracking result can be found when using dynamic pose resolution, the tracker will automatically reset its internal state (used for resolving the pose ambiguity and point correspondence) -and return to a fail-safe initialization phase that assumes a neutral pose after this time. -Decrease this time, if you get stuck in a wrong pose too often.</dd> -<dt>Reset</dt><dd>Manually reset the trackers internal state used for dynamic pose resolution and return to a fail-safe initialization phase that assumes a neutral pose. -You may use this in case you get stuck in a wrong pose.</dd> -<dt>Enable Axis ...</dt><dd>Which axis to use for FTNoIR.</dd> -</dl> - -<img src="settings2.png" alt="Settings Pane 2"/> -<dl> -<dt>Device</dt><dd>The camera used for tracking.</dd> -<dt>Resolution</dt><dd>The desired capture resolution. If your camera does not support the entered resolution the true output resolution may be different or even invalid. -You may check the true capture resolution in the status area while the tracker is running. A higher resolution results in more accurate point positions and will increase the -stability of the tracking result, as long as the signal/noise ratio is sufficiently high.</dd> -<dt>FPS</dt><dd>The desired capture framerate. Again, if your camera does not support the entered framerate, the true caputre framerate may be different or invalid. -You may check the true processing framerate in the status area while the tracker is running.</dd> -<dt>F/W</dt><dd>The focal length of the camera divided by the sensor width (of course in the same units). -In case you don't have access to your camera's specifications, you can measure this yourself by placing a plane object of known width (for example a piece of cardboard) in front of the camera until it fills the whole image width. -Then measure the distance between the object and the camera and divide by the object width.</dd> -<dt>VideoWidget</dt><dd>Shows a resizable stand-alone video widget that shows the same content as the integrated video widget in FTNoIR. -Update rate is only 10 fps and may lag behind a bit. Mainly useful during calibration of the point extraction. Same as for the integrated wiget, to save resources, this widget should only be shown when needed.</dd> -<dt>Roll Pitch Yaw...</dt><dd>The orientation of the camera relative to the reference frame. -If these angles are setup properly, the direction of translations may not be correct. -Roll is treated in a special way since it is implemented as a frame rotation by +/- 90 deg that is transparent to the rest of the processing pipeline. -</dd> -<dt>Threshold</dt><dd>The threshold for point recognition. Areas above the threshold are shown in blue in the VideoWidget. -Since point accuracy is best if the points are as big as possible in pixels, the theshold should be chosen as low as possible (stop before the contour of the points becomes "noisy"). -If small reflections are being falsely classified as points, increasing the minimum point diameter (see below) may help.</dd> -<dt>Min Diameter</dt><dd>Minimum diameter of blobs to be classified as a pointmodel-point.</dd> -<dt>Max Diameter</dt><dd>Maximum diameter of blobs to be classified as a pointmodel-point.</dd> -<dt>Status</dt><dd>The tracker's status is shown in this area while the tracker is running. -The FPS shown here correspond to the framerate of the whole tracker processing chain and may be lower than what your camera is able to provide, when<br/> -1. The processing gets not enough CPU time<br/> -2. The sleep time of the tracking thread is set too high<br/></dd> -</dl> - -<img src="settings3.png" alt="Settings Pane 3"/> -<dl> -<dt>Model Selection and Dimensions ...</dt><dd> -First select your model type (point, clip, custom), then enter the dimensions of your model in milimeters here.<br/> -For the custom setting, the coordinates of the two remaining model points have to be entered (reference point M0 is at (0,0,0)) in a pose where the model roughly faces the camera. -For orientation, the coordinates for the standard Freetrack clip are (0,40,-30), (0,-70,-80) and the ones for the cap (40,-60,-100), (-40,-60,-100).<br/> -When using a custom point-model configuration, the following restrictions should be observed:<br/> -The plane in which the 3 points lie should never be parallel to the image plane, M0-M1 and M0-M2 should be roughly perpendicular.</dd> - -<dt>Model Position</dt><dd>The vector from the model to the center of the head in the model frame. Can be calibrated automatically.</dd> -<dt>Calibrate</dt><dd>In order to automatically calibrate the model-head offset, do the following:<br/>Press the Calibrate button, then look around while not moving your shoulder. (i.e. only rotation, no translation). -Do not stay in one pose for too long. The current translation estimate will be updated in real time. As soon as the values stabilized sufficiently, press the Calibrate button again to stop the calibration process.</dd> -</dl> -</div> - -<a class="nav" id="setup"></a> -<h2>Filter Setup</h2> -<div class="indent"> -<p> -This section desribes how the FTNoIR filter work and what the recommended settings for PointTracker are. -</p> -<p> -Filtering is always a tradeoff between stability, accuracy and responsiveness. -</p> -<p> -The <q>Smoothing</q> filter in FTNoIR is just a simple average over the last n samples. -Since this filter produces input lag no matter how fast the head-movements are, it is recommended to turn it off by setting samples to 1. -</p> -<p> -In the filter tab, it is recommended to select <q>Accela Filter Mk2</q>. -Accela is a non-linear filter that works as follows:<br/> -It looks at the difference between the new raw values <i>new_val</i> from the tracker and the last filtered value <i>old_val</i> -and maps this difference via the customizable response function <i>f</i> via:<br/> -</p> -<p style="text-align: center"> -<i>new_val = old_val + f(new_val - old_val) / reduction_factor</i> -</p> -<p> -So by setting <i>f(x) = reduction_factor * x</i>, one will get no filtering at all.<br/> -If you set lower values for small x, small deviations (usually noise) will get dampened. -This results in a dynamic dead-zone around the current position. -</p> -<p> -The last two points are used by accela to extrapolate for large deviations. -So in order to get a fast unfiltered response for large deviations, the line connecting the last two points should have a slope >= <i>reduction_factor</i>. -</p> -<p> -More aggressive accela settings than the default FTNoIR accela settings are recommended in order to decrease the filtering lag and fully use the potential of point tracking.<br/> -My current settings are: -</p> -<pre class="indent"><code> -[Accela] -Reduction=20 - -[Curves-Accela-Scaling-Rotation] -point-count=4 -point-0-x=0.1 -point-0-y=0 -point-1-x=1.43 -point-1-y=2.45 -point-2-x=2.0 -point-2-y=5.44 -point-3-x=2.06 -point-3-y=6 -</code></pre> -<p> -The curve is not too different from the standard one (except that I like a small dynamic dead zone for steady aiming, that's why the curve has a slope of 0 at the beginning).<br/> -However, the reduction factor is decreased to a value of 20 (compared to the standard value of 100). This implies that each value of the curve is effectively 5 times higher than in standard FTNoIR (see formula above), which means higher responsiveness but can also lead to jitter/shaking.<br/> -Keep in mind that there are no <q>best filter settings</q>. Since filtering is always a compromise it's a matter of personal taste and -playing around with the filter settings is highly recommended. -</p> -</div> - -<a class="nav" id="support"></a> -<h2>Support</h2> -<div class="indent"> -<p> -For questions/feedback about the plugin, post to the <a href="https://sourceforge.net/projects/facetracknoir/forums">FTNoIR-Forum</a>.<br/> -In case you like this plugin and would like to support the author, you may consider making a donation. -</p> -<div style="text-align:center"> -<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> -<fieldset class="blind"> -<input type="hidden" name="cmd" value="_s-xclick"/> -<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHJwYJKoZIhvcNAQcEoIIHGDCCBxQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYCa+2zPZ+6vFPqveJsBIjFLpy54m7tl0AdojRr/K5qa3QJDyRBhGwGAP2jRihkmZFE2oKlfLpkz7nrwOQY/wFEPkggO+cABxUfjcQVpIupHEtwdV0hMklLs0RmACJy802yfi1yTiCpJ4hvWN+VfUI3gOiZ9uRZ3L4iGXES7xtqJbDELMAkGBSsOAwIaBQAwgaQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIeopHzcJ8XBOAgYCYJFyTejSplEOwF21aQ01qQOads9Z+RUVI+hlvM/pHTjimaZPKSis3poAeqv6wKn40DpLNxDnmcT+Y9KXhrV+Gy4GZCPaeNzq2vquQ2ZVN0fTr84QVmKqPkjMBGmJAHSLCcZswUddemJgoD1uyvS0kNbchvxw7gDXJnJeBRNyXXKCCA4cwggODMIIC7KADAgECAgEAMA0GCSqGSIb3DQEBBQUAMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbTAeFw0wNDAyMTMxMDEzMTVaFw0zNTAyMTMxMDEzMTVaMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwUdO3fxEzEtcnI7ZKZL412XvZPugoni7i7D7prCe0AtaHTc97CYgm7NsAtJyxNLixmhLV8pyIEaiHXWAh8fPKW+R017+EmXrr9EaquPmsVvTywAAE1PMNOKqo2kl4Gxiz9zZqIajOm1fZGWcGS0f5JQ2kBqNbvbg2/Za+GJ/qwUCAwEAAaOB7jCB6zAdBgNVHQ4EFgQUlp98u8ZvF71ZP1LXChvsENZklGswgbsGA1UdIwSBszCBsIAUlp98u8ZvF71ZP1LXChvsENZklGuhgZSkgZEwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTEyMDkyMzA5NTcwOFowIwYJKoZIhvcNAQkEMRYEFG/qW7uo4R4m5uFYegcZaZsTPAcUMA0GCSqGSIb3DQEBAQUABIGAGygLfrR6IQbG2xZY2OrwKkfmRwiwtnXpLBnSbnWb7XxUOMhvM6962RiKBQBGP0+XYw0S9yu8ZHx7tqz/3bcMfGjtz7PwixYx6Rm8Z29ja78aUy5FmU7fc9yAWFxLHptSliK1dJBPxdQa9J2YSDvPQPAj+AdB9sJvqJoMoxTFGM4=-----END PKCS7----- -"/> -<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!"/> -<img alt="" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1"/> -</fieldset> -</form> -</div> -</div> - -<a class="nav" id="changelog"></a> -<h2>ChangeLog</h2> -<div class="indent"> -<h3>1.1</h3> -<ul> -<li>Added camera yaw and roll correction (intended for vertically mounted cameras)</li> -<li>Improved point extraction algorithm, thanks to Michael Welter</li> -<li>UI improvements: Select camera by device name, different VideoWidget architecture</li> -<li>Bugfixes: Removed 99 FPS limitation</li> -</ul> - -<h3>1.0</h3> -<ul> -<li>Added camera pitch correction</li> -<li>Better communication with FTNoIR: output axis configuration, status report</li> -</ul> - -<h3>1.0 beta</h3> -<ul> -<li>Switchted to videoInput library for capture. Desired capture resolution and fps can now be customized</li> -<li>Introduced dynamic point-correspondence and POSIT-ambiguity resolution, which allows for the reconstruction of more extreme poses</li> -<li>More convenient freetrack-like model dimension GUI</li> -<li>Bugfixes: VideoWidget skipping frames, Timer resolution too low for accurate FPS measurement</li> -</ul> -</div> - -<a class="nav" id="build_instructions"></a> -<h2>Build Instructions</h2> -<div class="indent"> -<p> -This section describes what you need to do in order to build PointTracker yourself.<br/> -You can find the sources at the <a href="https://sourceforge.net/projects/ftnoirpt/">project site</a> -or as part of the <a href="https://sourceforge.net/projects/facetracknoir/">FTNoIR sources</a>. -</p> -<p> The project was created with Visual Studio. </p> - -<h3>Dependencies</h3> -<ul> -<li>Qt 4.8.2 library</li> -<li>Qt plugin for Visual studio</li> -<li>OpenCV 2.4 prebuilt for Windows</li> -<li>Boost 1.47</li> -</ul> - -<h3>Details</h3> -<div class="indent"> -<h4>Common</h4> -<ul> -<li>setup environment variable "QTDIR" (example value "D:\Devel\Libs\Qt\4.8.2")</li> -<li>add "%QTDIR%\bin" to PATH</li> -<li>setup environment variable "BOOST_DIR" (example value "D:\Devel\Libs\boost_1_47_0")</li> -<li>setup environment variable "OPENCV_DIR" (example value "D:\Devel\Libs\opencv\build")</li> -</ul> -<h4>Debug</h4> -<p>opencv linked dynamically:</p> -<ul> -<li>add "%OPENCV_DIR%\x86\vc9\bin" to PATH</li> -</ul> -<p>(in case of different Visual studio, change PATH and linker dependencies accordingly)</p> -<h4>Release</h4> -<p>opencv linked statically:</p> -<ul> -<li>custom build a statically linked version of opencv with the buil-option BUILD_WITH_STATIC_CRT set to OFF!</li> -<li>copy resulting libaries to "%OPENCV_DIR%\x86\vc9\static_lib"</li> -</ul> -<p>(in case of different Visual studio, change PATH and linker dependencies accordingly)</p> -</div> -</div> - -</div> - -</body> -</html> \ No newline at end of file diff --git a/FTNoIR_Tracker_PT/doc/logo.png b/FTNoIR_Tracker_PT/doc/logo.png deleted file mode 100644 index 95032a25..00000000 Binary files a/FTNoIR_Tracker_PT/doc/logo.png and /dev/null differ diff --git a/FTNoIR_Tracker_PT/doc/ptrack.ico b/FTNoIR_Tracker_PT/doc/ptrack.ico deleted file mode 100644 index c4b2aedc..00000000 Binary files a/FTNoIR_Tracker_PT/doc/ptrack.ico and /dev/null differ diff --git a/FTNoIR_Tracker_PT/doc/settings1.png b/FTNoIR_Tracker_PT/doc/settings1.png deleted file mode 100644 index 35b84c5c..00000000 Binary files a/FTNoIR_Tracker_PT/doc/settings1.png and /dev/null differ diff --git a/FTNoIR_Tracker_PT/doc/settings2.png b/FTNoIR_Tracker_PT/doc/settings2.png deleted file mode 100644 index c6cfd1f3..00000000 Binary files a/FTNoIR_Tracker_PT/doc/settings2.png and /dev/null differ diff --git a/FTNoIR_Tracker_PT/doc/settings3.png b/FTNoIR_Tracker_PT/doc/settings3.png deleted file mode 100644 index 5922403d..00000000 Binary files a/FTNoIR_Tracker_PT/doc/settings3.png and /dev/null differ diff --git a/FTNoIR_Tracker_PT/doc/style.css b/FTNoIR_Tracker_PT/doc/style.css deleted file mode 100644 index a8d3e333..00000000 --- a/FTNoIR_Tracker_PT/doc/style.css +++ /dev/null @@ -1,131 +0,0 @@ -body { - width: 1000px; - font-size: 13px; - color: #000000; - padding: 0; - margin: 0 auto; - background: #444444; - font-family: verdana,arial; -} - -table { - border-width: 3px; - border-color: #0000FF; - border-style: ridge; - margin-top: 5px; - background-color: #E0E0FF; -} - -table.blind { - border: none; - background-color: #E6E6E6; -} - -fieldset.blind { - border: none; -} - -h1 { font-size: 160%; } -h2 { font-size: 140%; } -h3 { font-size: 115%; } - -.indent { - margin-left: 25px; -} - -p -{ - margin-left: 10px; -} - -li -{ - margin: 10px; -} - - -dl -{ - /*width: 80%;*/ - border-bottom: 1px solid #999; -} - -dt -{ - padding-top: 5px; - font-weight: bold; - border-top: 1px solid #999; -} - -dd -{ - padding: 5px; -} - - -hr { - color: #688938; -} - -a:link, a:visited { - color: #0000BF; -} -a:hover { - color: #0000FF; -} - -a.nav { - position: relative; - top: -30px; - display: block; - visibility: hidden; -} - -#navbar { - width: 1000px; - height: 30px; - background-color:#1a1a1b; - position: fixed; - margin: 0 auto; - padding: 0; -} - -#navbar ul -{ - list-style-type: none; - margin: 0 auto; - padding: 0; - overflow: hidden; -} - -#navbar li -{ - margin: 0 auto; - padding: 5px; - float:left; -} - -#navbar a:link,a:visited -{ - display:block; - width:150px; - font-weight:bold; - color:#e85d02; - text-align:center; - /*padding:4px;*/ - text-decoration:none; - /*text-transform:uppercase;*/ -} - -#navbar a:hover,a:active -{ - color:#ffffff; -} - -#content { - background-color:#ffffff; - padding: 15px; - padding-top: 40px; - padding-right: 40px; - margin: 0 auto; -} diff --git a/FTNoIR_Tracker_PT/frame_observer.cpp b/FTNoIR_Tracker_PT/frame_observer.cpp deleted file mode 100644 index 281f3d57..00000000 --- a/FTNoIR_Tracker_PT/frame_observer.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* Copyright (c) 2013 Patrick Ruoff - * - * 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 "frame_observer.h" - -//----------------------------------------------------------------------------- -FrameProvider::~FrameProvider() -{ - QMutexLocker lock(&observer_mutex); - for (std::set<FrameObserver*>::iterator iter=frame_observers.begin(); iter!=frame_observers.end(); ++iter) - { - (*iter)->on_frame_provider_destroy(); - } -} diff --git a/FTNoIR_Tracker_PT/frame_observer.h b/FTNoIR_Tracker_PT/frame_observer.h deleted file mode 100644 index 585a6ee7..00000000 --- a/FTNoIR_Tracker_PT/frame_observer.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (c) 2013 Patrick Ruoff - * - * 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. - */ - -#ifndef FRAME_OBSERVER_H -#define FRAME_OBSERVER_H - -#include <QMutex> -#include <opencv2/opencv.hpp> -#ifndef OPENTRACK_API -# include <boost/shared_ptr.hpp> -#else -# include "FTNoIR_Tracker_PT/boost-compat.h" -#endif -#include <set> - -//----------------------------------------------------------------------------- -// Forward declarations -class FrameObserver; - -//----------------------------------------------------------------------------- -// Provides means to copy frame and point information if it has observers -// Instantiate a FrameObserver to get the information -class FrameProvider -{ - friend class FrameObserver; -public: - ~FrameProvider(); - -protected: - virtual bool get_frame_and_points(cv::Mat& frame, boost::shared_ptr< std::vector<cv::Vec2f> >& points) = 0; - - bool has_observers() const { QMutexLocker lock(&observer_mutex); return !frame_observers.empty(); } - -private: - mutable QMutex observer_mutex; - void add_observer(FrameObserver* obs) { QMutexLocker lock(&observer_mutex); frame_observers.insert(obs); } - void remove_observer(FrameObserver* obs) { QMutexLocker lock(&observer_mutex); frame_observers.erase(obs); } - std::set<FrameObserver*> frame_observers; -}; - -//----------------------------------------------------------------------------- -// Used to get frame and point information from MutexedFrameProvider -// Destroy instance if not interested anymore since a living -// FrameObserver instance causes MutexedFrameProvider to provide the information, -// potentially reducing its performance -class FrameObserver -{ -public: - FrameObserver(FrameProvider* provider) : provider(provider) { - provider->add_observer(this); - } - - ~FrameObserver() { - if (provider) provider->remove_observer(this); - } - - bool get_frame_and_points(cv::Mat& frame, boost::shared_ptr< std::vector<cv::Vec2f> >& points) { - return provider ? provider->get_frame_and_points(frame, points) : false; - } - - void on_frame_provider_destroy() { - provider = NULL; - } - -protected: - FrameProvider* provider; - -private: - FrameObserver(const FrameObserver&); -}; - -#endif //FRAME_OBSERVER_H diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp deleted file mode 100644 index ef72f9a2..00000000 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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 "ftnoir_tracker_pt.h" -#include <QHBoxLayout> -#include <cmath> -#include <QDebug> -#include <QFile> -#include <QCoreApplication> - -using namespace std; -using namespace cv; -using namespace boost; - -//#define PT_PERF_LOG //log performance - -const float rad2deg = 180.0/3.14159265; -const float deg2rad = 1.0/rad2deg; - -//----------------------------------------------------------------------------- -Tracker::Tracker() - : mutex(QMutex::Recursive), - commands(0), - video_widget(NULL), - video_frame(NULL), - tracking_valid(false), - new_settings(nullptr) - -{ - qDebug()<<"Tracker::Tracker"; -} - -Tracker::~Tracker() -{ - qDebug()<<"Tracker::~Tracker"; - // terminate tracker thread - set_command(ABORT); - wait(); - s.video_widget = false; - delete video_widget; - video_widget = NULL; - if (video_frame->layout()) delete video_frame->layout(); -} - -void Tracker::set_command(Command command) -{ - //QMutexLocker lock(&mutex); - commands |= command; -} - -void Tracker::reset_command(Command command) -{ - //QMutexLocker lock(&mutex); - commands &= ~command; -} - -void Tracker::run() -{ - qDebug()<<"Tracker:: Thread started"; - -#ifdef PT_PERF_LOG - QFile log_file(QCoreApplication::applicationDirPath() + "/PointTrackerPerformance.txt"); - if (!log_file.open(QIODevice::WriteOnly | QIODevice::Text)) return; - QTextStream log_stream(&log_file); -#endif - - time.start(); - double dt; - bool new_frame; - forever - { - if (commands & ABORT) break; - if (commands & PAUSE) continue; - commands = 0; - apply_inner(); - dt = time.start() / 1000000000.; - - new_frame = camera.get_frame(dt, &frame); - - if (new_frame && !frame.empty()) - { - QMutexLocker lock(&mutex); - - frame = frame_rotation.rotate_frame(frame); - const std::vector<cv::Vec2f>& points = point_extractor.extract_points(frame, dt, true); - for (auto p : points) - { - auto p2 = cv::Point(p[0] * frame.cols + frame.cols/2, -p[1] * frame.cols + frame.rows/2); - cv::Scalar color(0, 255, 0); - cv::line(frame, - cv::Point(p2.x - 20, p2.y), - cv::Point(p2.x + 20, p2.y), - color, - 4); - cv::line(frame, - cv::Point(p2.x, p2.y - 20), - cv::Point(p2.x, p2.y + 20), - color, - 4); - } - tracking_valid = point_tracker.track(points, camera.get_info().f, dt); - video_widget->update_image(frame); - } -#ifdef PT_PERF_LOG - log_stream<<"dt: "<<dt; - if (!frame.empty()) log_stream<<" fps: "<<camera.get_info().fps; - log_stream<<"\n"; -#endif - } - - qDebug()<<"Tracker:: Thread stopping"; -} -void Tracker::apply(settings& s) -{ - // caller guarantees object lifetime - new_settings = &s; -} - -void Tracker::apply_inner() -{ - settings* tmp = new_settings.exchange(nullptr); - if (tmp == nullptr) - return; - auto& s = *tmp; - qDebug()<<"Tracker:: Applying settings"; - camera.set_device_index(s.cam_index); - camera.set_res(s.cam_res_x, s.cam_res_y); - camera.set_fps(s.cam_fps); - camera.set_f(s.cam_f); - frame_rotation.rotation = static_cast<RotationType>(static_cast<int>(s.cam_roll)); - point_extractor.threshold_val = s.threshold; - point_extractor.threshold_secondary_val = s.threshold_secondary; - point_extractor.min_size = s.min_point_size; - point_extractor.max_size = s.max_point_size; - { - cv::Vec3f M01(s.m01_x, s.m01_y, s.m01_z); - cv::Vec3f M02(s.m02_x, s.m02_y, s.m02_z); - point_tracker.point_model = boost::shared_ptr<PointModel>(new PointModel(M01, M02)); - } - point_tracker.dynamic_pose_resolution = s.dyn_pose_res; - point_tracker.dt_reset = s.reset_time / 1000.0; - t_MH = cv::Vec3f(s.t_MH_x, s.t_MH_y, s.t_MH_z); - R_GC = Matx33f( cos(deg2rad*s.cam_yaw), 0, sin(deg2rad*s.cam_yaw), - 0, 1, 0, - -sin(deg2rad*s.cam_yaw), 0, cos(deg2rad*s.cam_yaw)); - R_GC = R_GC * Matx33f( 1, 0, 0, - 0, cos(deg2rad*s.cam_pitch), sin(deg2rad*s.cam_pitch), - 0, -sin(deg2rad*s.cam_pitch), cos(deg2rad*s.cam_pitch)); - - FrameTrafo X_MH(Matx33f::eye(), t_MH); - X_GH_0 = R_GC * X_MH; - - qDebug()<<"Tracker::apply ends"; -} - -void Tracker::reset() -{ - QMutexLocker lock(&mutex); - point_tracker.reset(); -} - -void Tracker::center() -{ - point_tracker.reset(); // we also do a reset here since there is no reset shortkey yet - QMutexLocker lock(&mutex); - FrameTrafo X_CM_0 = point_tracker.get_pose(); - FrameTrafo X_MH(Matx33f::eye(), t_MH); - X_GH_0 = R_GC * X_CM_0 * X_MH; -} - -bool Tracker::get_frame_and_points(cv::Mat& frame_copy, boost::shared_ptr< std::vector<Vec2f> >& points) -{ - QMutexLocker lock(&mutex); - if (frame.empty()) return false; - - // copy the frame and points from the tracker thread - frame_copy = frame.clone(); - points = boost::shared_ptr< vector<Vec2f> >(new vector<Vec2f>(point_extractor.get_points())); - return true; -} - -void Tracker::refreshVideo() -{ - if (video_widget) video_widget->update_frame_and_points(); -} - -void Tracker::StartTracker(QFrame *parent_window) -{ - this->video_frame = parent_window; - video_frame->setAttribute(Qt::WA_NativeWindow); - video_frame->show(); - video_widget = new PTVideoWidget(video_frame, this); - QHBoxLayout* video_layout = new QHBoxLayout(parent_window); - video_layout->setContentsMargins(0, 0, 0, 0); - video_layout->addWidget(video_widget); - video_frame->setLayout(video_layout); - video_widget->resize(video_frame->width(), video_frame->height()); - camera.start(); - apply(s); - start(); - reset_command(PAUSE); -} - -#ifndef OPENTRACK_API -void Tracker::StopTracker(bool exit) -{ - set_command(PAUSE); -} -#endif - -#ifdef OPENTRACK_API -#define THeadPoseData double -#endif - -void Tracker::GetHeadPoseData(THeadPoseData *data) -{ - { - QMutexLocker lock(&mutex); - - if (!tracking_valid) return; - - FrameTrafo X_CM = point_tracker.get_pose(); - FrameTrafo X_MH(Matx33f::eye(), t_MH); - FrameTrafo X_GH = R_GC * X_CM * X_MH; - Matx33f R = X_GH.R * X_GH_0.R.t(); - Vec3f t = X_GH.t - X_GH_0.t; - - // get translation(s) - if (s.bEnableX) data[TX] = t[0] / 10.0; // convert to cm - if (s.bEnableY) data[TY] = t[1] / 10.0; - if (s.bEnableZ) data[TZ] = t[2] / 10.0; - - // translate rotation matrix from opengl (G) to roll-pitch-yaw (E) frame - // -z -> x, y -> z, x -> -y - Matx33f R_EG( 0, 0,-1, - -1, 0, 0, - 0, 1, 0); - R = R_EG * R * R_EG.t(); - - // extract rotation angles - float alpha, beta, gamma; - beta = atan2( -R(2,0), sqrt(R(2,1)*R(2,1) + R(2,2)*R(2,2)) ); - alpha = atan2( R(1,0), R(0,0)); - gamma = atan2( R(2,1), R(2,2)); - - if (s.bEnableYaw) data[Yaw] = rad2deg * alpha; - if (s.bEnablePitch) data[Pitch] = - rad2deg * beta; // FTNoIR expects a minus here - if (s.bEnableRoll) data[Roll] = rad2deg * gamma; - } -} - -//----------------------------------------------------------------------------- -#ifdef OPENTRACK_API -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() -#else -#pragma comment(linker, "/export:GetTracker=_GetTracker@0") -FTNOIR_TRACKER_BASE_EXPORT ITrackerPtr __stdcall GetTracker() -#endif -{ - return new Tracker; -} diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h deleted file mode 100644 index 79f16629..00000000 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h +++ /dev/null @@ -1,95 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - -#ifndef FTNOIR_TRACKER_PT_H -#define FTNOIR_TRACKER_PT_H - -#ifdef OPENTRACK_API -# include "ftnoir_tracker_base/ftnoir_tracker_base.h" -# include "facetracknoir/plugin-support.h" -#endif -#include "ftnoir_tracker_pt_settings.h" -#include "frame_observer.h" -#include "camera.h" -#include "point_extractor.h" -#include "point_tracker.h" -#include "pt_video_widget.h" -#include "facetracknoir/timer.hpp" - -#include <QThread> -#include <QMutex> -#include <QMutexLocker> -#include <QTime> -#include <opencv2/opencv.hpp> -#include <atomic> -#ifndef OPENTRACK_API -# include <boost/shared_ptr.hpp> -#else -# include "FTNoIR_Tracker_PT/boost-compat.h" -#endif -#include <vector> - -//----------------------------------------------------------------------------- -// Constantly processes the tracking chain in a separate thread -class Tracker : public ITracker, QThread, public FrameProvider -{ -public: - Tracker(); - virtual ~Tracker(); - virtual void StartTracker(QFrame* parent_window); - virtual void GetHeadPoseData(double* data); - virtual void refreshVideo(); - - void apply(settings& s); - void apply_inner(); - void center(); - void reset(); // reset the trackers internal state variables - void run(); - - void get_pose(FrameTrafo* X_CM) { QMutexLocker lock(&mutex); *X_CM = point_tracker.get_pose(); } - int get_n_points() { QMutexLocker lock(&mutex); return point_extractor.get_points().size(); } - void get_cam_info(CamInfo* info) { QMutexLocker lock(&mutex); *info = camera.get_info(); } - -protected: - // --- MutexedFrameProvider interface --- - virtual bool get_frame_and_points(cv::Mat& frame, boost::shared_ptr< std::vector<cv::Vec2f> >& points); - - // --- thread --- - QMutex mutex; - // thread commands - enum Command { - ABORT = 1<<0, - PAUSE = 1<<1 - }; - void set_command(Command command); - void reset_command(Command command); - volatile int commands; - - CVCamera camera; - FrameRotation frame_rotation; - PointExtractor point_extractor; - PointTracker point_tracker; - - FrameTrafo X_GH_0; // for centering - cv::Vec3f t_MH; // translation from model frame to head frame - cv::Matx33f R_GC; // rotation from opengl reference frame to camera frame - - // --- ui --- - cv::Mat frame; // the output frame for display - - PTVideoWidget* video_widget; - QFrame* video_frame; - bool tracking_valid; - - settings s; - std::atomic<settings*> new_settings; - Timer time; -}; - -#undef VideoWidget - -#endif // FTNOIR_TRACKER_PT_H diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.qrc b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.qrc deleted file mode 100644 index a8f9a1af..00000000 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.qrc +++ /dev/null @@ -1,9 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>Resources/cap_front.png</file> - <file>Resources/cap_side.png</file> - <file>Resources/clip_front.png</file> - <file>Resources/clip_side.png</file> - <file>Resources/Logo_IR.png</file> - </qresource> -</RCC> diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp deleted file mode 100644 index c103b78c..00000000 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp +++ /dev/null @@ -1,321 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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 "ftnoir_tracker_pt_dialog.h" - -#include <QMessageBox> -#include <QDebug> -#include <opencv2/opencv.hpp> -#ifndef OPENTRACK_API -# include <boost/shared_ptr.hpp> -#else -# include "FTNoIR_Tracker_PT/boost-compat.h" -#endif -#include <vector> - -using namespace std; - -//----------------------------------------------------------------------------- -TrackerDialog::TrackerDialog() - : tracker(NULL), - video_widget_dialog(NULL), - timer(this), - trans_calib_running(false) -{ - qDebug()<<"TrackerDialog::TrackerDialog"; - setAttribute(Qt::WA_DeleteOnClose, false); - - ui.setupUi( this ); - - vector<string> device_names; - get_camera_device_names(device_names); - for (vector<string>::iterator iter = device_names.begin(); iter != device_names.end(); ++iter) - { - ui.camdevice_combo->addItem(iter->c_str()); - } - - ui.camroll_combo->addItem("-90"); - ui.camroll_combo->addItem("0"); - ui.camroll_combo->addItem("90"); - - tie_setting(s.dyn_pose_res, ui.dynpose_check); - tie_setting(s.reset_time, ui.reset_spin); - - tie_setting(s.cam_index, ui.camdevice_combo); - tie_setting(s.cam_f, ui.f_dspin); - tie_setting(s.cam_res_x, ui.res_x_spin); - tie_setting(s.cam_res_y, ui.res_y_spin); - tie_setting(s.cam_fps, ui.fps_spin); - tie_setting(s.cam_roll, ui.camroll_combo); - tie_setting(s.cam_pitch, ui.campitch_spin); - tie_setting(s.cam_yaw, ui.camyaw_spin); - - tie_setting(s.threshold_secondary, ui.threshold_secondary_slider); - tie_setting(s.threshold, ui.threshold_slider); - - tie_setting(s.bEnableYaw, ui.chkEnableYaw); - tie_setting(s.bEnablePitch, ui.chkEnablePitch); - tie_setting(s.bEnableRoll, ui.chkEnableRoll); - tie_setting(s.bEnableX, ui.chkEnableX); - tie_setting(s.bEnableY, ui.chkEnableY); - tie_setting(s.bEnableZ, ui.chkEnableZ); - - tie_setting(s.min_point_size, ui.mindiam_spin); - tie_setting(s.max_point_size, ui.maxdiam_spin); - - tie_setting(s.clip_by, ui.clip_bheight_spin); - tie_setting(s.clip_bz, ui.clip_blength_spin); - tie_setting(s.clip_ty, ui.clip_theight_spin); - tie_setting(s.clip_tz, ui.clip_tlength_spin); - - tie_setting(s.cap_x, ui.cap_width_spin); - tie_setting(s.cap_y, ui.cap_height_spin); - tie_setting(s.cap_z, ui.cap_length_spin); - - tie_setting(s.m01_x, ui.m1x_spin); - tie_setting(s.m01_y, ui.m1y_spin); - tie_setting(s.m01_z, ui.m1z_spin); - - tie_setting(s.m02_x, ui.m2x_spin); - tie_setting(s.m02_y, ui.m2y_spin); - tie_setting(s.m02_z, ui.m2z_spin); - - tie_setting(s.t_MH_x, ui.tx_spin); - tie_setting(s.t_MH_y, ui.ty_spin); - tie_setting(s.t_MH_z, ui.tz_spin); - - connect( ui.tcalib_button,SIGNAL(toggled(bool)), this,SLOT(startstop_trans_calib(bool)) ); - connect(ui.reset_button, SIGNAL(clicked()), this, SLOT(doReset())); - - connect(ui.ok_button, SIGNAL(clicked()), this, SLOT(doOK())); - connect(ui.cancel_button, SIGNAL(clicked()), this, SLOT(doCancel())); - connect(ui.btnApply, SIGNAL(clicked()), this, SLOT(doApply())); - - ui.model_tabs->setCurrentIndex(s.active_model_panel); - - connect(ui.model_tabs, SIGNAL(currentChanged(int)), this, SLOT(set_model(int))); - connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); - timer.start(100); - - connect(s.b.get(), SIGNAL(bundleChanged()), this, SLOT(do_apply_without_saving())); -} - -void TrackerDialog::set_model_clip() -{ - s.m01_x = 0; - s.m01_y = static_cast<double>(s.clip_ty); - s.m01_z = -static_cast<double>(s.clip_tz); - s.m02_x = 0; - s.m02_y = -static_cast<double>(s.clip_by); - s.m02_z = -static_cast<double>(s.clip_bz); - - settings_changed(); -} - -void TrackerDialog::set_model_cap() -{ - s.m01_x = -static_cast<double>(s.cap_x); - s.m01_y = -static_cast<double>(s.cap_y); - s.m01_z = -static_cast<double>(s.cap_z); - s.m02_x = static_cast<double>(s.cap_x); - s.m02_y = -static_cast<double>(s.cap_y); - s.m02_z = -static_cast<double>(s.cap_z); - - settings_changed(); -} - -void TrackerDialog::set_model_custom() -{ - settings_changed(); -} - -void TrackerDialog::set_model(int val) -{ - s.active_model_panel = val; -} - -void TrackerDialog::startstop_trans_calib(bool start) -{ - if (start) - { - qDebug()<<"TrackerDialog:: Starting translation calibration"; - trans_calib.reset(); - trans_calib_running = true; - } - else - { - qDebug()<<"TrackerDialog:: Stoppping translation calibration"; - trans_calib_running = false; - { - auto tmp = trans_calib.get_estimate(); - s.t_MH_x = tmp[0]; - s.t_MH_y = tmp[1]; - s.t_MH_z = tmp[2]; - } - settings_changed(); - } -} - -void TrackerDialog::trans_calib_step() -{ - if (tracker) - { - FrameTrafo X_CM; - tracker->get_pose(&X_CM); - trans_calib.update(X_CM.R, X_CM.t); - cv::Vec3f t_MH = trans_calib.get_estimate(); - s.t_MH_x = t_MH[0]; - s.t_MH_y = t_MH[1]; - s.t_MH_z = t_MH[2]; - } -} - -void TrackerDialog::settings_changed() -{ - if (tracker) tracker->apply(s); -} - -void TrackerDialog::doCenter() -{ - if (tracker) tracker->center(); -} - -void TrackerDialog::doReset() -{ - if (tracker) tracker->reset(); -} - -void TrackerDialog::save() -{ - do_apply_without_saving(); - s.b->save(); -} - -void TrackerDialog::doOK() -{ - save(); - close(); -} - -void TrackerDialog::do_apply_without_saving() -{ - switch (s.active_model_panel) { - default: - case 0: - set_model_clip(); - break; - case 1: - set_model_cap(); - break; - case 2: - set_model_custom(); - break; - } - if (tracker) tracker->apply(s); -} - -void TrackerDialog::doApply() -{ - save(); -} - -void TrackerDialog::doCancel() -{ - s.b->revert(); - close(); -} - -void TrackerDialog::widget_destroyed(QObject* obj) -{ - if (obj == video_widget_dialog) { - // widget was / will be already deleted by Qt - destroy_video_widget(false); - } -} - -void TrackerDialog::create_video_widget() -{ - // this should not happen but better be sure - if (video_widget_dialog) destroy_video_widget(); - if (!tracker) return; - - video_widget_dialog = new VideoWidgetDialog(this, tracker); - video_widget_dialog->setAttribute( Qt::WA_DeleteOnClose ); - connect( video_widget_dialog, SIGNAL(destroyed(QObject*)), this, SLOT(widget_destroyed(QObject*)) ); - video_widget_dialog->show(); -} - -void TrackerDialog::destroy_video_widget(bool do_delete /*= true*/) -{ - if (video_widget_dialog) { - if (do_delete) delete video_widget_dialog; - video_widget_dialog = NULL; - } -} - -void TrackerDialog::poll_tracker_info() -{ - if (tracker) - { - QString to_print; - - // display caminfo - CamInfo info; - tracker->get_cam_info(&info); - to_print = QString::number(info.res_x)+"x"+QString::number(info.res_y)+" @ "+QString::number(info.fps)+" FPS"; - ui.caminfo_label->setText(to_print); - - // display pointinfo - int n_points = tracker->get_n_points(); - to_print = QString::number(n_points); - if (n_points == 3) - to_print += " OK!"; - else - to_print += " BAD!"; - ui.pointinfo_label->setText(to_print); - - // update calibration - if (trans_calib_running) trans_calib_step(); - - // update videowidget - if (video_widget_dialog) { - video_widget_dialog->get_video_widget()->update_frame_and_points(); - } - } - else - { - QString to_print = "Tracker offline"; - ui.caminfo_label->setText(to_print); - ui.pointinfo_label->setText(to_print); - } -} - -void TrackerDialog::registerTracker(ITracker *t) -{ - qDebug()<<"TrackerDialog:: Tracker registered"; - tracker = static_cast<Tracker*>(t); - if (isVisible() & s.b->modifiedp()) - tracker->apply(s); - ui.tcalib_button->setEnabled(true); - //ui.center_button->setEnabled(true); - ui.reset_button->setEnabled(true); -} - -void TrackerDialog::unRegisterTracker() -{ - qDebug()<<"TrackerDialog:: Tracker un-registered"; - tracker = NULL; - destroy_video_widget(); - ui.tcalib_button->setEnabled(false); - //ui.center_button->setEnabled(false); - ui.reset_button->setEnabled(false); -} - -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) -{ - return new TrackerDialog; -} diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h deleted file mode 100644 index 0325160d..00000000 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - -#ifndef FTNOIR_TRACKER_PT_DIALOG_H -#define FTNOIR_TRACKER_PT_DIALOG_H - -#ifdef OPENTRACK_API -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#else -#include "..\ftnoir_tracker_base\ftnoir_tracker_base.h" -#endif -#include "ftnoir_tracker_pt_settings.h" -#include "ftnoir_tracker_pt.h" -#include "trans_calib.h" -#include "pt_video_widget.h" -#include "ui_FTNoIR_PT_Controls.h" - -#include <QTimer> - -//----------------------------------------------------------------------------- -// The dialog that shows up when the user presses "Settings" -class TrackerDialog : public QWidget, Ui::UICPTClientControls, public ITrackerDialog -{ - Q_OBJECT -public: - TrackerDialog(); - void registerTracker(ITracker *tracker); - void unRegisterTracker(); - void save(); - void trans_calib_step(); - -public slots: - void doCenter(); - void doReset(); - void doOK(); - void doApply(); - void doCancel(); - void do_apply_without_saving(); - - void startstop_trans_calib(bool start); - void widget_destroyed(QObject* obj); - void create_video_widget(); - void poll_tracker_info(); - void set_model(int idx); - -protected: - void destroy_video_widget(bool do_delete = true); - - void set_model_clip(); - void set_model_cap(); - void set_model_custom(); - - void settings_changed(); - - settings s; - Tracker* tracker; - VideoWidgetDialog* video_widget_dialog; - QTimer timer; - - TranslationCalibrator trans_calib; - bool trans_calib_running; - - Ui::UICPTClientControls ui; -}; - -#endif //FTNOIR_TRACKER_PT_DIALOG_H diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp deleted file mode 100644 index 15e830a4..00000000 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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 "ftnoir_tracker_pt_dll.h" -#include <QIcon> - -//----------------------------------------------------------------------------- -void TrackerDll::getFullName(QString *strToBeFilled) -{ - *strToBeFilled = "PointTracker 1.1"; -} - -void TrackerDll::getShortName(QString *strToBeFilled) -{ - *strToBeFilled = "PointTracker"; -} - -void TrackerDll::getDescription(QString *strToBeFilled) -{ - *strToBeFilled = "Tracks a 3-point model with know geometry like Freetrack / TrackIR"; -} - -void TrackerDll::getIcon(QIcon *icon) -{ - *icon = QIcon(":/Resources/Logo_IR.png"); -} - - -#ifdef OPENTRACK_API -# include "facetracknoir/plugin-support.h" -extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() -#else -# pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0") -FTNOIR_TRACKER_BASE_EXPORT ITrackerDllPtr __stdcall GetTrackerDll() -#endif -{ - return new TrackerDll; -} diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h deleted file mode 100644 index 22e1ff29..00000000 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - -#if defined(OPENTRACK_API) -# include "ftnoir_tracker_base/ftnoir_tracker_base.h" -# include "facetracknoir/plugin-support.h" -#else -# include "../ftnoir_tracker_base/ftnoir_tracker_base.h" -#endif - -//----------------------------------------------------------------------------- -class TrackerDll : -#if defined(OPENTRACK_API) - public Metadata -#else - public ITrackerDll -#endif -{ - void getFullName(QString *strToBeFilled); - void getShortName(QString *strToBeFilled); - void getDescription(QString *strToBeFilled); - void getIcon(QIcon *icon); -}; diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h deleted file mode 100644 index 109090b3..00000000 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - -#ifndef FTNOIR_TRACKER_PT_SETTINGS_H -#define FTNOIR_TRACKER_PT_SETTINGS_H - -#include <opencv2/opencv.hpp> -#include "point_tracker.h" - -#include "facetracknoir/options.h" -using namespace options; - -struct settings -{ - pbundle b; - value<int> cam_index, - cam_res_x, - cam_res_y, - cam_fps, - cam_roll, - cam_pitch, - cam_yaw, - threshold, - threshold_secondary, - min_point_size, - max_point_size; - value<double> cam_f; - - value<int> m01_x, m01_y, m01_z; - value<int> m02_x, m02_y, m02_z; - value<bool> dyn_pose_res, video_widget; - - value<int> t_MH_x, t_MH_y, t_MH_z; - - value<int> reset_time; - - value<bool> bEnableYaw, bEnablePitch, bEnableRoll; - value<bool> bEnableX, bEnableY, bEnableZ; - - value<int> clip_ty, clip_tz, clip_by, clip_bz; - value<int> active_model_panel, cap_x, cap_y, cap_z; - - settings() : - b(bundle("tracker-pt")), - cam_index(b, "camera-index", 0), - cam_res_x(b, "camera-res-width", 640), - cam_res_y(b, "camera-res-height", 480), - cam_fps(b, "camera-fps", 30), - cam_roll(b, "camera-roll", 1), - cam_pitch(b, "camera-pitch", 0), - cam_yaw(b, "camera-yaw", 0), - threshold(b, "threshold-primary", 128), - threshold_secondary(b, "threshold-secondary", 128), - min_point_size(b, "min-point-size", 10), - max_point_size(b, "max-point-size", 50), - cam_f(b, "camera-focal-length", 1), - m01_x(b, "m_01-x", 0), - m01_y(b, "m_01-y", 0), - m01_z(b, "m_01-z", 0), - m02_x(b, "m_02-x", 0), - m02_y(b, "m_02-y", 0), - m02_z(b, "m_02-z", 0), - dyn_pose_res(b, "dynamic-pose-resolution", false), - video_widget(b, "video-widget", true), - t_MH_x(b, "model-centroid-x", 0), - t_MH_y(b, "model-centroid-y", 0), - t_MH_z(b, "model-centroid-z", 0), - reset_time(b, "reset-time", 2000), - bEnableYaw(b, "enable-yaw", true), - bEnablePitch(b, "enable-pitch", true), - bEnableRoll(b, "enable-roll", true), - bEnableX(b, "enable-x", true), - bEnableY(b, "enable-y", true), - bEnableZ(b, "enable-z", true), - clip_ty(b, "clip-ty", 0), - clip_tz(b, "clip-tz", 0), - clip_by(b, "clip-by", 0), - clip_bz(b, "clip-bz", 0), - active_model_panel(b, "active-model-panel", 0), - cap_x(b, "cap-x", 0), - cap_y(b, "cap-y", 0), - cap_z(b, "cap-z", 0) - {} -}; - -#endif //FTNOIR_TRACKER_PT_SETTINGS_H diff --git a/FTNoIR_Tracker_PT/point_extractor.cpp b/FTNoIR_Tracker_PT/point_extractor.cpp deleted file mode 100644 index d9ff0a5b..00000000 --- a/FTNoIR_Tracker_PT/point_extractor.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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 "point_extractor.h" -#include <QDebug> - - -using namespace cv; -using namespace std; - - -PointExtractor::PointExtractor(){ - //if (!AllocConsole()){} - //else SetConsoleTitle("debug"); - //freopen("CON", "w", stdout); - //freopen("CON", "w", stderr); -} -// ---------------------------------------------------------------------------- -const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool draw_output) -{ - const int W = frame.cols; - const int H = frame.rows; - - if (frame_last.cols != W || frame_last.rows != H) - { - frame_last = cv::Mat(); - } - - // clear old points - points.clear(); - - // convert to grayscale - Mat frame_gray; - cvtColor(frame, frame_gray, CV_RGB2GRAY); - - int secondary = threshold_secondary_val; - - // mask for everything that passes the threshold (or: the upper threshold of the hysteresis) - Mat frame_bin; - // only used if draw_output - Mat frame_bin_copy; - // mask for everything that passes - Mat frame_bin_low; - // mask for lower-threshold && combined result of last, needs to remain in scope until drawing, but is only used if secondary != 0 - Mat frame_last_and_low; - - if(secondary==0){ - threshold(frame_gray, frame_bin, threshold_val, 255, THRESH_BINARY); - }else{ - // we recombine a number of buffers, this might be slower than a single loop of per-pixel logic - // but it might as well be faster if openCV makes good use of SIMD - float t = threshold_val; - //float hyst = float(threshold_secondary_val)/512.; - //threshold(frame_gray, frame_bin, (t + ((255.-t)*hyst)), 255, THRESH_BINARY); - float hyst = float(threshold_secondary_val)/256.; - threshold(frame_gray, frame_bin, t, 255, THRESH_BINARY); - threshold(frame_gray, frame_bin_low,std::max(float(1), t - (t*hyst)), 255, THRESH_BINARY); - - if(draw_output) frame_bin.copyTo(frame_bin_copy); - if(frame_last.empty()){ - frame_bin.copyTo(frame_last); - }else{ - // keep pixels from last if they are above lower threshold - bitwise_and(frame_last, frame_bin_low, frame_last_and_low); - // union of pixels >= higher threshold and pixels >= lower threshold - bitwise_or(frame_bin, frame_last_and_low, frame_last); - frame_last.copyTo(frame_bin); - } - } - unsigned int region_size_min = 3.14*min_size*min_size/4.0; - unsigned int region_size_max = 3.14*max_size*max_size/4.0; - - int blob_index = 1; - for (int y=0; y<H; y++) - { - if (blob_index >= 255) break; - for (int x=0; x<W; x++) - { - if (blob_index >= 255) break; - - // find connected components with floodfill - if (frame_bin.at<unsigned char>(y,x) != 255) continue; - Rect rect; - - floodFill(frame_bin, Point(x,y), Scalar(blob_index), &rect, Scalar(0), Scalar(0), FLOODFILL_FIXED_RANGE); - blob_index++; - - // calculate the size of the connected component - unsigned int region_size = 0; - for (int i=rect.y; i < (rect.y+rect.height); i++) - { - for (int j=rect.x; j < (rect.x+rect.width); j++) - { - if (frame_bin.at<unsigned char>(i,j) != blob_index-1) continue; - region_size++; - } - } - - if (region_size < region_size_min || region_size > region_size_max) continue; - - // calculate the center of mass: - // mx = (sum_ij j*f(frame_grey_ij)) / (sum_ij f(frame_grey_ij)) - // my = ... - // f maps from [threshold,256] -> [0, 1], lower values are mapped to 0 - float m = 0; - float mx = 0; - float my = 0; - for (int i=rect.y; i < (rect.y+rect.height); i++) - { - for (int j=rect.x; j < (rect.x+rect.width); j++) - { - if (frame_bin.at<unsigned char>(i,j) != blob_index-1) continue; - float val; - - if(secondary==0){ - val = frame_gray.at<unsigned char>(i,j); - val = float(val - threshold_val)/(256 - threshold_val); - val = val*val; // makes it more stable (less emphasis on low values, more on the peak) - }else{ - //hysteresis point detection gets stability from ignoring pixel noise so we decidedly leave the actual pixel values out of the picture - val = frame_last.at<unsigned char>(i,j) / 256.; - } - - m += val; - mx += j * val; - my += i * val; - } - } - - // convert to centered camera coordinate system with y axis upwards - Vec2f c; - c[0] = (mx/m - W/2)/W; - c[1] = -(my/m - H/2)/W; - //qDebug()<<blob_index<<" => "<<c[0]<<" "<<c[1]; - points.push_back(c); - } - } - - // draw output image - if (draw_output) { - vector<Mat> channels; - if(secondary==0){ - frame_bin.setTo(170, frame_bin); - channels.push_back(frame_gray + frame_bin); - channels.push_back(frame_gray - frame_bin); - channels.push_back(frame_gray - frame_bin); - }else{ - frame_bin_copy.setTo(120, frame_bin_copy); - frame_bin_low.setTo(90, frame_bin_low); - channels.push_back(frame_gray + frame_bin_copy); - channels.push_back(frame_gray + frame_last_and_low); - channels.push_back(frame_gray + frame_bin_low); - //channels.push_back(frame_gray + frame_bin); - } - merge(channels, frame); - } - - return points; -} diff --git a/FTNoIR_Tracker_PT/point_extractor.h b/FTNoIR_Tracker_PT/point_extractor.h deleted file mode 100644 index ff36f3ce..00000000 --- a/FTNoIR_Tracker_PT/point_extractor.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - -#ifndef POINTEXTRACTOR_H -#define POINTEXTRACTOR_H - -#include <opencv2/opencv.hpp> -#include <opencv2/imgproc/imgproc_c.h> - -// ---------------------------------------------------------------------------- -// Extracts points from an opencv image -class PointExtractor -{ -public: - // extracts points from frame and draws some processing info into frame, if draw_output is set - // dt: time since last call in seconds - // WARNING: returned reference is valid as long as object - const std::vector<cv::Vec2f>& extract_points(cv::Mat frame, float dt, bool draw_output); - const std::vector<cv::Vec2f>& get_points() { return points; } - PointExtractor(); - - int threshold_val; - int threshold_secondary_val; - int min_size, max_size; - -protected: - std::vector<cv::Vec2f> points; - cv::Mat frame_last; -}; - -#endif //POINTEXTRACTOR_H diff --git a/FTNoIR_Tracker_PT/point_tracker.cpp b/FTNoIR_Tracker_PT/point_tracker.cpp deleted file mode 100644 index dfefdaf8..00000000 --- a/FTNoIR_Tracker_PT/point_tracker.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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 "point_tracker.h" - -#include <vector> -#include <algorithm> -#include <cmath> - -#include <QDebug> - -using namespace cv; -using namespace boost; -using namespace std; - -const float PI = 3.14159265358979323846f; - -// ---------------------------------------------------------------------------- -static void get_row(const Matx33f& m, int i, Vec3f& v) -{ - v[0] = m(i,0); - v[1] = m(i,1); - v[2] = m(i,2); -} - -static void set_row(Matx33f& m, int i, const Vec3f& v) -{ - m(i,0) = v[0]; - m(i,1) = v[1]; - m(i,2) = v[2]; -} - -// ---------------------------------------------------------------------------- -PointModel::PointModel(Vec3f M01, Vec3f M02) - : M01(M01), - M02(M02) -{ - // calculate u - u = M01.cross(M02); - u /= norm(u); - - // calculate projection matrix on M01,M02 plane - float s11 = M01.dot(M01); - float s12 = M01.dot(M02); - float s22 = M02.dot(M02); - P = 1.0/(s11*s22-s12*s12) * Matx22f(s22, -s12, - -s12, s11); - - // calculate d and d_order for simple freetrack-like point correspondence - vector<Vec2f> points; - points.push_back(Vec2f(0,0)); - points.push_back(Vec2f(M01[0], M01[1])); - points.push_back(Vec2f(M02[0], M02[1])); - // fit line to orthographically projected points - // ERROR: yields wrong results with colinear points?! - /* - Vec4f line; - fitLine(points, line, CV_DIST_L2, 0, 0.01, 0.01); - d[0] = line[0]; d[1] = line[1]; - */ - // TODO: fix this - d = Vec2f(M01[0]-M02[0], M01[1]-M02[1]); - - // sort model points - get_d_order(points, d_order); -} - -#ifdef OPENTRACK_API -static bool d_vals_sort(const pair<float,int> a, const pair<float,int> b) -{ - return a.first < b.first; -} -#endif - -void PointModel::get_d_order(const std::vector<cv::Vec2f>& points, int d_order[]) const -{ - // get sort indices with respect to d scalar product - vector< pair<float,int> > d_vals; - for (int i = 0; i<points.size(); ++i) - d_vals.push_back(pair<float, int>(d.dot(points[i]), i)); - - struct - { - bool operator()(const pair<float, int>& a, const pair<float, int>& b) { return a.first < b.first; } - } comp; - std::sort(d_vals.begin(), - d_vals.end(), -#ifdef OPENTRACK_API - d_vals_sort -#else - comp -#endif - ); - - for (int i = 0; i<points.size(); ++i) - d_order[i] = d_vals[i].second; -} - - -// ---------------------------------------------------------------------------- -PointTracker::PointTracker() - : init_phase(true), - dt_valid(0), - dt_reset(1), - v_t(0,0,0), - v_r(0,0,0), - dynamic_pose_resolution(true) -{ - X_CM.t[2] = 1000; // default position: 1 m away from cam; -} - -void PointTracker::reset() -{ - // enter init phase and reset velocities - init_phase = true; - dt_valid = 0; - reset_velocities(); -} - -void PointTracker::reset_velocities() -{ - v_t = Vec3f(0,0,0); - v_r = Vec3f(0,0,0); -} - - -bool PointTracker::track(const vector<Vec2f>& points, float f, float dt) -{ - if (!dynamic_pose_resolution) init_phase = true; - - dt_valid += dt; - // if there was no valid tracking result for too long, do a reset - if (dt_valid > dt_reset) - { - //qDebug()<<"dt_valid "<<dt_valid<<" > dt_reset "<<dt_reset; - reset(); - } - - bool no_model = -#ifdef OPENTRACK_API - point_model.get() == NULL; -#else - !point_model; -#endif - - // if there is a pointtracking problem, reset the velocities - if (no_model || points.size() != PointModel::N_POINTS) - { - //qDebug()<<"Wrong number of points!"; - reset_velocities(); - return false; - } - - X_CM_old = X_CM; // backup old transformation for velocity calculation - - if (!init_phase) - predict(dt_valid); - - // if there is a point correspondence problem something has gone wrong, do a reset - if (!find_correspondences(points, f)) - { - //qDebug()<<"Error in finding point correspondences!"; - X_CM = X_CM_old; // undo prediction - reset(); - return false; - } - - int n_iter = POSIT(f); - //qDebug()<<"Number of POSIT iterations: "<<n_iter; - - if (!init_phase) - update_velocities(dt_valid); - - // we have a valid tracking result, leave init phase and reset time since valid result - init_phase = false; - dt_valid = 0; - return true; -} - -void PointTracker::predict(float dt) -{ - // predict with constant velocity - Matx33f R; - Rodrigues(dt*v_r, R); - X_CM.R = R*X_CM.R; - X_CM.t += dt * v_t; -} - -void PointTracker::update_velocities(float dt) -{ - // update velocities - Rodrigues(X_CM.R*X_CM_old.R.t(), v_r); - v_r /= dt; - v_t = (X_CM.t - X_CM_old.t)/dt; -} - -bool PointTracker::find_correspondences(const vector<Vec2f>& points, float f) -{ - if (init_phase) { - // We do a simple freetrack-like sorting in the init phase... - // sort points - int point_d_order[PointModel::N_POINTS]; - point_model->get_d_order(points, point_d_order); - - // set correspondences - for (int i=0; i<PointModel::N_POINTS; ++i) - { - p[point_model->d_order[i]] = points[point_d_order[i]]; - } - } - else { - // ... otherwise we look at the distance to the projection of the expected model points - // project model points under current pose - p_exp[0] = project(Vec3f(0,0,0), f); - p_exp[1] = project(point_model->M01, f); - p_exp[2] = project(point_model->M02, f); - - // set correspondences by minimum distance to projected model point - bool point_taken[PointModel::N_POINTS]; - for (int i=0; i<PointModel::N_POINTS; ++i) - point_taken[i] = false; - - float min_sdist = 0; - int min_idx = 0; - - for (int i=0; i<PointModel::N_POINTS; ++i) - { - // find closest point to projected model point i - for (int j=0; j<PointModel::N_POINTS; ++j) - { - Vec2f d = p_exp[i]-points[j]; - float sdist = d.dot(d); - if (sdist < min_sdist || j==0) - { - min_idx = j; - min_sdist = sdist; - } - } - // if one point is closest to more than one model point, abort - if (point_taken[min_idx]) return false; - point_taken[min_idx] = true; - p[i] = points[min_idx]; - } - } - return true; -} - - - -int PointTracker::POSIT(float f) -{ - // POSIT algorithm for coplanar points as presented in - // [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"] - // we use the same notation as in the paper here - - // The expected rotation used for resolving the ambiguity in POSIT: - // In every iteration step the rotation closer to R_expected is taken - Matx33f R_expected; - if (init_phase) - R_expected = Matx33f::eye(); // in the init phase, we want to be close to the default pose = no rotation - else - R_expected = X_CM.R; // later we want to be close to the last (predicted) rotation - - // initial pose = last (predicted) pose - Vec3f k; - get_row(R_expected, 2, k); - float Z0 = init_phase ? 1000 : X_CM.t[2]; - - float old_epsilon_1 = 0; - float old_epsilon_2 = 0; - float epsilon_1 = 1; - float epsilon_2 = 1; - - Vec3f I0, J0; - Vec2f I0_coeff, J0_coeff; - - Vec3f I_1, J_1, I_2, J_2; - Matx33f R_1, R_2; - Matx33f* R_current; - - const int MAX_ITER = 100; - const float EPS_THRESHOLD = 1e-4; - - int i=1; - for (; i<MAX_ITER; ++i) - { - epsilon_1 = k.dot(point_model->M01)/Z0; - epsilon_2 = k.dot(point_model->M02)/Z0; - - // vector of scalar products <I0, M0i> and <J0, M0i> - Vec2f I0_M0i(p[1][0]*(1.0 + epsilon_1) - p[0][0], - p[2][0]*(1.0 + epsilon_2) - p[0][0]); - Vec2f J0_M0i(p[1][1]*(1.0 + epsilon_1) - p[0][1], - p[2][1]*(1.0 + epsilon_2) - p[0][1]); - - // construct projection of I, J onto M0i plane: I0 and J0 - I0_coeff = point_model->P * I0_M0i; - J0_coeff = point_model->P * J0_M0i; - I0 = I0_coeff[0]*point_model->M01 + I0_coeff[1]*point_model->M02; - J0 = J0_coeff[0]*point_model->M01 + J0_coeff[1]*point_model->M02; - - // calculate u component of I, J - float II0 = I0.dot(I0); - float IJ0 = I0.dot(J0); - float JJ0 = J0.dot(J0); - float rho, theta; - if (JJ0 == II0) { - rho = sqrt(abs(2*IJ0)); - theta = -PI/4; - if (IJ0<0) theta *= -1; - } - else { - rho = sqrt(sqrt( (JJ0-II0)*(JJ0-II0) + 4*IJ0*IJ0 )); - theta = atan( -2*IJ0 / (JJ0-II0) ); - if (JJ0 - II0 < 0) theta += PI; - theta /= 2; - } - - // construct the two solutions - I_1 = I0 + rho*cos(theta)*point_model->u; - I_2 = I0 - rho*cos(theta)*point_model->u; - - J_1 = J0 + rho*sin(theta)*point_model->u; - J_2 = J0 - rho*sin(theta)*point_model->u; - - float norm_const = 1.0/norm(I_1); // all have the same norm - - // create rotation matrices - I_1 *= norm_const; J_1 *= norm_const; - I_2 *= norm_const; J_2 *= norm_const; - - set_row(R_1, 0, I_1); - set_row(R_1, 1, J_1); - set_row(R_1, 2, I_1.cross(J_1)); - - set_row(R_2, 0, I_2); - set_row(R_2, 1, J_2); - set_row(R_2, 2, I_2.cross(J_2)); - - // the single translation solution - Z0 = norm_const * f; - - // pick the rotation solution closer to the expected one - // in simple metric d(A,B) = || I - A * B^T || - float R_1_deviation = norm(Matx33f::eye() - R_expected * R_1.t()); - float R_2_deviation = norm(Matx33f::eye() - R_expected * R_2.t()); - - if (R_1_deviation < R_2_deviation) - R_current = &R_1; - else - R_current = &R_2; - - get_row(*R_current, 2, k); - - // check for convergence condition - if (abs(epsilon_1 - old_epsilon_1) + abs(epsilon_2 - old_epsilon_2) < EPS_THRESHOLD) - break; - old_epsilon_1 = epsilon_1; - old_epsilon_2 = epsilon_2; - } - - // apply results - X_CM.R = *R_current; - X_CM.t[0] = p[0][0] * Z0/f; - X_CM.t[1] = p[0][1] * Z0/f; - X_CM.t[2] = Z0; - - return i; - - //Rodrigues(X_CM.R, r); - //qDebug()<<"iter: "<<i; - //qDebug()<<"t: "<<X_CM.t[0]<<' '<<X_CM.t[1]<<' '<<X_CM.t[2]; - //Vec3f r; - // - //qDebug()<<"r: "<<r[0]<<' '<<r[1]<<' '<<r[2]<<'\n'; -} diff --git a/FTNoIR_Tracker_PT/point_tracker.h b/FTNoIR_Tracker_PT/point_tracker.h deleted file mode 100644 index 11034100..00000000 --- a/FTNoIR_Tracker_PT/point_tracker.h +++ /dev/null @@ -1,129 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - -#ifndef POINTTRACKER_H -#define POINTTRACKER_H - -#include <opencv2/opencv.hpp> -#ifndef OPENTRACK_API -# include <boost/shared_ptr.hpp> -#else -# include "FTNoIR_Tracker_PT/boost-compat.h" -#endif -#include <list> - -// ---------------------------------------------------------------------------- -// Affine frame trafo -class FrameTrafo -{ -public: - FrameTrafo() : R(cv::Matx33f::eye()), t(0,0,0) {} - FrameTrafo(const cv::Matx33f& R, const cv::Vec3f& t) : R(R),t(t) {} - - cv::Matx33f R; - cv::Vec3f t; -}; - -inline FrameTrafo operator*(const FrameTrafo& X, const FrameTrafo& Y) -{ - return FrameTrafo(X.R*Y.R, X.R*Y.t + X.t); -} - -inline FrameTrafo operator*(const cv::Matx33f& X, const FrameTrafo& Y) -{ - return FrameTrafo(X*Y.R, X*Y.t); -} - -inline FrameTrafo operator*(const FrameTrafo& X, const cv::Matx33f& Y) -{ - return FrameTrafo(X.R*Y, X.t); -} - -inline cv::Vec3f operator*(const FrameTrafo& X, const cv::Vec3f& v) -{ - return X.R*v + X.t; -} - - -// ---------------------------------------------------------------------------- -// Describes a 3-point model -// nomenclature as in -// [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"] -class PointModel -{ - friend class PointTracker; -public: - static const int N_POINTS = 3; - - PointModel(cv::Vec3f M01, cv::Vec3f M02); - - const cv::Vec3f& get_M01() const { return M01; }; - const cv::Vec3f& get_M02() const { return M02; }; - -protected: - cv::Vec3f M01; // M01 in model frame - cv::Vec3f M02; // M02 in model frame - - cv::Vec3f u; // unit vector perpendicular to M01,M02-plane - - cv::Matx22f P; - - cv::Vec2f d; // discriminant vector for point correspondence - int d_order[3]; // sorting of projected model points with respect to d scalar product - - void get_d_order(const std::vector<cv::Vec2f>& points, int d_order[]) const; -}; - -// ---------------------------------------------------------------------------- -// Tracks a 3-point model -// implementing the POSIT algorithm for coplanar points as presented in -// [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"] -class PointTracker -{ -public: - PointTracker(); - - // track the pose using the set of normalized point coordinates (x pos in range -0.5:0.5) - // f : (focal length)/(sensor width) - // dt : time since last call - bool track(const std::vector<cv::Vec2f>& points, float f, float dt); - boost::shared_ptr<PointModel> point_model; - - bool dynamic_pose_resolution; - float dt_reset; - - FrameTrafo get_pose() const { return X_CM; } - void reset(); - -protected: - inline cv::Vec2f project(const cv::Vec3f& v_M, float f) - { - cv::Vec3f v_C = X_CM * v_M; - return cv::Vec2f(f*v_C[0]/v_C[2], f*v_C[1]/v_C[2]); - } - - bool find_correspondences(const std::vector<cv::Vec2f>& points, float f); - - cv::Vec2f p[PointModel::N_POINTS]; // the points in model order - cv::Vec2f p_exp[PointModel::N_POINTS]; // the expected point positions - - void predict(float dt); - void update_velocities(float dt); - void reset_velocities(); - - - int POSIT(float f); // The POSIT algorithm, returns the number of iterations - - bool init_phase; - float dt_valid; // time since last valid tracking result - cv::Vec3f v_t; // velocities - cv::Vec3f v_r; - FrameTrafo X_CM; // trafo from model to camera - FrameTrafo X_CM_old; -}; - -#endif //POINTTRACKER_H diff --git a/FTNoIR_Tracker_PT/pt_video_widget.cpp b/FTNoIR_Tracker_PT/pt_video_widget.cpp deleted file mode 100644 index 02817cbf..00000000 --- a/FTNoIR_Tracker_PT/pt_video_widget.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - * - * 20130312, WVR: Add 7 lines to resizeGL after resize_frame. This should lower CPU-load. - */ - -#include "pt_video_widget.h" - -#include <QDebug> -#include <QHBoxLayout> - -using namespace cv; -using namespace std; - -void PTVideoWidget::update_image(const cv::Mat& frame) -{ - QMutexLocker foo(&mtx); - _frame = frame.clone(); - freshp = true; -} - -// ---------------------------------------------------------------------------- -VideoWidgetDialog::VideoWidgetDialog(QWidget *parent, FrameProvider* provider) - : QDialog(parent), - video_widget(NULL) -{ - const int VIDEO_FRAME_WIDTH = 640; - const int VIDEO_FRAME_HEIGHT = 480; - - video_widget = new PTVideoWidget(this, provider); - - QHBoxLayout* layout = new QHBoxLayout(); - layout->setContentsMargins(0, 0, 0, 0); - layout->addWidget(video_widget); - if (this->layout()) delete this->layout(); - setLayout(layout); - resize(VIDEO_FRAME_WIDTH, VIDEO_FRAME_HEIGHT); -} - -void PTVideoWidget::update_and_repaint() -{ - QMutexLocker foo(&mtx); - if (_frame.empty() || !freshp) - return; - freshp = false; - QImage qframe = QImage(_frame.cols, _frame.rows, QImage::Format_RGB888); - uchar* data = qframe.bits(); - const int pitch = qframe.bytesPerLine(); - for (int y = 0; y < _frame.rows; y++) - for (int x = 0; x < _frame.cols; x++) - { - const auto& elt = _frame.at<Vec3b>(y, x); - const cv::Scalar elt2 = static_cast<cv::Scalar>(elt); - data[y * pitch + x * 3 + 0] = elt2.val[2]; - data[y * pitch + x * 3 + 1] = elt2.val[1]; - data[y * pitch + x * 3 + 2] = elt2.val[0]; - } - qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); - texture = qframe; - update(); -} diff --git a/FTNoIR_Tracker_PT/pt_video_widget.h b/FTNoIR_Tracker_PT/pt_video_widget.h deleted file mode 100644 index 25d593c3..00000000 --- a/FTNoIR_Tracker_PT/pt_video_widget.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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 "frame_observer.h" -#include <QObject> -#include <QTime> -#include <QDialog> -#include <opencv2/opencv.hpp> -#ifndef OPENTRACK_API -# include <QGLWidget> -# include <boost/shared_ptr.hpp> -#else -# include "FTNoIR_Tracker_PT/boost-compat.h" -# if defined(_WIN32) -# include <dshow.h> -# endif -#endif -#include <QPainter> -#include <QPaintEvent> -#include <QTimer> - -class PTVideoWidget : public QWidget, public FrameObserver -{ - Q_OBJECT - -public: - PTVideoWidget(QWidget *parent, FrameProvider* provider) : - QWidget(parent), - /* to avoid linker errors */ FrameObserver(provider), - freshp(false) - { - connect(&timer, SIGNAL(timeout()), this, SLOT(update_and_repaint())); - timer.start(40); - } - void update_image(const cv::Mat &frame); - void update_frame_and_points() {} -protected slots: - void paintEvent( QPaintEvent* e ) { - QMutexLocker foo(&mtx); - QPainter painter(this); - painter.drawImage(e->rect(), texture); - } - void update_and_repaint(); -private: - QMutex mtx; - QImage texture; - QTimer timer; - cv::Mat _frame; - bool freshp; -}; - -// ---------------------------------------------------------------------------- -// A VideoWidget embedded in a dialog frame -class VideoWidgetDialog : public QDialog -{ - Q_OBJECT -public: - VideoWidgetDialog(QWidget *parent, FrameProvider* provider); - virtual ~VideoWidgetDialog() {} - - PTVideoWidget* get_video_widget() { return video_widget; } - -private: - PTVideoWidget* video_widget; -}; diff --git a/FTNoIR_Tracker_PT/trans_calib.cpp b/FTNoIR_Tracker_PT/trans_calib.cpp deleted file mode 100644 index 9b75a1b6..00000000 --- a/FTNoIR_Tracker_PT/trans_calib.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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 "trans_calib.h" - -using namespace cv; - -//----------------------------------------------------------------------------- -TranslationCalibrator::TranslationCalibrator() -{ - reset(); -} - -void TranslationCalibrator::reset() -{ - P = Matx66f::zeros(); - y = Vec6f(0,0,0, 0,0,0); -} - -void TranslationCalibrator::update(const Matx33f& R_CM_k, const Vec3f& t_CM_k) -{ - Matx<float, 6,3> H_k_T = Matx<float, 6,3>::zeros(); - for (int i=0; i<3; ++i) { - for (int j=0; j<3; ++j) { - H_k_T(i,j) = R_CM_k(j,i); - } - } - for (int i=0; i<3; ++i) - { - H_k_T(3+i,i) = 1.0; - } - P += H_k_T * H_k_T.t(); - y += H_k_T * t_CM_k; -} - -Vec3f TranslationCalibrator::get_estimate() -{ - Vec6f x = P.inv() * y; - return Vec3f(-x[0], -x[1], -x[2]); -} \ No newline at end of file diff --git a/FTNoIR_Tracker_PT/trans_calib.h b/FTNoIR_Tracker_PT/trans_calib.h deleted file mode 100644 index f2521690..00000000 --- a/FTNoIR_Tracker_PT/trans_calib.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - -#ifndef TRANSCALIB_H -#define TRANSCALIB_H - -#include <opencv2/opencv.hpp> - -//----------------------------------------------------------------------------- -// Calibrates the translation from head to model = t_MH -// by recursive least squares / -// kalman filter in information form with identity noise covariance -// measurement equation when head position = t_CH is fixed: -// (R_CM_k , Id)*(-t_MH, t_CH) = t_CM_k - -class TranslationCalibrator -{ -public: - TranslationCalibrator(); - - // reset the calibration process - void reset(); - - // update the current estimate - void update(const cv::Matx33f& R_CM_k, const cv::Vec3f& t_CM_k); - - // get the current estimate for t_MH - cv::Vec3f get_estimate(); - -protected: - cv::Matx66f P; // normalized precision matrix = inverse covariance - cv::Vec6f y; // P*(-t_MH, t_CH) -}; - -#endif //TRANSCALIB_H \ No newline at end of file diff --git a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui new file mode 100644 index 00000000..0bbec7e1 --- /dev/null +++ b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui @@ -0,0 +1,1790 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UICPTClientControls</class> + <widget class="QWidget" name="UICPTClientControls"> + <property name="windowModality"> + <enum>Qt::NonModal</enum> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>459</width> + <height>621</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle"> + <string>PointTracker Settings</string> + </property> + <property name="windowIcon"> + <iconset resource="ftnoir_tracker_pt.qrc"> + <normaloff>:/Resources/Logo_IR.png</normaloff>:/Resources/Logo_IR.png</iconset> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="sizeConstraint"> + <enum>QLayout::SetFixedSize</enum> + </property> + <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>General</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QGroupBox" name="groupBox_6"> + <property name="title"> + <string>Tracker Thread</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label_43"> + <property name="text"> + <string>Auto-reset time</string> + </property> + <property name="buddy"> + <cstring>reset_spin</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="reset_spin"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Time until automatic reset of tracker's internal state when no valid tracking result is found</string> + </property> + <property name="suffix"> + <string>ms</string> + </property> + <property name="maximum"> + <number>9999</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_17"> + <property name="text"> + <string>Dynamic Pose Resolution</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QCheckBox" name="dynpose_check"> + <property name="toolTip"> + <string/> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QPushButton" name="reset_button"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Reset the tracker's internal state</string> + </property> + <property name="text"> + <string>Reset</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_3"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>85</height> + </size> + </property> + <property name="title"> + <string>Enable Axis</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>Roll:</string> + </property> + <property name="buddy"> + <cstring>chkEnableRoll</cstring> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_9"> + <property name="text"> + <string>Pitch:</string> + </property> + <property name="buddy"> + <cstring>chkEnablePitch</cstring> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_11"> + <property name="text"> + <string>Yaw:</string> + </property> + <property name="buddy"> + <cstring>chkEnableYaw</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QCheckBox" name="chkEnableRoll"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QCheckBox" name="chkEnablePitch"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QCheckBox" name="chkEnableYaw"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLabel" name="label_14"> + <property name="text"> + <string>X:</string> + </property> + <property name="buddy"> + <cstring>chkEnableX</cstring> + </property> + </widget> + </item> + <item row="0" column="4"> + <widget class="QCheckBox" name="chkEnableX"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLabel" name="label_15"> + <property name="text"> + <string>Y:</string> + </property> + <property name="buddy"> + <cstring>chkEnableY</cstring> + </property> + </widget> + </item> + <item row="1" column="4"> + <widget class="QCheckBox" name="chkEnableY"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLabel" name="label_16"> + <property name="text"> + <string>Z:</string> + </property> + <property name="buddy"> + <cstring>chkEnableZ</cstring> + </property> + </widget> + </item> + <item row="2" column="4"> + <widget class="QCheckBox" name="chkEnableZ"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="0" column="2"> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Minimum</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="2"> + <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Minimum</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="2"> + <spacer name="horizontalSpacer_8"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Minimum</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>Camera</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_7"> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="toolTip"> + <string>The camera device used as input</string> + </property> + <property name="title"> + <string>Camera Settings</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="label_2"> + <property name="minimumSize"> + <size> + <width>55</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Device</string> + </property> + <property name="buddy"> + <cstring>camdevice_combo</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="camdevice_combo"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Camera device used as input</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_8"> + <item> + <layout class="QGridLayout" name="gridLayout_8"> + <item row="0" column="0"> + <widget class="QLabel" name="label_36"> + <property name="minimumSize"> + <size> + <width>55</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Resolution</string> + </property> + </widget> + </item> + <item row="0" column="5"> + <widget class="QLabel" name="label_37"> + <property name="text"> + <string>FPS</string> + </property> + <property name="buddy"> + <cstring>fps_spin</cstring> + </property> + </widget> + </item> + <item row="0" column="6"> + <widget class="QSpinBox" name="fps_spin"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Desired capture framerate</string> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_41"> + <property name="text"> + <string>x</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="res_x_spin"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Desired capture width</string> + </property> + <property name="maximum"> + <number>2000</number> + </property> + <property name="singleStep"> + <number>10</number> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QSpinBox" name="res_y_spin"> + <property name="toolTip"> + <string>Desired capture height</string> + </property> + <property name="maximum"> + <number>2000</number> + </property> + <property name="singleStep"> + <number>10</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_34"> + <property name="text"> + <string>F/W</string> + </property> + <property name="buddy"> + <cstring>f_dspin</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QDoubleSpinBox" name="f_dspin"> + <property name="toolTip"> + <string>The camera's focal length devided by its sensor width</string> + </property> + <property name="decimals"> + <number>2</number> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="0" column="4"> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="7"> + <spacer name="horizontalSpacer_9"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_7"/> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_4"> + <property name="title"> + <string>Camera Orientation</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_8"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <item> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="1" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Pitch</string> + </property> + <property name="buddy"> + <cstring>campitch_spin</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="campitch_spin"> + <property name="contextMenuPolicy"> + <enum>Qt::DefaultContextMenu</enum> + </property> + <property name="toolTip"> + <string>The angle the camera is facing upwards</string> + </property> + <property name="minimum"> + <number>-99</number> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_20"> + <property name="text"> + <string>Yaw</string> + </property> + <property name="buddy"> + <cstring>camyaw_spin</cstring> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QSpinBox" name="camyaw_spin"> + <property name="contextMenuPolicy"> + <enum>Qt::DefaultContextMenu</enum> + </property> + <property name="toolTip"> + <string>The angle the camera is facing leftwards</string> + </property> + <property name="minimum"> + <number>-99</number> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="label_21"> + <property name="text"> + <string>deg (positve = leftwards)</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="camroll_combo"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Rotation of the camera image</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>deg (positive = upwards)</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_19"> + <property name="text"> + <string>deg</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_18"> + <property name="text"> + <string>Roll</string> + </property> + <property name="buddy"> + <cstring>camroll_combo</cstring> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer_10"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Point Extraction</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Threshold</string> + </property> + <property name="buddy"> + <cstring>threshold_slider</cstring> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="threshold_slider"> + <property name="toolTip"> + <string>Intensity threshold for point extraction</string> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="value"> + <number>127</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_secondary"> + <item> + <widget class="QLabel" name="label_secondary"> + <property name="text"> + <string>Hysteresis</string> + </property> + <property name="buddy"> + <cstring>threshold_secondary_slider</cstring> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="threshold_secondary_slider"> + <property name="toolTip"> + <string>Per pixel hysteresis width (leave left if there is little difference between dot and non-dot, move right for increased stability against pixel noise)</string> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="pageStep"> + <number>1</number> + </property> + <property name="value"> + <number>100</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Min Diameter</string> + </property> + <property name="buddy"> + <cstring>mindiam_spin</cstring> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="mindiam_spin"> + <property name="toolTip"> + <string>Minimum point diameter</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_12"> + <property name="text"> + <string>px</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Max Diameter</string> + </property> + <property name="buddy"> + <cstring>maxdiam_spin</cstring> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="maxdiam_spin"> + <property name="toolTip"> + <string>Maximum point diameter</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_13"> + <property name="text"> + <string>px</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_4"> + <attribute name="title"> + <string>Model</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_16"> + <item> + <widget class="QTabWidget" name="model_tabs"> + <property name="tabShape"> + <enum>QTabWidget::Rounded</enum> + </property> + <property name="currentIndex"> + <number>2</number> + </property> + <property name="usesScrollButtons"> + <bool>false</bool> + </property> + <property name="documentMode"> + <bool>false</bool> + </property> + <property name="tabsClosable"> + <bool>false</bool> + </property> + <widget class="QWidget" name="tab_5"> + <attribute name="title"> + <string>Clip</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_13"> + <item> + <widget class="QGroupBox" name="groupBox_8"> + <property name="title"> + <string>Model Dimensions (mm)</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_16"> + <item> + <widget class="QWidget" name="widget_4" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>160</height> + </size> + </property> + <widget class="QLabel" name="label_44"> + <property name="geometry"> + <rect> + <x>30</x> + <y>30</y> + <width>71</width> + <height>111</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/clip_side.png</pixmap> + </property> + </widget> + <widget class="QSpinBox" name="clip_theight_spin"> + <property name="geometry"> + <rect> + <x>100</x> + <y>50</y> + <width>46</width> + <height>22</height> + </rect> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + <widget class="QSpinBox" name="clip_tlength_spin"> + <property name="geometry"> + <rect> + <x>60</x> + <y>10</y> + <width>46</width> + <height>22</height> + </rect> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + <widget class="QSpinBox" name="clip_bheight_spin"> + <property name="geometry"> + <rect> + <x>100</x> + <y>90</y> + <width>46</width> + <height>22</height> + </rect> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + <widget class="QLabel" name="label_50"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>46</width> + <height>13</height> + </rect> + </property> + <property name="text"> + <string>Side</string> + </property> + </widget> + <widget class="QSpinBox" name="clip_blength_spin"> + <property name="geometry"> + <rect> + <x>40</x> + <y>140</y> + <width>46</width> + <height>22</height> + </rect> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + <widget class="QLabel" name="label_52"> + <property name="geometry"> + <rect> + <x>70</x> + <y>70</y> + <width>16</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>R</string> + </property> + </widget> + </widget> + </item> + <item> + <widget class="QWidget" name="widget_3" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>140</height> + </size> + </property> + <widget class="QLabel" name="label_51"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>46</width> + <height>13</height> + </rect> + </property> + <property name="text"> + <string>Front</string> + </property> + </widget> + <widget class="QLabel" name="label_45"> + <property name="geometry"> + <rect> + <x>40</x> + <y>30</y> + <width>21</width> + <height>111</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/clip_front.png</pixmap> + </property> + </widget> + <widget class="QLabel" name="label_53"> + <property name="geometry"> + <rect> + <x>60</x> + <y>70</y> + <width>16</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>R</string> + </property> + </widget> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_6"> + <attribute name="title"> + <string>Cap</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_14"> + <item> + <widget class="QGroupBox" name="groupBox_9"> + <property name="title"> + <string>Model Dimensions (mm)</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_15"> + <item> + <widget class="QWidget" name="widget" native="true"> + <property name="minimumSize"> + <size> + <width>140</width> + <height>130</height> + </size> + </property> + <widget class="QLabel" name="label_46"> + <property name="geometry"> + <rect> + <x>20</x> + <y>50</y> + <width>111</width> + <height>81</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/cap_side.png</pixmap> + </property> + </widget> + <widget class="QSpinBox" name="cap_height_spin"> + <property name="geometry"> + <rect> + <x>30</x> + <y>80</y> + <width>46</width> + <height>22</height> + </rect> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + <widget class="QLabel" name="label_54"> + <property name="geometry"> + <rect> + <x>130</x> + <y>50</y> + <width>16</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>R</string> + </property> + </widget> + <widget class="QLabel" name="label_48"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>46</width> + <height>13</height> + </rect> + </property> + <property name="text"> + <string>Side</string> + </property> + </widget> + <widget class="QSpinBox" name="cap_length_spin"> + <property name="geometry"> + <rect> + <x>50</x> + <y>40</y> + <width>46</width> + <height>22</height> + </rect> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </widget> + </item> + <item> + <widget class="QWidget" name="widget_2" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>130</height> + </size> + </property> + <widget class="QLabel" name="label_49"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>46</width> + <height>13</height> + </rect> + </property> + <property name="text"> + <string>Front</string> + </property> + </widget> + <widget class="QLabel" name="label_55"> + <property name="geometry"> + <rect> + <x>30</x> + <y>50</y> + <width>16</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>R</string> + </property> + </widget> + <widget class="QLabel" name="label_47"> + <property name="geometry"> + <rect> + <x>10</x> + <y>50</y> + <width>81</width> + <height>81</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/cap_front.png</pixmap> + </property> + </widget> + <widget class="QSpinBox" name="cap_width_spin"> + <property name="geometry"> + <rect> + <x>50</x> + <y>30</y> + <width>46</width> + <height>22</height> + </rect> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_7"> + <attribute name="title"> + <string>Custom</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_15"> + <item> + <widget class="QGroupBox" name="groupBox_7"> + <property name="title"> + <string>Model Dimensions (mm)</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_12"> + <item> + <widget class="QLabel" name="label_56"> + <property name="text"> + <string><html><head/><body><p>Location of the two remaining model points<br/>with respect to the reference point in default pose</p></body></html></string> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer_4"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_14"> + <item> + <spacer name="horizontalSpacer_14"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>10</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="3" column="2"> + <widget class="QSpinBox" name="m1z_spin"> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLabel" name="label_58"> + <property name="text"> + <string>y:</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QSpinBox" name="m1y_spin"> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLabel" name="label_57"> + <property name="text"> + <string>z:</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_60"> + <property name="text"> + <string>M1:</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QSpinBox" name="m1x_spin"> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="label_63"> + <property name="text"> + <string>x:</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer_15"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QGridLayout" name="gridLayout_5"> + <item row="1" column="2"> + <widget class="QSpinBox" name="m2x_spin"> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="label_67"> + <property name="text"> + <string>x:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLabel" name="label_69"> + <property name="text"> + <string>z:</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QSpinBox" name="m2y_spin"> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLabel" name="label_70"> + <property name="text"> + <string>y:</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_64"> + <property name="text"> + <string>M2:</string> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QSpinBox" name="m2z_spin"> + <property name="suffix"> + <string/> + </property> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer_16"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>10</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer_3"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_10"> + <property name="title"> + <string>Model Position (mm)</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_11"> + <item> + <widget class="QLabel" name="label_59"> + <property name="text"> + <string><html><head/><body><p>Translation from head center to model reference point<br/> in default pose</p></body></html></string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_17"> + <item> + <spacer name="horizontalSpacer_17"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>10</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QGridLayout" name="gridLayout_6"> + <item row="3" column="1"> + <widget class="QSpinBox" name="tz_spin"> + <property name="suffix"> + <string/> + </property> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_61"> + <property name="text"> + <string>x:</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_62"> + <property name="text"> + <string>y:</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_66"> + <property name="text"> + <string>z:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QSpinBox" name="ty_spin"> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="tx_spin"> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer_18"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="tcalib_button"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Calibrate</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_19"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>10</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_3"> + <attribute name="title"> + <string>About</string> + </attribute> + <widget class="QLabel" name="label_10"> + <property name="geometry"> + <rect> + <x>30</x> + <y>30</y> + <width>161</width> + <height>111</height> + </rect> + </property> + <property name="text"> + <string><html><head/><body><p><span style=" font-weight:600;">FTNoIR PointTracker Plugin<br/>Version 1.1</span></p><p><span style=" font-weight:600;">by Patrick Ruoff</span></p><p><a href="http://ftnoirpt.sourceforge.net/"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">Manual (external)</span></a></p></body></html></string> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + <widget class="QLabel" name="label_35"> + <property name="geometry"> + <rect> + <x>200</x> + <y>30</y> + <width>141</width> + <height>141</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/Logo_IR.png</pixmap> + </property> + </widget> + </widget> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_5"> + <property name="title"> + <string>Status</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <item> + <layout class="QFormLayout" name="formLayout"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_38"> + <property name="text"> + <string>Camera Info:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="caminfo_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>120</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Extracted Points:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="pointinfo_label"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QPushButton" name="btnApply"> + <property name="text"> + <string>Save</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_6"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="ok_button"> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="text"> + <string>Ok</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancel_button"> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <tabstops> + <tabstop>tabWidget</tabstop> + <tabstop>reset_spin</tabstop> + <tabstop>chkEnableRoll</tabstop> + <tabstop>chkEnablePitch</tabstop> + <tabstop>chkEnableYaw</tabstop> + <tabstop>chkEnableX</tabstop> + <tabstop>chkEnableY</tabstop> + <tabstop>chkEnableZ</tabstop> + <tabstop>camdevice_combo</tabstop> + <tabstop>res_x_spin</tabstop> + <tabstop>res_y_spin</tabstop> + <tabstop>fps_spin</tabstop> + <tabstop>f_dspin</tabstop> + <tabstop>camroll_combo</tabstop> + <tabstop>campitch_spin</tabstop> + <tabstop>camyaw_spin</tabstop> + <tabstop>threshold_slider</tabstop> + <tabstop>mindiam_spin</tabstop> + <tabstop>maxdiam_spin</tabstop> + <tabstop>model_tabs</tabstop> + <tabstop>clip_tlength_spin</tabstop> + <tabstop>clip_theight_spin</tabstop> + <tabstop>clip_bheight_spin</tabstop> + <tabstop>clip_blength_spin</tabstop> + <tabstop>cap_length_spin</tabstop> + <tabstop>cap_height_spin</tabstop> + <tabstop>cap_width_spin</tabstop> + <tabstop>m1x_spin</tabstop> + <tabstop>m1y_spin</tabstop> + <tabstop>m1z_spin</tabstop> + <tabstop>m2x_spin</tabstop> + <tabstop>m2y_spin</tabstop> + <tabstop>m2z_spin</tabstop> + <tabstop>tx_spin</tabstop> + <tabstop>ty_spin</tabstop> + <tabstop>tz_spin</tabstop> + <tabstop>tcalib_button</tabstop> + <tabstop>ok_button</tabstop> + <tabstop>cancel_button</tabstop> + </tabstops> + <resources> + <include location="ftnoir_tracker_pt.qrc"/> + </resources> + <connections> + <connection> + <sender>dynpose_check</sender> + <signal>toggled(bool)</signal> + <receiver>reset_spin</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>172</x> + <y>110</y> + </hint> + <hint type="destinationlabel"> + <x>351</x> + <y>112</y> + </hint> + </hints> + </connection> + </connections> + <slots> + <slot>startEngineClicked()</slot> + <slot>stopEngineClicked()</slot> + <slot>cameraSettingsClicked()</slot> + </slots> +</ui> diff --git a/ftnoir_tracker_pt/Resources/Logo_IR.png b/ftnoir_tracker_pt/Resources/Logo_IR.png new file mode 100644 index 00000000..95032a25 Binary files /dev/null and b/ftnoir_tracker_pt/Resources/Logo_IR.png differ diff --git a/ftnoir_tracker_pt/Resources/cap_front.png b/ftnoir_tracker_pt/Resources/cap_front.png new file mode 100644 index 00000000..14207a67 Binary files /dev/null and b/ftnoir_tracker_pt/Resources/cap_front.png differ diff --git a/ftnoir_tracker_pt/Resources/cap_side.png b/ftnoir_tracker_pt/Resources/cap_side.png new file mode 100644 index 00000000..5ad4ee65 Binary files /dev/null and b/ftnoir_tracker_pt/Resources/cap_side.png differ diff --git a/ftnoir_tracker_pt/Resources/clip_front.png b/ftnoir_tracker_pt/Resources/clip_front.png new file mode 100644 index 00000000..04880138 Binary files /dev/null and b/ftnoir_tracker_pt/Resources/clip_front.png differ diff --git a/ftnoir_tracker_pt/Resources/clip_side.png b/ftnoir_tracker_pt/Resources/clip_side.png new file mode 100644 index 00000000..72667ac7 Binary files /dev/null and b/ftnoir_tracker_pt/Resources/clip_side.png differ diff --git a/ftnoir_tracker_pt/boost-compat.h b/ftnoir_tracker_pt/boost-compat.h new file mode 100644 index 00000000..612f2c4d --- /dev/null +++ b/ftnoir_tracker_pt/boost-compat.h @@ -0,0 +1,5 @@ +#pragma once +#include <memory> +namespace boost { + using std::shared_ptr; +} diff --git a/ftnoir_tracker_pt/camera.cpp b/ftnoir_tracker_pt/camera.cpp new file mode 100644 index 00000000..754533c5 --- /dev/null +++ b/ftnoir_tracker_pt/camera.cpp @@ -0,0 +1,351 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + + #if defined(OPENTRACK_API) && defined(_WIN32) +#include <windows.h> +#include <dshow.h> +#endif + +#include "camera.h" +#include <string> +#include <QDebug> + +using namespace cv; + +#if defined(OPENTRACK_API) && (defined(__unix) || defined(__linux) || defined(__APPLE__)) +#include <unistd.h> +#endif + +#ifdef OPENTRACK_API +void get_camera_device_names(std::vector<std::string>& device_names) { +# if defined(_WIN32) + // Create the System Device Enumerator. + HRESULT hr; + ICreateDevEnum *pSysDevEnum = NULL; + hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **)&pSysDevEnum); + if (FAILED(hr)) + { + return; + } + // Obtain a class enumerator for the video compressor category. + IEnumMoniker *pEnumCat = NULL; + hr = pSysDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEnumCat, 0); + + if (hr == S_OK) { + // Enumerate the monikers. + IMoniker *pMoniker = NULL; + ULONG cFetched; + while (pEnumCat->Next(1, &pMoniker, &cFetched) == S_OK) { + IPropertyBag *pPropBag; + hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pPropBag); + if (SUCCEEDED(hr)) { + // To retrieve the filter's friendly name, do the following: + VARIANT varName; + VariantInit(&varName); + hr = pPropBag->Read(L"FriendlyName", &varName, 0); + if (SUCCEEDED(hr)) + { + auto wstr = std::wstring(varName.bstrVal); + auto str = std::string(wstr.begin(), wstr.end()); + device_names.push_back(str); + } + VariantClear(&varName); + + ////// To create an instance of the filter, do the following: + ////IBaseFilter *pFilter; + ////hr = pMoniker->BindToObject(NULL, NULL, IID_IBaseFilter, + //// (void**)&pFilter); + // Now add the filter to the graph. + //Remember to release pFilter later. + pPropBag->Release(); + } + pMoniker->Release(); + } + pEnumCat->Release(); + } + pSysDevEnum->Release(); +# else + for (int i = 0; i < 16; i++) { + char buf[128]; + sprintf(buf, "/dev/video%d", i); + if (access(buf, R_OK | W_OK) == 0) { + device_names.push_back(std::string(buf)); + } + } +# endif +} +#else +// ---------------------------------------------------------------------------- +void get_camera_device_names(std::vector<std::string>& device_names) +{ + videoInput VI; + VI.listDevices(); + std::string device_name; + for(int index = 0; ; ++index) { + device_name = VI.getDeviceName(index); + if (device_name.empty()) break; + device_names.push_back(device_name); + } +} +#endif + +// ---------------------------------------------------------------------------- +void Camera::set_device_index(int index) +{ + if (desired_index != index) + { + desired_index = index; + _set_device_index(); + + // reset fps + dt_valid = 0; + dt_mean = 0; + active_index = index; + } +} + +void Camera::set_f(float f) +{ + if (cam_desired.f != f) + { + cam_desired.f = f; + _set_f(); + } +} +void Camera::set_fps(int fps) +{ + if (cam_desired.fps != fps) + { + cam_desired.fps = fps; + _set_fps(); + } +} + +void Camera::set_res(int x_res, int y_res) +{ + if (cam_desired.res_x != x_res || cam_desired.res_y != y_res) + { + cam_desired.res_x = x_res; + cam_desired.res_y = y_res; + _set_res(); + _set_fps(); + } +} + +bool Camera::get_frame(float dt, cv::Mat* frame) +{ + bool new_frame = _get_frame(frame); + // measure fps of valid frames + const float dt_smoothing_const = 0.9; + dt_valid += dt; + if (new_frame) + { + dt_mean = dt_smoothing_const * dt_mean + (1.0 - dt_smoothing_const) * dt_valid; + cam_info.fps = 1.0 / dt_mean; + dt_valid = 0; + } + return new_frame; +} + +// ---------------------------------------------------------------------------- +#ifdef OPENTRACK_API +void CVCamera::start() +{ + cap = new VideoCapture(desired_index); + // extract camera info + if (cap->isOpened()) + { + active = true; + active_index = desired_index; + cam_info.res_x = cap->get(CV_CAP_PROP_FRAME_WIDTH); + cam_info.res_y = cap->get(CV_CAP_PROP_FRAME_HEIGHT); + } else { + delete cap; + cap = nullptr; + } +} + +void CVCamera::stop() +{ + if (cap) + { + cap->release(); + delete cap; + } + active = false; +} + +bool CVCamera::_get_frame(Mat* frame) +{ + if (cap && cap->isOpened()) + { + Mat img; + /* + * XXX some Windows webcams fail to decode first + * frames and then some every once in a while + * -sh + */ + for (int i = 0; i < 100 && !cap->read(img); i++) + ;; + + if (img.empty()) + return false; + + *frame = img; + return true; + } + return false; +} + +void CVCamera::_set_index() +{ + if (active) restart(); +} + +void CVCamera::_set_f() +{ + cam_info.f = cam_desired.f; +} + +void CVCamera::_set_fps() +{ + if (cap) cap->set(CV_CAP_PROP_FPS, cam_desired.fps); +} + +void CVCamera::_set_res() +{ + if (cap) + { + cap->set(CV_CAP_PROP_FRAME_WIDTH, cam_desired.res_x); + cap->set(CV_CAP_PROP_FRAME_HEIGHT, cam_desired.res_y); + cam_info.res_x = cap->get(CV_CAP_PROP_FRAME_WIDTH); + cam_info.res_y = cap->get(CV_CAP_PROP_FRAME_HEIGHT); + } +} +void CVCamera::_set_device_index() +{ + if (cap) + { + cap->release(); + delete cap; + } + cap = new VideoCapture(desired_index); +} + +#else +// ---------------------------------------------------------------------------- +VICamera::VICamera() : frame_buffer(NULL) +{ + VI.listDevices(); +} + +void VICamera::start() +{ + if (desired_index >= 0) + { + if (cam_desired.res_x == 0 || cam_desired.res_y == 0) + VI.setupDevice(desired_index); + else + VI.setupDevice(desired_index, cam_desired.res_x, cam_desired.res_y); + + active = true; + active_index = desired_index; + + cam_info.res_x = VI.getWidth(active_index); + cam_info.res_y = VI.getHeight(active_index); + new_frame = cv::Mat(cam_info.res_y, cam_info.res_x, CV_8UC3); + // If matrix is not continuous we have to copy manually via frame_buffer + if (!new_frame.isContinuous()) { + unsigned int size = VI.getSize(active_index); + frame_buffer = new unsigned char[size]; + } + } +} + +void VICamera::stop() +{ + if (active) + { + VI.stopDevice(active_index); + } + if (frame_buffer) + { + delete[] frame_buffer; + frame_buffer = NULL; + } + active = false; +} + +bool VICamera::_get_frame(Mat* frame) +{ + if (active && VI.isFrameNew(active_index)) + { + if (new_frame.isContinuous()) + { + VI.getPixels(active_index, new_frame.data, false, true); + } + else + { + // If matrix is not continuous we have to copy manually via frame_buffer + VI.getPixels(active_index, frame_buffer, false, true); + new_frame = cv::Mat(cam_info.res_y, cam_info.res_x, CV_8UC3, frame_buffer).clone(); + } + *frame = new_frame; + return true; + } + return false; +} + +void VICamera::_set_device_index() +{ + if (active) restart(); +} + +void VICamera::_set_f() +{ + cam_info.f = cam_desired.f; +} + +void VICamera::_set_fps() +{ + bool was_active = active; + if (active) stop(); + VI.setIdealFramerate(desired_index, cam_desired.fps); + if (was_active) start(); +} + +void VICamera::_set_res() +{ + if (active) restart(); +} +#endif + +// ---------------------------------------------------------------------------- +Mat FrameRotation::rotate_frame(Mat frame) +{ + switch (rotation) + { + case CLOCKWISE: + { + Mat dst; + transpose(frame, dst); + flip(dst, dst, 1); + return dst; + } + + case COUNTER_CLOCKWISE: + { + Mat dst; + transpose(frame, dst); + flip(dst, dst, 0); + return dst; + } + + default: + return frame; + } +} diff --git a/ftnoir_tracker_pt/camera.h b/ftnoir_tracker_pt/camera.h new file mode 100644 index 00000000..ea68c387 --- /dev/null +++ b/ftnoir_tracker_pt/camera.h @@ -0,0 +1,145 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#ifndef CAMERA_H +#define CAMERA_H + +#include <opencv2/opencv.hpp> +#ifndef OPENTRACK_API +# include <boost/shared_ptr.hpp> +#else +# include "FTNoIR_Tracker_PT/boost-compat.h" +# include <opencv2/highgui/highgui.hpp> +# include <opencv2/highgui/highgui_c.h> +#endif +#include <string> + +// ---------------------------------------------------------------------------- +void get_camera_device_names(std::vector<std::string>& device_names); + + +// ---------------------------------------------------------------------------- +struct CamInfo +{ + CamInfo() : res_x(0), res_y(0), fps(0), f(1) {} + + int res_x; + int res_y; + int fps; + float f; // (focal length) / (sensor width) +}; + +// ---------------------------------------------------------------------------- +// Base class for cameras, calculates the frame rate +class Camera +{ +public: + Camera() : dt_valid(0), dt_mean(0), desired_index(0), active_index(-1), active(false) {} + virtual ~Camera() {} + + // start/stop capturing + virtual void start() = 0; + virtual void stop() = 0; + void restart() { stop(); start(); } + + // calls corresponding template methods and reinitializes frame rate calculation + void set_device_index(int index); + void set_f(float f); + void set_fps(int fps); + void set_res(int x_res, int y_res); + + // gets a frame from the camera, dt: time since last call in seconds + bool get_frame(float dt, cv::Mat* frame); + + // WARNING: returned references are valid as long as object + const CamInfo& get_info() const { return cam_info; } + const CamInfo& get_desired() const { return cam_desired; } + +protected: + // get a frame from the camera + virtual bool _get_frame(cv::Mat* frame) = 0; + + // update the camera using cam_desired, write res and f to cam_info if successful + virtual void _set_device_index() = 0; + virtual void _set_f() = 0; + virtual void _set_fps() = 0; + virtual void _set_res() = 0; + + float dt_valid; + float dt_mean; + int desired_index; + int active_index; + bool active; + CamInfo cam_info; + CamInfo cam_desired; +}; + + +// ---------------------------------------------------------------------------- +// camera based on OpenCV's videoCapture +#ifdef OPENTRACK_API +class CVCamera : public Camera +{ +public: + CVCamera() : cap(NULL) {} + ~CVCamera() { stop(); } + + virtual void start(); + virtual void stop(); + +protected: + virtual bool _get_frame(cv::Mat* frame); + virtual void _set_index(); + virtual void _set_f(); + virtual void _set_fps(); + virtual void _set_res(); + virtual void _set_device_index(); + + cv::VideoCapture* cap; +}; +#else +// ---------------------------------------------------------------------------- +// Camera based on the videoInput library +class VICamera : public Camera +{ +public: + VICamera(); + ~VICamera() { stop(); } + + virtual void start(); + virtual void stop(); + +protected: + virtual bool _get_frame(cv::Mat* frame); + virtual void _set_device_index(); + virtual void _set_f(); + virtual void _set_fps(); + virtual void _set_res(); + + videoInput VI; + cv::Mat new_frame; + unsigned char* frame_buffer; +}; +#endif + +enum RotationType +{ + CLOCKWISE = 0, + ZERO = 1, + COUNTER_CLOCKWISE = 2 +}; + +// ---------------------------------------------------------------------------- +class FrameRotation +{ +public: + RotationType rotation; + + cv::Mat rotate_frame(cv::Mat frame); +}; + +#endif //CAMERA_H diff --git a/ftnoir_tracker_pt/doc/index.htm b/ftnoir_tracker_pt/doc/index.htm new file mode 100644 index 00000000..87b7356f --- /dev/null +++ b/ftnoir_tracker_pt/doc/index.htm @@ -0,0 +1,262 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + +<head> + <title>FTNoIR PointTracker Help</title> + + <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> + + <meta name="author" + content="Patrick Ruoff (C14)"/> + <meta name="keywords" + content="facetracknoir infrared point model tracker plugin"/> + <meta name="description" + content="Pointtracker plugin for FaceTrackNoIR"/> + + <link rel="shortcut icon" href="ptrack.ico" type="image/vnd.microsoft.icon" /> + <link rel="stylesheet" type="text/css" href="style.css" /> +</head> + +<body> +<div id="navbar"> +<ul class="navbar"> +<li class="navbar"><a class="navbar" href="#about">About</a></li> +<li class="navbar"><a class="navbar" href="#settings">Settings</a></li> +<li class="navbar"><a class="navbar" href="#setup">Filter Setup</a></li> +<li class="navbar"><a class="navbar" href="#support">Support</a></li> +<li class="navbar"><a class="navbar" href="#changelog">ChangeLog</a></li> +<li class="navbar"><a class="navbar" href="#build_instructions">Build Instructions</a></li> +</ul> +</div> + +<div id="content"> +<div style="text-align:center"><h1>FaceTrackNoIR PointTracker Plugin</h1><img src="logo.png" alt="PointTracker Plugin Logo" /></div> + +<a class="nav" id="about"></a> +<h2>About</h2> +<div class="indent"> +<p> +PointTracker is a plugin for the free head tracking software <a href="http://facetracknoir.sourceforge.net">FaceTrackNoIR</a> +which introduces the capability to track a (typically IR-) point model comprising 3 bright points to FaceTrackNoIR, +much like the popular free tracking software <a href="http://www.free-track.net/">Freetrack</a> does.<br/> +It was created as a stable modular alternative to Freetrack, which has some stability issues with newer systems and seems to be no longer actively developped. +</p> +</div> + +<a class="nav" id="settings"></a> +<h2>Settings</h2> +<div class="indent"> +<p> +This section desribes the various settings of the PointTracker plugin in detail. +</p> + +<img src="settings1.png" alt="Settings Pane 1"/> +<dl> +<dt>Show VideoWidget</dt><dd>Whether the video widget is updated or not. It may save some performance to turn this off when not needed</dd> +<dt>Sleep time</dt><dd>Time the tracking thread sleeps after each processed image. It's inverse should be below the framefrate you want to achieve. +(check the framerate in the status region when tracker is active, in case the sleep time is too high, the framerate will decrease). +Low values will result in more CPU-load.</dd> +<dt>Dynamic Pose Resolution</dt><dd>Whether the point correspondence and pose ambiquity is resolved using a more sophisticated dynamic algorithm (constant velocity prediction) or a simple static resolution. +Dynamic pose resolution can capture more extreme poses but may occasionally get stuck in a wrong pose estimates so that a reset of the internal state becomes neccessary.</dd> +<dt>Auto-reset time</dt><dd>If no valid tracking result can be found when using dynamic pose resolution, the tracker will automatically reset its internal state (used for resolving the pose ambiguity and point correspondence) +and return to a fail-safe initialization phase that assumes a neutral pose after this time. +Decrease this time, if you get stuck in a wrong pose too often.</dd> +<dt>Reset</dt><dd>Manually reset the trackers internal state used for dynamic pose resolution and return to a fail-safe initialization phase that assumes a neutral pose. +You may use this in case you get stuck in a wrong pose.</dd> +<dt>Enable Axis ...</dt><dd>Which axis to use for FTNoIR.</dd> +</dl> + +<img src="settings2.png" alt="Settings Pane 2"/> +<dl> +<dt>Device</dt><dd>The camera used for tracking.</dd> +<dt>Resolution</dt><dd>The desired capture resolution. If your camera does not support the entered resolution the true output resolution may be different or even invalid. +You may check the true capture resolution in the status area while the tracker is running. A higher resolution results in more accurate point positions and will increase the +stability of the tracking result, as long as the signal/noise ratio is sufficiently high.</dd> +<dt>FPS</dt><dd>The desired capture framerate. Again, if your camera does not support the entered framerate, the true caputre framerate may be different or invalid. +You may check the true processing framerate in the status area while the tracker is running.</dd> +<dt>F/W</dt><dd>The focal length of the camera divided by the sensor width (of course in the same units). +In case you don't have access to your camera's specifications, you can measure this yourself by placing a plane object of known width (for example a piece of cardboard) in front of the camera until it fills the whole image width. +Then measure the distance between the object and the camera and divide by the object width.</dd> +<dt>VideoWidget</dt><dd>Shows a resizable stand-alone video widget that shows the same content as the integrated video widget in FTNoIR. +Update rate is only 10 fps and may lag behind a bit. Mainly useful during calibration of the point extraction. Same as for the integrated wiget, to save resources, this widget should only be shown when needed.</dd> +<dt>Roll Pitch Yaw...</dt><dd>The orientation of the camera relative to the reference frame. +If these angles are setup properly, the direction of translations may not be correct. +Roll is treated in a special way since it is implemented as a frame rotation by +/- 90 deg that is transparent to the rest of the processing pipeline. +</dd> +<dt>Threshold</dt><dd>The threshold for point recognition. Areas above the threshold are shown in blue in the VideoWidget. +Since point accuracy is best if the points are as big as possible in pixels, the theshold should be chosen as low as possible (stop before the contour of the points becomes "noisy"). +If small reflections are being falsely classified as points, increasing the minimum point diameter (see below) may help.</dd> +<dt>Min Diameter</dt><dd>Minimum diameter of blobs to be classified as a pointmodel-point.</dd> +<dt>Max Diameter</dt><dd>Maximum diameter of blobs to be classified as a pointmodel-point.</dd> +<dt>Status</dt><dd>The tracker's status is shown in this area while the tracker is running. +The FPS shown here correspond to the framerate of the whole tracker processing chain and may be lower than what your camera is able to provide, when<br/> +1. The processing gets not enough CPU time<br/> +2. The sleep time of the tracking thread is set too high<br/></dd> +</dl> + +<img src="settings3.png" alt="Settings Pane 3"/> +<dl> +<dt>Model Selection and Dimensions ...</dt><dd> +First select your model type (point, clip, custom), then enter the dimensions of your model in milimeters here.<br/> +For the custom setting, the coordinates of the two remaining model points have to be entered (reference point M0 is at (0,0,0)) in a pose where the model roughly faces the camera. +For orientation, the coordinates for the standard Freetrack clip are (0,40,-30), (0,-70,-80) and the ones for the cap (40,-60,-100), (-40,-60,-100).<br/> +When using a custom point-model configuration, the following restrictions should be observed:<br/> +The plane in which the 3 points lie should never be parallel to the image plane, M0-M1 and M0-M2 should be roughly perpendicular.</dd> + +<dt>Model Position</dt><dd>The vector from the model to the center of the head in the model frame. Can be calibrated automatically.</dd> +<dt>Calibrate</dt><dd>In order to automatically calibrate the model-head offset, do the following:<br/>Press the Calibrate button, then look around while not moving your shoulder. (i.e. only rotation, no translation). +Do not stay in one pose for too long. The current translation estimate will be updated in real time. As soon as the values stabilized sufficiently, press the Calibrate button again to stop the calibration process.</dd> +</dl> +</div> + +<a class="nav" id="setup"></a> +<h2>Filter Setup</h2> +<div class="indent"> +<p> +This section desribes how the FTNoIR filter work and what the recommended settings for PointTracker are. +</p> +<p> +Filtering is always a tradeoff between stability, accuracy and responsiveness. +</p> +<p> +The <q>Smoothing</q> filter in FTNoIR is just a simple average over the last n samples. +Since this filter produces input lag no matter how fast the head-movements are, it is recommended to turn it off by setting samples to 1. +</p> +<p> +In the filter tab, it is recommended to select <q>Accela Filter Mk2</q>. +Accela is a non-linear filter that works as follows:<br/> +It looks at the difference between the new raw values <i>new_val</i> from the tracker and the last filtered value <i>old_val</i> +and maps this difference via the customizable response function <i>f</i> via:<br/> +</p> +<p style="text-align: center"> +<i>new_val = old_val + f(new_val - old_val) / reduction_factor</i> +</p> +<p> +So by setting <i>f(x) = reduction_factor * x</i>, one will get no filtering at all.<br/> +If you set lower values for small x, small deviations (usually noise) will get dampened. +This results in a dynamic dead-zone around the current position. +</p> +<p> +The last two points are used by accela to extrapolate for large deviations. +So in order to get a fast unfiltered response for large deviations, the line connecting the last two points should have a slope >= <i>reduction_factor</i>. +</p> +<p> +More aggressive accela settings than the default FTNoIR accela settings are recommended in order to decrease the filtering lag and fully use the potential of point tracking.<br/> +My current settings are: +</p> +<pre class="indent"><code> +[Accela] +Reduction=20 + +[Curves-Accela-Scaling-Rotation] +point-count=4 +point-0-x=0.1 +point-0-y=0 +point-1-x=1.43 +point-1-y=2.45 +point-2-x=2.0 +point-2-y=5.44 +point-3-x=2.06 +point-3-y=6 +</code></pre> +<p> +The curve is not too different from the standard one (except that I like a small dynamic dead zone for steady aiming, that's why the curve has a slope of 0 at the beginning).<br/> +However, the reduction factor is decreased to a value of 20 (compared to the standard value of 100). This implies that each value of the curve is effectively 5 times higher than in standard FTNoIR (see formula above), which means higher responsiveness but can also lead to jitter/shaking.<br/> +Keep in mind that there are no <q>best filter settings</q>. Since filtering is always a compromise it's a matter of personal taste and +playing around with the filter settings is highly recommended. +</p> +</div> + +<a class="nav" id="support"></a> +<h2>Support</h2> +<div class="indent"> +<p> +For questions/feedback about the plugin, post to the <a href="https://sourceforge.net/projects/facetracknoir/forums">FTNoIR-Forum</a>.<br/> +In case you like this plugin and would like to support the author, you may consider making a donation. +</p> +<div style="text-align:center"> +<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> +<fieldset class="blind"> +<input type="hidden" name="cmd" value="_s-xclick"/> +<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHJwYJKoZIhvcNAQcEoIIHGDCCBxQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYCa+2zPZ+6vFPqveJsBIjFLpy54m7tl0AdojRr/K5qa3QJDyRBhGwGAP2jRihkmZFE2oKlfLpkz7nrwOQY/wFEPkggO+cABxUfjcQVpIupHEtwdV0hMklLs0RmACJy802yfi1yTiCpJ4hvWN+VfUI3gOiZ9uRZ3L4iGXES7xtqJbDELMAkGBSsOAwIaBQAwgaQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIeopHzcJ8XBOAgYCYJFyTejSplEOwF21aQ01qQOads9Z+RUVI+hlvM/pHTjimaZPKSis3poAeqv6wKn40DpLNxDnmcT+Y9KXhrV+Gy4GZCPaeNzq2vquQ2ZVN0fTr84QVmKqPkjMBGmJAHSLCcZswUddemJgoD1uyvS0kNbchvxw7gDXJnJeBRNyXXKCCA4cwggODMIIC7KADAgECAgEAMA0GCSqGSIb3DQEBBQUAMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbTAeFw0wNDAyMTMxMDEzMTVaFw0zNTAyMTMxMDEzMTVaMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwUdO3fxEzEtcnI7ZKZL412XvZPugoni7i7D7prCe0AtaHTc97CYgm7NsAtJyxNLixmhLV8pyIEaiHXWAh8fPKW+R017+EmXrr9EaquPmsVvTywAAE1PMNOKqo2kl4Gxiz9zZqIajOm1fZGWcGS0f5JQ2kBqNbvbg2/Za+GJ/qwUCAwEAAaOB7jCB6zAdBgNVHQ4EFgQUlp98u8ZvF71ZP1LXChvsENZklGswgbsGA1UdIwSBszCBsIAUlp98u8ZvF71ZP1LXChvsENZklGuhgZSkgZEwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTEyMDkyMzA5NTcwOFowIwYJKoZIhvcNAQkEMRYEFG/qW7uo4R4m5uFYegcZaZsTPAcUMA0GCSqGSIb3DQEBAQUABIGAGygLfrR6IQbG2xZY2OrwKkfmRwiwtnXpLBnSbnWb7XxUOMhvM6962RiKBQBGP0+XYw0S9yu8ZHx7tqz/3bcMfGjtz7PwixYx6Rm8Z29ja78aUy5FmU7fc9yAWFxLHptSliK1dJBPxdQa9J2YSDvPQPAj+AdB9sJvqJoMoxTFGM4=-----END PKCS7----- +"/> +<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!"/> +<img alt="" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1"/> +</fieldset> +</form> +</div> +</div> + +<a class="nav" id="changelog"></a> +<h2>ChangeLog</h2> +<div class="indent"> +<h3>1.1</h3> +<ul> +<li>Added camera yaw and roll correction (intended for vertically mounted cameras)</li> +<li>Improved point extraction algorithm, thanks to Michael Welter</li> +<li>UI improvements: Select camera by device name, different VideoWidget architecture</li> +<li>Bugfixes: Removed 99 FPS limitation</li> +</ul> + +<h3>1.0</h3> +<ul> +<li>Added camera pitch correction</li> +<li>Better communication with FTNoIR: output axis configuration, status report</li> +</ul> + +<h3>1.0 beta</h3> +<ul> +<li>Switchted to videoInput library for capture. Desired capture resolution and fps can now be customized</li> +<li>Introduced dynamic point-correspondence and POSIT-ambiguity resolution, which allows for the reconstruction of more extreme poses</li> +<li>More convenient freetrack-like model dimension GUI</li> +<li>Bugfixes: VideoWidget skipping frames, Timer resolution too low for accurate FPS measurement</li> +</ul> +</div> + +<a class="nav" id="build_instructions"></a> +<h2>Build Instructions</h2> +<div class="indent"> +<p> +This section describes what you need to do in order to build PointTracker yourself.<br/> +You can find the sources at the <a href="https://sourceforge.net/projects/ftnoirpt/">project site</a> +or as part of the <a href="https://sourceforge.net/projects/facetracknoir/">FTNoIR sources</a>. +</p> +<p> The project was created with Visual Studio. </p> + +<h3>Dependencies</h3> +<ul> +<li>Qt 4.8.2 library</li> +<li>Qt plugin for Visual studio</li> +<li>OpenCV 2.4 prebuilt for Windows</li> +<li>Boost 1.47</li> +</ul> + +<h3>Details</h3> +<div class="indent"> +<h4>Common</h4> +<ul> +<li>setup environment variable "QTDIR" (example value "D:\Devel\Libs\Qt\4.8.2")</li> +<li>add "%QTDIR%\bin" to PATH</li> +<li>setup environment variable "BOOST_DIR" (example value "D:\Devel\Libs\boost_1_47_0")</li> +<li>setup environment variable "OPENCV_DIR" (example value "D:\Devel\Libs\opencv\build")</li> +</ul> +<h4>Debug</h4> +<p>opencv linked dynamically:</p> +<ul> +<li>add "%OPENCV_DIR%\x86\vc9\bin" to PATH</li> +</ul> +<p>(in case of different Visual studio, change PATH and linker dependencies accordingly)</p> +<h4>Release</h4> +<p>opencv linked statically:</p> +<ul> +<li>custom build a statically linked version of opencv with the buil-option BUILD_WITH_STATIC_CRT set to OFF!</li> +<li>copy resulting libaries to "%OPENCV_DIR%\x86\vc9\static_lib"</li> +</ul> +<p>(in case of different Visual studio, change PATH and linker dependencies accordingly)</p> +</div> +</div> + +</div> + +</body> +</html> \ No newline at end of file diff --git a/ftnoir_tracker_pt/doc/logo.png b/ftnoir_tracker_pt/doc/logo.png new file mode 100644 index 00000000..95032a25 Binary files /dev/null and b/ftnoir_tracker_pt/doc/logo.png differ diff --git a/ftnoir_tracker_pt/doc/ptrack.ico b/ftnoir_tracker_pt/doc/ptrack.ico new file mode 100644 index 00000000..c4b2aedc Binary files /dev/null and b/ftnoir_tracker_pt/doc/ptrack.ico differ diff --git a/ftnoir_tracker_pt/doc/settings1.png b/ftnoir_tracker_pt/doc/settings1.png new file mode 100644 index 00000000..35b84c5c Binary files /dev/null and b/ftnoir_tracker_pt/doc/settings1.png differ diff --git a/ftnoir_tracker_pt/doc/settings2.png b/ftnoir_tracker_pt/doc/settings2.png new file mode 100644 index 00000000..c6cfd1f3 Binary files /dev/null and b/ftnoir_tracker_pt/doc/settings2.png differ diff --git a/ftnoir_tracker_pt/doc/settings3.png b/ftnoir_tracker_pt/doc/settings3.png new file mode 100644 index 00000000..5922403d Binary files /dev/null and b/ftnoir_tracker_pt/doc/settings3.png differ diff --git a/ftnoir_tracker_pt/doc/style.css b/ftnoir_tracker_pt/doc/style.css new file mode 100644 index 00000000..a8d3e333 --- /dev/null +++ b/ftnoir_tracker_pt/doc/style.css @@ -0,0 +1,131 @@ +body { + width: 1000px; + font-size: 13px; + color: #000000; + padding: 0; + margin: 0 auto; + background: #444444; + font-family: verdana,arial; +} + +table { + border-width: 3px; + border-color: #0000FF; + border-style: ridge; + margin-top: 5px; + background-color: #E0E0FF; +} + +table.blind { + border: none; + background-color: #E6E6E6; +} + +fieldset.blind { + border: none; +} + +h1 { font-size: 160%; } +h2 { font-size: 140%; } +h3 { font-size: 115%; } + +.indent { + margin-left: 25px; +} + +p +{ + margin-left: 10px; +} + +li +{ + margin: 10px; +} + + +dl +{ + /*width: 80%;*/ + border-bottom: 1px solid #999; +} + +dt +{ + padding-top: 5px; + font-weight: bold; + border-top: 1px solid #999; +} + +dd +{ + padding: 5px; +} + + +hr { + color: #688938; +} + +a:link, a:visited { + color: #0000BF; +} +a:hover { + color: #0000FF; +} + +a.nav { + position: relative; + top: -30px; + display: block; + visibility: hidden; +} + +#navbar { + width: 1000px; + height: 30px; + background-color:#1a1a1b; + position: fixed; + margin: 0 auto; + padding: 0; +} + +#navbar ul +{ + list-style-type: none; + margin: 0 auto; + padding: 0; + overflow: hidden; +} + +#navbar li +{ + margin: 0 auto; + padding: 5px; + float:left; +} + +#navbar a:link,a:visited +{ + display:block; + width:150px; + font-weight:bold; + color:#e85d02; + text-align:center; + /*padding:4px;*/ + text-decoration:none; + /*text-transform:uppercase;*/ +} + +#navbar a:hover,a:active +{ + color:#ffffff; +} + +#content { + background-color:#ffffff; + padding: 15px; + padding-top: 40px; + padding-right: 40px; + margin: 0 auto; +} diff --git a/ftnoir_tracker_pt/frame_observer.cpp b/ftnoir_tracker_pt/frame_observer.cpp new file mode 100644 index 00000000..281f3d57 --- /dev/null +++ b/ftnoir_tracker_pt/frame_observer.cpp @@ -0,0 +1,18 @@ +/* Copyright (c) 2013 Patrick Ruoff + * + * 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 "frame_observer.h" + +//----------------------------------------------------------------------------- +FrameProvider::~FrameProvider() +{ + QMutexLocker lock(&observer_mutex); + for (std::set<FrameObserver*>::iterator iter=frame_observers.begin(); iter!=frame_observers.end(); ++iter) + { + (*iter)->on_frame_provider_destroy(); + } +} diff --git a/ftnoir_tracker_pt/frame_observer.h b/ftnoir_tracker_pt/frame_observer.h new file mode 100644 index 00000000..585a6ee7 --- /dev/null +++ b/ftnoir_tracker_pt/frame_observer.h @@ -0,0 +1,76 @@ +/* Copyright (c) 2013 Patrick Ruoff + * + * 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. + */ + +#ifndef FRAME_OBSERVER_H +#define FRAME_OBSERVER_H + +#include <QMutex> +#include <opencv2/opencv.hpp> +#ifndef OPENTRACK_API +# include <boost/shared_ptr.hpp> +#else +# include "FTNoIR_Tracker_PT/boost-compat.h" +#endif +#include <set> + +//----------------------------------------------------------------------------- +// Forward declarations +class FrameObserver; + +//----------------------------------------------------------------------------- +// Provides means to copy frame and point information if it has observers +// Instantiate a FrameObserver to get the information +class FrameProvider +{ + friend class FrameObserver; +public: + ~FrameProvider(); + +protected: + virtual bool get_frame_and_points(cv::Mat& frame, boost::shared_ptr< std::vector<cv::Vec2f> >& points) = 0; + + bool has_observers() const { QMutexLocker lock(&observer_mutex); return !frame_observers.empty(); } + +private: + mutable QMutex observer_mutex; + void add_observer(FrameObserver* obs) { QMutexLocker lock(&observer_mutex); frame_observers.insert(obs); } + void remove_observer(FrameObserver* obs) { QMutexLocker lock(&observer_mutex); frame_observers.erase(obs); } + std::set<FrameObserver*> frame_observers; +}; + +//----------------------------------------------------------------------------- +// Used to get frame and point information from MutexedFrameProvider +// Destroy instance if not interested anymore since a living +// FrameObserver instance causes MutexedFrameProvider to provide the information, +// potentially reducing its performance +class FrameObserver +{ +public: + FrameObserver(FrameProvider* provider) : provider(provider) { + provider->add_observer(this); + } + + ~FrameObserver() { + if (provider) provider->remove_observer(this); + } + + bool get_frame_and_points(cv::Mat& frame, boost::shared_ptr< std::vector<cv::Vec2f> >& points) { + return provider ? provider->get_frame_and_points(frame, points) : false; + } + + void on_frame_provider_destroy() { + provider = NULL; + } + +protected: + FrameProvider* provider; + +private: + FrameObserver(const FrameObserver&); +}; + +#endif //FRAME_OBSERVER_H diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp new file mode 100644 index 00000000..ef72f9a2 --- /dev/null +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -0,0 +1,265 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 "ftnoir_tracker_pt.h" +#include <QHBoxLayout> +#include <cmath> +#include <QDebug> +#include <QFile> +#include <QCoreApplication> + +using namespace std; +using namespace cv; +using namespace boost; + +//#define PT_PERF_LOG //log performance + +const float rad2deg = 180.0/3.14159265; +const float deg2rad = 1.0/rad2deg; + +//----------------------------------------------------------------------------- +Tracker::Tracker() + : mutex(QMutex::Recursive), + commands(0), + video_widget(NULL), + video_frame(NULL), + tracking_valid(false), + new_settings(nullptr) + +{ + qDebug()<<"Tracker::Tracker"; +} + +Tracker::~Tracker() +{ + qDebug()<<"Tracker::~Tracker"; + // terminate tracker thread + set_command(ABORT); + wait(); + s.video_widget = false; + delete video_widget; + video_widget = NULL; + if (video_frame->layout()) delete video_frame->layout(); +} + +void Tracker::set_command(Command command) +{ + //QMutexLocker lock(&mutex); + commands |= command; +} + +void Tracker::reset_command(Command command) +{ + //QMutexLocker lock(&mutex); + commands &= ~command; +} + +void Tracker::run() +{ + qDebug()<<"Tracker:: Thread started"; + +#ifdef PT_PERF_LOG + QFile log_file(QCoreApplication::applicationDirPath() + "/PointTrackerPerformance.txt"); + if (!log_file.open(QIODevice::WriteOnly | QIODevice::Text)) return; + QTextStream log_stream(&log_file); +#endif + + time.start(); + double dt; + bool new_frame; + forever + { + if (commands & ABORT) break; + if (commands & PAUSE) continue; + commands = 0; + apply_inner(); + dt = time.start() / 1000000000.; + + new_frame = camera.get_frame(dt, &frame); + + if (new_frame && !frame.empty()) + { + QMutexLocker lock(&mutex); + + frame = frame_rotation.rotate_frame(frame); + const std::vector<cv::Vec2f>& points = point_extractor.extract_points(frame, dt, true); + for (auto p : points) + { + auto p2 = cv::Point(p[0] * frame.cols + frame.cols/2, -p[1] * frame.cols + frame.rows/2); + cv::Scalar color(0, 255, 0); + cv::line(frame, + cv::Point(p2.x - 20, p2.y), + cv::Point(p2.x + 20, p2.y), + color, + 4); + cv::line(frame, + cv::Point(p2.x, p2.y - 20), + cv::Point(p2.x, p2.y + 20), + color, + 4); + } + tracking_valid = point_tracker.track(points, camera.get_info().f, dt); + video_widget->update_image(frame); + } +#ifdef PT_PERF_LOG + log_stream<<"dt: "<<dt; + if (!frame.empty()) log_stream<<" fps: "<<camera.get_info().fps; + log_stream<<"\n"; +#endif + } + + qDebug()<<"Tracker:: Thread stopping"; +} +void Tracker::apply(settings& s) +{ + // caller guarantees object lifetime + new_settings = &s; +} + +void Tracker::apply_inner() +{ + settings* tmp = new_settings.exchange(nullptr); + if (tmp == nullptr) + return; + auto& s = *tmp; + qDebug()<<"Tracker:: Applying settings"; + camera.set_device_index(s.cam_index); + camera.set_res(s.cam_res_x, s.cam_res_y); + camera.set_fps(s.cam_fps); + camera.set_f(s.cam_f); + frame_rotation.rotation = static_cast<RotationType>(static_cast<int>(s.cam_roll)); + point_extractor.threshold_val = s.threshold; + point_extractor.threshold_secondary_val = s.threshold_secondary; + point_extractor.min_size = s.min_point_size; + point_extractor.max_size = s.max_point_size; + { + cv::Vec3f M01(s.m01_x, s.m01_y, s.m01_z); + cv::Vec3f M02(s.m02_x, s.m02_y, s.m02_z); + point_tracker.point_model = boost::shared_ptr<PointModel>(new PointModel(M01, M02)); + } + point_tracker.dynamic_pose_resolution = s.dyn_pose_res; + point_tracker.dt_reset = s.reset_time / 1000.0; + t_MH = cv::Vec3f(s.t_MH_x, s.t_MH_y, s.t_MH_z); + R_GC = Matx33f( cos(deg2rad*s.cam_yaw), 0, sin(deg2rad*s.cam_yaw), + 0, 1, 0, + -sin(deg2rad*s.cam_yaw), 0, cos(deg2rad*s.cam_yaw)); + R_GC = R_GC * Matx33f( 1, 0, 0, + 0, cos(deg2rad*s.cam_pitch), sin(deg2rad*s.cam_pitch), + 0, -sin(deg2rad*s.cam_pitch), cos(deg2rad*s.cam_pitch)); + + FrameTrafo X_MH(Matx33f::eye(), t_MH); + X_GH_0 = R_GC * X_MH; + + qDebug()<<"Tracker::apply ends"; +} + +void Tracker::reset() +{ + QMutexLocker lock(&mutex); + point_tracker.reset(); +} + +void Tracker::center() +{ + point_tracker.reset(); // we also do a reset here since there is no reset shortkey yet + QMutexLocker lock(&mutex); + FrameTrafo X_CM_0 = point_tracker.get_pose(); + FrameTrafo X_MH(Matx33f::eye(), t_MH); + X_GH_0 = R_GC * X_CM_0 * X_MH; +} + +bool Tracker::get_frame_and_points(cv::Mat& frame_copy, boost::shared_ptr< std::vector<Vec2f> >& points) +{ + QMutexLocker lock(&mutex); + if (frame.empty()) return false; + + // copy the frame and points from the tracker thread + frame_copy = frame.clone(); + points = boost::shared_ptr< vector<Vec2f> >(new vector<Vec2f>(point_extractor.get_points())); + return true; +} + +void Tracker::refreshVideo() +{ + if (video_widget) video_widget->update_frame_and_points(); +} + +void Tracker::StartTracker(QFrame *parent_window) +{ + this->video_frame = parent_window; + video_frame->setAttribute(Qt::WA_NativeWindow); + video_frame->show(); + video_widget = new PTVideoWidget(video_frame, this); + QHBoxLayout* video_layout = new QHBoxLayout(parent_window); + video_layout->setContentsMargins(0, 0, 0, 0); + video_layout->addWidget(video_widget); + video_frame->setLayout(video_layout); + video_widget->resize(video_frame->width(), video_frame->height()); + camera.start(); + apply(s); + start(); + reset_command(PAUSE); +} + +#ifndef OPENTRACK_API +void Tracker::StopTracker(bool exit) +{ + set_command(PAUSE); +} +#endif + +#ifdef OPENTRACK_API +#define THeadPoseData double +#endif + +void Tracker::GetHeadPoseData(THeadPoseData *data) +{ + { + QMutexLocker lock(&mutex); + + if (!tracking_valid) return; + + FrameTrafo X_CM = point_tracker.get_pose(); + FrameTrafo X_MH(Matx33f::eye(), t_MH); + FrameTrafo X_GH = R_GC * X_CM * X_MH; + Matx33f R = X_GH.R * X_GH_0.R.t(); + Vec3f t = X_GH.t - X_GH_0.t; + + // get translation(s) + if (s.bEnableX) data[TX] = t[0] / 10.0; // convert to cm + if (s.bEnableY) data[TY] = t[1] / 10.0; + if (s.bEnableZ) data[TZ] = t[2] / 10.0; + + // translate rotation matrix from opengl (G) to roll-pitch-yaw (E) frame + // -z -> x, y -> z, x -> -y + Matx33f R_EG( 0, 0,-1, + -1, 0, 0, + 0, 1, 0); + R = R_EG * R * R_EG.t(); + + // extract rotation angles + float alpha, beta, gamma; + beta = atan2( -R(2,0), sqrt(R(2,1)*R(2,1) + R(2,2)*R(2,2)) ); + alpha = atan2( R(1,0), R(0,0)); + gamma = atan2( R(2,1), R(2,2)); + + if (s.bEnableYaw) data[Yaw] = rad2deg * alpha; + if (s.bEnablePitch) data[Pitch] = - rad2deg * beta; // FTNoIR expects a minus here + if (s.bEnableRoll) data[Roll] = rad2deg * gamma; + } +} + +//----------------------------------------------------------------------------- +#ifdef OPENTRACK_API +extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +#else +#pragma comment(linker, "/export:GetTracker=_GetTracker@0") +FTNOIR_TRACKER_BASE_EXPORT ITrackerPtr __stdcall GetTracker() +#endif +{ + return new Tracker; +} diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.h b/ftnoir_tracker_pt/ftnoir_tracker_pt.h new file mode 100644 index 00000000..79f16629 --- /dev/null +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.h @@ -0,0 +1,95 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#ifndef FTNOIR_TRACKER_PT_H +#define FTNOIR_TRACKER_PT_H + +#ifdef OPENTRACK_API +# include "ftnoir_tracker_base/ftnoir_tracker_base.h" +# include "facetracknoir/plugin-support.h" +#endif +#include "ftnoir_tracker_pt_settings.h" +#include "frame_observer.h" +#include "camera.h" +#include "point_extractor.h" +#include "point_tracker.h" +#include "pt_video_widget.h" +#include "facetracknoir/timer.hpp" + +#include <QThread> +#include <QMutex> +#include <QMutexLocker> +#include <QTime> +#include <opencv2/opencv.hpp> +#include <atomic> +#ifndef OPENTRACK_API +# include <boost/shared_ptr.hpp> +#else +# include "FTNoIR_Tracker_PT/boost-compat.h" +#endif +#include <vector> + +//----------------------------------------------------------------------------- +// Constantly processes the tracking chain in a separate thread +class Tracker : public ITracker, QThread, public FrameProvider +{ +public: + Tracker(); + virtual ~Tracker(); + virtual void StartTracker(QFrame* parent_window); + virtual void GetHeadPoseData(double* data); + virtual void refreshVideo(); + + void apply(settings& s); + void apply_inner(); + void center(); + void reset(); // reset the trackers internal state variables + void run(); + + void get_pose(FrameTrafo* X_CM) { QMutexLocker lock(&mutex); *X_CM = point_tracker.get_pose(); } + int get_n_points() { QMutexLocker lock(&mutex); return point_extractor.get_points().size(); } + void get_cam_info(CamInfo* info) { QMutexLocker lock(&mutex); *info = camera.get_info(); } + +protected: + // --- MutexedFrameProvider interface --- + virtual bool get_frame_and_points(cv::Mat& frame, boost::shared_ptr< std::vector<cv::Vec2f> >& points); + + // --- thread --- + QMutex mutex; + // thread commands + enum Command { + ABORT = 1<<0, + PAUSE = 1<<1 + }; + void set_command(Command command); + void reset_command(Command command); + volatile int commands; + + CVCamera camera; + FrameRotation frame_rotation; + PointExtractor point_extractor; + PointTracker point_tracker; + + FrameTrafo X_GH_0; // for centering + cv::Vec3f t_MH; // translation from model frame to head frame + cv::Matx33f R_GC; // rotation from opengl reference frame to camera frame + + // --- ui --- + cv::Mat frame; // the output frame for display + + PTVideoWidget* video_widget; + QFrame* video_frame; + bool tracking_valid; + + settings s; + std::atomic<settings*> new_settings; + Timer time; +}; + +#undef VideoWidget + +#endif // FTNOIR_TRACKER_PT_H diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.qrc b/ftnoir_tracker_pt/ftnoir_tracker_pt.qrc new file mode 100644 index 00000000..a8f9a1af --- /dev/null +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.qrc @@ -0,0 +1,9 @@ +<RCC> + <qresource prefix="/"> + <file>Resources/cap_front.png</file> + <file>Resources/cap_side.png</file> + <file>Resources/clip_front.png</file> + <file>Resources/clip_side.png</file> + <file>Resources/Logo_IR.png</file> + </qresource> +</RCC> diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp new file mode 100644 index 00000000..c103b78c --- /dev/null +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp @@ -0,0 +1,321 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 "ftnoir_tracker_pt_dialog.h" + +#include <QMessageBox> +#include <QDebug> +#include <opencv2/opencv.hpp> +#ifndef OPENTRACK_API +# include <boost/shared_ptr.hpp> +#else +# include "FTNoIR_Tracker_PT/boost-compat.h" +#endif +#include <vector> + +using namespace std; + +//----------------------------------------------------------------------------- +TrackerDialog::TrackerDialog() + : tracker(NULL), + video_widget_dialog(NULL), + timer(this), + trans_calib_running(false) +{ + qDebug()<<"TrackerDialog::TrackerDialog"; + setAttribute(Qt::WA_DeleteOnClose, false); + + ui.setupUi( this ); + + vector<string> device_names; + get_camera_device_names(device_names); + for (vector<string>::iterator iter = device_names.begin(); iter != device_names.end(); ++iter) + { + ui.camdevice_combo->addItem(iter->c_str()); + } + + ui.camroll_combo->addItem("-90"); + ui.camroll_combo->addItem("0"); + ui.camroll_combo->addItem("90"); + + tie_setting(s.dyn_pose_res, ui.dynpose_check); + tie_setting(s.reset_time, ui.reset_spin); + + tie_setting(s.cam_index, ui.camdevice_combo); + tie_setting(s.cam_f, ui.f_dspin); + tie_setting(s.cam_res_x, ui.res_x_spin); + tie_setting(s.cam_res_y, ui.res_y_spin); + tie_setting(s.cam_fps, ui.fps_spin); + tie_setting(s.cam_roll, ui.camroll_combo); + tie_setting(s.cam_pitch, ui.campitch_spin); + tie_setting(s.cam_yaw, ui.camyaw_spin); + + tie_setting(s.threshold_secondary, ui.threshold_secondary_slider); + tie_setting(s.threshold, ui.threshold_slider); + + tie_setting(s.bEnableYaw, ui.chkEnableYaw); + tie_setting(s.bEnablePitch, ui.chkEnablePitch); + tie_setting(s.bEnableRoll, ui.chkEnableRoll); + tie_setting(s.bEnableX, ui.chkEnableX); + tie_setting(s.bEnableY, ui.chkEnableY); + tie_setting(s.bEnableZ, ui.chkEnableZ); + + tie_setting(s.min_point_size, ui.mindiam_spin); + tie_setting(s.max_point_size, ui.maxdiam_spin); + + tie_setting(s.clip_by, ui.clip_bheight_spin); + tie_setting(s.clip_bz, ui.clip_blength_spin); + tie_setting(s.clip_ty, ui.clip_theight_spin); + tie_setting(s.clip_tz, ui.clip_tlength_spin); + + tie_setting(s.cap_x, ui.cap_width_spin); + tie_setting(s.cap_y, ui.cap_height_spin); + tie_setting(s.cap_z, ui.cap_length_spin); + + tie_setting(s.m01_x, ui.m1x_spin); + tie_setting(s.m01_y, ui.m1y_spin); + tie_setting(s.m01_z, ui.m1z_spin); + + tie_setting(s.m02_x, ui.m2x_spin); + tie_setting(s.m02_y, ui.m2y_spin); + tie_setting(s.m02_z, ui.m2z_spin); + + tie_setting(s.t_MH_x, ui.tx_spin); + tie_setting(s.t_MH_y, ui.ty_spin); + tie_setting(s.t_MH_z, ui.tz_spin); + + connect( ui.tcalib_button,SIGNAL(toggled(bool)), this,SLOT(startstop_trans_calib(bool)) ); + connect(ui.reset_button, SIGNAL(clicked()), this, SLOT(doReset())); + + connect(ui.ok_button, SIGNAL(clicked()), this, SLOT(doOK())); + connect(ui.cancel_button, SIGNAL(clicked()), this, SLOT(doCancel())); + connect(ui.btnApply, SIGNAL(clicked()), this, SLOT(doApply())); + + ui.model_tabs->setCurrentIndex(s.active_model_panel); + + connect(ui.model_tabs, SIGNAL(currentChanged(int)), this, SLOT(set_model(int))); + connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); + timer.start(100); + + connect(s.b.get(), SIGNAL(bundleChanged()), this, SLOT(do_apply_without_saving())); +} + +void TrackerDialog::set_model_clip() +{ + s.m01_x = 0; + s.m01_y = static_cast<double>(s.clip_ty); + s.m01_z = -static_cast<double>(s.clip_tz); + s.m02_x = 0; + s.m02_y = -static_cast<double>(s.clip_by); + s.m02_z = -static_cast<double>(s.clip_bz); + + settings_changed(); +} + +void TrackerDialog::set_model_cap() +{ + s.m01_x = -static_cast<double>(s.cap_x); + s.m01_y = -static_cast<double>(s.cap_y); + s.m01_z = -static_cast<double>(s.cap_z); + s.m02_x = static_cast<double>(s.cap_x); + s.m02_y = -static_cast<double>(s.cap_y); + s.m02_z = -static_cast<double>(s.cap_z); + + settings_changed(); +} + +void TrackerDialog::set_model_custom() +{ + settings_changed(); +} + +void TrackerDialog::set_model(int val) +{ + s.active_model_panel = val; +} + +void TrackerDialog::startstop_trans_calib(bool start) +{ + if (start) + { + qDebug()<<"TrackerDialog:: Starting translation calibration"; + trans_calib.reset(); + trans_calib_running = true; + } + else + { + qDebug()<<"TrackerDialog:: Stoppping translation calibration"; + trans_calib_running = false; + { + auto tmp = trans_calib.get_estimate(); + s.t_MH_x = tmp[0]; + s.t_MH_y = tmp[1]; + s.t_MH_z = tmp[2]; + } + settings_changed(); + } +} + +void TrackerDialog::trans_calib_step() +{ + if (tracker) + { + FrameTrafo X_CM; + tracker->get_pose(&X_CM); + trans_calib.update(X_CM.R, X_CM.t); + cv::Vec3f t_MH = trans_calib.get_estimate(); + s.t_MH_x = t_MH[0]; + s.t_MH_y = t_MH[1]; + s.t_MH_z = t_MH[2]; + } +} + +void TrackerDialog::settings_changed() +{ + if (tracker) tracker->apply(s); +} + +void TrackerDialog::doCenter() +{ + if (tracker) tracker->center(); +} + +void TrackerDialog::doReset() +{ + if (tracker) tracker->reset(); +} + +void TrackerDialog::save() +{ + do_apply_without_saving(); + s.b->save(); +} + +void TrackerDialog::doOK() +{ + save(); + close(); +} + +void TrackerDialog::do_apply_without_saving() +{ + switch (s.active_model_panel) { + default: + case 0: + set_model_clip(); + break; + case 1: + set_model_cap(); + break; + case 2: + set_model_custom(); + break; + } + if (tracker) tracker->apply(s); +} + +void TrackerDialog::doApply() +{ + save(); +} + +void TrackerDialog::doCancel() +{ + s.b->revert(); + close(); +} + +void TrackerDialog::widget_destroyed(QObject* obj) +{ + if (obj == video_widget_dialog) { + // widget was / will be already deleted by Qt + destroy_video_widget(false); + } +} + +void TrackerDialog::create_video_widget() +{ + // this should not happen but better be sure + if (video_widget_dialog) destroy_video_widget(); + if (!tracker) return; + + video_widget_dialog = new VideoWidgetDialog(this, tracker); + video_widget_dialog->setAttribute( Qt::WA_DeleteOnClose ); + connect( video_widget_dialog, SIGNAL(destroyed(QObject*)), this, SLOT(widget_destroyed(QObject*)) ); + video_widget_dialog->show(); +} + +void TrackerDialog::destroy_video_widget(bool do_delete /*= true*/) +{ + if (video_widget_dialog) { + if (do_delete) delete video_widget_dialog; + video_widget_dialog = NULL; + } +} + +void TrackerDialog::poll_tracker_info() +{ + if (tracker) + { + QString to_print; + + // display caminfo + CamInfo info; + tracker->get_cam_info(&info); + to_print = QString::number(info.res_x)+"x"+QString::number(info.res_y)+" @ "+QString::number(info.fps)+" FPS"; + ui.caminfo_label->setText(to_print); + + // display pointinfo + int n_points = tracker->get_n_points(); + to_print = QString::number(n_points); + if (n_points == 3) + to_print += " OK!"; + else + to_print += " BAD!"; + ui.pointinfo_label->setText(to_print); + + // update calibration + if (trans_calib_running) trans_calib_step(); + + // update videowidget + if (video_widget_dialog) { + video_widget_dialog->get_video_widget()->update_frame_and_points(); + } + } + else + { + QString to_print = "Tracker offline"; + ui.caminfo_label->setText(to_print); + ui.pointinfo_label->setText(to_print); + } +} + +void TrackerDialog::registerTracker(ITracker *t) +{ + qDebug()<<"TrackerDialog:: Tracker registered"; + tracker = static_cast<Tracker*>(t); + if (isVisible() & s.b->modifiedp()) + tracker->apply(s); + ui.tcalib_button->setEnabled(true); + //ui.center_button->setEnabled(true); + ui.reset_button->setEnabled(true); +} + +void TrackerDialog::unRegisterTracker() +{ + qDebug()<<"TrackerDialog:: Tracker un-registered"; + tracker = NULL; + destroy_video_widget(); + ui.tcalib_button->setEnabled(false); + //ui.center_button->setEnabled(false); + ui.reset_button->setEnabled(false); +} + +extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) +{ + return new TrackerDialog; +} diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h new file mode 100644 index 00000000..0325160d --- /dev/null +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h @@ -0,0 +1,70 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#ifndef FTNOIR_TRACKER_PT_DIALOG_H +#define FTNOIR_TRACKER_PT_DIALOG_H + +#ifdef OPENTRACK_API +#include "ftnoir_tracker_base/ftnoir_tracker_base.h" +#else +#include "..\ftnoir_tracker_base\ftnoir_tracker_base.h" +#endif +#include "ftnoir_tracker_pt_settings.h" +#include "ftnoir_tracker_pt.h" +#include "trans_calib.h" +#include "pt_video_widget.h" +#include "ui_FTNoIR_PT_Controls.h" + +#include <QTimer> + +//----------------------------------------------------------------------------- +// The dialog that shows up when the user presses "Settings" +class TrackerDialog : public QWidget, Ui::UICPTClientControls, public ITrackerDialog +{ + Q_OBJECT +public: + TrackerDialog(); + void registerTracker(ITracker *tracker); + void unRegisterTracker(); + void save(); + void trans_calib_step(); + +public slots: + void doCenter(); + void doReset(); + void doOK(); + void doApply(); + void doCancel(); + void do_apply_without_saving(); + + void startstop_trans_calib(bool start); + void widget_destroyed(QObject* obj); + void create_video_widget(); + void poll_tracker_info(); + void set_model(int idx); + +protected: + void destroy_video_widget(bool do_delete = true); + + void set_model_clip(); + void set_model_cap(); + void set_model_custom(); + + void settings_changed(); + + settings s; + Tracker* tracker; + VideoWidgetDialog* video_widget_dialog; + QTimer timer; + + TranslationCalibrator trans_calib; + bool trans_calib_running; + + Ui::UICPTClientControls ui; +}; + +#endif //FTNOIR_TRACKER_PT_DIALOG_H diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp new file mode 100644 index 00000000..15e830a4 --- /dev/null +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp @@ -0,0 +1,42 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 "ftnoir_tracker_pt_dll.h" +#include <QIcon> + +//----------------------------------------------------------------------------- +void TrackerDll::getFullName(QString *strToBeFilled) +{ + *strToBeFilled = "PointTracker 1.1"; +} + +void TrackerDll::getShortName(QString *strToBeFilled) +{ + *strToBeFilled = "PointTracker"; +} + +void TrackerDll::getDescription(QString *strToBeFilled) +{ + *strToBeFilled = "Tracks a 3-point model with know geometry like Freetrack / TrackIR"; +} + +void TrackerDll::getIcon(QIcon *icon) +{ + *icon = QIcon(":/Resources/Logo_IR.png"); +} + + +#ifdef OPENTRACK_API +# include "facetracknoir/plugin-support.h" +extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +#else +# pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0") +FTNOIR_TRACKER_BASE_EXPORT ITrackerDllPtr __stdcall GetTrackerDll() +#endif +{ + return new TrackerDll; +} diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h new file mode 100644 index 00000000..22e1ff29 --- /dev/null +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h @@ -0,0 +1,27 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#if defined(OPENTRACK_API) +# include "ftnoir_tracker_base/ftnoir_tracker_base.h" +# include "facetracknoir/plugin-support.h" +#else +# include "../ftnoir_tracker_base/ftnoir_tracker_base.h" +#endif + +//----------------------------------------------------------------------------- +class TrackerDll : +#if defined(OPENTRACK_API) + public Metadata +#else + public ITrackerDll +#endif +{ + void getFullName(QString *strToBeFilled); + void getShortName(QString *strToBeFilled); + void getDescription(QString *strToBeFilled); + void getIcon(QIcon *icon); +}; diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h new file mode 100644 index 00000000..109090b3 --- /dev/null +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h @@ -0,0 +1,90 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#ifndef FTNOIR_TRACKER_PT_SETTINGS_H +#define FTNOIR_TRACKER_PT_SETTINGS_H + +#include <opencv2/opencv.hpp> +#include "point_tracker.h" + +#include "facetracknoir/options.h" +using namespace options; + +struct settings +{ + pbundle b; + value<int> cam_index, + cam_res_x, + cam_res_y, + cam_fps, + cam_roll, + cam_pitch, + cam_yaw, + threshold, + threshold_secondary, + min_point_size, + max_point_size; + value<double> cam_f; + + value<int> m01_x, m01_y, m01_z; + value<int> m02_x, m02_y, m02_z; + value<bool> dyn_pose_res, video_widget; + + value<int> t_MH_x, t_MH_y, t_MH_z; + + value<int> reset_time; + + value<bool> bEnableYaw, bEnablePitch, bEnableRoll; + value<bool> bEnableX, bEnableY, bEnableZ; + + value<int> clip_ty, clip_tz, clip_by, clip_bz; + value<int> active_model_panel, cap_x, cap_y, cap_z; + + settings() : + b(bundle("tracker-pt")), + cam_index(b, "camera-index", 0), + cam_res_x(b, "camera-res-width", 640), + cam_res_y(b, "camera-res-height", 480), + cam_fps(b, "camera-fps", 30), + cam_roll(b, "camera-roll", 1), + cam_pitch(b, "camera-pitch", 0), + cam_yaw(b, "camera-yaw", 0), + threshold(b, "threshold-primary", 128), + threshold_secondary(b, "threshold-secondary", 128), + min_point_size(b, "min-point-size", 10), + max_point_size(b, "max-point-size", 50), + cam_f(b, "camera-focal-length", 1), + m01_x(b, "m_01-x", 0), + m01_y(b, "m_01-y", 0), + m01_z(b, "m_01-z", 0), + m02_x(b, "m_02-x", 0), + m02_y(b, "m_02-y", 0), + m02_z(b, "m_02-z", 0), + dyn_pose_res(b, "dynamic-pose-resolution", false), + video_widget(b, "video-widget", true), + t_MH_x(b, "model-centroid-x", 0), + t_MH_y(b, "model-centroid-y", 0), + t_MH_z(b, "model-centroid-z", 0), + reset_time(b, "reset-time", 2000), + bEnableYaw(b, "enable-yaw", true), + bEnablePitch(b, "enable-pitch", true), + bEnableRoll(b, "enable-roll", true), + bEnableX(b, "enable-x", true), + bEnableY(b, "enable-y", true), + bEnableZ(b, "enable-z", true), + clip_ty(b, "clip-ty", 0), + clip_tz(b, "clip-tz", 0), + clip_by(b, "clip-by", 0), + clip_bz(b, "clip-bz", 0), + active_model_panel(b, "active-model-panel", 0), + cap_x(b, "cap-x", 0), + cap_y(b, "cap-y", 0), + cap_z(b, "cap-z", 0) + {} +}; + +#endif //FTNOIR_TRACKER_PT_SETTINGS_H diff --git a/ftnoir_tracker_pt/point_extractor.cpp b/ftnoir_tracker_pt/point_extractor.cpp new file mode 100644 index 00000000..d9ff0a5b --- /dev/null +++ b/ftnoir_tracker_pt/point_extractor.cpp @@ -0,0 +1,163 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 "point_extractor.h" +#include <QDebug> + + +using namespace cv; +using namespace std; + + +PointExtractor::PointExtractor(){ + //if (!AllocConsole()){} + //else SetConsoleTitle("debug"); + //freopen("CON", "w", stdout); + //freopen("CON", "w", stderr); +} +// ---------------------------------------------------------------------------- +const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool draw_output) +{ + const int W = frame.cols; + const int H = frame.rows; + + if (frame_last.cols != W || frame_last.rows != H) + { + frame_last = cv::Mat(); + } + + // clear old points + points.clear(); + + // convert to grayscale + Mat frame_gray; + cvtColor(frame, frame_gray, CV_RGB2GRAY); + + int secondary = threshold_secondary_val; + + // mask for everything that passes the threshold (or: the upper threshold of the hysteresis) + Mat frame_bin; + // only used if draw_output + Mat frame_bin_copy; + // mask for everything that passes + Mat frame_bin_low; + // mask for lower-threshold && combined result of last, needs to remain in scope until drawing, but is only used if secondary != 0 + Mat frame_last_and_low; + + if(secondary==0){ + threshold(frame_gray, frame_bin, threshold_val, 255, THRESH_BINARY); + }else{ + // we recombine a number of buffers, this might be slower than a single loop of per-pixel logic + // but it might as well be faster if openCV makes good use of SIMD + float t = threshold_val; + //float hyst = float(threshold_secondary_val)/512.; + //threshold(frame_gray, frame_bin, (t + ((255.-t)*hyst)), 255, THRESH_BINARY); + float hyst = float(threshold_secondary_val)/256.; + threshold(frame_gray, frame_bin, t, 255, THRESH_BINARY); + threshold(frame_gray, frame_bin_low,std::max(float(1), t - (t*hyst)), 255, THRESH_BINARY); + + if(draw_output) frame_bin.copyTo(frame_bin_copy); + if(frame_last.empty()){ + frame_bin.copyTo(frame_last); + }else{ + // keep pixels from last if they are above lower threshold + bitwise_and(frame_last, frame_bin_low, frame_last_and_low); + // union of pixels >= higher threshold and pixels >= lower threshold + bitwise_or(frame_bin, frame_last_and_low, frame_last); + frame_last.copyTo(frame_bin); + } + } + unsigned int region_size_min = 3.14*min_size*min_size/4.0; + unsigned int region_size_max = 3.14*max_size*max_size/4.0; + + int blob_index = 1; + for (int y=0; y<H; y++) + { + if (blob_index >= 255) break; + for (int x=0; x<W; x++) + { + if (blob_index >= 255) break; + + // find connected components with floodfill + if (frame_bin.at<unsigned char>(y,x) != 255) continue; + Rect rect; + + floodFill(frame_bin, Point(x,y), Scalar(blob_index), &rect, Scalar(0), Scalar(0), FLOODFILL_FIXED_RANGE); + blob_index++; + + // calculate the size of the connected component + unsigned int region_size = 0; + for (int i=rect.y; i < (rect.y+rect.height); i++) + { + for (int j=rect.x; j < (rect.x+rect.width); j++) + { + if (frame_bin.at<unsigned char>(i,j) != blob_index-1) continue; + region_size++; + } + } + + if (region_size < region_size_min || region_size > region_size_max) continue; + + // calculate the center of mass: + // mx = (sum_ij j*f(frame_grey_ij)) / (sum_ij f(frame_grey_ij)) + // my = ... + // f maps from [threshold,256] -> [0, 1], lower values are mapped to 0 + float m = 0; + float mx = 0; + float my = 0; + for (int i=rect.y; i < (rect.y+rect.height); i++) + { + for (int j=rect.x; j < (rect.x+rect.width); j++) + { + if (frame_bin.at<unsigned char>(i,j) != blob_index-1) continue; + float val; + + if(secondary==0){ + val = frame_gray.at<unsigned char>(i,j); + val = float(val - threshold_val)/(256 - threshold_val); + val = val*val; // makes it more stable (less emphasis on low values, more on the peak) + }else{ + //hysteresis point detection gets stability from ignoring pixel noise so we decidedly leave the actual pixel values out of the picture + val = frame_last.at<unsigned char>(i,j) / 256.; + } + + m += val; + mx += j * val; + my += i * val; + } + } + + // convert to centered camera coordinate system with y axis upwards + Vec2f c; + c[0] = (mx/m - W/2)/W; + c[1] = -(my/m - H/2)/W; + //qDebug()<<blob_index<<" => "<<c[0]<<" "<<c[1]; + points.push_back(c); + } + } + + // draw output image + if (draw_output) { + vector<Mat> channels; + if(secondary==0){ + frame_bin.setTo(170, frame_bin); + channels.push_back(frame_gray + frame_bin); + channels.push_back(frame_gray - frame_bin); + channels.push_back(frame_gray - frame_bin); + }else{ + frame_bin_copy.setTo(120, frame_bin_copy); + frame_bin_low.setTo(90, frame_bin_low); + channels.push_back(frame_gray + frame_bin_copy); + channels.push_back(frame_gray + frame_last_and_low); + channels.push_back(frame_gray + frame_bin_low); + //channels.push_back(frame_gray + frame_bin); + } + merge(channels, frame); + } + + return points; +} diff --git a/ftnoir_tracker_pt/point_extractor.h b/ftnoir_tracker_pt/point_extractor.h new file mode 100644 index 00000000..ff36f3ce --- /dev/null +++ b/ftnoir_tracker_pt/point_extractor.h @@ -0,0 +1,35 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#ifndef POINTEXTRACTOR_H +#define POINTEXTRACTOR_H + +#include <opencv2/opencv.hpp> +#include <opencv2/imgproc/imgproc_c.h> + +// ---------------------------------------------------------------------------- +// Extracts points from an opencv image +class PointExtractor +{ +public: + // extracts points from frame and draws some processing info into frame, if draw_output is set + // dt: time since last call in seconds + // WARNING: returned reference is valid as long as object + const std::vector<cv::Vec2f>& extract_points(cv::Mat frame, float dt, bool draw_output); + const std::vector<cv::Vec2f>& get_points() { return points; } + PointExtractor(); + + int threshold_val; + int threshold_secondary_val; + int min_size, max_size; + +protected: + std::vector<cv::Vec2f> points; + cv::Mat frame_last; +}; + +#endif //POINTEXTRACTOR_H diff --git a/ftnoir_tracker_pt/point_tracker.cpp b/ftnoir_tracker_pt/point_tracker.cpp new file mode 100644 index 00000000..dfefdaf8 --- /dev/null +++ b/ftnoir_tracker_pt/point_tracker.cpp @@ -0,0 +1,380 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 "point_tracker.h" + +#include <vector> +#include <algorithm> +#include <cmath> + +#include <QDebug> + +using namespace cv; +using namespace boost; +using namespace std; + +const float PI = 3.14159265358979323846f; + +// ---------------------------------------------------------------------------- +static void get_row(const Matx33f& m, int i, Vec3f& v) +{ + v[0] = m(i,0); + v[1] = m(i,1); + v[2] = m(i,2); +} + +static void set_row(Matx33f& m, int i, const Vec3f& v) +{ + m(i,0) = v[0]; + m(i,1) = v[1]; + m(i,2) = v[2]; +} + +// ---------------------------------------------------------------------------- +PointModel::PointModel(Vec3f M01, Vec3f M02) + : M01(M01), + M02(M02) +{ + // calculate u + u = M01.cross(M02); + u /= norm(u); + + // calculate projection matrix on M01,M02 plane + float s11 = M01.dot(M01); + float s12 = M01.dot(M02); + float s22 = M02.dot(M02); + P = 1.0/(s11*s22-s12*s12) * Matx22f(s22, -s12, + -s12, s11); + + // calculate d and d_order for simple freetrack-like point correspondence + vector<Vec2f> points; + points.push_back(Vec2f(0,0)); + points.push_back(Vec2f(M01[0], M01[1])); + points.push_back(Vec2f(M02[0], M02[1])); + // fit line to orthographically projected points + // ERROR: yields wrong results with colinear points?! + /* + Vec4f line; + fitLine(points, line, CV_DIST_L2, 0, 0.01, 0.01); + d[0] = line[0]; d[1] = line[1]; + */ + // TODO: fix this + d = Vec2f(M01[0]-M02[0], M01[1]-M02[1]); + + // sort model points + get_d_order(points, d_order); +} + +#ifdef OPENTRACK_API +static bool d_vals_sort(const pair<float,int> a, const pair<float,int> b) +{ + return a.first < b.first; +} +#endif + +void PointModel::get_d_order(const std::vector<cv::Vec2f>& points, int d_order[]) const +{ + // get sort indices with respect to d scalar product + vector< pair<float,int> > d_vals; + for (int i = 0; i<points.size(); ++i) + d_vals.push_back(pair<float, int>(d.dot(points[i]), i)); + + struct + { + bool operator()(const pair<float, int>& a, const pair<float, int>& b) { return a.first < b.first; } + } comp; + std::sort(d_vals.begin(), + d_vals.end(), +#ifdef OPENTRACK_API + d_vals_sort +#else + comp +#endif + ); + + for (int i = 0; i<points.size(); ++i) + d_order[i] = d_vals[i].second; +} + + +// ---------------------------------------------------------------------------- +PointTracker::PointTracker() + : init_phase(true), + dt_valid(0), + dt_reset(1), + v_t(0,0,0), + v_r(0,0,0), + dynamic_pose_resolution(true) +{ + X_CM.t[2] = 1000; // default position: 1 m away from cam; +} + +void PointTracker::reset() +{ + // enter init phase and reset velocities + init_phase = true; + dt_valid = 0; + reset_velocities(); +} + +void PointTracker::reset_velocities() +{ + v_t = Vec3f(0,0,0); + v_r = Vec3f(0,0,0); +} + + +bool PointTracker::track(const vector<Vec2f>& points, float f, float dt) +{ + if (!dynamic_pose_resolution) init_phase = true; + + dt_valid += dt; + // if there was no valid tracking result for too long, do a reset + if (dt_valid > dt_reset) + { + //qDebug()<<"dt_valid "<<dt_valid<<" > dt_reset "<<dt_reset; + reset(); + } + + bool no_model = +#ifdef OPENTRACK_API + point_model.get() == NULL; +#else + !point_model; +#endif + + // if there is a pointtracking problem, reset the velocities + if (no_model || points.size() != PointModel::N_POINTS) + { + //qDebug()<<"Wrong number of points!"; + reset_velocities(); + return false; + } + + X_CM_old = X_CM; // backup old transformation for velocity calculation + + if (!init_phase) + predict(dt_valid); + + // if there is a point correspondence problem something has gone wrong, do a reset + if (!find_correspondences(points, f)) + { + //qDebug()<<"Error in finding point correspondences!"; + X_CM = X_CM_old; // undo prediction + reset(); + return false; + } + + int n_iter = POSIT(f); + //qDebug()<<"Number of POSIT iterations: "<<n_iter; + + if (!init_phase) + update_velocities(dt_valid); + + // we have a valid tracking result, leave init phase and reset time since valid result + init_phase = false; + dt_valid = 0; + return true; +} + +void PointTracker::predict(float dt) +{ + // predict with constant velocity + Matx33f R; + Rodrigues(dt*v_r, R); + X_CM.R = R*X_CM.R; + X_CM.t += dt * v_t; +} + +void PointTracker::update_velocities(float dt) +{ + // update velocities + Rodrigues(X_CM.R*X_CM_old.R.t(), v_r); + v_r /= dt; + v_t = (X_CM.t - X_CM_old.t)/dt; +} + +bool PointTracker::find_correspondences(const vector<Vec2f>& points, float f) +{ + if (init_phase) { + // We do a simple freetrack-like sorting in the init phase... + // sort points + int point_d_order[PointModel::N_POINTS]; + point_model->get_d_order(points, point_d_order); + + // set correspondences + for (int i=0; i<PointModel::N_POINTS; ++i) + { + p[point_model->d_order[i]] = points[point_d_order[i]]; + } + } + else { + // ... otherwise we look at the distance to the projection of the expected model points + // project model points under current pose + p_exp[0] = project(Vec3f(0,0,0), f); + p_exp[1] = project(point_model->M01, f); + p_exp[2] = project(point_model->M02, f); + + // set correspondences by minimum distance to projected model point + bool point_taken[PointModel::N_POINTS]; + for (int i=0; i<PointModel::N_POINTS; ++i) + point_taken[i] = false; + + float min_sdist = 0; + int min_idx = 0; + + for (int i=0; i<PointModel::N_POINTS; ++i) + { + // find closest point to projected model point i + for (int j=0; j<PointModel::N_POINTS; ++j) + { + Vec2f d = p_exp[i]-points[j]; + float sdist = d.dot(d); + if (sdist < min_sdist || j==0) + { + min_idx = j; + min_sdist = sdist; + } + } + // if one point is closest to more than one model point, abort + if (point_taken[min_idx]) return false; + point_taken[min_idx] = true; + p[i] = points[min_idx]; + } + } + return true; +} + + + +int PointTracker::POSIT(float f) +{ + // POSIT algorithm for coplanar points as presented in + // [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"] + // we use the same notation as in the paper here + + // The expected rotation used for resolving the ambiguity in POSIT: + // In every iteration step the rotation closer to R_expected is taken + Matx33f R_expected; + if (init_phase) + R_expected = Matx33f::eye(); // in the init phase, we want to be close to the default pose = no rotation + else + R_expected = X_CM.R; // later we want to be close to the last (predicted) rotation + + // initial pose = last (predicted) pose + Vec3f k; + get_row(R_expected, 2, k); + float Z0 = init_phase ? 1000 : X_CM.t[2]; + + float old_epsilon_1 = 0; + float old_epsilon_2 = 0; + float epsilon_1 = 1; + float epsilon_2 = 1; + + Vec3f I0, J0; + Vec2f I0_coeff, J0_coeff; + + Vec3f I_1, J_1, I_2, J_2; + Matx33f R_1, R_2; + Matx33f* R_current; + + const int MAX_ITER = 100; + const float EPS_THRESHOLD = 1e-4; + + int i=1; + for (; i<MAX_ITER; ++i) + { + epsilon_1 = k.dot(point_model->M01)/Z0; + epsilon_2 = k.dot(point_model->M02)/Z0; + + // vector of scalar products <I0, M0i> and <J0, M0i> + Vec2f I0_M0i(p[1][0]*(1.0 + epsilon_1) - p[0][0], + p[2][0]*(1.0 + epsilon_2) - p[0][0]); + Vec2f J0_M0i(p[1][1]*(1.0 + epsilon_1) - p[0][1], + p[2][1]*(1.0 + epsilon_2) - p[0][1]); + + // construct projection of I, J onto M0i plane: I0 and J0 + I0_coeff = point_model->P * I0_M0i; + J0_coeff = point_model->P * J0_M0i; + I0 = I0_coeff[0]*point_model->M01 + I0_coeff[1]*point_model->M02; + J0 = J0_coeff[0]*point_model->M01 + J0_coeff[1]*point_model->M02; + + // calculate u component of I, J + float II0 = I0.dot(I0); + float IJ0 = I0.dot(J0); + float JJ0 = J0.dot(J0); + float rho, theta; + if (JJ0 == II0) { + rho = sqrt(abs(2*IJ0)); + theta = -PI/4; + if (IJ0<0) theta *= -1; + } + else { + rho = sqrt(sqrt( (JJ0-II0)*(JJ0-II0) + 4*IJ0*IJ0 )); + theta = atan( -2*IJ0 / (JJ0-II0) ); + if (JJ0 - II0 < 0) theta += PI; + theta /= 2; + } + + // construct the two solutions + I_1 = I0 + rho*cos(theta)*point_model->u; + I_2 = I0 - rho*cos(theta)*point_model->u; + + J_1 = J0 + rho*sin(theta)*point_model->u; + J_2 = J0 - rho*sin(theta)*point_model->u; + + float norm_const = 1.0/norm(I_1); // all have the same norm + + // create rotation matrices + I_1 *= norm_const; J_1 *= norm_const; + I_2 *= norm_const; J_2 *= norm_const; + + set_row(R_1, 0, I_1); + set_row(R_1, 1, J_1); + set_row(R_1, 2, I_1.cross(J_1)); + + set_row(R_2, 0, I_2); + set_row(R_2, 1, J_2); + set_row(R_2, 2, I_2.cross(J_2)); + + // the single translation solution + Z0 = norm_const * f; + + // pick the rotation solution closer to the expected one + // in simple metric d(A,B) = || I - A * B^T || + float R_1_deviation = norm(Matx33f::eye() - R_expected * R_1.t()); + float R_2_deviation = norm(Matx33f::eye() - R_expected * R_2.t()); + + if (R_1_deviation < R_2_deviation) + R_current = &R_1; + else + R_current = &R_2; + + get_row(*R_current, 2, k); + + // check for convergence condition + if (abs(epsilon_1 - old_epsilon_1) + abs(epsilon_2 - old_epsilon_2) < EPS_THRESHOLD) + break; + old_epsilon_1 = epsilon_1; + old_epsilon_2 = epsilon_2; + } + + // apply results + X_CM.R = *R_current; + X_CM.t[0] = p[0][0] * Z0/f; + X_CM.t[1] = p[0][1] * Z0/f; + X_CM.t[2] = Z0; + + return i; + + //Rodrigues(X_CM.R, r); + //qDebug()<<"iter: "<<i; + //qDebug()<<"t: "<<X_CM.t[0]<<' '<<X_CM.t[1]<<' '<<X_CM.t[2]; + //Vec3f r; + // + //qDebug()<<"r: "<<r[0]<<' '<<r[1]<<' '<<r[2]<<'\n'; +} diff --git a/ftnoir_tracker_pt/point_tracker.h b/ftnoir_tracker_pt/point_tracker.h new file mode 100644 index 00000000..11034100 --- /dev/null +++ b/ftnoir_tracker_pt/point_tracker.h @@ -0,0 +1,129 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#ifndef POINTTRACKER_H +#define POINTTRACKER_H + +#include <opencv2/opencv.hpp> +#ifndef OPENTRACK_API +# include <boost/shared_ptr.hpp> +#else +# include "FTNoIR_Tracker_PT/boost-compat.h" +#endif +#include <list> + +// ---------------------------------------------------------------------------- +// Affine frame trafo +class FrameTrafo +{ +public: + FrameTrafo() : R(cv::Matx33f::eye()), t(0,0,0) {} + FrameTrafo(const cv::Matx33f& R, const cv::Vec3f& t) : R(R),t(t) {} + + cv::Matx33f R; + cv::Vec3f t; +}; + +inline FrameTrafo operator*(const FrameTrafo& X, const FrameTrafo& Y) +{ + return FrameTrafo(X.R*Y.R, X.R*Y.t + X.t); +} + +inline FrameTrafo operator*(const cv::Matx33f& X, const FrameTrafo& Y) +{ + return FrameTrafo(X*Y.R, X*Y.t); +} + +inline FrameTrafo operator*(const FrameTrafo& X, const cv::Matx33f& Y) +{ + return FrameTrafo(X.R*Y, X.t); +} + +inline cv::Vec3f operator*(const FrameTrafo& X, const cv::Vec3f& v) +{ + return X.R*v + X.t; +} + + +// ---------------------------------------------------------------------------- +// Describes a 3-point model +// nomenclature as in +// [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"] +class PointModel +{ + friend class PointTracker; +public: + static const int N_POINTS = 3; + + PointModel(cv::Vec3f M01, cv::Vec3f M02); + + const cv::Vec3f& get_M01() const { return M01; }; + const cv::Vec3f& get_M02() const { return M02; }; + +protected: + cv::Vec3f M01; // M01 in model frame + cv::Vec3f M02; // M02 in model frame + + cv::Vec3f u; // unit vector perpendicular to M01,M02-plane + + cv::Matx22f P; + + cv::Vec2f d; // discriminant vector for point correspondence + int d_order[3]; // sorting of projected model points with respect to d scalar product + + void get_d_order(const std::vector<cv::Vec2f>& points, int d_order[]) const; +}; + +// ---------------------------------------------------------------------------- +// Tracks a 3-point model +// implementing the POSIT algorithm for coplanar points as presented in +// [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"] +class PointTracker +{ +public: + PointTracker(); + + // track the pose using the set of normalized point coordinates (x pos in range -0.5:0.5) + // f : (focal length)/(sensor width) + // dt : time since last call + bool track(const std::vector<cv::Vec2f>& points, float f, float dt); + boost::shared_ptr<PointModel> point_model; + + bool dynamic_pose_resolution; + float dt_reset; + + FrameTrafo get_pose() const { return X_CM; } + void reset(); + +protected: + inline cv::Vec2f project(const cv::Vec3f& v_M, float f) + { + cv::Vec3f v_C = X_CM * v_M; + return cv::Vec2f(f*v_C[0]/v_C[2], f*v_C[1]/v_C[2]); + } + + bool find_correspondences(const std::vector<cv::Vec2f>& points, float f); + + cv::Vec2f p[PointModel::N_POINTS]; // the points in model order + cv::Vec2f p_exp[PointModel::N_POINTS]; // the expected point positions + + void predict(float dt); + void update_velocities(float dt); + void reset_velocities(); + + + int POSIT(float f); // The POSIT algorithm, returns the number of iterations + + bool init_phase; + float dt_valid; // time since last valid tracking result + cv::Vec3f v_t; // velocities + cv::Vec3f v_r; + FrameTrafo X_CM; // trafo from model to camera + FrameTrafo X_CM_old; +}; + +#endif //POINTTRACKER_H diff --git a/ftnoir_tracker_pt/pt_video_widget.cpp b/ftnoir_tracker_pt/pt_video_widget.cpp new file mode 100644 index 00000000..02817cbf --- /dev/null +++ b/ftnoir_tracker_pt/pt_video_widget.cpp @@ -0,0 +1,64 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + * + * 20130312, WVR: Add 7 lines to resizeGL after resize_frame. This should lower CPU-load. + */ + +#include "pt_video_widget.h" + +#include <QDebug> +#include <QHBoxLayout> + +using namespace cv; +using namespace std; + +void PTVideoWidget::update_image(const cv::Mat& frame) +{ + QMutexLocker foo(&mtx); + _frame = frame.clone(); + freshp = true; +} + +// ---------------------------------------------------------------------------- +VideoWidgetDialog::VideoWidgetDialog(QWidget *parent, FrameProvider* provider) + : QDialog(parent), + video_widget(NULL) +{ + const int VIDEO_FRAME_WIDTH = 640; + const int VIDEO_FRAME_HEIGHT = 480; + + video_widget = new PTVideoWidget(this, provider); + + QHBoxLayout* layout = new QHBoxLayout(); + layout->setContentsMargins(0, 0, 0, 0); + layout->addWidget(video_widget); + if (this->layout()) delete this->layout(); + setLayout(layout); + resize(VIDEO_FRAME_WIDTH, VIDEO_FRAME_HEIGHT); +} + +void PTVideoWidget::update_and_repaint() +{ + QMutexLocker foo(&mtx); + if (_frame.empty() || !freshp) + return; + freshp = false; + QImage qframe = QImage(_frame.cols, _frame.rows, QImage::Format_RGB888); + uchar* data = qframe.bits(); + const int pitch = qframe.bytesPerLine(); + for (int y = 0; y < _frame.rows; y++) + for (int x = 0; x < _frame.cols; x++) + { + const auto& elt = _frame.at<Vec3b>(y, x); + const cv::Scalar elt2 = static_cast<cv::Scalar>(elt); + data[y * pitch + x * 3 + 0] = elt2.val[2]; + data[y * pitch + x * 3 + 1] = elt2.val[1]; + data[y * pitch + x * 3 + 2] = elt2.val[0]; + } + qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); + texture = qframe; + update(); +} diff --git a/ftnoir_tracker_pt/pt_video_widget.h b/ftnoir_tracker_pt/pt_video_widget.h new file mode 100644 index 00000000..25d593c3 --- /dev/null +++ b/ftnoir_tracker_pt/pt_video_widget.h @@ -0,0 +1,71 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 "frame_observer.h" +#include <QObject> +#include <QTime> +#include <QDialog> +#include <opencv2/opencv.hpp> +#ifndef OPENTRACK_API +# include <QGLWidget> +# include <boost/shared_ptr.hpp> +#else +# include "FTNoIR_Tracker_PT/boost-compat.h" +# if defined(_WIN32) +# include <dshow.h> +# endif +#endif +#include <QPainter> +#include <QPaintEvent> +#include <QTimer> + +class PTVideoWidget : public QWidget, public FrameObserver +{ + Q_OBJECT + +public: + PTVideoWidget(QWidget *parent, FrameProvider* provider) : + QWidget(parent), + /* to avoid linker errors */ FrameObserver(provider), + freshp(false) + { + connect(&timer, SIGNAL(timeout()), this, SLOT(update_and_repaint())); + timer.start(40); + } + void update_image(const cv::Mat &frame); + void update_frame_and_points() {} +protected slots: + void paintEvent( QPaintEvent* e ) { + QMutexLocker foo(&mtx); + QPainter painter(this); + painter.drawImage(e->rect(), texture); + } + void update_and_repaint(); +private: + QMutex mtx; + QImage texture; + QTimer timer; + cv::Mat _frame; + bool freshp; +}; + +// ---------------------------------------------------------------------------- +// A VideoWidget embedded in a dialog frame +class VideoWidgetDialog : public QDialog +{ + Q_OBJECT +public: + VideoWidgetDialog(QWidget *parent, FrameProvider* provider); + virtual ~VideoWidgetDialog() {} + + PTVideoWidget* get_video_widget() { return video_widget; } + +private: + PTVideoWidget* video_widget; +}; diff --git a/ftnoir_tracker_pt/trans_calib.cpp b/ftnoir_tracker_pt/trans_calib.cpp new file mode 100644 index 00000000..9b75a1b6 --- /dev/null +++ b/ftnoir_tracker_pt/trans_calib.cpp @@ -0,0 +1,44 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 "trans_calib.h" + +using namespace cv; + +//----------------------------------------------------------------------------- +TranslationCalibrator::TranslationCalibrator() +{ + reset(); +} + +void TranslationCalibrator::reset() +{ + P = Matx66f::zeros(); + y = Vec6f(0,0,0, 0,0,0); +} + +void TranslationCalibrator::update(const Matx33f& R_CM_k, const Vec3f& t_CM_k) +{ + Matx<float, 6,3> H_k_T = Matx<float, 6,3>::zeros(); + for (int i=0; i<3; ++i) { + for (int j=0; j<3; ++j) { + H_k_T(i,j) = R_CM_k(j,i); + } + } + for (int i=0; i<3; ++i) + { + H_k_T(3+i,i) = 1.0; + } + P += H_k_T * H_k_T.t(); + y += H_k_T * t_CM_k; +} + +Vec3f TranslationCalibrator::get_estimate() +{ + Vec6f x = P.inv() * y; + return Vec3f(-x[0], -x[1], -x[2]); +} \ No newline at end of file diff --git a/ftnoir_tracker_pt/trans_calib.h b/ftnoir_tracker_pt/trans_calib.h new file mode 100644 index 00000000..f2521690 --- /dev/null +++ b/ftnoir_tracker_pt/trans_calib.h @@ -0,0 +1,39 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#ifndef TRANSCALIB_H +#define TRANSCALIB_H + +#include <opencv2/opencv.hpp> + +//----------------------------------------------------------------------------- +// Calibrates the translation from head to model = t_MH +// by recursive least squares / +// kalman filter in information form with identity noise covariance +// measurement equation when head position = t_CH is fixed: +// (R_CM_k , Id)*(-t_MH, t_CH) = t_CM_k + +class TranslationCalibrator +{ +public: + TranslationCalibrator(); + + // reset the calibration process + void reset(); + + // update the current estimate + void update(const cv::Matx33f& R_CM_k, const cv::Vec3f& t_CM_k); + + // get the current estimate for t_MH + cv::Vec3f get_estimate(); + +protected: + cv::Matx66f P; // normalized precision matrix = inverse covariance + cv::Vec6f y; // P*(-t_MH, t_CH) +}; + +#endif //TRANSCALIB_H \ No newline at end of file -- cgit v1.2.3 From 30ffe1f0a349ce23e27c01e9ee898f604d07cec6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 6 Sep 2014 22:25:11 -0700 Subject: opencv symbol rename not done yet apparently --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 176fd9b1..3d034819 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -325,7 +325,7 @@ void Tracker::run() last_roi.height = std::min<int>(grayscale.rows - last_roi.y, last_roi.height); } - cv::solvePnP(obj_points, m, intrinsics, dist_coeffs, rvec, tvec, !first, cv::SOLVEPNP_ITERATIVE); + cv::solvePnP(obj_points, m, intrinsics, dist_coeffs, rvec, tvec, !first, cv::ITERATIVE); first = false; cv::Mat rotation_matrix = cv::Mat::zeros(3, 3, CV_64FC1); cv::Mat junk1(3, 3, CV_64FC1), junk2(3, 3, CV_64FC1); -- cgit v1.2.3 From 8762edd0fa1b9131a7e090f9759aba37d6ec64cf Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 6 Sep 2014 22:25:36 -0700 Subject: unbreak build following rename --- ftnoir_tracker_pt/boost-compat.h | 5 ----- ftnoir_tracker_pt/camera.h | 2 +- ftnoir_tracker_pt/frame_observer.h | 6 +++--- ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 7 +++---- ftnoir_tracker_pt/ftnoir_tracker_pt.h | 4 ++-- ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp | 2 +- ftnoir_tracker_pt/point_tracker.cpp | 1 - ftnoir_tracker_pt/point_tracker.h | 4 ++-- ftnoir_tracker_pt/pt_video_widget.h | 2 +- 9 files changed, 13 insertions(+), 20 deletions(-) delete mode 100644 ftnoir_tracker_pt/boost-compat.h diff --git a/ftnoir_tracker_pt/boost-compat.h b/ftnoir_tracker_pt/boost-compat.h deleted file mode 100644 index 612f2c4d..00000000 --- a/ftnoir_tracker_pt/boost-compat.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once -#include <memory> -namespace boost { - using std::shared_ptr; -} diff --git a/ftnoir_tracker_pt/camera.h b/ftnoir_tracker_pt/camera.h index ea68c387..a9f60841 100644 --- a/ftnoir_tracker_pt/camera.h +++ b/ftnoir_tracker_pt/camera.h @@ -12,7 +12,7 @@ #ifndef OPENTRACK_API # include <boost/shared_ptr.hpp> #else -# include "FTNoIR_Tracker_PT/boost-compat.h" +# include <memory> # include <opencv2/highgui/highgui.hpp> # include <opencv2/highgui/highgui_c.h> #endif diff --git a/ftnoir_tracker_pt/frame_observer.h b/ftnoir_tracker_pt/frame_observer.h index 585a6ee7..c3c20259 100644 --- a/ftnoir_tracker_pt/frame_observer.h +++ b/ftnoir_tracker_pt/frame_observer.h @@ -13,7 +13,7 @@ #ifndef OPENTRACK_API # include <boost/shared_ptr.hpp> #else -# include "FTNoIR_Tracker_PT/boost-compat.h" +# include <memory> #endif #include <set> @@ -31,7 +31,7 @@ public: ~FrameProvider(); protected: - virtual bool get_frame_and_points(cv::Mat& frame, boost::shared_ptr< std::vector<cv::Vec2f> >& points) = 0; + virtual bool get_frame_and_points(cv::Mat& frame, std::shared_ptr< std::vector<cv::Vec2f> >& points) = 0; bool has_observers() const { QMutexLocker lock(&observer_mutex); return !frame_observers.empty(); } @@ -58,7 +58,7 @@ public: if (provider) provider->remove_observer(this); } - bool get_frame_and_points(cv::Mat& frame, boost::shared_ptr< std::vector<cv::Vec2f> >& points) { + bool get_frame_and_points(cv::Mat& frame, std::shared_ptr< std::vector<cv::Vec2f> >& points) { return provider ? provider->get_frame_and_points(frame, points) : false; } diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index ef72f9a2..268abeab 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -14,7 +14,6 @@ using namespace std; using namespace cv; -using namespace boost; //#define PT_PERF_LOG //log performance @@ -139,7 +138,7 @@ void Tracker::apply_inner() { cv::Vec3f M01(s.m01_x, s.m01_y, s.m01_z); cv::Vec3f M02(s.m02_x, s.m02_y, s.m02_z); - point_tracker.point_model = boost::shared_ptr<PointModel>(new PointModel(M01, M02)); + point_tracker.point_model = std::shared_ptr<PointModel>(new PointModel(M01, M02)); } point_tracker.dynamic_pose_resolution = s.dyn_pose_res; point_tracker.dt_reset = s.reset_time / 1000.0; @@ -172,14 +171,14 @@ void Tracker::center() X_GH_0 = R_GC * X_CM_0 * X_MH; } -bool Tracker::get_frame_and_points(cv::Mat& frame_copy, boost::shared_ptr< std::vector<Vec2f> >& points) +bool Tracker::get_frame_and_points(cv::Mat& frame_copy, std::shared_ptr< std::vector<Vec2f> >& points) { QMutexLocker lock(&mutex); if (frame.empty()) return false; // copy the frame and points from the tracker thread frame_copy = frame.clone(); - points = boost::shared_ptr< vector<Vec2f> >(new vector<Vec2f>(point_extractor.get_points())); + points = std::shared_ptr< vector<Vec2f> >(new vector<Vec2f>(point_extractor.get_points())); return true; } diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.h b/ftnoir_tracker_pt/ftnoir_tracker_pt.h index 79f16629..7e944fc2 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.h @@ -29,7 +29,7 @@ #ifndef OPENTRACK_API # include <boost/shared_ptr.hpp> #else -# include "FTNoIR_Tracker_PT/boost-compat.h" +# include <memory> #endif #include <vector> @@ -56,7 +56,7 @@ public: protected: // --- MutexedFrameProvider interface --- - virtual bool get_frame_and_points(cv::Mat& frame, boost::shared_ptr< std::vector<cv::Vec2f> >& points); + virtual bool get_frame_and_points(cv::Mat& frame, std::shared_ptr< std::vector<cv::Vec2f> >& points); // --- thread --- QMutex mutex; diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp index c103b78c..00d10d13 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp @@ -13,7 +13,7 @@ #ifndef OPENTRACK_API # include <boost/shared_ptr.hpp> #else -# include "FTNoIR_Tracker_PT/boost-compat.h" +# include <memory> #endif #include <vector> diff --git a/ftnoir_tracker_pt/point_tracker.cpp b/ftnoir_tracker_pt/point_tracker.cpp index dfefdaf8..5735c081 100644 --- a/ftnoir_tracker_pt/point_tracker.cpp +++ b/ftnoir_tracker_pt/point_tracker.cpp @@ -14,7 +14,6 @@ #include <QDebug> using namespace cv; -using namespace boost; using namespace std; const float PI = 3.14159265358979323846f; diff --git a/ftnoir_tracker_pt/point_tracker.h b/ftnoir_tracker_pt/point_tracker.h index 11034100..3ff9c724 100644 --- a/ftnoir_tracker_pt/point_tracker.h +++ b/ftnoir_tracker_pt/point_tracker.h @@ -12,7 +12,7 @@ #ifndef OPENTRACK_API # include <boost/shared_ptr.hpp> #else -# include "FTNoIR_Tracker_PT/boost-compat.h" +# include <memory> #endif #include <list> @@ -91,7 +91,7 @@ public: // f : (focal length)/(sensor width) // dt : time since last call bool track(const std::vector<cv::Vec2f>& points, float f, float dt); - boost::shared_ptr<PointModel> point_model; + std::shared_ptr<PointModel> point_model; bool dynamic_pose_resolution; float dt_reset; diff --git a/ftnoir_tracker_pt/pt_video_widget.h b/ftnoir_tracker_pt/pt_video_widget.h index 25d593c3..f7de4db8 100644 --- a/ftnoir_tracker_pt/pt_video_widget.h +++ b/ftnoir_tracker_pt/pt_video_widget.h @@ -16,7 +16,7 @@ # include <QGLWidget> # include <boost/shared_ptr.hpp> #else -# include "FTNoIR_Tracker_PT/boost-compat.h" +# include <memory> # if defined(_WIN32) # include <dshow.h> # endif -- cgit v1.2.3 From 1309abb9756e0be882cb48a7d93a7ea8b965c2a3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 6 Sep 2014 22:42:47 -0700 Subject: ar: fix choosing camera --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 3d034819..b70bef09 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -451,6 +451,7 @@ TrackerControls::TrackerControls() calib_timer.setInterval(200); ui.setupUi(this); setAttribute(Qt::WA_NativeWindow, true); + ui.cameraName->addItems(get_camera_names()); tie_setting(s.camera_index, ui.cameraName); tie_setting(s.resolution, ui.resolution); tie_setting(s.force_fps, ui.cameraFPS); @@ -468,8 +469,6 @@ TrackerControls::TrackerControls() tie_setting(s.marker_pitch, ui.marker_pitch); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - ui.cameraName->addItems(get_camera_names()); - 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())); -- cgit v1.2.3 From 1f248e06e5fd40d3049a57b85cddf3de46fd8d5c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 7 Sep 2014 12:45:02 +0200 Subject: remove commas to stop github whining --- bin/settings/facetracknoir supported games.csv | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/settings/facetracknoir supported games.csv b/bin/settings/facetracknoir supported games.csv index d0b737b8..b53cf2d9 100644 --- a/bin/settings/facetracknoir supported games.csv +++ b/bin/settings/facetracknoir supported games.csv @@ -27,7 +27,7 @@ No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID 23;Aprisoft Traumhaus Designer;FreeTrack20;V160;;;20013;00174655E792BB825B9300 498;ARI;FreeTrack20;V160;;;20795;01F23FB9A61044E206E200 24;ArmA;FreeTrack20;V160;V;EmBeES;10601;0018F2F27A57631A40F200 -25;ArmA 2;FreeTrack20;V170;V;V4Friend, Ronski;7502;0019EB3616B3A44F05B900 +25;ArmA 2;FreeTrack20;V170;V;V4Friend Ronski;7502;0019EB3616B3A44F05B900 26;ArmA 2 Operation Arrowhead;FreeTrack20;V160;V;vn88holden;0;001ABC224B7783DAF0D500 27;ArmA 3;FreeTrack20;V170;;;7503;001BB69411ABD4E2B39900 28;Armored Assault - Gold Edition;FreeTrack20;V170;;;1303;001CA7F7CAA00814ECA700 @@ -96,7 +96,7 @@ No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID 513;Dawn of Aces/Red Baron;FreeTrack20;V160;;;1307;0201916C14F32918D9B800 87;DBS WalkAndFollow;FreeTrack20;V160;;;2525;005770A8B77008BDE89200 88;DCS: Black Shark;FreeTrack20;V170;V;EmBeES;1006;0058F688FC9B0556868F00 -89;DCS: A-10C Warthog (32 and 64 bit);FreeTrack20;V170;V;fabri91, Shadow;1003;0059B6DCD15F5A572F6500 +89;DCS: A-10C Warthog (32 and 64 bit);FreeTrack20;V170;V;fabri91 Shadow;1003;0059B6DCD15F5A572F6500 90;Dead Reckoning;FreeTrack20;V160;;;10401;005A4C2F6752F912D66200 91;Delivery;FreeTrack20;V160;;;15901;005BF3E85B1A8534AE3400 471;Demon Core;FreeTrack20;V160;;;3225;01D7D1DC6052A165A7AC00 @@ -149,7 +149,7 @@ No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID 133;Fighter Ace;FreeTrack20;V160;;;8401;0085E2D1D77D259837B700 134;Fighter Ops;FreeTrack20;V160;;;9301;00860FC9FF8B23A033BA00 135;Fighter Squadron: Screamin Demons Over Europe;FreeTrack20;V160;;;1675;00872E20237D259A27A600 -136;First Eagles, Wings Over Europe, Strike Fighters;FreeTrack20;V160;;;1101;0088311857638A73BB7E00 +136;First Eagles Wings Over Europe Strike Fighters;FreeTrack20;V160;;;1101;0088311857638A73BB7E00 469;Flight Gear;FreeTrack20;V160;;;12901;01D5D896C66B030606E000 466;Flight Simulator 2002;FreeTrack20;V160;;;2302;01D21F7650E254B4514B00 467;Flight Simulator 2004;FreeTrack20;V160;;;2303;01D3E91BAAB385B2362E00 @@ -189,7 +189,7 @@ No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID 165;Half Life 2;FreeTrack20;V160;;;7806;00A556BA018130AF365500 166;Halo;FreeTrack20;V160;;;3801;00A656BA018130AF3F9C00 502;hapTEL;FreeTrack20;V160;;;20805;01F63ADE510A20446B6A00 -167;Hardware Control Simulator, Railway Electronics;FreeTrack20;V160;;;20705;00A7F3E85B1A8930B42F00 +167;Hardware Control Simulator Railway Electronics;FreeTrack20;V160;;;20705;00A7F3E85B1A8930B42F00 168;Harrier Attack II;FreeTrack20;V160;;;1175;00A8F2F27A57D20A940900 499;Harry's Hard Choices Interactive;FreeTrack20;V160;;;20800;01F33A21BAE3DB6D48A000 169;HAWX;FreeTrack20;V160;V;EmBeES ;0;00A9D615A9C8B088717000 @@ -207,7 +207,7 @@ No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID 180;id Research;FreeTrack20;V170;;;2950;00B4E723B873D7FC87D700 181;IESA;FreeTrack20;V160;;;20037;00B5157D78D0E840AD7100 182;IL-2 Cliffs of Dover;FreeTrack20;V160;V;V4Friend;0;00B6282282095F00521000 -183;IL-2 Forgotten Battles, ACE, Pacific Fighters;FreeTrack20;V160;V;Glenn;1001;00B722FD79137100621100 +183;IL-2 Forgotten Battles ACE Pacific Fighters;FreeTrack20;V160;V;Glenn;1001;00B722FD79137100621100 484;IL-2 Sturmovik: Battle of Stalingrad;FreeTrack20;V170;;;1008;03F04D5368D1FD2DF2AE00 184;Illumina;FreeTrack20;V160;;;1350;00B8054E8B39A33DB02400 185;ILP;FreeTrack20;V160;;;20310;00B9F07957801789C9A600 @@ -331,7 +331,7 @@ No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID 303;R-concept X (AdrenalinStorm);FreeTrack20;V160;;;9101;012F72456F83E6993AA600 293;R.U.D.O. Tools;FreeTrack20;V160;;;20039;0125612F287FB9BEA76E00 294;RACE (the WTCC game);FreeTrack20;V160;;;3904;01263C2C1C94FA86146300 -295;RACE 07, RACE, GTR 2;FreeTrack20;V160;V;zild1221, TrickyDee ;3903;0127C0AF9800870056FD00 +295;RACE 07 RACE GTR 2;FreeTrack20;V160;V;zild1221 TrickyDee ;3903;0127C0AF9800870056FD00 296;RaceOn;FreeTrack20;V160;V;zild1221 ;0;0128621E7832AA82388200 297;Racer;FreeTrack20;V160;;;2401;01296D2D103862E932EA00 298;Racer S;FreeTrack20;V160;;;20030;012AEA1CBED961CA52CB00 @@ -394,7 +394,7 @@ No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID 351;SimQuest immersion system;FreeTrack20;V160;;;20023;015F6C69678C32A30FAE00 352;SimSol;FreeTrack20;V160;;;20034;01602315187389E0FB5300 491;Simumak;FreeTrack20;V160;;;20770;01EB119629980784DCE600 -510;Sir, You Are Being Hunted;FreeTrack20;V160;;;3550;01FEDAB345FA104ED4A100 +510;Sir You Are Being Hunted;FreeTrack20;V160;;;3550;01FEDAB345FA104ED4A100 353;Sirocco Racing;FreeTrack20;V160;;;5801;01612BCA748925A6369A00 354;Sky God: Military Freefall;FreeTrack20;V170;;;1526;01622C0104385FD1C44400 355;Soft fx Demo;FreeTrack20;V160;;;2125;01632E20238A2B99335200 -- cgit v1.2.3 From a38fc743ef4153045fb296c274eafaf4b206d5f6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 7 Sep 2014 12:45:23 +0200 Subject: dos2unix --- bin/settings/facetracknoir supported games.csv | 994 ++++++++++++------------- 1 file changed, 497 insertions(+), 497 deletions(-) diff --git a/bin/settings/facetracknoir supported games.csv b/bin/settings/facetracknoir supported games.csv index b53cf2d9..4052806b 100644 --- a/bin/settings/facetracknoir supported games.csv +++ b/bin/settings/facetracknoir supported games.csv @@ -1,527 +1,527 @@ No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID -1;18 Wheels of Steel: Haulin';FreeTrack20;V160;V;doc-uk;13601;000121F172F35116A02100 -2;1944 D-Day;FreeTrack20;V160;;;15701;00022E542A6A0575F05200 -497;2KMarinNEXT;FreeTrack20;V170;;;3425;0D614F6A0820D1EA8EE800 -3;3D Instructor;FreeTrack20;V160;;;20490;00034B0FC367116611B100 -4;3D Interactive;FreeTrack20;V160;;;20425;0004C6371D77135815A600 +1;18 Wheels of Steel: Haulin';FreeTrack20;V160;V;doc-uk;13601;000121F172F35116A02100 +2;1944 D-Day;FreeTrack20;V160;;;15701;00022E542A6A0575F05200 +497;2KMarinNEXT;FreeTrack20;V170;;;3425;0D614F6A0820D1EA8EE800 +3;3D Instructor;FreeTrack20;V160;;;20490;00034B0FC367116611B100 +4;3D Interactive;FreeTrack20;V160;;;20425;0004C6371D77135815A600 505;3D Interieur Visualisation;FreeTrack20;V160;;;20815;01F9EDEE75DAC2968D9A00 -5;3d Nav;FreeTrack20;V160;;;20235;000579EC0E26932651EA00 -6;3D-Fahrschule Driving Simulator;FreeTrack20;V160;;;20020;000601075146E0E9625B00 -7;3ds Max;FreeTrack20;V160;;;8601;00077A32A1A7523A4DE700 -8;Aaaaa!;FreeTrack20;V160;;;1775;00085485D831DA62CA7E00 -9;Accessible Computer Games;FreeTrack20;V160;;;4301;000916BC07A2F9B35B6300 -10;Aces High II;FreeTrack20;V160;V;bash1;2701;000A4B798B7221A72E5800 -11;ADS;FreeTrack20;V160;;;20690;000BB25377780C8A894400 -12;Aerofly FS;FreeTrack20;V160;V;V4Friend;2025;000C3797169752CAB39A00 -13;Affineon;FreeTrack20;V160;;;20405;000D662B0374339635A000 -14;Air Battles: Sky Defender;FreeTrack20;V160;;;7003;000E7C822098630A2ED700 -15;Air Phobia;FreeTrack20;V160;;;20100;000F0108339B3E78525B00 -16;Air Traffic Control Tower;FreeTrack20;V160;;;3601;0010432C28637A8EF97400 -17;AirBook;FreeTrack20;V160;;;15201;0011D615A9C8430A201A00 -18;America's Army;FreeTrack20;V160;;;4101;00120BCF5753D98399E200 -19;America's Army 3;FreeTrack20;V170;;;14203;00133F3206BCEA252BB700 -20;ANAG 3D;FreeTrack20;V160;;;20250;0014E2D1D7780A72166300 -21;Apache: Air Assault;FreeTrack20;V160;V;paleta77;1875;001591D997A2D912AAA200 +5;3d Nav;FreeTrack20;V160;;;20235;000579EC0E26932651EA00 +6;3D-Fahrschule Driving Simulator;FreeTrack20;V160;;;20020;000601075146E0E9625B00 +7;3ds Max;FreeTrack20;V160;;;8601;00077A32A1A7523A4DE700 +8;Aaaaa!;FreeTrack20;V160;;;1775;00085485D831DA62CA7E00 +9;Accessible Computer Games;FreeTrack20;V160;;;4301;000916BC07A2F9B35B6300 +10;Aces High II;FreeTrack20;V160;V;bash1;2701;000A4B798B7221A72E5800 +11;ADS;FreeTrack20;V160;;;20690;000BB25377780C8A894400 +12;Aerofly FS;FreeTrack20;V160;V;V4Friend;2025;000C3797169752CAB39A00 +13;Affineon;FreeTrack20;V160;;;20405;000D662B0374339635A000 +14;Air Battles: Sky Defender;FreeTrack20;V160;;;7003;000E7C822098630A2ED700 +15;Air Phobia;FreeTrack20;V160;;;20100;000F0108339B3E78525B00 +16;Air Traffic Control Tower;FreeTrack20;V160;;;3601;0010432C28637A8EF97400 +17;AirBook;FreeTrack20;V160;;;15201;0011D615A9C8430A201A00 +18;America's Army;FreeTrack20;V160;;;4101;00120BCF5753D98399E200 +19;America's Army 3;FreeTrack20;V170;;;14203;00133F3206BCEA252BB700 +20;ANAG 3D;FreeTrack20;V160;;;20250;0014E2D1D7780A72166300 +21;Apache: Air Assault;FreeTrack20;V160;V;paleta77;1875;001591D997A2D912AAA200 519;Apex Motorsports;FreeTrack20;V160;;;3675;02078F3159271BBE676800 -22;Aprisoft Gartenplaner;FreeTrack20;V160;;;20014;0016F2F27A5762FA937A00 -23;Aprisoft Traumhaus Designer;FreeTrack20;V160;;;20013;00174655E792BB825B9300 +22;Aprisoft Gartenplaner;FreeTrack20;V160;;;20014;0016F2F27A5762FA937A00 +23;Aprisoft Traumhaus Designer;FreeTrack20;V160;;;20013;00174655E792BB825B9300 498;ARI;FreeTrack20;V160;;;20795;01F23FB9A61044E206E200 -24;ArmA;FreeTrack20;V160;V;EmBeES;10601;0018F2F27A57631A40F200 -25;ArmA 2;FreeTrack20;V170;V;V4Friend Ronski;7502;0019EB3616B3A44F05B900 -26;ArmA 2 Operation Arrowhead;FreeTrack20;V160;V;vn88holden;0;001ABC224B7783DAF0D500 -27;ArmA 3;FreeTrack20;V170;;;7503;001BB69411ABD4E2B39900 -28;Armored Assault - Gold Edition;FreeTrack20;V170;;;1303;001CA7F7CAA00814ECA700 -29;Arvoch Alliance;FreeTrack20;V160;;;14908;001D318F8773BAE29A9300 -30;Arvoch Conflict;FreeTrack20;V160;;;14901;001E5C1FDE722DAE2BA900 -31;Auditory Displays for the blind;FreeTrack20;V160;;;20035;001F0FC9FF862F9D34BA00 -486;Autodesk;FreeTrack20;V160;;;20755;01E6953FA7F759AF33AC00 -32;AV Core Technology;FreeTrack20;V160;;;20016;00204655E791166FEB5300 -33;AVRS;FreeTrack20;V160;;;20340;0021231517525830F41D00 -482;B.O.M.B.;FreeTrack20;V160;;;3325;01E248ECCB81191AD49F00 -34;BAE Systems HILAS cockpit;FreeTrack20;V160;;;20019;00220D9C887FD88E98B300 -35;Battle of Britain (iENT);FreeTrack20;V170;;;1305;00230BA119195B701AED00 -36;Battle of Britain II - Wings of Victory;FreeTrack20;V160;V;Normalguy;7001;002452135882CA6419E200 -37;Battlecruiser;FreeTrack20;V160;;;6101;00257C822098728A442900 -38;Battlefield 2;FreeTrack20;V170;;;9601;0026B1560A2A7327659200 -39;Battlefield 2 Trauma Studios;FreeTrack20;V160;;;6501;002720C7529B733AE2EA00 -40;Battlefield 2142;FreeTrack20;V170;;;9602;00281C739AD3817FD43300 -41;Battleground Europe : World War II Online;FreeTrack20;V160;;;3301;0029F07957792CAD3DAF00 -42;Battleground Europe : WWII Online;FreeTrack20;V160;;;11201;002A985017330A844A1200 -43;Beckman Institute UIUC;FreeTrack20;V160;;;20012;002BB59DEFA8322A926A00 -44;Beyond The Red Line;FreeTrack20;V160;;;13301;002CE7A7FAA27424BA2A00 -45;BF2 (Unsupported Demo);FreeTrack20;V160;;;9651;002DC6371D86156AEB6000 -46;Big Scale Racing;FreeTrack20;V160;;;8301;002E4655E7A24ADDB99200 -47;Birds of Prey;FreeTrack20;V160;;;1601;002FBF8C4EAA57730B3200 -48;Birds of Steel;FreeTrack20;V160;;;1878;0030D7690F607233A21E00 -49;Boeing;FreeTrack20;V160;;;20351;0031044872BA630A033E00 -50;Boeing Demo;FreeTrack20;V160;;;20350;003228C57B369A37B13600 -51;Bomber Squadron;FreeTrack20;V160;;;1850;00338481733B9E32A83A00 -52;Brain-IT Group;FreeTrack20;V160;;;20050;0034E482F5772C9330B100 -53;Brothers In Arms;FreeTrack20;V160;;;13501;003503FB872CA8439D1F00 -82;C-Spine;FreeTrack20;V160;;;4901;00525FD692C188FB8B2D00 -54;C.A.R.S.;FreeTrack20;V170;;;2825;003698EFE2EB6EE8E11300 -55;C.U.B.;FreeTrack20;V160;;;20505;0037848174F986FD85F500 -56;CameraGripTools;FreeTrack20;V160;;;20150;003870A8B761FA524A4200 -57;Caterpillar Simulators;FreeTrack20;V160;;;23080;0039F52E4221742FA63100 -58;CCG Metamedia;FreeTrack20;V160;;;20009;003A6FA8A8DD86FE8BDB00 -59;CEWIT Immersive Cabin;FreeTrack20;V160;;;20370;003B90B5780C90078DEE00 -60;Chopper;FreeTrack20;V160;;;3150;003CC166C8632A32EA2300 -61;Clearbox;FreeTrack20;V160;;;20565;003D5C1FDE74279D1DB800 -62;CNKFsoft;FreeTrack20;V160;;;20495;003ED7690F6073187B0000 -487;Cognitics;FreeTrack20;V160;;;20760;01E715A96D19515BFC1500 -63;Colin McRae DiRT 2;FreeTrack20;V170;V;V4Friend;8107;003F7815C5379491C73300 -64;Colin McRae Rally 04;FreeTrack20;V160;;;8103;0040D13C2A843DA526A610 -65;Comanche;FreeTrack20;V160;;;2275;00414097C36A12BA32BA00 -66;Combat Flight Simulator 3;FreeTrack20;V160;V;V4Friend;2304;00420EC5F763AB21CA7310 -67;Combat Helo;FreeTrack20;V160;;;2001;004329DFA863FAE1EA7300 +24;ArmA;FreeTrack20;V160;V;EmBeES;10601;0018F2F27A57631A40F200 +25;ArmA 2;FreeTrack20;V170;V;V4Friend Ronski;7502;0019EB3616B3A44F05B900 +26;ArmA 2 Operation Arrowhead;FreeTrack20;V160;V;vn88holden;0;001ABC224B7783DAF0D500 +27;ArmA 3;FreeTrack20;V170;;;7503;001BB69411ABD4E2B39900 +28;Armored Assault - Gold Edition;FreeTrack20;V170;;;1303;001CA7F7CAA00814ECA700 +29;Arvoch Alliance;FreeTrack20;V160;;;14908;001D318F8773BAE29A9300 +30;Arvoch Conflict;FreeTrack20;V160;;;14901;001E5C1FDE722DAE2BA900 +31;Auditory Displays for the blind;FreeTrack20;V160;;;20035;001F0FC9FF862F9D34BA00 +486;Autodesk;FreeTrack20;V160;;;20755;01E6953FA7F759AF33AC00 +32;AV Core Technology;FreeTrack20;V160;;;20016;00204655E791166FEB5300 +33;AVRS;FreeTrack20;V160;;;20340;0021231517525830F41D00 +482;B.O.M.B.;FreeTrack20;V160;;;3325;01E248ECCB81191AD49F00 +34;BAE Systems HILAS cockpit;FreeTrack20;V160;;;20019;00220D9C887FD88E98B300 +35;Battle of Britain (iENT);FreeTrack20;V170;;;1305;00230BA119195B701AED00 +36;Battle of Britain II - Wings of Victory;FreeTrack20;V160;V;Normalguy;7001;002452135882CA6419E200 +37;Battlecruiser;FreeTrack20;V160;;;6101;00257C822098728A442900 +38;Battlefield 2;FreeTrack20;V170;;;9601;0026B1560A2A7327659200 +39;Battlefield 2 Trauma Studios;FreeTrack20;V160;;;6501;002720C7529B733AE2EA00 +40;Battlefield 2142;FreeTrack20;V170;;;9602;00281C739AD3817FD43300 +41;Battleground Europe : World War II Online;FreeTrack20;V160;;;3301;0029F07957792CAD3DAF00 +42;Battleground Europe : WWII Online;FreeTrack20;V160;;;11201;002A985017330A844A1200 +43;Beckman Institute UIUC;FreeTrack20;V160;;;20012;002BB59DEFA8322A926A00 +44;Beyond The Red Line;FreeTrack20;V160;;;13301;002CE7A7FAA27424BA2A00 +45;BF2 (Unsupported Demo);FreeTrack20;V160;;;9651;002DC6371D86156AEB6000 +46;Big Scale Racing;FreeTrack20;V160;;;8301;002E4655E7A24ADDB99200 +47;Birds of Prey;FreeTrack20;V160;;;1601;002FBF8C4EAA57730B3200 +48;Birds of Steel;FreeTrack20;V160;;;1878;0030D7690F607233A21E00 +49;Boeing;FreeTrack20;V160;;;20351;0031044872BA630A033E00 +50;Boeing Demo;FreeTrack20;V160;;;20350;003228C57B369A37B13600 +51;Bomber Squadron;FreeTrack20;V160;;;1850;00338481733B9E32A83A00 +52;Brain-IT Group;FreeTrack20;V160;;;20050;0034E482F5772C9330B100 +53;Brothers In Arms;FreeTrack20;V160;;;13501;003503FB872CA8439D1F00 +82;C-Spine;FreeTrack20;V160;;;4901;00525FD692C188FB8B2D00 +54;C.A.R.S.;FreeTrack20;V170;;;2825;003698EFE2EB6EE8E11300 +55;C.U.B.;FreeTrack20;V160;;;20505;0037848174F986FD85F500 +56;CameraGripTools;FreeTrack20;V160;;;20150;003870A8B761FA524A4200 +57;Caterpillar Simulators;FreeTrack20;V160;;;23080;0039F52E4221742FA63100 +58;CCG Metamedia;FreeTrack20;V160;;;20009;003A6FA8A8DD86FE8BDB00 +59;CEWIT Immersive Cabin;FreeTrack20;V160;;;20370;003B90B5780C90078DEE00 +60;Chopper;FreeTrack20;V160;;;3150;003CC166C8632A32EA2300 +61;Clearbox;FreeTrack20;V160;;;20565;003D5C1FDE74279D1DB800 +62;CNKFsoft;FreeTrack20;V160;;;20495;003ED7690F6073187B0000 +487;Cognitics;FreeTrack20;V160;;;20760;01E715A96D19515BFC1500 +63;Colin McRae DiRT 2;FreeTrack20;V170;V;V4Friend;8107;003F7815C5379491C73300 +64;Colin McRae Rally 04;FreeTrack20;V160;;;8103;0040D13C2A843DA526A610 +65;Comanche;FreeTrack20;V160;;;2275;00414097C36A12BA32BA00 +66;Combat Flight Simulator 3;FreeTrack20;V160;V;V4Friend;2304;00420EC5F763AB21CA7310 +67;Combat Helo;FreeTrack20;V160;;;2001;004329DFA863FAE1EA7300 515;Combined Arms;FreeTrack20;V160;;;1309;0203387EDB1A5AFEADB600 -68;Commandos Strike Force;FreeTrack20;V160;;;8801;0044C1BBF892DB037A7200 -69;Concept RS;FreeTrack20;V160;;;10701;004537971697736A72DA00 -70;Condor: The Competitive Soaring Simulator;FreeTrack20;V160;V;MicheleF;5901;004670A8B762DA623A1300 -71;Conflict Taiwan;FreeTrack20;V160;;;1950;0047D7690F6073399E2000 -72;Corys;FreeTrack20;V160;;;20550;0048157D78738A342A8D00 -73;Counter Strike;FreeTrack20;V160;;;12501;004953FE1E862AB73DA600 -74;Crane Simulator;FreeTrack20;V160;;;20048;004A6B62C6A7931972DA00 -75;Crashday;FreeTrack20;V160;;;5601;004BD6E585F893D933BA00 -76;Creanex Training Simulator;FreeTrack20;V160;;;20205;004CF478D277A40A929A00 -77;Creative Labs headset;FreeTrack20;V160;;;20018;004D348B1743E961FA6300 -78;Cross Racing Championship;FreeTrack20;V160;;;4801;004E20C763AB232B5E8900 -79;Crysis Mod;FreeTrack20;V160;;;1625;004F90B57839B231A24200 -80;Crystal Growth Simulation;FreeTrack20;V160;;;20029;005026F79742FB241A6200 -81;Crytek;FreeTrack20;V170;;;2775;0051D5F1EBBAD81C714600 -83;D2x-XL;FreeTrack20;V160;;;16001;00532E20237BEDABEB8A00 -84;Dark Horizons Lore;FreeTrack20;V160;;;7901;005487801A852AA7385200 -85;Dawn of Aces - Gold Edition;FreeTrack20;V170;;;1304;0055A9ED7700814190DE00 -86;Dawn of Aces II;FreeTrack20;V160;;;1302;00566925967C2BB0285500 +68;Commandos Strike Force;FreeTrack20;V160;;;8801;0044C1BBF892DB037A7200 +69;Concept RS;FreeTrack20;V160;;;10701;004537971697736A72DA00 +70;Condor: The Competitive Soaring Simulator;FreeTrack20;V160;V;MicheleF;5901;004670A8B762DA623A1300 +71;Conflict Taiwan;FreeTrack20;V160;;;1950;0047D7690F6073399E2000 +72;Corys;FreeTrack20;V160;;;20550;0048157D78738A342A8D00 +73;Counter Strike;FreeTrack20;V160;;;12501;004953FE1E862AB73DA600 +74;Crane Simulator;FreeTrack20;V160;;;20048;004A6B62C6A7931972DA00 +75;Crashday;FreeTrack20;V160;;;5601;004BD6E585F893D933BA00 +76;Creanex Training Simulator;FreeTrack20;V160;;;20205;004CF478D277A40A929A00 +77;Creative Labs headset;FreeTrack20;V160;;;20018;004D348B1743E961FA6300 +78;Cross Racing Championship;FreeTrack20;V160;;;4801;004E20C763AB232B5E8900 +79;Crysis Mod;FreeTrack20;V160;;;1625;004F90B57839B231A24200 +80;Crystal Growth Simulation;FreeTrack20;V160;;;20029;005026F79742FB241A6200 +81;Crytek;FreeTrack20;V170;;;2775;0051D5F1EBBAD81C714600 +83;D2x-XL;FreeTrack20;V160;;;16001;00532E20237BEDABEB8A00 +84;Dark Horizons Lore;FreeTrack20;V160;;;7901;005487801A852AA7385200 +85;Dawn of Aces - Gold Edition;FreeTrack20;V170;;;1304;0055A9ED7700814190DE00 +86;Dawn of Aces II;FreeTrack20;V160;;;1302;00566925967C2BB0285500 513;Dawn of Aces/Red Baron;FreeTrack20;V160;;;1307;0201916C14F32918D9B800 -87;DBS WalkAndFollow;FreeTrack20;V160;;;2525;005770A8B77008BDE89200 -88;DCS: Black Shark;FreeTrack20;V170;V;EmBeES;1006;0058F688FC9B0556868F00 -89;DCS: A-10C Warthog (32 and 64 bit);FreeTrack20;V170;V;fabri91 Shadow;1003;0059B6DCD15F5A572F6500 -90;Dead Reckoning;FreeTrack20;V160;;;10401;005A4C2F6752F912D66200 -91;Delivery;FreeTrack20;V160;;;15901;005BF3E85B1A8534AE3400 -471;Demon Core;FreeTrack20;V160;;;3225;01D7D1DC6052A165A7AC00 -92;DiRT;FreeTrack20;V160;;;8104;005C72456F7523881F1800 -93;DiRT 3;FreeTrack20;V170;;;8108;005DABA016ED2DFBDF6F00 -94;Door3;FreeTrack20;V160;;;20665;005ED13C2A853DA82F6B00 -95;Down In Flames;FreeTrack20;V160;;;1025;005F29DFA873FB82A66000 -96;Driver Test;FreeTrack20;V160;;;20265;00609343487C3FAA429D00 -97;Driver's Republic;FreeTrack20;V160;;;14001;0061D24C3F8A3F9C33AB00 -98;DriveSim;FreeTrack20;V160;;;5001;0062DD7CC2B47830A14400 -99;Driving Simulator;FreeTrack20;V160;;;13001;00630AC67539AC3F9F3A00 -100;dSphere TBA;FreeTrack20;V160;;;2425;0064A2AE4981FB5389A300 -101;DTS;FreeTrack20;V160;;;20625;006505B37C12868B3E8500 -102;Dungeons and Dragons Online;FreeTrack20;V170;;;1575;0066BD4D4DDC6BB6818800 -103;DY Demo;FreeTrack20;V160;;;20345;006727D5047A15540F9D00 -104;EADS Testing;FreeTrack20;V160;;;20303;00680288709760D5512900 +87;DBS WalkAndFollow;FreeTrack20;V160;;;2525;005770A8B77008BDE89200 +88;DCS: Black Shark;FreeTrack20;V170;V;EmBeES;1006;0058F688FC9B0556868F00 +89;DCS: A-10C Warthog (32 and 64 bit);FreeTrack20;V170;V;fabri91 Shadow;1003;0059B6DCD15F5A572F6500 +90;Dead Reckoning;FreeTrack20;V160;;;10401;005A4C2F6752F912D66200 +91;Delivery;FreeTrack20;V160;;;15901;005BF3E85B1A8534AE3400 +471;Demon Core;FreeTrack20;V160;;;3225;01D7D1DC6052A165A7AC00 +92;DiRT;FreeTrack20;V160;;;8104;005C72456F7523881F1800 +93;DiRT 3;FreeTrack20;V170;;;8108;005DABA016ED2DFBDF6F00 +94;Door3;FreeTrack20;V160;;;20665;005ED13C2A853DA82F6B00 +95;Down In Flames;FreeTrack20;V160;;;1025;005F29DFA873FB82A66000 +96;Driver Test;FreeTrack20;V160;;;20265;00609343487C3FAA429D00 +97;Driver's Republic;FreeTrack20;V160;;;14001;0061D24C3F8A3F9C33AB00 +98;DriveSim;FreeTrack20;V160;;;5001;0062DD7CC2B47830A14400 +99;Driving Simulator;FreeTrack20;V160;;;13001;00630AC67539AC3F9F3A00 +100;dSphere TBA;FreeTrack20;V160;;;2425;0064A2AE4981FB5389A300 +101;DTS;FreeTrack20;V160;;;20625;006505B37C12868B3E8500 +102;Dungeons and Dragons Online;FreeTrack20;V170;;;1575;0066BD4D4DDC6BB6818800 +103;DY Demo;FreeTrack20;V160;;;20345;006727D5047A15540F9D00 +104;EADS Testing;FreeTrack20;V160;;;20303;00680288709760D5512900 504;EAFIT;FreeTrack20;V160;;;20810;01F8D2675ABC163E99B000 -105;Eagle Lander 3D;FreeTrack20;V160;;;11901;00697686E5A7B209C27900 -106;EasyVR;FreeTrack20;V160;;;20220;006A68292872FAC4588100 -107;ECA-Sindel;FreeTrack20;V160;;;20590;006BC5BEE479FD75FB8500 +105;Eagle Lander 3D;FreeTrack20;V160;;;11901;00697686E5A7B209C27900 +106;EasyVR;FreeTrack20;V160;;;20220;006A68292872FAC4588100 +107;ECA-Sindel;FreeTrack20;V160;;;20590;006BC5BEE479FD75FB8500 508;Elite: Dangerous;FreeTrack20;V170;;;3475;0D93A9485EECA12E18BE00 -481;Embers of Caerus;FreeTrack20;V170;;;3275;0CCB4134258D7E10119E00 -108;EMS Simulations;FreeTrack20;V160;;;20390;006CA59E687D1589DE8500 -109;Enemy Engaged 2;FreeTrack20;V160;;;2102;006D010873EA635AEDC800 -110;Enemy Engaged: Commanche vs Hokum;FreeTrack20;V160;;;2101;006E157D789379636AED00 +481;Embers of Caerus;FreeTrack20;V170;;;3275;0CCB4134258D7E10119E00 +108;EMS Simulations;FreeTrack20;V160;;;20390;006CA59E687D1589DE8500 +109;Enemy Engaged 2;FreeTrack20;V160;;;2102;006D010873EA635AEDC800 +110;Enemy Engaged: Commanche vs Hokum;FreeTrack20;V160;;;2101;006E157D789379636AED00 524;Enemy Starfighter;FreeTrack20;V160;;;3725;020C7EF3AC4F08C8787600 -111;Envision TE;FreeTrack20;V160;;;20320;006FD13C2A863CAF26AB00 -112;EON Reality;FreeTrack20;V160;;;20410;0070B6C6142771F82EE900 -113;eSigma;FreeTrack20;V160;;;20700;0071950F9AA60DAD2E9F00 -114;Euro Truck Simulator;FreeTrack20;V160;V;mamsa;13602;00721B4BFF8B3EA3296600 -115;EVE Online;FreeTrack20;V160;;;11801;0073F47CC377C2388DC900 -116;Eventology;FreeTrack20;V160;;;12201;0074849F8B469C2BAC3600 -117;EVOC-101 Training;FreeTrack20;V160;;;20038;00756925967D2088FC6200 -118;Evochron Alliance 2.0;FreeTrack20;V160;;;14904;00767A32A1A8735A022900 -119;Evochron Legends;FreeTrack20;V160;;;14906;0077D6E585F8B41A12BA00 -120;Evochron Mercenary;FreeTrack20;V160;V;Scavenger4711 ;14907;00783752FBC7B42B221A00 -121;Evochron Renegades;FreeTrack20;V160;;;14905;0079621E7763FB421A1300 -122;EZCA;FreeTrack20;V160;V;dennison ;2475;007A6DBB52F7B147510601 -125;F-22 Total Air War;FreeTrack20;V160;;;1750;007D20C79F475F0621DB00 -126;F-35 PTA;FreeTrack20;V160;;;20185;007E26F7977E96C0352100 -148;F-Trainer;FreeTrack20;V160;;;20615;0094C6371D8AFB8C3E9900 -123;F1 2011/2012;FreeTrack20;V170;;;8109;007B265ECD74893EA12900 -124;F1 Challenge 99-02;FreeTrack20;V160;;;4401;007CA15F278FB660C9D210 -127;FAAC;FreeTrack20;V160;;;20500;007F0F00F489118300C000 -128;Farmer Simulator 2009;FreeTrack20;V160;;;1725;0080926ED8A1EB628AB300 -129;Faros Driving Simulator;FreeTrack20;V160;;;8001;0081B1C6647A1EA839A800 -130;Faubert Lab Car Simulator;FreeTrack20;V160;;;20480;00822E542A7F2DB61F9700 -131;Ferrari Virtual Academy;FreeTrack20;V160;V;sosna1983 ;0;0083C0AF8C24B62D974000 -132;FIFA 09;FreeTrack20;V170;;;9002;0084288979C65B0DAA0D00 -133;Fighter Ace;FreeTrack20;V160;;;8401;0085E2D1D77D259837B700 -134;Fighter Ops;FreeTrack20;V160;;;9301;00860FC9FF8B23A033BA00 -135;Fighter Squadron: Screamin Demons Over Europe;FreeTrack20;V160;;;1675;00872E20237D259A27A600 -136;First Eagles Wings Over Europe Strike Fighters;FreeTrack20;V160;;;1101;0088311857638A73BB7E00 -469;Flight Gear;FreeTrack20;V160;;;12901;01D5D896C66B030606E000 -466;Flight Simulator 2002;FreeTrack20;V160;;;2302;01D21F7650E254B4514B00 -467;Flight Simulator 2004;FreeTrack20;V160;;;2303;01D3E91BAAB385B2362E00 -468;Flight Simulator X;FreeTrack20;V160;;;2305;01D41C31F42FAF32603600 -137;FlightGear;FlightGear;V110;V;V4Friend;0;0089054E8839A02FAB2F00 -138;Flyboys / Warbirds;FreeTrack20;V160;;;1301;008ABB5BF72C8934AB2B00 -139;Flyer;FreeTrack20;V160;;;1650;008BD1C9F27826AE2CA500 -140;Flying Tigers;FreeTrack20;V160;;;7002;008C91D997F29A930B0200 -141;FlyingGuns;FreeTrack20;V160;;;14801;008D7A32A1A882BAA28A00 -142;Ford Racing 3;FreeTrack20;V160;;;6901;008E27D5047C2BA62F5800 -143;Free Falcon 4.0;FreeTrack20;V160;;;1901;008F157D78A3B962E55000 -144;Free Falcon 4.0: Allied Force;FreeTrack20;V160;;;8901;0090656DD6793CA9325900 -145;Free Falcon 5;FreeTrack20;V160;V;V4Friend;1902;00911038C3AAB32590E900 -146;FreeSpace2;FreeTrack20;V160;;;13302;0092C8CDF8C2EA63496300 -147;FTAlpha;FreeTrack20;V160;;;20270;00936C69677F1D772AA900 -149;Full Out;FreeTrack20;V160;;;1701;009527D5047C31A0375800 -150;Future Pinball;FreeTrack20;V160;V;V4Friend;13101;00969343487E42B541AA00 -151;Game VR;FreeTrack20;V160;;;20325;009756BA018030B0355500 -152;GameLab;FreeTrack20;V160;;;20555;00985485D891DB23092200 -472;Games Farm;FreeTrack20;V160;;;3250;01D875C0981E627E5C7600 -153;Gamma;FreeTrack20;V160;;;1050;009921007D1B9D38A76F00 +111;Envision TE;FreeTrack20;V160;;;20320;006FD13C2A863CAF26AB00 +112;EON Reality;FreeTrack20;V160;;;20410;0070B6C6142771F82EE900 +113;eSigma;FreeTrack20;V160;;;20700;0071950F9AA60DAD2E9F00 +114;Euro Truck Simulator;FreeTrack20;V160;V;mamsa;13602;00721B4BFF8B3EA3296600 +115;EVE Online;FreeTrack20;V160;;;11801;0073F47CC377C2388DC900 +116;Eventology;FreeTrack20;V160;;;12201;0074849F8B469C2BAC3600 +117;EVOC-101 Training;FreeTrack20;V160;;;20038;00756925967D2088FC6200 +118;Evochron Alliance 2.0;FreeTrack20;V160;;;14904;00767A32A1A8735A022900 +119;Evochron Legends;FreeTrack20;V160;;;14906;0077D6E585F8B41A12BA00 +120;Evochron Mercenary;FreeTrack20;V160;V;Scavenger4711 ;14907;00783752FBC7B42B221A00 +121;Evochron Renegades;FreeTrack20;V160;;;14905;0079621E7763FB421A1300 +122;EZCA;FreeTrack20;V160;V;dennison ;2475;007A6DBB52F7B147510601 +125;F-22 Total Air War;FreeTrack20;V160;;;1750;007D20C79F475F0621DB00 +126;F-35 PTA;FreeTrack20;V160;;;20185;007E26F7977E96C0352100 +148;F-Trainer;FreeTrack20;V160;;;20615;0094C6371D8AFB8C3E9900 +123;F1 2011/2012;FreeTrack20;V170;;;8109;007B265ECD74893EA12900 +124;F1 Challenge 99-02;FreeTrack20;V160;;;4401;007CA15F278FB660C9D210 +127;FAAC;FreeTrack20;V160;;;20500;007F0F00F489118300C000 +128;Farmer Simulator 2009;FreeTrack20;V160;;;1725;0080926ED8A1EB628AB300 +129;Faros Driving Simulator;FreeTrack20;V160;;;8001;0081B1C6647A1EA839A800 +130;Faubert Lab Car Simulator;FreeTrack20;V160;;;20480;00822E542A7F2DB61F9700 +131;Ferrari Virtual Academy;FreeTrack20;V160;V;sosna1983 ;0;0083C0AF8C24B62D974000 +132;FIFA 09;FreeTrack20;V170;;;9002;0084288979C65B0DAA0D00 +133;Fighter Ace;FreeTrack20;V160;;;8401;0085E2D1D77D259837B700 +134;Fighter Ops;FreeTrack20;V160;;;9301;00860FC9FF8B23A033BA00 +135;Fighter Squadron: Screamin Demons Over Europe;FreeTrack20;V160;;;1675;00872E20237D259A27A600 +136;First Eagles Wings Over Europe Strike Fighters;FreeTrack20;V160;;;1101;0088311857638A73BB7E00 +469;Flight Gear;FreeTrack20;V160;;;12901;01D5D896C66B030606E000 +466;Flight Simulator 2002;FreeTrack20;V160;;;2302;01D21F7650E254B4514B00 +467;Flight Simulator 2004;FreeTrack20;V160;;;2303;01D3E91BAAB385B2362E00 +468;Flight Simulator X;FreeTrack20;V160;;;2305;01D41C31F42FAF32603600 +137;FlightGear;FlightGear;V110;V;V4Friend;0;0089054E8839A02FAB2F00 +138;Flyboys / Warbirds;FreeTrack20;V160;;;1301;008ABB5BF72C8934AB2B00 +139;Flyer;FreeTrack20;V160;;;1650;008BD1C9F27826AE2CA500 +140;Flying Tigers;FreeTrack20;V160;;;7002;008C91D997F29A930B0200 +141;FlyingGuns;FreeTrack20;V160;;;14801;008D7A32A1A882BAA28A00 +142;Ford Racing 3;FreeTrack20;V160;;;6901;008E27D5047C2BA62F5800 +143;Free Falcon 4.0;FreeTrack20;V160;;;1901;008F157D78A3B962E55000 +144;Free Falcon 4.0: Allied Force;FreeTrack20;V160;;;8901;0090656DD6793CA9325900 +145;Free Falcon 5;FreeTrack20;V160;V;V4Friend;1902;00911038C3AAB32590E900 +146;FreeSpace2;FreeTrack20;V160;;;13302;0092C8CDF8C2EA63496300 +147;FTAlpha;FreeTrack20;V160;;;20270;00936C69677F1D772AA900 +149;Full Out;FreeTrack20;V160;;;1701;009527D5047C31A0375800 +150;Future Pinball;FreeTrack20;V160;V;V4Friend;13101;00969343487E42B541AA00 +151;Game VR;FreeTrack20;V160;;;20325;009756BA018030B0355500 +152;GameLab;FreeTrack20;V160;;;20555;00985485D891DB23092200 +472;Games Farm;FreeTrack20;V160;;;3250;01D875C0981E627E5C7600 +153;Gamma;FreeTrack20;V160;;;1050;009921007D1B9D38A76F00 503;Garry's Mod;FreeTrack20;V160;;;12503;01F74EEB71FA7F37856900 -483;Generic Robotics;FreeTrack20;V160;;;20750;01E3FE7B4F05872A415400 -475;Glider Sim;FreeTrack20;V160;;;20720;01DB42130C4B0620871C00 -154;Global Ground Support Deicing Simulation;FreeTrack20;V160;;;20330;009ACFE709237A3AA11F00 -155;GosNIIAS Sim Trainer;FreeTrack20;V160;;;20355;009BB78B06EC8A2DB81800 -156;Gothic 3;FreeTrack20;V160;;;14401;009C37971697B36AD32A00 -157;Grand Prix Legends;FreeTrack20;V160;;;6701;009D521358D3D933B96E01 -158;Grand Theft Auto: San Andreas;FreeTrack20;V160;;;7808;009E5F3D95777D3BA23700 -159;GRID;FreeTrack20;V160;V;LeapoEclipse ;8105;009FD8175F8D1D7C0D3800 -160;GSE Power Plant Simulation;FreeTrack20;V160;;;20044;00A0432C28C217BEF93300 -161;GT Legends;FreeTrack20;V160;V;TrickyDee ;3902;00A116BC08020581CA8200 -162;GTR;FreeTrack20;V160;;;3901;00A2FD6BFE39A881B85B00 -163;GTR2 EVO;FreeTrack20;V160;V;zild1221 ;0;00A34B0FC37B2198F96300 -164;Gun Commander;FreeTrack20;V160;;;2675;00A4E2D1D77E319FEE8600 +483;Generic Robotics;FreeTrack20;V160;;;20750;01E3FE7B4F05872A415400 +475;Glider Sim;FreeTrack20;V160;;;20720;01DB42130C4B0620871C00 +154;Global Ground Support Deicing Simulation;FreeTrack20;V160;;;20330;009ACFE709237A3AA11F00 +155;GosNIIAS Sim Trainer;FreeTrack20;V160;;;20355;009BB78B06EC8A2DB81800 +156;Gothic 3;FreeTrack20;V160;;;14401;009C37971697B36AD32A00 +157;Grand Prix Legends;FreeTrack20;V160;;;6701;009D521358D3D933B96E01 +158;Grand Theft Auto: San Andreas;FreeTrack20;V160;;;7808;009E5F3D95777D3BA23700 +159;GRID;FreeTrack20;V160;V;LeapoEclipse ;8105;009FD8175F8D1D7C0D3800 +160;GSE Power Plant Simulation;FreeTrack20;V160;;;20044;00A0432C28C217BEF93300 +161;GT Legends;FreeTrack20;V160;V;TrickyDee ;3902;00A116BC08020581CA8200 +162;GTR;FreeTrack20;V160;;;3901;00A2FD6BFE39A881B85B00 +163;GTR2 EVO;FreeTrack20;V160;V;zild1221 ;0;00A34B0FC37B2198F96300 +164;Gun Commander;FreeTrack20;V160;;;2675;00A4E2D1D77E319FEE8600 520;H1Z1;FreeTrack20;V170;;;6004;1774F090B1BA9E782D0800 -165;Half Life 2;FreeTrack20;V160;;;7806;00A556BA018130AF365500 -166;Halo;FreeTrack20;V160;;;3801;00A656BA018130AF3F9C00 +165;Half Life 2;FreeTrack20;V160;;;7806;00A556BA018130AF365500 +166;Halo;FreeTrack20;V160;;;3801;00A656BA018130AF3F9C00 502;hapTEL;FreeTrack20;V160;;;20805;01F63ADE510A20446B6A00 -167;Hardware Control Simulator Railway Electronics;FreeTrack20;V160;;;20705;00A7F3E85B1A8930B42F00 -168;Harrier Attack II;FreeTrack20;V160;;;1175;00A8F2F27A57D20A940900 +167;Hardware Control Simulator Railway Electronics;FreeTrack20;V160;;;20705;00A7F3E85B1A8930B42F00 +168;Harrier Attack II;FreeTrack20;V160;;;1175;00A8F2F27A57D20A940900 499;Harry's Hard Choices Interactive;FreeTrack20;V160;;;20800;01F33A21BAE3DB6D48A000 -169;HAWX;FreeTrack20;V160;V;EmBeES ;0;00A9D615A9C8B088717000 -170;Herissons (Paris France);FreeTrack20;V160;;;20001;00AAEA1CBED8C20B430B00 +169;HAWX;FreeTrack20;V160;V;EmBeES ;0;00A9D615A9C8B088717000 +170;Herissons (Paris France);FreeTrack20;V160;;;20001;00AAEA1CBED8C20B430B00 523;hiCRANE2;FreeTrack20;V160;;;20835;020BA8FC8C7DFFA1381A00 -171;HOBI;FreeTrack20;V160;;;20335;00ABB253777F1779168900 -172;HoverAssault;FreeTrack20;V160;;;5303;00AC521358E3AA832A4000 -173;HPC;FreeTrack20;V160;;;20600;00AD0FC9FF8D0A7CEF9500 -174;HPG Tracking;FreeTrack20;V160;;;20255;00AE0288A1879D98930900 -175;HTW;FreeTrack20;V160;;;20630;00AF26F797911901C22C00 -176;Huawei Software;FreeTrack20;V160;;;20660;00B04655E8030A733AB300 -177;HueSpace;FreeTrack20;V160;;;20510;00B1231517C44960FB6300 -178;Hyper Vision;FreeTrack20;V160;;;15101;00B2DB242B657D43B32300 -179;iAmFootball;FreeTrack20;V160;;;1250;00B3B59DEFAAAFDB301A00 -180;id Research;FreeTrack20;V170;;;2950;00B4E723B873D7FC87D700 -181;IESA;FreeTrack20;V160;;;20037;00B5157D78D0E840AD7100 -182;IL-2 Cliffs of Dover;FreeTrack20;V160;V;V4Friend;0;00B6282282095F00521000 -183;IL-2 Forgotten Battles ACE Pacific Fighters;FreeTrack20;V160;V;Glenn;1001;00B722FD79137100621100 -484;IL-2 Sturmovik: Battle of Stalingrad;FreeTrack20;V170;;;1008;03F04D5368D1FD2DF2AE00 -184;Illumina;FreeTrack20;V160;;;1350;00B8054E8B39A33DB02400 -185;ILP;FreeTrack20;V160;;;20310;00B9F07957801789C9A600 -186;Imagine 3D ATC Tower Simulation;FreeTrack20;V160;;;20032;00BAEF7A8F4B8812B95300 -187;In Touch Technologies Inc.;FreeTrack20;V160;;;20006;00BB84817A3A5124B23D00 -188;Inglobe;FreeTrack20;V160;;;20360;00BCE7A7FAA27B2DA82700 -189;Innovatec Simulator;FreeTrack20;V160;;;20036;00BD22FD7935B23DB82C00 -190;Insurgency;FreeTrack20;V160;;;9401;00BEB6C61427B3EA744B00 -191;Intific;FreeTrack20;V160;;;20655;00BF2BCA747F2AA8309D00 -192;iRacing;FreeTrack20;V160;V;vn88holden ;14101;00C0103AF1AA730A236900 -193;IREQ Robotic Camera Control;FreeTrack20;V160;;;20027;00C10448E0E8618521EB00 -194;ISIC;FreeTrack20;V160;;;20680;00C2DEE3582F8F217E0B00 +171;HOBI;FreeTrack20;V160;;;20335;00ABB253777F1779168900 +172;HoverAssault;FreeTrack20;V160;;;5303;00AC521358E3AA832A4000 +173;HPC;FreeTrack20;V160;;;20600;00AD0FC9FF8D0A7CEF9500 +174;HPG Tracking;FreeTrack20;V160;;;20255;00AE0288A1879D98930900 +175;HTW;FreeTrack20;V160;;;20630;00AF26F797911901C22C00 +176;Huawei Software;FreeTrack20;V160;;;20660;00B04655E8030A733AB300 +177;HueSpace;FreeTrack20;V160;;;20510;00B1231517C44960FB6300 +178;Hyper Vision;FreeTrack20;V160;;;15101;00B2DB242B657D43B32300 +179;iAmFootball;FreeTrack20;V160;;;1250;00B3B59DEFAAAFDB301A00 +180;id Research;FreeTrack20;V170;;;2950;00B4E723B873D7FC87D700 +181;IESA;FreeTrack20;V160;;;20037;00B5157D78D0E840AD7100 +182;IL-2 Cliffs of Dover;FreeTrack20;V160;V;V4Friend;0;00B6282282095F00521000 +183;IL-2 Forgotten Battles ACE Pacific Fighters;FreeTrack20;V160;V;Glenn;1001;00B722FD79137100621100 +484;IL-2 Sturmovik: Battle of Stalingrad;FreeTrack20;V170;;;1008;03F04D5368D1FD2DF2AE00 +184;Illumina;FreeTrack20;V160;;;1350;00B8054E8B39A33DB02400 +185;ILP;FreeTrack20;V160;;;20310;00B9F07957801789C9A600 +186;Imagine 3D ATC Tower Simulation;FreeTrack20;V160;;;20032;00BAEF7A8F4B8812B95300 +187;In Touch Technologies Inc.;FreeTrack20;V160;;;20006;00BB84817A3A5124B23D00 +188;Inglobe;FreeTrack20;V160;;;20360;00BCE7A7FAA27B2DA82700 +189;Innovatec Simulator;FreeTrack20;V160;;;20036;00BD22FD7935B23DB82C00 +190;Insurgency;FreeTrack20;V160;;;9401;00BEB6C61427B3EA744B00 +191;Intific;FreeTrack20;V160;;;20655;00BF2BCA747F2AA8309D00 +192;iRacing;FreeTrack20;V160;V;vn88holden ;14101;00C0103AF1AA730A236900 +193;IREQ Robotic Camera Control;FreeTrack20;V160;;;20027;00C10448E0E8618521EB00 +194;ISIC;FreeTrack20;V160;;;20680;00C2DEE3582F8F217E0B00 506;ITCL;FreeTrack20;V160;;;20820;01FAD19412681DC9CC6100 -195;IVD Online;FreeTrack20;V160;;;20535;00C390B57E1D7DDD883D00 -196;J.J. Keller and Associates;FreeTrack20;V160;;;20002;00C4E482F57FE77CF46300 -197;Janes F18;FreeTrack20;V160;;;9001;00C55F3D9577802AAF2E00 -198;Javal Ent.;FreeTrack20;V160;;;2650;00C622FD7A28BA2FAEEA00 -199;JC Demo;FreeTrack20;V160;;;20470;00C70AC67B0A630D9B3900 -200;Jet Thunder;FreeTrack20;V160;;;4501;00C82100801FA4EA9A3500 -201;Jetfighter V;FreeTrack20;V160;;;2501;00C9F52E42217B33A63200 -202;JFIST;FreeTrack20;V160;;;20560;00CAC932727C0F8D208600 -203;John Deere Vehicle Simulator;FreeTrack20;V160;;;20175;00CB29DFA8D3FA92A66000 -204;Jump to Lightspeed;FreeTrack20;V160;;;6001;00CCC166C8D3FA12E52400 -205;Jumpgate;FreeTrack20;V160;;;15001;00CD26F797B32A63E99200 -206;Jumpgate Evolution;FreeTrack20;V170;;;15002;00CE5936D4F93DCE0CE700 -207;KAF Keymapper;FreeTrack20;V160;;;3101;00CF934348830E87EB8300 -476;KAI FLight Simulator;FreeTrack20;V160;;;20725;01DCC522132A5C01EDE500 -208;Key Macro View;FreeTrack20;V160;;;12001;00D016BC08431B1EF90100 -209;kiwi.vg;FreeTrack20;V160;;;20395;00D1409A430AB33633E900 +195;IVD Online;FreeTrack20;V160;;;20535;00C390B57E1D7DDD883D00 +196;J.J. Keller and Associates;FreeTrack20;V160;;;20002;00C4E482F57FE77CF46300 +197;Janes F18;FreeTrack20;V160;;;9001;00C55F3D9577802AAF2E00 +198;Javal Ent.;FreeTrack20;V160;;;2650;00C622FD7A28BA2FAEEA00 +199;JC Demo;FreeTrack20;V160;;;20470;00C70AC67B0A630D9B3900 +200;Jet Thunder;FreeTrack20;V160;;;4501;00C82100801FA4EA9A3500 +201;Jetfighter V;FreeTrack20;V160;;;2501;00C9F52E42217B33A63200 +202;JFIST;FreeTrack20;V160;;;20560;00CAC932727C0F8D208600 +203;John Deere Vehicle Simulator;FreeTrack20;V160;;;20175;00CB29DFA8D3FA92A66000 +204;Jump to Lightspeed;FreeTrack20;V160;;;6001;00CCC166C8D3FA12E52400 +205;Jumpgate;FreeTrack20;V160;;;15001;00CD26F797B32A63E99200 +206;Jumpgate Evolution;FreeTrack20;V170;;;15002;00CE5936D4F93DCE0CE700 +207;KAF Keymapper;FreeTrack20;V160;;;3101;00CF934348830E87EB8300 +476;KAI FLight Simulator;FreeTrack20;V160;;;20725;01DCC522132A5C01EDE500 +208;Key Macro View;FreeTrack20;V160;;;12001;00D016BC08431B1EF90100 +209;kiwi.vg;FreeTrack20;V160;;;20395;00D1409A430AB33633E900 521;Kongsberg GlobalSim;FreeTrack20;V160;;;20825;0209B2C573D990BF764700 -210;L-3;FreeTrack20;V160;;;20465;00D2F885EFA8DE67878B00 -211;L-3 Communications;FreeTrack20;V160;;;20051;00D3D6E585F92F765E7800 +210;L-3;FreeTrack20;V160;;;20465;00D2F885EFA8DE67878B00 +211;L-3 Communications;FreeTrack20;V160;;;20051;00D3D6E585F92F765E7800 522;LG Electronics;FreeTrack20;V160;;;20830;020A3678F5833D513DCA00 -212;Lionhead MGS Game Research;FreeTrack20;V160;;;15301;00D4C1BBF9227B238AE200 -213;Live For Speed;FreeTrack20;V160;V;zild1221 ;7101;00D528228526A833521300 -214;Live for Speed S2;FreeTrack20;V160;;;11601;00D63752FBC8235B923500 -218;Lock-On: Modern Air Combat;FreeTrack20;V160;;;1002;00DAAC156D903C993B6200 -215;Lockheed Martin Littoral Combat Ship simulator;FreeTrack20;V160;;;20025;00D771ED5E802A9827A000 -216;Lockheed Martin Prepar3D;SimConnect;V130;V;elelbe ;0;00D8D615A9C8F36932AA00 -217;LockOn: Flaming Cliffs 2;FreeTrack20;V170;V;EmBeES ;1005;00D9AFB0D279F3A6F72200 -219;London NHS;FreeTrack20;V160;;;20640;00DB2E2023832BA123A100 -220;Lore (Dark Horizons);FreeTrack20;V160;;;5302;00DCF478D27833DB62D500 -221;Love;FreeTrack20;V160;;;3125;00DD71ED5E802AAB214800 -222;Lucid Engine;FreeTrack20;V160;;;10501;00DE71ED5E803098259C00 +212;Lionhead MGS Game Research;FreeTrack20;V160;;;15301;00D4C1BBF9227B238AE200 +213;Live For Speed;FreeTrack20;V160;V;zild1221 ;7101;00D528228526A833521300 +214;Live for Speed S2;FreeTrack20;V160;;;11601;00D63752FBC8235B923500 +218;Lock-On: Modern Air Combat;FreeTrack20;V160;;;1002;00DAAC156D903C993B6200 +215;Lockheed Martin Littoral Combat Ship simulator;FreeTrack20;V160;;;20025;00D771ED5E802A9827A000 +216;Lockheed Martin Prepar3D;SimConnect;V130;V;elelbe ;0;00D8D615A9C8F36932AA00 +217;LockOn: Flaming Cliffs 2;FreeTrack20;V170;V;EmBeES ;1005;00D9AFB0D279F3A6F72200 +219;London NHS;FreeTrack20;V160;;;20640;00DB2E2023832BA123A100 +220;Lore (Dark Horizons);FreeTrack20;V160;;;5302;00DCF478D27833DB62D500 +221;Love;FreeTrack20;V160;;;3125;00DD71ED5E802AAB214800 +222;Lucid Engine;FreeTrack20;V160;;;10501;00DE71ED5E803098259C00 514;M4 Tank Brigade;FreeTrack20;V160;;;1308;02024ED5A3A26741604300 -223;M4 Tank Platoon;FreeTrack20;V160;;;1306;00DFDCC441A8E036320900 -224;Mach 1;FreeTrack20;V160;;;2575;00E0231518130942466000 -225;ManuVAR;FreeTrack20;V160;;;20455;00E153FE1E901CB0448800 -226;MaqSIM4;FreeTrack20;V160;;;20026;00E28F54A207D29B611700 -227;Mech Tactical Sim;FreeTrack20;V160;;;9501;00E3F3E85B1A8E34A53300 -228;Mechwarrior Online;FreeTrack20;V170;;;3025;00E414954226DB5D8CE200 +223;M4 Tank Platoon;FreeTrack20;V160;;;1306;00DFDCC441A8E036320900 +224;Mach 1;FreeTrack20;V160;;;2575;00E0231518130942466000 +225;ManuVAR;FreeTrack20;V160;;;20455;00E153FE1E901CB0448800 +226;MaqSIM4;FreeTrack20;V160;;;20026;00E28F54A207D29B611700 +227;Mech Tactical Sim;FreeTrack20;V160;;;9501;00E3F3E85B1A8E34A53300 +228;Mechwarrior Online;FreeTrack20;V170;;;3025;00E414954226DB5D8CE200 516;MechWarrior Online;FreeTrack20;V170;;;3026;0BD2E0DCBC723836CD2400 -229;Medical Image Visualization;FreeTrack20;V160;;;20295;00E59343488532A5359B00 -230;Meggitt Defense Systems;FreeTrack20;V160;;;20045;00E6926ED9122AB22AF300 -231;MetaVR;FreeTrack20;V160;;;20545;00E7C5BEE48120A8308800 -232;Meteoroid Maze;FreeTrack20;V160;;;13003;00E8F079578430AD2EB200 -233;MeVEA;FreeTrack20;V160;;;2250;00E9D24C3F933289028700 -234;Micro Flight;FreeTrack20;V160;V;V4Friend;5101;00EABA89D078439932EA00 -235;Microsoft ESP;FreeTrack20;V160;;;2306;00EB0AC67E30A63BA53F00 -236;Microsoft Flight;FreeTrack20;V170;V;V4Friend;2307;00ECAFBC54959539C51500 -237;Microsoft Flight Simulator 3;FreeTrack20;V160;V;V4Friend;0;00ED5909437D36963EA810 -238;Microsoft FS2002/2004;FSUIPC;V130;V;V4Friend;0;00EE44958F34992CB43A00 -239;Microsoft FSX;SimConnect;V130;V;V4Friend;0;00EFF478D278437A73AA00 -240;Microsoft Train Simulator;FreeTrack20;V160;;;7805;00F00449225A439A13FB00 -494;MiddleVR;FreeTrack20;V160;;;20785;01EE1227DF43CA90C26100 -241;Mig Alley;FreeTrack20;V160;;;1501;00F17686E5A83289CDA700 -242;Mimik Vehicle Simulator;FreeTrack20;V160;;;20585;00F2AB1D58A8E35A531A00 -243;Miner Wars;FreeTrack20;V160;;;2550;00F3C5BEE48124A234A400 -244;MKMapper Keymapper;FreeTrack20;V160;;;2201;00F487801A8E14822EA200 -245;ModelSim;FreeTrack20;V160;;;20540;00F544958F3A9A1FB11A00 -246;Morgan State University;FreeTrack20;V160;;;20010;00F65909437D3CA5339A00 -247;Motor Company;FreeTrack20;V160;;;11501;00F70288F37A629A7DD700 -248;Motorsport Simulators;FreeTrack20;V160;;;4201;00F8F52E42217E3DA63B00 -249;Mouse Emulation;FreeTrack20;V160;;;8501;00F9950F9A8E29B93A9700 -250;MS World Tour Kart 2004;FreeTrack20;V160;;;6601;00FA9F819CA27F10591600 -251;MSN Virtual Earth;FreeTrack20;V160;;;2309;00FBF47CC37842091DC900 -252;mTBI Balance;FreeTrack20;V160;;;20420;00FC72456F9E0E78145800 -253;NASA Crew Exploration Vehicle;FreeTrack20;V160;;;20017;00FD028900985FA5501A00 -254;NASCAR Heat;FreeTrack20;V160;;;2602;00FE311857E10880B84100 -255;NASCAR Racing 2003 season;FreeTrack20;V160;;;7804;00FFDE661F6D920B87FC10 -256;NASCAR SimRacing;FreeTrack20;V160;;;6201;01004098708870D761A500 -257;NecroVisioN;FreeTrack20;V160;;;15601;0101621E77F2EA830A8100 -258;NetKar Pro;FreeTrack20;V160;V;sosna1983 ;10901;01028C3958334A5169A300 -259;Nitro Stunt Racing;FreeTrack20;V160;;;13901;0103C0AF9428B82DA5ED00 -260;North Eastern University;FreeTrack20;V160;;;20003;0104A2AE4823BB7449DE00 -261;Novint;FreeTrack20;V160;;;2725;01051C76F8137B823A4300 -262;NVH Sound Simulator;FreeTrack20;V160;;;20695;010655A2AA93158DDE9500 -479;OHJCH;FreeTrack20;V160;;;20740;01DF992E6C0DA43A703600 -263;OMSI Bus Simulator;FreeTrack20;V160;V;Thiago ;2225;0107F47CC37861A9606600 -264;Onadime - Realtime Animation;FreeTrack20;V160;;;20049;010853FE1E9229A3339B00 -265;Open Falcon 4.5;FreeTrack20;V160;V;muplex ;0;0109B1C664832D9B385500 -266;Operation Air Assault 2;FreeTrack20;V160;;;5401;010ABB5BF72C9238973B00 -267;Operation Flashpoint 2 (inactive);FreeTrack20;V160;;;7601;010BD1C9F2812A9A399400 -268;Operation Flashpoint(r): Dragon Rising(tm);FreeTrack20;V170;;;8106;010C3328780E1322676100 -269;OptiMetrics;FreeTrack20;V160;;;20011;010D55A2AA942FB9288F00 -270;OpusFSX;FreeTrack20;V160;;;3175;010E1C76F8238B72D7C100 -271;Orbiter 2005 Plug-In;FreeTrack20;V160;;;10301;010F87801A903B9736A600 -272;Orbiter 2006;FreeTrack20;V160;V;Ripley;10303;0110D24C3F953F9526BA00 -273;Orbiter 2006 Plug-In;FreeTrack20;V160;;;10302;0111054E913F9931B72000 -274;Oryx Vehicle Simulators;FreeTrack20;V160;;;20028;0112C8CDF952EBA4763100 -275;Outer Conflict: Frontiers;FreeTrack20;V160;;;1900;01136C6967883EAA23AB00 -276;Over Flanders Fields;FreeTrack20;V160;V;Summelar ;2325;0114A59E68873E9B315210 -277;PanoPro;FreeTrack20;V160;;;20525;0115B6C61428231A23E900 -278;Paraworld;FreeTrack20;V160;;;14501;0116656DD6832BB62EB000 -279;Phoenix R/C;FreeTrack20;V160;;;3075;0117B6C61428238A334B00 -280;Pivot Maritime;FreeTrack20;V160;;;20365;01187686E5A8628AB2AA00 -281;PlanetSide 2;FreeTrack20;V170;;;6002;0119BB34B53FDC5C5AAF00 -474;PlanetSide 2 M.E.;FreeTrack20;V160;;;6003;01DA321EF31DA48C159A00 -282;Pointman;FreeTrack20;V160;;;7525;011ACFE70923833D9B2B00 -283;Power Driving Simulator;FreeTrack20;V160;;;20675;011BB78B06EC932DBC2F00 -470;Prepar3D;FreeTrack20;V160;;;20440;01D6DA768CE8AA43D8DC00 -284;Priston Tale;FreeTrack20;V160;;;9701;011C849F9642A030AC3600 -285;Project Reality (BF2 Mod);FreeTrack20;V160;;;9201;011D3C2C1C922CB239A800 -286;Project Torque (Invictus);FreeTrack20;V160;;;4802;011E612F28540B52797100 -287;Project X;FreeTrack20;V160;;;20022;011FE9D85E4842DA439900 -288;Quanser;FreeTrack20;V160;;;20435;0120950F9A922FA535A500 -289;QuantaDyn;FreeTrack20;V160;;;20575;012199BB5C9433A739B600 -290;Quest 3D Xframe Plugin;FreeTrack20;V160;;;20043;0122FD6BFE39A923C98200 -291;Quest3D;FreeTrack20;V160;;;1425;01234B0FC38542AB3BB700 -292;Quest3D - CINEACT integration;FreeTrack20;V160;;;20040;0124A15F28340AB3CA9000 -303;R-concept X (AdrenalinStorm);FreeTrack20;V160;;;9101;012F72456F83E6993AA600 -293;R.U.D.O. Tools;FreeTrack20;V160;;;20039;0125612F287FB9BEA76E00 -294;RACE (the WTCC game);FreeTrack20;V160;;;3904;01263C2C1C94FA86146300 -295;RACE 07 RACE GTR 2;FreeTrack20;V160;V;zild1221 TrickyDee ;3903;0127C0AF9800870056FD00 -296;RaceOn;FreeTrack20;V160;V;zild1221 ;0;0128621E7832AA82388200 -297;Racer;FreeTrack20;V160;;;2401;01296D2D103862E932EA00 -298;Racer S;FreeTrack20;V160;;;20030;012AEA1CBED961CA52CB00 -490;RaceRoom Racing Experience;FreeTrack20;V160;;;3905;01EA9124F663AF03BBC500 -299;Rail Simulator 1;FreeTrack20;V160;;;1550;012BB253778929A0395900 -300;Railway Work Simulator;FreeTrack20;V160;;;20225;012C91D998B1E9933B9100 -301;RailWorks 2;FreeTrack20;V160;;;2750;012D3919C4972D9D299000 +229;Medical Image Visualization;FreeTrack20;V160;;;20295;00E59343488532A5359B00 +230;Meggitt Defense Systems;FreeTrack20;V160;;;20045;00E6926ED9122AB22AF300 +231;MetaVR;FreeTrack20;V160;;;20545;00E7C5BEE48120A8308800 +232;Meteoroid Maze;FreeTrack20;V160;;;13003;00E8F079578430AD2EB200 +233;MeVEA;FreeTrack20;V160;;;2250;00E9D24C3F933289028700 +234;Micro Flight;FreeTrack20;V160;V;V4Friend;5101;00EABA89D078439932EA00 +235;Microsoft ESP;FreeTrack20;V160;;;2306;00EB0AC67E30A63BA53F00 +236;Microsoft Flight;FreeTrack20;V170;V;V4Friend;2307;00ECAFBC54959539C51500 +237;Microsoft Flight Simulator 3;FreeTrack20;V160;V;V4Friend;0;00ED5909437D36963EA810 +238;Microsoft FS2002/2004;FSUIPC;V130;V;V4Friend;0;00EE44958F34992CB43A00 +239;Microsoft FSX;SimConnect;V130;V;V4Friend;0;00EFF478D278437A73AA00 +240;Microsoft Train Simulator;FreeTrack20;V160;;;7805;00F00449225A439A13FB00 +494;MiddleVR;FreeTrack20;V160;;;20785;01EE1227DF43CA90C26100 +241;Mig Alley;FreeTrack20;V160;;;1501;00F17686E5A83289CDA700 +242;Mimik Vehicle Simulator;FreeTrack20;V160;;;20585;00F2AB1D58A8E35A531A00 +243;Miner Wars;FreeTrack20;V160;;;2550;00F3C5BEE48124A234A400 +244;MKMapper Keymapper;FreeTrack20;V160;;;2201;00F487801A8E14822EA200 +245;ModelSim;FreeTrack20;V160;;;20540;00F544958F3A9A1FB11A00 +246;Morgan State University;FreeTrack20;V160;;;20010;00F65909437D3CA5339A00 +247;Motor Company;FreeTrack20;V160;;;11501;00F70288F37A629A7DD700 +248;Motorsport Simulators;FreeTrack20;V160;;;4201;00F8F52E42217E3DA63B00 +249;Mouse Emulation;FreeTrack20;V160;;;8501;00F9950F9A8E29B93A9700 +250;MS World Tour Kart 2004;FreeTrack20;V160;;;6601;00FA9F819CA27F10591600 +251;MSN Virtual Earth;FreeTrack20;V160;;;2309;00FBF47CC37842091DC900 +252;mTBI Balance;FreeTrack20;V160;;;20420;00FC72456F9E0E78145800 +253;NASA Crew Exploration Vehicle;FreeTrack20;V160;;;20017;00FD028900985FA5501A00 +254;NASCAR Heat;FreeTrack20;V160;;;2602;00FE311857E10880B84100 +255;NASCAR Racing 2003 season;FreeTrack20;V160;;;7804;00FFDE661F6D920B87FC10 +256;NASCAR SimRacing;FreeTrack20;V160;;;6201;01004098708870D761A500 +257;NecroVisioN;FreeTrack20;V160;;;15601;0101621E77F2EA830A8100 +258;NetKar Pro;FreeTrack20;V160;V;sosna1983 ;10901;01028C3958334A5169A300 +259;Nitro Stunt Racing;FreeTrack20;V160;;;13901;0103C0AF9428B82DA5ED00 +260;North Eastern University;FreeTrack20;V160;;;20003;0104A2AE4823BB7449DE00 +261;Novint;FreeTrack20;V160;;;2725;01051C76F8137B823A4300 +262;NVH Sound Simulator;FreeTrack20;V160;;;20695;010655A2AA93158DDE9500 +479;OHJCH;FreeTrack20;V160;;;20740;01DF992E6C0DA43A703600 +263;OMSI Bus Simulator;FreeTrack20;V160;V;Thiago ;2225;0107F47CC37861A9606600 +264;Onadime - Realtime Animation;FreeTrack20;V160;;;20049;010853FE1E9229A3339B00 +265;Open Falcon 4.5;FreeTrack20;V160;V;muplex ;0;0109B1C664832D9B385500 +266;Operation Air Assault 2;FreeTrack20;V160;;;5401;010ABB5BF72C9238973B00 +267;Operation Flashpoint 2 (inactive);FreeTrack20;V160;;;7601;010BD1C9F2812A9A399400 +268;Operation Flashpoint(r): Dragon Rising(tm);FreeTrack20;V170;;;8106;010C3328780E1322676100 +269;OptiMetrics;FreeTrack20;V160;;;20011;010D55A2AA942FB9288F00 +270;OpusFSX;FreeTrack20;V160;;;3175;010E1C76F8238B72D7C100 +271;Orbiter 2005 Plug-In;FreeTrack20;V160;;;10301;010F87801A903B9736A600 +272;Orbiter 2006;FreeTrack20;V160;V;Ripley;10303;0110D24C3F953F9526BA00 +273;Orbiter 2006 Plug-In;FreeTrack20;V160;;;10302;0111054E913F9931B72000 +274;Oryx Vehicle Simulators;FreeTrack20;V160;;;20028;0112C8CDF952EBA4763100 +275;Outer Conflict: Frontiers;FreeTrack20;V160;;;1900;01136C6967883EAA23AB00 +276;Over Flanders Fields;FreeTrack20;V160;V;Summelar ;2325;0114A59E68873E9B315210 +277;PanoPro;FreeTrack20;V160;;;20525;0115B6C61428231A23E900 +278;Paraworld;FreeTrack20;V160;;;14501;0116656DD6832BB62EB000 +279;Phoenix R/C;FreeTrack20;V160;;;3075;0117B6C61428238A334B00 +280;Pivot Maritime;FreeTrack20;V160;;;20365;01187686E5A8628AB2AA00 +281;PlanetSide 2;FreeTrack20;V170;;;6002;0119BB34B53FDC5C5AAF00 +474;PlanetSide 2 M.E.;FreeTrack20;V160;;;6003;01DA321EF31DA48C159A00 +282;Pointman;FreeTrack20;V160;;;7525;011ACFE70923833D9B2B00 +283;Power Driving Simulator;FreeTrack20;V160;;;20675;011BB78B06EC932DBC2F00 +470;Prepar3D;FreeTrack20;V160;;;20440;01D6DA768CE8AA43D8DC00 +284;Priston Tale;FreeTrack20;V160;;;9701;011C849F9642A030AC3600 +285;Project Reality (BF2 Mod);FreeTrack20;V160;;;9201;011D3C2C1C922CB239A800 +286;Project Torque (Invictus);FreeTrack20;V160;;;4802;011E612F28540B52797100 +287;Project X;FreeTrack20;V160;;;20022;011FE9D85E4842DA439900 +288;Quanser;FreeTrack20;V160;;;20435;0120950F9A922FA535A500 +289;QuantaDyn;FreeTrack20;V160;;;20575;012199BB5C9433A739B600 +290;Quest 3D Xframe Plugin;FreeTrack20;V160;;;20043;0122FD6BFE39A923C98200 +291;Quest3D;FreeTrack20;V160;;;1425;01234B0FC38542AB3BB700 +292;Quest3D - CINEACT integration;FreeTrack20;V160;;;20040;0124A15F28340AB3CA9000 +303;R-concept X (AdrenalinStorm);FreeTrack20;V160;;;9101;012F72456F83E6993AA600 +293;R.U.D.O. Tools;FreeTrack20;V160;;;20039;0125612F287FB9BEA76E00 +294;RACE (the WTCC game);FreeTrack20;V160;;;3904;01263C2C1C94FA86146300 +295;RACE 07 RACE GTR 2;FreeTrack20;V160;V;zild1221 TrickyDee ;3903;0127C0AF9800870056FD00 +296;RaceOn;FreeTrack20;V160;V;zild1221 ;0;0128621E7832AA82388200 +297;Racer;FreeTrack20;V160;;;2401;01296D2D103862E932EA00 +298;Racer S;FreeTrack20;V160;;;20030;012AEA1CBED961CA52CB00 +490;RaceRoom Racing Experience;FreeTrack20;V160;;;3905;01EA9124F663AF03BBC500 +299;Rail Simulator 1;FreeTrack20;V160;;;1550;012BB253778929A0395900 +300;Railway Work Simulator;FreeTrack20;V160;;;20225;012C91D998B1E9933B9100 +301;RailWorks 2;FreeTrack20;V160;;;2750;012D3919C4972D9D299000 507;RailWorks 5 (TS2014);FreeTrack20;V160;;;1551;01FB8B5232CB1502C95A00 -302;Raydon Driving Simulator;FreeTrack20;V160;;;3701;012E5485D941DBE2FB5300 -304;Real Time Visual;FreeTrack20;V160;;;9901;0130B1C664862297365500 -305;RealFlight;FreeTrack20;V160;;;4001;0131AC6E87892E993A8B00 -306;Reality Manager;FreeTrack20;V160;;;20046;0132DB242B65872FA42A00 -307;RealWorld;FreeTrack20;V160;;;20215;0133B59DEFA9322A727800 -308;Red Baron 3D;FreeTrack20;V160;;;1125;0134C6371D96349CEB7A00 -309;Red Orchestra: Heroes of Stalingrad;FreeTrack20;V170;;;12602;013521F9121056CD997300 -310;Red Orchestra: Ostfront;FreeTrack20;V170;;;12601;01369A9A2BE97252BB9000 -311;Redline Monitor;FreeTrack20;V160;;;20210;01373752FBC8831A72AA00 -312;REFLEX XTR;FreeTrack20;V160;;;2150;0138054E94127D14881300 -313;Remote Presence;FreeTrack20;V160;;;20710;01399BC3BDA93229D2BB00 -314;rFactor;FreeTrack20;V160;V;V4Friend;7401;013AEF7A8F4B8AA0495200 -315;rFactor Pro;FreeTrack20;V170;;;7403;013B175198D74BE8E89600 -316;rFactor2;FreeTrack20;V170;;;7402;013CBFF3A86D34DA24C000 -317;Richard Burns Rally;FreeTrack20;V160;V;zild1221;3401;013D42868B339A31A73C10 -318;RidingStar;FreeTrack20;V160;;;1475;013E3919C497359826A700 -319;Rig N Roll;FreeTrack20;V160;;;9801;013FD1C9F284239CE68100 -320;Rio Tinto Resource Development;FreeTrack20;V160;;;20033;01401039831B5EC8D31900 -321;Rise of Flight;FreeTrack20;V160;V;Seborgarsen ;11401;0141AA71218335A51F5100 -322;Rise: The Vieneo Province;FreeTrack20;V160;;;6301;0142DEE3582F9837A82D00 -323;Rising Conflicts;FreeTrack20;V160;;;12101;014384818335A439B12F00 -492;RITS;FreeTrack20;V160;;;20775;01ECEE745B83DD3A0DBE00 -324;Road Legends;FreeTrack20;V160;;;1876;0144379716986369A2E600 -325;Rogue Space;FreeTrack20;V160;;;3050;014588F5872C9C30ABE900 -326;Rogue Warrior;FreeTrack20;V160;;;14202;0146432C2973D9D45A8E00 -327;ROV Sim;FreeTrack20;V160;;;20530;0147FA04BD27891D9ADD00 -328;Rowan's Battle Of Britain;FreeTrack20;V160;;;1502;014821008829A72CB4F300 -329;RSD Demo;FreeTrack20;V160;;;2050;0149BF8C4EAA5871A85D00 -330;RTMS Crane Sim;FreeTrack20;V160;;;20400;014AC93272841D91205200 -331;RTT DeltaGen Plugin;FreeTrack20;V160;;;20195;014B90B5871B8DDD7D3400 +302;Raydon Driving Simulator;FreeTrack20;V160;;;3701;012E5485D941DBE2FB5300 +304;Real Time Visual;FreeTrack20;V160;;;9901;0130B1C664862297365500 +305;RealFlight;FreeTrack20;V160;;;4001;0131AC6E87892E993A8B00 +306;Reality Manager;FreeTrack20;V160;;;20046;0132DB242B65872FA42A00 +307;RealWorld;FreeTrack20;V160;;;20215;0133B59DEFA9322A727800 +308;Red Baron 3D;FreeTrack20;V160;;;1125;0134C6371D96349CEB7A00 +309;Red Orchestra: Heroes of Stalingrad;FreeTrack20;V170;;;12602;013521F9121056CD997300 +310;Red Orchestra: Ostfront;FreeTrack20;V170;;;12601;01369A9A2BE97252BB9000 +311;Redline Monitor;FreeTrack20;V160;;;20210;01373752FBC8831A72AA00 +312;REFLEX XTR;FreeTrack20;V160;;;2150;0138054E94127D14881300 +313;Remote Presence;FreeTrack20;V160;;;20710;01399BC3BDA93229D2BB00 +314;rFactor;FreeTrack20;V160;V;V4Friend;7401;013AEF7A8F4B8AA0495200 +315;rFactor Pro;FreeTrack20;V170;;;7403;013B175198D74BE8E89600 +316;rFactor2;FreeTrack20;V170;;;7402;013CBFF3A86D34DA24C000 +317;Richard Burns Rally;FreeTrack20;V160;V;zild1221;3401;013D42868B339A31A73C10 +318;RidingStar;FreeTrack20;V160;;;1475;013E3919C497359826A700 +319;Rig N Roll;FreeTrack20;V160;;;9801;013FD1C9F284239CE68100 +320;Rio Tinto Resource Development;FreeTrack20;V160;;;20033;01401039831B5EC8D31900 +321;Rise of Flight;FreeTrack20;V160;V;Seborgarsen ;11401;0141AA71218335A51F5100 +322;Rise: The Vieneo Province;FreeTrack20;V160;;;6301;0142DEE3582F9837A82D00 +323;Rising Conflicts;FreeTrack20;V160;;;12101;014384818335A439B12F00 +492;RITS;FreeTrack20;V160;;;20775;01ECEE745B83DD3A0DBE00 +324;Road Legends;FreeTrack20;V160;;;1876;0144379716986369A2E600 +325;Rogue Space;FreeTrack20;V160;;;3050;014588F5872C9C30ABE900 +326;Rogue Warrior;FreeTrack20;V160;;;14202;0146432C2973D9D45A8E00 +327;ROV Sim;FreeTrack20;V160;;;20530;0147FA04BD27891D9ADD00 +328;Rowan's Battle Of Britain;FreeTrack20;V160;;;1502;014821008829A72CB4F300 +329;RSD Demo;FreeTrack20;V160;;;2050;0149BF8C4EAA5871A85D00 +330;RTMS Crane Sim;FreeTrack20;V160;;;20400;014AC93272841D91205200 +331;RTT DeltaGen Plugin;FreeTrack20;V160;;;20195;014B90B5871B8DDD7D3400 511;Sail;FreeTrack20;V160;;;3575;01FF2916D764159099F800 -332;Sail Simulator 5;FreeTrack20;V160;;;1975;014CE2D1D78A1D9A3B6300 -333;Sailors of the Sky;FreeTrack20;V160;;;10201;014D17BE02961FAF3AB100 -334;Santa Cruz Watermill;FreeTrack20;V160;;;20290;014E88F5881EA32FA7E900 -335;SCANeR Studio Plugin;FreeTrack20;V160;;;20445;014FA2AE4870F861E9A100 -336;SEGA Demo;FreeTrack20;V160;;;2075;015016BC08C117F1163000 -337;Seven-G;FreeTrack20;V160;;;2350;01510F00F49635B822A200 -338;SFSPC;FreeTrack20;V160;;;2801;0152F885EFA9400981B700 -339;Ship Simulator 2006;FreeTrack20;V160;;;5002;015329DFA9638AA2C66100 -340;Ship Simulator 2008;FreeTrack20;V160;V;djj3ff ;5003;01545213599339B3D52100 -341;Shiphandling Simulator;FreeTrack20;V160;;;20570;01553FD0FC9D8B37AD3700 -342;Shooting Simulator;FreeTrack20;V160;;;20047;0156F2F27A58827A63DA00 -343;SIA Games;FreeTrack20;V160;;;20015;0157926ED970685DA8D200 -344;Silent Wings;FreeTrack20;V160;;;8701;0158D615A9C96309C24A00 -345;SilverHat;FreeTrack20;V160;;;12401;0159D8175F99349F3F9600 -346;Simax Simulator;FreeTrack20;V160;;;20021;015AAC156D9736A331AD00 -347;Simball 4D;FreeTrack20;V160;;;20315;015BD6E585F99349F2AA00 -348;Simbionix;FreeTrack20;V160;;;20485;015CE7A7FAA28528AE1D00 +332;Sail Simulator 5;FreeTrack20;V160;;;1975;014CE2D1D78A1D9A3B6300 +333;Sailors of the Sky;FreeTrack20;V160;;;10201;014D17BE02961FAF3AB100 +334;Santa Cruz Watermill;FreeTrack20;V160;;;20290;014E88F5881EA32FA7E900 +335;SCANeR Studio Plugin;FreeTrack20;V160;;;20445;014FA2AE4870F861E9A100 +336;SEGA Demo;FreeTrack20;V160;;;2075;015016BC08C117F1163000 +337;Seven-G;FreeTrack20;V160;;;2350;01510F00F49635B822A200 +338;SFSPC;FreeTrack20;V160;;;2801;0152F885EFA9400981B700 +339;Ship Simulator 2006;FreeTrack20;V160;;;5002;015329DFA9638AA2C66100 +340;Ship Simulator 2008;FreeTrack20;V160;V;djj3ff ;5003;01545213599339B3D52100 +341;Shiphandling Simulator;FreeTrack20;V160;;;20570;01553FD0FC9D8B37AD3700 +342;Shooting Simulator;FreeTrack20;V160;;;20047;0156F2F27A58827A63DA00 +343;SIA Games;FreeTrack20;V160;;;20015;0157926ED970685DA8D200 +344;Silent Wings;FreeTrack20;V160;;;8701;0158D615A9C96309C24A00 +345;SilverHat;FreeTrack20;V160;;;12401;0159D8175F99349F3F9600 +346;Simax Simulator;FreeTrack20;V160;;;20021;015AAC156D9736A331AD00 +347;Simball 4D;FreeTrack20;V160;;;20315;015BD6E585F99349F2AA00 +348;Simbionix;FreeTrack20;V160;;;20485;015CE7A7FAA28528AE1D00 518;SimCraft;FreeTrack20;V160;;;3650;02065BA013963203CB1900 -349;SimCreator;FreeTrack20;V160;;;20520;015D3752FBC8935B001A00 -350;Simlog Personal Simulator;FreeTrack20;V160;;;20635;015E42868C33A435B53100 -351;SimQuest immersion system;FreeTrack20;V160;;;20023;015F6C69678C32A30FAE00 -352;SimSol;FreeTrack20;V160;;;20034;01602315187389E0FB5300 -491;Simumak;FreeTrack20;V160;;;20770;01EB119629980784DCE600 +349;SimCreator;FreeTrack20;V160;;;20520;015D3752FBC8935B001A00 +350;Simlog Personal Simulator;FreeTrack20;V160;;;20635;015E42868C33A435B53100 +351;SimQuest immersion system;FreeTrack20;V160;;;20023;015F6C69678C32A30FAE00 +352;SimSol;FreeTrack20;V160;;;20034;01602315187389E0FB5300 +491;Simumak;FreeTrack20;V160;;;20770;01EB119629980784DCE600 510;Sir You Are Being Hunted;FreeTrack20;V160;;;3550;01FEDAB345FA104ED4A100 -353;Sirocco Racing;FreeTrack20;V160;;;5801;01612BCA748925A6369A00 -354;Sky God: Military Freefall;FreeTrack20;V170;;;1526;01622C0104385FD1C44400 -355;Soft fx Demo;FreeTrack20;V160;;;2125;01632E20238A2B99335200 -356;Source Engine (Half-Life 2);FreeTrack20;V160;;;12502;0164E482F58829A739A600 -357;Space Shuttle Mission 2007;FreeTrack20;V160;V;purewhitewings ;1225;0165662B03863D912F9700 +353;Sirocco Racing;FreeTrack20;V160;;;5801;01612BCA748925A6369A00 +354;Sky God: Military Freefall;FreeTrack20;V170;;;1526;01622C0104385FD1C44400 +355;Soft fx Demo;FreeTrack20;V160;;;2125;01632E20238A2B99335200 +356;Source Engine (Half-Life 2);FreeTrack20;V160;;;12502;0164E482F58829A739A600 +357;Space Shuttle Mission 2007;FreeTrack20;V160;V;purewhitewings ;1225;0165662B03863D912F9700 517;Spaze;FreeTrack20;V160;;;3625;020573F9D3ED8C43B8DC00 -358;SRI;FreeTrack20;V160;;;20620;01663FD0FC9D8B218D8100 -359;Stanford University;FreeTrack20;V160;;;20004;0167CE35BAF9933A62AA00 +358;SRI;FreeTrack20;V160;;;20620;01663FD0FC9D8B218D8100 +359;Stanford University;FreeTrack20;V160;;;20004;0167CE35BAF9933A62AA00 500;Star Citizen;FreeTrack20;V170;;;3450;0D7AF4CE4E343EC6B4A200 -360;Starshatter;FreeTrack20;V160;;;6401;0168F079578A3F9A3BB600 -361;Steel Beasts 2;FreeTrack20;V160;;;11703;0169DCC441A9443A831A00 -362;Steel Beasts Pro;FreeTrack20;V160;;;11701;016A8F54A20833CAA23900 -363;Steel Beasts Pro Personal;FreeTrack20;V160;;;11702;016BF3E85B1A9443A73000 -364;Stoked Rider;FreeTrack20;V160;;;14701;016CC166C963EA32997300 -365;Storm of War: the Battle of Britain;FreeTrack20;V170;;;11001;016D8F54A68B71F25D0200 -495;STRAFT;FreeTrack20;V160;;;3375;01EF1329E014ADF98D6B00 -366;Stride;FreeTrack20;V170;;;2310;016EC784B21E4B21984400 -367;STS Driving Simulator;FreeTrack20;V160;;;20300;016FA59E688B1C89DE7600 -368;Sunaerosys;FreeTrack20;V160;;;20475;01700449831AF28973EB00 -369;Superkarting;FreeTrack20;V160;;;14903;0171DE661F6D973FA41F00 -370;SuperX Research;FreeTrack20;V160;;;15401;0172BA89D078A45A021A00 -371;SWRI Demo;FreeTrack20;V160;;;20230;01730AC6841E9512561000 -372;Syncon Robot Control;FreeTrack20;V160;;;20415;0174C1BBF9937B12DB5200 -373;Synergy Simulation;FreeTrack20;V160;;;20595;0175926ED9736B220B8200 -374;T and TS Corp.;FreeTrack20;V160;;;20005;017617BE0297DDA73CA600 -375;Take On Helicopters;FreeTrack20;V170;;;7504;0177513CB40C0623B96A00 -376;Target: Korea;FreeTrack20;V160;;;1201;0178F52E4221852FA43300 -377;Target: Rabaul;FreeTrack20;V160;;;1202;0179E9D85E4881CA736900 -378;Targeting Demo;FreeTrack20;V160;;;13002;017AAB1D58A952DAA2F900 -379;TD Demo;FreeTrack20;V160;;;1925;017BC5BEE488FE54139700 -489;TeachLive;FreeTrack20;V160;;;20765;01E905245B5AC5484FC100 -380;Telepresence;FreeTrack20;V160;;;20450;017CF478D278B33B02DA00 -381;Tenstar Simulator;FreeTrack20;V160;;;20605;017D318F88A2EA62DBA200 -382;Test Drive Unlimited;FreeTrack20;V160;;;13201;017E6F2699559730A84000 +360;Starshatter;FreeTrack20;V160;;;6401;0168F079578A3F9A3BB600 +361;Steel Beasts 2;FreeTrack20;V160;;;11703;0169DCC441A9443A831A00 +362;Steel Beasts Pro;FreeTrack20;V160;;;11701;016A8F54A20833CAA23900 +363;Steel Beasts Pro Personal;FreeTrack20;V160;;;11702;016BF3E85B1A9443A73000 +364;Stoked Rider;FreeTrack20;V160;;;14701;016CC166C963EA32997300 +365;Storm of War: the Battle of Britain;FreeTrack20;V170;;;11001;016D8F54A68B71F25D0200 +495;STRAFT;FreeTrack20;V160;;;3375;01EF1329E014ADF98D6B00 +366;Stride;FreeTrack20;V170;;;2310;016EC784B21E4B21984400 +367;STS Driving Simulator;FreeTrack20;V160;;;20300;016FA59E688B1C89DE7600 +368;Sunaerosys;FreeTrack20;V160;;;20475;01700449831AF28973EB00 +369;Superkarting;FreeTrack20;V160;;;14903;0171DE661F6D973FA41F00 +370;SuperX Research;FreeTrack20;V160;;;15401;0172BA89D078A45A021A00 +371;SWRI Demo;FreeTrack20;V160;;;20230;01730AC6841E9512561000 +372;Syncon Robot Control;FreeTrack20;V160;;;20415;0174C1BBF9937B12DB5200 +373;Synergy Simulation;FreeTrack20;V160;;;20595;0175926ED9736B220B8200 +374;T and TS Corp.;FreeTrack20;V160;;;20005;017617BE0297DDA73CA600 +375;Take On Helicopters;FreeTrack20;V170;;;7504;0177513CB40C0623B96A00 +376;Target: Korea;FreeTrack20;V160;;;1201;0178F52E4221852FA43300 +377;Target: Rabaul;FreeTrack20;V160;;;1202;0179E9D85E4881CA736900 +378;Targeting Demo;FreeTrack20;V160;;;13002;017AAB1D58A952DAA2F900 +379;TD Demo;FreeTrack20;V160;;;1925;017BC5BEE488FE54139700 +489;TeachLive;FreeTrack20;V160;;;20765;01E905245B5AC5484FC100 +380;Telepresence;FreeTrack20;V160;;;20450;017CF478D278B33B02DA00 +381;Tenstar Simulator;FreeTrack20;V160;;;20605;017D318F88A2EA62DBA200 +382;Test Drive Unlimited;FreeTrack20;V160;;;13201;017E6F2699559730A84000 509;Tetrahedral;FreeTrack20;V160;;;3525;01FDCFF1C56D6F757E8200 501;The Crew;FreeTrack20;V170;;;1009;03F1F534E94F4834D9B100 -488;The Gallery;FreeTrack20;V160;;;3350;01E8CE152EDE5FFD267700 -383;The Sky Gods;FreeTrack20;V170;;;1525;017FDFF782DCCEEA27C200 -384;theHunter;FreeTrack20;V170;;;2375;0180BFF3A86D34DA24C000 -385;thriXXX HII 3D;FreeTrack20;V160;;;13403;0181FA04BD27AB36B62700 -386;thriXXX Jenna;FreeTrack20;V160;;;13401;01829F819CA2A625AB2800 -387;ThriXXX Technology;FreeTrack20;V160;;;13402;0183F47CC378B35B526900 -388;tir2joy;FreeTrack20;V160;;;2202;018487801AB532A7FE9C00 -389;TIRF4;FreeTrack20;V160;;;2203;0185311858418870E77000 -390;TNO;FreeTrack20;V160;;;20285;01861AAF6870A853D64900 -391;ToCA Race Driver 2;FreeTrack20;V160;;;8102;0187FFE9E886F286297910 -392;Toca Race Driver 3;FreeTrack20;V160;;;8101;01884098D36972B551A900 -393;Tom Clancy's H.A.W.X.;FreeTrack20;V170;V;EmBeES ;1004;0189AA4D48E85966FBAA00 -394;Tom Clancy's H.A.W.X. 2;FreeTrack20;V170;;;1007;018A1B7583521C12406F00 -395;Torque Game Engine;FreeTrack20;V160;;;5301;018BC0AF9A2EB62CAB3300 -396;Total War;FreeTrack20;V160;;;1375;018C72456F8529AA2CA400 -397;Tower Crane Simulator;FreeTrack20;V160;;;20670;018D03FB9929B034A7D900 -398;Tower I;FreeTrack20;V160;;;1325;018E662B03873CA731A400 -399;TPL Testing;FreeTrack20;V160;;;20260;018F849F9A2083DC8C2C00 -400;trackd;FreeTrack20;V160;;;20580;019053FE1EB72DA3329D00 -401;TrackMapper2;FreeTrack20;V160;;;2175;0191CE35BAF9A31A61FA00 -402;TrainMaster;FreeTrack20;V160;;;20042;01925C1FDE852D9925B400 -403;Trainz;FreeTrack20;V160;;;4701;0193D1C9F2862C9630A100 -404;TraumTek;FreeTrack20;V160;;;20650;0194A2AE4883EA645A2100 -405;Turismo Carretera;FreeTrack20;V160;;;15801;01956F2699559740A73500 -406;UK Rally Champion;FreeTrack20;V160;;;5701;019679EC0E28B196522A00 -407;ULAN;FreeTrack20;V160;;;20645;01974ADE68E16780D97A00 -473;Underwater Navigation;FreeTrack20;V160;;;20715;01D9FE2B94FB03772DE200 -408;Unity 3D Plugin;FreeTrack20;V160;;;20430;0198D24C3F9B3B9C31BF00 +488;The Gallery;FreeTrack20;V160;;;3350;01E8CE152EDE5FFD267700 +383;The Sky Gods;FreeTrack20;V170;;;1525;017FDFF782DCCEEA27C200 +384;theHunter;FreeTrack20;V170;;;2375;0180BFF3A86D34DA24C000 +385;thriXXX HII 3D;FreeTrack20;V160;;;13403;0181FA04BD27AB36B62700 +386;thriXXX Jenna;FreeTrack20;V160;;;13401;01829F819CA2A625AB2800 +387;ThriXXX Technology;FreeTrack20;V160;;;13402;0183F47CC378B35B526900 +388;tir2joy;FreeTrack20;V160;;;2202;018487801AB532A7FE9C00 +389;TIRF4;FreeTrack20;V160;;;2203;0185311858418870E77000 +390;TNO;FreeTrack20;V160;;;20285;01861AAF6870A853D64900 +391;ToCA Race Driver 2;FreeTrack20;V160;;;8102;0187FFE9E886F286297910 +392;Toca Race Driver 3;FreeTrack20;V160;;;8101;01884098D36972B551A900 +393;Tom Clancy's H.A.W.X.;FreeTrack20;V170;V;EmBeES ;1004;0189AA4D48E85966FBAA00 +394;Tom Clancy's H.A.W.X. 2;FreeTrack20;V170;;;1007;018A1B7583521C12406F00 +395;Torque Game Engine;FreeTrack20;V160;;;5301;018BC0AF9A2EB62CAB3300 +396;Total War;FreeTrack20;V160;;;1375;018C72456F8529AA2CA400 +397;Tower Crane Simulator;FreeTrack20;V160;;;20670;018D03FB9929B034A7D900 +398;Tower I;FreeTrack20;V160;;;1325;018E662B03873CA731A400 +399;TPL Testing;FreeTrack20;V160;;;20260;018F849F9A2083DC8C2C00 +400;trackd;FreeTrack20;V160;;;20580;019053FE1EB72DA3329D00 +401;TrackMapper2;FreeTrack20;V160;;;2175;0191CE35BAF9A31A61FA00 +402;TrainMaster;FreeTrack20;V160;;;20042;01925C1FDE852D9925B400 +403;Trainz;FreeTrack20;V160;;;4701;0193D1C9F2862C9630A100 +404;TraumTek;FreeTrack20;V160;;;20650;0194A2AE4883EA645A2100 +405;Turismo Carretera;FreeTrack20;V160;;;15801;01956F2699559740A73500 +406;UK Rally Champion;FreeTrack20;V160;;;5701;019679EC0E28B196522A00 +407;ULAN;FreeTrack20;V160;;;20645;01974ADE68E16780D97A00 +473;Underwater Navigation;FreeTrack20;V160;;;20715;01D9FE2B94FB03772DE200 +408;Unity 3D Plugin;FreeTrack20;V160;;;20430;0198D24C3F9B3B9C31BF00 525;Unity 64-bit;FreeTrack20;V160;;;3750;020DC8AB18AF3539FA5200 -409;Untitled 10tacle;FreeTrack20;V160;;;13701;0199FFE9E886F28728AA00 -410;Untitled 3D People;FreeTrack20;V160;;;15501;019A6925968D38AD23A900 -411;Untitled Apportmedia;FreeTrack20;V160;;;6801;019B3C2C1C9728B738B700 -412;Untitled Combat Flight Sim;FreeTrack20;V160;;;13801;019CA59E688D36AA28A600 -413;Untitled Deep Silver;FreeTrack20;V160;;;14601;019D656DD68838B836AD00 -414;Untitled G5 Software;FreeTrack20;V160;;;7301;019E318F88B37AC23BA300 -415;Untitled Microsoft;FreeTrack20;V160;;;2308;019FA15F28739BA32A9300 -416;Untitled Research;FreeTrack20;V160;;;1075;01A07686E5A8B2DA924A00 -417;Untitled Ron E;FreeTrack20;V160;;;14902;01A14ADE68E38AB28B9300 -418;Untitled Sega of America;FreeTrack20;V160;;;12801;01A27A32A1A972DA528A00 -419;Untitled Simbin;FreeTrack20;V160;;;3902;01A36C69678E37AA27AD00 -420;Untitled WorkShield;FreeTrack20;V160;;;4601;01A442868E38AB32BA3600 -421;Untitled ZootFly;FreeTrack20;V160;;;12701;01A5348B1863AA527A6300 -422;UQO;FreeTrack20;V160;;;23085;01A67C822099A187FE3600 -423;UVEG Machinery Simulator;FreeTrack20;V160;;;20024;01A73118585257A0F63100 -424;VAR;FreeTrack20;V160;;;20460;01A8950F9A97FA96FD2E00 -425;VBS2;FreeTrack20;V160;;;7501;01A999BB5C990099FCBF00 -485;VBS2 2.0;FreeTrack20;V170;;;7505;1D51EB3616B3A44F05B900 -426;Vehicle Simulator (Quality Simulations);FreeTrack20;V160;;;5102;01AA0FC9FF9B1FA134A900 -478;Vehicle Simulator Direction;FreeTrack20;V160;;;20735;01DEB88CF58E570F1CEF00 -427;Vestibular Ocular Reflex;FreeTrack20;V160;;;20008;01AB3919C49B31A731A200 -428;Viper Arena;FreeTrack20;V160;;;3501;01AC6F2699559934A53100 -429;VIRTools Engine;FreeTrack20;V160;;;10801;01AD1AAF68905881EB5300 -430;Virtools Plugin;FreeTrack20;V160;;;20200;01AE03FB9B23AB43A42900 -431;Virtual Driving;FreeTrack20;V160;;;20245;01AF99BB5C9927B83FB700 -432;Virtual Heroes;FreeTrack20;V160;;;20375;01B0621E78732B732AE200 -433;Virtual RC Racing;FreeTrack20;V160;;;8201;01B16D2D1038A36A23DA00 -434;Virtual Sailor;FreeTrack20;V160;;;5201;01B25F3D95778C32B33D00 -435;Virtual Shopper;FreeTrack20;V160;;;20610;01B3B78B06EC9927B73E00 -436;Virtual Supermarket;FreeTrack20;V160;;;20280;01B4849F9C39A931AD2800 -496;VirtualiTeach;FreeTrack20;V160;;;20790;01F062AE1CAB33B52D0700 -480;Vizard;FreeTrack20;V160;;;20745;01E0C1F20A79D7C0561300 -437;VizRD;FreeTrack20;V160;;;20031;01B55485D9825BF1D8AB00 -438;Void War;FreeTrack20;V160;;;10001;01B65C1FDE872AA1206600 -477;VRPlayer;FreeTrack20;V160;;;20730;01DD6787E57245201D5000 -439;VT08;FreeTrack20;V160;;;1275;01B7B78B06EC9912750200 -440;VVVV Plugin;FreeTrack20;V160;;;20075;01B8B1C6648A138C205500 -441;VW Testing;FreeTrack20;V160;;;20275;01B9AC6E878D205822AA00 -442;Walkabout3d;FreeTrack20;V160;;;20125;01BA2822901E9E39932F00 -443;Wallbusters;FreeTrack20;V160;;;1450;01BB88F58C1EA127A83F00 -444;War Thunder;FreeTrack20;V160;;;0;01BC17BE029A1FB8ED9600 -445;WAVES;FreeTrack20;V160;;;20515;01BD05B38FFE89008B8B00 -446;Welding Simulator;FreeTrack20;V160;;;2625;01BE348B188319D229B300 -447;West Racing;FreeTrack20;V160;;;1801;01BF91D999022A33B62000 -448;Whirlwind of Vietnam;FreeTrack20;V160;;;11101;01C0054E9935A03AAF3200 -449;Wikid FJ;FreeTrack20;V160;;;20685;01C19BC3BDA98269B25A00 -450;Wings of Prey;FreeTrack20;V160;V;V4Friend;1877;01C25909438736A133AC00 -451;Wings of War;FreeTrack20;V160;;;7807;01C34B0FC38B36B42FB610 +409;Untitled 10tacle;FreeTrack20;V160;;;13701;0199FFE9E886F28728AA00 +410;Untitled 3D People;FreeTrack20;V160;;;15501;019A6925968D38AD23A900 +411;Untitled Apportmedia;FreeTrack20;V160;;;6801;019B3C2C1C9728B738B700 +412;Untitled Combat Flight Sim;FreeTrack20;V160;;;13801;019CA59E688D36AA28A600 +413;Untitled Deep Silver;FreeTrack20;V160;;;14601;019D656DD68838B836AD00 +414;Untitled G5 Software;FreeTrack20;V160;;;7301;019E318F88B37AC23BA300 +415;Untitled Microsoft;FreeTrack20;V160;;;2308;019FA15F28739BA32A9300 +416;Untitled Research;FreeTrack20;V160;;;1075;01A07686E5A8B2DA924A00 +417;Untitled Ron E;FreeTrack20;V160;;;14902;01A14ADE68E38AB28B9300 +418;Untitled Sega of America;FreeTrack20;V160;;;12801;01A27A32A1A972DA528A00 +419;Untitled Simbin;FreeTrack20;V160;;;3902;01A36C69678E37AA27AD00 +420;Untitled WorkShield;FreeTrack20;V160;;;4601;01A442868E38AB32BA3600 +421;Untitled ZootFly;FreeTrack20;V160;;;12701;01A5348B1863AA527A6300 +422;UQO;FreeTrack20;V160;;;23085;01A67C822099A187FE3600 +423;UVEG Machinery Simulator;FreeTrack20;V160;;;20024;01A73118585257A0F63100 +424;VAR;FreeTrack20;V160;;;20460;01A8950F9A97FA96FD2E00 +425;VBS2;FreeTrack20;V160;;;7501;01A999BB5C990099FCBF00 +485;VBS2 2.0;FreeTrack20;V170;;;7505;1D51EB3616B3A44F05B900 +426;Vehicle Simulator (Quality Simulations);FreeTrack20;V160;;;5102;01AA0FC9FF9B1FA134A900 +478;Vehicle Simulator Direction;FreeTrack20;V160;;;20735;01DEB88CF58E570F1CEF00 +427;Vestibular Ocular Reflex;FreeTrack20;V160;;;20008;01AB3919C49B31A731A200 +428;Viper Arena;FreeTrack20;V160;;;3501;01AC6F2699559934A53100 +429;VIRTools Engine;FreeTrack20;V160;;;10801;01AD1AAF68905881EB5300 +430;Virtools Plugin;FreeTrack20;V160;;;20200;01AE03FB9B23AB43A42900 +431;Virtual Driving;FreeTrack20;V160;;;20245;01AF99BB5C9927B83FB700 +432;Virtual Heroes;FreeTrack20;V160;;;20375;01B0621E78732B732AE200 +433;Virtual RC Racing;FreeTrack20;V160;;;8201;01B16D2D1038A36A23DA00 +434;Virtual Sailor;FreeTrack20;V160;;;5201;01B25F3D95778C32B33D00 +435;Virtual Shopper;FreeTrack20;V160;;;20610;01B3B78B06EC9927B73E00 +436;Virtual Supermarket;FreeTrack20;V160;;;20280;01B4849F9C39A931AD2800 +496;VirtualiTeach;FreeTrack20;V160;;;20790;01F062AE1CAB33B52D0700 +480;Vizard;FreeTrack20;V160;;;20745;01E0C1F20A79D7C0561300 +437;VizRD;FreeTrack20;V160;;;20031;01B55485D9825BF1D8AB00 +438;Void War;FreeTrack20;V160;;;10001;01B65C1FDE872AA1206600 +477;VRPlayer;FreeTrack20;V160;;;20730;01DD6787E57245201D5000 +439;VT08;FreeTrack20;V160;;;1275;01B7B78B06EC9912750200 +440;VVVV Plugin;FreeTrack20;V160;;;20075;01B8B1C6648A138C205500 +441;VW Testing;FreeTrack20;V160;;;20275;01B9AC6E878D205822AA00 +442;Walkabout3d;FreeTrack20;V160;;;20125;01BA2822901E9E39932F00 +443;Wallbusters;FreeTrack20;V160;;;1450;01BB88F58C1EA127A83F00 +444;War Thunder;FreeTrack20;V160;;;0;01BC17BE029A1FB8ED9600 +445;WAVES;FreeTrack20;V160;;;20515;01BD05B38FFE89008B8B00 +446;Welding Simulator;FreeTrack20;V160;;;2625;01BE348B188319D229B300 +447;West Racing;FreeTrack20;V160;;;1801;01BF91D999022A33B62000 +448;Whirlwind of Vietnam;FreeTrack20;V160;;;11101;01C0054E9935A03AAF3200 +449;Wikid FJ;FreeTrack20;V160;;;20685;01C19BC3BDA98269B25A00 +450;Wings of Prey;FreeTrack20;V160;V;V4Friend;1877;01C25909438736A133AC00 +451;Wings of War;FreeTrack20;V160;;;7807;01C34B0FC38B36B42FB610 512;Wings: Over Flanders Fields;FreeTrack20;V160;;;2326;02008AE39AAA4624B33C00 -452;World Racing 2;FreeTrack20;V160;;;7201;01C41AAF68A2BA836AAE00 -453;WWII Battle Tanks: T-34 vs. Tiger;FreeTrack20;V160;;;11102;01C5432C29C257F1963100 -454;X Motor Racing;FreeTrack20;V160;;;1150;01C669259690E98629A900 +452;World Racing 2;FreeTrack20;V160;;;7201;01C41AAF68A2BA836AAE00 +453;WWII Battle Tanks: T-34 vs. Tiger;FreeTrack20;V160;;;11102;01C5432C29C257F1963100 +454;X Motor Racing;FreeTrack20;V160;;;1150;01C669259690E98629A900 526;X-Camera;FreeTrack20;V160;;;3775;020E1C4055DE39CBC03D00 -458;X-Cockpit for X-Plane;FreeTrack20;V160;;;2901;01CA1C76F8BF4852999300 -459;X-Plane (32 and 64 bit);FreeTrack20;V160;V;EmBeES ;7701;01CB3FD0FC9D90FB943300 -460;X-Plane 6DOF Plugin;FreeTrack20;V160;;;10101;01CCA15F28AF7963596300 -461;X-Plane Pilot View (32 and 64 bit);FreeTrack20;V160;V;V4Friend;11301;01CD79EC0E28EFA953CA00 -462;X-Tower for X-Plane;FreeTrack20;V160;;;3001;01CE05B390EA872AAF3200 -455;X1Alpha;FreeTrack20;V160;;;1825;01C76D2D1038CFD7135A00 -456;X2: The Threat;FreeTrack20;V160;;;5501;01C81039EF980EC8D30900 -457;X3: Albion Prelude and Reunion;FreeTrack20;V170;V;V4Friend;5502;01C97E101A708F8524E300 -463;Xyphoid;FreeTrack20;V160;;;14301;01CF656DD68B43B435A800 -464;zedasoft F-35 Demo;FreeTrack20;V160;;;20041;01D02100B01F942CB93C00 -493;ZKT;FreeTrack20;V160;;;20780;01ED2BAA723F3C097EE800 -465;Zombie AA Research;FreeTrack20;V160;;;14201;01D1AA71218B3B9F1C9A00 +458;X-Cockpit for X-Plane;FreeTrack20;V160;;;2901;01CA1C76F8BF4852999300 +459;X-Plane (32 and 64 bit);FreeTrack20;V160;V;EmBeES ;7701;01CB3FD0FC9D90FB943300 +460;X-Plane 6DOF Plugin;FreeTrack20;V160;;;10101;01CCA15F28AF7963596300 +461;X-Plane Pilot View (32 and 64 bit);FreeTrack20;V160;V;V4Friend;11301;01CD79EC0E28EFA953CA00 +462;X-Tower for X-Plane;FreeTrack20;V160;;;3001;01CE05B390EA872AAF3200 +455;X1Alpha;FreeTrack20;V160;;;1825;01C76D2D1038CFD7135A00 +456;X2: The Threat;FreeTrack20;V160;;;5501;01C81039EF980EC8D30900 +457;X3: Albion Prelude and Reunion;FreeTrack20;V170;V;V4Friend;5502;01C97E101A708F8524E300 +463;Xyphoid;FreeTrack20;V160;;;14301;01CF656DD68B43B435A800 +464;zedasoft F-35 Demo;FreeTrack20;V160;;;20041;01D02100B01F942CB93C00 +493;ZKT;FreeTrack20;V160;;;20780;01ED2BAA723F3C097EE800 +465;Zombie AA Research;FreeTrack20;V160;;;14201;01D1AA71218B3B9F1C9A00 -- cgit v1.2.3 From c3739b878a02d0c78a1805d403d15d99747b941c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 7 Sep 2014 21:37:30 +0200 Subject: Rift: position tracking DK2, pitch sign Tested-by: dyvoid, p00ky (both through reddit) --- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index be0ee689..c43b963a 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -56,17 +56,17 @@ void Rift_Tracker::GetHeadPoseData(double *data) old_yaw=yaw; } if (s.bEnableYaw) - data[Yaw] = yaw * 57.295781f; + data[Yaw] = yaw * 57.295781; if (s.bEnablePitch) - data[Pitch] = pitch * 57.295781f; + data[Pitch] = pitch * -57.295781; if (s.bEnableRoll) - data[Roll] = roll * 57.295781f; + data[Roll] = roll * 57.295781; if (s.bEnableX) - data[TX] = pose.Position.x * 1e-3; + data[TX] = pose.Position.x * 1e2; if (s.bEnableY) - data[TY] = pose.Position.y * 1e-3; + data[TY] = pose.Position.y * 1e2; if (s.bEnableX) - data[TZ] = pose.Position.z * 1e-3; + data[TZ] = pose.Position.z * 1e2; } } } -- cgit v1.2.3 From facb42e5b7bcf919cf3ef67369683a20ceef2aea Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 7 Sep 2014 22:58:40 +0200 Subject: Flip yaw too for rift Reported-by: dyvoid through reddit --- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index c43b963a..8b24dd97 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -56,7 +56,7 @@ void Rift_Tracker::GetHeadPoseData(double *data) old_yaw=yaw; } if (s.bEnableYaw) - data[Yaw] = yaw * 57.295781; + data[Yaw] = yaw * -57.295781; if (s.bEnablePitch) data[Pitch] = pitch * -57.295781; if (s.bEnableRoll) -- cgit v1.2.3 From 54004b14d20d3b07db88e5a08a9c89a48b3efc17 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 8 Sep 2014 07:15:33 +0200 Subject: Flip tx, not yaw, as dyvoid said in the first place Reported-by: dyvoid via reddit --- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index 8b24dd97..33d8f418 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -56,13 +56,13 @@ void Rift_Tracker::GetHeadPoseData(double *data) old_yaw=yaw; } if (s.bEnableYaw) - data[Yaw] = yaw * -57.295781; + data[Yaw] = yaw * 57.295781; if (s.bEnablePitch) data[Pitch] = pitch * -57.295781; if (s.bEnableRoll) data[Roll] = roll * 57.295781; if (s.bEnableX) - data[TX] = pose.Position.x * 1e2; + data[TX] = pose.Position.x * -1e2; if (s.bEnableY) data[TY] = pose.Position.y * 1e2; if (s.bEnableX) -- cgit v1.2.3 From eb9af9a745933f1e816a963ce2497f92f352159f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 9 Sep 2014 07:46:15 +0200 Subject: account for joy hot-unplug shenanigans and read failures --- .../ftnoir_tracker_joystick.cpp | 28 ++++++++++++++-------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index 806ba91e..34ac0dca 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -161,18 +161,26 @@ void FTNoIR_Tracker::GetHeadPoseData(double *data) if( !g_pDI || !g_pJoystick) return; - auto hr = g_pJoystick->Poll(); - if( FAILED( hr )) - { - hr = g_pJoystick->Acquire(); - for (int i = 0; hr == DIERR_INPUTLOST && i < 200; i++) - hr = g_pJoystick->Acquire(); - if (hr != DI_OK) + bool ok = false; + + for (int i = 0; i < 100; i++) + { + if (!FAILED(g_pJoystick->Poll())) { - qDebug() << "joy read failure" << hr; - return; + ok = true; + break; } - } + if (g_pJoystick->Acquire() != DI_OK) + continue; + else + ok = true; + break; + } + + if (!ok) + return; + + HRESULT hr = 0; if( FAILED( hr = g_pJoystick->GetDeviceState( sizeof( js ), &js ) ) ) return; -- cgit v1.2.3 From 0e10668c887f7306e86d8015c9b8e295e2e75197 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 12 Sep 2014 04:18:59 +0200 Subject: Joystick makes even less sense at 3am Issue: #38 --- ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index 34ac0dca..195dd760 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -225,9 +225,9 @@ void FTNoIR_Tracker::GetHeadPoseData(double *data) auto mid = (min_[idx] + max_[idx]) / 2; auto val = values[idx] - mid; - auto max = (max_[idx] - min_[idx]) / 2; - auto min = (min_[idx] - max_[idx]) / -2; - data[i] = val * limits[i] / (double) (val >= 0 ? max : min); + auto max = (max_[idx] - mid) * 2; + auto min = (mid - min_[idx]) * 2; + data[i] = val * limits[i] / (double) (val > mid ? max : min); } } } -- cgit v1.2.3 From 5d2d9bc14c0b97a2f5d3f5be6e533966f5a4df39 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 12 Sep 2014 04:25:40 +0200 Subject: Don't cut ranges in half needlessly Issue: #38 --- ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index 195dd760..cbb4440e 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -225,8 +225,8 @@ void FTNoIR_Tracker::GetHeadPoseData(double *data) auto mid = (min_[idx] + max_[idx]) / 2; auto val = values[idx] - mid; - auto max = (max_[idx] - mid) * 2; - auto min = (mid - min_[idx]) * 2; + auto max = (max_[idx] - mid); + auto min = (mid - min_[idx]); data[i] = val * limits[i] / (double) (val > mid ? max : min); } } -- cgit v1.2.3 From 63cd64275512c50948ccc6894a2547c707e8fbe3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 12 Sep 2014 07:46:02 +0200 Subject: mid axis range already subtracted, correct branch test Issue: #38 --- ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index cbb4440e..a4f026de 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -227,7 +227,7 @@ void FTNoIR_Tracker::GetHeadPoseData(double *data) auto max = (max_[idx] - mid); auto min = (mid - min_[idx]); - data[i] = val * limits[i] / (double) (val > mid ? max : min); + data[i] = val * limits[i] / (double) (val > 0 ? max : min); } } } -- cgit v1.2.3 From aa7fe04754cad9c1277e9e19b570b8b69c7f5103 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 12 Sep 2014 08:26:15 +0200 Subject: Correct axis scale logic Issue: #38 --- ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index a4f026de..d3f5806b 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -2,6 +2,7 @@ #include "facetracknoir/plugin-support.h" #undef NDEBUG #include <QMutexLocker> +#include <stdlib.h> FTNoIR_Tracker::FTNoIR_Tracker() : g_pDI(nullptr), @@ -225,9 +226,8 @@ void FTNoIR_Tracker::GetHeadPoseData(double *data) auto mid = (min_[idx] + max_[idx]) / 2; auto val = values[idx] - mid; - auto max = (max_[idx] - mid); - auto min = (mid - min_[idx]); - data[i] = val * limits[i] / (double) (val > 0 ? max : min); + int scale = val > 0 ? abs(max_[idx] - mid) : -abs(mid - min_[idx]); + data[i] = abs(val) * limits[i] / scale; } } } -- cgit v1.2.3 From d82575fafb5f5887dd1938dfc9d04f7c65eae269 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 13 Sep 2014 07:23:41 +0200 Subject: why is this useless shit STILL THERE? --- documentation/filemapping example.doc | Bin 35840 -> 0 bytes documentation/qt 4.5 with visual studio 2.pdf | Bin 575691 -> 0 bytes documentation/setting up qt.pdf | Bin 20759 -> 0 bytes .../using shared memory for freetrack server.pdf | Bin 13514 -> 0 bytes documentation/working with qt visual studio plugin.pdf | Bin 314796 -> 0 bytes 5 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 documentation/filemapping example.doc delete mode 100644 documentation/qt 4.5 with visual studio 2.pdf delete mode 100644 documentation/setting up qt.pdf delete mode 100644 documentation/using shared memory for freetrack server.pdf delete mode 100644 documentation/working with qt visual studio plugin.pdf diff --git a/documentation/filemapping example.doc b/documentation/filemapping example.doc deleted file mode 100644 index 0940508c..00000000 Binary files a/documentation/filemapping example.doc and /dev/null differ diff --git a/documentation/qt 4.5 with visual studio 2.pdf b/documentation/qt 4.5 with visual studio 2.pdf deleted file mode 100644 index c23e3ac9..00000000 Binary files a/documentation/qt 4.5 with visual studio 2.pdf and /dev/null differ diff --git a/documentation/setting up qt.pdf b/documentation/setting up qt.pdf deleted file mode 100644 index addaee9a..00000000 Binary files a/documentation/setting up qt.pdf and /dev/null differ diff --git a/documentation/using shared memory for freetrack server.pdf b/documentation/using shared memory for freetrack server.pdf deleted file mode 100644 index 980a0e55..00000000 Binary files a/documentation/using shared memory for freetrack server.pdf and /dev/null differ diff --git a/documentation/working with qt visual studio plugin.pdf b/documentation/working with qt visual studio plugin.pdf deleted file mode 100644 index 5d70447e..00000000 Binary files a/documentation/working with qt visual studio plugin.pdf and /dev/null differ -- cgit v1.2.3 From 9e21f5ef4e0dc00452ff0b6a940edc2d51114ec3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 13 Sep 2014 11:24:01 +0200 Subject: joy: Fix API misuse Issue: #38 --- ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 21 ++++++--------------- ftnoir_tracker_joystick/ftnoir_tracker_joystick.h | 2 +- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index d3f5806b..54573af6 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -3,6 +3,7 @@ #undef NDEBUG #include <QMutexLocker> #include <stdlib.h> +#include <utility> FTNoIR_Tracker::FTNoIR_Tracker() : g_pDI(nullptr), @@ -10,8 +11,6 @@ FTNoIR_Tracker::FTNoIR_Tracker() : iter(-1), mtx(QMutex::Recursive) { - for (int i = 0; i < 6; i++) - min_[i] = max_[i] = 0; GUID bar = {0}; } @@ -51,8 +50,6 @@ static BOOL CALLBACK EnumObjectsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, { auto self = (FTNoIR_Tracker*) pContext; - // For axes that are returned, set the DIPROP_RANGE property for the - // enumerated axis in order to scale min/max values. if( pdidoi->dwType & DIDFT_AXIS ) { DIPROPRANGE diprg = {0}; @@ -60,15 +57,14 @@ static BOOL CALLBACK EnumObjectsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, diprg.diph.dwHeaderSize = sizeof( DIPROPHEADER ); diprg.diph.dwHow = DIPH_BYID; diprg.diph.dwObj = pdidoi->dwType; + diprg.lMax = 65535; + diprg.lMin = -65536; // Set the range for the axis - if( FAILED( self->g_pJoystick->GetProperty( DIPROP_RANGE, &diprg.diph ) ) ) + if( FAILED( self->g_pJoystick->SetProperty( DIPROP_RANGE, &diprg.diph ) ) ) return DIENUM_STOP; - self->min_[self->iter] = diprg.lMin; - self->max_[self->iter] = diprg.lMax; - qDebug() << "axis" << self->iter << diprg.lMin << diprg.lMax; self->iter++; } @@ -222,13 +218,8 @@ void FTNoIR_Tracker::GetHeadPoseData(double *data) { data[i] = 0; } - else { - auto mid = (min_[idx] + max_[idx]) / 2; - auto val = values[idx] - mid; - - int scale = val > 0 ? abs(max_[idx] - mid) : -abs(mid - min_[idx]); - data[i] = abs(val) * limits[i] / scale; - } + else + data[i] = values[i] * limits[i] / AXIS_MAX; } } diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h index 2c1bc731..1135b609 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h @@ -61,12 +61,12 @@ public: void reload(); LPDIRECTINPUT8 g_pDI; LPDIRECTINPUTDEVICE8 g_pJoystick; - int min_[8], max_[8]; QMutex mtx; QFrame* frame; DIDEVICEINSTANCE def; int iter; // XXX bad style settings s; + static const constexpr int AXIS_MAX = 65535; }; class TrackerControls: public QWidget, public ITrackerDialog -- cgit v1.2.3 From 98e05692a5bf3a9fabc6b08c121afbe36efe030c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 13 Sep 2014 12:12:46 +0200 Subject: useless headers --- ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index 54573af6..2d65f273 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -1,9 +1,6 @@ #include "ftnoir_tracker_joystick.h" #include "facetracknoir/plugin-support.h" -#undef NDEBUG #include <QMutexLocker> -#include <stdlib.h> -#include <utility> FTNoIR_Tracker::FTNoIR_Tracker() : g_pDI(nullptr), -- cgit v1.2.3 From 6c7e9930aaf50d69472113791bcf6d69ef556ce1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 13 Sep 2014 12:13:25 +0200 Subject: fix braino --- ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index 2d65f273..bf596f51 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -54,8 +54,8 @@ static BOOL CALLBACK EnumObjectsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, diprg.diph.dwHeaderSize = sizeof( DIPROPHEADER ); diprg.diph.dwHow = DIPH_BYID; diprg.diph.dwObj = pdidoi->dwType; - diprg.lMax = 65535; - diprg.lMin = -65536; + diprg.lMax = AXIS_MAX; + diprg.lMin = -AXIS_MAX; // Set the range for the axis -- cgit v1.2.3 From eeda6becd090b512b929fbe381cdc8d881bf08ce Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 13 Sep 2014 13:10:30 +0200 Subject: nix outdated comments and incorrect copyright assignment --- ftnoir_tracker_base/ftnoir_tracker_base.h | 46 +------------------------------ 1 file changed, 1 insertion(+), 45 deletions(-) diff --git a/ftnoir_tracker_base/ftnoir_tracker_base.h b/ftnoir_tracker_base/ftnoir_tracker_base.h index 09723d84..8415e38c 100644 --- a/ftnoir_tracker_base/ftnoir_tracker_base.h +++ b/ftnoir_tracker_base/ftnoir_tracker_base.h @@ -1,44 +1,8 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of the some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2010 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* This class implements a tracker-base * -*********************************************************************************/ -#ifndef FTNOIR_TRACKER_BASE_H -#define FTNOIR_TRACKER_BASE_H - +#pragma once #include "ftnoir_tracker_base_global.h" #include "ftnoir_tracker_types.h" -#include <QWidget> -#include <QFrame> -#include <QWaitCondition> -#include <QMutex> #include <QFrame> -//////////////////////////////////////////////////////////////////////////////// -// COM-Like abstract interface. -// This interface doesn't require __declspec(dllexport/dllimport) specifier. -// Method calls are dispatched via virtual table. -// Any C++ compiler can use it. -// Instances are obtained via factory function. struct ITracker { virtual ~ITracker() = 0; @@ -49,17 +13,9 @@ struct ITracker inline ITracker::~ITracker() { } -//////////////////////////////////////////////////////////////////////////////// -// COM-Like abstract interface. -// This interface doesn't require __declspec(dllexport/dllimport) specifier. -// Method calls are dispatched via virtual table. -// Any C++ compiler can use it. -// Instances are obtained via factory function. struct ITrackerDialog { virtual ~ITrackerDialog() {} virtual void registerTracker(ITracker *tracker) = 0; virtual void unRegisterTracker() = 0; }; - -#endif // FTNOIR_TRACKER_BASE_H -- cgit v1.2.3 From 8cd7cbcee50c2afd5eeb2eb67fc02433751772e1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 13 Sep 2014 13:13:49 +0200 Subject: nix invalid copyright attribution longer than code actual --- ftnoir_filter_base/ftnoir_filter_base.h | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/ftnoir_filter_base/ftnoir_filter_base.h b/ftnoir_filter_base/ftnoir_filter_base.h index fbb0441d..366ff149 100644 --- a/ftnoir_filter_base/ftnoir_filter_base.h +++ b/ftnoir_filter_base/ftnoir_filter_base.h @@ -1,14 +1,6 @@ -#ifndef FTNOIR_FILTER_BASE_H -#define FTNOIR_FILTER_BASE_H - +#pragma once #include "ftnoir_filter_base_global.h" #include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#include <QString> -#include <QList> -#include <QFile> -#include <QCoreApplication> -#include <QMessageBox> -#include <QSettings> struct IFilter { @@ -25,5 +17,3 @@ struct IFilterDialog virtual void registerFilter(IFilter* tracker) = 0; virtual void unregisterFilter() = 0; }; - -#endif // FTNOIR_FILTER_BASE_H -- cgit v1.2.3 From 89fe49d28207f122451c650d93d57d8cbc5a8ae5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 13 Sep 2014 13:14:29 +0200 Subject: nix copyright boilerplate --- ftnoir_protocol_base/ftnoir_protocol_base.h | 39 +---------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/ftnoir_protocol_base/ftnoir_protocol_base.h b/ftnoir_protocol_base/ftnoir_protocol_base.h index d2f85ec0..84f1c0e5 100644 --- a/ftnoir_protocol_base/ftnoir_protocol_base.h +++ b/ftnoir_protocol_base/ftnoir_protocol_base.h @@ -1,41 +1,6 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of the some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2010 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* This class implements a tracker-base * -*********************************************************************************/ -/* - Modifications (last one on top): - - 20121115 - WVR: Added RegisterProtocol() and unRegisterProtocol() to Dialog Class - 20110415 - WVR: Added overloaded operator - and -= -*/ - -#ifndef FTNOIR_PROTOCOL_BASE_H -#define FTNOIR_PROTOCOL_BASE_H - +#pragma once #include "ftnoir_protocol_base_global.h" #include "ftnoir_tracker_base/ftnoir_tracker_types.h" -#include <QWidget> -#include <QFrame> struct IProtocol { @@ -53,5 +18,3 @@ struct IProtocolDialog virtual void registerProtocol(IProtocol *protocol) = 0; virtual void unRegisterProtocol() = 0; }; - -#endif // FTNOIR_PROTOCOL_BASE_H -- cgit v1.2.3 From 61f739e32f81150f905a577050440a35bbe5c467 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 13 Sep 2014 13:15:57 +0200 Subject: nix wrong attribution --- ftnoir_protocol_wine/ftnoir_protocol_wine.h | 32 ----------------------------- 1 file changed, 32 deletions(-) diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.h b/ftnoir_protocol_wine/ftnoir_protocol_wine.h index bde1c100..95e833f6 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine.h +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.h @@ -1,32 +1,4 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2010 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* * -* FTServer FTServer is the Class, that communicates headpose-data * -* to games, using the FreeTrackClient.dll. * -********************************************************************************/ #pragma once -#ifndef INCLUDED_FTSERVER_H -#define INCLUDED_FTSERVER_H #include "ftnoir_protocol_base/ftnoir_protocol_base.h" #include "ftnoir_protocol_ft/fttypes.h" @@ -92,7 +64,3 @@ public: void getIcon(QIcon *icon) { *icon = QIcon(":/images/wine.png"); } }; - - -#endif//INCLUDED_FTSERVER_H -//END -- cgit v1.2.3 From 7bbc9c9f17de42a8e0371551649f6d1ab558782e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 13 Sep 2014 13:23:42 +0200 Subject: nix incorrect copyright attribution (see note) While @dbaarda wanted to leave it ghostwritten, it's not fair toward him. --- ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp | 27 ++------------------ ftnoir_filter_ewma2/ftnoir_filter_ewma2.h | 29 ---------------------- ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp | 24 ------------------ ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp | 24 ------------------ 4 files changed, 2 insertions(+), 102 deletions(-) diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp index 1001514d..7201ba37 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp @@ -1,13 +1,5 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage * -* * +/*** Written by Donovan Baarda +* * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the * * Free Software Foundation; either version 3 of the License, or (at your * @@ -30,21 +22,6 @@ #include <algorithm> #include <QMutexLocker> -/////////////////////////////////////////////////////////////////////////////// -// -// EWMA Filter: Exponentially Weighted Moving Average filter with dynamic smoothing parameter -// -// This filter tries to adjust the amount of filtering to minimize lag when -// moving, and minimize noise when still. It uses the delta filtered over the -// last 3 frames (0.1secs) compared to the delta's average noise variance over -// the last 3600 frames (~2mins) to try and detect movement vs noise. As the -// delta increases from 0->3 stdevs of the noise, the filtering scales down -// from maxSmooth->minSmooth at a rate controlled by the powCurve setting. -// -// Written by Donovan Baarda -// -/////////////////////////////////////////////////////////////////////////////// - FTNoIR_Filter::FTNoIR_Filter() : first_run(true), // Deltas are smoothed over the last 3 frames (0.1sec at 30fps). diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h index c08b0dd9..35a316e6 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h @@ -1,30 +1,4 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ #pragma once -#ifndef INCLUDED_FTN_FILTER_H -#define INCLUDED_FTN_FILTER_H #include "ftnoir_filter_base/ftnoir_filter_base.h" #include "facetracknoir/plugin-support.h" @@ -92,6 +66,3 @@ public: void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Exponentially Weighted Moving Average filter with dynamic smoothing parameter"); } void getIcon(QIcon *icon){ *icon = QIcon(":/images/filter-16.png"); } }; - -#endif //INCLUDED_FTN_FILTER_H -//END diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp index c042d12c..437928a3 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp @@ -1,27 +1,3 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ #include "ftnoir_filter_ewma2.h" #include <cmath> #include <QDebug> diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp index 106bf4c6..5c381e31 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp @@ -1,27 +1,3 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ #include "ftnoir_filter_ewma2.h" #include "facetracknoir/plugin-support.h" -- cgit v1.2.3 From be9901c4cc21597bcd28aebcc95ed488a5a7c172 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 13 Sep 2014 13:27:11 +0200 Subject: Remove incorrect ownership --- facetracknoir/main.cpp | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp index 9bf11b32..7462f8c2 100644 --- a/facetracknoir/main.cpp +++ b/facetracknoir/main.cpp @@ -1,35 +1,5 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of the some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2010 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -*********************************************************************************/ - #include "facetracknoir.h" -#include "tracker.h" #include <QApplication> -#include <QDesktopWidget> -#include <QDebug> -#include <QList> -#include <QDir> -#include <QStringList> #include <memory> int main(int argc, char** argv) @@ -41,6 +11,5 @@ int main(int argc, char** argv) w->show(); app.exec(); - return 0; + return 0; } - -- cgit v1.2.3 -- cgit v1.2.3 From 96e5dcb54b932d65c6d3bf9e9364226da21486ee Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 13 Sep 2014 13:54:12 +0200 Subject: Never heard of the person. Is this a joke? --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index f0c98fb9..a362b136 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,6 @@ Don't be afraid to submit an issue/feature request if the need arises. - Ulf Schreiber (PT tracker) - uglyDwarf (high CON) - Wim Vriend (historically) -- Ron Hendriks (historically) # Licensing information -- cgit v1.2.3 From d4dd9675276093817756187c04d89f10da2df02e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 13 Sep 2014 14:09:08 +0200 Subject: nix comment cancer --- facetracknoir/curve-config.cpp | 5 --- facetracknoir/facetracknoir.cpp | 4 +- facetracknoir/facetracknoir.h | 24 ++++------- facetracknoir/plugin-support.cpp | 7 +--- facetracknoir/plugin-support.h | 1 + facetracknoir/rotation.h | 11 ++--- facetracknoir/shortcuts.cpp | 12 +----- facetracknoir/tracker.cpp | 2 +- facetracknoir/tracker_types.cpp | 4 +- ftnoir_csv/csv.cpp | 18 +------- ftnoir_csv/csv.h | 11 +---- .../ftnoir_protocol_wine_dialog.cpp | 16 -------- ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp | 5 +-- .../ftnoir_tracker_joystick.cpp | 6 +-- ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp | 5 +-- qfunctionconfigurator/functionconfig.cpp | 48 ++-------------------- qfunctionconfigurator/functionconfig.h | 14 +------ qfunctionconfigurator/qfunctionconfigurator.cpp | 6 +-- qfunctionconfigurator/qfunctionconfigurator.h | 31 +++++--------- 19 files changed, 44 insertions(+), 186 deletions(-) diff --git a/facetracknoir/curve-config.cpp b/facetracknoir/curve-config.cpp index 2bff009a..ef63607d 100644 --- a/facetracknoir/curve-config.cpp +++ b/facetracknoir/curve-config.cpp @@ -11,7 +11,6 @@ CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidge QPoint offsetpos(120, 30); this->move(parent->pos() + offsetpos); - // Connect Qt signals to member-functions connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); @@ -39,7 +38,6 @@ CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidge tie_setting(mainApp->s.a_y.invert, ui.chkInvertY); tie_setting(mainApp->s.a_z.invert, ui.chkInvertZ); - // Load the settings from the current .INI-file loadSettings(); } @@ -54,9 +52,6 @@ void CurveConfigurationDialog::doCancel() { close(); } -// -// Load the current Settings from the currently 'active' INI-file. -// void CurveConfigurationDialog::loadSettings() { QFunctionConfigurator* configs[6] = { ui.txconfig, diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index d717b3be..8df368cd 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -26,7 +26,7 @@ #include "tracker.h" #include "curve-config.h" #include "opentrack-version.h" -#include <QDebug> +#include <QFileDialog> #if defined(_WIN32) # include <windows.h> @@ -185,7 +185,6 @@ void FaceTrackNoIR::GetCameraNameDX() { #if defined(_WIN32) ui.cameraName->setText("No video-capturing device was found in your system: check if it's connected!"); - // Create the System Device Enumerator. HRESULT hr; ICreateDevEnum *pSysDevEnum = NULL; hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **)&pSysDevEnum); @@ -197,7 +196,6 @@ void FaceTrackNoIR::GetCameraNameDX() { qDebug() << "GetWDM says: CoCreateInstance succeeded!"; - // Obtain a class enumerator for the video compressor category. IEnumMoniker *pEnumCat = NULL; hr = pSysDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEnumCat, 0); diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index ca8084c2..1da2d6b8 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -22,24 +22,16 @@ * with this program; if not, see <http://www.gnu.org/licenses/>. * *********************************************************************************/ -#ifndef FaceTrackNoIR_H -#define FaceTrackNoIR_H +#pragma once #include <QMainWindow> #include <QApplication> -#include <QFileDialog> -#include <QListView> -#include <QPainter> #include <QWidget> #include <QDialog> #include <QUrl> #include <QList> #include <QKeySequence> -#include <QtGui> -#include <QString> -#include <QByteArray> #include <QShortcut> -#include <vector> #if !defined(_WIN32) # include "qxt-mini/QxtGlobalShortcut" #else @@ -78,7 +70,7 @@ public: FaceTrackNoIR(QWidget *parent = 0); ~FaceTrackNoIR(); - QFrame *get_video_widget(); // Get a pointer to the video-widget, to use in the DLL + QFrame *get_video_widget(); Tracker *tracker; void bindKeyboardShortcuts(); DynamicLibrary* current_tracker1() { @@ -114,12 +106,12 @@ public slots: private: HeadPoseData pose; Ui::OpentrackUI ui; - QTimer timUpdateHeadPose; // Timer to display headpose + QTimer timUpdateHeadPose; - ITrackerDialog* pTrackerDialog; // Pointer to Tracker dialog instance (in DLL) - ITrackerDialog* pSecondTrackerDialog; // Pointer to the second Tracker dialog instance (in DLL) - IProtocolDialog* pProtocolDialog; // Pointer to Protocol dialog instance (in DLL) - IFilterDialog* pFilterDialog; // Pointer to Filter dialog instance (in DLL) + ITrackerDialog* pTrackerDialog; + ITrackerDialog* pSecondTrackerDialog; + IProtocolDialog* pProtocolDialog; + IFilterDialog* pFilterDialog; QWidget *_keyboard_shortcuts; QWidget *_curve_config; @@ -161,5 +153,3 @@ private slots: void startTracker(); void stopTracker(); }; - -#endif // FaceTrackNoIR_H diff --git a/facetracknoir/plugin-support.cpp b/facetracknoir/plugin-support.cpp index 5d810ed1..2e80c5e4 100644 --- a/facetracknoir/plugin-support.cpp +++ b/facetracknoir/plugin-support.cpp @@ -1,4 +1,5 @@ #include "plugin-support.h" +#include <QCoreApplication> #if !(defined(_WIN32)) # include <dlfcn.h> @@ -62,15 +63,9 @@ SelectedLibraries::SelectedLibraries(IDynamicLibraryProvider* mainApp) : pFilter = (IFilter*) ptr(); } - // Check if the Protocol-server files were installed OK. - // Some servers also create a memory-mapping, for Inter Process Communication. - // The handle of the MainWindow is sent to 'The Game', so it can send a message back. - if (pProtocol) if(!pProtocol->checkServerInstallationOK()) return; - - // retrieve pointers to the User Interface and the main Application if (pTracker) { pTracker->StartTracker( mainApp->get_video_widget() ); } diff --git a/facetracknoir/plugin-support.h b/facetracknoir/plugin-support.h index 1c63151a..931f0fa1 100644 --- a/facetracknoir/plugin-support.h +++ b/facetracknoir/plugin-support.h @@ -77,6 +77,7 @@ struct Metadata virtual void getIcon(QIcon *icon) = 0; }; +// merely to break a circular header dependency -sh class IDynamicLibraryProvider { public: virtual DynamicLibrary* current_tracker1() = 0; diff --git a/facetracknoir/rotation.h b/facetracknoir/rotation.h index 22f35abb..d40fb6cf 100644 --- a/facetracknoir/rotation.h +++ b/facetracknoir/rotation.h @@ -5,10 +5,9 @@ * copyright notice and this permission notice appear in all copies. */ -#ifndef ROTATION_H -#define ROTATION_H +#pragma once #include <cmath> -// ---------------------------------------------------------------------------- + class RotationType { public: @@ -16,7 +15,7 @@ public: RotationType(double yaw, double pitch, double roll) { fromEuler(yaw, pitch, roll); } RotationType(double a, double b, double c, double d) : a(a),b(b),c(c),d(d) {} - RotationType inv(){ // inverse + RotationType inv(){ return RotationType(a,-b,-c, -d); } @@ -58,7 +57,3 @@ public: protected: double a,b,c,d; // quaternion coefficients }; - - - -#endif //ROTATION_H diff --git a/facetracknoir/shortcuts.cpp b/facetracknoir/shortcuts.cpp index 601bbcc6..758617ca 100644 --- a/facetracknoir/shortcuts.cpp +++ b/facetracknoir/shortcuts.cpp @@ -9,9 +9,8 @@ KeyboardShortcutDialog::KeyboardShortcutDialog( FaceTrackNoIR *ftnoir, QWidget * QPoint offsetpos(100, 100); this->move(parent->pos() + offsetpos); - mainApp = ftnoir; // Preserve a pointer to FTNoIR + mainApp = ftnoir; - // Connect Qt signals to member-functions connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); @@ -33,9 +32,6 @@ KeyboardShortcutDialog::KeyboardShortcutDialog( FaceTrackNoIR *ftnoir, QWidget * tie_setting(mainApp->s.dingp, ui.ding); } -// -// OK clicked on server-dialog -// void KeyboardShortcutDialog::doOK() { mainApp->b->save(); this->close(); @@ -112,16 +108,10 @@ static bool isKeyPressed( const Key *key, const BYTE *keystate ) { ctrl = ( (keystate[DIK_LCONTROL] & 0x80) || (keystate[DIK_RCONTROL] & 0x80) ); alt = ( (keystate[DIK_LALT] & 0x80) || (keystate[DIK_RALT] & 0x80) ); - // - // If one of the modifiers is needed and not pressed, return false. - // if (key->shift && !shift) return false; if (key->ctrl && !ctrl) return false; if (key->alt && !alt) return false; - // - // All is well! - // return true; } return false; diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index dfe9bc1d..01fd0b4c 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -160,7 +160,7 @@ void Tracker::run() { t_compensate(output_camera.axes, output_camera.axes, mainApp->s.tcomp_tz); if (Libraries->pProtocol) { - Libraries->pProtocol->sendHeadposeToGame( output_camera.axes ); // degrees & centimeters + Libraries->pProtocol->sendHeadposeToGame( output_camera.axes ); } } diff --git a/facetracknoir/tracker_types.cpp b/facetracknoir/tracker_types.cpp index dec4ff81..ba3ac552 100644 --- a/facetracknoir/tracker_types.cpp +++ b/facetracknoir/tracker_types.cpp @@ -20,8 +20,7 @@ T6DOF operator-(const T6DOF& A, const T6DOF& B) C.axes[TX] = A.axes[TX] - B.axes[TX]; C.axes[TY] = A.axes[TY] - B.axes[TY]; C.axes[TZ] = A.axes[TZ] - B.axes[TZ]; - //C.frame_number? - return C; + return C; } T6DOF operator+(const T6DOF& A, const T6DOF& B) @@ -39,6 +38,5 @@ T6DOF operator+(const T6DOF& A, const T6DOF& B) C.axes[TX] = A.axes[TX] + B.axes[TX]; C.axes[TY] = A.axes[TY] + B.axes[TY]; C.axes[TZ] = A.axes[TZ] + B.axes[TZ]; - //C.frame_number? return C; } diff --git a/ftnoir_csv/csv.cpp b/ftnoir_csv/csv.cpp index 66823d24..b59b5083 100644 --- a/ftnoir_csv/csv.cpp +++ b/ftnoir_csv/csv.cpp @@ -25,9 +25,9 @@ #define INSIDE_CSV #include "csv.h" #include <QTextDecoder> -#include <QDebug> #include <QFile> #include <QCoreApplication> +#include <QDebug> CSV::CSV(QIODevice * device) { @@ -46,12 +46,10 @@ CSV::CSV(QString &string){ CSV::~CSV() { - //delete m_codec; } void CSV::setCodec(const char* codecName){ - //delete m_codec; m_codec = QTextCodec::codecForName(codecName); } @@ -59,7 +57,6 @@ QString CSV::readLine(){ QString line; if(m_string.isNull()){ - //READ DATA FROM DEVICE if(m_device && m_device->isReadable()){ QTextDecoder dec(m_codec); m_string = dec.toUnicode(m_device->readAll()); @@ -67,8 +64,6 @@ QString CSV::readLine(){ return QString(); } } - - //PARSE if((m_pos = m_rx.indexIn(m_string,m_pos)) != -1) { line = m_rx.cap(1); m_pos += m_rx.matchedLength(); @@ -111,12 +106,9 @@ void CSV::getGameData( const int id, unsigned char* table, QString& gamename) QStringList gameLine; qDebug() << "getGameData, ID = " << gameID; - // - // Open the supported games list, to get the Name. - // QFile file(QCoreApplication::applicationDirPath() + "/settings/facetracknoir supported games.csv"); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){ - return; + return; } CSV csv(&file); gameLine = csv.parseLine(); @@ -131,9 +123,6 @@ void CSV::getGameData( const int id, unsigned char* table, QString& gamename) //qDebug() << "Column 6: " << gameLine.at(6); // International ID //qDebug() << "Column 7: " << gameLine.at(7); // FaceTrackNoIR ID - // - // If the gameID was found, fill the shared memory - // if (gameLine.count() > 6) { if (gameLine.at(6).compare( gameID, Qt::CaseInsensitive ) == 0) { QByteArray id = gameLine.at(7).toLatin1(); @@ -172,9 +161,6 @@ void CSV::getGameData( const int id, unsigned char* table, QString& gamename) gameLine = csv.parseLine(); } - // - // If the gameID was NOT found, fill only the name "Unknown game connected" - // qDebug() << "Unknown game connected" << gameID; file.close(); } diff --git a/ftnoir_csv/csv.h b/ftnoir_csv/csv.h index bfbece58..79e1351e 100644 --- a/ftnoir_csv/csv.h +++ b/ftnoir_csv/csv.h @@ -1,11 +1,4 @@ -/*dummy CSV reader for QT4*/ -/*version 0.1*/ -/*11.1.2009*/ -#ifndef CSV_H -#define CSV_H - -//#include "myclass_api.h" - +#pragma once #include <QObject> #include <QStringList> #include <QIODevice> @@ -41,5 +34,3 @@ private: CSV(QIODevice * device); CSV(QString &string); }; - -#endif // CSV_H diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp index 29d46219..a6fae479 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp @@ -2,13 +2,6 @@ #include <QDebug> #include "facetracknoir/plugin-support.h" -//******************************************************************************************************* -// FaceTrackNoIR Client Settings-dialog. -//******************************************************************************************************* - -// -// Constructor for server-settings-dialog -// FTControls::FTControls() : QWidget() { ui.setupUi( this ); @@ -16,19 +9,10 @@ FTControls::FTControls() : QWidget() connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); } -// -// Destructor for server-dialog - -// -// OK clicked on server-dialog -// void FTControls::doOK() { this->close(); } -// -// Cancel clicked on server-dialog -// void FTControls::doCancel() { this->close(); } diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp index 7bab1651..7d7fb247 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp @@ -1,13 +1,12 @@ #include "ftnoir_protocol_wine.h" -#include <QDebug> #include "facetracknoir/plugin-support.h" -FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() { +FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() +{ } FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll() { - } extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index bf596f51..e1d92b78 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -54,10 +54,8 @@ static BOOL CALLBACK EnumObjectsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, diprg.diph.dwHeaderSize = sizeof( DIPROPHEADER ); diprg.diph.dwHow = DIPH_BYID; diprg.diph.dwObj = pdidoi->dwType; - diprg.lMax = AXIS_MAX; - diprg.lMin = -AXIS_MAX; - - // Set the range for the axis + diprg.lMax = FTNoIR_Tracker::AXIS_MAX; + diprg.lMin = -FTNoIR_Tracker::AXIS_MAX; if( FAILED( self->g_pJoystick->SetProperty( DIPROP_RANGE, &diprg.diph ) ) ) return DIENUM_STOP; diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp index b7ec9784..cc8079bf 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp @@ -4,9 +4,8 @@ TrackerControls::TrackerControls() : QWidget() { - ui.setupUi( this ); + ui.setupUi( this ); - // Connect Qt signals to member-functions connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); @@ -34,7 +33,7 @@ void TrackerControls::doCancel() { close(); } -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) +extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog() { return new TrackerControls; } diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index 97a6db24..85d058fb 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -17,9 +17,6 @@ #include <math.h> #include <QPixmap> -// -// Constructor with List of Points in argument. -// FunctionConfig::FunctionConfig(QString title, int intMaxInput, int intMaxOutput) : _mutex(QMutex::Recursive) { @@ -29,9 +26,9 @@ FunctionConfig::FunctionConfig(QString title, int intMaxInput, int intMaxOutput) _size = 0; lastValueTracked = QPointF(0,0); _tracking_active = false; - _max_Input = intMaxInput; // Added WVR 20120805 + _max_Input = intMaxInput; _max_Output = intMaxOutput; - QSettings settings("opentrack"); // Registry settings (in HK_USER) + QSettings settings("opentrack"); QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); loadSettings(iniFile); @@ -53,11 +50,6 @@ FunctionConfig::FunctionConfig() : { } -// -// Calculate the value of the function, given the input 'x'. -// Used to draw the curve and, most importantly, to translate input to output. -// The return-value is also stored internally, so the Widget can show the current value, when the Tracker is running. -// float FunctionConfig::getValue(float x) { QMutexLocker foo(&_mutex); int x2 = (int) (std::min<float>(std::max<float>(x, -360), 360) * MEMOIZE_PRECISION); @@ -67,9 +59,6 @@ float FunctionConfig::getValue(float x) { return ret; } -// -// The return-value is also stored internally, so the Widget can show the current value, when the Tracker is running. -// bool FunctionConfig::getLastPoint(QPointF& point ) { QMutexLocker foo(&_mutex); point = lastValueTracked; @@ -172,10 +161,6 @@ FunctionConfig::~FunctionConfig() { delete[] _data; } -// -// Remove a Point from the Function. -// Used by the Widget. -// void FunctionConfig::removePoint(int i) { QMutexLocker foo(&_mutex); if (i >= 0 && i < _points.size()) @@ -185,20 +170,12 @@ void FunctionConfig::removePoint(int i) { } } -// -// Add a Point to the Function. -// Used by the Widget and by loadSettings. -// void FunctionConfig::addPoint(QPointF pt) { QMutexLocker foo(&_mutex); _points.append(pt); reload(); } -// -// Move a Function Point. -// Used by the Widget. -// void FunctionConfig::movePoint(int idx, QPointF pt) { QMutexLocker foo(&_mutex); if (idx >= 0 && idx < _points.size()) @@ -208,10 +185,6 @@ void FunctionConfig::movePoint(int idx, QPointF pt) { } } -// -// Return the List of Points. -// Used by the Widget. -// QList<QPointF> FunctionConfig::getPoints() { QList<QPointF> ret; QMutexLocker foo(&_mutex); @@ -221,10 +194,6 @@ QList<QPointF> FunctionConfig::getPoints() { return ret; } -// -// Load the Points for the Function from the INI-file designated by settings. -// Settings for a specific Curve are loaded from their own Group in the INI-file. -// void FunctionConfig::loadSettings(QSettings& settings) { QMutexLocker foo(&_mutex); QPointF newPoint; @@ -235,12 +204,8 @@ void FunctionConfig::loadSettings(QSettings& settings) { int max = settings.value("point-count", 0).toInt(); for (int i = 0; i < max; i++) { - newPoint = QPointF(settings.value(QString("point-%1-x").arg(i), 0).toFloat(), - settings.value(QString("point-%1-y").arg(i), 0).toFloat()); - // - // Make sure the new Point fits in the Function Range. - // Maybe this can be improved? - // + newPoint = QPointF(settings.value(QString("point-%1-x").arg(i), 0).toFloat(), + settings.value(QString("point-%1-y").arg(i), 0).toFloat()); if (newPoint.x() > _max_Input) { newPoint.setX(_max_Input); } @@ -254,11 +219,6 @@ void FunctionConfig::loadSettings(QSettings& settings) { reload(); } -// -// Save the Points for the Function to the INI-file designated by settings. -// Settings for a specific Curve are saved in their own Group in the INI-file. -// The number of Points is also saved, to make loading more convenient. -// void FunctionConfig::saveSettings(QSettings& settings) { QMutexLocker foo(&_mutex); settings.beginGroup(QString("Curves-%1").arg(_title)); diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h index 4d771dfd..9b43f0bd 100644 --- a/qfunctionconfigurator/functionconfig.h +++ b/qfunctionconfigurator/functionconfig.h @@ -26,7 +26,7 @@ private: int _size; QString _title; float getValueInternal(int x); - QPointF lastValueTracked; // The last input value requested by the Tracker, with it's output-value. + QPointF lastValueTracked; volatile bool _tracking_active; int _max_Input; int _max_Output; @@ -34,19 +34,12 @@ private: public: int maxInput() const { return _max_Input; } int maxOutput() const { return _max_Output; } - // - // Contructor(s) and destructor - // FunctionConfig(); FunctionConfig(QString title, int intMaxInput, int intMaxOutput); ~FunctionConfig(); float getValue(float x); - bool getLastPoint(QPointF& point); // Get the last Point that was requested. - - // - // Functions to manipulate the Function - // + bool getLastPoint(QPointF& point); void removePoint(int i); void removeAllPoints() { QMutexLocker foo(&_mutex); @@ -64,9 +57,6 @@ public: _max_Output = MaxOutput; } - // - // Functions to load/save the Function-Points to an INI-file - // void saveSettings(QSettings& settings); void loadSettings(QSettings& settings); diff --git a/qfunctionconfigurator/qfunctionconfigurator.cpp b/qfunctionconfigurator/qfunctionconfigurator.cpp index 55d1e1bc..e94eded4 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.cpp +++ b/qfunctionconfigurator/qfunctionconfigurator.cpp @@ -28,7 +28,7 @@ static const int pointSize = 5; QFunctionConfigurator::QFunctionConfigurator(QWidget *parent) : QWidget(parent) { - movingPoint = -1; // Index of that same point + movingPoint = -1; _config = 0; _draw_background = true; _draw_function = true; @@ -37,9 +37,9 @@ QFunctionConfigurator::QFunctionConfigurator(QWidget *parent) } void QFunctionConfigurator::setConfig(FunctionConfig* config) { - QSettings settings("opentrack"); // Registry settings (in HK_USER) + QSettings settings("opentrack"); QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) + QSettings iniFile( currentFile, QSettings::IniFormat ); config->loadSettings(iniFile); _config = config; diff --git a/qfunctionconfigurator/qfunctionconfigurator.h b/qfunctionconfigurator/qfunctionconfigurator.h index 1f6b4f78..d3a8741f 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.h +++ b/qfunctionconfigurator/qfunctionconfigurator.h @@ -4,8 +4,7 @@ * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. */ -#ifndef QFUNCTIONCONFIGURATOR_H -#define QFUNCTIONCONFIGURATOR_H +#pragma once #include <QWidget> #include <QtGui> @@ -14,14 +13,6 @@ #include "qfunctionconfigurator/functionconfig.h" #include "ftnoir_tracker_base/ftnoir_tracker_base.h" -// -// The FunctionConfigurator Widget is used to display and configure a function (curve). -// The Function is used by FaceTrackNoIR to 'translate' the actual head-pose to the virtual headpose. Every axis is configured by a separate Function. -// -// The Function is coded in a separate Class and can exists, without the Widget. When the widget is displayed (therefore 'created'), the Function can be attached to the -// Widget and the Widget used to change the Function. -// - class FTNOIR_TRACKER_BASE_EXPORT QFunctionConfigurator : public QWidget { Q_OBJECT @@ -70,23 +61,21 @@ private: _draw_function = _draw_background = true; } - QRectF range; // The actual rectangle for the Bezier-curve - QPointF lastPoint; // The right-most point of the Function - QPointF pixel_coord_to_point (QPointF point) const; // Convert the graphical Point to a real-life Point - QPointF point_to_pixel (QPointF point) const; // Convert the Point to a graphical Point + QRectF range; + QPointF lastPoint; + QPointF pixel_coord_to_point (QPointF point) const; + QPointF point_to_pixel (QPointF point) const; int movingPoint; QElapsedTimer timer; QPointF c; - QColor colBezier; // Color of Bezier curve + QColor colBezier; - bool _draw_background; // Flag to determine if the background should be (re-)drawn on the QPixmap - QPixmap _background; // Image of the static parts (axis, lines, etc.) - bool _draw_function; // Flag to determine if the function should be (re-)drawn on the QPixmap - QPixmap _function; // Image of the function (static unless edited by the user) + bool _draw_background; + QPixmap _background; + bool _draw_function; + QPixmap _function; FunctionConfig* _config; }; - -#endif // QFUNCTIONCONFIGURATOR_H -- cgit v1.2.3 From 6e02a0f3585b161c1c95b29a4be318b4ac3ff58c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 13 Sep 2014 14:11:43 +0200 Subject: Reference pre-fork project's url --- 3rdparty-notices/FACETRACKNOIR-COPYING.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/3rdparty-notices/FACETRACKNOIR-COPYING.txt b/3rdparty-notices/FACETRACKNOIR-COPYING.txt index befeafb5..1b2b7a07 100644 --- a/3rdparty-notices/FACETRACKNOIR-COPYING.txt +++ b/3rdparty-notices/FACETRACKNOIR-COPYING.txt @@ -1,3 +1,7 @@ +The opentrack project is a fork of "FaceTrackNoIR" software. + +Original project's site located at <http://facetracknoir.sourceforge.net/home/default.htm> + ******************************************************************************** * FaceTrackNoIR This program is a private project of the some enthusiastic * * gamers from Holland, who don't like to pay much for * -- cgit v1.2.3 From 4be72d40c239ac35e6b974c389858226d860599d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 16 Sep 2014 03:24:40 +0200 Subject: gitignore --- .gitignore | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.gitignore b/.gitignore index 9c4f50ff..8ea15e74 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,4 @@ /CMakeLists.txt.user *~ /build* -/install -/bin/tracker-ht/headtracker-ftnoir.exe -/bin/tracker-ht/libgcc_s_dw2-1.dll -/bin/tracker-ht/libstdc++-6.dll -/bin/tracker-ht/bounding-box.raw -/bin/tracker-ht/flandmark_model.dat -/bin/tracker-ht/head.raw /installer/Output -/nbproject/ -- cgit v1.2.3 From 46401fcd2e4e5437e74ca9fca04c7521432566aa Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 17 Sep 2014 03:10:31 +0200 Subject: ctor brevity --- facetracknoir/tracker_types.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/facetracknoir/tracker_types.h b/facetracknoir/tracker_types.h index a367371e..043c0420 100644 --- a/facetracknoir/tracker_types.h +++ b/facetracknoir/tracker_types.h @@ -7,10 +7,7 @@ struct T6DOF { public: double axes[6]; - T6DOF() { - for (int i = 0; i < 6; i++) - axes[i] = 0; - } + T6DOF() : axes {0,0,0, 0,0,0 } {} }; T6DOF operator-(const T6DOF& A, const T6DOF& B); // get new pose with respect to reference pose B -- cgit v1.2.3 From 59d6976ebef702627b2676eecd3ad5c397072074 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 17 Sep 2014 03:11:05 +0200 Subject: hook up axis source options Issue: #52 --- facetracknoir/curve-config.cpp | 22 ++- facetracknoir/ftnoir_curves.ui | 424 ++++++++++++++++++++++++++++------------ facetracknoir/main-settings.hpp | 19 +- 3 files changed, 326 insertions(+), 139 deletions(-) diff --git a/facetracknoir/curve-config.cpp b/facetracknoir/curve-config.cpp index ef63607d..e1f39d03 100644 --- a/facetracknoir/curve-config.cpp +++ b/facetracknoir/curve-config.cpp @@ -31,12 +31,19 @@ CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidge tie_setting(mainApp->s.a_pitch.zero, ui.pos_ry); tie_setting(mainApp->s.a_roll.zero, ui.pos_rz); - tie_setting(mainApp->s.a_yaw.invert, ui.chkInvertYaw); - tie_setting(mainApp->s.a_pitch.invert, ui.chkInvertPitch); - tie_setting(mainApp->s.a_roll.invert, ui.chkInvertRoll); - tie_setting(mainApp->s.a_x.invert, ui.chkInvertX); - tie_setting(mainApp->s.a_y.invert, ui.chkInvertY); - tie_setting(mainApp->s.a_z.invert, ui.chkInvertZ); + tie_setting(mainApp->s.a_yaw.invert, ui.invert_yaw); + tie_setting(mainApp->s.a_pitch.invert, ui.invert_pitch); + tie_setting(mainApp->s.a_roll.invert, ui.invert_roll); + tie_setting(mainApp->s.a_x.invert, ui.invert_x); + tie_setting(mainApp->s.a_y.invert, ui.invert_y); + tie_setting(mainApp->s.a_z.invert, ui.invert_z); + + tie_setting(mainApp->s.a_yaw.src, ui.src_yaw); + tie_setting(mainApp->s.a_pitch.src, ui.src_pitch); + tie_setting(mainApp->s.a_roll.src, ui.src_roll); + tie_setting(mainApp->s.a_x.src, ui.src_x); + tie_setting(mainApp->s.a_y.src, ui.src_y); + tie_setting(mainApp->s.a_z.src, ui.src_z); loadSettings(); } @@ -83,9 +90,6 @@ void CurveConfigurationDialog::loadSettings() { } } -// -// Save the current Settings to the currently 'active' INI-file. -// void CurveConfigurationDialog::save() { qDebug() << "save() says: started"; diff --git a/facetracknoir/ftnoir_curves.ui b/facetracknoir/ftnoir_curves.ui index 33421b40..951d37a7 100644 --- a/facetracknoir/ftnoir_curves.ui +++ b/facetracknoir/ftnoir_curves.ui @@ -580,6 +580,9 @@ <string>Options</string> </attribute> <layout class="QFormLayout" name="formLayout"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> <item row="0" column="0"> <widget class="QGroupBox" name="groupBox"> <property name="title"> @@ -737,47 +740,6 @@ </widget> </item> <item row="1" column="0"> - <widget class="QGroupBox" name="groupBox_2"> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="title"> - <string>Translation compensation</string> - </property> - <property name="flat"> - <bool>true</bool> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QCheckBox" name="tcomp_enable"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string>Enable</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="tcomp_rz"> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string>Disable Z axis compensation</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="2" column="0"> <widget class="QGroupBox" name="groupBox_4"> <property name="maximumSize"> <size> @@ -791,7 +753,7 @@ </font> </property> <property name="title"> - <string>Axis inversion</string> + <string>Output source</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> @@ -802,127 +764,345 @@ <property name="checkable"> <bool>false</bool> </property> - <layout class="QGridLayout" name="gridLayout_4" rowstretch="6,6,6" columnstretch="6,6" rowminimumheight="6,6,6" columnminimumwidth="6,6"> + <layout class="QGridLayout" name="gridLayout_4" rowstretch="0,0,0,0,0,0,0" columnstretch="0,0,0,0"> <property name="sizeConstraint"> <enum>QLayout::SetMinAndMaxSize</enum> </property> <property name="spacing"> <number>6</number> </property> - <item row="0" column="0"> - <widget class="QCheckBox" name="chkInvertYaw"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::RightToLeft</enum> - </property> - <property name="styleSheet"> - <string notr="true">background:none;</string> + <item row="4" column="0"> + <widget class="QLabel" name="label_10"> + <property name="text"> + <string>X</string> </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_7"> <property name="text"> <string>Yaw</string> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QCheckBox" name="chkInvertX"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::RightToLeft</enum> - </property> - <property name="styleSheet"> - <string notr="true">background:none;</string> - </property> + <item row="2" column="0"> + <widget class="QLabel" name="label_8"> <property name="text"> - <string>TX</string> + <string>Pitch</string> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QCheckBox" name="chkInvertPitch"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::RightToLeft</enum> + <item row="5" column="0"> + <widget class="QLabel" name="label_11"> + <property name="text"> + <string>Y</string> </property> - <property name="autoFillBackground"> - <bool>false</bool> + </widget> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="label_12"> + <property name="text"> + <string>Z</string> </property> - <property name="styleSheet"> - <string notr="true">background:none;</string> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_9"> + <property name="text"> + <string>Roll</string> </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QCheckBox" name="invert_yaw"> <property name="text"> - <string>Pitch</string> + <string/> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="chkInvertY"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> + <item row="2" column="2"> + <widget class="QCheckBox" name="invert_pitch"> + <property name="text"> + <string/> </property> - <property name="layoutDirection"> - <enum>Qt::RightToLeft</enum> + </widget> + </item> + <item row="4" column="2"> + <widget class="QCheckBox" name="invert_x"> + <property name="text"> + <string/> </property> - <property name="styleSheet"> - <string notr="true">background:none;</string> + </widget> + </item> + <item row="3" column="2"> + <widget class="QCheckBox" name="invert_roll"> + <property name="text"> + <string/> </property> + </widget> + </item> + <item row="5" column="2"> + <widget class="QCheckBox" name="invert_y"> <property name="text"> - <string>TY</string> + <string/> </property> </widget> </item> - <item row="2" column="0"> - <widget class="QCheckBox" name="chkInvertRoll"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> + <item row="6" column="2"> + <widget class="QCheckBox" name="invert_z"> + <property name="text"> + <string/> </property> - <property name="layoutDirection"> - <enum>Qt::RightToLeft</enum> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="src_yaw"> + <item> + <property name="text"> + <string>X</string> + </property> + </item> + <item> + <property name="text"> + <string>Y</string> + </property> + </item> + <item> + <property name="text"> + <string>Z</string> + </property> + </item> + <item> + <property name="text"> + <string>Yaw</string> + </property> + </item> + <item> + <property name="text"> + <string>Pitch</string> + </property> + </item> + <item> + <property name="text"> + <string>Roll</string> + </property> + </item> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="src_pitch"> + <item> + <property name="text"> + <string>X</string> + </property> + </item> + <item> + <property name="text"> + <string>Y</string> + </property> + </item> + <item> + <property name="text"> + <string>Z</string> + </property> + </item> + <item> + <property name="text"> + <string>Yaw</string> + </property> + </item> + <item> + <property name="text"> + <string>Pitch</string> + </property> + </item> + <item> + <property name="text"> + <string>Roll</string> + </property> + </item> + </widget> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="src_roll"> + <item> + <property name="text"> + <string>X</string> + </property> + </item> + <item> + <property name="text"> + <string>Y</string> + </property> + </item> + <item> + <property name="text"> + <string>Z</string> + </property> + </item> + <item> + <property name="text"> + <string>Yaw</string> + </property> + </item> + <item> + <property name="text"> + <string>Pitch</string> + </property> + </item> + <item> + <property name="text"> + <string>Roll</string> + </property> + </item> + </widget> + </item> + <item row="4" column="1"> + <widget class="QComboBox" name="src_x"> + <item> + <property name="text"> + <string>X</string> + </property> + </item> + <item> + <property name="text"> + <string>Y</string> + </property> + </item> + <item> + <property name="text"> + <string>Z</string> + </property> + </item> + <item> + <property name="text"> + <string>Yaw</string> + </property> + </item> + <item> + <property name="text"> + <string>Pitch</string> + </property> + </item> + <item> + <property name="text"> + <string>Roll</string> + </property> + </item> + </widget> + </item> + <item row="5" column="1"> + <widget class="QComboBox" name="src_y"> + <item> + <property name="text"> + <string>X</string> + </property> + </item> + <item> + <property name="text"> + <string>Y</string> + </property> + </item> + <item> + <property name="text"> + <string>Z</string> + </property> + </item> + <item> + <property name="text"> + <string>Yaw</string> + </property> + </item> + <item> + <property name="text"> + <string>Pitch</string> + </property> + </item> + <item> + <property name="text"> + <string>Roll</string> + </property> + </item> + </widget> + </item> + <item row="6" column="1"> + <widget class="QComboBox" name="src_z"> + <item> + <property name="text"> + <string>X</string> + </property> + </item> + <item> + <property name="text"> + <string>Y</string> + </property> + </item> + <item> + <property name="text"> + <string>Z</string> + </property> + </item> + <item> + <property name="text"> + <string>Yaw</string> + </property> + </item> + <item> + <property name="text"> + <string>Pitch</string> + </property> + </item> + <item> + <property name="text"> + <string>Roll</string> + </property> + </item> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="1"> + <widget class="QGroupBox" name="groupBox_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="title"> + <string>Translation compensation</string> + </property> + <property name="flat"> + <bool>true</bool> + </property> + <layout class="QFormLayout" name="formLayout_2"> + <item row="0" column="0"> + <widget class="QCheckBox" name="tcomp_enable"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="styleSheet"> - <string notr="true">background:none;</string> + <string notr="true"/> </property> <property name="text"> - <string>Roll</string> + <string>Enable</string> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QCheckBox" name="chkInvertZ"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::RightToLeft</enum> - </property> + <item row="1" column="0"> + <widget class="QCheckBox" name="tcomp_rz"> <property name="styleSheet"> - <string notr="true">background:none;</string> + <string notr="true"/> </property> <property name="text"> - <string>TZ</string> + <string>Disable Z axis compensation</string> </property> </widget> </item> diff --git a/facetracknoir/main-settings.hpp b/facetracknoir/main-settings.hpp index 8e93bd24..b45c5d9c 100644 --- a/facetracknoir/main-settings.hpp +++ b/facetracknoir/main-settings.hpp @@ -2,6 +2,7 @@ #include <QString> #include "facetracknoir/options.h" +#include "ftnoir_tracker_base/ftnoir_tracker_types.h" using namespace options; struct key_opts { @@ -18,10 +19,12 @@ struct key_opts { struct axis_opts { value<double> zero; value<bool> invert, altp; - axis_opts(pbundle b, QString pfx) : + value<int> src; + axis_opts(pbundle b, QString pfx, int idx) : zero(b, n(pfx, "zero-pos"), 0), invert(b, n(pfx, "invert-axis"), false), - altp(b, n(pfx, "alt-axis-sign"), false) + altp(b, n(pfx, "alt-axis-sign"), false), + src(b, n(pfx, "source-index"), idx) {} private: static inline QString n(QString pfx, QString name) { @@ -44,12 +47,12 @@ struct main_settings { tracker2_dll(b, "tracker2-dll", ""), filter_dll(b, "filter-dll", ""), protocol_dll(b, "protocol-dll", ""), - a_x(b, "x"), - a_y(b, "y"), - a_z(b, "z"), - a_yaw(b, "yaw"), - a_pitch(b, "pitch"), - a_roll(b, "roll"), + a_x(b, "x", TX), + a_y(b, "y", TY), + a_z(b, "z", TZ), + a_yaw(b, "yaw", Yaw), + a_pitch(b, "pitch", Pitch), + a_roll(b, "roll", Roll), tcomp_p(b, "compensate-translation", true), tcomp_tz(b, "compensate-translation-disable-z-axis", false), dingp(b, "ding", true) -- cgit v1.2.3 From b81d4ac044e2e61a69f02ddecd8aedeb780c1a7b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 17 Sep 2014 04:23:54 +0200 Subject: simplify alt axis logic --- facetracknoir/tracker.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 01fd0b4c..ca505315 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -39,16 +39,11 @@ Tracker::~Tracker() static void get_curve(double pos, double& out, THeadPoseDOF& axis) { bool altp = (pos < 0) && axis.opts.altp; - if (altp) { - out = (axis.opts.invert ? -1 : 1) * axis.curveAlt.getValue(pos); - axis.curve.setTrackingActive( false ); - axis.curveAlt.setTrackingActive( true ); - } - else { - out = (axis.opts.invert ? -1 : 1) * axis.curve.getValue(pos); - axis.curve.setTrackingActive( true ); - axis.curveAlt.setTrackingActive( false ); - } + axis.curve.setTrackingActive( !altp ); + axis.curveAlt.setTrackingActive( altp ); + auto& fc = altp ? axis.curveAlt : axis.curve; + out = (axis.opts.invert ? -1 : 1) * fc.getValue(pos); + out += axis.opts.zero; } -- cgit v1.2.3 From d0d3be7f3895df5997647394853986096f889a1a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 17 Sep 2014 04:24:12 +0200 Subject: hook up axis src logic Issue: #52 --- facetracknoir/tracker.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index ca505315..29855b31 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -119,7 +119,13 @@ void Tracker::run() { QMutexLocker foo(&mtx); for (int i = 0; i < 6; i++) - mainApp->axis(i).headPos = newpose[i]; + { + auto& axis = mainApp->axis(i); + int k = axis.opts.src; + if (k < 0 || k >= 6) + continue; + axis.headPos = newpose[k]; + } if (do_center) { for (int i = 0; i < 6; i++) -- cgit v1.2.3 From f8b65030eefbb8bf7ce09d5c0adbfd3192f1cf24 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 17 Sep 2014 05:21:55 +0200 Subject: keep using raw headpose in ui Issue: #52 --- facetracknoir/tracker.cpp | 3 ++- facetracknoir/tracker.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 29855b31..db2a7af3 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -121,6 +121,7 @@ void Tracker::run() { for (int i = 0; i < 6; i++) { auto& axis = mainApp->axis(i); + raw_6dof.axes[i] = newpose[i]; int k = axis.opts.src; if (k < 0 || k >= 6) continue; @@ -184,7 +185,7 @@ void Tracker::getHeadPose( double *data ) { QMutexLocker foo(&mtx); for (int i = 0; i < 6; i++) { - data[i] = mainApp->axis(i).headPos; + data[i] = raw_6dof.axes[i]; } } diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index 49e7f302..152551d4 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -73,7 +73,7 @@ public: volatile bool do_center; volatile bool enabled; - T6DOF output_camera; + T6DOF output_camera, raw_6dof; void start() { QThread::start(); } }; -- cgit v1.2.3 From fff539163e23c687ef32d61aa91c16b2e616ec63 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 17 Sep 2014 07:55:35 +0200 Subject: remove win32-joystick axis remap Feature provided for all trackers in core. Only confuses when both remaps used at the same time. Issue: #52 --- .../ftnoir_tracker_joystick.cpp | 21 +- ftnoir_tracker_joystick/ftnoir_tracker_joystick.h | 12 - .../ftnoir_tracker_joystick_controls.ui | 394 +-------------------- .../ftnoir_tracker_joystick_dialog.cpp | 7 - 4 files changed, 16 insertions(+), 418 deletions(-) diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index e1d92b78..0e95f57d 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -196,26 +196,9 @@ void FTNoIR_Tracker::GetHeadPoseData(double *data) 90, 180 }; - - int axes[] = { - s.axis_0, - s.axis_1, - s.axis_2, - s.axis_3, - s.axis_4, - s.axis_5 - }; - + for (int i = 0; i < 6; i++) - { - auto idx = axes[i] - 1; - if (idx < 0 || idx > 7) - { - data[i] = 0; - } - else - data[i] = values[i] * limits[i] / AXIS_MAX; - } + data[i] = values[i] * limits[i] / AXIS_MAX; } extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h index 1135b609..75ea9f52 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h @@ -32,21 +32,9 @@ using namespace options; struct settings { pbundle b; - value<int> axis_0; - value<int> axis_1; - value<int> axis_2; - value<int> axis_3; - value<int> axis_4; - value<int> axis_5; value<QString> joyid; settings() : b(bundle("tracker-joystick")), - axis_0(b, "axis-0", 0), - axis_1(b, "axis-1", 0), - axis_2(b, "axis-2", 0), - axis_3(b, "axis-3", 0), - axis_4(b, "axis-4", 0), - axis_5(b, "axis-5", 0), joyid(b, "joy-id", "") {} }; diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_controls.ui b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_controls.ui index 5d349169..b0e010a1 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_controls.ui +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_controls.ui @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>216</width> - <height>259</height> + <width>326</width> + <height>88</height> </rect> </property> <property name="sizePolicy"> @@ -32,385 +32,25 @@ <property name="autoFillBackground"> <bool>false</bool> </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QGroupBox" name="groupBox_3"> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Joystick</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="joylist"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>85</height> - </size> - </property> - <property name="title"> - <string>Axis enablement</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="1" column="0"> - <widget class="QLabel" name="label_11"> - <property name="text"> - <string>X</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_9"> - <property name="text"> - <string>Y</string> - </property> - </widget> - </item> - <item row="7" column="0"> - <widget class="QLabel" name="label_16"> - <property name="text"> - <string>Roll</string> - </property> - </widget> - </item> - <item row="6" column="1"> - <widget class="QComboBox" name="comboBox_5"> - <item> - <property name="text"> - <string/> - </property> - </item> - <item> - <property name="text"> - <string>#1</string> - </property> - </item> - <item> - <property name="text"> - <string>#2</string> - </property> - </item> - <item> - <property name="text"> - <string>#3</string> - </property> - </item> - <item> - <property name="text"> - <string>#4</string> - </property> - </item> - <item> - <property name="text"> - <string>#5</string> - </property> - </item> - <item> - <property name="text"> - <string>#6</string> - </property> - </item> - <item> - <property name="text"> - <string>#7</string> - </property> - </item> - <item> - <property name="text"> - <string>#8</string> - </property> - </item> - </widget> - </item> - <item row="7" column="1"> - <widget class="QComboBox" name="comboBox_6"> - <item> - <property name="text"> - <string/> - </property> - </item> - <item> - <property name="text"> - <string>#1</string> - </property> - </item> - <item> - <property name="text"> - <string>#2</string> - </property> - </item> - <item> - <property name="text"> - <string>#3</string> - </property> - </item> - <item> - <property name="text"> - <string>#4</string> - </property> - </item> - <item> - <property name="text"> - <string>#5</string> - </property> - </item> - <item> - <property name="text"> - <string>#6</string> - </property> - </item> - <item> - <property name="text"> - <string>#7</string> - </property> - </item> - <item> - <property name="text"> - <string>#8</string> - </property> - </item> - </widget> - </item> - <item row="5" column="1"> - <widget class="QComboBox" name="comboBox_4"> - <item> - <property name="text"> - <string/> - </property> - </item> - <item> - <property name="text"> - <string>#1</string> - </property> - </item> - <item> - <property name="text"> - <string>#2</string> - </property> - </item> - <item> - <property name="text"> - <string>#3</string> - </property> - </item> - <item> - <property name="text"> - <string>#4</string> - </property> - </item> - <item> - <property name="text"> - <string>#5</string> - </property> - </item> - <item> - <property name="text"> - <string>#6</string> - </property> - </item> - <item> - <property name="text"> - <string>#7</string> - </property> - </item> - <item> - <property name="text"> - <string>#8</string> - </property> - </item> - </widget> - </item> - <item row="3" column="1"> - <widget class="QComboBox" name="comboBox_2"> - <item> - <property name="text"> - <string/> - </property> - </item> - <item> - <property name="text"> - <string>#1</string> - </property> - </item> - <item> - <property name="text"> - <string>#2</string> - </property> - </item> - <item> - <property name="text"> - <string>#3</string> - </property> - </item> - <item> - <property name="text"> - <string>#4</string> - </property> - </item> - <item> - <property name="text"> - <string>#5</string> - </property> - </item> - <item> - <property name="text"> - <string>#6</string> - </property> - </item> - <item> - <property name="text"> - <string>#7</string> - </property> - </item> - <item> - <property name="text"> - <string>#8</string> - </property> - </item> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="comboBox"> - <item> - <property name="text"> - <string/> - </property> - </item> - <item> - <property name="text"> - <string>#1</string> - </property> - </item> - <item> - <property name="text"> - <string>#2</string> - </property> - </item> - <item> - <property name="text"> - <string>#3</string> - </property> - </item> - <item> - <property name="text"> - <string>#4</string> - </property> - </item> - <item> - <property name="text"> - <string>#5</string> - </property> - </item> - <item> - <property name="text"> - <string>#6</string> - </property> - </item> - <item> - <property name="text"> - <string>#7</string> - </property> - </item> - <item> - <property name="text"> - <string>#8</string> - </property> - </item> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="label_14"> - <property name="text"> - <string>Yaw</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QComboBox" name="comboBox_3"> - <item> - <property name="text"> - <string/> - </property> - </item> - <item> - <property name="text"> - <string>#1</string> - </property> - </item> - <item> - <property name="text"> - <string>#2</string> - </property> - </item> - <item> - <property name="text"> - <string>#3</string> - </property> - </item> - <item> - <property name="text"> - <string>#4</string> - </property> - </item> - <item> - <property name="text"> - <string>#5</string> - </property> - </item> - <item> - <property name="text"> - <string>#6</string> - </property> - </item> - <item> - <property name="text"> - <string>#7</string> - </property> - </item> - <item> - <property name="text"> - <string>#8</string> - </property> - </item> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>Z</string> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="label_15"> - <property name="text"> - <string>Pitch</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Joy Id</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="joylist"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - </layout> </widget> </item> - <item> + <item row="1" column="0" colspan="2"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="standardButtons"> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> @@ -421,12 +61,6 @@ </widget> <tabstops> <tabstop>joylist</tabstop> - <tabstop>comboBox</tabstop> - <tabstop>comboBox_2</tabstop> - <tabstop>comboBox_3</tabstop> - <tabstop>comboBox_4</tabstop> - <tabstop>comboBox_5</tabstop> - <tabstop>comboBox_6</tabstop> <tabstop>buttonBox</tabstop> </tabstops> <resources/> diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp index 7f24a8f1..eea7f916 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp @@ -19,13 +19,6 @@ TrackerControls::TrackerControls() : tracker(nullptr) connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - tie_setting(s.axis_0, ui.comboBox); - tie_setting(s.axis_1, ui.comboBox_2); - tie_setting(s.axis_2, ui.comboBox_3); - tie_setting(s.axis_3, ui.comboBox_4); - tie_setting(s.axis_4, ui.comboBox_5); - tie_setting(s.axis_5, ui.comboBox_6); - { auto hr = CoInitialize( nullptr ); LPDIRECTINPUT8 g_pDI = nullptr; -- cgit v1.2.3 From 4fdc2d9b3733f2b8d3edd4e10fdba0b7a525ae22 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 17 Sep 2014 08:07:09 +0200 Subject: initialize COM on _WIN32 as per Win32 API For API correctness only. It worked without issues since ever. --- facetracknoir/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp index 7462f8c2..694715d1 100644 --- a/facetracknoir/main.cpp +++ b/facetracknoir/main.cpp @@ -2,8 +2,16 @@ #include <QApplication> #include <memory> +#ifdef _WIN32 +# include <objbase.h> +#endif + int main(int argc, char** argv) { +#ifdef _WIN32 + CoInitializeEx(NULL, COINIT_MULTITHREADED); +#endif + QApplication::setAttribute(Qt::AA_X11InitThreads, true); QApplication app(argc, argv); auto w = std::make_shared<FaceTrackNoIR>(); -- cgit v1.2.3 From 679f424c250a38473c82bf1f997b75fbea4d3758 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 17 Sep 2014 12:40:39 +0200 Subject: nix explicit malloc simplifies, allows for copy operator --- facetracknoir/facetracknoir.cpp | 4 +- facetracknoir/facetracknoir.h | 2 +- facetracknoir/tracker.h | 46 ++++---- qfunctionconfigurator/functionconfig.cpp | 143 ++++++++++-------------- qfunctionconfigurator/functionconfig.h | 79 +++++++++---- qfunctionconfigurator/qfunctionconfigurator.cpp | 13 +-- qfunctionconfigurator/qfunctionconfigurator.h | 23 ++-- 7 files changed, 154 insertions(+), 156 deletions(-) diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 8df368cd..da8fae61 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -366,8 +366,8 @@ void FaceTrackNoIR::startTracker( ) { for (int i = 0; i < 6; i++) { - axis(i).curve.loadSettings(iniFile); - axis(i).curveAlt.loadSettings(iniFile); + axis(i).curve.loadSettings(iniFile, axis(i).name1); + axis(i).curveAlt.loadSettings(iniFile, axis(i).name2); } } diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 1da2d6b8..dc37ad37 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -86,7 +86,7 @@ public: return dlopen_filters.value(ui.iconcomboFilter->currentIndex(), (DynamicLibrary*) NULL); } THeadPoseDOF& axis(int idx) { - return *pose.axes[idx]; + return pose.axes[idx]; } #if defined(_WIN32) diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index 152551d4..d06ac9d2 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -21,12 +21,7 @@ #include "facetracknoir/timer.hpp" using namespace options; -class FaceTrackNoIR; // pre-define parent-class to avoid circular includes - class THeadPoseDOF { -private: - THeadPoseDOF(const THeadPoseDOF &) = delete; - THeadPoseDOF& operator=(const THeadPoseDOF&) = delete; public: THeadPoseDOF(QString primary, QString secondary, @@ -36,22 +31,27 @@ public: int maxOutput2, axis_opts* opts) : headPos(0), - curve(primary, maxInput1, maxOutput1), - curveAlt(secondary, maxInput2, maxOutput2), - opts(*opts) + curve(maxInput1, maxOutput1), + curveAlt(maxInput2, maxOutput2), + opts(*opts), + name1(primary), + name2(secondary) { QSettings settings("opentrack"); QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); - curve.loadSettings(iniFile); - curveAlt.loadSettings(iniFile); + curve.loadSettings(iniFile, primary); + curveAlt.loadSettings(iniFile, secondary); } volatile double headPos; FunctionConfig curve; FunctionConfig curveAlt; axis_opts& opts; + QString name1, name2; }; +class FaceTrackNoIR; + class Tracker : protected QThread { Q_OBJECT @@ -80,23 +80,17 @@ public: class HeadPoseData { public: - THeadPoseDOF* axes[6]; - HeadPoseData(std::vector<axis_opts*> opts) - { - axes[TX] = new THeadPoseDOF("tx","tx_alt", 100, 100, 100, 100, opts[TX]); - axes[TY] = new THeadPoseDOF("ty","ty_alt", 100, 100, 100, 100, opts[TY]); - axes[TZ] = new THeadPoseDOF("tz","tz_alt", 100, 100, 100, 100, opts[TZ]); - axes[Yaw] = new THeadPoseDOF("rx", "rx_alt", 180, 180, 180, 180, opts[Yaw]); - axes[Pitch] = new THeadPoseDOF("ry", "ry_alt", 90, 90, 90, 90, opts[Pitch]); - axes[Roll] = new THeadPoseDOF("rz", "rz_alt", 180, 180, 180, 180, opts[Roll]); - } - ~HeadPoseData() - { - for (int i = 0; i < 6; i++) - { - delete axes[i]; + THeadPoseDOF axes[6]; + HeadPoseData(std::vector<axis_opts*> opts) : + axes { + THeadPoseDOF("tx","tx_alt", 100, 100, 100, 100, opts[TX]), + THeadPoseDOF("ty","ty_alt", 100, 100, 100, 100, opts[TY]), + THeadPoseDOF("tz","tz_alt", 100, 100, 100, 100, opts[TZ]), + THeadPoseDOF("rx", "rx_alt", 180, 180, 180, 180, opts[Yaw]), + THeadPoseDOF("ry", "ry_alt", 90, 90, 90, 90, opts[Pitch]), + THeadPoseDOF("rz", "rz_alt", 180, 180, 180, 180, opts[Roll]) } - } + {} }; #endif diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index 85d058fb..640db1ef 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -17,36 +17,17 @@ #include <math.h> #include <QPixmap> -FunctionConfig::FunctionConfig(QString title, int intMaxInput, int intMaxOutput) : - _mutex(QMutex::Recursive) -{ - _title = title; - _points = QList<QPointF>(); - _data = 0; - _size = 0; - lastValueTracked = QPointF(0,0); - _tracking_active = false; - _max_Input = intMaxInput; - _max_Output = intMaxOutput; - QSettings settings("opentrack"); - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); - loadSettings(iniFile); - reload(); -} - void FunctionConfig::setTrackingActive(bool blnActive) { - _tracking_active = blnActive; + activep = blnActive; } FunctionConfig::FunctionConfig() : _mutex(QMutex::Recursive), - _data(0), - _size(0), - _tracking_active(false), - _max_Input(0), - _max_Output(0) + data(0), + activep(false), + max_x(0), + max_y(0) { } @@ -54,31 +35,30 @@ float FunctionConfig::getValue(float x) { QMutexLocker foo(&_mutex); int x2 = (int) (std::min<float>(std::max<float>(x, -360), 360) * MEMOIZE_PRECISION); float ret = getValueInternal(x2); - lastValueTracked.setX(x); - lastValueTracked.setY(ret); + last_input_value.setX(x); + last_input_value.setY(ret); return ret; } bool FunctionConfig::getLastPoint(QPointF& point ) { QMutexLocker foo(&_mutex); - point = lastValueTracked; - return _tracking_active; + point = last_input_value; + return activep; } float FunctionConfig::getValueInternal(int x) { float sign = x < 0 ? -1 : 1; x = x < 0 ? -x : x; float ret; - if (!_data) - ret = 0; - else if (_size == 0) + int sz = data.size(); + if (sz == 0) ret = 0; else if (x < 0) ret = 0; - else if (x < _size && x >= 0) - ret = _data[x]; + else if (x < sz && x >= 0) + ret = data[x]; else - ret = _data[_size - 1]; + ret = data[sz - 1]; return ret * sign; } @@ -96,35 +76,32 @@ static bool sortFn(const QPointF& one, const QPointF& two) { } void FunctionConfig::reload() { - _size = 0; + if (input.size()) + qStableSort(input.begin(), input.end(), sortFn); - if (_points.size()) - qStableSort(_points.begin(), _points.end(), sortFn); + if (input.size()) { + data = std::vector<float>(MEMOIZE_PRECISION * input[input.size() - 1].x()); + + const int sz = data.size(); - if (_data) - delete[] _data; - _data = NULL; - if (_points.size()) { - _data = new float[_size = MEMOIZE_PRECISION * _points[_points.size() - 1].x()]; + for (int i = 0; i < sz; i++) + data[i] = -1; - for (int i = 0; i < _size; i++) - _data[i] = -1e6; - - for (int k = 0; k < _points[0].x() * MEMOIZE_PRECISION; k++) { - if (k < _size) - _data[k] = _points[0].y() * k / (_points[0].x() * MEMOIZE_PRECISION); + for (int k = 0; k < input[0].x() * MEMOIZE_PRECISION; k++) { + if (k < sz) + data[k] = input[0].y() * k / (input[0].x() * MEMOIZE_PRECISION); } - for (int i = 0; i < _points.size(); i++) { - QPointF p0 = ensureInBounds(_points, i - 1); - QPointF p1 = ensureInBounds(_points, i); - QPointF p2 = ensureInBounds(_points, i + 1); - QPointF p3 = ensureInBounds(_points, i + 2); + for (int i = 0; i < sz; i++) { + QPointF p0 = ensureInBounds(input, i - 1); + QPointF p1 = ensureInBounds(input, i); + QPointF p2 = ensureInBounds(input, i + 1); + QPointF p3 = ensureInBounds(input, i + 2); - int end = p2.x() * MEMOIZE_PRECISION; + int end = std::min<int>(sz, p2.x() * MEMOIZE_PRECISION); int start = p1.x() * MEMOIZE_PRECISION; - for (int j = start; j < end && j < _size; j++) { + for (int j = start; j < end; j++) { double t = (j - start) / (double) (end - start); double t2 = t*t; double t3 = t*t*t; @@ -140,47 +117,41 @@ void FunctionConfig::reload() { (2. * p0.y() - 5. * p1.y() + 4. * p2.y() - p3.y()) * t2 + (-p0.y() + 3. * p1.y() - 3. * p2.y() + p3.y()) * t3); - if (x >= 0 && x < _size) - _data[x] = y; + if (x >= 0 && x < sz) + data[x] = y; } } float last = 0; - - for (int i = 0; i < _size; i++) + for (int i = 0; i < sz; i++) { - if (_data[i] == -1e6) - _data[i] = last; - last = _data[i]; + if (data[i] <= 0) + data[i] = last; + last = data[i]; } } } -FunctionConfig::~FunctionConfig() { - if (_data) - delete[] _data; -} - void FunctionConfig::removePoint(int i) { QMutexLocker foo(&_mutex); - if (i >= 0 && i < _points.size()) + if (i >= 0 && i < input.size()) { - _points.removeAt(i); + input.removeAt(i); reload(); } } void FunctionConfig::addPoint(QPointF pt) { QMutexLocker foo(&_mutex); - _points.append(pt); + input.append(pt); reload(); } void FunctionConfig::movePoint(int idx, QPointF pt) { QMutexLocker foo(&_mutex); - if (idx >= 0 && idx < _points.size()) + if (idx >= 0 && idx < input.size()) { - _points[idx] = pt; + input[idx] = pt; reload(); } } @@ -188,45 +159,45 @@ void FunctionConfig::movePoint(int idx, QPointF pt) { QList<QPointF> FunctionConfig::getPoints() { QList<QPointF> ret; QMutexLocker foo(&_mutex); - for (int i = 0; i < _points.size(); i++) { - ret.append(_points[i]); + for (int i = 0; i < input.size(); i++) { + ret.append(input[i]); } return ret; } -void FunctionConfig::loadSettings(QSettings& settings) { +void FunctionConfig::loadSettings(QSettings& settings, const QString& title) { QMutexLocker foo(&_mutex); QPointF newPoint; QList<QPointF> points; - settings.beginGroup(QString("Curves-%1").arg(_title)); + settings.beginGroup(QString("Curves-%1").arg(title)); int max = settings.value("point-count", 0).toInt(); for (int i = 0; i < max; i++) { newPoint = QPointF(settings.value(QString("point-%1-x").arg(i), 0).toFloat(), settings.value(QString("point-%1-y").arg(i), 0).toFloat()); - if (newPoint.x() > _max_Input) { - newPoint.setX(_max_Input); + if (newPoint.x() > max_x) { + newPoint.setX(max_x); } - if (newPoint.y() > _max_Output) { - newPoint.setY(_max_Output); + if (newPoint.y() > max_y) { + newPoint.setY(max_y); } points.append(newPoint); } settings.endGroup(); - _points = points; + input = points; reload(); } -void FunctionConfig::saveSettings(QSettings& settings) { +void FunctionConfig::saveSettings(QSettings& settings, const QString& title) { QMutexLocker foo(&_mutex); - settings.beginGroup(QString("Curves-%1").arg(_title)); - int max = _points.size(); + settings.beginGroup(QString("Curves-%1").arg(title)); + int max = input.size(); settings.setValue("point-count", max); for (int i = 0; i < max; i++) { - settings.setValue(QString("point-%1-x").arg(i), _points[i].x()); - settings.setValue(QString("point-%1-y").arg(i), _points[i].y()); + settings.setValue(QString("point-%1-x").arg(i), input[i].x()); + settings.setValue(QString("point-%1-y").arg(i), input[i].y()); } for (int i = max; true; i++) diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h index 9b43f0bd..22bfc406 100644 --- a/qfunctionconfigurator/functionconfig.h +++ b/qfunctionconfigurator/functionconfig.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, Stanislaw Halik <sthalik@misaki.pl> +/* Copyright (c) 2011-2014, 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, @@ -14,36 +14,72 @@ #include <QSettings> #include <QMutex> #include "ftnoir_tracker_base/ftnoir_tracker_base.h" +#include <vector> #define MEMOIZE_PRECISION 100 +class MyMutex { +private: + QMutex inner; + +public: + QMutex* operator->() { return &inner; } + QMutex* operator->() const { return &const_cast<MyMutex*>(this)->inner; } + + MyMutex operator=(const MyMutex& datum) + { + auto mode = + datum->isRecursive() + ? QMutex::Recursive + : QMutex::NonRecursive; + + return MyMutex(mode); + } + + MyMutex(const MyMutex& datum) + { + *this = datum; + } + + MyMutex(QMutex::RecursionMode mode = QMutex::NonRecursive) : + inner(mode) + { + } + + QMutex* operator&() + { + return &inner; + } +}; + class FTNOIR_TRACKER_BASE_EXPORT FunctionConfig { private: - QMutex _mutex; - QList<QPointF> _points; - void reload(); - float* _data; - int _size; - QString _title; + void reload(); float getValueInternal(int x); - QPointF lastValueTracked; - volatile bool _tracking_active; - int _max_Input; - int _max_Output; - FunctionConfig(const FunctionConfig&) = delete; + + MyMutex _mutex; + QList<QPointF> input; + std::vector<float> data; + QPointF last_input_value; + volatile bool activep; + int max_x; + int max_y; public: - int maxInput() const { return _max_Input; } - int maxOutput() const { return _max_Output; } + int maxInput() const { return max_x; } + int maxOutput() const { return max_y; } FunctionConfig(); - FunctionConfig(QString title, int intMaxInput, int intMaxOutput); - ~FunctionConfig(); + FunctionConfig(int maxx, int maxy) + { + setMaxInput(maxx); + setMaxOutput(maxy); + } float getValue(float x); bool getLastPoint(QPointF& point); void removePoint(int i); void removeAllPoints() { QMutexLocker foo(&_mutex); - _points.clear(); + input.clear(); reload(); } @@ -51,15 +87,14 @@ public: void movePoint(int idx, QPointF pt); QList<QPointF> getPoints(); void setMaxInput(int MaxInput) { - _max_Input = MaxInput; + max_x = MaxInput; } void setMaxOutput(int MaxOutput) { - _max_Output = MaxOutput; + max_y = MaxOutput; } - void saveSettings(QSettings& settings); - void loadSettings(QSettings& settings); + void saveSettings(QSettings& settings, const QString& title); + void loadSettings(QSettings& settings, const QString& title); void setTrackingActive(bool blnActive); - QString getTitle() { return _title; } }; diff --git a/qfunctionconfigurator/qfunctionconfigurator.cpp b/qfunctionconfigurator/qfunctionconfigurator.cpp index e94eded4..a197dadb 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.cpp +++ b/qfunctionconfigurator/qfunctionconfigurator.cpp @@ -41,7 +41,7 @@ void QFunctionConfigurator::setConfig(FunctionConfig* config) { QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); - config->loadSettings(iniFile); + config->loadSettings(iniFile, name); _config = config; _draw_function = _draw_background = true; update_range(); @@ -52,7 +52,7 @@ void QFunctionConfigurator::saveSettings(QString settingsFile) { QSettings iniFile( settingsFile, QSettings::IniFormat ); // Application settings (in INI-file) if (_config) { - _config->saveSettings(iniFile); + _config->saveSettings(iniFile, name); } } @@ -279,7 +279,6 @@ void QFunctionConfigurator::mousePressEvent(QMouseEvent *e) } if (!bTouchingPoint) { _config->addPoint(pixel_coord_to_point(e->pos())); - emit CurveChanged( true ); } } } @@ -296,7 +295,6 @@ void QFunctionConfigurator::mousePressEvent(QMouseEvent *e) if (found_pt != -1) { _config->removePoint(found_pt); - emit CurveChanged( true ); } movingPoint = -1; } @@ -353,7 +351,6 @@ void QFunctionConfigurator::mouseReleaseEvent(QMouseEvent *e) if (e->button() == Qt::LeftButton) { timer.invalidate(); if (movingPoint >= 0 && movingPoint < points.size()) { - emit CurveChanged( true ); if (_config) { _config->movePoint(movingPoint, pixel_coord_to_point(e->pos())); } @@ -400,12 +397,6 @@ QPointF QFunctionConfigurator::point_to_pixel(QPointF point) const range.y() + range.height() - point.y() * c.y()); } -void QFunctionConfigurator::setColorBezier(QColor color) -{ - colBezier = color; - update(); -} - void QFunctionConfigurator::resizeEvent(QResizeEvent *) { update_range(); diff --git a/qfunctionconfigurator/qfunctionconfigurator.h b/qfunctionconfigurator/qfunctionconfigurator.h index d3a8741f..e4af0062 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.h +++ b/qfunctionconfigurator/qfunctionconfigurator.h @@ -16,40 +16,47 @@ class FTNOIR_TRACKER_BASE_EXPORT QFunctionConfigurator : public QWidget { Q_OBJECT - Q_PROPERTY(QColor colorBezier READ colorBezier WRITE setColorBezier) + Q_PROPERTY(QString Name READ get_name WRITE set_name) + QColor colorBezier() const { return colBezier; } + void setColorBezier(QColor color) + { + colBezier = color; + update(); + } + QString get_name() const { + return name; + } + void set_name(QString name) + { + this->name = name; + } public: QFunctionConfigurator(QWidget *parent = 0); FunctionConfig* config(); void setConfig(FunctionConfig* config); void saveSettings(QString settingsFile); - -signals: - void CurveChanged(bool); - public slots: - void setColorBezier(QColor); protected slots: void paintEvent(QPaintEvent *e); void mousePressEvent(QMouseEvent *e); void mouseMoveEvent(QMouseEvent *e); void mouseReleaseEvent(QMouseEvent *e); - protected: void drawBackground(); void drawFunction(); void drawPoint(QPainter *painter, const QPointF &pt, QColor colBG ); void drawLine(QPainter *painter, const QPointF &start, const QPointF &end, QPen pen); bool point_within_pixel(QPointF pt, QPointF pixel) const; - protected: virtual void resizeEvent(QResizeEvent *); private: + QString name; void update_range() { if (!_config) return; -- cgit v1.2.3 From 2b50200ca979cbf33d8e67503db341a6f62d1604 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 17 Sep 2014 12:47:48 +0200 Subject: ftclient: compile as C, cleanup --- CMakeLists.txt | 5 +- freetrackclient/freetrackclient.c | 151 ++++++++++++++++++++++++ freetrackclient/freetrackclient.cpp | 224 ------------------------------------ 3 files changed, 152 insertions(+), 228 deletions(-) create mode 100644 freetrackclient/freetrackclient.c delete mode 100644 freetrackclient/freetrackclient.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f79c7cd..5f666936 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -206,7 +206,7 @@ file(GLOB opentrack-xplane-plugin-c "x-plane-plugin/*.c") # freetrack -file(GLOB opentrack-freetrack-c "freetrackclient/*.cpp") +file(GLOB opentrack-freetrack-c "freetrackclient/*.c" "freetrackclient/*.def") if(SDK_XPLANE) # probably librt already included @@ -296,9 +296,6 @@ endif() if(WIN32) add_library(freetrackclient SHARED ${opentrack-freetrack-c}) - if(CMAKE_COMPILER_IS_GNUCC) - set_target_properties(freetrackclient PROPERTIES LINK_FLAGS "-Wl,--enable-stdcall-fixup -fno-lto -Wl,-kill-at" PREFIX "" COMPILE_FLAGS "-fno-lto") - endif() endif() opentrack_library(opentrack-proto-udp) diff --git a/freetrackclient/freetrackclient.c b/freetrackclient/freetrackclient.c new file mode 100644 index 00000000..007d073f --- /dev/null +++ b/freetrackclient/freetrackclient.c @@ -0,0 +1,151 @@ +/*********************************************************************************** + * * FTTypes FTTypes contains the specific type definitions for the * + * * FreeTrack protocol. * + * * It was loosely translated from FTTypes.pas * + * * which was created by the FreeTrack-team. * + * * * + * * Wim Vriend (Developing) * + * * Ron Hendriks (Testing and Research) * + * * * + * * Homepage <http://facetracknoir.sourceforge.net/home/default.htm> * + * * * + * * This program is distributed in the hope that it will be useful, but * + * * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * + * * or FITNESS FOR A PARTICULAR PURPOSE. * + * * * + * * * + * * The FreeTrackClient sources were translated from the original Delphi sources * + * * created by the FreeTrack developers. * + */ +#define NP_AXIS_MAX 16383 + +#include <stdarg.h> +#include <stdbool.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <windows.h> + +#include "ftnoir_protocol_ft/fttypes.h" + +#define FT_EXPORT(t) __declspec(dllexport) t __stdcall + +FT_EXPORT(bool) FTCreateMapping(void); + +#if 0 +static FILE *debug_stream = fopen("c:\\FreeTrackClient.log", "a"); +#define dbg_report(...) if (debug_stream) { fprintf(debug_stream, __VA_ARGS__); fflush(debug_stream); } +#else +#define dbg_report(...) ((void)0) +#endif + +static HANDLE hFTMemMap = 0; +static FTHeap *pMemData = 0; +static HANDLE hFTMutex = 0; +static const char* dllVersion = "1.0.0.0"; +static const char* dllProvider = "FreeTrack"; + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + switch (fdwReason) { + case DLL_PROCESS_ATTACH: +#ifdef WIN64 + dbg_report("\n= WIN64 =========================================================================================\n"); +#else + dbg_report("\n= WIN32 =========================================================================================\n"); +#endif + dbg_report("DllMain: (0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); + dbg_report("DllMain: Attach request\n"); + DisableThreadLibraryCalls(hinstDLL); + break; + + case DLL_PROCESS_DETACH: + dbg_report("DllMain: Detach\n"); + dbg_report("DllMain: (0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); + dbg_report("==========================================================================================\n"); + break; + } + return TRUE; +} + +FT_EXPORT(bool) FTGetData(FTData* data) +{ +// dbg_report("NP_GetData called."); + if (FTCreateMapping() == false) + return false; + + if (hFTMutex && WaitForSingleObject(hFTMutex, 16) == WAIT_OBJECT_0) { + if (pMemData) { + if (pMemData->data.DataID > (1 << 29)) { + pMemData->data.DataID = 0; + } + data->DataID = pMemData->data.DataID; + } + ReleaseMutex(hFTMutex); + } + return true; +} + +// For some mysterious reason, the previously existing function FTReportID has been changed to FTReportName, but with an integer as argument. +// The Delphi-code from the FreeTrack repo suggest a char * as argument, so it cost me an afternoon to figure it out (and keep ArmA2 from crashing). +// Thanks guys! +// +FT_EXPORT(void) FTReportName( int name ) +{ + dbg_report("FTReportName request (ID = %d).\n", name); +} + +FT_EXPORT(const char*) FTGetDllVersion(void) +{ + dbg_report("FTGetDllVersion request.\n"); + + return dllVersion; +} + +FT_EXPORT(const char*) FTProvider(void) +{ + dbg_report("FTProvider request.\n"); + + return dllProvider; +} + +// +// Create a memory-mapping to the Freetrack data. +// It contains the tracking data, a handle to the main-window and the program-name of the Game! +// +// +FT_EXPORT(bool) FTCreateMapping(void) +{ + if ( pMemData != NULL ) { + return true; + } + + dbg_report("FTCreateMapping request (pMemData == NULL).\n"); + + hFTMemMap = CreateFileMappingA( INVALID_HANDLE_VALUE , 00 , PAGE_READWRITE , 0 , + sizeof( FTHeap ), + (LPCSTR) FT_MM_DATA ); + + if (hFTMemMap == NULL) + { + pMemData = NULL; + return false; + } + + pMemData = (FTHeap*) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof( FTHeap ) ); + hFTMutex = CreateMutexA(NULL, false, FREETRACK_MUTEX); + + return true; +} + +FT_EXPORT(void) FTDestroyMapping(void) +{ + if ( pMemData != NULL ) { + UnmapViewOfFile ( pMemData ); + } + + CloseHandle( hFTMutex ); + CloseHandle( hFTMemMap ); + pMemData = 0; + hFTMemMap = 0; +} diff --git a/freetrackclient/freetrackclient.cpp b/freetrackclient/freetrackclient.cpp deleted file mode 100644 index 816e7b65..00000000 --- a/freetrackclient/freetrackclient.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/*********************************************************************************** - * * FTTypes FTTypes contains the specific type definitions for the * - * * FreeTrack protocol. * - * * It was loosely translated from FTTypes.pas * - * * which was created by the FreeTrack-team. * - * * * - * * Wim Vriend (Developing) * - * * Ron Hendriks (Testing and Research) * - * * * - * * Homepage <http://facetracknoir.sourceforge.net/home/default.htm> * - * * * - * * This program is distributed in the hope that it will be useful, but * - * * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * - * * or FITNESS FOR A PARTICULAR PURPOSE. * - * * * - * * * - * * The FreeTrackClient sources were translated from the original Delphi sources * - * * created by the FreeTrack developers. * - */ -#define NP_AXIS_MAX 16383 - -#include <stdarg.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <windows.h> -//#include <tchar.h> - -#include "ftnoir_protocol_ft/fttypes.h" - -#define FT_EXPORT(t) extern "C" __declspec(dllexport) t __stdcall - -// -// Functions to create/open the file-mapping -// and to destroy it again. -// -static float scale2AnalogLimits( float x, float min_x, float max_x ); -static float getDegreesFromRads ( float rads ); -FT_EXPORT(bool) FTCreateMapping(void); - -#if 0 -static FILE *debug_stream = fopen("c:\\FreeTrackClient.log", "a"); -#define dbg_report(...) if (debug_stream) { fprintf(debug_stream, __VA_ARGS__); fflush(debug_stream); } -#else -#define dbg_report(...) -#endif - -// -// Handles to 'handle' the memory mapping -// -static HANDLE hFTMemMap = 0; -static FTMemMap *pMemData = 0; -static HANDLE hFTMutex = 0; -static const char* dllVersion = "1.0.0.0"; -static const char* dllProvider = "FreeTrack"; - -// -// DllMain gets called, when the DLL is (un)loaded or a process attaches. -// -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - switch (fdwReason) { - case DLL_PROCESS_ATTACH: -#ifdef WIN64 - dbg_report("\n= WIN64 =========================================================================================\n"); -#else - dbg_report("\n= WIN32 =========================================================================================\n"); -#endif - dbg_report("DllMain: (0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); - dbg_report("DllMain: Attach request\n"); - DisableThreadLibraryCalls(hinstDLL); - break; - - case DLL_PROCESS_DETACH: - dbg_report("DllMain: Detach\n"); - dbg_report("DllMain: (0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); - dbg_report("==========================================================================================\n"); - break; - } - return TRUE; -} - -/****************************************************************** - * FTGetData (FreeTrackClient.1) - */ - -#pragma comment(linker, "/export:FTGetData@4=FTGetData") -FT_EXPORT(bool) FTGetData(PFreetrackData data) -{ -// dbg_report("NP_GetData called."); - if (FTCreateMapping() == false) return false; - - if (hFTMutex && WaitForSingleObject(hFTMutex, 5) == WAIT_OBJECT_0) { - if (pMemData) { - // - // Limit the range of DataID - // - if (pMemData->data.DataID > 1000) { - pMemData->data.DataID = 0; - } - data->DataID = pMemData->data.DataID; - - } - ReleaseMutex(hFTMutex); - } - return true; -} - -/****************************************************************** - * FTReportName (FreeTrackClient.2) - */ -#pragma comment(linker, "/export:FTReportName@4=FTReportName") -// -// For some mysterious reason, the previously existing function FTReportID has been changed to FTReportName, but with an integer as argument. -// The Delphi-code from the FreeTrack repo suggest a char * as argument, so it cost me an afternoon to figure it out (and keep ArmA2 from crashing). -// Thanks guys! -// -FT_EXPORT(void) FTReportName( int name ) -{ - dbg_report("FTReportName request (ID = %d).\n", name); -} - -/****************************************************************** - * FTGetDllVersion (FreeTrackClient.3) - */ -#pragma comment(linker, "/export:FTGetDllVersion@0=FTGetDllVersion") -FT_EXPORT(const char*) FTGetDllVersion(void) -{ - dbg_report("FTGetDllVersion request.\n"); - - return dllVersion; -} - -/****************************************************************** - * FTProvider (FreeTrackClient.4) - */ -#pragma comment(linker, "/export:FTProvider@0=FTProvider") -FT_EXPORT(const char*) FTProvider(void) -{ - dbg_report("FTProvider request.\n"); - - return dllProvider; -} - -// -// Create a memory-mapping to the Freetrack data. -// It contains the tracking data, a handle to the main-window and the program-name of the Game! -// -// -FT_EXPORT(bool) FTCreateMapping(void) -{ - // - // Memory-mapping already exists! - // - if ( pMemData != NULL ) { - return true; - } - - dbg_report("FTCreateMapping request (pMemData == NULL).\n"); - - // - // A FileMapping is used to create 'shared memory' between the FTClient and the FTServer. - // - // Try to create a FileMapping to the Shared Memory. This is done to check if it's already there (what - // may mean the face-tracker program is already running). - // - // If one already exists: close it and open the file-mapping to the existing one. - // - hFTMemMap = CreateFileMappingA( INVALID_HANDLE_VALUE , 00 , PAGE_READWRITE , 0 , - sizeof( FTMemMap ), - (LPCSTR) FT_MM_DATA ); - - if (hFTMemMap == NULL) - { - pMemData = NULL; - return false; - } - - pMemData = (FTMemMap *) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof( FTMemMap ) ); - hFTMutex = CreateMutexA(NULL, false, FREETRACK_MUTEX); - - return true; -} - -// -// Destory the FileMapping to the shared memory -// -FT_EXPORT(void) FTDestroyMapping(void) -{ - if ( pMemData != NULL ) { - UnmapViewOfFile ( pMemData ); - } - - CloseHandle( hFTMutex ); - CloseHandle( hFTMemMap ); - pMemData = 0; - hFTMemMap = 0; -} - -// -// 4 convenience -// -static float getDegreesFromRads ( float rads ) { - return (rads * 57.295781f); -} - -// -// Scale the measured value to the TIR values -// -static float scale2AnalogLimits( float x, float min_x, float max_x ) { -double y; -double local_x; - - local_x = x; - if (local_x > max_x) { - local_x = max_x; - } - if (local_x < min_x) { - local_x = min_x; - } - y = ( NP_AXIS_MAX * local_x ) / max_x; - - return (float) y; -} -- cgit v1.2.3 From df84ea6740236bd377de7fefc90764831ce663b4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 17 Sep 2014 12:54:58 +0200 Subject: ft proto: cleanup --- ftnoir_protocol_ft/ftnoir_protocol_ft.cpp | 82 ++++++++---------------- ftnoir_protocol_ft/ftnoir_protocol_ft.h | 13 ++-- ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp | 35 +++------- ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp | 27 +------- ftnoir_protocol_ft/fttypes.h | 44 +++---------- 5 files changed, 52 insertions(+), 149 deletions(-) diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp index 281af6a0..bb771c9d 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp @@ -28,9 +28,9 @@ #include "ftnoir_csv/csv.h" FTNoIR_Protocol::FTNoIR_Protocol() : - shm(FT_MM_DATA, FREETRACK_MUTEX, sizeof(FTMemMap)) + shm(FT_MM_DATA, FREETRACK_MUTEX, sizeof(FTHeap)) { - pMemData = (FTMemMap*) shm.mem; + pMemData = (FTHeap*) shm.mem; ProgramName = ""; intGameID = 0; viewsStart = 0; @@ -49,50 +49,30 @@ FTNoIR_Protocol::~FTNoIR_Protocol() } void FTNoIR_Protocol::sendHeadposeToGame(const double* headpose) { - float virtPosX; - float virtPosY; - float virtPosZ; - - float virtRotX; - float virtRotY; - float virtRotZ; - - float headPosX; - float headPosY; - float headPosZ; - - float headRotX; - float headRotY; - float headRotZ; - headRotX = virtRotX = getRadsFromDegrees(headpose[Pitch]) * (s.useDummyExe ? 2.0 : 1.0); - headRotY = virtRotY = getRadsFromDegrees(headpose[Yaw]); - headRotZ = virtRotZ = getRadsFromDegrees(headpose[Roll]); - headPosX = virtPosX = headpose[TX] * 10; - headPosY = virtPosY = headpose[TY] * 10; - headPosZ = virtPosZ = headpose[TZ] * 10; + float yaw = getRadsFromDegrees(headpose[Pitch]) * (s.useDummyExe ? 2.0 : 1.0); + float pitch = getRadsFromDegrees(headpose[Yaw]); + float roll = getRadsFromDegrees(headpose[Roll]); + float tx = headpose[TX] * 10.f; + float ty = headpose[TY] * 10.f; + float tz = headpose[TZ] * 10.f; shm.lock(); - pMemData->data.RawX = headPosX; - pMemData->data.RawY = headPosY; - pMemData->data.RawZ = headPosZ; - pMemData->data.RawPitch = headRotX; - pMemData->data.RawYaw = headRotY; - pMemData->data.RawRoll = headRotZ; - - // - // - pMemData->data.X = virtPosX; - pMemData->data.Y = virtPosY; - pMemData->data.Z = virtPosZ; - pMemData->data.Pitch = virtRotX; - pMemData->data.Yaw = virtRotY; - pMemData->data.Roll = virtRotZ; - - // - // Leave some values 0 yet... - // - pMemData->data.X1 = pMemData->data.DataID + 10; + pMemData->data.RawX = 0; + pMemData->data.RawY = 0; + pMemData->data.RawZ = 0; + pMemData->data.RawPitch = 0; + pMemData->data.RawYaw = 0; + pMemData->data.RawRoll = 0; + + pMemData->data.X = tx; + pMemData->data.Y = ty; + pMemData->data.Z = tz; + pMemData->data.Pitch = pitch; + pMemData->data.Yaw = yaw; + pMemData->data.Roll = roll; + + pMemData->data.X1 = ++pMemData->data.DataID; pMemData->data.X2 = 0; pMemData->data.X3 = 0; pMemData->data.X4 = 0; @@ -154,20 +134,14 @@ bool FTNoIR_Protocol::checkServerInstallationOK() { QSettings settings("Freetrack", "FreetrackClient"); // Registry settings (in HK_USER) QSettings settingsTIR("NaturalPoint", "NATURALPOINT\\NPClient Location"); // Registry settings (in HK_USER) - QString aLocation; // Location of Client DLL - if (!shm.success()) return false; - qDebug() << "checkServerInstallationOK says: Starting Function"; - - // - // Write the path in the registry (for FreeTrack and FreeTrack20), for the game(s). - // - aLocation = QCoreApplication::applicationDirPath() + "/"; + QString aLocation = QCoreApplication::applicationDirPath() + "/"; qDebug() << "checkServerInstallationOK says: used interface = " << s.intUsedInterface; + switch (s.intUsedInterface) { case 0: // Use both interfaces settings.setValue( "Path" , aLocation ); @@ -182,13 +156,9 @@ bool FTNoIR_Protocol::checkServerInstallationOK() settingsTIR.setValue( "Path" , aLocation ); break; default: - // should never be reached - break; + break; } - // - // TIRViews must be started first, or the NPClient DLL will never be loaded. - // if (s.useTIRViews) { start_tirviews(); } diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h index 01682e69..b1d71f08 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h @@ -36,7 +36,6 @@ #include <QDebug> #include <QFile> #include <QString> -#include <windows.h> #include <QMutex> #include <QMutexLocker> #include "compat/compat.h" @@ -55,9 +54,8 @@ struct settings { {} }; -//typedef char *(WINAPI *importProvider)(void); -typedef void (WINAPI *importTIRViewsStart)(void); -typedef void (WINAPI *importTIRViewsStop)(void); +typedef void (__stdcall *importTIRViewsStart)(void); +typedef void (__stdcall *importTIRViewsStop)(void); class FTNoIR_Protocol : public IProtocol { @@ -71,14 +69,13 @@ public: return connected_game; } private: - importTIRViewsStart viewsStart; // Functions inside TIRViews.dll + importTIRViewsStart viewsStart; importTIRViewsStop viewsStop; - - FTMemMap *pMemData; + + FTHeap *pMemData; QString game_name; PortableLockedShm shm; - // Private properties QString ProgramName; QLibrary FTIRViewsLib; QProcess dummyTrackIR; diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp index 5ce903b7..98d61675 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp @@ -26,21 +26,10 @@ #include <QDebug> #include <QFileDialog> -//******************************************************************************************************* -// FaceTrackNoIR Client Settings-dialog. -//******************************************************************************************************* - -// -// Constructor for server-settings-dialog -// -FTControls::FTControls() : - QWidget() +FTControls::FTControls() { - QString aFileName; // File Path and Name - ui.setupUi( this ); - // Connect Qt signals to member-functions connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); connect(ui.bntLocateNPClient, SIGNAL(clicked()), this, SLOT(selectDLL())); @@ -54,8 +43,8 @@ FTControls::FTControls() : tie_setting(s.intUsedInterface, ui.cbxSelectInterface); - aFileName = QCoreApplication::applicationDirPath() + "/TIRViews.dll"; - if ( !QFile::exists( aFileName ) ) { + QFile memhacks_pathname(QCoreApplication::applicationDirPath() + "/TIRViews.dll"); + if (!memhacks_pathname.exists()) { ui.chkTIRViews->setChecked( false ); ui.chkTIRViews->setEnabled ( false ); } @@ -75,22 +64,16 @@ void FTControls::doCancel() { } void FTControls::selectDLL() { - QString fileName = QFileDialog::getOpenFileName( this, tr("Select the desired NPClient DLL"), QCoreApplication::applicationDirPath() + "/NPClient.dll", tr("Dll file (*.dll);;All Files (*)")); - - // - // Write the location of the file in the required Registry-key. - // - if (! fileName.isEmpty() ) { - if (fileName.endsWith("NPClient.dll", Qt::CaseInsensitive) ) { - QSettings settingsTIR("NaturalPoint", "NATURALPOINT\\NPClient Location"); // Registry settings (in HK_USER) - QString aLocation = fileName.left(fileName.length() - 12); // Location of Client DLL + QString filename = QFileDialog::getOpenFileName( this, tr("Select the desired NPClient DLL"), QCoreApplication::applicationDirPath() + "/NPClient.dll", tr("Dll file (*.dll);;All Files (*)")); - settingsTIR.setValue( "Path" , aLocation ); - } + if (! filename.isEmpty() ) { + QSettings node("NaturalPoint", "NATURALPOINT\\NPClient Location"); + QFileInfo dllname(filename); + node.setValue( "Path" , dllname.dir().path() ); } } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) +extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog() { return new FTControls; } diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp index 38f11211..d5a51457 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp @@ -1,28 +1,5 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ -#include "ftnoir_protocol_ft.h" +#include "facetracknoir/plugin-support.h" +#include "ftnoir_protocol_ft/ftnoir_protocol_ft.h" extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { diff --git a/ftnoir_protocol_ft/fttypes.h b/ftnoir_protocol_ft/fttypes.h index ced844dc..cc78a80a 100644 --- a/ftnoir_protocol_ft/fttypes.h +++ b/ftnoir_protocol_ft/fttypes.h @@ -16,27 +16,16 @@ * * The FTTypes sources were translated from the original Delphi sources * * * created by the FreeTrack developers. * */ -#ifndef INCLUDED_FTTYPES_H -#define INCLUDED_FTTYPES_H -#if !defined(_WIN32) -# include <inttypes.h> -typedef int32_t my_32bit_int; -# define WINAPI -#else -# include <windows.h> -typedef __int32 my_32bit_int; -#endif +#pragma once -//#include "Registry.h" +#include <inttypes.h> -// static const char* FT_CLIENT_LOCATION = "Software\\Freetrack\\FreetrackClient"; -//#define FT_CLIENT_FILENAME "FreeTrackClient.Dll" #define FT_MM_DATA "FT_SharedMem" -//#define FREETRACK "Freetrack" #define FREETRACK_MUTEX "FT_Mutext" -struct TFreeTrackData { +// only 6 headpose floats and the data id are filled -sh +typedef struct __FTData { int DataID; int CamWidth; int CamHeight; @@ -63,24 +52,11 @@ struct TFreeTrackData { float Y3; float X4; float Y4; -}; -typedef TFreeTrackData * PFreetrackData; +} FTData; -struct FTMemMap { - TFreeTrackData data; - my_32bit_int GameID; +typedef struct __FTAlloc { + FTData data; + int32_t GameID; unsigned char table[8]; - my_32bit_int GameID2; -}; -typedef FTMemMap * PFTMemMap; - -//extern bool (*FTGetData) (PFreetrackData data); -// DLL function signatures -// These match those given in FTTypes.pas -// WINAPI is macro for __stdcall defined somewhere in the depths of windows.h -typedef bool (WINAPI *importGetData)(TFreeTrackData * data); -typedef char *(WINAPI *importGetDllVersion)(void); -typedef void (WINAPI *importReportID)(int name); -typedef char *(WINAPI *importProvider)(void); - -#endif//INCLUDED_FTTYPES_H + int32_t GameID2; +} FTHeap; -- cgit v1.2.3 From a521596921c5fc5f4b7502cc301f01f8dd3a8e52 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 17 Sep 2014 14:18:30 +0200 Subject: cleanup global symbols --- freetrackclient/freetrackclient.c | 74 +++++++++++++-------------------------- 1 file changed, 24 insertions(+), 50 deletions(-) diff --git a/freetrackclient/freetrackclient.c b/freetrackclient/freetrackclient.c index 007d073f..4d71ce30 100644 --- a/freetrackclient/freetrackclient.c +++ b/freetrackclient/freetrackclient.c @@ -49,25 +49,39 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: -#ifdef WIN64 - dbg_report("\n= WIN64 =========================================================================================\n"); -#else - dbg_report("\n= WIN32 =========================================================================================\n"); -#endif - dbg_report("DllMain: (0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); - dbg_report("DllMain: Attach request\n"); DisableThreadLibraryCalls(hinstDLL); break; case DLL_PROCESS_DETACH: - dbg_report("DllMain: Detach\n"); - dbg_report("DllMain: (0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); - dbg_report("==========================================================================================\n"); break; } return TRUE; } +static bool FTCreateMapping(void) +{ + if ( pMemData != NULL ) { + return true; + } + + dbg_report("FTCreateMapping request (pMemData == NULL).\n"); + + hFTMemMap = CreateFileMappingA( INVALID_HANDLE_VALUE , 00 , PAGE_READWRITE , 0 , + sizeof( FTHeap ), + (LPCSTR) FT_MM_DATA ); + + if (hFTMemMap == NULL) + { + pMemData = NULL; + return false; + } + + pMemData = (FTHeap*) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof( FTHeap ) ); + hFTMutex = CreateMutexA(NULL, false, FREETRACK_MUTEX); + + return true; +} + FT_EXPORT(bool) FTGetData(FTData* data) { // dbg_report("NP_GetData called."); @@ -109,43 +123,3 @@ FT_EXPORT(const char*) FTProvider(void) return dllProvider; } -// -// Create a memory-mapping to the Freetrack data. -// It contains the tracking data, a handle to the main-window and the program-name of the Game! -// -// -FT_EXPORT(bool) FTCreateMapping(void) -{ - if ( pMemData != NULL ) { - return true; - } - - dbg_report("FTCreateMapping request (pMemData == NULL).\n"); - - hFTMemMap = CreateFileMappingA( INVALID_HANDLE_VALUE , 00 , PAGE_READWRITE , 0 , - sizeof( FTHeap ), - (LPCSTR) FT_MM_DATA ); - - if (hFTMemMap == NULL) - { - pMemData = NULL; - return false; - } - - pMemData = (FTHeap*) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof( FTHeap ) ); - hFTMutex = CreateMutexA(NULL, false, FREETRACK_MUTEX); - - return true; -} - -FT_EXPORT(void) FTDestroyMapping(void) -{ - if ( pMemData != NULL ) { - UnmapViewOfFile ( pMemData ); - } - - CloseHandle( hFTMutex ); - CloseHandle( hFTMemMap ); - pMemData = 0; - hFTMemMap = 0; -} -- cgit v1.2.3 From d4dc0006fba2ce43fb09c47f1124df9c82836ddd Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 17 Sep 2014 14:19:04 +0200 Subject: add remap labels Issue: #52 --- facetracknoir/ftnoir_curves.ui | 107 ++++++++++++++++++++++++----------------- 1 file changed, 64 insertions(+), 43 deletions(-) diff --git a/facetracknoir/ftnoir_curves.ui b/facetracknoir/ftnoir_curves.ui index 951d37a7..f98bf884 100644 --- a/facetracknoir/ftnoir_curves.ui +++ b/facetracknoir/ftnoir_curves.ui @@ -33,7 +33,7 @@ <item> <widget class="QTabWidget" name="tabWidget"> <property name="styleSheet"> - <string notr="true">background-color: #ccc;</string> + <string notr="true"/> </property> <property name="tabPosition"> <enum>QTabWidget::North</enum> @@ -598,15 +598,8 @@ <bool>false</bool> </property> <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>RX</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QDoubleSpinBox" name="pos_rx"> + <item row="2" column="1"> + <widget class="QDoubleSpinBox" name="pos_rz"> <property name="suffix"> <string> deg.</string> </property> @@ -621,6 +614,22 @@ </property> </widget> </item> + <item row="2" column="3"> + <widget class="QDoubleSpinBox" name="pos_tz"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="decimals"> + <number>3</number> + </property> + <property name="minimum"> + <double>-100.000000000000000</double> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + </widget> + </item> <item row="0" column="2"> <widget class="QLabel" name="label_4"> <property name="text"> @@ -651,22 +660,6 @@ </property> </widget> </item> - <item row="1" column="1"> - <widget class="QDoubleSpinBox" name="pos_ry"> - <property name="suffix"> - <string> deg.</string> - </property> - <property name="decimals"> - <number>3</number> - </property> - <property name="minimum"> - <double>-180.000000000000000</double> - </property> - <property name="maximum"> - <double>180.000000000000000</double> - </property> - </widget> - </item> <item row="1" column="2"> <widget class="QLabel" name="label_5"> <property name="text"> @@ -674,19 +667,19 @@ </property> </widget> </item> - <item row="1" column="3"> - <widget class="QDoubleSpinBox" name="pos_ty"> + <item row="1" column="1"> + <widget class="QDoubleSpinBox" name="pos_ry"> <property name="suffix"> - <string> cm</string> + <string> deg.</string> </property> <property name="decimals"> <number>3</number> </property> <property name="minimum"> - <double>-100.000000000000000</double> + <double>-180.000000000000000</double> </property> <property name="maximum"> - <double>100.000000000000000</double> + <double>180.000000000000000</double> </property> </widget> </item> @@ -704,35 +697,42 @@ </property> </widget> </item> - <item row="2" column="1"> - <widget class="QDoubleSpinBox" name="pos_rz"> + <item row="1" column="3"> + <widget class="QDoubleSpinBox" name="pos_ty"> <property name="suffix"> - <string> deg.</string> + <string> cm</string> </property> <property name="decimals"> <number>3</number> </property> <property name="minimum"> - <double>-180.000000000000000</double> + <double>-100.000000000000000</double> </property> <property name="maximum"> - <double>180.000000000000000</double> + <double>100.000000000000000</double> </property> </widget> </item> - <item row="2" column="3"> - <widget class="QDoubleSpinBox" name="pos_tz"> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>RX</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QDoubleSpinBox" name="pos_rx"> <property name="suffix"> - <string> cm</string> + <string> deg.</string> </property> <property name="decimals"> <number>3</number> </property> <property name="minimum"> - <double>-100.000000000000000</double> + <double>-180.000000000000000</double> </property> <property name="maximum"> - <double>100.000000000000000</double> + <double>180.000000000000000</double> </property> </widget> </item> @@ -753,7 +753,7 @@ </font> </property> <property name="title"> - <string>Output source</string> + <string>Output remap</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> @@ -764,7 +764,7 @@ <property name="checkable"> <bool>false</bool> </property> - <layout class="QGridLayout" name="gridLayout_4" rowstretch="0,0,0,0,0,0,0" columnstretch="0,0,0,0"> + <layout class="QGridLayout" name="gridLayout_4" rowstretch="0,0,0,0,0,0,0" columnstretch="0,0,0"> <property name="sizeConstraint"> <enum>QLayout::SetMinAndMaxSize</enum> </property> @@ -1059,6 +1059,27 @@ </item> </widget> </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_13"> + <property name="text"> + <string>Source</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_14"> + <property name="text"> + <string>Invert</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_15"> + <property name="text"> + <string>Destination</string> + </property> + </widget> + </item> </layout> </widget> </item> -- cgit v1.2.3 From 448d4dfaaaa6c055a91eb97b3e39e35ce2cba30f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 17 Sep 2014 14:19:23 +0200 Subject: no need for dllmain --- freetrackclient/freetrackclient.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/freetrackclient/freetrackclient.c b/freetrackclient/freetrackclient.c index 4d71ce30..84346c3c 100644 --- a/freetrackclient/freetrackclient.c +++ b/freetrackclient/freetrackclient.c @@ -45,19 +45,6 @@ static HANDLE hFTMutex = 0; static const char* dllVersion = "1.0.0.0"; static const char* dllProvider = "FreeTrack"; -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - switch (fdwReason) { - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(hinstDLL); - break; - - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - static bool FTCreateMapping(void) { if ( pMemData != NULL ) { -- cgit v1.2.3 From 73a6c374bd9233b2f1fd9696a69983bb3b7d5563 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Thu, 18 Sep 2014 04:20:20 +0200 Subject: Revert "initialize COM on _WIN32 as per Win32 API" This reverts commit 03e4d58bbbbfb5d841354a34a2e2dc317b189deb. Issue: #53 Ironically breaks Windows open/save dialogs --- facetracknoir/main.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp index 694715d1..7462f8c2 100644 --- a/facetracknoir/main.cpp +++ b/facetracknoir/main.cpp @@ -2,16 +2,8 @@ #include <QApplication> #include <memory> -#ifdef _WIN32 -# include <objbase.h> -#endif - int main(int argc, char** argv) { -#ifdef _WIN32 - CoInitializeEx(NULL, COINIT_MULTITHREADED); -#endif - QApplication::setAttribute(Qt::AA_X11InitThreads, true); QApplication app(argc, argv); auto w = std::make_shared<FaceTrackNoIR>(); -- cgit v1.2.3 From cbca9cd89a79ea0dafbbfa843e2b239ed6cc20a9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Thu, 18 Sep 2014 04:24:51 +0200 Subject: reformat --- freetrackclient/freetrackclient.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/freetrackclient/freetrackclient.c b/freetrackclient/freetrackclient.c index 84346c3c..717a1c6a 100644 --- a/freetrackclient/freetrackclient.c +++ b/freetrackclient/freetrackclient.c @@ -47,15 +47,16 @@ static const char* dllProvider = "FreeTrack"; static bool FTCreateMapping(void) { - if ( pMemData != NULL ) { + if (pMemData != NULL) { return true; } - dbg_report("FTCreateMapping request (pMemData == NULL).\n"); - - hFTMemMap = CreateFileMappingA( INVALID_HANDLE_VALUE , 00 , PAGE_READWRITE , 0 , - sizeof( FTHeap ), - (LPCSTR) FT_MM_DATA ); + hFTMemMap = CreateFileMappingA(INVALID_HANDLE_VALUE, + NULL, + PAGE_READWRITE, + 0, + sizeof(FTHeap), + (LPCSTR) FT_MM_DATA); if (hFTMemMap == NULL) { @@ -63,7 +64,7 @@ static bool FTCreateMapping(void) return false; } - pMemData = (FTHeap*) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof( FTHeap ) ); + pMemData = (FTHeap*) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof(FTHeap)); hFTMutex = CreateMutexA(NULL, false, FREETRACK_MUTEX); return true; @@ -71,7 +72,6 @@ static bool FTCreateMapping(void) FT_EXPORT(bool) FTGetData(FTData* data) { -// dbg_report("NP_GetData called."); if (FTCreateMapping() == false) return false; -- cgit v1.2.3 From f6de2d9efb38788869005f92881e07e72b86b444 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Thu, 18 Sep 2014 04:25:23 +0200 Subject: ftclient: .def doesn't work, don't lie to ourselves --- CMakeLists.txt | 3 ++- freetrackclient/freetrackclient.def | 6 ------ 2 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 freetrackclient/freetrackclient.def diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f666936..cdf81aab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -206,7 +206,7 @@ file(GLOB opentrack-xplane-plugin-c "x-plane-plugin/*.c") # freetrack -file(GLOB opentrack-freetrack-c "freetrackclient/*.c" "freetrackclient/*.def") +file(GLOB opentrack-freetrack-c "freetrackclient/*.c") if(SDK_XPLANE) # probably librt already included @@ -296,6 +296,7 @@ endif() if(WIN32) add_library(freetrackclient SHARED ${opentrack-freetrack-c}) + set_target_properties(freetrackclient PROPERTIES PREFIX "") endif() opentrack_library(opentrack-proto-udp) diff --git a/freetrackclient/freetrackclient.def b/freetrackclient/freetrackclient.def deleted file mode 100644 index 155648dd..00000000 --- a/freetrackclient/freetrackclient.def +++ /dev/null @@ -1,6 +0,0 @@ -LIBRARY freetrackclient.dll -EXPORTS -FTGetData@4 = FTGetData -FTReportName@4 = FTReportName -FTGetDllVersion@0 = FTGetDllVersion -FTProvider@0 = FTProvider -- cgit v1.2.3 From 748777e254da04350c8efcc412b0745558ed156c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Thu, 18 Sep 2014 04:26:16 +0200 Subject: nix unused includes --- freetrackclient/freetrackclient.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/freetrackclient/freetrackclient.c b/freetrackclient/freetrackclient.c index 717a1c6a..cec69348 100644 --- a/freetrackclient/freetrackclient.c +++ b/freetrackclient/freetrackclient.c @@ -19,10 +19,7 @@ */ #define NP_AXIS_MAX 16383 -#include <stdarg.h> #include <stdbool.h> -#include <stdlib.h> -#include <stdio.h> #include <string.h> #include <windows.h> @@ -33,6 +30,7 @@ FT_EXPORT(bool) FTCreateMapping(void); #if 0 +#include <stdio.h> static FILE *debug_stream = fopen("c:\\FreeTrackClient.log", "a"); #define dbg_report(...) if (debug_stream) { fprintf(debug_stream, __VA_ARGS__); fflush(debug_stream); } #else -- cgit v1.2.3 From f95add4571874c58b35ff4929bcea75dc4080e16 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Thu, 18 Sep 2014 04:29:47 +0200 Subject: fix build --- freetrackclient/freetrackclient.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/freetrackclient/freetrackclient.c b/freetrackclient/freetrackclient.c index cec69348..e69d9911 100644 --- a/freetrackclient/freetrackclient.c +++ b/freetrackclient/freetrackclient.c @@ -27,8 +27,6 @@ #define FT_EXPORT(t) __declspec(dllexport) t __stdcall -FT_EXPORT(bool) FTCreateMapping(void); - #if 0 #include <stdio.h> static FILE *debug_stream = fopen("c:\\FreeTrackClient.log", "a"); -- cgit v1.2.3 From cf5ab7886e8228d1622566cc59277bcf089199a9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Thu, 18 Sep 2014 07:24:52 +0200 Subject: cleanup qfc Issue: #44 Remove confusing logic and retarded comments by the usual offender. Change prototypes a bit for clarity's sake again. --- facetracknoir/curve-config.cpp | 56 +++---- qfunctionconfigurator/functionconfig.cpp | 11 +- qfunctionconfigurator/functionconfig.h | 2 +- qfunctionconfigurator/qfunctionconfigurator.cpp | 188 +++++++++++------------- qfunctionconfigurator/qfunctionconfigurator.h | 72 +++++---- 5 files changed, 158 insertions(+), 171 deletions(-) diff --git a/facetracknoir/curve-config.cpp b/facetracknoir/curve-config.cpp index e1f39d03..535655c2 100644 --- a/facetracknoir/curve-config.cpp +++ b/facetracknoir/curve-config.cpp @@ -1,7 +1,5 @@ #include "facetracknoir/facetracknoir.h" #include "facetracknoir/curve-config.h" -#include <QDebug> -#include <QCheckBox> CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidget *parent) : QWidget( parent, Qt::Dialog ), mainApp(ftnoir) { @@ -78,39 +76,45 @@ void CurveConfigurationDialog::loadSettings() { ui.rzconfig_alt }; - QSettings settings("opentrack"); - QString currentFile = settings.value("SettingsFile", - QCoreApplication::applicationDirPath() + "/settings/default.ini" ) - .toString(); - for (int i = 0; i < 6; i++) { - configs[i]->setConfig(&mainApp->axis(i).curve); - alt_configs[i]->setConfig(&mainApp->axis(i).curveAlt); + configs[i]->setConfig(&mainApp->axis(i).curve, mainApp->axis(i).name1); + alt_configs[i]->setConfig(&mainApp->axis(i).curveAlt, mainApp->axis(i).name2); } } void CurveConfigurationDialog::save() { - - qDebug() << "save() says: started"; - QSettings settings("opentrack"); QString currentFile = settings.value("SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ) .toString(); - - ui.rxconfig->saveSettings(currentFile); - ui.ryconfig->saveSettings(currentFile); - ui.rzconfig->saveSettings(currentFile); - ui.txconfig->saveSettings(currentFile); - ui.tyconfig->saveSettings(currentFile); - ui.tzconfig->saveSettings(currentFile); - - ui.txconfig_alt->saveSettings(currentFile); - ui.tyconfig_alt->saveSettings(currentFile); - ui.tzconfig_alt->saveSettings(currentFile); - ui.rxconfig_alt->saveSettings(currentFile); - ui.ryconfig_alt->saveSettings(currentFile); - ui.rzconfig_alt->saveSettings(currentFile); + + struct { + QFunctionConfigurator* qfc; + Axis axis; + bool altp; + } qfcs[] = + { + { ui.rxconfig, Yaw, false }, + { ui.ryconfig, Pitch, false}, + { ui.rzconfig, Roll, false }, + { ui.txconfig, TX, false }, + { ui.tyconfig, TY, false }, + { ui.tzconfig, TZ, false }, + + { ui.rxconfig_alt, Yaw, true }, + { ui.ryconfig_alt, Pitch, true}, + { ui.rzconfig_alt, Roll, true }, + { ui.txconfig_alt, TX, true }, + { ui.tyconfig_alt, TY, true }, + { ui.tzconfig_alt, TZ, true }, + { nullptr, Yaw, false } + }; + + for (int i = 0; qfcs[i].qfc; i++) + { + THeadPoseDOF& axis = mainApp->axis(qfcs[i].axis); + qfcs[i].qfc->saveSettings(currentFile, qfcs[i].altp ? axis.name2 : axis.name1); + } } diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index 640db1ef..159f350e 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -14,7 +14,7 @@ #include <QtAlgorithms> #include <QtAlgorithms> #include <QSettings> -#include <math.h> +#include <cmath> #include <QPixmap> void FunctionConfig::setTrackingActive(bool blnActive) @@ -156,13 +156,10 @@ void FunctionConfig::movePoint(int idx, QPointF pt) { } } -QList<QPointF> FunctionConfig::getPoints() { - QList<QPointF> ret; +const QList<QPointF> FunctionConfig::getPoints() { QMutexLocker foo(&_mutex); - for (int i = 0; i < input.size(); i++) { - ret.append(input[i]); - } - return ret; + // NB can't pass by reference + return input; } void FunctionConfig::loadSettings(QSettings& settings, const QString& title) { diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h index 22bfc406..ee2087a0 100644 --- a/qfunctionconfigurator/functionconfig.h +++ b/qfunctionconfigurator/functionconfig.h @@ -85,7 +85,7 @@ public: void addPoint(QPointF pt); void movePoint(int idx, QPointF pt); - QList<QPointF> getPoints(); + const QList<QPointF> getPoints(); void setMaxInput(int MaxInput) { max_x = MaxInput; } diff --git a/qfunctionconfigurator/qfunctionconfigurator.cpp b/qfunctionconfigurator/qfunctionconfigurator.cpp index a197dadb..17431986 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.cpp +++ b/qfunctionconfigurator/qfunctionconfigurator.cpp @@ -1,10 +1,12 @@ -/* Copyright (c) 2011-2012 Stanislaw Halik <sthalik@misaki.pl> - * Adapted to FaceTrackNoIR by Wim Vriend. +/* Copyright (c) 2011-2014 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. */ +// Adapted to FaceTrackNoIR by Wim Vriend. + #include "qfunctionconfigurator/qfunctionconfigurator.h" #include <QPainter> #include <QPaintEvent> @@ -25,35 +27,33 @@ static const int pointSize = 5; -QFunctionConfigurator::QFunctionConfigurator(QWidget *parent) - : QWidget(parent) +QFunctionConfigurator::QFunctionConfigurator(QWidget *parent) : + QWidget(parent), + _config(nullptr), + moving_control_point_idx(-1), + _draw_function(true) { - movingPoint = -1; - _config = 0; - _draw_background = true; - _draw_function = true; update_range(); setMouseTracking(true); } -void QFunctionConfigurator::setConfig(FunctionConfig* config) { +void QFunctionConfigurator::setConfig(FunctionConfig* config, const QString& name) { QSettings settings("opentrack"); QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); config->loadSettings(iniFile, name); _config = config; - _draw_function = _draw_background = true; + _draw_function = true; update_range(); update(); } -void QFunctionConfigurator::saveSettings(QString settingsFile) { - QSettings iniFile( settingsFile, QSettings::IniFormat ); // Application settings (in INI-file) +void QFunctionConfigurator::saveSettings(QString settingsFile, const QString& name) { + QSettings iniFile(settingsFile, QSettings::IniFormat); - if (_config) { + if (_config) _config->saveSettings(iniFile, name); - } } void QFunctionConfigurator::drawBackground() @@ -61,11 +61,13 @@ void QFunctionConfigurator::drawBackground() if (!_config) return; _background = QPixmap(width(), height()); + QPainter painter(&_background); painter.fillRect(rect(), QColor::fromRgb(204, 204, 204)); painter.setRenderHint(QPainter::Antialiasing); + QColor bg_color(112, 154, 209); - painter.fillRect(range, bg_color); + painter.fillRect(pixel_bounds, bg_color); QFont font; font.setPointSize(8); @@ -79,61 +81,59 @@ void QFunctionConfigurator::drawBackground() const int maxy = _config->maxOutput(); // horizontal grid - for (int i = 0; i < maxy; i += xstep) { - double y = range.height() - i * c.y() + range.y(); + double y = pixel_bounds.height() - i * c.y() + pixel_bounds.y(); drawLine(&painter, - QPointF(range.x(), y), - QPointF(range.x() + range.width(), y), + QPointF(pixel_bounds.x(), y), + QPointF(pixel_bounds.x() + pixel_bounds.width(), y), pen); painter.drawText(QRectF(10, y - metrics.height()/2, - range.left(), + pixel_bounds.left(), metrics.height()), QString::number(i)); } { const int i = maxy; - double y = range.height() - i * c.y() + range.y(); + double y = pixel_bounds.height() - i * c.y() + pixel_bounds.y(); drawLine(&painter, - QPointF(range.x(), y), - QPointF(range.x() + range.width(), y), + QPointF(pixel_bounds.x(), y), + QPointF(pixel_bounds.x() + pixel_bounds.width(), y), pen); painter.drawText(QRectF(10, y - metrics.height()/2, - range.x() - 10, + pixel_bounds.x() - 10, metrics.height()), QString::number(i)); } // vertical grid - for (int i = 0; i < maxx; i += ystep) { - double x = range.x() + i * c.x(); + double x = pixel_bounds.x() + i * c.x(); drawLine(&painter, - QPointF(x, range.y()), - QPointF(x, range.y() + range.height()), + QPointF(x, pixel_bounds.y()), + QPointF(x, pixel_bounds.y() + pixel_bounds.height()), pen); const QString text = QString::number(i); painter.drawText(QRectF(x - metrics.width(text)/2, - range.height() + 10 + metrics.height(), + pixel_bounds.height() + 10 + metrics.height(), metrics.width(text), metrics.height()), text); } { const int i = maxx; - double x = range.x() + i * c.x(); + double x = pixel_bounds.x() + i * c.x(); drawLine(&painter, - QPointF(x, range.y()), - QPointF(x, range.y() + range.height()), + QPointF(x, pixel_bounds.y()), + QPointF(x, pixel_bounds.y() + pixel_bounds.height()), pen); const QString text = QString::number(i); painter.drawText(QRectF(x - metrics.width(text)/2, - range.height() + 10 + metrics.height(), + pixel_bounds.height() + 10 + metrics.height(), metrics.width(text), metrics.height()), text); @@ -144,9 +144,6 @@ void QFunctionConfigurator::drawFunction() { if (!_config) return; - int i; - QPointF prevPoint; - QPointF currentPoint; _function = QPixmap(_background); QPainter painter(&_function); @@ -156,19 +153,18 @@ void QFunctionConfigurator::drawFunction() QList<QPointF> points = _config->getPoints(); - for (i = 0; i < points.size(); i++) { - currentPoint = point_to_pixel( points[i] ); // Get the next point and convert it to Widget measures - drawPoint(&painter, currentPoint, QColor(200, 200, 210, 120)); - lastPoint = currentPoint; // Remember which point is the rightmost in the graph + for (int i = 0; i < points.size(); i++) { + drawPoint(&painter, + point_to_pixel(points[i]), + QColor(200, 200, 210, 120)); } + QPen pen(spline_color, 1.2, Qt::SolidLine); - QPen pen(colBezier, 1.2, Qt::SolidLine); - - prevPoint = point_to_pixel( QPointF(0,0) ); // Start at the Axis - double max = _config->maxInput(); + static const constexpr double step = 1.02; + const double max = _config->maxInput(); + QPointF prev = point_to_pixel(QPointF(0, 0)); - const double step = 1.01; for (double i = 0; i < max; i += step) { double val = _config->getValue(i); QPointF cur = point_to_pixel(QPointF(i, val)); @@ -180,66 +176,54 @@ void QFunctionConfigurator::drawFunction() void QFunctionConfigurator::paintEvent(QPaintEvent *e) { - QPointF prevPoint; - QPointF currentPoint; - QPointF actualPos; - int i; - QPainter p(this); p.setRenderHint(QPainter::Antialiasing); - if (_draw_background) { + if (_background.isNull()) drawBackground(); - _draw_background = false; - } p.drawPixmap(e->rect(), _background); if (_draw_function) { - drawFunction(); // Draw the Function on a Pixmap _draw_function = false; + drawFunction(); } - p.drawPixmap(e->rect(), _function); // Always draw the background and the function + p.drawPixmap(e->rect(), _function); if (_config) { QPen pen(Qt::white, 1, Qt::SolidLine); QList<QPointF> points = _config->getPoints(); - if (movingPoint >= 0 && movingPoint < points.size()) { - prevPoint = point_to_pixel( QPointF(0,0) ); // Start at the Axis - for (i = 0; i < points.size(); i++) { - currentPoint = point_to_pixel( points[i] ); // Get the next point and convert it to Widget measures - drawLine(&p, prevPoint, currentPoint, pen); - prevPoint = currentPoint; + if (moving_control_point_idx >= 0 && moving_control_point_idx < points.size()) { + QPointF prev; + for (int i = 0; i < points.size(); i++) { + auto tmp = point_to_pixel(points[i]); + drawLine(&p, prev, tmp, pen); + prev = tmp; } pen.setWidth(1); pen.setColor( Qt::white ); pen.setStyle( Qt::DashLine ); - actualPos = point_to_pixel(points[movingPoint]); - drawLine(&p, QPoint(range.left(), actualPos.y()), QPoint(actualPos.x(), actualPos.y()), pen); - drawLine(&p, QPoint(actualPos.x(), actualPos.y()), QPoint(actualPos.x(), range.height() + range.top()), pen); + QPointF pixel_pos = point_to_pixel(points[moving_control_point_idx]); + drawLine(&p, QPoint(pixel_bounds.left(), pixel_pos.y()), QPoint(pixel_pos.x(), pixel_pos.y()), pen); + drawLine(&p, QPoint(pixel_pos.x(), pixel_pos.y()), QPoint(pixel_pos.x(), pixel_bounds.height() + pixel_bounds.top()), pen); } - // // If the Tracker is active, the 'Last Point' it requested is recorded. // Show that point on the graph, with some lines to assist. // This new feature is very handy for tweaking the curves! - // - if (_config->getLastPoint( currentPoint )) { - actualPos = point_to_pixel( QPointF(fabs(currentPoint.x()), fabs(currentPoint.y())) ); - drawPoint(&p, actualPos, QColor(255, 0, 0, 120)); + QPointF last; + if (_config->getLastPoint(last)) { + QPointF pixel_pos = point_to_pixel( QPointF(fabs(last.x()), fabs(last.y())) ); + drawPoint(&p, pixel_pos, QColor(255, 0, 0, 120)); pen.setWidth(1); pen.setColor( Qt::black ); pen.setStyle( Qt::SolidLine ); - drawLine(&p, QPoint(range.left(), actualPos.y()), QPoint(actualPos.x(), actualPos.y()), pen); - drawLine(&p, QPoint(actualPos.x(), actualPos.y()), QPoint(actualPos.x(), range.width()), pen); + drawLine(&p, QPoint(pixel_bounds.left(), pixel_pos.y()), QPoint(pixel_pos.x(), pixel_pos.y()), pen); + drawLine(&p, QPoint(pixel_pos.x(), pixel_pos.y()), QPoint(pixel_pos.x(), pixel_bounds.width()), pen); } - } } -// -// Draw the handle, to move the Bezier-curve. -// void QFunctionConfigurator::drawPoint(QPainter *painter, const QPointF &pos, QColor colBG ) { painter->save(); @@ -251,7 +235,7 @@ void QFunctionConfigurator::drawPoint(QPainter *painter, const QPointF &pos, QCo painter->restore(); } -void QFunctionConfigurator::drawLine(QPainter *painter, const QPointF &start, const QPointF &end, QPen pen) +void QFunctionConfigurator::drawLine(QPainter *painter, const QPointF &start, const QPointF &end, QPen &pen) { painter->save(); painter->setPen(pen); @@ -267,12 +251,12 @@ void QFunctionConfigurator::mousePressEvent(QMouseEvent *e) QList<QPointF> points = _config->getPoints(); if (e->button() == Qt::LeftButton) { bool bTouchingPoint = false; - movingPoint = -1; + moving_control_point_idx = -1; if (_config) { for (int i = 0; i < points.size(); i++) { if ( point_within_pixel(points[i], e->pos() ) ) { bTouchingPoint = true; - movingPoint = i; + moving_control_point_idx = i; timer.restart(); break; } @@ -296,7 +280,7 @@ void QFunctionConfigurator::mousePressEvent(QMouseEvent *e) if (found_pt != -1) { _config->removePoint(found_pt); } - movingPoint = -1; + moving_control_point_idx = -1; } } _draw_function = true; @@ -307,29 +291,33 @@ void QFunctionConfigurator::mouseMoveEvent(QMouseEvent *e) { if (!_config) return; + + static const constexpr int min_refresh_delay = 25; + + if (timer.isValid() && timer.elapsed() < min_refresh_delay) + return; + + static const constexpr int refresh_delay = 50; QList<QPointF> points = _config->getPoints(); - const int refresh_delay = 50; - if (movingPoint >= 0 && movingPoint < points.size()) { + if (moving_control_point_idx >= 0 && moving_control_point_idx < points.size()) { setCursor(Qt::ClosedHandCursor); if (timer.isValid() && timer.elapsed() > refresh_delay) { timer.restart(); QPointF new_pt = pixel_coord_to_point(e->pos()); - points[movingPoint] = new_pt; - _config->movePoint(movingPoint, new_pt); + points[moving_control_point_idx] = new_pt; + _config->movePoint(moving_control_point_idx, new_pt); _draw_function = true; update(); } } else { bool bTouchingPoint = false; - if (_config) { - for (int i = 0; i < points.size(); i++) { - if ( point_within_pixel(points[i], e->pos() ) ) { - bTouchingPoint = true; - } + for (int i = 0; i < points.size(); i++) { + if ( point_within_pixel(points[i], e->pos() ) ) { + bTouchingPoint = true; } } @@ -346,37 +334,39 @@ void QFunctionConfigurator::mouseReleaseEvent(QMouseEvent *e) { if (!_config) return; + QList<QPointF> points = _config->getPoints(); if (e->button() == Qt::LeftButton) { timer.invalidate(); - if (movingPoint >= 0 && movingPoint < points.size()) { + if (moving_control_point_idx >= 0 && moving_control_point_idx < points.size()) { if (_config) { - _config->movePoint(movingPoint, pixel_coord_to_point(e->pos())); + _config->movePoint(moving_control_point_idx, pixel_coord_to_point(e->pos())); } } setCursor(Qt::ArrowCursor); - movingPoint = -1; + moving_control_point_idx = -1; } _draw_function = true; update(); } -bool QFunctionConfigurator::point_within_pixel(QPointF pt, QPointF pixel) const +bool QFunctionConfigurator::point_within_pixel(const QPointF &pt, const QPointF &pixel) { - QPointF pixel2(range.x() + pt.x() * c.x(), (range.y() + range.height() - pt.y() * c.y())); + QPointF pixel2(pixel_bounds.x() + pt.x() * c.x(), + (pixel_bounds.y() + pixel_bounds.height() - pt.y() * c.y())); return pixel2.x() >= pixel.x() - pointSize && pixel2.x() < pixel.x() + pointSize && pixel2.y() >= pixel.y() - pointSize && pixel2.y() < pixel.y() + pointSize; } -QPointF QFunctionConfigurator::pixel_coord_to_point(QPointF point) const +QPointF QFunctionConfigurator::pixel_coord_to_point(const QPointF& point) { if (!_config) return QPointF(-1, -1); - double x = (point.x() - range.x()) / c.x(); - double y = (range.height() - point.y() + range.y()) / c.y(); + double x = (point.x() - pixel_bounds.x()) / c.x(); + double y = (pixel_bounds.height() - point.y() + pixel_bounds.y()) / c.y(); if (x < 0) x = 0; @@ -391,10 +381,10 @@ QPointF QFunctionConfigurator::pixel_coord_to_point(QPointF point) const return QPointF(x, y); } -QPointF QFunctionConfigurator::point_to_pixel(QPointF point) const +QPointF QFunctionConfigurator::point_to_pixel(const QPointF& point) { - return QPointF(range.x() + point.x() * c.x(), - range.y() + range.height() - point.y() * c.y()); + return QPointF(pixel_bounds.x() + point.x() * c.x(), + pixel_bounds.y() + pixel_bounds.height() - point.y() * c.y()); } void QFunctionConfigurator::resizeEvent(QResizeEvent *) diff --git a/qfunctionconfigurator/qfunctionconfigurator.h b/qfunctionconfigurator/qfunctionconfigurator.h index e4af0062..4643f0d5 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.h +++ b/qfunctionconfigurator/qfunctionconfigurator.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012 Stanislaw Halik <sthalik@misaki.pl> +/* Copyright (c) 2011-2014 Stanislaw Halik <sthalik@misaki.pl> * Adapted to FaceTrackNoIR by Wim Vriend. * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -16,73 +16,69 @@ class FTNOIR_TRACKER_BASE_EXPORT QFunctionConfigurator : public QWidget { Q_OBJECT - Q_PROPERTY(QString Name READ get_name WRITE set_name) + Q_PROPERTY(QColor colorBezier READ colorBezier WRITE setColorBezier) +public: + QFunctionConfigurator(QWidget *parent = 0); + + FunctionConfig* config(); + void setConfig(FunctionConfig* config, const QString &name); + + void saveSettings(QString settingsFile, const QString &name); QColor colorBezier() const { - return colBezier; + return spline_color; } void setColorBezier(QColor color) { - colBezier = color; + spline_color = color; update(); } - QString get_name() const { - return name; - } - void set_name(QString name) - { - this->name = name; - } -public: - QFunctionConfigurator(QWidget *parent = 0); - FunctionConfig* config(); - - void setConfig(FunctionConfig* config); - void saveSettings(QString settingsFile); -public slots: protected slots: void paintEvent(QPaintEvent *e); void mousePressEvent(QMouseEvent *e); void mouseMoveEvent(QMouseEvent *e); void mouseReleaseEvent(QMouseEvent *e); -protected: +private: void drawBackground(); void drawFunction(); void drawPoint(QPainter *painter, const QPointF &pt, QColor colBG ); - void drawLine(QPainter *painter, const QPointF &start, const QPointF &end, QPen pen); - bool point_within_pixel(QPointF pt, QPointF pixel) const; + void drawLine(QPainter *painter, const QPointF &start, const QPointF &end, QPen& pen); + bool point_within_pixel(const QPointF& pt, const QPointF& pixel); protected: virtual void resizeEvent(QResizeEvent *); - private: - QString name; void update_range() { if (!_config) return; - double w = width(), h = height(); + + const double w = width(), h = height(); const double mwl = 40, mhl = 20; const double mwr = 15, mhr = 35; - range = QRectF(mwl, mhl, (w - mwl - mwr), (h - mhl - mhr)); - c = QPointF(range.width() / _config->maxInput(), range.height() / _config->maxOutput()); - _draw_function = _draw_background = true; + + pixel_bounds = QRectF(mwl, mhl, (w - mwl - mwr), (h - mhl - mhr)); + c = QPointF(pixel_bounds.width() / _config->maxInput(), pixel_bounds.height() / _config->maxOutput()); + _draw_function = true; + + _background = QPixmap(); + _function = QPixmap(); } - QRectF range; - QPointF lastPoint; - QPointF pixel_coord_to_point (QPointF point) const; - QPointF point_to_pixel (QPointF point) const; + QPointF pixel_coord_to_point (const QPointF& point); + QPointF point_to_pixel (const QPointF& point); - int movingPoint; + FunctionConfig* _config; + + // bounds of the rectangle user can interact with + QRectF pixel_bounds; + + int moving_control_point_idx; QElapsedTimer timer; QPointF c; - QColor colBezier; - - bool _draw_background; + QColor spline_color; + QPixmap _background; - bool _draw_function; QPixmap _function; - - FunctionConfig* _config; + bool _draw_function; }; -- cgit v1.2.3 From 41503f0101bdf2159543aadf5b66a18b0df76bda Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Thu, 18 Sep 2014 07:30:36 +0200 Subject: nix vjoy warning --- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp index 33dd35ae..ee7d2e85 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp @@ -4,7 +4,8 @@ FTNoIR_Protocol::FTNoIR_Protocol() { - VJoy_Initialize("", ""); + static char meh[1] = {0}; + VJoy_Initialize(meh, meh); } FTNoIR_Protocol::~FTNoIR_Protocol() -- cgit v1.2.3 From 8d2c9d5a03962c944bcfddf87878487b3e180005 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Thu, 18 Sep 2014 07:30:50 +0200 Subject: header cleanup only --- ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp | 2 +- ftnoir_filter_kalman/kalman.cpp | 2 +- ftnoir_protocol_ftn/ftnoir_protocol_ftn.h | 2 +- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h | 11 ++++------- ftnoir_tracker_hydra/ftnoir_tracker_hydra.h | 3 --- ftnoir_tracker_udp/ftnoir_tracker_udp.h | 7 ++----- 6 files changed, 9 insertions(+), 18 deletions(-) diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp index 7201ba37..d1f06a64 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp @@ -15,7 +15,7 @@ * * ********************************************************************************/ #include "ftnoir_filter_ewma2.h" -#include "math.h" +#include <cmath> #include <QDebug> #include <QWidget> #include "facetracknoir/plugin-support.h" diff --git a/ftnoir_filter_kalman/kalman.cpp b/ftnoir_filter_kalman/kalman.cpp index 81ee1df2..1f2ebb3b 100644 --- a/ftnoir_filter_kalman/kalman.cpp +++ b/ftnoir_filter_kalman/kalman.cpp @@ -7,7 +7,7 @@ #include "ftnoir_filter_kalman.h" #include "facetracknoir/plugin-support.h" #include <QDebug> -#include <math.h> +#include <cmath> FTNoIR_Filter::FTNoIR_Filter() { reset(); diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h index 2e3c270a..498df50c 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h @@ -33,7 +33,7 @@ #include <QThread> #include <QUdpSocket> #include <QMessageBox> -#include <math.h> +#include <cmath> #include "facetracknoir/plugin-support.h" #include "facetracknoir/options.h" using namespace options; diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h index c36b15f3..b63a5492 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h @@ -28,13 +28,8 @@ #pragma once #include "ftnoir_protocol_base/ftnoir_protocol_base.h" #include "ui_ftnoir_vjoy_controls.h" -#include <QThread> -#include <QUdpSocket> -#include <QMessageBox> -#include <QSettings> -#include <math.h> +#include <cmath> #include "facetracknoir/plugin-support.h" -#include <windows.h> #define FT_PROGRAMID "FT_ProgramID" @@ -60,7 +55,7 @@ class VJoyControls: public QWidget, public IProtocolDialog public: explicit VJoyControls(); - void registerProtocol(IProtocol *l) {} + void registerProtocol(IProtocol *) {} void unRegisterProtocol() {} private: @@ -89,6 +84,8 @@ public: #define VJOY_AXIS_NIL 0 #define VJOY_AXIS_MAX 32767 +#include <windows.h> + #include <pshpack1.h> typedef struct _JOYSTICK_STATE diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h index 7819dd67..fdfc2643 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h @@ -1,8 +1,5 @@ #include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "ui_ftnoir_hydra_clientcontrols.h" -#include <QMessageBox> -#include <QWaitCondition> -#include <math.h> #include "facetracknoir/plugin-support.h" #include "facetracknoir/options.h" using namespace options; diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.h b/ftnoir_tracker_udp/ftnoir_tracker_udp.h index c093c940..22c9c465 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.h +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.h @@ -1,11 +1,8 @@ #include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "ui_ftnoir_ftnclientcontrols.h" -#include <QThread> #include <QUdpSocket> -#include <QMessageBox> -#include <QMutex> -#include <QWaitCondition> -#include <math.h> +#include <QThread> +#include <cmath> #include "facetracknoir/plugin-support.h" #include "facetracknoir/options.h" using namespace options; -- cgit v1.2.3 From f505a21b064251d8ef55a2c0ca9a8f3609289acf Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Thu, 18 Sep 2014 08:47:40 +0200 Subject: qfc: fix artifacts following cleanup --- qfunctionconfigurator/qfunctionconfigurator.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qfunctionconfigurator/qfunctionconfigurator.cpp b/qfunctionconfigurator/qfunctionconfigurator.cpp index 17431986..2e60476a 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.cpp +++ b/qfunctionconfigurator/qfunctionconfigurator.cpp @@ -192,9 +192,9 @@ void QFunctionConfigurator::paintEvent(QPaintEvent *e) if (_config) { QPen pen(Qt::white, 1, Qt::SolidLine); QList<QPointF> points = _config->getPoints(); - if (moving_control_point_idx >= 0 && moving_control_point_idx < points.size()) { - QPointF prev; - for (int i = 0; i < points.size(); i++) { + if (points.size() && moving_control_point_idx >= 0 && moving_control_point_idx < points.size()) { + QPointF prev = points[0]; + for (int i = 1; i < points.size(); i++) { auto tmp = point_to_pixel(points[i]); drawLine(&p, prev, tmp, pen); prev = tmp; -- cgit v1.2.3 From 06a3eb720894e3ea0df3954c2c4aaa0e4b5ed7ee Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Thu, 18 Sep 2014 08:47:51 +0200 Subject: qfc: don't do same thing twice --- qfunctionconfigurator/qfunctionconfigurator.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/qfunctionconfigurator/qfunctionconfigurator.cpp b/qfunctionconfigurator/qfunctionconfigurator.cpp index 2e60476a..3f94f094 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.cpp +++ b/qfunctionconfigurator/qfunctionconfigurator.cpp @@ -181,7 +181,6 @@ void QFunctionConfigurator::paintEvent(QPaintEvent *e) if (_background.isNull()) drawBackground(); - p.drawPixmap(e->rect(), _background); if (_draw_function) { _draw_function = false; -- cgit v1.2.3 From 20b2685c74ae615420517e93eac0d2c06f6b93cc Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Thu, 18 Sep 2014 08:48:08 +0200 Subject: ft: use C-style comments --- freetrackclient/freetrackclient.c | 3 ++- ftnoir_protocol_ft/fttypes.h | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/freetrackclient/freetrackclient.c b/freetrackclient/freetrackclient.c index e69d9911..ee11741a 100644 --- a/freetrackclient/freetrackclient.c +++ b/freetrackclient/freetrackclient.c @@ -83,10 +83,11 @@ FT_EXPORT(bool) FTGetData(FTData* data) return true; } +/* // For some mysterious reason, the previously existing function FTReportID has been changed to FTReportName, but with an integer as argument. // The Delphi-code from the FreeTrack repo suggest a char * as argument, so it cost me an afternoon to figure it out (and keep ArmA2 from crashing). // Thanks guys! -// +*/ FT_EXPORT(void) FTReportName( int name ) { dbg_report("FTReportName request (ID = %d).\n", name); diff --git a/ftnoir_protocol_ft/fttypes.h b/ftnoir_protocol_ft/fttypes.h index cc78a80a..d4cb0c9b 100644 --- a/ftnoir_protocol_ft/fttypes.h +++ b/ftnoir_protocol_ft/fttypes.h @@ -24,26 +24,26 @@ #define FT_MM_DATA "FT_SharedMem" #define FREETRACK_MUTEX "FT_Mutext" -// only 6 headpose floats and the data id are filled -sh +/* only 6 headpose floats and the data id are filled -sh */ typedef struct __FTData { int DataID; int CamWidth; int CamHeight; - // virtual pose - float Yaw; // positive yaw to the left - float Pitch; // positive pitch up - float Roll; // positive roll to the left + /* virtual pose */ + float Yaw; /* positive yaw to the left */ + float Pitch; /* positive pitch up */ + float Roll; /* positive roll to the left */ float X; float Y; float Z; - // raw pose with no smoothing, sensitivity, response curve etc. + /* raw pose with no smoothing, sensitivity, response curve etc. */ float RawYaw; float RawPitch; float RawRoll; float RawX; float RawY; float RawZ; - // raw points, sorted by Y, origin top left corner + /* raw points, sorted by Y, origin top left corner */ float X1; float Y1; float X2; -- cgit v1.2.3 From 05b5171229d840b8b120a1e5b765128973270584 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Thu, 18 Sep 2014 08:49:07 +0200 Subject: -Wall -Wextra, no functional changes --- ftnoir_protocol_sc/ftnoir_protocol_sc.cpp | 10 ++++------ ftnoir_protocol_sc/ftnoir_protocol_sc.h | 2 +- ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 5 ++--- ftnoir_tracker_pt/point_tracker.cpp | 20 ++++++++------------ 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp index c53aa49c..1baeacd4 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp @@ -79,13 +79,11 @@ void FTNoIR_Protocol::sendHeadposeToGame( const double *headpose ) { if (!blnSimConnectActive) { if (SUCCEEDED(simconnect_open(&hSimConnect, "FaceTrackNoIR", NULL, 0, 0, 0))) { - HRESULT hr; - simconnect_subscribetosystemevent(hSimConnect, EVENT_PING, "Frame"); - hr = simconnect_mapclienteventtosimevent(hSimConnect, EVENT_INIT, ""); - hr = simconnect_addclienteventtonotificationgroup(hSimConnect, GROUP0, EVENT_INIT, false); - hr = simconnect_setnotificationgrouppriority(hSimConnect, GROUP0, SIMCONNECT_GROUP_PRIORITY_HIGHEST); + simconnect_mapclienteventtosimevent(hSimConnect, EVENT_INIT, ""); + simconnect_addclienteventtonotificationgroup(hSimConnect, GROUP0, EVENT_INIT, false); + simconnect_setnotificationgrouppriority(hSimConnect, GROUP0, SIMCONNECT_GROUP_PRIORITY_HIGHEST); blnSimConnectActive = true; } } @@ -203,7 +201,7 @@ bool FTNoIR_Protocol::checkServerInstallationOK() return true; } -void CALLBACK FTNoIR_Protocol::processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD cbData, void *pContext) +void CALLBACK FTNoIR_Protocol::processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD, void *) { switch(pData->dwID) { diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.h b/ftnoir_protocol_sc/ftnoir_protocol_sc.h index d6185428..c60f6d85 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.h +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.h @@ -133,7 +133,7 @@ class SCControls: public QWidget, public IProtocolDialog Q_OBJECT public: SCControls(); - void registerProtocol(IProtocol *protocol) {} + void registerProtocol(IProtocol *) {} void unRegisterProtocol() {} private: Ui::UICSCControls ui; diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index 0e95f57d..63a3a8b5 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -5,10 +5,9 @@ FTNoIR_Tracker::FTNoIR_Tracker() : g_pDI(nullptr), g_pJoystick(nullptr), - iter(-1), - mtx(QMutex::Recursive) + mtx(QMutex::Recursive), + iter(-1) { - GUID bar = {0}; } void FTNoIR_Tracker::reload() diff --git a/ftnoir_tracker_pt/point_tracker.cpp b/ftnoir_tracker_pt/point_tracker.cpp index 5735c081..f83ff437 100644 --- a/ftnoir_tracker_pt/point_tracker.cpp +++ b/ftnoir_tracker_pt/point_tracker.cpp @@ -79,13 +79,9 @@ void PointModel::get_d_order(const std::vector<cv::Vec2f>& points, int d_order[] { // get sort indices with respect to d scalar product vector< pair<float,int> > d_vals; - for (int i = 0; i<points.size(); ++i) + for (unsigned i = 0; i<points.size(); ++i) d_vals.push_back(pair<float, int>(d.dot(points[i]), i)); - struct - { - bool operator()(const pair<float, int>& a, const pair<float, int>& b) { return a.first < b.first; } - } comp; std::sort(d_vals.begin(), d_vals.end(), #ifdef OPENTRACK_API @@ -95,19 +91,19 @@ void PointModel::get_d_order(const std::vector<cv::Vec2f>& points, int d_order[] #endif ); - for (int i = 0; i<points.size(); ++i) + for (unsigned i = 0; i<points.size(); ++i) d_order[i] = d_vals[i].second; } // ---------------------------------------------------------------------------- -PointTracker::PointTracker() - : init_phase(true), +PointTracker::PointTracker() : + dynamic_pose_resolution(true), + dt_reset(1), + init_phase(true), dt_valid(0), - dt_reset(1), v_t(0,0,0), - v_r(0,0,0), - dynamic_pose_resolution(true) + v_r(0,0,0) { X_CM.t[2] = 1000; // default position: 1 m away from cam; } @@ -168,7 +164,7 @@ bool PointTracker::track(const vector<Vec2f>& points, float f, float dt) return false; } - int n_iter = POSIT(f); + (void) POSIT(f); //qDebug()<<"Number of POSIT iterations: "<<n_iter; if (!init_phase) -- cgit v1.2.3 From 06416c1581409b1fd0737fa8ce7370f58cbdc417 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 19 Sep 2014 09:45:28 +0200 Subject: cleanup mapping code There was quite a bit of duplicated logic, which wasn't duplicated where it needed to be. Make functions out of the duplicated bits, then call where appropriate. Issue: #56 --- facetracknoir/curve-config.cpp | 109 ++++++++++-------------- facetracknoir/curve-config.h | 2 - facetracknoir/facetracknoir.cpp | 57 +++++++------ facetracknoir/facetracknoir.h | 4 + qfunctionconfigurator/qfunctionconfigurator.cpp | 7 -- qfunctionconfigurator/qfunctionconfigurator.h | 2 - 6 files changed, 79 insertions(+), 102 deletions(-) diff --git a/facetracknoir/curve-config.cpp b/facetracknoir/curve-config.cpp index 535655c2..81383688 100644 --- a/facetracknoir/curve-config.cpp +++ b/facetracknoir/curve-config.cpp @@ -4,10 +4,50 @@ CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidge QWidget( parent, Qt::Dialog ), mainApp(ftnoir) { ui.setupUi( this ); + + // rest of mapping settings taken care of by options::value<t> + mainApp->load_mappings(); + + { + struct { + QFunctionConfigurator* qfc; + Axis axis; + bool altp; + } qfcs[] = + { + { ui.rxconfig, Yaw, false }, + { ui.ryconfig, Pitch, false}, + { ui.rzconfig, Roll, false }, + { ui.txconfig, TX, false }, + { ui.tyconfig, TY, false }, + { ui.tzconfig, TZ, false }, + + { ui.rxconfig_alt, Yaw, true }, + { ui.ryconfig_alt, Pitch, true}, + { ui.rzconfig_alt, Roll, true }, + { ui.txconfig_alt, TX, true }, + { ui.tyconfig_alt, TY, true }, + { ui.tzconfig_alt, TZ, true }, + { nullptr, Yaw, false } + }; + + for (int i = 0; qfcs[i].qfc; i++) + { + const bool altp = qfcs[i].altp; + THeadPoseDOF& axis = mainApp->axis(qfcs[i].axis); + FunctionConfig* conf = altp ? &axis.curveAlt : &axis.curve; + const auto& name = qfcs[i].altp ? axis.name2 : axis.name1; + + qfcs[i].qfc->setConfig(conf, name); + } + } + setFont(qApp->font()); - QPoint offsetpos(120, 30); this->move(parent->pos() + offsetpos); + + + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); @@ -42,8 +82,6 @@ CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidge tie_setting(mainApp->s.a_x.src, ui.src_x); tie_setting(mainApp->s.a_y.src, ui.src_y); tie_setting(mainApp->s.a_z.src, ui.src_z); - - loadSettings(); } void CurveConfigurationDialog::doOK() { @@ -52,69 +90,10 @@ void CurveConfigurationDialog::doOK() { } void CurveConfigurationDialog::doCancel() { - mainApp->b->revert(); - loadSettings(); - close(); -} - -void CurveConfigurationDialog::loadSettings() { - QFunctionConfigurator* configs[6] = { - ui.txconfig, - ui.tyconfig, - ui.tzconfig, - ui.rxconfig, - ui.ryconfig, - ui.rzconfig - }; - - QFunctionConfigurator* alt_configs[6] = { - ui.txconfig_alt, - ui.tyconfig_alt, - ui.tzconfig_alt, - ui.rxconfig_alt, - ui.ryconfig_alt, - ui.rzconfig_alt - }; - - for (int i = 0; i < 6; i++) - { - configs[i]->setConfig(&mainApp->axis(i).curve, mainApp->axis(i).name1); - alt_configs[i]->setConfig(&mainApp->axis(i).curveAlt, mainApp->axis(i).name2); - } + mainApp->load_mappings(); + this->close(); } void CurveConfigurationDialog::save() { - QSettings settings("opentrack"); - QString currentFile = - settings.value("SettingsFile", - QCoreApplication::applicationDirPath() + "/settings/default.ini" ) - .toString(); - - struct { - QFunctionConfigurator* qfc; - Axis axis; - bool altp; - } qfcs[] = - { - { ui.rxconfig, Yaw, false }, - { ui.ryconfig, Pitch, false}, - { ui.rzconfig, Roll, false }, - { ui.txconfig, TX, false }, - { ui.tyconfig, TY, false }, - { ui.tzconfig, TZ, false }, - - { ui.rxconfig_alt, Yaw, true }, - { ui.ryconfig_alt, Pitch, true}, - { ui.rzconfig_alt, Roll, true }, - { ui.txconfig_alt, TX, true }, - { ui.tyconfig_alt, TY, true }, - { ui.tzconfig_alt, TZ, true }, - { nullptr, Yaw, false } - }; - - for (int i = 0; qfcs[i].qfc; i++) - { - THeadPoseDOF& axis = mainApp->axis(qfcs[i].axis); - qfcs[i].qfc->saveSettings(currentFile, qfcs[i].altp ? axis.name2 : axis.name1); - } + mainApp->save_mappings(); } diff --git a/facetracknoir/curve-config.h b/facetracknoir/curve-config.h index 0949cdc4..49aba7bd 100644 --- a/facetracknoir/curve-config.h +++ b/facetracknoir/curve-config.h @@ -10,12 +10,10 @@ class CurveConfigurationDialog: public QWidget Q_OBJECT public: CurveConfigurationDialog( FaceTrackNoIR *ftnoir, QWidget *parent ); - void loadSettings(); private: Ui::UICCurveConfigurationDialog ui; void save(); FaceTrackNoIR *mainApp; - private slots: void doOK(); void doCancel(); diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index da8fae61..dfa13577 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -259,16 +259,26 @@ void FaceTrackNoIR::open() { } } -void FaceTrackNoIR::save() { - b->save(); - +void FaceTrackNoIR::save_mappings() { QSettings settings("opentrack"); QString currentFile = settings.value("SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini") .toString(); + QSettings iniFile( currentFile, QSettings::IniFormat ); + + for (int i = 0; i < 6; i++) + { + axis(i).curve.saveSettings(iniFile, axis(i).name1); + axis(i).curveAlt.saveSettings(iniFile, axis(i).name2); + } +} +void FaceTrackNoIR::save() { + b->save(); + save_mappings(); + #if defined(__unix) || defined(__linux) QByteArray bytes = QFile::encodeName(currentFile); const char* filename_as_asciiz = bytes.constData(); @@ -311,9 +321,21 @@ void FaceTrackNoIR::saveAs() fill_profile_cbx(); } +void FaceTrackNoIR::load_mappings() { + QSettings settings("opentrack"); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); + QSettings iniFile( currentFile, QSettings::IniFormat ); + + for (int i = 0; i < 6; i++) + { + axis(i).curve.loadSettings(iniFile, axis(i).name1); + axis(i).curveAlt.loadSettings(iniFile, axis(i).name2); + } +} + void FaceTrackNoIR::loadSettings() { b->reload(); - (dynamic_cast<CurveConfigurationDialog*>(_curve_config))->loadSettings(); + load_mappings(); } void FaceTrackNoIR::updateButtonState(bool running) @@ -359,18 +381,6 @@ void FaceTrackNoIR::startTracker( ) { delete tracker; } - { - QSettings settings("opentrack"); - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); - - for (int i = 0; i < 6; i++) - { - axis(i).curve.loadSettings(iniFile, axis(i).name1); - axis(i).curveAlt.loadSettings(iniFile, axis(i).name2); - } - } - tracker = new Tracker ( this, s ); if (pTrackerDialog && Libraries->pTracker) { @@ -559,17 +569,12 @@ void FaceTrackNoIR::showKeyboardShortcuts() { _keyboard_shortcuts->show(); _keyboard_shortcuts->raise(); } -void FaceTrackNoIR::showCurveConfiguration() { - - if (!_curve_config) - { +void FaceTrackNoIR::showCurveConfiguration() { + if (!_curve_config) _curve_config = new CurveConfigurationDialog( this, this ); - } - - if (_curve_config) { - _curve_config->show(); - _curve_config->raise(); - } + + _curve_config->show(); + _curve_config->raise(); } void FaceTrackNoIR::exit() { diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index dc37ad37..f6f4afdf 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -152,4 +152,8 @@ private slots: void startTracker(); void stopTracker(); + +public: + void save_mappings(); + void load_mappings(); }; diff --git a/qfunctionconfigurator/qfunctionconfigurator.cpp b/qfunctionconfigurator/qfunctionconfigurator.cpp index 3f94f094..70f68285 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.cpp +++ b/qfunctionconfigurator/qfunctionconfigurator.cpp @@ -49,13 +49,6 @@ void QFunctionConfigurator::setConfig(FunctionConfig* config, const QString& nam update(); } -void QFunctionConfigurator::saveSettings(QString settingsFile, const QString& name) { - QSettings iniFile(settingsFile, QSettings::IniFormat); - - if (_config) - _config->saveSettings(iniFile, name); -} - void QFunctionConfigurator::drawBackground() { if (!_config) diff --git a/qfunctionconfigurator/qfunctionconfigurator.h b/qfunctionconfigurator/qfunctionconfigurator.h index 4643f0d5..bb2f09ce 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.h +++ b/qfunctionconfigurator/qfunctionconfigurator.h @@ -23,8 +23,6 @@ public: FunctionConfig* config(); void setConfig(FunctionConfig* config, const QString &name); - void saveSettings(QString settingsFile, const QString &name); - QColor colorBezier() const { return spline_color; -- cgit v1.2.3 From 00097d4c2d272bda38e5ebdaa6dffc41a59eba33 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 19 Sep 2014 10:25:25 +0200 Subject: reorder, pedantry --- facetracknoir/tracker.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index db2a7af3..dd37e883 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -120,11 +120,14 @@ void Tracker::run() { for (int i = 0; i < 6; i++) { - auto& axis = mainApp->axis(i); raw_6dof.axes[i] = newpose[i]; + + auto& axis = mainApp->axis(i); + int k = axis.opts.src; if (k < 0 || k >= 6) continue; + axis.headPos = newpose[k]; } @@ -162,7 +165,7 @@ void Tracker::run() { t_compensate(output_camera.axes, output_camera.axes, mainApp->s.tcomp_tz); if (Libraries->pProtocol) { - Libraries->pProtocol->sendHeadposeToGame( output_camera.axes ); + Libraries->pProtocol->sendHeadposeToGame( output_camera.axes ); } } -- cgit v1.2.3 From 2ec2fe9222c95565ce1cdc47c4b49dd2f5e5c2e3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 19 Sep 2014 10:25:56 +0200 Subject: fix axes swappage Issue: #56 --- ftnoir_protocol_ft/ftnoir_protocol_ft.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp index bb771c9d..7b62dfbb 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp @@ -49,8 +49,8 @@ FTNoIR_Protocol::~FTNoIR_Protocol() } void FTNoIR_Protocol::sendHeadposeToGame(const double* headpose) { - float yaw = getRadsFromDegrees(headpose[Pitch]) * (s.useDummyExe ? 2.0 : 1.0); - float pitch = getRadsFromDegrees(headpose[Yaw]); + float yaw = getRadsFromDegrees(headpose[Yaw]) * (s.useDummyExe ? 2.0 : 1.0); + float pitch = getRadsFromDegrees(headpose[Pitch]); float roll = getRadsFromDegrees(headpose[Roll]); float tx = headpose[TX] * 10.f; float ty = headpose[TY] * 10.f; @@ -68,8 +68,8 @@ void FTNoIR_Protocol::sendHeadposeToGame(const double* headpose) { pMemData->data.X = tx; pMemData->data.Y = ty; pMemData->data.Z = tz; - pMemData->data.Pitch = pitch; pMemData->data.Yaw = yaw; + pMemData->data.Pitch = pitch; pMemData->data.Roll = roll; pMemData->data.X1 = ++pMemData->data.DataID; -- cgit v1.2.3 -- cgit v1.2.3 From 181aac6db63f0fd3aac31c599569acad06a60530 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 20 Sep 2014 09:34:13 +0200 Subject: add todo via web ui Issue: #52 (closed already) --- ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp index 52f9b53b..cd50dbe5 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp @@ -33,6 +33,8 @@ void FTNoIR_Protocol::sendHeadposeToGame(const double *headpose ) { double fMouse_X = 0; double fMouse_Y = 0; + // XXX TODO remove axis selector, use mapping window's + // axis selection. Mention in UI axis used. -sh 20140920 int Mouse_X = s.Mouse_X; int Mouse_Y = s.Mouse_Y; -- cgit v1.2.3 From 5d8cdde055947ef9c8e157047f090b19e368140c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 20 Sep 2014 06:37:04 +0200 Subject: Support FreePIE IMU UDP protocol Issue: #48 Note, pushed to stable since won't cause regressions, as it's purely freestanding code. --- CMakeLists.txt | 2 + ftnoir_tracker_freepie-udp/freepie-udp-controls.ui | 186 +++++++++++++++++++++ ftnoir_tracker_freepie-udp/freepie-udp-res.qrc | 5 + .../ftnoir_tracker_freepie-udp.cpp | 97 +++++++++++ .../ftnoir_tracker_freepie-udp.h | 69 ++++++++ .../ftnoir_tracker_freepie-udp_dialog.cpp | 30 ++++ .../ftnoir_tracker_freepie-udp_dll.cpp | 28 ++++ ftnoir_tracker_freepie-udp/glovepie.png | Bin 0 -> 3584 bytes 8 files changed, 417 insertions(+) create mode 100644 ftnoir_tracker_freepie-udp/freepie-udp-controls.ui create mode 100644 ftnoir_tracker_freepie-udp/freepie-udp-res.qrc create mode 100644 ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp create mode 100644 ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h create mode 100644 ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp create mode 100644 ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp create mode 100644 ftnoir_tracker_freepie-udp/glovepie.png diff --git a/CMakeLists.txt b/CMakeLists.txt index cdf81aab..ae54f90f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,6 +194,7 @@ opentrack_module(opentrack-tracker-udp ftnoir_tracker_udp) opentrack_module(opentrack-tracker-joystick ftnoir_tracker_joystick) opentrack_module(opentrack-tracker-rift ftnoir_tracker_rift) opentrack_module(opentrack-tracker-hydra ftnoir_tracker_hydra) +opentrack_module(opentrack-tracker-freepie-udp ftnoir_tracker_freepie-udp) file(GLOB opentrack-csv-c "ftnoir_csv/*.cpp" "ftnoir_csv/*.h") @@ -347,6 +348,7 @@ target_link_libraries(opentrack-tracker-pt ${OpenCV_LIBS}) link_with_dinput8(opentrack-tracker-pt) opentrack_library(opentrack-tracker-udp) +opentrack_library(opentrack-tracker-freepie-udp) if(SDK_RIFT) include_directories("${SDK_RIFT}/Include") diff --git a/ftnoir_tracker_freepie-udp/freepie-udp-controls.ui b/ftnoir_tracker_freepie-udp/freepie-udp-controls.ui new file mode 100644 index 00000000..937dafaa --- /dev/null +++ b/ftnoir_tracker_freepie-udp/freepie-udp-controls.ui @@ -0,0 +1,186 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UI_freepie_udp_dialog</class> + <widget class="QWidget" name="UI_freepie_udp_dialog"> + <property name="windowModality"> + <enum>Qt::NonModal</enum> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>208</width> + <height>240</height> + </rect> + </property> + <property name="windowTitle"> + <string>UDP tracker settings</string> + </property> + <property name="windowIcon"> + <iconset> + <normaloff>../facetracknoir/images/facetracknoir.png</normaloff>../facetracknoir/images/facetracknoir.png</iconset> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <property name="topMargin"> + <number>0</number> + </property> + <item row="0" column="0" colspan="3"> + <widget class="QGroupBox" name="groupbox_port"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="1"> + <widget class="QSpinBox" name="port"> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_5"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>UDP port</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="0" rowspan="2" colspan="3"> + <widget class="QGroupBox" name="groupBox_3"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>85</height> + </size> + </property> + <property name="title"> + <string>Enable axis</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="2" column="0"> + <widget class="QLabel" name="label_6"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Roll</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QCheckBox" name="chkEnablePitch"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_11"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Yaw</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_9"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Pitch</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QCheckBox" name="chkEnableYaw"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QCheckBox" name="chkEnableRoll"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="3" column="1"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <tabstops> + <tabstop>port</tabstop> + </tabstops> + <resources/> + <connections/> + <slots> + <slot>startEngineClicked()</slot> + <slot>stopEngineClicked()</slot> + <slot>cameraSettingsClicked()</slot> + </slots> +</ui> diff --git a/ftnoir_tracker_freepie-udp/freepie-udp-res.qrc b/ftnoir_tracker_freepie-udp/freepie-udp-res.qrc new file mode 100644 index 00000000..3fd3edc4 --- /dev/null +++ b/ftnoir_tracker_freepie-udp/freepie-udp-res.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>glovepie.png</file> + </qresource> +</RCC> diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp new file mode 100644 index 00000000..811a08d9 --- /dev/null +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp @@ -0,0 +1,97 @@ +#include "ftnoir_tracker_freepie-udp.h" +#include "facetracknoir/plugin-support.h" + +#include <cinttypes> + +TrackerImpl::TrackerImpl() : pose { 0,0,0, 0,0,0 }, should_quit(false) +{ +} + +TrackerImpl::~TrackerImpl() +{ + should_quit = true; + wait(); +} + +void TrackerImpl::run() { + struct { + uint8_t pad; + uint8_t flags; + union { + float rot[6]; + struct { + float pad[9]; + float rot[6]; + } raw_rot; + }; + } data; + + enum F { + flag_Raw = 1 << 0, + flag_Orient = 1 << 1, + Mask = flag_Raw | flag_Orient + }; + + while (1) { + if (should_quit) + break; + { + float* orient = nullptr; + + while (sock.hasPendingDatagrams()) { + data = decltype(data){0,0, 0,0,0}; + (void) sock.readDatagram(reinterpret_cast<char*>(&data), sizeof(data)); + + int flags = data.flags & F::Mask; + switch (flags) + { + case flag_Raw: + continue; + case flag_Raw | flag_Orient: + orient = data.raw_rot.rot; + break; + case flag_Orient: + orient = data.rot; + break; + } + } + if (orient) + { + QMutexLocker foo(&mtx); + for (int i = 0; i < 3; i++) + pose[Yaw + i] = orient[i]; + } + } + usleep(4000); + } +} + +void TrackerImpl::StartTracker(QFrame*) +{ + (void) sock.bind(QHostAddress::Any, (int) s.port, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); + start(); +} + +void TrackerImpl::GetHeadPoseData(double *data) +{ + QMutexLocker foo(&mtx); +#if 0 + if (s.enable_x) + data[TX] = pose[TX]; + if (s.enable_y) + data[TY] = pose[TY]; + if (s.enable_z) + data[TZ] = pose[TZ]; +#endif + if (s.enable_yaw) + data[Yaw] = pose[Yaw]; + if (s.enable_pitch) + data[Pitch] = pose[Pitch]; + if (s.enable_roll) + data[Roll] = pose[Roll]; +} + +extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +{ + return new TrackerImpl; +} diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h new file mode 100644 index 00000000..b6fd544e --- /dev/null +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h @@ -0,0 +1,69 @@ +/* Copyright (c) 2014 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 "ftnoir_tracker_base/ftnoir_tracker_base.h" +#include "ui_freepie-udp-controls.h" +#include <QUdpSocket> +#include <QThread> +#include "facetracknoir/plugin-support.h" +#include "facetracknoir/options.h" +using namespace options; + +struct settings { + pbundle b; + value<int> port; + value<bool> enable_roll, enable_pitch, enable_yaw; + settings() : + b(bundle("freepie-udp-tracker")), + port(b, "port", 4237), + enable_roll(b, "enable-roll", true), + enable_pitch(b, "enable-pitch", true), + enable_yaw(b, "enable-yaw", true) + {} +}; + +class TrackerImpl : public ITracker, protected QThread +{ +public: + TrackerImpl(); + virtual ~TrackerImpl() override; + void StartTracker(QFrame *); + void GetHeadPoseData(double *data); +protected: + void run(); +private: + double pose[6]; + QUdpSocket sock; + settings s; + QMutex mtx; + volatile bool should_quit; +}; + +class TrackerDialog : public QWidget, public ITrackerDialog +{ + Q_OBJECT +public: + TrackerDialog(); + void registerTracker(ITracker *) {} + void unRegisterTracker() {} +private: + Ui::UI_freepie_udp_dialog ui; + settings s; +private slots: + void doOK(); + void doCancel(); +}; + +class TrackerMeta : public Metadata +{ +public: + void getFullName(QString *strToBeFilled); + void getShortName(QString *strToBeFilled); + void getDescription(QString *strToBeFilled); + void getIcon(QIcon *icon); +}; + diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp new file mode 100644 index 00000000..702cc8a0 --- /dev/null +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp @@ -0,0 +1,30 @@ +#include "ftnoir_tracker_freepie-udp.h" +#include "facetracknoir/plugin-support.h" + +TrackerDialog::TrackerDialog() +{ + ui.setupUi(this); + + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); + connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); + + tie_setting(s.port, ui.port); + tie_setting(s.enable_yaw, ui.chkEnableYaw); + tie_setting(s.enable_pitch, ui.chkEnablePitch); + tie_setting(s.enable_roll, ui.chkEnableRoll); +} + +void TrackerDialog::doOK() { + s.b->save(); + this->close(); +} + +void TrackerDialog::doCancel() { + s.b->revert(); + this->close(); +} + +extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog() +{ + return new TrackerDialog; +} diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp new file mode 100644 index 00000000..717975e3 --- /dev/null +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp @@ -0,0 +1,28 @@ +#include "ftnoir_tracker_freepie-udp.h" +#include <QDebug> +#include "facetracknoir/plugin-support.h" + +void TrackerMeta::getFullName(QString *strToBeFilled) +{ + *strToBeFilled = "FreePIE UDP"; +} + +void TrackerMeta::getShortName(QString *strToBeFilled) +{ + *strToBeFilled = "FreePIE"; +} + +void TrackerMeta::getDescription(QString *strToBeFilled) +{ + *strToBeFilled = "FreePIE UDP"; +} + +void TrackerMeta::getIcon(QIcon *icon) +{ + *icon = QIcon(":/glovepie.png"); +} + +extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +{ + return new TrackerMeta; +} diff --git a/ftnoir_tracker_freepie-udp/glovepie.png b/ftnoir_tracker_freepie-udp/glovepie.png new file mode 100644 index 00000000..2156b7af Binary files /dev/null and b/ftnoir_tracker_freepie-udp/glovepie.png differ -- cgit v1.2.3 From 1c9e60221a52e9419780e81aedfe076ad157d014 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 20 Sep 2014 12:16:26 +0200 Subject: reformat only --- .../ftnoir_tracker_freepie-udp.cpp | 19 ++++++++++--------- .../ftnoir_tracker_freepie-udp.h | 22 +++++++++++----------- .../ftnoir_tracker_freepie-udp_dialog.cpp | 8 ++++---- .../ftnoir_tracker_freepie-udp_dll.cpp | 3 +-- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp index 811a08d9..3a63df6e 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp @@ -21,27 +21,28 @@ void TrackerImpl::run() { float rot[6]; struct { float pad[9]; - float rot[6]; + float rot[6]; } raw_rot; }; } data; - + enum F { flag_Raw = 1 << 0, flag_Orient = 1 << 1, Mask = flag_Raw | flag_Orient }; - while (1) { + while (1) { if (should_quit) break; { float* orient = nullptr; - - while (sock.hasPendingDatagrams()) { + + while (sock.hasPendingDatagrams()) + { data = decltype(data){0,0, 0,0,0}; (void) sock.readDatagram(reinterpret_cast<char*>(&data), sizeof(data)); - + int flags = data.flags & F::Mask; switch (flags) { @@ -62,14 +63,14 @@ void TrackerImpl::run() { pose[Yaw + i] = orient[i]; } } - usleep(4000); - } + usleep(4000); + } } void TrackerImpl::StartTracker(QFrame*) { (void) sock.bind(QHostAddress::Any, (int) s.port, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); - start(); + start(); } void TrackerImpl::GetHeadPoseData(double *data) diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h index b6fd544e..8cefb509 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h @@ -26,15 +26,15 @@ struct settings { {} }; -class TrackerImpl : public ITracker, protected QThread +class TrackerImpl : public ITracker, private QThread { public: - TrackerImpl(); + TrackerImpl(); virtual ~TrackerImpl() override; void StartTracker(QFrame *); void GetHeadPoseData(double *data); protected: - void run(); + virtual void run() override; private: double pose[6]; QUdpSocket sock; @@ -47,23 +47,23 @@ class TrackerDialog : public QWidget, public ITrackerDialog { Q_OBJECT public: - TrackerDialog(); + TrackerDialog(); void registerTracker(ITracker *) {} void unRegisterTracker() {} private: - Ui::UI_freepie_udp_dialog ui; + Ui::UI_freepie_udp_dialog ui; settings s; private slots: - void doOK(); - void doCancel(); + void doOK(); + void doCancel(); }; class TrackerMeta : public Metadata { public: - void getFullName(QString *strToBeFilled); - void getShortName(QString *strToBeFilled); - void getDescription(QString *strToBeFilled); - void getIcon(QIcon *icon); + void getFullName(QString *strToBeFilled); + void getShortName(QString *strToBeFilled); + void getDescription(QString *strToBeFilled); + void getIcon(QIcon *icon); }; diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp index 702cc8a0..d845ff4a 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp @@ -3,10 +3,10 @@ TrackerDialog::TrackerDialog() { - ui.setupUi(this); + ui.setupUi(this); - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); + connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); tie_setting(s.port, ui.port); tie_setting(s.enable_yaw, ui.chkEnableYaw); @@ -16,7 +16,7 @@ TrackerDialog::TrackerDialog() void TrackerDialog::doOK() { s.b->save(); - this->close(); + this->close(); } void TrackerDialog::doCancel() { diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp index 717975e3..cfaa9f47 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp @@ -1,5 +1,4 @@ #include "ftnoir_tracker_freepie-udp.h" -#include <QDebug> #include "facetracknoir/plugin-support.h" void TrackerMeta::getFullName(QString *strToBeFilled) @@ -24,5 +23,5 @@ void TrackerMeta::getIcon(QIcon *icon) extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { - return new TrackerMeta; + return new TrackerMeta; } -- cgit v1.2.3 From 13b1fd19091ff6c6387828eac816f91152620346 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 20 Sep 2014 15:25:47 +0200 Subject: avoid rebuild after commit Issue: #59 --- CMakeLists.txt | 15 +++++++++------ facetracknoir/facetracknoir.cpp | 5 +++-- facetracknoir/facetracknoir.h | 2 -- facetracknoir/version.c | 5 +++++ opentrack-version.h | 7 ------- 5 files changed, 17 insertions(+), 17 deletions(-) create mode 100644 facetracknoir/version.c delete mode 100644 opentrack-version.h diff --git a/CMakeLists.txt b/CMakeLists.txt index ae54f90f..633bf587 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -196,6 +196,8 @@ opentrack_module(opentrack-tracker-rift ftnoir_tracker_rift) opentrack_module(opentrack-tracker-hydra ftnoir_tracker_hydra) opentrack_module(opentrack-tracker-freepie-udp ftnoir_tracker_freepie-udp) +file(GLOB opentrack-version-c "facetracknoir/version.c") + file(GLOB opentrack-csv-c "ftnoir_csv/*.cpp" "ftnoir_csv/*.h") # compat lib for POSIX/win32 @@ -257,6 +259,11 @@ target_link_libraries(opentrack-pose-widget ${MY_QT_LIBS}) add_library(opentrack-spline-widget SHARED ${opentrack-spline-widget-c}) target_link_libraries(opentrack-spline-widget ${MY_QT_LIBS}) +add_library(opentrack-version STATIC ${opentrack-version-c}) +set_target_properties(opentrack-version PROPERTIES + COMPILE_DEFINITIONS + "IN_VERSION_UNIT;OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\"") + opentrack_library(opentrack-filter-accela) opentrack_library(opentrack-filter-kalman) opentrack_library(opentrack-filter-ewma) @@ -419,17 +426,13 @@ if(UNIX OR APPLE) target_link_libraries(opentrack-qxt-mini X11) endif() endif() + add_executable(opentrack ${opentrack-win32-executable} ${opentrack-bin-c} ${opentrack-bin-uih} ${opentrack-bin-rcc}) -set_target_properties(opentrack PROPERTIES COMPILE_DEFINITIONS OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\") -set(OPENTRACK_COMMIT_VERSION \"${OPENTRACK__COMMIT}\") -configure_file("${CMAKE_SOURCE_DIR}/opentrack-version.h" "${CMAKE_BINARY_DIR}/opentrack-version.h" @ONLY NEWLINE_STYLE UNIX) if(APPLE) SET_TARGET_PROPERTIES(opentrack-qxt-mini PROPERTIES LINK_FLAGS "-framework Carbon -framework CoreFoundation") endif() -set_target_properties(opentrack PROPERTIES COMPILE_DEFINITIONS OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\") - if(UNIX OR APPLE) target_link_libraries(opentrack opentrack-qxt-mini) endif() @@ -446,7 +449,7 @@ if(CMAKE_SYSTEM STREQUAL LINUX) link_libraries(rt) endif() -target_link_libraries(opentrack opentrack-pose-widget opentrack-spline-widget ${MY_QT_LIBS} ${QXT_QXTCORE_LIB_RELEASE} ${QXT_QXTWIDGETS_LIB_RELEASE}) +target_link_libraries(opentrack opentrack-version opentrack-pose-widget opentrack-spline-widget ${MY_QT_LIBS} ${QXT_QXTCORE_LIB_RELEASE} ${QXT_QXTWIDGETS_LIB_RELEASE}) if(NOT WIN32) target_link_libraries(opentrack dl) endif() diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index dfa13577..43c96f13 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -25,7 +25,6 @@ #include "shortcuts.h" #include "tracker.h" #include "curve-config.h" -#include "opentrack-version.h" #include <QFileDialog> #if defined(_WIN32) @@ -581,6 +580,8 @@ void FaceTrackNoIR::exit() { QCoreApplication::exit(0); } +extern "C" volatile const char* opentrack_version; + void FaceTrackNoIR::fill_profile_cbx() { if (looping) @@ -590,7 +591,7 @@ void FaceTrackNoIR::fill_profile_cbx() QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); qDebug() << "Config file now" << currentFile; QFileInfo pathInfo ( currentFile ); - setWindowTitle(QString( OPENTRACK_VERSION " :: ") + pathInfo.fileName()); + setWindowTitle(QString( const_cast<const char*>(opentrack_version) + QStringLiteral(" :: ")) + pathInfo.fileName()); QDir settingsDir( pathInfo.dir() ); QStringList filters; filters << "*.ini"; diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index f6f4afdf..713a51f0 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -55,8 +55,6 @@ using namespace options; #include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "ftnoir_filter_base/ftnoir_filter_base.h" -#include "opentrack-version.h" - class Tracker; // pre-define class to avoid circular includes class FaceTrackNoIR; diff --git a/facetracknoir/version.c b/facetracknoir/version.c new file mode 100644 index 00000000..0ef4ec14 --- /dev/null +++ b/facetracknoir/version.c @@ -0,0 +1,5 @@ +#ifdef IN_VERSION_UNIT +# define IN_CRAPOLA_COMPILE_UNIT +volatile const char* opentrack_version = OPENTRACK_VERSION; +#else +#endif diff --git a/opentrack-version.h b/opentrack-version.h deleted file mode 100644 index f31d5edf..00000000 --- a/opentrack-version.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef OPENTRACK_VERSION -# define OPENTRACK_VERSION @OPENTRACK_COMMIT_VERSION@ -#else -# ifndef OPENTRACK_VERSION -# define OPENTRACK_VERSION "Mourns-For-Trees" -# endif -#endif -- cgit v1.2.3 From 34cfb18a68c3a626a8927aa1216a642c2aba35f8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 21 Sep 2014 21:23:49 +0200 Subject: nix needless include, less rebuild time --- facetracknoir/global-shortcuts.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/facetracknoir/global-shortcuts.cpp b/facetracknoir/global-shortcuts.cpp index 1c10b160..9b6591a7 100644 --- a/facetracknoir/global-shortcuts.cpp +++ b/facetracknoir/global-shortcuts.cpp @@ -1,4 +1,5 @@ -#include "facetracknoir/facetracknoir.h" +# include <QList> +# include <QString> #if defined(_WIN32) # ifndef DIRECTINPUT_VERSION -- cgit v1.2.3 From aafe709c798996317472de7ffdf68c466e3b4bca Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 21 Sep 2014 19:45:59 +0200 Subject: workaround bug in apk logic Issue: #48 flag for raw sensor data set despite datagram with fused data only --- ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp index 3a63df6e..7223a33f 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp @@ -1,6 +1,7 @@ #include "ftnoir_tracker_freepie-udp.h" #include "facetracknoir/plugin-support.h" +#include <stddef.h> #include <cinttypes> TrackerImpl::TrackerImpl() : pose { 0,0,0, 0,0,0 }, should_quit(false) @@ -41,9 +42,16 @@ void TrackerImpl::run() { while (sock.hasPendingDatagrams()) { data = decltype(data){0,0, 0,0,0}; - (void) sock.readDatagram(reinterpret_cast<char*>(&data), sizeof(data)); + int sz = sock.readDatagram(reinterpret_cast<char*>(&data), sizeof(data)); int flags = data.flags & F::Mask; + + constexpr int minsz = offsetof(decltype(data), raw_rot) + sizeof(decltype(data)::raw_rot); + const bool flags_came_out_wrong = minsz > sz; + + if (flags_came_out_wrong) + flags &= ~F::flag_Raw; + switch (flags) { case flag_Raw: -- cgit v1.2.3 From cc21e8364c5cf7573a50ea605b0ff4cda8eedab2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 21 Sep 2014 19:44:29 +0200 Subject: clarify win32-joy 6 of 8 axis and remap moved to core --- .../ftnoir_tracker_joystick_controls.ui | 34 +++++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_controls.ui b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_controls.ui index b0e010a1..424d1c44 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_controls.ui +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_controls.ui @@ -9,12 +9,12 @@ <rect> <x>0</x> <y>0</y> - <width>326</width> - <height>88</height> + <width>458</width> + <height>134</height> </rect> </property> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -33,6 +33,24 @@ <bool>false</bool> </property> <layout class="QFormLayout" name="formLayout"> + <property name="horizontalSpacing"> + <number>6</number> + </property> + <property name="verticalSpacing"> + <number>6</number> + </property> + <property name="leftMargin"> + <number>12</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>12</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> <item row="0" column="0"> <widget class="QLabel" name="label"> <property name="text"> @@ -50,13 +68,21 @@ </property> </widget> </item> - <item row="1" column="0" colspan="2"> + <item row="2" column="0" colspan="2"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="standardButtons"> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> </property> </widget> </item> + <item row="1" column="0" colspan="2"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Only first 6 axes available. +Adjust order in mapping window "output remap" option.</string> + </property> + </widget> + </item> </layout> </widget> <tabstops> -- cgit v1.2.3 From 7298e7c57f0933997b9dd2c417afab50984c0cd2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 21 Sep 2014 21:24:05 +0200 Subject: crop to make icon less bad --- facetracknoir/uielements/curves.png | Bin 2850 -> 3457 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/facetracknoir/uielements/curves.png b/facetracknoir/uielements/curves.png index fe21fa15..3f953a0a 100644 Binary files a/facetracknoir/uielements/curves.png and b/facetracknoir/uielements/curves.png differ -- cgit v1.2.3 From a3f514ff05d4218b0b7ae1e93a1cc63b782ae358 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 21 Sep 2014 21:31:10 +0200 Subject: Rename HT combobox entry Thanks @KyokushinPL for report. Users don't seem to notice what HT does. --- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 3f67953e..50b25238 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -224,12 +224,12 @@ void Tracker::GetHeadPoseData(double *data) //----------------------------------------------------------------------------- void TrackerDll::getFullName(QString *strToBeFilled) { - *strToBeFilled = "HT 1.0"; + *strToBeFilled = "HT face tracker"; } void TrackerDll::getShortName(QString *strToBeFilled) { - *strToBeFilled = "HT"; + *strToBeFilled = "HT" } void TrackerDll::getDescription(QString *strToBeFilled) -- cgit v1.2.3 From 27109d3fd204f971a920cb034a5499bdb6ebb81b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 21 Sep 2014 17:27:13 +0200 Subject: core: nix support for camera device identifier --- facetracknoir/facetracknoir.cpp | 63 ----------------------------------------- facetracknoir/facetracknoir.h | 1 - 2 files changed, 64 deletions(-) diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 43c96f13..ea857462 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -27,10 +27,6 @@ #include "curve-config.h" #include <QFileDialog> -#if defined(_WIN32) -# include <windows.h> -# include <dshow.h> -#endif #if defined(__APPLE__) # define SONAME "dylib" @@ -154,8 +150,6 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : connect(ui.btnStartTracker, SIGNAL(clicked()), this, SLOT(startTracker())); connect(ui.btnStopTracker, SIGNAL(clicked()), this, SLOT(stopTracker())); - GetCameraNameDX(); - connect(ui.iconcomboProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(profileSelected(int))); connect(&timUpdateHeadPose, SIGNAL(timeout()), this, SLOT(showHeadPose())); @@ -180,63 +174,6 @@ QFrame* FaceTrackNoIR::get_video_widget() { return ui.video_frame; } -void FaceTrackNoIR::GetCameraNameDX() { -#if defined(_WIN32) - ui.cameraName->setText("No video-capturing device was found in your system: check if it's connected!"); - - HRESULT hr; - ICreateDevEnum *pSysDevEnum = NULL; - hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **)&pSysDevEnum); - if (FAILED(hr)) - { - qDebug() << "GetWDM says: CoCreateInstance Failed!"; - return; - } - - qDebug() << "GetWDM says: CoCreateInstance succeeded!"; - - IEnumMoniker *pEnumCat = NULL; - hr = pSysDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEnumCat, 0); - - if (hr == S_OK) { - qDebug() << "GetWDM says: CreateClassEnumerator succeeded!"; - - IMoniker *pMoniker = NULL; - ULONG cFetched; - if (pEnumCat->Next(1, &pMoniker, &cFetched) == S_OK) { - IPropertyBag *pPropBag; - hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pPropBag); - if (SUCCEEDED(hr)) { - VARIANT varName; - VariantInit(&varName); - hr = pPropBag->Read(L"FriendlyName", &varName, 0); - if (SUCCEEDED(hr)) - { - QString str((QChar*)varName.bstrVal, wcslen(varName.bstrVal)); - qDebug() << "GetWDM says: Moniker found:" << str; - ui.cameraName->setText(str); - } - VariantClear(&varName); - - pPropBag->Release(); - } - pMoniker->Release(); - } - pEnumCat->Release(); - } - pSysDevEnum->Release(); -#else - for (int i = 0; i < 16; i++) { - char buf[128]; - sprintf(buf, "/dev/video%d", i); - if (access(buf, R_OK | W_OK) == 0) { - ui.cameraName->setText(QString(buf)); - break; - } - } -#endif -} - void FaceTrackNoIR::open() { QFileDialog dialog(this); dialog.setFileMode(QFileDialog::ExistingFile); diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 713a51f0..22a4363e 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -116,7 +116,6 @@ private: void createIconGroupBox(); - void GetCameraNameDX(); void loadSettings(); void updateButtonState(bool); -- cgit v1.2.3 From 8e2aba0a468c189a6eb733fe3fab5b7889abb7ba Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 21 Sep 2014 19:42:26 +0200 Subject: use more savory UI style on win32 --- facetracknoir/main.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp index 7462f8c2..aa33522d 100644 --- a/facetracknoir/main.cpp +++ b/facetracknoir/main.cpp @@ -1,11 +1,33 @@ #include "facetracknoir.h" #include <QApplication> +#include <QStyleFactory> +#include <QStringList> #include <memory> int main(int argc, char** argv) { + // workaround QTBUG-38598 + QCoreApplication::addLibraryPath("."); + + // qt5 designer-made controls look like shit on 'doze -sh 20140921 +#ifdef _WIN32 + { + const QStringList preferred { "fusion", "windowsvista", "jazzbands'-marijuana", "macintosh", "windowsxp" }; + for (const auto& style_name : preferred) + { + QStyle* s = QStyleFactory::create(style_name); + if (s) + { + QApplication::setStyle(s); + break; + } + } + } +#endif + QApplication::setAttribute(Qt::AA_X11InitThreads, true); QApplication app(argc, argv); + auto w = std::make_shared<FaceTrackNoIR>(); w->show(); -- cgit v1.2.3 From a33dcb5dc4edca8d34d7778a6b1ddf867e6a4590 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 21 Sep 2014 19:42:56 +0200 Subject: reorder access(2) header for clarity --- facetracknoir/facetracknoir.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index ea857462..5f4a4e11 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -27,7 +27,6 @@ #include "curve-config.h" #include <QFileDialog> - #if defined(__APPLE__) # define SONAME "dylib" #elif defined(_WIN32) @@ -44,10 +43,6 @@ # define LIB_PREFIX "lib" #endif -#if defined(__unix) || defined(__linux) || defined(__APPLE__) -# include <unistd.h> -#endif - static bool get_metadata(DynamicLibrary* lib, QString& longName, QIcon& icon) { Metadata* meta; @@ -211,6 +206,10 @@ void FaceTrackNoIR::save_mappings() { } } +#if defined(__unix) || defined(__linux) || defined(__APPLE__) +# include <unistd.h> +#endif + void FaceTrackNoIR::save() { b->save(); save_mappings(); -- cgit v1.2.3 From de2c98a213c32db99b63754fb8520271501eee43 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 21 Sep 2014 19:43:15 +0200 Subject: adjust some UI stuff, breaks muscle memory sadly --- facetracknoir/facetracknoir.ui | 1645 +++++++++++----------------------------- 1 file changed, 438 insertions(+), 1207 deletions(-) diff --git a/facetracknoir/facetracknoir.ui b/facetracknoir/facetracknoir.ui index b257ae30..ab332288 100644 --- a/facetracknoir/facetracknoir.ui +++ b/facetracknoir/facetracknoir.ui @@ -3,15 +3,12 @@ <author>WVR</author> <class>OpentrackUI</class> <widget class="QMainWindow" name="OpentrackUI"> - <property name="windowModality"> - <enum>Qt::NonModal</enum> - </property> <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>790</width> - <height>500</height> + <width>879</width> + <height>422</height> </rect> </property> <property name="sizePolicy"> @@ -20,225 +17,76 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="contextMenuPolicy"> - <enum>Qt::DefaultContextMenu</enum> - </property> - <property name="windowTitle"> - <string>opentrack</string> - </property> <property name="windowIcon"> <iconset resource="main-facetracknoir.qrc"> <normaloff>:/images/facetracknoir.png</normaloff>:/images/facetracknoir.png</iconset> </property> - <property name="toolTip"> - <string/> - </property> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonIconOnly</enum> - </property> - <property name="animated"> - <bool>true</bool> - </property> - <property name="unifiedTitleAndToolBarOnMac"> - <bool>false</bool> - </property> <widget class="QWidget" name="centralWidget"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65535</width> - <height>65535</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <widget class="QFrame" name="video_frame"> + <widget class="QPushButton" name="btnShortcuts"> <property name="geometry"> <rect> - <x>10</x> - <y>130</y> - <width>320</width> - <height>240</height> + <x>715</x> + <y>110</y> + <width>151</width> + <height>38</height> </rect> </property> <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>250</width> - <height>187</height> - </size> + <property name="text"> + <string>Keys</string> </property> - <property name="maximumSize"> + <property name="icon"> + <iconset resource="main-facetracknoir.qrc"> + <normaloff>:/uielements/tools.png</normaloff>:/uielements/tools.png</iconset> + </property> + <property name="iconSize"> <size> - <width>65536</width> - <height>65536</height> + <width>98</width> + <height>24</height> </size> </property> - <property name="lineWidth"> - <number>0</number> - </property> - <widget class="QWidget" name="widget4video" native="true"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>320</width> - <height>240</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - </widget> </widget> - <widget class="QGroupBox" name="groupBox4logo"> + <widget class="QGroupBox" name="box_mapped_headpose"> <property name="geometry"> <rect> - <x>100</x> - <y>10</y> - <width>229</width> - <height>121</height> + <x>90</x> + <y>20</y> + <width>169</width> + <height>137</height> </rect> </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> <property name="title"> - <string notr="true"/> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + <string notr="true">Game data</string> </property> - <property name="flat"> - <bool>true</bool> - </property> - <layout class="QGridLayout" name="gridLayout_8"> - <property name="sizeConstraint"> - <enum>QLayout::SetMinimumSize</enum> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <property name="horizontalSpacing"> - <number>10</number> - </property> - <item row="2" column="0"> - <widget class="QLabel" name="lblZ"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="text"> - <string>TZ</string> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLCDNumber" name="lcdNumOutputRotX"> + <layout class="QGridLayout" name="gridLayout_10"> + <item row="0" column="1"> + <widget class="QLCDNumber" name="lcdNumOutputPosX"> <property name="enabled"> <bool>true</bool> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> <property name="font"> <font> <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> </font> </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> + <enum>QFrame::Raised</enum> </property> <property name="smallDecimalPoint"> - <bool>false</bool> + <bool>true</bool> </property> <property name="digitCount"> - <number>5</number> + <number>2</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> @@ -246,142 +94,129 @@ </widget> </item> <item row="0" column="0"> - <widget class="QLabel" name="lblX"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> + <widget class="QLabel" name="lblX_2"> <property name="text"> <string>TX</string> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QLCDNumber" name="lcdNumOutputPosX"> + <item row="1" column="3"> + <widget class="QLCDNumber" name="lcdNumOutputRotY"> <property name="enabled"> <bool>true</bool> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> <property name="font"> <font> <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> </font> </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> + <enum>QFrame::Raised</enum> </property> <property name="smallDecimalPoint"> - <bool>false</bool> + <bool>true</bool> </property> <property name="digitCount"> - <number>5</number> + <number>2</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> </property> </widget> </item> - <item row="0" column="2"> - <widget class="QLabel" name="lblRotX"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> + <item row="2" column="1"> + <widget class="QLCDNumber" name="lcdNumOutputPosZ"> + <property name="enabled"> + <bool>true</bool> </property> - <property name="text"> - <string>yaw</string> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>2</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QLCDNumber" name="lcdNumOutputPosY"> + <item row="2" column="3"> + <widget class="QLCDNumber" name="lcdNumOutputRotZ"> <property name="enabled"> <bool>true</bool> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> <property name="font"> <font> <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> </font> </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> + <enum>QFrame::Raised</enum> </property> <property name="smallDecimalPoint"> - <bool>false</bool> + <bool>true</bool> </property> <property name="digitCount"> - <number>5</number> + <number>2</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QLCDNumber" name="lcdNumOutputPosZ"> + <item row="0" column="2"> + <widget class="QLabel" name="lblRotX_2"> + <property name="text"> + <string>yaw</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLCDNumber" name="lcdNumOutputRotX"> <property name="enabled"> <bool>true</bool> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> <property name="font"> <font> <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> </font> </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> + <enum>QFrame::Raised</enum> </property> <property name="smallDecimalPoint"> - <bool>false</bool> + <bool>true</bool> </property> <property name="digitCount"> - <number>5</number> + <number>2</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> @@ -389,29 +224,17 @@ </widget> </item> <item row="2" column="2"> - <widget class="QLabel" name="lblRotZ"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> + <widget class="QLabel" name="lblRotZ_2"> <property name="text"> <string>roll</string> </property> </widget> </item> <item row="1" column="0"> - <widget class="QLabel" name="lblY"> + <widget class="QLabel" name="lblY_2"> <property name="enabled"> <bool>true</bool> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> <property name="autoFillBackground"> <bool>false</bool> </property> @@ -420,205 +243,93 @@ </property> </widget> </item> - <item row="1" column="2"> - <widget class="QLabel" name="lblRotY"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="text"> - <string>pitch</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLCDNumber" name="lcdNumOutputRotY"> + <item row="2" column="0"> + <widget class="QLabel" name="lblZ_2"> <property name="enabled"> <bool>true</bool> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - </font> - </property> <property name="autoFillBackground"> <bool>false</bool> </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> - </property> - <property name="smallDecimalPoint"> - <bool>false</bool> - </property> - <property name="digitCount"> - <number>5</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> + <property name="text"> + <string>TZ</string> </property> </widget> </item> - <item row="2" column="3"> - <widget class="QLCDNumber" name="lcdNumOutputRotZ"> + <item row="1" column="1"> + <widget class="QLCDNumber" name="lcdNumOutputPosY"> <property name="enabled"> <bool>true</bool> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> <property name="font"> <font> <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> </font> </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> + <enum>QFrame::Raised</enum> </property> <property name="smallDecimalPoint"> - <bool>false</bool> + <bool>true</bool> </property> <property name="digitCount"> - <number>5</number> + <number>2</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> </property> </widget> </item> + <item row="1" column="2"> + <widget class="QLabel" name="lblRotY_2"> + <property name="text"> + <string>pitch</string> + </property> + </widget> + </item> </layout> </widget> - <widget class="GLWidget" name="pose_display" native="true"> - <property name="geometry"> - <rect> - <x>10</x> - <y>20</y> - <width>81</width> - <height>100</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - </widget> <widget class="QGroupBox" name="groupGameProtocol"> <property name="geometry"> <rect> - <x>350</x> - <y>270</y> - <width>191</width> - <height>91</height> + <x>345</x> + <y>260</y> + <width>256</width> + <height>65</height> </rect> </property> - <property name="minimumSize"> - <size> - <width>180</width> - <height>80</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> <property name="title"> - <string>Game protocol</string> - </property> - <property name="alignment"> - <set>Qt::AlignHCenter|Qt::AlignTop</set> - </property> - <property name="flat"> - <bool>false</bool> - </property> - <property name="checkable"> - <bool>false</bool> + <string>Protocol</string> </property> - <layout class="QGridLayout" name="gridLayout_6" rowstretch="6,6" columnstretch="6" rowminimumheight="6,6" columnminimumwidth="6"> - <property name="sizeConstraint"> - <enum>QLayout::SetDefaultConstraint</enum> - </property> - <property name="spacing"> - <number>6</number> - </property> - <item row="0" column="0"> + <layout class="QHBoxLayout" name="_4"> + <item> <widget class="QComboBox" name="iconcomboProtocol"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="currentIndex"> - <number>-1</number> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="maxVisibleItems"> - <number>7</number> + <number>42</number> </property> </widget> </item> - <item row="1" column="0"> + <item> <widget class="QPushButton" name="btnShowServerControls"> <property name="enabled"> <bool>true</bool> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="toolTip"> - <string>Change game protocol settings</string> - </property> - <property name="styleSheet"> - <string notr="true"/> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="text"> <string>Settings</string> @@ -627,153 +338,42 @@ </item> </layout> </widget> - <widget class="QPushButton" name="btnEditCurves"> + <widget class="QGroupBox" name="groupTrackerSource"> <property name="geometry"> <rect> - <x>580</x> - <y>390</y> - <width>171</width> - <height>38</height> - </rect> - </property> - <property name="minimumSize"> - <size> - <width>62</width> - <height>38</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="cursor"> - <cursorShape>PointingHandCursor</cursorShape> - </property> - <property name="toolTip"> - <string>Edit the Curve settings</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true">background:none;</string> - </property> - <property name="text"> - <string>Mapping</string> - </property> - <property name="icon"> - <iconset resource="main-facetracknoir.qrc"> - <normaloff>:/uielements/curves.png</normaloff>:/uielements/curves.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>98</width> - <height>24</height> - </size> - </property> - </widget> - <widget class="QLabel" name="game_name"> - <property name="geometry"> - <rect> - <x>370</x> - <y>40</y> - <width>411</width> - <height>20</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="text"> - <string>Not connected</string> - </property> - </widget> - <widget class="QGroupBox" name="groupFilter"> - <property name="geometry"> - <rect> - <x>580</x> - <y>210</y> - <width>171</width> - <height>91</height> + <x>345</x> + <y>175</y> + <width>256</width> + <height>65</height> </rect> </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> <property name="title"> - <string>Filter</string> - </property> - <property name="alignment"> - <set>Qt::AlignHCenter|Qt::AlignTop</set> - </property> - <property name="flat"> - <bool>false</bool> - </property> - <property name="checkable"> - <bool>false</bool> + <string>Tracker</string> </property> - <layout class="QGridLayout" name="gridLayout"> - <property name="sizeConstraint"> - <enum>QLayout::SetDefaultConstraint</enum> - </property> - <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboFilter"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="currentIndex"> - <number>-1</number> + <layout class="QHBoxLayout" name="_3"> + <item> + <widget class="QComboBox" name="iconcomboTrackerSource"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="maxVisibleItems"> - <number>7</number> + <number>42</number> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QPushButton" name="btnShowFilterControls"> + <item> + <widget class="QPushButton" name="btnShowEngineControls"> <property name="enabled"> <bool>true</bool> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="toolTip"> - <string>Change game protocol settings</string> - </property> - <property name="styleSheet"> - <string notr="true"/> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="text"> <string>Settings</string> @@ -782,59 +382,26 @@ </item> </layout> </widget> - <widget class="QGroupBox" name="groupTrackerSource"> + <widget class="QGroupBox" name="groupFilter"> <property name="geometry"> <rect> - <x>350</x> - <y>60</y> - <width>191</width> - <height>91</height> + <x>630</x> + <y>175</y> + <width>221</width> + <height>65</height> </rect> </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> <property name="title"> - <string>Main tracker</string> - </property> - <property name="alignment"> - <set>Qt::AlignHCenter|Qt::AlignTop</set> - </property> - <property name="flat"> - <bool>false</bool> - </property> - <property name="checkable"> - <bool>false</bool> + <string>Filter</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <property name="sizeConstraint"> - <enum>QLayout::SetDefaultConstraint</enum> - </property> + <layout class="QHBoxLayout" name="_5"> <item> - <widget class="QComboBox" name="iconcomboTrackerSource"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="currentIndex"> - <number>-1</number> + <widget class="QComboBox" name="iconcomboFilter"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="maxVisibleItems"> <number>42</number> @@ -842,21 +409,15 @@ </widget> </item> <item> - <widget class="QPushButton" name="btnShowEngineControls"> + <widget class="QPushButton" name="btnShowFilterControls"> <property name="enabled"> <bool>true</bool> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="toolTip"> - <string>Change tracker settings</string> - </property> - <property name="styleSheet"> - <string notr="true"/> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="text"> <string>Settings</string> @@ -865,87 +426,26 @@ </item> </layout> </widget> - <widget class="QLabel" name="cameraName"> - <property name="geometry"> - <rect> - <x>370</x> - <y>10</y> - <width>411</width> - <height>25</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="text"> - <string/> - </property> - </widget> <widget class="QGroupBox" name="groupBox_3"> <property name="geometry"> <rect> - <x>350</x> - <y>160</y> - <width>191</width> - <height>91</height> + <x>630</x> + <y>260</y> + <width>221</width> + <height>65</height> </rect> </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> <property name="title"> <string>Auxiliary tracker</string> </property> - <property name="alignment"> - <set>Qt::AlignHCenter|Qt::AlignTop</set> - </property> - <property name="flat"> - <bool>false</bool> - </property> - <property name="checkable"> - <bool>false</bool> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="sizeConstraint"> - <enum>QLayout::SetDefaultConstraint</enum> - </property> + <layout class="QHBoxLayout" name="_6"> <item> <widget class="QComboBox" name="cbxSecondTrackerSource"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="currentIndex"> - <number>-1</number> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="maxVisibleItems"> <number>42</number> @@ -957,17 +457,11 @@ <property name="enabled"> <bool>true</bool> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="toolTip"> - <string>Change tracker settings</string> - </property> - <property name="styleSheet"> - <string notr="true"/> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="text"> <string>Settings</string> @@ -976,93 +470,13 @@ </item> </layout> </widget> - <widget class="QGroupBox" name="groupStartStop"> - <property name="geometry"> - <rect> - <x>350</x> - <y>400</y> - <width>190</width> - <height>65</height> - </rect> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="title"> - <string>GO!</string> - </property> - <property name="alignment"> - <set>Qt::AlignHCenter|Qt::AlignTop</set> - </property> - <property name="flat"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout_9" rowstretch="0" columnstretch="0,0" rowminimumheight="0" columnminimumwidth="0,0"> - <property name="sizeConstraint"> - <enum>QLayout::SetMinimumSize</enum> - </property> - <property name="spacing"> - <number>6</number> - </property> - <item row="0" column="0"> - <widget class="QPushButton" name="btnStartTracker"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="toolTip"> - <string>Start the Tracker</string> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string>Start</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QPushButton" name="btnStopTracker"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="toolTip"> - <string>Stop the Tracker</string> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string>Stop</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QPushButton" name="btnShortcuts"> + <widget class="QFrame" name="video_frame"> <property name="geometry"> <rect> - <x>580</x> - <y>340</y> - <width>171</width> - <height>38</height> + <x>10</x> + <y>170</y> + <width>320</width> + <height>240</height> </rect> </property> <property name="sizePolicy"> @@ -1071,151 +485,75 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>62</width> - <height>38</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="cursor"> - <cursorShape>PointingHandCursor</cursorShape> - </property> - <property name="toolTip"> - <string>Edit the Keyboard and mouse shortcuts</string> - </property> - <property name="text"> - <string>Keys</string> - </property> - <property name="icon"> - <iconset resource="main-facetracknoir.qrc"> - <normaloff>:/uielements/tools.png</normaloff>:/uielements/tools.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>98</width> - <height>24</height> - </size> + <property name="lineWidth"> + <number>0</number> </property> </widget> <widget class="QGroupBox" name="groupProfile"> <property name="geometry"> <rect> - <x>550</x> - <y>60</y> - <width>231</width> - <height>123</height> + <x>450</x> + <y>40</y> + <width>256</width> + <height>111</height> </rect> </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> <property name="title"> <string>Profile</string> </property> - <property name="alignment"> - <set>Qt::AlignHCenter|Qt::AlignTop</set> - </property> - <property name="flat"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout_5" rowstretch="6,6,6" columnstretch="6,6" rowminimumheight="6,6,6" columnminimumwidth="6,6"> - <property name="sizeConstraint"> - <enum>QLayout::SetDefaultConstraint</enum> - </property> - <property name="spacing"> - <number>6</number> - </property> - <item row="0" column="0" colspan="2"> + <layout class="QGridLayout" name="_2"> + <item row="0" column="0"> <widget class="QComboBox" name="iconcomboProfile"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="currentIndex"> - <number>-1</number> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="maxVisibleItems"> <number>10</number> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QPushButton" name="btnLoad"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="toolTip"> - <string>Load an INI-file from a folder</string> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string>Load</string> - </property> - </widget> - </item> - <item row="1" column="1"> + <item row="0" column="1"> <widget class="QPushButton" name="btnSave"> <property name="enabled"> <bool>true</bool> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="toolTip"> - <string>Save the current INI-file</string> + <property name="text"> + <string>Save</string> </property> - <property name="styleSheet"> - <string notr="true"/> + </widget> + </item> + <item row="1" column="0"> + <widget class="QPushButton" name="btnLoad"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="text"> - <string>Save</string> + <string>Load</string> </property> </widget> </item> - <item row="2" column="0" colspan="2"> + <item row="1" column="1"> <widget class="QPushButton" name="btnSaveAs"> <property name="enabled"> <bool>true</bool> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="toolTip"> - <string>Save the INI-file under another name</string> - </property> - <property name="styleSheet"> - <string notr="true"/> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="text"> <string>Save As ...</string> @@ -1224,495 +562,371 @@ </item> </layout> </widget> - <widget class="QGroupBox" name="groupBox"> + <widget class="QPushButton" name="btnEditCurves"> + <property name="geometry"> + <rect> + <x>715</x> + <y>60</y> + <width>151</width> + <height>38</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Mapping</string> + </property> + <property name="icon"> + <iconset resource="main-facetracknoir.qrc"> + <normaloff>:/uielements/curves.png</normaloff>:/uielements/curves.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>80</width> + <height>22</height> + </size> + </property> + </widget> + <widget class="GLWidget" name="pose_display" native="true"> + <property name="geometry"> + <rect> + <x>0</x> + <y>10</y> + <width>81</width> + <height>100</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QGroupBox" name="groupStartStop"> <property name="geometry"> <rect> - <x>10</x> - <y>380</y> - <width>141</width> - <height>106</height> + <x>520</x> + <y>340</y> + <width>190</width> + <height>65</height> </rect> </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>65536</width> + <height>65536</height> + </size> + </property> <property name="title"> - <string>Raw translation</string> + <string notr="true">Controls</string> </property> <property name="alignment"> - <set>Qt::AlignBottom|Qt::AlignHCenter</set> - </property> - <property name="flat"> - <bool>false</bool> + <set>Qt::AlignHCenter|Qt::AlignTop</set> </property> - <layout class="QFormLayout" name="formLayout"> - <property name="sizeConstraint"> - <enum>QLayout::SetMaximumSize</enum> - </property> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::FieldsStayAtSizeHint</enum> - </property> - <property name="rowWrapPolicy"> - <enum>QFormLayout::DontWrapRows</enum> - </property> - <property name="labelAlignment"> - <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set> - </property> - <property name="formAlignment"> - <set>Qt::AlignHCenter|Qt::AlignTop</set> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> + <layout class="QGridLayout"> <item row="0" column="0"> - <widget class="QLabel" name="label_4"> + <widget class="QPushButton" name="btnStartTracker"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> <property name="text"> - <string>TX</string> + <string>Start</string> </property> </widget> </item> <item row="0" column="1"> - <widget class="QLCDNumber" name="lcdNumX"> + <widget class="QPushButton" name="btnStopTracker"> <property name="enabled"> - <bool>true</bool> + <bool>false</bool> </property> <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> + <property name="text"> + <string>Stop</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QLabel" name="game_name"> + <property name="geometry"> + <rect> + <x>460</x> + <y>10</y> + <width>115</width> + <height>19</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QGroupBox" name="box_raw_headpose"> + <property name="geometry"> + <rect> + <x>270</x> + <y>20</y> + <width>169</width> + <height>137</height> + </rect> + </property> + <property name="title"> + <string notr="true">Raw pose</string> + </property> + <layout class="QGridLayout" name="gridLayout_13"> + <item row="0" column="1"> + <widget class="QLCDNumber" name="lcdNumX"> + <property name="enabled"> + <bool>true</bool> </property> <property name="font"> <font> - <pointsize>12</pointsize> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> </font> </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="lineWidth"> - <number>0</number> - </property> - <property name="midLineWidth"> - <number>0</number> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> </property> <property name="smallDecimalPoint"> - <bool>false</bool> + <bool>true</bool> </property> <property name="digitCount"> - <number>4</number> + <number>2</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_5"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> + <item row="0" column="0"> + <widget class="QLabel" name="lblX_3"> <property name="text"> - <string>TY</string> + <string>TX</string> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QLCDNumber" name="lcdNumY"> + <item row="1" column="3"> + <widget class="QLCDNumber" name="lcdNumRotY"> <property name="enabled"> <bool>true</bool> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> <property name="font"> <font> - <pointsize>12</pointsize> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> </font> </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="lineWidth"> - <number>0</number> - </property> - <property name="midLineWidth"> - <number>0</number> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> </property> <property name="smallDecimalPoint"> - <bool>false</bool> + <bool>true</bool> </property> <property name="digitCount"> - <number>4</number> + <number>2</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> </property> </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_6"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="text"> - <string>TZ</string> - </property> - </widget> - </item> <item row="2" column="1"> <widget class="QLCDNumber" name="lcdNumZ"> <property name="enabled"> <bool>true</bool> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> <property name="font"> <font> - <pointsize>12</pointsize> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> </font> </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="lineWidth"> - <number>0</number> - </property> - <property name="midLineWidth"> - <number>0</number> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> </property> <property name="smallDecimalPoint"> - <bool>false</bool> + <bool>true</bool> </property> <property name="digitCount"> - <number>4</number> + <number>2</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> </property> </widget> </item> - </layout> - </widget> - <widget class="QGroupBox" name="groupBox_2"> - <property name="geometry"> - <rect> - <x>160</x> - <y>380</y> - <width>161</width> - <height>111</height> - </rect> - </property> - <property name="title"> - <string>Raw rotation</string> - </property> - <property name="alignment"> - <set>Qt::AlignBottom|Qt::AlignHCenter</set> - </property> - <property name="flat"> - <bool>false</bool> - </property> - <layout class="QFormLayout" name="formLayout_2"> - <property name="sizeConstraint"> - <enum>QLayout::SetMaximumSize</enum> - </property> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::FieldsStayAtSizeHint</enum> - </property> - <property name="rowWrapPolicy"> - <enum>QFormLayout::DontWrapRows</enum> - </property> - <property name="labelAlignment"> - <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set> - </property> - <property name="formAlignment"> - <set>Qt::AlignHCenter|Qt::AlignTop</set> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="label_9"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="text"> - <string>yaw</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLCDNumber" name="lcdNumRotX"> + <item row="2" column="3"> + <widget class="QLCDNumber" name="lcdNumRotZ"> <property name="enabled"> <bool>true</bool> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> <property name="font"> <font> - <pointsize>12</pointsize> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> </font> </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="lineWidth"> - <number>0</number> - </property> - <property name="midLineWidth"> - <number>0</number> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> </property> <property name="smallDecimalPoint"> - <bool>false</bool> + <bool>true</bool> </property> <property name="digitCount"> - <number>4</number> + <number>2</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_8"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> + <item row="0" column="2"> + <widget class="QLabel" name="lblRotX_3"> <property name="text"> - <string>pitch</string> + <string>yaw</string> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QLCDNumber" name="lcdNumRotY"> + <item row="0" column="3"> + <widget class="QLCDNumber" name="lcdNumRotX"> <property name="enabled"> <bool>true</bool> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> <property name="font"> <font> - <pointsize>12</pointsize> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> </font> </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="lineWidth"> - <number>0</number> - </property> - <property name="midLineWidth"> - <number>0</number> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> </property> <property name="smallDecimalPoint"> - <bool>false</bool> + <bool>true</bool> </property> <property name="digitCount"> - <number>4</number> + <number>2</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> </property> </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_7"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <item row="2" column="2"> + <widget class="QLabel" name="lblRotZ_3"> + <property name="text"> + <string>roll</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lblY_3"> + <property name="enabled"> + <bool>true</bool> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> + <property name="autoFillBackground"> + <bool>false</bool> </property> <property name="text"> - <string>roll</string> + <string>TY</string> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QLCDNumber" name="lcdNumRotZ"> + <item row="2" column="0"> + <widget class="QLabel" name="lblZ_3"> <property name="enabled"> <bool>true</bool> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="text"> + <string>TZ</string> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLCDNumber" name="lcdNumY"> + <property name="enabled"> + <bool>true</bool> </property> <property name="font"> <font> - <pointsize>12</pointsize> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> </font> </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="lineWidth"> - <number>0</number> - </property> - <property name="midLineWidth"> - <number>0</number> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> </property> <property name="smallDecimalPoint"> - <bool>false</bool> + <bool>true</bool> </property> <property name="digitCount"> - <number>4</number> + <number>2</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> </property> </widget> </item> + <item row="1" column="2"> + <widget class="QLabel" name="lblRotY_3"> + <property name="text"> + <string>pitch</string> + </property> + </widget> + </item> </layout> - <zorder>lcdNumRotZ</zorder> - <zorder>label_8</zorder> - <zorder>label_7</zorder> - <zorder>lcdNumRotY</zorder> - <zorder>lcdNumRotX</zorder> - <zorder>label_9</zorder> </widget> </widget> </widget> - <layoutdefault spacing="0" margin="0"/> <customwidgets> <customwidget> <class>GLWidget</class> @@ -1724,4 +938,21 @@ <include location="main-facetracknoir.qrc"/> </resources> <connections/> + <designerdata> + <property name="gridDeltaX"> + <number>5</number> + </property> + <property name="gridDeltaY"> + <number>5</number> + </property> + <property name="gridSnapX"> + <bool>true</bool> + </property> + <property name="gridSnapY"> + <bool>true</bool> + </property> + <property name="gridVisible"> + <bool>true</bool> + </property> + </designerdata> </ui> -- cgit v1.2.3 From 0fa42ce4822c7b7cdfde6d0fe93abb2d722bc230 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 21 Sep 2014 21:22:39 +0200 Subject: indicate UI contains a "video feed" element --- facetracknoir/facetracknoir.cpp | 28 +++++++------ facetracknoir/facetracknoir.h | 13 +++--- facetracknoir/facetracknoir.ui | 74 +++++++++++++++++++++++------------ facetracknoir/main-facetracknoir.qrc | 1 + facetracknoir/uielements/no-feed.png | Bin 0 -> 20196 bytes 5 files changed, 72 insertions(+), 44 deletions(-) create mode 100644 facetracknoir/uielements/no-feed.png diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 5f4a4e11..3f6d641e 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -94,10 +94,14 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : pProtocolDialog(NULL), pFilterDialog(NULL), kbd_quit(QKeySequence("Ctrl+Q"), this), - looping(0) + looping(0), + video_frame_layout(new QVBoxLayout()), + no_feed_pixmap(":/uielements/no-feed.png") { ui.setupUi(this); setFixedSize(size()); + ui.video_frame_label->setPixmap(no_feed_pixmap); + updateButtonState(false); _keyboard_shortcuts = 0; _curve_config = 0; @@ -163,6 +167,7 @@ FaceTrackNoIR::~FaceTrackNoIR() { save(); if (Libraries) delete Libraries; + delete video_frame_layout; } QFrame* FaceTrackNoIR::get_video_widget() { @@ -275,20 +280,17 @@ void FaceTrackNoIR::loadSettings() { void FaceTrackNoIR::updateButtonState(bool running) { - bool e = !running; - ui.iconcomboProfile->setEnabled ( e ); - ui.btnLoad->setEnabled ( e ); - ui.btnSaveAs->setEnabled ( e ); - ui.btnStartTracker->setEnabled ( e ); + bool not_running = !running; + ui.iconcomboProfile->setEnabled ( not_running ); + ui.btnStartTracker->setEnabled ( not_running ); ui.btnStopTracker->setEnabled ( running ); - ui.iconcomboProtocol->setEnabled ( e ); - ui.btnShowServerControls->setEnabled ( e ); - ui.iconcomboFilter->setEnabled ( e ); - ui.iconcomboTrackerSource->setEnabled(e); - ui.cbxSecondTrackerSource->setEnabled(e); - - ui.btnStartTracker->setEnabled(e); + ui.iconcomboProtocol->setEnabled ( not_running ); + ui.iconcomboFilter->setEnabled ( not_running ); + ui.iconcomboTrackerSource->setEnabled(not_running); + ui.cbxSecondTrackerSource->setEnabled(not_running); + ui.btnStartTracker->setEnabled(not_running); ui.btnStopTracker->setEnabled(running); + ui.video_frame_label->setVisible(not_running); } void FaceTrackNoIR::startTracker( ) { diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 22a4363e..f005a9c1 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -32,13 +32,14 @@ #include <QList> #include <QKeySequence> #include <QShortcut> +#include <QLayout> +#include <QPixmap> +#include <QLabel> #if !defined(_WIN32) # include "qxt-mini/QxtGlobalShortcut" #else # include <windows.h> #endif -#include <QThread> -#include <QDebug> #include "ui_facetracknoir.h" @@ -117,18 +118,20 @@ private: void createIconGroupBox(); void loadSettings(); - void updateButtonState(bool); + void updateButtonState(bool running); QList<DynamicLibrary*> dlopen_filters; QList<DynamicLibrary*> dlopen_trackers; QList<DynamicLibrary*> dlopen_protocols; QShortcut kbd_quit; - + int looping; + + QLayout* video_frame_layout; + QPixmap no_feed_pixmap; #ifndef _WIN32 void bind_keyboard_shortcut(QxtGlobalShortcut&, key_opts& k); #endif void fill_profile_cbx(); - int looping; private slots: void open(); diff --git a/facetracknoir/facetracknoir.ui b/facetracknoir/facetracknoir.ui index ab332288..d2c78461 100644 --- a/facetracknoir/facetracknoir.ui +++ b/facetracknoir/facetracknoir.ui @@ -25,9 +25,9 @@ <widget class="QPushButton" name="btnShortcuts"> <property name="geometry"> <rect> - <x>715</x> - <y>110</y> - <width>151</width> + <x>760</x> + <y>280</y> + <width>96</width> <height>38</height> </rect> </property> @@ -54,7 +54,7 @@ <widget class="QGroupBox" name="box_mapped_headpose"> <property name="geometry"> <rect> - <x>90</x> + <x>120</x> <y>20</y> <width>169</width> <height>137</height> @@ -298,8 +298,8 @@ <property name="geometry"> <rect> <x>345</x> - <y>260</y> - <width>256</width> + <y>255</y> + <width>246</width> <height>65</height> </rect> </property> @@ -343,7 +343,7 @@ <rect> <x>345</x> <y>175</y> - <width>256</width> + <width>246</width> <height>65</height> </rect> </property> @@ -385,9 +385,9 @@ <widget class="QGroupBox" name="groupFilter"> <property name="geometry"> <rect> - <x>630</x> - <y>175</y> - <width>221</width> + <x>345</x> + <y>335</y> + <width>246</width> <height>65</height> </rect> </property> @@ -429,8 +429,8 @@ <widget class="QGroupBox" name="groupBox_3"> <property name="geometry"> <rect> - <x>630</x> - <y>260</y> + <x>625</x> + <y>180</y> <width>221</width> <height>65</height> </rect> @@ -485,16 +485,38 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="lineWidth"> - <number>0</number> - </property> + <widget class="QLabel" name="video_frame_label"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>320</width> + <height>240</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="text"> + <string/> + </property> + </widget> </widget> <widget class="QGroupBox" name="groupProfile"> <property name="geometry"> <rect> - <x>450</x> + <x>525</x> <y>40</y> - <width>256</width> + <width>311</width> <height>111</height> </rect> </property> @@ -565,9 +587,9 @@ <widget class="QPushButton" name="btnEditCurves"> <property name="geometry"> <rect> - <x>715</x> - <y>60</y> - <width>151</width> + <x>615</x> + <y>280</y> + <width>141</width> <height>38</height> </rect> </property> @@ -586,8 +608,8 @@ </property> <property name="iconSize"> <size> - <width>80</width> - <height>22</height> + <width>60</width> + <height>37</height> </size> </property> </widget> @@ -610,9 +632,9 @@ <widget class="QGroupBox" name="groupStartStop"> <property name="geometry"> <rect> - <x>520</x> - <y>340</y> - <width>190</width> + <x>635</x> + <y>335</y> + <width>201</width> <height>65</height> </rect> </property> @@ -685,7 +707,7 @@ <widget class="QGroupBox" name="box_raw_headpose"> <property name="geometry"> <rect> - <x>270</x> + <x>320</x> <y>20</y> <width>169</width> <height>137</height> diff --git a/facetracknoir/main-facetracknoir.qrc b/facetracknoir/main-facetracknoir.qrc index 6cb2e300..e37c2529 100644 --- a/facetracknoir/main-facetracknoir.qrc +++ b/facetracknoir/main-facetracknoir.qrc @@ -4,5 +4,6 @@ <file>images/settings16.png</file> <file>uielements/curves.png</file> <file>images/facetracknoir.png</file> + <file>uielements/no-feed.png</file> </qresource> </RCC> diff --git a/facetracknoir/uielements/no-feed.png b/facetracknoir/uielements/no-feed.png new file mode 100644 index 00000000..7c2f52bf Binary files /dev/null and b/facetracknoir/uielements/no-feed.png differ -- cgit v1.2.3 From 9e6dc13ee9cfc1743d11b8df336a020732560d3f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 08:42:36 +0200 Subject: fixup! 725e9c0e6ba5d3ab1bded4f104ce03cd57d3de4b --- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 50b25238..ef7e185d 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -229,7 +229,7 @@ void TrackerDll::getFullName(QString *strToBeFilled) void TrackerDll::getShortName(QString *strToBeFilled) { - *strToBeFilled = "HT" + *strToBeFilled = "HT"; } void TrackerDll::getDescription(QString *strToBeFilled) -- cgit v1.2.3 From 35d3f9b53f9ee409ef39621e5579699ebf2f645a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 08:43:17 +0200 Subject: only remove "no feed" image if tracker provides a video feed --- facetracknoir/facetracknoir.cpp | 13 ++++++++----- facetracknoir/facetracknoir.h | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 3f6d641e..eb9ece52 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -101,7 +101,7 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : ui.setupUi(this); setFixedSize(size()); ui.video_frame_label->setPixmap(no_feed_pixmap); - updateButtonState(false); + updateButtonState(false, false); _keyboard_shortcuts = 0; _curve_config = 0; @@ -278,7 +278,7 @@ void FaceTrackNoIR::loadSettings() { load_mappings(); } -void FaceTrackNoIR::updateButtonState(bool running) +void FaceTrackNoIR::updateButtonState(bool running, bool inertialp) { bool not_running = !running; ui.iconcomboProfile->setEnabled ( not_running ); @@ -290,7 +290,7 @@ void FaceTrackNoIR::updateButtonState(bool running) ui.cbxSecondTrackerSource->setEnabled(not_running); ui.btnStartTracker->setEnabled(not_running); ui.btnStopTracker->setEnabled(running); - ui.video_frame_label->setVisible(not_running); + ui.video_frame_label->setVisible(not_running || inertialp); } void FaceTrackNoIR::startTracker( ) { @@ -333,7 +333,10 @@ void FaceTrackNoIR::startTracker( ) { timUpdateHeadPose.start(50); - updateButtonState(true); + // NB check valid since SelectedLibraries ctor called + // trackers take care of layout state updates + const bool is_inertial = ui.video_frame->layout() == nullptr; + updateButtonState(true, is_inertial); } void FaceTrackNoIR::stopTracker( ) { @@ -381,7 +384,7 @@ void FaceTrackNoIR::stopTracker( ) { Libraries = NULL; } } - updateButtonState(false); + updateButtonState(false, false); } void FaceTrackNoIR::showHeadPose() { diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index f005a9c1..50f68825 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -118,7 +118,7 @@ private: void createIconGroupBox(); void loadSettings(); - void updateButtonState(bool running); + void updateButtonState(bool running, bool inertialp); QList<DynamicLibrary*> dlopen_filters; QList<DynamicLibrary*> dlopen_trackers; -- cgit v1.2.3 From 1c07a40d12aee0dc1a0167fbfcfe62a2d7142d79 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 09:39:40 +0200 Subject: core: plugin-api.hpp now exclusively provides interface --- facetracknoir/facetracknoir.h | 4 - facetracknoir/main-settings.hpp | 1 - facetracknoir/plugin-api.hpp | 87 ++++++++++++++++++++++ facetracknoir/plugin-support.h | 21 +----- facetracknoir/tracker.h | 1 - facetracknoir/tracker_types.cpp | 1 + facetracknoir/tracker_types.h | 7 +- ftnoir_filter_base/ftnoir_filter_base.h | 19 ----- ftnoir_filter_base/ftnoir_filter_base_global.h | 4 - ftnoir_posewidget/glwidget.h | 10 +-- ftnoir_protocol_base/ftnoir_protocol_base.h | 20 ----- ftnoir_protocol_base/ftnoir_protocol_base_global.h | 4 - ftnoir_tracker_base/ftnoir_tracker_base.h | 21 ------ ftnoir_tracker_base/ftnoir_tracker_base_global.h | 18 ----- ftnoir_tracker_base/ftnoir_tracker_types.h | 4 - qfunctionconfigurator/functionconfig.h | 4 +- qfunctionconfigurator/qfunctionconfigurator.h | 4 +- 17 files changed, 98 insertions(+), 132 deletions(-) create mode 100644 facetracknoir/plugin-api.hpp delete mode 100644 ftnoir_filter_base/ftnoir_filter_base.h delete mode 100644 ftnoir_filter_base/ftnoir_filter_base_global.h delete mode 100644 ftnoir_protocol_base/ftnoir_protocol_base.h delete mode 100644 ftnoir_protocol_base/ftnoir_protocol_base_global.h delete mode 100644 ftnoir_tracker_base/ftnoir_tracker_base.h delete mode 100644 ftnoir_tracker_base/ftnoir_tracker_base_global.h delete mode 100644 ftnoir_tracker_base/ftnoir_tracker_types.h diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 50f68825..bdec333f 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -52,10 +52,6 @@ using namespace options; #include "tracker.h" #include "facetracknoir/shortcuts.h" -#include "ftnoir_protocol_base/ftnoir_protocol_base.h" -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#include "ftnoir_filter_base/ftnoir_filter_base.h" - class Tracker; // pre-define class to avoid circular includes class FaceTrackNoIR; diff --git a/facetracknoir/main-settings.hpp b/facetracknoir/main-settings.hpp index b45c5d9c..0a1fb968 100644 --- a/facetracknoir/main-settings.hpp +++ b/facetracknoir/main-settings.hpp @@ -2,7 +2,6 @@ #include <QString> #include "facetracknoir/options.h" -#include "ftnoir_tracker_base/ftnoir_tracker_types.h" using namespace options; struct key_opts { diff --git a/facetracknoir/plugin-api.hpp b/facetracknoir/plugin-api.hpp new file mode 100644 index 00000000..1610c5d8 --- /dev/null +++ b/facetracknoir/plugin-api.hpp @@ -0,0 +1,87 @@ +#pragma once + +#include <QtGlobal> +#include <QFrame> + +#if defined(_WIN32) +# define CALLING_CONVENTION __stdcall +#else +# define CALLING_CONVENTION +#endif + +enum Axis { + TX = 0, TY, TZ, Yaw, Pitch, Roll +}; + +struct Metadata +{ + Metadata() {} + virtual ~Metadata() {} + + virtual void getFullName(QString *strToBeFilled) = 0; + virtual void getShortName(QString *strToBeFilled) = 0; + virtual void getDescription(QString *strToBeFilled) = 0; + virtual void getIcon(QIcon *icon) = 0; +}; + +struct IFilter +{ + virtual ~IFilter() = 0; + virtual void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position) = 0; + virtual void reset() = 0; +}; + +inline IFilter::~IFilter() {} + +struct IFilterDialog +{ + virtual ~IFilterDialog() {} + virtual void registerFilter(IFilter* tracker) = 0; + virtual void unregisterFilter() = 0; +}; + +struct IProtocol +{ + virtual ~IProtocol() = 0; + virtual bool checkServerInstallationOK() = 0; + virtual void sendHeadposeToGame( const double* headpose ) = 0; + virtual QString getGameName() = 0; +}; + +inline IProtocol::~IProtocol() {} + +struct IProtocolDialog +{ + virtual ~IProtocolDialog() {} + virtual void registerProtocol(IProtocol *protocol) = 0; + virtual void unRegisterProtocol() = 0; +}; + +struct ITracker +{ + virtual ~ITracker() = 0; + virtual void StartTracker( QFrame* frame ) = 0; + virtual void GetHeadPoseData(double *data) = 0; + virtual int preferredHz() { return 200; } +}; + +inline ITracker::~ITracker() {} + +struct ITrackerDialog +{ + virtual ~ITrackerDialog() {} + virtual void registerTracker(ITracker *tracker) = 0; + virtual void unRegisterTracker() = 0; +}; + +#ifndef OPENTRACK_EXPORT +# ifdef IN_OPENTRACK +# if !defined(_MSC_VER) +# define OPENTRACK_EXPORT __attribute__ ((visibility ("default"))) Q_DECL_EXPORT +# else +# error "MSVC support removed" +# endif +# else +# define OPENTRACK_EXPORT Q_DECL_IMPORT +# endif +#endif diff --git a/facetracknoir/plugin-support.h b/facetracknoir/plugin-support.h index 931f0fa1..bb7b3c02 100644 --- a/facetracknoir/plugin-support.h +++ b/facetracknoir/plugin-support.h @@ -1,5 +1,7 @@ #pragma once +#include "facetracknoir/plugin-api.hpp" + #if defined(_WIN32) # define CALLING_CONVENTION_SUFFIX_VOID_FUNCTION "@0" # ifdef _MSC_VER @@ -19,15 +21,6 @@ #include <QString> #include <QLibrary> #include <QFrame> -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#include "ftnoir_filter_base/ftnoir_filter_base.h" -#include "ftnoir_protocol_base/ftnoir_protocol_base.h" - -#if defined(_WIN32) -# define CALLING_CONVENTION __stdcall -#else -# define CALLING_CONVENTION -#endif class IDynamicLibraryProvider; @@ -66,16 +59,6 @@ private: #endif }; -struct Metadata -{ - Metadata() {} - virtual ~Metadata() {} - - virtual void getFullName(QString *strToBeFilled) = 0; - virtual void getShortName(QString *strToBeFilled) = 0; - virtual void getDescription(QString *strToBeFilled) = 0; - virtual void getIcon(QIcon *icon) = 0; -}; // merely to break a circular header dependency -sh class IDynamicLibraryProvider { diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index d06ac9d2..54350164 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -11,7 +11,6 @@ #include <QDebug> #include <QMutex> #include "plugin-support.h" -#include <ftnoir_tracker_base/ftnoir_tracker_types.h> #include <vector> #include <qfunctionconfigurator/functionconfig.h> diff --git a/facetracknoir/tracker_types.cpp b/facetracknoir/tracker_types.cpp index ba3ac552..2d7ec45a 100644 --- a/facetracknoir/tracker_types.cpp +++ b/facetracknoir/tracker_types.cpp @@ -1,5 +1,6 @@ #include "tracker_types.h" #include "rotation.h" +#include "facetracknoir/plugin-api.hpp" #define PI 3.14159265358979323846264 #define D2R PI/180.0 diff --git a/facetracknoir/tracker_types.h b/facetracknoir/tracker_types.h index 043c0420..80b74759 100644 --- a/facetracknoir/tracker_types.h +++ b/facetracknoir/tracker_types.h @@ -1,7 +1,4 @@ -#ifndef __TRACKER_TYPES_H__ -#define __TRACKER_TYPES_H__ - -#include "ftnoir_tracker_base/ftnoir_tracker_types.h" +#pragma once struct T6DOF { public: @@ -12,5 +9,3 @@ public: T6DOF operator-(const T6DOF& A, const T6DOF& B); // get new pose with respect to reference pose B T6DOF operator+(const T6DOF& A, const T6DOF& B); // get new pose with respect to reference pose B^-1 - -#endif //__TRACKER_TYPES_H__ diff --git a/ftnoir_filter_base/ftnoir_filter_base.h b/ftnoir_filter_base/ftnoir_filter_base.h deleted file mode 100644 index 366ff149..00000000 --- a/ftnoir_filter_base/ftnoir_filter_base.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include "ftnoir_filter_base_global.h" -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" - -struct IFilter -{ - virtual ~IFilter() = 0; - virtual void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position) = 0; - virtual void reset() = 0; -}; - -inline IFilter::~IFilter() { } - -struct IFilterDialog -{ - virtual ~IFilterDialog() {} - virtual void registerFilter(IFilter* tracker) = 0; - virtual void unregisterFilter() = 0; -}; diff --git a/ftnoir_filter_base/ftnoir_filter_base_global.h b/ftnoir_filter_base/ftnoir_filter_base_global.h deleted file mode 100644 index 09172756..00000000 --- a/ftnoir_filter_base/ftnoir_filter_base_global.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" - -#define FTNOIR_FILTER_BASE_EXPORT FTNOIR_TRACKER_BASE_EXPORT diff --git a/ftnoir_posewidget/glwidget.h b/ftnoir_posewidget/glwidget.h index c4b2e09d..eef238ec 100644 --- a/ftnoir_posewidget/glwidget.h +++ b/ftnoir_posewidget/glwidget.h @@ -5,12 +5,11 @@ * copyright notice and this permission notice appear in all copies. */ -#ifndef GLWIDGET_H -#define GLWIDGET_H +#pragma once #include <QtGui> #include <QPixmap> -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" +#include "facetracknoir/plugin-api.hpp" struct Point { Point(int x, int y) : @@ -48,7 +47,7 @@ struct Vec2f { } }; -class FTNOIR_TRACKER_BASE_EXPORT GLWidget : public QWidget +class OPENTRACK_EXPORT GLWidget : public QWidget { Q_OBJECT @@ -56,7 +55,6 @@ public: GLWidget(QWidget *parent); ~GLWidget(); void rotateBy(double xAngle, double yAngle, double zAngle); - protected: void paintEvent ( QPaintEvent * event ); @@ -93,5 +91,3 @@ private: QImage back; QImage texture; }; - -#endif diff --git a/ftnoir_protocol_base/ftnoir_protocol_base.h b/ftnoir_protocol_base/ftnoir_protocol_base.h deleted file mode 100644 index 84f1c0e5..00000000 --- a/ftnoir_protocol_base/ftnoir_protocol_base.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#include "ftnoir_protocol_base_global.h" -#include "ftnoir_tracker_base/ftnoir_tracker_types.h" - -struct IProtocol -{ - virtual ~IProtocol() = 0; - virtual bool checkServerInstallationOK() = 0; - virtual void sendHeadposeToGame( const double* headpose ) = 0; - virtual QString getGameName() = 0; -}; - -inline IProtocol::~IProtocol() { } - -struct IProtocolDialog -{ - virtual ~IProtocolDialog() {} - virtual void registerProtocol(IProtocol *protocol) = 0; - virtual void unRegisterProtocol() = 0; -}; diff --git a/ftnoir_protocol_base/ftnoir_protocol_base_global.h b/ftnoir_protocol_base/ftnoir_protocol_base_global.h deleted file mode 100644 index 24f3f6c9..00000000 --- a/ftnoir_protocol_base/ftnoir_protocol_base_global.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" - -#define FTNOIR_PROTOCOL_BASE_EXPORT FTNOIR_TRACKER_BASE_EXPORT diff --git a/ftnoir_tracker_base/ftnoir_tracker_base.h b/ftnoir_tracker_base/ftnoir_tracker_base.h deleted file mode 100644 index 8415e38c..00000000 --- a/ftnoir_tracker_base/ftnoir_tracker_base.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once -#include "ftnoir_tracker_base_global.h" -#include "ftnoir_tracker_types.h" -#include <QFrame> - -struct ITracker -{ - virtual ~ITracker() = 0; - virtual void StartTracker( QFrame* frame ) = 0; - virtual void GetHeadPoseData(double *data) = 0; - virtual int preferredHz() { return 200; } -}; - -inline ITracker::~ITracker() { } - -struct ITrackerDialog -{ - virtual ~ITrackerDialog() {} - virtual void registerTracker(ITracker *tracker) = 0; - virtual void unRegisterTracker() = 0; -}; diff --git a/ftnoir_tracker_base/ftnoir_tracker_base_global.h b/ftnoir_tracker_base/ftnoir_tracker_base_global.h deleted file mode 100644 index 5b53ba82..00000000 --- a/ftnoir_tracker_base/ftnoir_tracker_base_global.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef FTNOIR_TRACKER_BASE_GLOBAL_H -#define FTNOIR_TRACKER_BASE_GLOBAL_H - -#include <QtGlobal> - -#ifndef FTNOIR_TRACKER_BASE_EXPORT -# ifdef IN_OPENTRACK -# if !defined(_MSC_VER) -# define FTNOIR_TRACKER_BASE_EXPORT __attribute__ ((visibility ("default"))) Q_DECL_EXPORT -# else -# error "MSVC support removed" -# endif -# else -# define FTNOIR_TRACKER_BASE_EXPORT Q_DECL_IMPORT -# endif -#endif - -#endif // FTNOIR_TRACKER_BASE_GLOBAL_H diff --git a/ftnoir_tracker_base/ftnoir_tracker_types.h b/ftnoir_tracker_base/ftnoir_tracker_types.h deleted file mode 100644 index d38baee4..00000000 --- a/ftnoir_tracker_base/ftnoir_tracker_types.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once -enum Axis { - TX = 0, TY, TZ, Yaw, Pitch, Roll -}; diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h index ee2087a0..66e7f3e8 100644 --- a/qfunctionconfigurator/functionconfig.h +++ b/qfunctionconfigurator/functionconfig.h @@ -13,7 +13,7 @@ #include <QString> #include <QSettings> #include <QMutex> -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" +#include "facetracknoir/plugin-api.hpp" #include <vector> #define MEMOIZE_PRECISION 100 @@ -52,7 +52,7 @@ public: } }; -class FTNOIR_TRACKER_BASE_EXPORT FunctionConfig { +class OPENTRACK_EXPORT FunctionConfig { private: void reload(); float getValueInternal(int x); diff --git a/qfunctionconfigurator/qfunctionconfigurator.h b/qfunctionconfigurator/qfunctionconfigurator.h index bb2f09ce..facc5bbe 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.h +++ b/qfunctionconfigurator/qfunctionconfigurator.h @@ -11,9 +11,9 @@ #include <QPointF> #include <QElapsedTimer> #include "qfunctionconfigurator/functionconfig.h" -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" +#include "facetracknoir/plugin-api.hpp" -class FTNOIR_TRACKER_BASE_EXPORT QFunctionConfigurator : public QWidget +class OPENTRACK_EXPORT QFunctionConfigurator : public QWidget { Q_OBJECT Q_PROPERTY(QColor colorBezier READ colorBezier WRITE setColorBezier) -- cgit v1.2.3 From 6e6fabc040c28206f11fe9d2f3895bab33d7265e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 09:59:04 +0200 Subject: pass -Wall -Wextra, reformat --- freetrackclient/freetrackclient.c | 59 +++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/freetrackclient/freetrackclient.c b/freetrackclient/freetrackclient.c index ee11741a..43694cda 100644 --- a/freetrackclient/freetrackclient.c +++ b/freetrackclient/freetrackclient.c @@ -17,7 +17,11 @@ * * The FreeTrackClient sources were translated from the original Delphi sources * * * created by the FreeTrack developers. * */ -#define NP_AXIS_MAX 16383 + +#pragma GCC diagnostic ignored "-Wvariadic-macros" +#pragma GCC diagnostic ignored "-Wunused-parameter" + +#define NP_AXIS_MAX 16383 #include <stdbool.h> #include <string.h> @@ -43,44 +47,39 @@ static const char* dllProvider = "FreeTrack"; static bool FTCreateMapping(void) { - if (pMemData != NULL) { - return true; - } + if (pMemData != NULL) + return true; - hFTMemMap = CreateFileMappingA(INVALID_HANDLE_VALUE, + hFTMemMap = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, - 0, - sizeof(FTHeap), - (LPCSTR) FT_MM_DATA); + 0, + sizeof(FTHeap), + (LPCSTR) FT_MM_DATA); if (hFTMemMap == NULL) - { - pMemData = NULL; - return false; - } + return (pMemData = NULL), false; pMemData = (FTHeap*) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof(FTHeap)); hFTMutex = CreateMutexA(NULL, false, FREETRACK_MUTEX); - return true; + return true; } FT_EXPORT(bool) FTGetData(FTData* data) { - if (FTCreateMapping() == false) - return false; - - if (hFTMutex && WaitForSingleObject(hFTMutex, 16) == WAIT_OBJECT_0) { - if (pMemData) { - if (pMemData->data.DataID > (1 << 29)) { - pMemData->data.DataID = 0; - } - data->DataID = pMemData->data.DataID; - } - ReleaseMutex(hFTMutex); - } - return true; + if (FTCreateMapping() == false) + return false; + + if (hFTMutex && WaitForSingleObject(hFTMutex, 16) == WAIT_OBJECT_0) { + if (pMemData) { + if (pMemData->data.DataID > (1 << 29)) + pMemData->data.DataID = 0; + data->DataID = pMemData->data.DataID; + } + ReleaseMutex(hFTMutex); + } + return true; } /* @@ -90,20 +89,18 @@ FT_EXPORT(bool) FTGetData(FTData* data) */ FT_EXPORT(void) FTReportName( int name ) { - dbg_report("FTReportName request (ID = %d).\n", name); + dbg_report("FTReportName request (ID = %d).\n", name); } FT_EXPORT(const char*) FTGetDllVersion(void) { dbg_report("FTGetDllVersion request.\n"); - - return dllVersion; + return dllVersion; } FT_EXPORT(const char*) FTProvider(void) { dbg_report("FTProvider request.\n"); - - return dllProvider; + return dllProvider; } -- cgit v1.2.3 From 2c242165e3e3881dfffa31d1b8cf727a71c68be1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 09:59:44 +0200 Subject: unused #define declspec dllimport -> #error --- facetracknoir/plugin-api.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/facetracknoir/plugin-api.hpp b/facetracknoir/plugin-api.hpp index 1610c5d8..f50b9617 100644 --- a/facetracknoir/plugin-api.hpp +++ b/facetracknoir/plugin-api.hpp @@ -82,6 +82,6 @@ struct ITrackerDialog # error "MSVC support removed" # endif # else -# define OPENTRACK_EXPORT Q_DECL_IMPORT +# error "Use only for exporting dynamic modules" # endif #endif -- cgit v1.2.3 From 59c4424ebc570a9494f1e35b9400b2969716b16a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 10:06:10 +0200 Subject: cleanup warnings --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 633bf587..024f67f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -274,7 +274,11 @@ opentrack_library(opentrack-proto-fgfs) if(SDK_VJOY) include_directories(${SDK_VJOY}) - opentrack_library(opentrack-proto-vjoy) + set(link-flags) + if(CMAKE_C_COMPILER_IS_GNUCC) + set(link-flags "-Wl,--enable-stdcall-fixup") + endif() + opentrack_library(opentrack-proto-vjoy LINK ${link-flags}) target_link_libraries(opentrack-proto-vjoy ${MY_QT_LIBS} "${SDK_VJOY}/VJoy.dll") endif() @@ -286,7 +290,7 @@ if(SDK_ENABLE_LIBEVDEV) endif() if(SDK_FSUIPC) - opentrack_library(opentrack-proto-fsuipc LINK "${link-flags}") + opentrack_library(opentrack-proto-fsuipc) target_link_libraries(opentrack-proto-fsuipc "${SDK_FSUIPC}/FSUIPC_User.lib") endif() -- cgit v1.2.3 From 93d20668f6b30dac0e70598703e58d600903f333 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 10:08:18 +0200 Subject: nix warnings for C translation units --- CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 024f67f5..b1bbf4ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,6 @@ if(APPLE) set(CMAKE_STATIC_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_STATIC_LINKER_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_EXE_LINKER_FLAGS}") set(CMAKE_MODULE_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_MODULE_LINKER_FLAGS}") - set(CMAKE_CXX_FLAGS " -stdlib=libc++ ${CMAKE_CXX_FLAGS} ") endif() SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) @@ -51,8 +50,8 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) add_definitions(-DOPENTRACK_API -DIN_OPENTRACK) -if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) - add_definitions(-std=c++11) +if(CMAKE_COMPILER_IS_GNUCXX OR APPLE) + set(CMAKE_CXX_FLAGS " -std=c++11 ${CMAKE_CXX_FLAGS} ") endif() -- cgit v1.2.3 From b6fd30bf9a716f060856ebc6767fa36e66b5fc2f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 10:26:36 +0200 Subject: nix spurious debug --- ftnoir_protocol_ft/ftnoir_protocol_ft.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp index 7b62dfbb..39ac649d 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp @@ -126,8 +126,6 @@ void FTNoIR_Protocol::start_dummy() { QString program = QCoreApplication::applicationDirPath() + "/TrackIR.exe"; dummyTrackIR.setProgram("\"" + program + "\""); dummyTrackIR.start(); - - qDebug() << "FTServer::run() says: TrackIR.exe executed!" << program; } bool FTNoIR_Protocol::checkServerInstallationOK() @@ -140,8 +138,6 @@ bool FTNoIR_Protocol::checkServerInstallationOK() QString aLocation = QCoreApplication::applicationDirPath() + "/"; - qDebug() << "checkServerInstallationOK says: used interface = " << s.intUsedInterface; - switch (s.intUsedInterface) { case 0: // Use both interfaces settings.setValue( "Path" , aLocation ); -- cgit v1.2.3 From 7f16cc265c4fe96c9c5bfcae2426aa036491b15b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 10:27:16 +0200 Subject: joy: nix debug --- ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index 63a3a8b5..7df65709 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -129,8 +129,6 @@ void FTNoIR_Tracker::StartTracker(QFrame* frame) goto fail; } - qDebug() << "joy init success"; - return; fail: -- cgit v1.2.3 From 6f2a292bb7f84470354e5bc707a1f3eea9d824e3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 10:27:39 +0200 Subject: joy: nix spurious warning with -Wall -Wextra --- ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index 7df65709..90091e5d 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -41,6 +41,8 @@ FTNoIR_Tracker::~FTNoIR_Tracker() } } +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" + static BOOL CALLBACK EnumObjectsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, VOID* pContext ) { -- cgit v1.2.3 From 2d20f6cc87a3f1e9470f1fc4718e4ddf64cac57c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 10:27:57 +0200 Subject: cmake: add cross-compile example --- cmake/mingw-w64.cmake | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 cmake/mingw-w64.cmake diff --git a/cmake/mingw-w64.cmake b/cmake/mingw-w64.cmake new file mode 100644 index 00000000..5cb63674 --- /dev/null +++ b/cmake/mingw-w64.cmake @@ -0,0 +1,28 @@ +# this file only serves as toolchain file when specified so explicitly +# when building the software. from repository's root directory: +# mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=$(pwd)/../cmake/mingw-w64.cmake +# -sh 20140922 + +SET(CMAKE_SYSTEM_NAME Windows) +SET(CMAKE_SYSTEM_VERSION 1) + +# specify the cross compiler +SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc) +SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++) +set(CMAKE_RC_COMPILER i686-w64-mingw32-windres) + +SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) + +# search for programs in the host directories +SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# don't poison with system compile-time data +SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +set(CMAKE_C_FLAGS_RELEASE "-O3 -flto -march=i686 -mtune=prescott -mno-sse3 -mno-avx -frename-registers" CACHE STRING "" FORCE) +set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE} CACHE STRING "" FORCE) +set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE) + +# these are merely for my own convenience +set(OpenCV_DIR /home/sthalik/opentrack-win32-sdk/opencv/build) +set(Qt5_DIR /home/sthalik/opentrack-win32-sdk/qt-install-5.3.1/lib/cmake/Qt5) -- cgit v1.2.3 From b8009a72fa4aa9cee227e6323bf674b056dafbe8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 10:32:36 +0200 Subject: pt: fix warning --- ftnoir_tracker_pt/point_extractor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftnoir_tracker_pt/point_extractor.cpp b/ftnoir_tracker_pt/point_extractor.cpp index d9ff0a5b..968fe23e 100644 --- a/ftnoir_tracker_pt/point_extractor.cpp +++ b/ftnoir_tracker_pt/point_extractor.cpp @@ -20,7 +20,7 @@ PointExtractor::PointExtractor(){ //freopen("CON", "w", stderr); } // ---------------------------------------------------------------------------- -const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool draw_output) +const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float /*dt*/, bool draw_output) { const int W = frame.cols; const int H = frame.rows; -- cgit v1.2.3 From e0322730ab08421113e5538c5202cfcb64b59ce6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 10:43:15 +0200 Subject: core: clean up dll logic --- facetracknoir/plugin-support.cpp | 69 +++++++++++++++++++++++++++++++--------- facetracknoir/plugin-support.h | 2 +- 2 files changed, 55 insertions(+), 16 deletions(-) diff --git a/facetracknoir/plugin-support.cpp b/facetracknoir/plugin-support.cpp index 2e80c5e4..50b8ad1a 100644 --- a/facetracknoir/plugin-support.cpp +++ b/facetracknoir/plugin-support.cpp @@ -76,19 +76,44 @@ SelectedLibraries::SelectedLibraries(IDynamicLibraryProvider* mainApp) : correct = true; } -DynamicLibrary::DynamicLibrary(const QString& filename) +DynamicLibrary::DynamicLibrary(const QString& filename) : + handle(nullptr), + Dialog(nullptr), + Constructor(nullptr), + Metadata(nullptr) { this->filename = filename; #if defined(_WIN32) QString fullPath = QCoreApplication::applicationDirPath() + "/" + this->filename; handle = new QLibrary(fullPath); - qDebug() << handle->errorString(); + + struct _foo { + static bool die(QLibrary*& l, bool failp) + { + if (failp) + { + qDebug() << "failed" << l->errorString(); + delete l; + l = nullptr; + } + return failp; + } + }; + + if (_foo::die(handle, !handle->load())) + return; + Dialog = (DIALOG_FUNPTR) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetDialog" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); - qDebug() << handle->errorString(); + if (_foo::die(handle, !Dialog)) + return; + Constructor = (CTOR_FUNPTR) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetConstructor" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); - qDebug() << handle->errorString(); + if (_foo::die(handle, !Constructor)) + return; + Metadata = (METADATA_FUNPTR) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetMetadata" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); - qDebug() << handle->errorString(); + if (_foo::die(handle, !Metadata)) + return; #else QByteArray latin1 = QFile::encodeName(filename); handle = dlopen(latin1.constData(), RTLD_NOW | @@ -102,20 +127,34 @@ DynamicLibrary::DynamicLibrary(const QString& filename) ); if (handle) { - fprintf(stderr, "Error, if any: %s\n", dlerror()); - fflush(stderr); + struct _foo { + static bool err(void*& handle) + { + const char* err = dlerror(); + if (err) + { + fprintf(stderr, "Error, ignoring: %s\n", err); + fflush(stderr); + dlclose(handle); + handle = nullptr; + return true; + } + false; + } + }; + if (_foo::err(handle)) + return; Dialog = (DIALOG_FUNPTR) dlsym(handle, "GetDialog"); - fprintf(stderr, "Error, if any: %s\n", dlerror()); - fflush(stderr); + if (_foo::err(handle)) + return; Constructor = (CTOR_FUNPTR) dlsym(handle, "GetConstructor"); - fprintf(stderr, "Error, if any: %s\n", dlerror()); - fflush(stderr); + if (_foo::err(handle)) + return; Metadata = (METADATA_FUNPTR) dlsym(handle, "GetMetadata"); - fprintf(stderr, "Error, if any: %s\n", dlerror()); - fflush(stderr); + if (_foo::err(handle)) + return; } else { - fprintf(stderr, "Error, if any: %s\n", dlerror()); - fflush(stderr); + (void) _foo::err(handle); } #endif } diff --git a/facetracknoir/plugin-support.h b/facetracknoir/plugin-support.h index bb7b3c02..f3270aa6 100644 --- a/facetracknoir/plugin-support.h +++ b/facetracknoir/plugin-support.h @@ -46,7 +46,7 @@ extern "C" typedef void* (CALLING_CONVENTION* DIALOG_FUNPTR)(void); class DynamicLibrary { public: DynamicLibrary(const QString& filename); - virtual ~DynamicLibrary(); + ~DynamicLibrary(); DIALOG_FUNPTR Dialog; CTOR_FUNPTR Constructor; METADATA_FUNPTR Metadata; -- cgit v1.2.3 From 766fc776421a85958d52bf6f3bfbc189b65a0d5f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 10:43:58 +0200 Subject: remove "second tracker" support Was always a kludge. --- facetracknoir/facetracknoir.cpp | 43 +++++---------------------------------- facetracknoir/facetracknoir.h | 11 +++------- facetracknoir/facetracknoir.ui | 44 ---------------------------------------- facetracknoir/plugin-support.cpp | 18 +--------------- facetracknoir/plugin-support.h | 2 -- facetracknoir/tracker.cpp | 7 ------- 6 files changed, 9 insertions(+), 116 deletions(-) diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index eb9ece52..3c36ab56 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -54,7 +54,7 @@ static bool get_metadata(DynamicLibrary* lib, QString& longName, QIcon& icon) return true; } -static void fill_combobox(const QString& filter, QList<DynamicLibrary*>& list, QComboBox* cbx, QComboBox* cbx2) +static void fill_combobox(const QString& filter, QList<DynamicLibrary*>& list, QComboBox& cbx) { QDir settingsDir( QCoreApplication::applicationDirPath() ); QStringList filenames = settingsDir.entryList( QStringList() << (LIB_PREFIX + filter + SONAME), QDir::Files, QDir::Name ); @@ -71,9 +71,7 @@ static void fill_combobox(const QString& filter, QList<DynamicLibrary*>& list, Q continue; } list.push_back(lib); - cbx->addItem(icon, longName); - if (cbx2) - cbx2->addItem(icon, longName); + cbx.addItem(icon, longName); } } @@ -90,7 +88,6 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : pose(std::vector<axis_opts*>{&s.a_x, &s.a_y, &s.a_z, &s.a_yaw, &s.a_pitch, &s.a_roll}), timUpdateHeadPose(this), pTrackerDialog(NULL), - pSecondTrackerDialog(NULL), pProtocolDialog(NULL), pFilterDialog(NULL), kbd_quit(QKeySequence("Ctrl+Q"), this), @@ -129,20 +126,17 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : connect(ui.btnEditCurves, SIGNAL(clicked()), this, SLOT(showCurveConfiguration())); connect(ui.btnShortcuts, SIGNAL(clicked()), this, SLOT(showKeyboardShortcuts())); connect(ui.btnShowEngineControls, SIGNAL(clicked()), this, SLOT(showTrackerSettings())); - connect(ui.btnShowSecondTrackerSettings, SIGNAL(clicked()), this, SLOT(showSecondTrackerSettings())); connect(ui.btnShowServerControls, SIGNAL(clicked()), this, SLOT(showServerControls())); connect(ui.btnShowFilterControls, SIGNAL(clicked()), this, SLOT(showFilterControls())); - ui.cbxSecondTrackerSource->addItem(QIcon(), ""); dlopen_filters.push_back((DynamicLibrary*) NULL); ui.iconcomboFilter->addItem(QIcon(), ""); - fill_combobox("opentrack-proto-*.", dlopen_protocols, ui.iconcomboProtocol, NULL); - fill_combobox("opentrack-tracker-*.", dlopen_trackers, ui.iconcomboTrackerSource, ui.cbxSecondTrackerSource); - fill_combobox("opentrack-filter-*.", dlopen_filters, ui.iconcomboFilter, NULL); + fill_combobox("opentrack-proto-*.", dlopen_protocols, *ui.iconcomboProtocol); + fill_combobox("opentrack-tracker-*.", dlopen_trackers, *ui.iconcomboTrackerSource); + fill_combobox("opentrack-filter-*.", dlopen_filters, *ui.iconcomboFilter); tie_setting(s.tracker_dll, ui.iconcomboTrackerSource); - tie_setting(s.tracker2_dll, ui.cbxSecondTrackerSource); tie_setting(s.protocol_dll, ui.iconcomboProtocol); tie_setting(s.filter_dll, ui.iconcomboFilter); @@ -287,7 +281,6 @@ void FaceTrackNoIR::updateButtonState(bool running, bool inertialp) ui.iconcomboProtocol->setEnabled ( not_running ); ui.iconcomboFilter->setEnabled ( not_running ); ui.iconcomboTrackerSource->setEnabled(not_running); - ui.cbxSecondTrackerSource->setEnabled(not_running); ui.btnStartTracker->setEnabled(not_running); ui.btnStopTracker->setEnabled(running); ui.video_frame_label->setVisible(not_running || inertialp); @@ -369,12 +362,6 @@ void FaceTrackNoIR::stopTracker( ) { delete pFilterDialog; pFilterDialog = nullptr; } - if (pSecondTrackerDialog) - { - pSecondTrackerDialog->unRegisterTracker(); - delete pSecondTrackerDialog; - pSecondTrackerDialog = nullptr; - } if ( tracker ) { delete tracker; @@ -442,26 +429,6 @@ void FaceTrackNoIR::showTrackerSettings() { } } -void FaceTrackNoIR::showSecondTrackerSettings() { - if (pSecondTrackerDialog) { - delete pSecondTrackerDialog; - pSecondTrackerDialog = NULL; - } - - DynamicLibrary* lib = dlopen_trackers.value(ui.cbxSecondTrackerSource->currentIndex() - 1, (DynamicLibrary*) NULL); - - if (lib) { - pSecondTrackerDialog = (ITrackerDialog*) lib->Dialog(); - if (pSecondTrackerDialog) { - auto foo = dynamic_cast<QWidget*>(pSecondTrackerDialog); - foo->setFixedSize(foo->size()); - if (Libraries && Libraries->pSecondTracker) - pSecondTrackerDialog->registerTracker(Libraries->pSecondTracker); - dynamic_cast<QWidget*>(pSecondTrackerDialog)->show(); - } - } -} - void FaceTrackNoIR::showServerControls() { if (pProtocolDialog) { delete pProtocolDialog; diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index bdec333f..9bdda749 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -68,16 +68,13 @@ public: QFrame *get_video_widget(); Tracker *tracker; void bindKeyboardShortcuts(); - DynamicLibrary* current_tracker1() { + DynamicLibrary* current_tracker1() override { return dlopen_trackers.value(ui.iconcomboTrackerSource->currentIndex(), (DynamicLibrary*) NULL); } - DynamicLibrary* current_tracker2() { - return dlopen_trackers.value(ui.cbxSecondTrackerSource->currentIndex() - 1, (DynamicLibrary*) NULL); - } - DynamicLibrary* current_protocol() { + DynamicLibrary* current_protocol() override { return dlopen_protocols.value(ui.iconcomboProtocol->currentIndex(), (DynamicLibrary*) NULL); } - DynamicLibrary* current_filter() { + DynamicLibrary* current_filter() override { return dlopen_filters.value(ui.iconcomboFilter->currentIndex(), (DynamicLibrary*) NULL); } THeadPoseDOF& axis(int idx) { @@ -104,7 +101,6 @@ private: QTimer timUpdateHeadPose; ITrackerDialog* pTrackerDialog; - ITrackerDialog* pSecondTrackerDialog; IProtocolDialog* pProtocolDialog; IFilterDialog* pFilterDialog; @@ -137,7 +133,6 @@ private slots: void profileSelected(int index); void showTrackerSettings(); - void showSecondTrackerSettings(); void showServerControls(); void showFilterControls(); diff --git a/facetracknoir/facetracknoir.ui b/facetracknoir/facetracknoir.ui index d2c78461..481260d3 100644 --- a/facetracknoir/facetracknoir.ui +++ b/facetracknoir/facetracknoir.ui @@ -426,50 +426,6 @@ </item> </layout> </widget> - <widget class="QGroupBox" name="groupBox_3"> - <property name="geometry"> - <rect> - <x>625</x> - <y>180</y> - <width>221</width> - <height>65</height> - </rect> - </property> - <property name="title"> - <string>Auxiliary tracker</string> - </property> - <layout class="QHBoxLayout" name="_6"> - <item> - <widget class="QComboBox" name="cbxSecondTrackerSource"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maxVisibleItems"> - <number>42</number> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnShowSecondTrackerSettings"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Settings</string> - </property> - </widget> - </item> - </layout> - </widget> <widget class="QFrame" name="video_frame"> <property name="geometry"> <rect> diff --git a/facetracknoir/plugin-support.cpp b/facetracknoir/plugin-support.cpp index 50b8ad1a..71279cb9 100644 --- a/facetracknoir/plugin-support.cpp +++ b/facetracknoir/plugin-support.cpp @@ -14,11 +14,6 @@ SelectedLibraries::~SelectedLibraries() pTracker = NULL; } - if (pSecondTracker) { - delete pSecondTracker; - pSecondTracker = NULL; - } - if (pFilter) delete pFilter; @@ -27,7 +22,7 @@ SelectedLibraries::~SelectedLibraries() } SelectedLibraries::SelectedLibraries(IDynamicLibraryProvider* mainApp) : - pTracker(NULL), pSecondTracker(NULL), pFilter(NULL), pProtocol(NULL) + pTracker(NULL), pFilter(NULL), pProtocol(NULL) { correct = false; if (!mainApp) @@ -42,13 +37,6 @@ SelectedLibraries::SelectedLibraries(IDynamicLibraryProvider* mainApp) : pTracker = (ITracker*) ptr(); } - lib = mainApp->current_tracker2(); - - if (lib && lib->Constructor) { - ptr = (CTOR_FUNPTR) lib->Constructor; - pSecondTracker = (ITracker*) ptr(); - } - lib = mainApp->current_protocol(); if (lib && lib->Constructor) { @@ -69,15 +57,11 @@ SelectedLibraries::SelectedLibraries(IDynamicLibraryProvider* mainApp) : if (pTracker) { pTracker->StartTracker( mainApp->get_video_widget() ); } - if (pSecondTracker) { - pSecondTracker->StartTracker( mainApp->get_video_widget() ); - } correct = true; } DynamicLibrary::DynamicLibrary(const QString& filename) : - handle(nullptr), Dialog(nullptr), Constructor(nullptr), Metadata(nullptr) diff --git a/facetracknoir/plugin-support.h b/facetracknoir/plugin-support.h index f3270aa6..1e02bd60 100644 --- a/facetracknoir/plugin-support.h +++ b/facetracknoir/plugin-support.h @@ -27,7 +27,6 @@ class IDynamicLibraryProvider; struct SelectedLibraries { public: ITracker* pTracker; - ITracker* pSecondTracker; IFilter* pFilter; IProtocol* pProtocol; SelectedLibraries(IDynamicLibraryProvider* main = NULL); @@ -64,7 +63,6 @@ private: class IDynamicLibraryProvider { public: virtual DynamicLibrary* current_tracker1() = 0; - virtual DynamicLibrary* current_tracker2() = 0; virtual DynamicLibrary* current_protocol() = 0; virtual DynamicLibrary* current_filter() = 0; virtual QFrame* get_video_widget() = 0; diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index dd37e883..90e9bdad 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -91,9 +91,6 @@ void Tracker::run() { if (Libraries->pTracker) sleep_ms = std::min(sleep_ms, 1000 / Libraries->pTracker->preferredHz()); - if (Libraries->pSecondTracker) - sleep_ms = std::min(sleep_ms, 1000 / Libraries->pSecondTracker->preferredHz()); - qDebug() << "tracker Hz:" << 1000 / sleep_ms; #if defined(_WIN32) @@ -107,10 +104,6 @@ void Tracker::run() { if (should_quit) break; - if (Libraries->pSecondTracker) { - Libraries->pSecondTracker->GetHeadPoseData(newpose); - } - if (Libraries->pTracker) { Libraries->pTracker->GetHeadPoseData(newpose); } -- cgit v1.2.3 From 461cb6e8f2b141a2408a4caf1fab930c24b19516 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 11:28:22 +0200 Subject: nix spurious warning --- ftnoir_protocol_sc/ftnoir_protocol_sc.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp index 1baeacd4..b3f4b490 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp @@ -91,6 +91,8 @@ void FTNoIR_Protocol::sendHeadposeToGame( const double *headpose ) { (void) (simconnect_calldispatch(hSimConnect, processNextSimconnectEvent, NULL)); } +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" + class ActivationContext { public: ActivationContext(const int resid) { -- cgit v1.2.3 From fb0cd9401e26aaf610356ffe899af268012d18c3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 11:39:07 +0200 Subject: remove obsolete axis selector from trackers --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 449 +++++++++------------ ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 24 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 7 - ftnoir_tracker_freepie-udp/freepie-udp-controls.ui | 159 +------- .../ftnoir_tracker_freepie-udp.cpp | 9 +- .../ftnoir_tracker_freepie-udp.h | 6 +- .../ftnoir_tracker_freepie-udp_dialog.cpp | 3 - ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 26 +- ftnoir_tracker_ht/ftnoir_tracker_ht.h | 7 - ftnoir_tracker_ht/ht-trackercontrols.ui | 91 +---- .../ftnoir_hydra_clientcontrols.ui | 168 +------- ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp | 43 +- ftnoir_tracker_hydra/ftnoir_tracker_hydra.h | 15 +- .../ftnoir_tracker_hydra_dialog.cpp | 7 - ftnoir_tracker_pt/FTNoIR_PT_Controls.ui | 245 ----------- ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp | 7 - ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h | 9 - ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui | 200 +-------- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 19 +- ftnoir_tracker_rift/ftnoir_tracker_rift.h | 8 +- ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp | 8 - ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui | 358 +--------------- ftnoir_tracker_udp/ftnoir_tracker_udp.cpp | 14 +- ftnoir_tracker_udp/ftnoir_tracker_udp.h | 10 +- ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp | 10 +- 25 files changed, 281 insertions(+), 1621 deletions(-) diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index be237e3c..e5654bd5 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -10,7 +10,7 @@ <x>0</x> <y>0</y> <width>636</width> - <height>346</height> + <height>368</height> </rect> </property> <property name="sizePolicy"> @@ -19,243 +19,239 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="maximumSize"> - <size> - <width>6666</width> - <height>6666</height> - </size> - </property> <property name="windowTitle"> - <string>HT tracker settings</string> + <string>Tracker settings</string> </property> - <layout class="QGridLayout" name="gridLayout"> - <property name="spacing"> - <number>7</number> - </property> - <item row="9" column="1" rowspan="3"> - <widget class="QGroupBox" name="groupBox_2"> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0" rowspan="2" colspan="2"> + <widget class="QGroupBox" name="groupBox"> <property name="title"> - <string>Head position</string> + <string/> </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> + <property name="flat"> + <bool>true</bool> </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="2" column="0"> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>TY</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_5"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> <property name="text"> - <string>TX</string> + <string>Horizontal FOV</string> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QDoubleSpinBox" name="cx"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <item row="0" column="1"> + <widget class="QDoubleSpinBox" name="cameraFOV"> + <property name="locale"> + <locale language="English" country="UnitedStates"/> </property> <property name="minimum"> - <double>-10000.000000000000000</double> + <double>35.000000000000000</double> </property> <property name="maximum"> - <double>10000.000000000000000</double> + <double>180.000000000000000</double> + </property> + <property name="value"> + <double>52.000000000000000</double> </property> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_8"> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> <property name="text"> - <string>TZ</string> + <string>Frames per second</string> </property> </widget> </item> - <item row="3" column="1"> - <widget class="QDoubleSpinBox" name="cz"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimum"> - <double>-10000.000000000000000</double> - </property> - <property name="maximum"> - <double>10000.000000000000000</double> - </property> + <item row="1" column="1"> + <widget class="QComboBox" name="cameraFPS"> + <item> + <property name="text"> + <string notr="true">Default</string> + </property> + </item> + <item> + <property name="text"> + <string>30</string> + </property> + </item> + <item> + <property name="text"> + <string>60</string> + </property> + </item> + <item> + <property name="text"> + <string>120</string> + </property> + </item> + <item> + <property name="text"> + <string>180</string> + </property> + </item> </widget> </item> - <item row="2" column="1"> - <widget class="QDoubleSpinBox" name="cy"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimum"> - <double>-10000.000000000000000</double> - </property> - <property name="maximum"> - <double>10000.000000000000000</double> + <item row="2" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Camera name</string> </property> </widget> </item> - <item row="4" column="1"> - <widget class="QPushButton" name="btn_calibrate"> + <item row="2" column="1"> + <widget class="QComboBox" name="cameraName"/> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_4"> <property name="text"> - <string>Calibrate</string> + <string>Resolution</string> </property> </widget> </item> - </layout> - </widget> - </item> - <item row="0" column="3" rowspan="3" colspan="2"> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Enable axes</string> - </property> - <layout class="QFormLayout" name="formLayout"> - <property name="horizontalSpacing"> - <number>7</number> - </property> - <property name="leftMargin"> - <number>6</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>6</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item row="0" column="0"> - <widget class="QCheckBox" name="rx"> - <property name="text"> - <string>RX</string> - </property> + <item row="3" column="1"> + <widget class="QComboBox" name="resolution"> + <item> + <property name="text"> + <string>640x480</string> + </property> + </item> + <item> + <property name="text"> + <string>320x240</string> + </property> + </item> + <item> + <property name="text"> + <string>320x200</string> + </property> + </item> + <item> + <property name="text"> + <string>Default (not recommended!)</string> + </property> + </item> </widget> </item> - <item row="0" column="1"> - <widget class="QCheckBox" name="tx"> + <item row="4" column="0"> + <widget class="QLabel" name="label_10"> <property name="text"> - <string>TX</string> + <string>Red channel only</string> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QCheckBox" name="ry"> + <item row="4" column="1"> + <widget class="QCheckBox" name="red_only"> <property name="text"> - <string>RY</string> + <string>Mileage may vary</string> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="ty"> + <item row="5" column="0"> + <widget class="QLabel" name="label_9"> <property name="text"> - <string>TY</string> + <string>Marker pitch</string> </property> </widget> </item> - <item row="2" column="0"> - <widget class="QCheckBox" name="rz"> - <property name="text"> - <string>RZ</string> + <item row="5" column="1"> + <widget class="QDoubleSpinBox" name="marker_pitch"> + <property name="minimum"> + <double>-180.000000000000000</double> + </property> + <property name="maximum"> + <double>180.000000000000000</double> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QCheckBox" name="tz"> - <property name="text"> - <string>TZ</string> + <item row="6" column="1"> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Head center</string> </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="4" column="1"> + <widget class="QPushButton" name="btn_calibrate"> + <property name="text"> + <string>Calibrate</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>TX</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QDoubleSpinBox" name="cy"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimum"> + <double>-10000.000000000000000</double> + </property> + <property name="maximum"> + <double>10000.000000000000000</double> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QDoubleSpinBox" name="cx"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimum"> + <double>-10000.000000000000000</double> + </property> + <property name="maximum"> + <double>10000.000000000000000</double> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QDoubleSpinBox" name="cz"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimum"> + <double>-10000.000000000000000</double> + </property> + <property name="maximum"> + <double>10000.000000000000000</double> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>TZ</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>TY</string> + </property> + </widget> + </item> + </layout> </widget> </item> </layout> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Frames per second</string> - </property> - </widget> - </item> - <item row="2" column="1" colspan="2"> - <widget class="QComboBox" name="cameraName"/> - </item> - <item row="1" column="1" colspan="2"> - <widget class="QComboBox" name="cameraFPS"> - <item> - <property name="text"> - <string notr="true">Default</string> - </property> - </item> - <item> - <property name="text"> - <string>30</string> - </property> - </item> - <item> - <property name="text"> - <string>60</string> - </property> - </item> - <item> - <property name="text"> - <string>120</string> - </property> - </item> - <item> - <property name="text"> - <string>180</string> - </property> - </item> - </widget> - </item> - <item row="7" column="1"> - <widget class="QCheckBox" name="red_only"> - <property name="text"> - <string>Recommended!</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Camera name</string> - </property> - </widget> - </item> - <item row="0" column="1" colspan="2"> - <widget class="QDoubleSpinBox" name="cameraFOV"> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="minimum"> - <double>35.000000000000000</double> - </property> - <property name="maximum"> - <double>180.000000000000000</double> - </property> - <property name="value"> - <double>52.000000000000000</double> - </property> - </widget> - </item> - <item row="6" column="2" rowspan="5" colspan="3"> + <item row="0" column="2"> <widget class="QLabel" name="label_6"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> @@ -270,7 +266,7 @@ <enum>Qt::RichText</enum> </property> <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> </property> <property name="wordWrap"> <bool>true</bool> @@ -286,93 +282,16 @@ </property> </widget> </item> - <item row="7" column="0"> - <widget class="QLabel" name="label_10"> - <property name="text"> - <string>Red channel only</string> - </property> - </widget> - </item> - <item row="6" column="1"> - <widget class="QComboBox" name="resolution"> - <item> - <property name="text"> - <string>640x480</string> - </property> - </item> - <item> - <property name="text"> - <string>320x240</string> - </property> - </item> - <item> - <property name="text"> - <string>320x200</string> - </property> - </item> - <item> - <property name="text"> - <string>Default (not recommended!)</string> - </property> - </item> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Horizontal FOV</string> - </property> - </widget> - </item> - <item row="11" column="4"> + <item row="1" column="2"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="standardButtons"> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> </property> </widget> </item> - <item row="8" column="1"> - <widget class="QDoubleSpinBox" name="marker_pitch"> - <property name="minimum"> - <double>-180.000000000000000</double> - </property> - <property name="maximum"> - <double>180.000000000000000</double> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Resolution</string> - </property> - </widget> - </item> - <item row="8" column="0"> - <widget class="QLabel" name="label_9"> - <property name="text"> - <string>Marker pitch</string> - </property> - </widget> - </item> </layout> </widget> <tabstops> - <tabstop>cameraFOV</tabstop> - <tabstop>cameraFPS</tabstop> - <tabstop>cameraName</tabstop> - <tabstop>resolution</tabstop> - <tabstop>red_only</tabstop> - <tabstop>marker_pitch</tabstop> - <tabstop>cx</tabstop> - <tabstop>cy</tabstop> - <tabstop>cz</tabstop> - <tabstop>rx</tabstop> - <tabstop>ry</tabstop> - <tabstop>rz</tabstop> - <tabstop>tx</tabstop> - <tabstop>ty</tabstop> - <tabstop>tz</tabstop> <tabstop>buttonBox</tabstop> </tabstops> <resources/> diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index b70bef09..f469c7a4 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -380,18 +380,12 @@ void Tracker::GetHeadPoseData(double *data) { QMutexLocker lck(&mtx); - if (s.eyaw) - data[Yaw] = pose[Yaw]; - if (s.epitch) - data[Pitch] = pose[Pitch]; - if (s.eroll) - data[Roll] = pose[Roll]; - if (s.ex) - data[TX] = pose[TX] * .1; - if (s.ey) - data[TY] = pose[TY] * .1; - if (s.ez) - data[TZ] = pose[TZ] * .1; + data[Yaw] = pose[Yaw]; + data[Pitch] = pose[Pitch]; + data[Roll] = pose[Roll]; + data[TX] = pose[TX] * .1; + data[TY] = pose[TY] * .1; + data[TZ] = pose[TZ] * .1; } class TrackerDll : public Metadata @@ -456,12 +450,6 @@ TrackerControls::TrackerControls() tie_setting(s.resolution, ui.resolution); tie_setting(s.force_fps, ui.cameraFPS); tie_setting(s.fov, ui.cameraFOV); - tie_setting(s.eyaw, ui.rx); - tie_setting(s.epitch, ui.ry); - tie_setting(s.eroll, ui.rz); - tie_setting(s.ex, ui.tx); - tie_setting(s.ey, ui.ty); - tie_setting(s.ez, ui.tz); tie_setting(s.headpos_x, ui.cx); tie_setting(s.headpos_y, ui.cy); tie_setting(s.headpos_z, ui.cz); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index f2207aef..c431d27a 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -28,7 +28,6 @@ struct settings { value<double> fov, headpos_x, headpos_y, headpos_z; value<int> camera_index, force_fps, resolution; value<bool> red_only; - value<bool> eyaw, epitch, eroll, ex, ey, ez; value<double> marker_pitch; settings() : b(bundle("aruco-tracker")), @@ -40,12 +39,6 @@ struct settings { force_fps(b, "force-fps", 0), resolution(b, "force-resolution", 0), red_only(b, "red-only", false), - eyaw(b, "enable-y", true), - epitch(b, "enable-p", true), - eroll(b, "enable-r", true), - ex(b, "enable-x", true), - ey(b, "enable-y", true), - ez(b, "enable-z", true), marker_pitch(b, "marker-pitch", 0) {} }; diff --git a/ftnoir_tracker_freepie-udp/freepie-udp-controls.ui b/ftnoir_tracker_freepie-udp/freepie-udp-controls.ui index 937dafaa..9870372a 100644 --- a/ftnoir_tracker_freepie-udp/freepie-udp-controls.ui +++ b/ftnoir_tracker_freepie-udp/freepie-udp-controls.ui @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>208</width> - <height>240</height> + <width>198</width> + <height>71</height> </rect> </property> <property name="windowTitle"> @@ -26,145 +26,31 @@ <property name="autoFillBackground"> <bool>false</bool> </property> - <layout class="QGridLayout" name="gridLayout_3"> - <property name="topMargin"> - <number>0</number> - </property> - <item row="0" column="0" colspan="3"> - <widget class="QGroupBox" name="groupbox_port"> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="1"> - <widget class="QSpinBox" name="port"> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_5"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>UDP port</string> - </property> - </widget> - </item> - </layout> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label_5"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>UDP port</string> + </property> </widget> </item> - <item row="1" column="0" rowspan="2" colspan="3"> - <widget class="QGroupBox" name="groupBox_3"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>85</height> - </size> + <item row="0" column="1"> + <widget class="QSpinBox" name="port"> + <property name="minimum"> + <number>0</number> </property> - <property name="title"> - <string>Enable axis</string> + <property name="maximum"> + <number>65535</number> </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="2" column="0"> - <widget class="QLabel" name="label_6"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Roll</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="chkEnablePitch"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_11"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Yaw</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_9"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Pitch</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QCheckBox" name="chkEnableYaw"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QCheckBox" name="chkEnableRoll"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> </widget> </item> - <item row="3" column="1"> + <item row="1" column="0" colspan="2"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="standardButtons"> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> @@ -173,9 +59,6 @@ </item> </layout> </widget> - <tabstops> - <tabstop>port</tabstop> - </tabstops> <resources/> <connections/> <slots> diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp index 7223a33f..718ec510 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp @@ -92,12 +92,9 @@ void TrackerImpl::GetHeadPoseData(double *data) if (s.enable_z) data[TZ] = pose[TZ]; #endif - if (s.enable_yaw) - data[Yaw] = pose[Yaw]; - if (s.enable_pitch) - data[Pitch] = pose[Pitch]; - if (s.enable_roll) - data[Roll] = pose[Roll]; + data[Yaw] = pose[Yaw]; + data[Pitch] = pose[Pitch]; + data[Roll] = pose[Roll]; } extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h index 8cefb509..b3f028fc 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h @@ -16,13 +16,9 @@ using namespace options; struct settings { pbundle b; value<int> port; - value<bool> enable_roll, enable_pitch, enable_yaw; settings() : b(bundle("freepie-udp-tracker")), - port(b, "port", 4237), - enable_roll(b, "enable-roll", true), - enable_pitch(b, "enable-pitch", true), - enable_yaw(b, "enable-yaw", true) + port(b, "port", 4237) {} }; diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp index d845ff4a..1489e336 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp @@ -9,9 +9,6 @@ TrackerDialog::TrackerDialog() connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); tie_setting(s.port, ui.port); - tie_setting(s.enable_yaw, ui.chkEnableYaw); - tie_setting(s.enable_pitch, ui.chkEnablePitch); - tie_setting(s.enable_roll, ui.chkEnableRoll); } void TrackerDialog::doOK() { diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index ef7e185d..7d6fc24e 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -197,24 +197,16 @@ void Tracker::GetHeadPoseData(double *data) shm->frame.width = 0; } if (shm->result.filled) { - if (s.enableRX) - data[Yaw] = shm->result.rotx; - if (s.enableRY) { - data[Pitch] = shm->result.roty; - } - if (s.enableRZ) { - data[Roll] = shm->result.rotz; - } - if (s.enableTX) - data[TX] = shm->result.tx; - if (s.enableTY) - data[TY] = shm->result.ty; - if (s.enableTZ) - data[TZ] = shm->result.tz; if (fabs(data[Yaw]) > 60 || fabs(data[Pitch]) > 50 || fabs(data[Roll]) > 40) { shm->pause = true; } + data[Yaw] = shm->result.rotx; + data[Pitch] = shm->result.roty; + data[Roll] = shm->result.rotz; + data[TX] = shm->result.tx; + data[TY] = shm->result.ty; + data[TZ] = shm->result.tz; } else { shm->pause = false; } @@ -267,12 +259,6 @@ TrackerControls::TrackerControls() tie_setting(s.camera_idx, ui.cameraName); tie_setting(s.fps, ui.cameraFPS); tie_setting(s.fov, ui.cameraFOV); - tie_setting(s.enableTX, ui.tx); - tie_setting(s.enableTY, ui.ty); - tie_setting(s.enableTZ, ui.tz); - tie_setting(s.enableRX, ui.rx); - tie_setting(s.enableRY, ui.ry); - tie_setting(s.enableRZ, ui.rz); tie_setting(s.resolution, ui.resolution); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h index 583249dc..418137bc 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h @@ -20,17 +20,10 @@ using namespace options; struct settings { pbundle b; - value<bool> enableTX, enableTY, enableTZ, enableRX, enableRY, enableRZ; value<double> fov; value<int> fps, camera_idx, resolution; settings() : b(bundle("HT-Tracker")), - enableTX(b, "enable-tx", true), - enableTY(b, "enable-ty", true), - enableTZ(b, "enable-tz", true), - enableRX(b, "enable-rx", true), - enableRY(b, "enable-ry", true), - enableRZ(b, "enable-rz", true), fov(b, "fov", 56), fps(b, "fps", 0), camera_idx(b, "camera-index", 0), diff --git a/ftnoir_tracker_ht/ht-trackercontrols.ui b/ftnoir_tracker_ht/ht-trackercontrols.ui index f57022c8..0b94ffc5 100644 --- a/ftnoir_tracker_ht/ht-trackercontrols.ui +++ b/ftnoir_tracker_ht/ht-trackercontrols.ui @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>531</width> - <height>166</height> + <width>354</width> + <height>158</height> </rect> </property> <property name="sizePolicy"> @@ -52,91 +52,6 @@ </property> </widget> </item> - <item row="0" column="2" rowspan="3"> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Enable axes</string> - </property> - <widget class="QCheckBox" name="rx"> - <property name="geometry"> - <rect> - <x>10</x> - <y>20</y> - <width>70</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>RX</string> - </property> - </widget> - <widget class="QCheckBox" name="ry"> - <property name="geometry"> - <rect> - <x>10</x> - <y>40</y> - <width>70</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>RY</string> - </property> - </widget> - <widget class="QCheckBox" name="rz"> - <property name="geometry"> - <rect> - <x>10</x> - <y>60</y> - <width>70</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>RZ</string> - </property> - </widget> - <widget class="QCheckBox" name="tx"> - <property name="geometry"> - <rect> - <x>60</x> - <y>20</y> - <width>70</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>TX</string> - </property> - </widget> - <widget class="QCheckBox" name="ty"> - <property name="geometry"> - <rect> - <x>60</x> - <y>40</y> - <width>70</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>TY</string> - </property> - </widget> - <widget class="QCheckBox" name="tz"> - <property name="geometry"> - <rect> - <x>60</x> - <y>60</y> - <width>70</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>TZ</string> - </property> - </widget> - </widget> - </item> <item row="1" column="0"> <widget class="QLabel" name="label_2"> <property name="text"> @@ -214,7 +129,7 @@ </item> </widget> </item> - <item row="4" column="2"> + <item row="4" column="1"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="standardButtons"> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> diff --git a/ftnoir_tracker_hydra/ftnoir_hydra_clientcontrols.ui b/ftnoir_tracker_hydra/ftnoir_hydra_clientcontrols.ui index e5e41bec..7cfac075 100644 --- a/ftnoir_tracker_hydra/ftnoir_hydra_clientcontrols.ui +++ b/ftnoir_tracker_hydra/ftnoir_hydra_clientcontrols.ui @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>172</width> - <height>145</height> + <width>190</width> + <height>62</height> </rect> </property> <property name="windowTitle"> @@ -26,167 +26,15 @@ <property name="autoFillBackground"> <bool>false</bool> </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QGroupBox" name="groupBox_3"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>85</height> - </size> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>None whatsoever</string> </property> - <property name="title"> - <string>Enable Axis</string> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label_61"> - <property name="text"> - <string>Pitch:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QCheckBox" name="chkEnablePitch"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>X:</string> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QCheckBox" name="chkEnableX"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_91"> - <property name="text"> - <string>Yaw:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="chkEnableYaw"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="label_9"> - <property name="text"> - <string>Y:</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QCheckBox" name="chkEnableY"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_111"> - <property name="text"> - <string>Roll:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QCheckBox" name="chkEnableRoll"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="label_11"> - <property name="text"> - <string>Z:</string> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QCheckBox" name="chkEnableZ"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> </widget> </item> - <item> + <item row="1" column="0"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="standardButtons"> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp index 6345ac57..5770f015 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp @@ -8,13 +8,10 @@ # define SIXENSE_UTILS_STATIC_LIB #endif #include <sixense.h> -#include <sixense_math.hpp> +Hydra_Tracker::Hydra_Tracker() : should_quit(false) {} -Hydra_Tracker::Hydra_Tracker() : should_quit(false) -{ - for (int i = 0; i < 6; i++) - newHeadPose[i] = 0; -} +#pragma GCC diagnostic ignored "-Wreorder" +#include <sixense_math.hpp> Hydra_Tracker::~Hydra_Tracker() { @@ -38,33 +35,13 @@ void Hydra_Tracker::GetHeadPoseData(double *data) float ypr[3]; mat.getEulerAngles().fill(ypr); - newHeadPose[Yaw] = ypr[0]; - newHeadPose[Pitch] = ypr[1]; - newHeadPose[Roll] = ypr[2]; - - - newHeadPose[TX] = acd.controllers[0].pos[0]/50.0f; - newHeadPose[TY] = acd.controllers[0].pos[1]/50.0f; - newHeadPose[TZ] = acd.controllers[0].pos[2]/50.0f; - - if (s.bEnableX) { - data[TX] = newHeadPose[TX]; - } - if (s.bEnableY) { - data[TY] = newHeadPose[TY]; - } - if (s.bEnableY) { - data[TZ] = newHeadPose[TZ]; - } - if (s.bEnableYaw) { - data[Yaw] = newHeadPose[Yaw] * 57.295781f; - } - if (s.bEnablePitch) { - data[Pitch] = newHeadPose[Pitch] * 57.295781f; - } - if (s.bEnableRoll) { - data[Roll] = newHeadPose[Roll] * 57.295781f; - } + data[TX] = acd.controllers[0].pos[0]/50.0; + data[TY] = acd.controllers[0].pos[1]/50.0; + data[TZ] = acd.controllers[0].pos[2]/50.0; + constexpr double r2d = 57.295781; + data[Yaw] = ypr[0] * r2d; + data[Pitch] = ypr[1] * r2d; + data[Roll] = ypr[2] * r2d; } extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h index fdfc2643..2b3c84a7 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h @@ -6,15 +6,8 @@ using namespace options; struct settings { pbundle b; - value<bool> bEnableRoll, bEnablePitch, bEnableYaw, bEnableX, bEnableY, bEnableZ; settings() : - b(bundle("tracker-hydra")), - bEnableRoll(b, "enable-rz", true), - bEnablePitch(b, "enable-ry", true), - bEnableYaw(b, "enable-rx", true), - bEnableX(b, "enable-tx", true), - bEnableY(b, "enable-ty", true), - bEnableZ(b, "enable-tz", true) + b(bundle("tracker-hydra")) {} }; @@ -25,15 +18,11 @@ public: ~Hydra_Tracker(); void StartTracker(QFrame *) override; void GetHeadPoseData(double *data) override; + virtual int preferredHz() override { return 250; } volatile bool should_quit; -protected: - void run(); // qthread override run method private: settings s; - bool isCalibrated; - double newHeadPose[6]; // Structure with new headpose QMutex mutex; - virtual int preferredHz() override { return 250; } }; class TrackerControls: public QWidget, public ITrackerDialog diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp index 6c98a0a1..3df77d15 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp @@ -9,13 +9,6 @@ QWidget() // Connect Qt signals to member-functions connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - - tie_setting(s.bEnableYaw, ui.chkEnableYaw); - tie_setting(s.bEnablePitch, ui.chkEnablePitch); - tie_setting(s.bEnableRoll, ui.chkEnableRoll); - tie_setting(s.bEnableX, ui.chkEnableX); - tie_setting(s.bEnableY, ui.chkEnableY); - tie_setting(s.bEnableZ, ui.chkEnableZ); } void TrackerControls::doOK() { diff --git a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui index 0bbec7e1..44dfc060 100644 --- a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui +++ b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui @@ -129,245 +129,6 @@ </layout> </widget> </item> - <item> - <widget class="QGroupBox" name="groupBox_3"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>85</height> - </size> - </property> - <property name="title"> - <string>Enable Axis</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <item> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>Roll:</string> - </property> - <property name="buddy"> - <cstring>chkEnableRoll</cstring> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_9"> - <property name="text"> - <string>Pitch:</string> - </property> - <property name="buddy"> - <cstring>chkEnablePitch</cstring> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_11"> - <property name="text"> - <string>Yaw:</string> - </property> - <property name="buddy"> - <cstring>chkEnableYaw</cstring> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QCheckBox" name="chkEnableRoll"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="chkEnablePitch"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QCheckBox" name="chkEnableYaw"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLabel" name="label_14"> - <property name="text"> - <string>X:</string> - </property> - <property name="buddy"> - <cstring>chkEnableX</cstring> - </property> - </widget> - </item> - <item row="0" column="4"> - <widget class="QCheckBox" name="chkEnableX"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLabel" name="label_15"> - <property name="text"> - <string>Y:</string> - </property> - <property name="buddy"> - <cstring>chkEnableY</cstring> - </property> - </widget> - </item> - <item row="1" column="4"> - <widget class="QCheckBox" name="chkEnableY"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLabel" name="label_16"> - <property name="text"> - <string>Z:</string> - </property> - <property name="buddy"> - <cstring>chkEnableZ</cstring> - </property> - </widget> - </item> - <item row="2" column="4"> - <widget class="QCheckBox" name="chkEnableZ"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="2"> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Minimum</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="2"> - <spacer name="horizontalSpacer_5"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Minimum</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="2" column="2"> - <spacer name="horizontalSpacer_8"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Minimum</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_4"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </item> <item> <spacer name="verticalSpacer"> <property name="orientation"> @@ -1723,12 +1484,6 @@ <tabstops> <tabstop>tabWidget</tabstop> <tabstop>reset_spin</tabstop> - <tabstop>chkEnableRoll</tabstop> - <tabstop>chkEnablePitch</tabstop> - <tabstop>chkEnableYaw</tabstop> - <tabstop>chkEnableX</tabstop> - <tabstop>chkEnableY</tabstop> - <tabstop>chkEnableZ</tabstop> <tabstop>camdevice_combo</tabstop> <tabstop>res_x_spin</tabstop> <tabstop>res_y_spin</tabstop> diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp index 00d10d13..4ba981a5 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp @@ -57,13 +57,6 @@ TrackerDialog::TrackerDialog() tie_setting(s.threshold_secondary, ui.threshold_secondary_slider); tie_setting(s.threshold, ui.threshold_slider); - tie_setting(s.bEnableYaw, ui.chkEnableYaw); - tie_setting(s.bEnablePitch, ui.chkEnablePitch); - tie_setting(s.bEnableRoll, ui.chkEnableRoll); - tie_setting(s.bEnableX, ui.chkEnableX); - tie_setting(s.bEnableY, ui.chkEnableY); - tie_setting(s.bEnableZ, ui.chkEnableZ); - tie_setting(s.min_point_size, ui.mindiam_spin); tie_setting(s.max_point_size, ui.maxdiam_spin); diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h index 109090b3..1eca1e35 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h @@ -38,9 +38,6 @@ struct settings value<int> reset_time; - value<bool> bEnableYaw, bEnablePitch, bEnableRoll; - value<bool> bEnableX, bEnableY, bEnableZ; - value<int> clip_ty, clip_tz, clip_by, clip_bz; value<int> active_model_panel, cap_x, cap_y, cap_z; @@ -70,12 +67,6 @@ struct settings t_MH_y(b, "model-centroid-y", 0), t_MH_z(b, "model-centroid-z", 0), reset_time(b, "reset-time", 2000), - bEnableYaw(b, "enable-yaw", true), - bEnablePitch(b, "enable-pitch", true), - bEnableRoll(b, "enable-roll", true), - bEnableX(b, "enable-x", true), - bEnableY(b, "enable-y", true), - bEnableZ(b, "enable-z", true), clip_ty(b, "clip-ty", 0), clip_tz(b, "clip-tz", 0), clip_by(b, "clip-by", 0), diff --git a/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui b/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui index 62edbec5..20c8f00b 100644 --- a/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui +++ b/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>532</width> - <height>481</height> + <width>218</width> + <height>200</height> </rect> </property> <property name="sizePolicy"> @@ -33,7 +33,7 @@ <bool>false</bool> </property> <layout class="QGridLayout" name="gridLayout_2"> - <item row="2" column="0"> + <item row="0" column="0"> <widget class="QGroupBox" name="groupBox"> <property name="title"> <string>Yaw spring</string> @@ -151,7 +151,7 @@ </layout> </widget> </item> - <item row="3" column="0"> + <item row="1" column="0"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> @@ -164,198 +164,6 @@ </property> </widget> </item> - <item row="0" column="0"> - <widget class="QGroupBox" name="groupBox_3"> - <property name="title"> - <string>Axes</string> - </property> - <property name="flat"> - <bool>false</bool> - </property> - <layout class="QFormLayout" name="formLayout_2"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::ExpandingFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="label_6"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Pitch:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QCheckBox" name="chkEnablePitch"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_9"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Yaw:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="chkEnableYaw"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_11"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Roll:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QCheckBox" name="chkEnableRoll"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_7"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>X</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QCheckBox" name="chkEnableX"> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_8"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Y</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QCheckBox" name="chkEnableY"> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="label_10"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Z</string> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QCheckBox" name="chkEnableZ"> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> - </widget> - </item> </layout> </widget> <resources/> diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index 33d8f418..46e8c29f 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -55,18 +55,13 @@ void Rift_Tracker::GetHeadPoseData(double *data) yaw += s.constant_drift; old_yaw=yaw; } - if (s.bEnableYaw) - data[Yaw] = yaw * 57.295781; - if (s.bEnablePitch) - data[Pitch] = pitch * -57.295781; - if (s.bEnableRoll) - data[Roll] = roll * 57.295781; - if (s.bEnableX) - data[TX] = pose.Position.x * -1e2; - if (s.bEnableY) - data[TY] = pose.Position.y * 1e2; - if (s.bEnableX) - data[TZ] = pose.Position.z * 1e2; + constexpr double d2r = 57.295781; + data[Yaw] = yaw * d2r; + data[Pitch] = pitch * -d2r; + data[Roll] = roll * d2r; + data[TX] = pose.Position.x * -1e2; + data[TY] = pose.Position.y * 1e2; + data[TZ] = pose.Position.z * 1e2; } } } diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index ee51b2cb..de224ca5 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -12,16 +12,10 @@ using namespace options; struct settings { pbundle b; - value<bool> bEnableYaw, bEnablePitch, bEnableRoll, bEnableX, bEnableY, bEnableZ, useYawSpring; + value<bool> useYawSpring; value<double> constant_drift, persistence, deadzone; settings() : b(bundle("Rift")), - bEnableYaw(b, "EnableYaw", true), - bEnablePitch(b, "EnablePitch", true), - bEnableRoll(b, "EnableRoll", true), - bEnableX(b, "EnableX", true), - bEnableY(b, "EnableY", true), - bEnableZ(b, "EnableZ", true), useYawSpring(b, "yaw-spring", false), constant_drift(b, "constant-drift", 0.000005), persistence(b, "persistence", 0.99999), diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp index cc8079bf..390eac0e 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp @@ -9,14 +9,6 @@ QWidget() connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - tie_setting(s.bEnableYaw, ui.chkEnableYaw); - tie_setting(s.bEnablePitch, ui.chkEnablePitch); - tie_setting(s.bEnableRoll, ui.chkEnableRoll); - - tie_setting(s.bEnableX, ui.chkEnableX); - tie_setting(s.bEnableY, ui.chkEnableY); - tie_setting(s.bEnableZ, ui.chkEnableZ); - tie_setting(s.constant_drift, ui.constantDrift); tie_setting(s.deadzone, ui.deadzone); tie_setting(s.persistence, ui.persistence); diff --git a/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui b/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui index 6f81a50b..f485e67f 100644 --- a/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui +++ b/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>411</width> - <height>232</height> + <width>216</width> + <height>71</height> </rect> </property> <property name="windowTitle"> @@ -26,353 +26,35 @@ <property name="autoFillBackground"> <bool>false</bool> </property> - <layout class="QVBoxLayout" name="_vertical_layout"> - <item> - <layout class="QGridLayout" name="gridLayout"> - <item row="1" column="0"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Port-number</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="spinPortNumber"> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - </item> - <item row="1" column="2"> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <widget class="QGroupBox" name="groupBox_3"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>85</height> - </size> - </property> - <property name="title"> - <string>Enable Axis</string> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Port</string> </property> - <widget class="QWidget" name="layoutWidget"> - <property name="geometry"> - <rect> - <x>10</x> - <y>20</y> - <width>150</width> - <height>73</height> - </rect> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>Roll:</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_9"> - <property name="text"> - <string>Pitch:</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_11"> - <property name="text"> - <string>Yaw:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QCheckBox" name="chkEnableRoll"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="chkEnablePitch"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QCheckBox" name="chkEnableYaw"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLabel" name="label_14"> - <property name="text"> - <string>X:</string> - </property> - </widget> - </item> - <item row="0" column="4"> - <widget class="QCheckBox" name="chkEnableX"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLabel" name="label_15"> - <property name="text"> - <string>Y:</string> - </property> - </widget> - </item> - <item row="1" column="4"> - <widget class="QCheckBox" name="chkEnableY"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLabel" name="label_16"> - <property name="text"> - <string>Z:</string> - </property> - </widget> - </item> - <item row="2" column="4"> - <widget class="QCheckBox" name="chkEnableZ"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="2"> - <spacer name="horizontalSpacer_4"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Minimum</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> </widget> </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> + <item row="0" column="1"> + <widget class="QSpinBox" name="spinPortNumber"> + <property name="minimum"> + <number>0</number> </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> + <property name="maximum"> + <number>65535</number> </property> - </spacer> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Enter the port-number for the remote PC.</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Remember: you may have to change firewall-settings too!</string> - </property> - </widget> - </item> - </layout> + </widget> </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="sizeConstraint"> - <enum>QLayout::SetDefaultConstraint</enum> - </property> - <item> - <widget class="QPushButton" name="btnOK"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>OK</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnCancel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Cancel</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> + <item row="1" column="1"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> </item> </layout> </widget> <tabstops> <tabstop>spinPortNumber</tabstop> - <tabstop>btnOK</tabstop> - <tabstop>btnCancel</tabstop> </tabstops> <resources/> <connections/> diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp index 1b6d9ddd..335616d5 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp @@ -62,18 +62,8 @@ void FTNoIR_Tracker::StartTracker(QFrame*) void FTNoIR_Tracker::GetHeadPoseData(double *data) { QMutexLocker foo(&mutex); - if (s.enable_x) - data[TX] = newHeadPose[TX]; - if (s.enable_y) - data[TY] = newHeadPose[TY]; - if (s.enable_z) - data[TZ] = newHeadPose[TZ]; - if (s.enable_yaw) - data[Yaw] = newHeadPose[Yaw]; - if (s.enable_pitch) - data[Pitch] = newHeadPose[Pitch]; - if (s.enable_roll) - data[Roll] = newHeadPose[Roll]; + for (int i = 0; i < 6; i++) + data[i] = last_recv_pose[i]; } extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.h b/ftnoir_tracker_udp/ftnoir_tracker_udp.h index 22c9c465..92d321b2 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.h +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.h @@ -10,17 +10,9 @@ using namespace options; struct settings { pbundle b; value<int> port; - value<bool> enable_roll, enable_pitch, enable_yaw, - enable_x, enable_y, enable_z; settings() : b(bundle("udp-tracker")), - port(b, "port", 4242), - enable_roll(b, "enable-roll", true), - enable_pitch(b, "enable-pitch", true), - enable_yaw(b, "enable-yaw", true), - enable_x(b, "enable-x", true), - enable_y(b, "enable-y", true), - enable_z(b, "enable-y", true) + port(b, "port", 4242) {} }; diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp index 17b174e8..16a59292 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp @@ -30,15 +30,9 @@ QWidget() { ui.setupUi( this ); - connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK())); - connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); + connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - tie_setting(s.enable_x, ui.chkEnableX); - tie_setting(s.enable_y, ui.chkEnableY); - tie_setting(s.enable_z, ui.chkEnableZ); - tie_setting(s.enable_yaw, ui.chkEnableYaw); - tie_setting(s.enable_pitch, ui.chkEnablePitch); - tie_setting(s.enable_roll, ui.chkEnableRoll); tie_setting(s.port, ui.spinPortNumber); } -- cgit v1.2.3 From 32f89f4f96f92e58e73e48fb09491bdcaba1174f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 11:43:13 +0200 Subject: win32: all plugins in Windows binary distro updated to new api --- ftnoir_filter_accela/ftnoir_filter_accela.cpp | 2 +- ftnoir_filter_accela/ftnoir_filter_accela.h | 3 +-- ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp | 2 +- ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp | 2 +- ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp | 2 +- ftnoir_filter_ewma2/ftnoir_filter_ewma2.h | 3 +-- ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp | 2 +- ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp | 2 +- ftnoir_filter_kalman/ftnoir_filter_kalman.h | 9 ++++----- ftnoir_filter_kalman/kalman.cpp | 6 +++--- ftnoir_protocol_fg/ftnoir_protocol_fg.cpp | 5 ++--- ftnoir_protocol_fg/ftnoir_protocol_fg.h | 3 +-- ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp | 2 +- ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp | 2 +- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp | 2 +- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h | 3 +-- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp | 2 +- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp | 2 +- ftnoir_protocol_ft/ftnoir_protocol_ft.cpp | 2 +- ftnoir_protocol_ft/ftnoir_protocol_ft.h | 3 +-- ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp | 2 +- ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp | 2 +- ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp | 2 +- ftnoir_protocol_ftn/ftnoir_protocol_ftn.h | 4 +--- ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp | 2 +- ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp | 2 +- ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp | 5 ++--- ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h | 3 +-- .../ftnoir_protocol_libevdev_dialog.cpp | 2 +- .../ftnoir_protocol_libevdev_dll.cpp | 2 +- ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp | 2 +- ftnoir_protocol_mouse/ftnoir_protocol_mouse.h | 3 +-- ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp | 2 +- ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp | 2 +- ftnoir_protocol_sc/ftnoir_protocol_sc.cpp | 2 +- ftnoir_protocol_sc/ftnoir_protocol_sc.h | 5 ++--- ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp | 2 +- ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp | 2 +- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp | 5 ++--- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h | 3 +-- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp | 2 +- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp | 2 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 9 ++++----- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 2 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h | 3 +-- .../ftnoir_tracker_freepie-udp.cpp | 2 +- ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h | 3 +-- .../ftnoir_tracker_freepie-udp_dialog.cpp | 2 +- .../ftnoir_tracker_freepie-udp_dll.cpp | 2 +- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 13 ++++--------- ftnoir_tracker_ht/ftnoir_tracker_ht.h | 2 +- ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h | 3 +-- ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp | 3 ++- ftnoir_tracker_hydra/ftnoir_tracker_hydra.h | 3 +-- ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp | 2 +- ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp | 2 +- ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 2 +- ftnoir_tracker_joystick/ftnoir_tracker_joystick.h | 3 +-- .../ftnoir_tracker_joystick_dialog.cpp | 2 +- ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp | 2 +- ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 16 ++++++++-------- ftnoir_tracker_pt/ftnoir_tracker_pt.h | 3 +-- ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp | 4 ++-- ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h | 2 +- ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp | 4 ++-- ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h | 3 +-- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 3 ++- ftnoir_tracker_rift/ftnoir_tracker_rift.h | 3 +-- ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp | 2 +- ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp | 2 +- ftnoir_tracker_udp/ftnoir_tracker_udp.cpp | 2 +- ftnoir_tracker_udp/ftnoir_tracker_udp.h | 4 ++-- ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp | 2 +- ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp | 2 +- 74 files changed, 101 insertions(+), 128 deletions(-) diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index 08e64667..b7aee77c 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -61,7 +61,7 @@ void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position, } } -extern "C" FTNOIR_FILTER_BASE_EXPORT IFilter* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IFilter* CALLING_CONVENTION GetConstructor() { return new FTNoIR_Filter; } diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index 4a9136b5..c9a434e7 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -1,7 +1,6 @@ #pragma once -#include "ftnoir_filter_base/ftnoir_filter_base.h" #include "ui_ftnoir_accela_filtercontrols.h" -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" #include <QMutex> #define ACCELA_SMOOTHING_ROTATION 60.0 diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp index 41b6022b..7afcd014 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp @@ -52,7 +52,7 @@ void FilterControls::save() { accela_filter->receiveSettings(); } -extern "C" FTNOIR_FILTER_BASE_EXPORT IFilterDialog* CALLING_CONVENTION GetDialog() +extern "C" OPENTRACK_EXPORT IFilterDialog* CALLING_CONVENTION GetDialog() { return new FilterControls; } diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp index d42baef7..e908b873 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp @@ -1,7 +1,7 @@ #include "ftnoir_filter_accela.h" #include "facetracknoir/plugin-support.h" -extern "C" FTNOIR_FILTER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_FilterDll; } diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp index d1f06a64..810cfef9 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp @@ -91,7 +91,7 @@ void FTNoIR_Filter::FilterHeadPoseData(const double *target_camera_position, } } -extern "C" FTNOIR_FILTER_BASE_EXPORT IFilter* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IFilter* CALLING_CONVENTION GetConstructor() { return new FTNoIR_Filter; } diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h index 35a316e6..8863348c 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h @@ -1,7 +1,6 @@ #pragma once -#include "ftnoir_filter_base/ftnoir_filter_base.h" -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" #include "ui_ftnoir_ewma_filtercontrols.h" #include <QWidget> #include <QMutex> diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp index 437928a3..9e89bdb7 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp @@ -43,7 +43,7 @@ void FilterControls::save() { pFilter->receiveSettings(); } -extern "C" FTNOIR_FILTER_BASE_EXPORT IFilterDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT IFilterDialog* CALLING_CONVENTION GetDialog( ) { return new FilterControls; } diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp index 5c381e31..9a5a9148 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp @@ -1,7 +1,7 @@ #include "ftnoir_filter_ewma2.h" #include "facetracknoir/plugin-support.h" -extern "C" FTNOIR_FILTER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_FilterDll; } diff --git a/ftnoir_filter_kalman/ftnoir_filter_kalman.h b/ftnoir_filter_kalman/ftnoir_filter_kalman.h index 9964d6f2..2ff172d5 100755 --- a/ftnoir_filter_kalman/ftnoir_filter_kalman.h +++ b/ftnoir_filter_kalman/ftnoir_filter_kalman.h @@ -8,9 +8,8 @@ #ifndef INCLUDED_FTN_FILTER_H #define INCLUDED_FTN_FILTER_H -#include "ftnoir_filter_base/ftnoir_filter_base.h" #include "ui_ftnoir_kalman_filtercontrols.h" -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" #include <opencv2/opencv.hpp> #include <vector> #include <QString> @@ -21,7 +20,7 @@ #include "facetracknoir/options.h" using namespace options; -class FTNOIR_FILTER_BASE_EXPORT FTNoIR_Filter : public IFilter +class OPENTRACK_EXPORT FTNoIR_Filter : public IFilter { public: FTNoIR_Filter(); @@ -36,7 +35,7 @@ public: qint64 timedelta; }; -class FTNOIR_FILTER_BASE_EXPORT FTNoIR_FilterDll : public Metadata +class OPENTRACK_EXPORT FTNoIR_FilterDll : public Metadata { public: void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("Kalman filter"); } @@ -45,7 +44,7 @@ public: void getIcon(QIcon *icon){ *icon = QIcon(":/images/filter-16.png"); } }; -class FTNOIR_FILTER_BASE_EXPORT FilterControls: public QWidget, public IFilterDialog +class OPENTRACK_EXPORT FilterControls: public QWidget, public IFilterDialog { Q_OBJECT public: diff --git a/ftnoir_filter_kalman/kalman.cpp b/ftnoir_filter_kalman/kalman.cpp index 1f2ebb3b..cb622d79 100644 --- a/ftnoir_filter_kalman/kalman.cpp +++ b/ftnoir_filter_kalman/kalman.cpp @@ -121,16 +121,16 @@ void FilterControls::doCancel() { close(); } -extern "C" FTNOIR_FILTER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_FilterDll; } -extern "C" FTNOIR_FILTER_BASE_EXPORT IFilter* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IFilter* CALLING_CONVENTION GetConstructor() { return new FTNoIR_Filter; } -extern "C" FTNOIR_FILTER_BASE_EXPORT IFilterDialog* CALLING_CONVENTION GetDialog() { +extern "C" OPENTRACK_EXPORT IFilterDialog* CALLING_CONVENTION GetDialog() { return new FilterControls; } diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp index 15a79131..45293796 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp @@ -26,8 +26,7 @@ * It is based on the (Linux) example made by Melchior FRANZ. * ********************************************************************************/ #include "ftnoir_protocol_fg.h" -#include "facetracknoir/plugin-support.h" -#include <ftnoir_tracker_base/ftnoir_tracker_types.h> +#include "facetracknoir/plugin-api.hpp" // For Todd and Arda Kutlu @@ -58,7 +57,7 @@ bool FTNoIR_Protocol::checkServerInstallationOK() return outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() { return new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.h b/ftnoir_protocol_fg/ftnoir_protocol_fg.h index f24331d9..4b25a3e1 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg.h +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.h @@ -26,13 +26,12 @@ * It is based on the (Linux) example made by Melchior FRANZ. * ********************************************************************************/ #pragma once -#include "ftnoir_protocol_base/ftnoir_protocol_base.h" #include "ui_ftnoir_fgcontrols.h" #include "fgtypes.h" #include <QThread> #include <QUdpSocket> #include <QMessageBox> -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" #include "facetracknoir/options.h" using namespace options; diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp index d9c596b7..eb8b9a81 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp @@ -63,7 +63,7 @@ void FGControls::doCancel() { this->close(); } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) { return new FGControls; } diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp index b7e286fd..a1f065c7 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp @@ -26,7 +26,7 @@ #include <QDebug> #include "facetracknoir/plugin-support.h" -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp index 572843c5..f5e6d5ea 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp @@ -158,7 +158,7 @@ bool FTNoIR_Protocol::checkServerInstallationOK() return true; } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT FTNoIR_Protocol* CALLING_CONVENTION GetConstructor(void) +extern "C" OPENTRACK_EXPORT FTNoIR_Protocol* CALLING_CONVENTION GetConstructor(void) { return new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h index 6e0db58c..fd63ed6b 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h @@ -31,8 +31,7 @@ #include <windows.h> #include <stdlib.h> #include "FSUIPC_User.h" -#include "facetracknoir/plugin-support.h" -#include "ftnoir_protocol_base/ftnoir_protocol_base.h" +#include "facetracknoir/plugin-api.hpp" #include "ui_ftnoir_fsuipccontrols.h" #include <QMessageBox> #include <QSettings> diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp index 89823499..e8c04dfe 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp @@ -56,7 +56,7 @@ void FSUIPCControls::getLocationOfDLL() } } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog(void) +extern "C" OPENTRACK_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog(void) { return new FSUIPCControls; } diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp index 6cffc4f3..b2cd6e02 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp @@ -25,7 +25,7 @@ #include "ftnoir_protocol_fsuipc.h" #include "facetracknoir/plugin-support.h" -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata(void) +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata(void) { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp index 39ac649d..d0cbfa97 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp @@ -171,7 +171,7 @@ bool FTNoIR_Protocol::checkServerInstallationOK() return true; } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() { return new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h index b1d71f08..d7a792b7 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h @@ -25,9 +25,8 @@ * to games, using the FreeTrackClient.dll. * ********************************************************************************/ #pragma once -#include "ftnoir_protocol_base/ftnoir_protocol_base.h" #include "ui_ftnoir_ftcontrols.h" -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" #include "fttypes.h" #include <QMessageBox> #include <QSettings> diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp index 98d61675..626d5358 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp @@ -73,7 +73,7 @@ void FTControls::selectDLL() { } } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog() +extern "C" OPENTRACK_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog() { return new FTControls; } diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp index d5a51457..d6f05bad 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp @@ -1,7 +1,7 @@ #include "facetracknoir/plugin-support.h" #include "ftnoir_protocol_ft/ftnoir_protocol_ft.h" -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp index af6f63f3..4ee7362b 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp @@ -48,7 +48,7 @@ bool FTNoIR_Protocol::checkServerInstallationOK() return outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() { return new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h index 498df50c..c14a7dba 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h @@ -27,14 +27,12 @@ ********************************************************************************/ #pragma once -#include "ftnoir_protocol_base/ftnoir_protocol_base.h" -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "ui_ftnoir_ftncontrols.h" #include <QThread> #include <QUdpSocket> #include <QMessageBox> #include <cmath> -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" #include "facetracknoir/options.h" using namespace options; diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp index 6afe20f2..b4a92b39 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp @@ -56,7 +56,7 @@ void FTNControls::doCancel() { this->close(); } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) { return new FTNControls; } diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp index fdc2f4ca..da89a9ca 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp @@ -25,7 +25,7 @@ #include "ftnoir_protocol_ftn.h" #include "facetracknoir/plugin-support.h" -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp index d2a8e5bf..ca395b34 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp @@ -1,6 +1,5 @@ #include "ftnoir_protocol_libevdev.h" -#include "facetracknoir/plugin-support.h" -//#include "ftnoir_tracker_base/ftnoir_tracker_types.h" +#include "facetracknoir/plugin-api.hpp" #include <cstdio> #include <algorithm> @@ -95,7 +94,7 @@ void FTNoIR_Protocol::sendHeadposeToGame(const double* headpose) { (void) libevdev_uinput_write_event(uidev, EV_SYN, SYN_REPORT, 0); } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() { return new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h index cb40959d..da753238 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h @@ -5,11 +5,10 @@ * copyright notice and this permission notice appear in all copies. */ #pragma once -#include "ftnoir_protocol_base/ftnoir_protocol_base.h" #include "ui_ftnoir_libevdev_controls.h" #include <QMessageBox> -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" extern "C" { # include <libevdev/libevdev.h> diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp index b63cc0c7..152095d4 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp @@ -20,7 +20,7 @@ void LibevdevControls::doCancel() { void LibevdevControls::save() { } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) { return new LibevdevControls; } diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp index 639b93d7..01f7ff5f 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp @@ -10,7 +10,7 @@ FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll() } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp index cd50dbe5..f78eb16d 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp @@ -63,7 +63,7 @@ bool FTNoIR_Protocol::checkServerInstallationOK() return true; } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() { return new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h index e096bf50..8f1f3ff1 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h @@ -30,7 +30,6 @@ #ifndef INCLUDED_MOUSESERVER_H #define INCLUDED_MOUSESERVER_H -#include "ftnoir_protocol_base/ftnoir_protocol_base.h" #include "ui_ftnoir_mousecontrols.h" #include <QMessageBox> #include <QSettings> @@ -40,7 +39,7 @@ #include <QFile> #include <windows.h> #include <winuser.h> -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" #include "facetracknoir/options.h" using namespace options; diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp index 63524de9..50ea8f2e 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp @@ -63,7 +63,7 @@ void MOUSEControls::doCancel() { this->close(); } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) { return new MOUSEControls; } diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp index 0f63b290..50f889db 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp @@ -25,7 +25,7 @@ #include "ftnoir_protocol_mouse.h" #include "facetracknoir/plugin-support.h" -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp index b3f4b490..0901546a 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp @@ -246,7 +246,7 @@ void CALLBACK FTNoIR_Protocol::processNextSimconnectEvent(SIMCONNECT_RECV* pData } } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() { return new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.h b/ftnoir_protocol_sc/ftnoir_protocol_sc.h index c60f6d85..5a90224f 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.h +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.h @@ -29,7 +29,7 @@ #pragma once #undef _WIN32_WINNT #define _WIN32_WINNT 0x0502 -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" // // Prevent the SimConnect manifest from being merged in the application-manifest // This is necessary to run FaceTrackNoIR on a PC without FSX @@ -38,8 +38,7 @@ #include <windows.h> #include <SimConnect.h> -#include <ftnoir_protocol_base/ftnoir_protocol_base.h> -#include <ui_ftnoir_sccontrols.h> +#include "ui_ftnoir_sccontrols.h" #include <QMessageBox> #include <QSettings> #include <QLibrary> diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp index ea55cc1b..8845bec6 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp @@ -48,7 +48,7 @@ void SCControls::doCancel() { close(); } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) { return new SCControls; } diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp index e4741d42..6effb6d5 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp @@ -26,7 +26,7 @@ #include <QDebug> #include "facetracknoir/plugin-support.h" -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp index ee7d2e85..803bc25a 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp @@ -1,6 +1,5 @@ #include "ftnoir_protocol_vjoy.h" -#include "facetracknoir/plugin-support.h" -#include <ftnoir_tracker_base/ftnoir_tracker_types.h> +#include "facetracknoir/plugin-api.hpp" FTNoIR_Protocol::FTNoIR_Protocol() { @@ -28,7 +27,7 @@ void FTNoIR_Protocol::sendHeadposeToGame( const double *headpose ) { VJoy_UpdateJoyState(0, state); } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() { return new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h index b63a5492..6f30705f 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h @@ -26,10 +26,9 @@ * It is based on the (Linux) example made by Melchior FRANZ. * ********************************************************************************/ #pragma once -#include "ftnoir_protocol_base/ftnoir_protocol_base.h" #include "ui_ftnoir_vjoy_controls.h" #include <cmath> -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" #define FT_PROGRAMID "FT_ProgramID" diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp index 66aa559e..440b12dc 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp @@ -20,7 +20,7 @@ void VJoyControls::doCancel() { void VJoyControls::save() { } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) { return new VJoyControls; } diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp index 180cd683..812a2af9 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp @@ -10,7 +10,7 @@ FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll() } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index f469c7a4..b27b96b8 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -5,10 +5,9 @@ * copyright notice and this permission notice appear in all copies. */ -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "ftnoir_tracker_aruco.h" #include "ui_aruco-trackercontrols.h" -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" #include <cmath> #include <QMutexLocker> #include <aruco.h> @@ -422,19 +421,19 @@ void TrackerDll::getIcon(QIcon *icon) //----------------------------------------------------------------------------- //#pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0") -extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new TrackerDll; } //#pragma comment(linker, "/export:GetTracker=_GetTracker@0") -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() { return new Tracker; } -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) { return new TrackerControls; } diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index c431d27a..b953d2b4 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -8,7 +8,6 @@ #ifndef FTNOIR_TRACKER_HT_H #define FTNOIR_TRACKER_HT_H -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "ui_aruco-trackercontrols.h" #include "ar_video_widget.h" #include <QObject> @@ -21,6 +20,7 @@ #include <opencv/highgui.h> #include "facetracknoir/options.h" #include "ftnoir_tracker_aruco/trans_calib.h" +#include "facetracknoir/plugin-api.hpp" using namespace options; struct settings { diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h index af2ec00c..66e57100 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h @@ -5,8 +5,7 @@ * copyright notice and this permission notice appear in all copies. */ -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" //----------------------------------------------------------------------------- class TrackerDll : public Metadata diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp index 718ec510..143d0c06 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp @@ -97,7 +97,7 @@ void TrackerImpl::GetHeadPoseData(double *data) data[Roll] = pose[Roll]; } -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() { return new TrackerImpl; } diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h index b3f028fc..4999053d 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h @@ -5,11 +5,10 @@ * copyright notice and this permission notice appear in all copies. */ -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "ui_freepie-udp-controls.h" #include <QUdpSocket> #include <QThread> -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" #include "facetracknoir/options.h" using namespace options; diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp index 1489e336..ee6c4284 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp @@ -21,7 +21,7 @@ void TrackerDialog::doCancel() { this->close(); } -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog() +extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog() { return new TrackerDialog; } diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp index cfaa9f47..7578150f 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp @@ -21,7 +21,7 @@ void TrackerMeta::getIcon(QIcon *icon) *icon = QIcon(":/glovepie.png"); } -extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new TrackerMeta; } diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 7d6fc24e..14d5faa1 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -1,10 +1,9 @@ #include "stdafx.h" -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "headtracker-ftnoir.h" #include "ftnoir_tracker_ht.h" #include "ftnoir_tracker_ht_dll.h" #include "ui_ht-trackercontrols.h" -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" #include <cmath> #if defined(_WIN32) @@ -197,10 +196,6 @@ void Tracker::GetHeadPoseData(double *data) shm->frame.width = 0; } if (shm->result.filled) { - if (fabs(data[Yaw]) > 60 || fabs(data[Pitch]) > 50 || fabs(data[Roll]) > 40) - { - shm->pause = true; - } data[Yaw] = shm->result.rotx; data[Pitch] = shm->result.roty; data[Roll] = shm->result.rotz; @@ -234,17 +229,17 @@ void TrackerDll::getIcon(QIcon *icon) *icon = QIcon(":/images/ht.png"); } -extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new TrackerDll; } -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() { return new Tracker; } -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) { return new TrackerControls; } diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h index 418137bc..b9f002a4 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h @@ -9,13 +9,13 @@ #define FTNOIR_TRACKER_HT_H #include "stdafx.h" -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "headtracker-ftnoir.h" #include "ui_ht-trackercontrols.h" #include "ht_video_widget.h" #include "compat/compat.h" #include <QObject> #include "facetracknoir/options.h" +#include "facetracknoir/plugin-api.hpp" using namespace options; struct settings { diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h b/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h index af2ec00c..66e57100 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h @@ -5,8 +5,7 @@ * copyright notice and this permission notice appear in all copies. */ -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" //----------------------------------------------------------------------------- class TrackerDll : public Metadata diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp index 5770f015..a28bd398 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp @@ -8,6 +8,7 @@ # define SIXENSE_UTILS_STATIC_LIB #endif #include <sixense.h> + Hydra_Tracker::Hydra_Tracker() : should_quit(false) {} #pragma GCC diagnostic ignored "-Wreorder" @@ -44,7 +45,7 @@ void Hydra_Tracker::GetHeadPoseData(double *data) data[Roll] = ypr[2] * r2d; } -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() { return new Hydra_Tracker; } diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h index 2b3c84a7..0049d977 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h @@ -1,6 +1,5 @@ -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "ui_ftnoir_hydra_clientcontrols.h" -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" #include "facetracknoir/options.h" using namespace options; diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp index 3df77d15..80b5fb22 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp @@ -21,7 +21,7 @@ void TrackerControls::doCancel() { close(); } -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) { return new TrackerControls; } diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp index b14b865c..8388ddfe 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp @@ -23,7 +23,7 @@ void FTNoIR_TrackerDll::getIcon(QIcon *icon) *icon = QIcon(":/images/facetracknoir.png"); } -extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_TrackerDll; } diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index 90091e5d..9b98d4be 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -200,7 +200,7 @@ void FTNoIR_Tracker::GetHeadPoseData(double *data) data[i] = values[i] * limits[i] / AXIS_MAX; } -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() { return new FTNoIR_Tracker; } diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h index 75ea9f52..2c2ebb47 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h @@ -5,7 +5,6 @@ * copyright notice and this permission notice appear in all copies. */ #pragma once -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "ui_ftnoir_tracker_joystick_controls.h" #include <QComboBox> #include <QCheckBox> @@ -16,7 +15,7 @@ #include <QMutex> #include <QFrame> #include <cmath> -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" #ifndef DIRECTINPUT_VERSION # define DIRECTINPUT_VERSION 0x800 #endif diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp index eea7f916..67e480a3 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp @@ -53,7 +53,7 @@ void TrackerControls::doCancel() { this->close(); } -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) { return new TrackerControls; } diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp index f5867fea..075ed555 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp @@ -22,7 +22,7 @@ void FTNoIR_TrackerDll::getIcon(QIcon *icon) *icon = QIcon(":/images/facetracknoir.png"); } -extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_TrackerDll; } diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 268abeab..219c8990 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -229,9 +229,9 @@ void Tracker::GetHeadPoseData(THeadPoseData *data) Vec3f t = X_GH.t - X_GH_0.t; // get translation(s) - if (s.bEnableX) data[TX] = t[0] / 10.0; // convert to cm - if (s.bEnableY) data[TY] = t[1] / 10.0; - if (s.bEnableZ) data[TZ] = t[2] / 10.0; + data[TX] = t[0] / 10.0; // convert to cm + data[TY] = t[1] / 10.0; + data[TZ] = t[2] / 10.0; // translate rotation matrix from opengl (G) to roll-pitch-yaw (E) frame // -z -> x, y -> z, x -> -y @@ -246,18 +246,18 @@ void Tracker::GetHeadPoseData(THeadPoseData *data) alpha = atan2( R(1,0), R(0,0)); gamma = atan2( R(2,1), R(2,2)); - if (s.bEnableYaw) data[Yaw] = rad2deg * alpha; - if (s.bEnablePitch) data[Pitch] = - rad2deg * beta; // FTNoIR expects a minus here - if (s.bEnableRoll) data[Roll] = rad2deg * gamma; + data[Yaw] = rad2deg * alpha; + data[Pitch] = - rad2deg * beta; // FTNoIR expects a minus here + data[Roll] = rad2deg * gamma; } } //----------------------------------------------------------------------------- #ifdef OPENTRACK_API -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() #else #pragma comment(linker, "/export:GetTracker=_GetTracker@0") -FTNOIR_TRACKER_BASE_EXPORT ITrackerPtr __stdcall GetTracker() +OPENTRACK_EXPORT ITrackerPtr __stdcall GetTracker() #endif { return new Tracker; diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.h b/ftnoir_tracker_pt/ftnoir_tracker_pt.h index 7e944fc2..63b8353e 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.h @@ -9,8 +9,7 @@ #define FTNOIR_TRACKER_PT_H #ifdef OPENTRACK_API -# include "ftnoir_tracker_base/ftnoir_tracker_base.h" -# include "facetracknoir/plugin-support.h" +# include "facetracknoir/plugin-api.hpp" #endif #include "ftnoir_tracker_pt_settings.h" #include "frame_observer.h" diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp index 4ba981a5..ae84ce8c 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp @@ -13,7 +13,7 @@ #ifndef OPENTRACK_API # include <boost/shared_ptr.hpp> #else -# include <memory> +# include <memory> #endif #include <vector> @@ -308,7 +308,7 @@ void TrackerDialog::unRegisterTracker() ui.reset_button->setEnabled(false); } -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) { return new TrackerDialog; } diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h index 0325160d..5cb09130 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h @@ -9,7 +9,7 @@ #define FTNOIR_TRACKER_PT_DIALOG_H #ifdef OPENTRACK_API -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" +# include "facetracknoir/plugin-api.hpp" #else #include "..\ftnoir_tracker_base\ftnoir_tracker_base.h" #endif diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp index 15e830a4..dd7b08d6 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp @@ -32,10 +32,10 @@ void TrackerDll::getIcon(QIcon *icon) #ifdef OPENTRACK_API # include "facetracknoir/plugin-support.h" -extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() #else # pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0") -FTNOIR_TRACKER_BASE_EXPORT ITrackerDllPtr __stdcall GetTrackerDll() +OPENTRACK_EXPORT ITrackerDllPtr __stdcall GetTrackerDll() #endif { return new TrackerDll; diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h index 22e1ff29..fce7aec2 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h @@ -6,8 +6,7 @@ */ #if defined(OPENTRACK_API) -# include "ftnoir_tracker_base/ftnoir_tracker_base.h" -# include "facetracknoir/plugin-support.h" +# include "facetracknoir/plugin-api.hpp" #else # include "../ftnoir_tracker_base/ftnoir_tracker_base.h" #endif diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index 46e8c29f..1cca6075 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -46,6 +46,7 @@ void Rift_Tracker::GetHeadPoseData(double *data) Quatf quat = pose.Orientation; float yaw, pitch, roll; quat.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &pitch, &roll); + // XXX TODO move to core if (s.useYawSpring) { yaw = old_yaw*s.persistence + (yaw-old_yaw); @@ -66,7 +67,7 @@ void Rift_Tracker::GetHeadPoseData(double *data) } } -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() { return new Rift_Tracker; } diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index de224ca5..4ca99932 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -1,10 +1,9 @@ #pragma once -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "ui_ftnoir_rift_clientcontrols.h" #include <QMessageBox> #include <QWaitCondition> #include <cmath> -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" #include "OVR.h" #include <memory> #include "facetracknoir/options.h" diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp index 390eac0e..c95ce364 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp @@ -25,7 +25,7 @@ void TrackerControls::doCancel() { close(); } -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog() +extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog() { return new TrackerControls; } diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp index 3edee290..22eec9b9 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp @@ -35,7 +35,7 @@ void FTNoIR_TrackerDll::getIcon(QIcon *icon) *icon = QIcon(":/images/rift_tiny.png"); } -extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_TrackerDll; } diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp index 335616d5..12699a58 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp @@ -66,7 +66,7 @@ void FTNoIR_Tracker::GetHeadPoseData(double *data) data[i] = last_recv_pose[i]; } -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() { return new FTNoIR_Tracker; } diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.h b/ftnoir_tracker_udp/ftnoir_tracker_udp.h index 92d321b2..1d5de19b 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.h +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.h @@ -1,9 +1,9 @@ -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" +#pragma once #include "ui_ftnoir_ftnclientcontrols.h" #include <QUdpSocket> #include <QThread> #include <cmath> -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" #include "facetracknoir/options.h" using namespace options; diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp index 16a59292..47166a24 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp @@ -46,7 +46,7 @@ void TrackerControls::doCancel() { this->close(); } -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) { return new TrackerControls; } diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp index 3d6fbc28..d5745849 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp @@ -46,7 +46,7 @@ void FTNoIR_TrackerDll::getIcon(QIcon *icon) *icon = QIcon(":/images/facetracknoir.png"); } -extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_TrackerDll; } -- cgit v1.2.3 From dfee22e635811510c48d2eb87531397f068a72ec Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 11:43:27 +0200 Subject: pt: remove verbose comment --- ftnoir_tracker_pt/camera.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ftnoir_tracker_pt/camera.cpp b/ftnoir_tracker_pt/camera.cpp index 754533c5..33e0ef2a 100644 --- a/ftnoir_tracker_pt/camera.cpp +++ b/ftnoir_tracker_pt/camera.cpp @@ -184,11 +184,6 @@ bool CVCamera::_get_frame(Mat* frame) if (cap && cap->isOpened()) { Mat img; - /* - * XXX some Windows webcams fail to decode first - * frames and then some every once in a while - * -sh - */ for (int i = 0; i < 100 && !cap->read(img); i++) ;; -- cgit v1.2.3 From 979372baf8a990e04d2019002b7db6fdb8874dc1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 11:44:40 +0200 Subject: nix spurious warning --- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp index 803bc25a..2b8aa017 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp @@ -13,8 +13,9 @@ FTNoIR_Protocol::~FTNoIR_Protocol() } void FTNoIR_Protocol::sendHeadposeToGame( const double *headpose ) { +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" JOYSTICK_STATE state[2] = { 0 }; - + state[0].POV = (4 << 12) | (4 << 8) | (4 << 4) | 4; state[0].XAxis = std::min<int>(VJOY_AXIS_MAX, std::max<int>(VJOY_AXIS_MIN, headpose[Yaw] * VJOY_AXIS_MAX / 180.0)); @@ -23,7 +24,7 @@ void FTNoIR_Protocol::sendHeadposeToGame( const double *headpose ) { state[0].XRotation = std::min<int>(VJOY_AXIS_MAX, std::max<int>(VJOY_AXIS_MIN, headpose[TX] * VJOY_AXIS_MAX / 100.0)); state[0].YRotation = std::min<int>(VJOY_AXIS_MAX, std::max<int>(VJOY_AXIS_MIN, headpose[TY] * VJOY_AXIS_MAX / 100.0)); state[0].ZRotation = std::min<int>(VJOY_AXIS_MAX, std::max<int>(VJOY_AXIS_MIN, headpose[TZ] * VJOY_AXIS_MAX / 100.0)); - + VJoy_UpdateJoyState(0, state); } -- cgit v1.2.3 From 52d2fd3bf8e3241c9a671a66daaf3150c6d7ed5b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 11:50:27 +0200 Subject: udp: cleanup, reduce mtx contention --- ftnoir_tracker_udp/ftnoir_tracker_udp.cpp | 26 ++++++++++---------------- ftnoir_tracker_udp/ftnoir_tracker_udp.h | 16 ++++++---------- 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp index 12699a58..854cedbb 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp @@ -25,13 +25,7 @@ #include "ftnoir_tracker_udp.h" #include "facetracknoir/plugin-support.h" -FTNoIR_Tracker::FTNoIR_Tracker() : should_quit(false) -{ - should_quit = false; - - for (int i = 0; i < 6; i++) - newHeadPose[i] = 0; -} +FTNoIR_Tracker::FTNoIR_Tracker() : last_recv_pose { 0,0,0, 0,0,0 }, should_quit(false) {} FTNoIR_Tracker::~FTNoIR_Tracker() { @@ -40,22 +34,22 @@ FTNoIR_Tracker::~FTNoIR_Tracker() } void FTNoIR_Tracker::run() { - forever { + QByteArray datagram; + datagram.resize(sizeof(last_recv_pose)); + for (;;) { if (should_quit) break; - while (inSocket.hasPendingDatagrams()) { - QMutexLocker foo(&mutex); - QByteArray datagram; - datagram.resize(sizeof(newHeadPose)); - inSocket.readDatagram((char * ) newHeadPose, sizeof(double[6])); + QMutexLocker foo(&mutex); + while (sock.hasPendingDatagrams()) { + sock.readDatagram((char * ) last_recv_pose, sizeof(double[6])); } - usleep(10000); - } + msleep(1); + } } void FTNoIR_Tracker::StartTracker(QFrame*) { - (void) inSocket.bind(QHostAddress::Any, (int) s.port, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); + (void) sock.bind(QHostAddress::Any, (int) s.port, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); start(); } diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.h b/ftnoir_tracker_udp/ftnoir_tracker_udp.h index 1d5de19b..a6f2e6d3 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.h +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.h @@ -16,31 +16,28 @@ struct settings { {} }; -class FTNoIR_Tracker : public ITracker, public QThread +class FTNoIR_Tracker : public ITracker, protected QThread { public: FTNoIR_Tracker(); ~FTNoIR_Tracker(); void StartTracker(QFrame *); void GetHeadPoseData(double *data); - volatile bool should_quit; protected: - void run(); // qthread override run method + void run() override; private: - QUdpSocket inSocket; - QHostAddress destIP; - QHostAddress srcIP; - double newHeadPose[6]; + QUdpSocket sock; + double last_recv_pose[6]; QMutex mutex; settings s; + volatile bool should_quit; }; class TrackerControls: public QWidget, public ITrackerDialog { Q_OBJECT public: - - explicit TrackerControls(); + TrackerControls(); void registerTracker(ITracker *) {} void unRegisterTracker() {} private: @@ -59,4 +56,3 @@ public: void getDescription(QString *strToBeFilled); void getIcon(QIcon *icon); }; - -- cgit v1.2.3 From 47c15f594103808bd0d19149edefa937b6a19bc4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 11:51:30 +0200 Subject: nix looooong copyright notices now that they don't apply --- ftnoir_tracker_udp/ftnoir_tracker_udp.cpp | 24 ----------------------- ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp | 24 ----------------------- ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp | 25 ------------------------ 3 files changed, 73 deletions(-) diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp index 854cedbb..6253529d 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp @@ -1,27 +1,3 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ #include "ftnoir_tracker_udp.h" #include "facetracknoir/plugin-support.h" diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp index 47166a24..59683ddc 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp @@ -1,27 +1,3 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ #include "ftnoir_tracker_udp.h" #include "facetracknoir/plugin-support.h" diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp index d5745849..525a618f 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp @@ -1,29 +1,4 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ #include "ftnoir_tracker_udp.h" -#include <QDebug> #include "facetracknoir/plugin-support.h" void FTNoIR_TrackerDll::getFullName(QString *strToBeFilled) -- cgit v1.2.3 From 5c56f7b46175d83f237846b52a99363bce8e2842 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 14:42:36 +0200 Subject: add gitattributes --- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..fcadb2cf --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text eol=lf -- cgit v1.2.3 From a42c19579c5c7a980c2826c7e015821d2e4d4b1d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 15:14:47 +0200 Subject: virtual function misuse (don't create needless VPTR all over) --- ftnoir_filter_kalman/ftnoir_filter_kalman.h | 4 ++-- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h | 2 +- ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h | 2 +- ftnoir_protocol_sc/ftnoir_protocol_sc.h | 2 +- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h | 2 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 2 +- ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h | 4 ++-- ftnoir_tracker_hydra/ftnoir_tracker_hydra.h | 2 +- ftnoir_tracker_rift/ftnoir_tracker_rift.h | 4 ++-- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ftnoir_filter_kalman/ftnoir_filter_kalman.h b/ftnoir_filter_kalman/ftnoir_filter_kalman.h index 2ff172d5..a47ebf4f 100755 --- a/ftnoir_filter_kalman/ftnoir_filter_kalman.h +++ b/ftnoir_filter_kalman/ftnoir_filter_kalman.h @@ -55,8 +55,8 @@ public: show(); } Ui::KalmanUICFilterControls ui; - virtual void registerFilter(IFilter*) override {} - virtual void unregisterFilter() override {} + void registerFilter(IFilter*) override {} + void unregisterFilter() override {} public slots: void doOK(); void doCancel(); diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h index fd63ed6b..bde16d8f 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h @@ -66,7 +66,7 @@ class FTNoIR_Protocol : public IProtocol { public: FTNoIR_Protocol(); - virtual ~FTNoIR_Protocol() override; + ~FTNoIR_Protocol() override; bool checkServerInstallationOK(); void sendHeadposeToGame(const double* headpose); QString getGameName() { diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h index da753238..e613885a 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h @@ -19,7 +19,7 @@ class FTNoIR_Protocol : public IProtocol { public: FTNoIR_Protocol(); - virtual ~FTNoIR_Protocol(); + ~FTNoIR_Protocol() override; bool checkServerInstallationOK() { return dev != NULL; } diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.h b/ftnoir_protocol_sc/ftnoir_protocol_sc.h index 5a90224f..02cb7b0e 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.h +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.h @@ -88,7 +88,7 @@ class FTNoIR_Protocol : public IProtocol { public: FTNoIR_Protocol(); - virtual ~FTNoIR_Protocol(); + ~FTNoIR_Protocol() override; bool checkServerInstallationOK(); void sendHeadposeToGame(const double* headpose); QString getGameName() { diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h index 6f30705f..eac3c610 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h @@ -36,7 +36,7 @@ class FTNoIR_Protocol : public IProtocol { public: FTNoIR_Protocol(); - virtual ~FTNoIR_Protocol(); + ~FTNoIR_Protocol() override; bool checkServerInstallationOK() { return true; } diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index b953d2b4..81332a26 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -48,7 +48,7 @@ class Tracker : protected QThread, public ITracker Q_OBJECT public: Tracker(); - virtual ~Tracker(); + ~Tracker() override; void StartTracker(QFrame* frame); void GetHeadPoseData(double *data); void run(); diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h index 4999053d..23f3ace9 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h @@ -25,11 +25,11 @@ class TrackerImpl : public ITracker, private QThread { public: TrackerImpl(); - virtual ~TrackerImpl() override; + ~TrackerImpl() override; void StartTracker(QFrame *); void GetHeadPoseData(double *data); protected: - virtual void run() override; + void run() override; private: double pose[6]; QUdpSocket sock; diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h index 0049d977..1e4c6683 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h @@ -17,7 +17,7 @@ public: ~Hydra_Tracker(); void StartTracker(QFrame *) override; void GetHeadPoseData(double *data) override; - virtual int preferredHz() override { return 250; } + int preferredHz() override { return 250; } volatile bool should_quit; private: settings s; diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index 4ca99932..eb21f7bc 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -26,11 +26,11 @@ class Rift_Tracker : public ITracker { public: Rift_Tracker(); - virtual ~Rift_Tracker() override; + ~Rift_Tracker() override; void StartTracker(QFrame *) override; void GetHeadPoseData(double *data) override; - virtual int preferredHz() override { return 250; } + int preferredHz() override { return 250; } volatile bool should_quit; protected: void run(); // qthread override run method -- cgit v1.2.3 From 350edf6e5c1f253a300fd0b7db6591082558d937 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 15:19:01 +0200 Subject: needless compat api breakage --- compat/compat.cpp | 9 +++------ compat/compat.h | 4 ++-- freetrackclient/freetrackclient.c | 2 +- ftnoir_protocol_ft/ftnoir_protocol_ft.cpp | 4 ++-- ftnoir_protocol_ft/ftnoir_protocol_ft.h | 2 +- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 2 +- 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/compat/compat.cpp b/compat/compat.cpp index 7b695617..b5d63f2b 100644 --- a/compat/compat.cpp +++ b/compat/compat.cpp @@ -4,12 +4,12 @@ * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. */ + +#include <cstring> #define IN_FTNOIR_COMPAT #include "compat.h" -#include <string.h> #if defined(_WIN32) - PortableLockedShm::PortableLockedShm(const char* shmName, const char* mutexName, int mapSize) { hMutex = CreateMutexA(NULL, false, mutexName); @@ -43,8 +43,8 @@ void PortableLockedShm::unlock() { (void) ReleaseMutex(hMutex); } - #else +#pragma GCC diagnostic ignored "-Wunused-result" PortableLockedShm::PortableLockedShm(const char *shmName, const char* /*mutexName*/, int mapSize) : size(mapSize) { char filename[512] = {0}; @@ -57,8 +57,6 @@ PortableLockedShm::PortableLockedShm(const char *shmName, const char* /*mutexNam PortableLockedShm::~PortableLockedShm() { - //(void) shm_unlink(shm_filename); - (void) munmap(mem, size); (void) close(fd); } @@ -72,7 +70,6 @@ void PortableLockedShm::unlock() { flock(fd, LOCK_UN); } - #endif bool PortableLockedShm::success() diff --git a/compat/compat.h b/compat/compat.h index 0e488752..490d8913 100644 --- a/compat/compat.h +++ b/compat/compat.h @@ -38,12 +38,12 @@ public: void lock(); void unlock(); bool success(); - void* mem; + inline void* ptr() { return mem; } private: + void* mem; #if defined(_WIN32) HANDLE hMutex, hMapFile; #else int fd, size; - //char shm_filename[NAME_MAX]; #endif }; diff --git a/freetrackclient/freetrackclient.c b/freetrackclient/freetrackclient.c index 43694cda..5323bcae 100644 --- a/freetrackclient/freetrackclient.c +++ b/freetrackclient/freetrackclient.c @@ -55,7 +55,7 @@ static bool FTCreateMapping(void) PAGE_READWRITE, 0, sizeof(FTHeap), - (LPCSTR) FT_MM_DATA); + (LPCSTR) FREETRACK_HEAP); if (hFTMemMap == NULL) return (pMemData = NULL), false; diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp index d0cbfa97..8b8be63d 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp @@ -28,9 +28,9 @@ #include "ftnoir_csv/csv.h" FTNoIR_Protocol::FTNoIR_Protocol() : - shm(FT_MM_DATA, FREETRACK_MUTEX, sizeof(FTHeap)) + shm(FREETRACK_HEAP, FREETRACK_MUTEX, sizeof(FTHeap)) { - pMemData = (FTHeap*) shm.mem; + pMemData = (FTHeap*) shm.ptr(); ProgramName = ""; intGameID = 0; viewsStart = 0; diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h index d7a792b7..dc534fda 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h @@ -27,7 +27,6 @@ #pragma once #include "ui_ftnoir_ftcontrols.h" #include "facetracknoir/plugin-api.hpp" -#include "fttypes.h" #include <QMessageBox> #include <QSettings> #include <QLibrary> @@ -39,6 +38,7 @@ #include <QMutexLocker> #include "compat/compat.h" #include "facetracknoir/options.h" +#include "fttypes.h" using namespace options; struct settings { diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 14d5faa1..15bf3a76 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -138,7 +138,7 @@ void Tracker::load_settings(ht_config_t* config) Tracker::Tracker() : lck_shm(HT_SHM_NAME, HT_MUTEX_NAME, sizeof(ht_shm_t)), - shm(reinterpret_cast<ht_shm_t*>(lck_shm.mem)), + shm(reinterpret_cast<ht_shm_t*>(lck_shm.ptr())), videoWidget(nullptr), layout(nullptr) { -- cgit v1.2.3 From 45d89cfd526bf7fa3f7865f2e78f10cd9a85a2f6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 15:20:15 +0200 Subject: fix Linux build --- facetracknoir/export.hpp | 7 ++++ facetracknoir/plugin-api.hpp | 78 +++------------------------------------- facetracknoir/plugin-qt-api.hpp | 65 +++++++++++++++++++++++++++++++++ facetracknoir/plugin-support.cpp | 33 +++++++++-------- 4 files changed, 94 insertions(+), 89 deletions(-) create mode 100644 facetracknoir/export.hpp create mode 100644 facetracknoir/plugin-qt-api.hpp diff --git a/facetracknoir/export.hpp b/facetracknoir/export.hpp new file mode 100644 index 00000000..8c8bdc69 --- /dev/null +++ b/facetracknoir/export.hpp @@ -0,0 +1,7 @@ +#pragma once +#ifdef _WIN32 +# define OPENTRACK_LINKAGE __declspec(dllexport) +#else +# define OPENTRACK_LINKAGE +#endif +#define OPENTRACK_EXPORT __attribute__ ((visibility ("default"))) OPENTRACK_LINKAGE diff --git a/facetracknoir/plugin-api.hpp b/facetracknoir/plugin-api.hpp index f50b9617..d458d25c 100644 --- a/facetracknoir/plugin-api.hpp +++ b/facetracknoir/plugin-api.hpp @@ -1,7 +1,6 @@ #pragma once -#include <QtGlobal> -#include <QFrame> +#include "facetracknoir/export.hpp" #if defined(_WIN32) # define CALLING_CONVENTION __stdcall @@ -13,75 +12,6 @@ enum Axis { TX = 0, TY, TZ, Yaw, Pitch, Roll }; -struct Metadata -{ - Metadata() {} - virtual ~Metadata() {} - - virtual void getFullName(QString *strToBeFilled) = 0; - virtual void getShortName(QString *strToBeFilled) = 0; - virtual void getDescription(QString *strToBeFilled) = 0; - virtual void getIcon(QIcon *icon) = 0; -}; - -struct IFilter -{ - virtual ~IFilter() = 0; - virtual void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position) = 0; - virtual void reset() = 0; -}; - -inline IFilter::~IFilter() {} - -struct IFilterDialog -{ - virtual ~IFilterDialog() {} - virtual void registerFilter(IFilter* tracker) = 0; - virtual void unregisterFilter() = 0; -}; - -struct IProtocol -{ - virtual ~IProtocol() = 0; - virtual bool checkServerInstallationOK() = 0; - virtual void sendHeadposeToGame( const double* headpose ) = 0; - virtual QString getGameName() = 0; -}; - -inline IProtocol::~IProtocol() {} - -struct IProtocolDialog -{ - virtual ~IProtocolDialog() {} - virtual void registerProtocol(IProtocol *protocol) = 0; - virtual void unRegisterProtocol() = 0; -}; - -struct ITracker -{ - virtual ~ITracker() = 0; - virtual void StartTracker( QFrame* frame ) = 0; - virtual void GetHeadPoseData(double *data) = 0; - virtual int preferredHz() { return 200; } -}; - -inline ITracker::~ITracker() {} - -struct ITrackerDialog -{ - virtual ~ITrackerDialog() {} - virtual void registerTracker(ITracker *tracker) = 0; - virtual void unRegisterTracker() = 0; -}; - -#ifndef OPENTRACK_EXPORT -# ifdef IN_OPENTRACK -# if !defined(_MSC_VER) -# define OPENTRACK_EXPORT __attribute__ ((visibility ("default"))) Q_DECL_EXPORT -# else -# error "MSVC support removed" -# endif -# else -# error "Use only for exporting dynamic modules" -# endif -#endif +#ifndef OPENTRACK_CROSS_ONLY +# include "facetracknoir/plugin-qt-api.hpp" +#endif \ No newline at end of file diff --git a/facetracknoir/plugin-qt-api.hpp b/facetracknoir/plugin-qt-api.hpp new file mode 100644 index 00000000..a8dd153b --- /dev/null +++ b/facetracknoir/plugin-qt-api.hpp @@ -0,0 +1,65 @@ +#pragma once + +#include <QString> +#include <QFrame> + +struct Metadata +{ + Metadata() {} + virtual ~Metadata() {} + + virtual void getFullName(QString *strToBeFilled) = 0; + virtual void getShortName(QString *strToBeFilled) = 0; + virtual void getDescription(QString *strToBeFilled) = 0; + virtual void getIcon(QIcon *icon) = 0; +}; + +struct IFilter +{ + virtual ~IFilter() = 0; + virtual void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position) = 0; + virtual void reset() = 0; +}; +inline IFilter::~IFilter() {} + +struct IFilterDialog +{ + virtual ~IFilterDialog() = 0; + virtual void registerFilter(IFilter* tracker) = 0; + virtual void unregisterFilter() = 0; +}; +inline IFilterDialog::~IFilterDialog() {} + +struct IProtocol +{ + virtual ~IProtocol() = 0; + virtual bool checkServerInstallationOK() = 0; + virtual void sendHeadposeToGame( const double* headpose ) = 0; + virtual QString getGameName() = 0; +}; +inline IProtocol::~IProtocol() {} + +struct IProtocolDialog +{ + virtual ~IProtocolDialog() = 0; + virtual void registerProtocol(IProtocol *protocol) = 0; + virtual void unRegisterProtocol() = 0; +}; +inline IProtocolDialog::~IProtocolDialog() {} + +struct ITracker +{ + virtual ~ITracker() = 0; + virtual void StartTracker( QFrame* frame ) = 0; + virtual void GetHeadPoseData(double *data) = 0; + virtual int preferredHz() { return 200; } +}; +inline ITracker::~ITracker() {} + +struct ITrackerDialog +{ + virtual ~ITrackerDialog() = 0; + virtual void registerTracker(ITracker *tracker) = 0; + virtual void unRegisterTracker() = 0; +}; +inline ITrackerDialog::~ITrackerDialog() {} \ No newline at end of file diff --git a/facetracknoir/plugin-support.cpp b/facetracknoir/plugin-support.cpp index 71279cb9..c6622fe0 100644 --- a/facetracknoir/plugin-support.cpp +++ b/facetracknoir/plugin-support.cpp @@ -1,5 +1,6 @@ #include "plugin-support.h" #include <QCoreApplication> +#include <QFile> #if !(defined(_WIN32)) # include <dlfcn.h> @@ -109,23 +110,25 @@ DynamicLibrary::DynamicLibrary(const QString& filename) : 0 # endif ); - if (handle) - { - struct _foo { - static bool err(void*& handle) + + struct _foo { + static bool err(void*& handle) + { + const char* err = dlerror(); + if (err) { - const char* err = dlerror(); - if (err) - { - fprintf(stderr, "Error, ignoring: %s\n", err); - fflush(stderr); - dlclose(handle); - handle = nullptr; - return true; - } - false; + fprintf(stderr, "Error, ignoring: %s\n", err); + fflush(stderr); + dlclose(handle); + handle = nullptr; + return true; } - }; + false; + } + }; + + if (handle) + { if (_foo::err(handle)) return; Dialog = (DIALOG_FUNPTR) dlsym(handle, "GetDialog"); -- cgit v1.2.3 From 083fd59b06aa9f9124e8161d915cc596e83f2589 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 15:21:06 +0200 Subject: wine: setup dependencies properly --- CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b1bbf4ba..d6c28682 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -320,23 +320,23 @@ if(SDK_WINE_PREFIX) opentrack_library(opentrack-proto-wine) target_link_libraries(opentrack-proto-wine opentrack-compat opentrack-csv) if(NOT SDK_WINE_NO_WRAPPER) - set(my-rt -lrt) - if(APPLE) - set(my-rt) - endif() + set(my-rt -lrt) + if(APPLE) + set(my-rt) + endif() + file(GLOB wine-deps "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/*.cxx") add_custom_command( OUTPUT opentrack-wrapper-wine.exe.so - DEPENDS "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx" - "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx" - "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx" - COMMAND "${SDK_WINE_PREFIX}/bin/wineg++" -g -O2 -m32 -o + DEPENDS ${wine-deps} + COMMAND "${SDK_WINE_PREFIX}/bin/wineg++" -g -O2 -m32 -std=c++11 -o opentrack-wrapper-wine.exe -I "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx" "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx" "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx" ${my-rt}) add_custom_target(wine-wrapper ALL DEPENDS opentrack-wrapper-wine.exe.so) - add_dependencies(wine-wrapper opentrack-compat opentrack-proto-wine) + add_dependencies(opentrack-proto-wine wine-wrapper) + add_dependencies(wine-wrapper opentrack-compat) endif() endif() -- cgit v1.2.3 From 906d19822771df7bbd60246ff9f05a00ad87eba3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 15:22:28 +0200 Subject: fixup! fix Linux build --- facetracknoir/facetracknoir.cpp | 2 ++ ftnoir_protocol_ft/ftnoir_protocol_ft.h | 2 +- ftnoir_tracker_ht/ftnoir_tracker_ht.h | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 3c36ab56..868b6dbf 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -214,6 +214,8 @@ void FaceTrackNoIR::save() { save_mappings(); #if defined(__unix) || defined(__linux) + QSettings settings("opentrack"); + const QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QByteArray bytes = QFile::encodeName(currentFile); const char* filename_as_asciiz = bytes.constData(); diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h index dc534fda..5b45e41a 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h @@ -60,7 +60,7 @@ class FTNoIR_Protocol : public IProtocol { public: FTNoIR_Protocol(); - virtual ~FTNoIR_Protocol(); + ~FTNoIR_Protocol() override; bool checkServerInstallationOK( ); void sendHeadposeToGame( const double *headpose ); QString getGameName() { diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h index b9f002a4..ea2cb75e 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h @@ -36,7 +36,7 @@ class Tracker : public QObject, public ITracker Q_OBJECT public: Tracker(); - virtual ~Tracker(); + ~Tracker() override; void StartTracker(QFrame* frame); void GetHeadPoseData(double *data); void load_settings(ht_config_t* config); -- cgit v1.2.3 From aadf333053490f62a5b51366746a89136719a251 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 15:22:44 +0200 Subject: style only --- ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp | 2 +- x-plane-plugin/plugin.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp index 143d0c06..ccc74350 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp @@ -1,7 +1,7 @@ #include "ftnoir_tracker_freepie-udp.h" #include "facetracknoir/plugin-support.h" -#include <stddef.h> +#include <cstddef> #include <cinttypes> TrackerImpl::TrackerImpl() : pose { 0,0,0, 0,0,0 }, should_quit(false) diff --git a/x-plane-plugin/plugin.c b/x-plane-plugin/plugin.c index 62c9d6f0..b91151c1 100644 --- a/x-plane-plugin/plugin.c +++ b/x-plane-plugin/plugin.c @@ -52,6 +52,8 @@ static void reinit_offset() { # define OT_UNUSED(varname) varname #endif +#pragma GCC diagnostic ignored "-Wunused-result" + PortableLockedShm* PortableLockedShm_init(const char *shmName, const char *OT_UNUSED(mutexName), int mapSize) { PortableLockedShm* self = malloc(sizeof(PortableLockedShm)); -- cgit v1.2.3 From d3d17ad9b662aca4327b7b63ba1824eb14d7874b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 15:24:44 +0200 Subject: fixup! needless compat api breakage --- ftnoir_protocol_ft/fttypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftnoir_protocol_ft/fttypes.h b/ftnoir_protocol_ft/fttypes.h index d4cb0c9b..0558f881 100644 --- a/ftnoir_protocol_ft/fttypes.h +++ b/ftnoir_protocol_ft/fttypes.h @@ -21,7 +21,7 @@ #include <inttypes.h> -#define FT_MM_DATA "FT_SharedMem" +#define FREETRACK_HEAP "FT_SharedMem" #define FREETRACK_MUTEX "FT_Mutext" /* only 6 headpose floats and the data id are filled -sh */ -- cgit v1.2.3 From 69236c0317a30bf100ec4f3d0f8e58fdc565a34b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 15:25:19 +0200 Subject: fix Wine proto bitrot --- ftnoir_protocol_wine/ftnoir_protocol_wine.cpp | 5 +- ftnoir_protocol_wine/ftnoir_protocol_wine.h | 17 ++--- .../ftnoir_protocol_wine_dialog.cpp | 10 +-- ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp | 2 +- .../opentrack-wrapper-wine-main.cxx | 84 +++++++++------------- .../opentrack-wrapper-wine-posix.cxx | 12 ++-- .../opentrack-wrapper-wine-windows.cxx | 16 +++-- ftnoir_protocol_wine/wine-shm.h | 4 ++ 8 files changed, 70 insertions(+), 80 deletions(-) diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp index 3208795c..8ebc394d 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp @@ -3,11 +3,12 @@ #include <sys/mman.h> #include <sys/stat.h> /* For mode constants */ #include <fcntl.h> /* For O_* constants */ +#include "ftnoir_csv/csv.h" FTNoIR_Protocol::FTNoIR_Protocol() : lck_shm(WINE_SHM_NAME, WINE_MTX_NAME, sizeof(WineSHM)), shm(NULL), gameid(0) { if (lck_shm.success()) { - shm = (WineSHM*) lck_shm.mem; + shm = (WineSHM*) lck_shm.ptr(); memset(shm, 0, sizeof(*shm)); } wrapper.start("wine", QStringList() << (QCoreApplication::applicationDirPath() + "/opentrack-wrapper-wine.exe.so")); @@ -55,7 +56,7 @@ bool FTNoIR_Protocol::checkServerInstallationOK() return lck_shm.success(); } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT void* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT void* CALLING_CONVENTION GetConstructor() { return (IProtocol*) new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.h b/ftnoir_protocol_wine/ftnoir_protocol_wine.h index 95e833f6..9a7fb7d5 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine.h +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.h @@ -1,8 +1,5 @@ #pragma once -#include "ftnoir_protocol_base/ftnoir_protocol_base.h" -#include "ftnoir_protocol_ft/fttypes.h" -#include "ftnoir_csv/csv.h" #include "ui_ftnoir_winecontrols.h" #include <QMessageBox> #include <QLibrary> @@ -11,15 +8,15 @@ #include <QMutex> #include <QMutexLocker> #include <QFile> -#include "facetracknoir/plugin-support.h" +#include "facetracknoir/plugin-api.hpp" #include "compat/compat.h" #include "ftnoir_protocol_wine/wine-shm.h" class FTNoIR_Protocol : public IProtocol { public: - FTNoIR_Protocol(); - virtual ~FTNoIR_Protocol(); + FTNoIR_Protocol(); + ~FTNoIR_Protocol() override; bool checkServerInstallationOK(); void sendHeadposeToGame(const double* headpose); @@ -48,15 +45,15 @@ private: Ui::UICFTControls ui; private slots: - void doOK(); - void doCancel(); + void doOK(); + void doCancel(); }; class FTNoIR_ProtocolDll : public Metadata { public: - FTNoIR_ProtocolDll(); - ~FTNoIR_ProtocolDll(); + FTNoIR_ProtocolDll(); + ~FTNoIR_ProtocolDll(); void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("Wine"); } void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("Wine"); } diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp index a6fae479..bcd3df45 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp @@ -4,20 +4,20 @@ FTControls::FTControls() : QWidget() { - ui.setupUi( this ); - connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK())); - connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); + ui.setupUi( this ); + connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK())); + connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); } void FTControls::doOK() { - this->close(); + this->close(); } void FTControls::doCancel() { this->close(); } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT void* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT void* CALLING_CONVENTION GetDialog( ) { return (IProtocolDialog*) new FTControls; } diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp index 7d7fb247..16e3e7c7 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp @@ -9,7 +9,7 @@ FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll() { } -extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx b/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx index 6e512b6e..fe5a95f9 100644 --- a/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx +++ b/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx @@ -1,60 +1,42 @@ -#include <errno.h> -#include <stdio.h> +#include <cerrno> +#include <cstdio> #include "ftnoir_protocol_ft/fttypes.h" #include "ftnoir_protocol_wine/wine-shm.h" -#include "ftnoir_tracker_base/ftnoir_tracker_types.h" -void create_registry_key(void); +#define OPENTRACK_CROSS_ONLY +#include "facetracknoir/plugin-api.hpp" -class ShmPosix { -public: - ShmPosix(const char *shmName, const char *mutexName, int mapSize); - ~ShmPosix(); - void lock(); - void unlock(); - bool success(); - void* mem; -private: - int fd, size; -}; +#define OPENTRACK_COMPAT_BUNDLED +#include "compat/compat.h" -class ShmWine { -public: - ShmWine(const char *shmName, const char *mutexName, int mapSize); - ~ShmWine(); - void lock(); - void unlock(); - bool success(); - void* mem; -private: - void *hMutex, *hMapFile; -}; -#include <windows.h> +void create_registry_key(void); +ptr<BasePortableLockedShm> make_shm_posix(); +ptr<BasePortableLockedShm> make_shm_win32(); int main(void) { - ShmPosix lck_posix(WINE_SHM_NAME, WINE_MTX_NAME, sizeof(WineSHM)); - ShmWine lck_wine("FT_SharedMem", "FT_Mutext", sizeof(FTMemMap)); - if(!lck_posix.success()) { - printf("Can't open posix map: %d\n", errno); - return 1; - } - if(!lck_wine.success()) { - printf("Can't open Wine map\n"); - return 1; - } - WineSHM* shm_posix = (WineSHM*) lck_posix.mem; - FTMemMap* shm_wine = (FTMemMap*) lck_wine.mem; - TFreeTrackData* data = &shm_wine->data; + ptr<BasePortableLockedShm> lck_posix = make_shm_posix(); + ptr<BasePortableLockedShm> lck_wine = make_shm_win32(); + if(!lck_posix->success()) { + printf("Can't open posix map: %d\n", errno); + return 1; + } + if(!lck_wine->success()) { + printf("Can't open Wine map\n"); + return 1; + } + WineSHM* shm_posix = (WineSHM*) lck_posix->ptr(); + FTHeap* shm_wine = (FTHeap*) lck_wine->ptr(); + FTData* data = &shm_wine->data; create_registry_key(); - while (1) { - (void) Sleep(10); - lck_posix.lock(); - if (shm_posix->stop) { - lck_posix.unlock(); - break; - } - lck_wine.lock(); + while (1) { + (void) Sleep(4); + lck_posix->lock(); + if (shm_posix->stop) { + lck_posix->unlock(); + break; + } + lck_wine->lock(); data->Yaw = shm_posix->data[Yaw]; data->Pitch = shm_posix->data[Pitch]; data->Roll = shm_posix->data[Roll]; @@ -68,7 +50,7 @@ int main(void) shm_posix->gameid = shm_wine->GameID; for (int i = 0; i < 8; i++) shm_wine->table[i] = shm_posix->table[i]; - lck_wine.unlock(); - lck_posix.unlock(); - } + lck_wine->unlock(); + lck_posix->unlock(); + } } diff --git a/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx b/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx index 010c4440..ea01ff03 100644 --- a/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx +++ b/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx @@ -1,8 +1,12 @@ #define OPENTRACK_COMPAT_BUNDLED -#ifdef _WIN32 -# undef _WIN32 -#endif - #define PortableLockedShm ShmPosix +#undef _WIN32 +#include "ftnoir_protocol_ft/fttypes.h" +#include "wine-shm.h" #include "compat/compat.h" #include "compat/compat.cpp" + +ptr<BasePortableLockedShm> make_shm_posix() +{ + return std::make_shared<ShmPosix>(FREETRACK_HEAP, FREETRACK_MUTEX, sizeof(FTHeap)); +} diff --git a/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx b/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx index e7102600..715dcc69 100644 --- a/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx +++ b/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx @@ -1,19 +1,21 @@ -#define OPENTRACK_COMPAT_BUNDLED - #ifndef __WIN32 -#define __WIN32 +# error "bad cross" #endif +#define OPENTRACK_COMPAT_BUNDLED #define PortableLockedShm ShmWine - -#include "ftnoir_protocol_ft/fttypes.h" #include "compat/compat.h" #include "compat/compat.cpp" -#include <string.h> +#include "wine-shm.h" + +ptr<BasePortableLockedShm> make_shm_win32() +{ + return std::make_shared<ShmWine>(WINE_SHM_NAME, WINE_MTX_NAME, sizeof(WineSHM)); +} void create_registry_key(void) { char dir[8192]; - + if (GetCurrentDirectoryA(8192, dir) < 8190) { HKEY hkpath; diff --git a/ftnoir_protocol_wine/wine-shm.h b/ftnoir_protocol_wine/wine-shm.h index ddbda8b5..c0f29cd3 100644 --- a/ftnoir_protocol_wine/wine-shm.h +++ b/ftnoir_protocol_wine/wine-shm.h @@ -3,6 +3,10 @@ #define WINE_SHM_NAME "facetracknoir-wine-shm" #define WINE_MTX_NAME "facetracknoir-wine-mtx" +#include <memory> + +template<typename t> using ptr = std::shared_ptr<t>; + struct WineSHM { double data[6]; int gameid, gameid2; -- cgit v1.2.3 From f495b0136faf48d397138272eed683ade26187c9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 19:01:28 +0200 Subject: const constexpr -> constexpr --- ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp | 2 +- ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp | 2 +- ftnoir_tracker_joystick/ftnoir_tracker_joystick.h | 2 +- qfunctionconfigurator/qfunctionconfigurator.cpp | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp index ccc74350..c1faebeb 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp @@ -46,7 +46,7 @@ void TrackerImpl::run() { int flags = data.flags & F::Mask; - constexpr int minsz = offsetof(decltype(data), raw_rot) + sizeof(decltype(data)::raw_rot); + static constexpr int minsz = offsetof(decltype(data), raw_rot) + sizeof(decltype(data)::raw_rot); const bool flags_came_out_wrong = minsz > sz; if (flags_came_out_wrong) diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp index a28bd398..03c756f9 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp @@ -39,7 +39,7 @@ void Hydra_Tracker::GetHeadPoseData(double *data) data[TX] = acd.controllers[0].pos[0]/50.0; data[TY] = acd.controllers[0].pos[1]/50.0; data[TZ] = acd.controllers[0].pos[2]/50.0; - constexpr double r2d = 57.295781; + static constexpr double r2d = 57.295781; data[Yaw] = ypr[0] * r2d; data[Pitch] = ypr[1] * r2d; data[Roll] = ypr[2] * r2d; diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h index 2c2ebb47..04a933db 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h @@ -53,7 +53,7 @@ public: DIDEVICEINSTANCE def; int iter; // XXX bad style settings s; - static const constexpr int AXIS_MAX = 65535; + static constexpr int AXIS_MAX = 65535; }; class TrackerControls: public QWidget, public ITrackerDialog diff --git a/qfunctionconfigurator/qfunctionconfigurator.cpp b/qfunctionconfigurator/qfunctionconfigurator.cpp index 70f68285..1e5b957c 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.cpp +++ b/qfunctionconfigurator/qfunctionconfigurator.cpp @@ -154,7 +154,7 @@ void QFunctionConfigurator::drawFunction() QPen pen(spline_color, 1.2, Qt::SolidLine); - static const constexpr double step = 1.02; + static constexpr double step = 1.02; const double max = _config->maxInput(); QPointF prev = point_to_pixel(QPointF(0, 0)); @@ -284,12 +284,12 @@ void QFunctionConfigurator::mouseMoveEvent(QMouseEvent *e) if (!_config) return; - static const constexpr int min_refresh_delay = 25; + static constexpr int min_refresh_delay = 25; if (timer.isValid() && timer.elapsed() < min_refresh_delay) return; - static const constexpr int refresh_delay = 50; + static constexpr int refresh_delay = 50; QList<QPointF> points = _config->getPoints(); if (moving_control_point_idx >= 0 && moving_control_point_idx < points.size()) { -- cgit v1.2.3 From 434d4e3e6e7e2835c86c00dae6ea1cc43efac96e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 19:01:42 +0200 Subject: add -ffast-math to toolchain file --- cmake/mingw-w64.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/mingw-w64.cmake b/cmake/mingw-w64.cmake index 5cb63674..b5c06549 100644 --- a/cmake/mingw-w64.cmake +++ b/cmake/mingw-w64.cmake @@ -19,7 +19,7 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -set(CMAKE_C_FLAGS_RELEASE "-O3 -flto -march=i686 -mtune=prescott -mno-sse3 -mno-avx -frename-registers" CACHE STRING "" FORCE) +set(CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math -flto -march=i686 -mtune=prescott -mno-sse3 -mno-avx -frename-registers" CACHE STRING "" FORCE) set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE} CACHE STRING "" FORCE) set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE) -- cgit v1.2.3 From 3fe35807466580d910a5bd33a7ae0bc8f439ee19 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 19:02:05 +0200 Subject: cmake: cleanup/comment -D's --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d6c28682..79bb2b1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,13 +48,14 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) -add_definitions(-DOPENTRACK_API -DIN_OPENTRACK) +# note, hatire supports both ftnoir and opentrack +# don't remove without being sure as hell -sh 20140922 +add_definitions(-DOPENTRACK_API) if(CMAKE_COMPILER_IS_GNUCXX OR APPLE) set(CMAKE_CXX_FLAGS " -std=c++11 ${CMAKE_CXX_FLAGS} ") endif() - if(UNIX) set(SDK_ENABLE_LIBEVDEV FALSE CACHE BOOL "libevdev virtual joystick protocol support (probably Linux only)") endif() -- cgit v1.2.3 From e2b296165236cdb0952c429d91d357b92d9ee18e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 19:02:33 +0200 Subject: dos2unix only --- ftnoir_tracker_pt/FTNoIR_PT_Controls.ui | 3090 ++++++++++++------------ ftnoir_tracker_pt/Resources/Logo_IR.png | Bin 10386 -> 10385 bytes ftnoir_tracker_pt/Resources/cap_front.png | Bin 1164 -> 1163 bytes ftnoir_tracker_pt/Resources/cap_side.png | Bin 1733 -> 1732 bytes ftnoir_tracker_pt/Resources/clip_front.png | Bin 571 -> 570 bytes ftnoir_tracker_pt/Resources/clip_side.png | Bin 2677 -> 2676 bytes ftnoir_tracker_pt/camera.cpp | 692 +++--- ftnoir_tracker_pt/camera.h | 288 +-- ftnoir_tracker_pt/doc/logo.png | Bin 10386 -> 10385 bytes ftnoir_tracker_pt/doc/settings1.png | Bin 25013 -> 25012 bytes ftnoir_tracker_pt/doc/settings2.png | Bin 26841 -> 26840 bytes ftnoir_tracker_pt/doc/settings3.png | Bin 29547 -> 29546 bytes ftnoir_tracker_pt/doc/style.css | 262 +- ftnoir_tracker_pt/frame_observer.cpp | 36 +- ftnoir_tracker_pt/frame_observer.h | 150 +- ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 528 ++-- ftnoir_tracker_pt/ftnoir_tracker_pt.h | 186 +- ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp | 628 ++--- ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h | 140 +- ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp | 84 +- ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h | 52 +- ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h | 162 +- ftnoir_tracker_pt/point_extractor.cpp | 326 +-- ftnoir_tracker_pt/point_extractor.h | 70 +- ftnoir_tracker_pt/point_tracker.cpp | 750 +++--- ftnoir_tracker_pt/point_tracker.h | 256 +- ftnoir_tracker_pt/pt_video_widget.cpp | 128 +- ftnoir_tracker_pt/pt_video_widget.h | 140 +- ftnoir_tracker_pt/trans_calib.cpp | 86 +- ftnoir_tracker_pt/trans_calib.h | 76 +- 30 files changed, 4065 insertions(+), 4065 deletions(-) diff --git a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui index 44dfc060..a2d5c47c 100644 --- a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui +++ b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui @@ -1,1545 +1,1545 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UICPTClientControls</class> - <widget class="QWidget" name="UICPTClientControls"> - <property name="windowModality"> - <enum>Qt::NonModal</enum> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>459</width> - <height>621</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="windowTitle"> - <string>PointTracker Settings</string> - </property> - <property name="windowIcon"> - <iconset resource="ftnoir_tracker_pt.qrc"> - <normaloff>:/Resources/Logo_IR.png</normaloff>:/Resources/Logo_IR.png</iconset> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="sizeConstraint"> - <enum>QLayout::SetFixedSize</enum> - </property> - <item> - <widget class="QTabWidget" name="tabWidget"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tab"> - <attribute name="title"> - <string>General</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <widget class="QGroupBox" name="groupBox_6"> - <property name="title"> - <string>Tracker Thread</string> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label_43"> - <property name="text"> - <string>Auto-reset time</string> - </property> - <property name="buddy"> - <cstring>reset_spin</cstring> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="reset_spin"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Time until automatic reset of tracker's internal state when no valid tracking result is found</string> - </property> - <property name="suffix"> - <string>ms</string> - </property> - <property name="maximum"> - <number>9999</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_17"> - <property name="text"> - <string>Dynamic Pose Resolution</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="dynpose_check"> - <property name="toolTip"> - <string/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QPushButton" name="reset_button"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="toolTip"> - <string>Reset the tracker's internal state</string> - </property> - <property name="text"> - <string>Reset</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_2"> - <attribute name="title"> - <string>Camera</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_7"> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="toolTip"> - <string>The camera device used as input</string> - </property> - <property name="title"> - <string>Camera Settings</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QLabel" name="label_2"> - <property name="minimumSize"> - <size> - <width>55</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Device</string> - </property> - <property name="buddy"> - <cstring>camdevice_combo</cstring> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="camdevice_combo"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Camera device used as input</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_8"> - <item> - <layout class="QGridLayout" name="gridLayout_8"> - <item row="0" column="0"> - <widget class="QLabel" name="label_36"> - <property name="minimumSize"> - <size> - <width>55</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Resolution</string> - </property> - </widget> - </item> - <item row="0" column="5"> - <widget class="QLabel" name="label_37"> - <property name="text"> - <string>FPS</string> - </property> - <property name="buddy"> - <cstring>fps_spin</cstring> - </property> - </widget> - </item> - <item row="0" column="6"> - <widget class="QSpinBox" name="fps_spin"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Desired capture framerate</string> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_41"> - <property name="text"> - <string>x</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="res_x_spin"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Desired capture width</string> - </property> - <property name="maximum"> - <number>2000</number> - </property> - <property name="singleStep"> - <number>10</number> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QSpinBox" name="res_y_spin"> - <property name="toolTip"> - <string>Desired capture height</string> - </property> - <property name="maximum"> - <number>2000</number> - </property> - <property name="singleStep"> - <number>10</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_34"> - <property name="text"> - <string>F/W</string> - </property> - <property name="buddy"> - <cstring>f_dspin</cstring> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QDoubleSpinBox" name="f_dspin"> - <property name="toolTip"> - <string>The camera's focal length devided by its sensor width</string> - </property> - <property name="decimals"> - <number>2</number> - </property> - <property name="singleStep"> - <double>0.100000000000000</double> - </property> - </widget> - </item> - <item row="0" column="4"> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="0" column="7"> - <spacer name="horizontalSpacer_9"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_7"/> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_4"> - <property name="title"> - <string>Camera Orientation</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_8"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_6"> - <item> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="1" column="0"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Pitch</string> - </property> - <property name="buddy"> - <cstring>campitch_spin</cstring> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="campitch_spin"> - <property name="contextMenuPolicy"> - <enum>Qt::DefaultContextMenu</enum> - </property> - <property name="toolTip"> - <string>The angle the camera is facing upwards</string> - </property> - <property name="minimum"> - <number>-99</number> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_20"> - <property name="text"> - <string>Yaw</string> - </property> - <property name="buddy"> - <cstring>camyaw_spin</cstring> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="camyaw_spin"> - <property name="contextMenuPolicy"> - <enum>Qt::DefaultContextMenu</enum> - </property> - <property name="toolTip"> - <string>The angle the camera is facing leftwards</string> - </property> - <property name="minimum"> - <number>-99</number> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="label_21"> - <property name="text"> - <string>deg (positve = leftwards)</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="camroll_combo"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>Rotation of the camera image</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>deg (positive = upwards)</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_19"> - <property name="text"> - <string>deg</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_18"> - <property name="text"> - <string>Roll</string> - </property> - <property name="buddy"> - <cstring>camroll_combo</cstring> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_10"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>Point Extraction</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Threshold</string> - </property> - <property name="buddy"> - <cstring>threshold_slider</cstring> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="threshold_slider"> - <property name="toolTip"> - <string>Intensity threshold for point extraction</string> - </property> - <property name="maximum"> - <number>255</number> - </property> - <property name="value"> - <number>127</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_secondary"> - <item> - <widget class="QLabel" name="label_secondary"> - <property name="text"> - <string>Hysteresis</string> - </property> - <property name="buddy"> - <cstring>threshold_secondary_slider</cstring> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="threshold_secondary_slider"> - <property name="toolTip"> - <string>Per pixel hysteresis width (leave left if there is little difference between dot and non-dot, move right for increased stability against pixel noise)</string> - </property> - <property name="maximum"> - <number>255</number> - </property> - <property name="pageStep"> - <number>1</number> - </property> - <property name="value"> - <number>100</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>Min Diameter</string> - </property> - <property name="buddy"> - <cstring>mindiam_spin</cstring> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="mindiam_spin"> - <property name="toolTip"> - <string>Minimum point diameter</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_12"> - <property name="text"> - <string>px</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>Max Diameter</string> - </property> - <property name="buddy"> - <cstring>maxdiam_spin</cstring> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="maxdiam_spin"> - <property name="toolTip"> - <string>Maximum point diameter</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_13"> - <property name="text"> - <string>px</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_4"> - <attribute name="title"> - <string>Model</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_16"> - <item> - <widget class="QTabWidget" name="model_tabs"> - <property name="tabShape"> - <enum>QTabWidget::Rounded</enum> - </property> - <property name="currentIndex"> - <number>2</number> - </property> - <property name="usesScrollButtons"> - <bool>false</bool> - </property> - <property name="documentMode"> - <bool>false</bool> - </property> - <property name="tabsClosable"> - <bool>false</bool> - </property> - <widget class="QWidget" name="tab_5"> - <attribute name="title"> - <string>Clip</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_13"> - <item> - <widget class="QGroupBox" name="groupBox_8"> - <property name="title"> - <string>Model Dimensions (mm)</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_16"> - <item> - <widget class="QWidget" name="widget_4" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>160</height> - </size> - </property> - <widget class="QLabel" name="label_44"> - <property name="geometry"> - <rect> - <x>30</x> - <y>30</y> - <width>71</width> - <height>111</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/clip_side.png</pixmap> - </property> - </widget> - <widget class="QSpinBox" name="clip_theight_spin"> - <property name="geometry"> - <rect> - <x>100</x> - <y>50</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - <widget class="QSpinBox" name="clip_tlength_spin"> - <property name="geometry"> - <rect> - <x>60</x> - <y>10</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - <widget class="QSpinBox" name="clip_bheight_spin"> - <property name="geometry"> - <rect> - <x>100</x> - <y>90</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - <widget class="QLabel" name="label_50"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>46</width> - <height>13</height> - </rect> - </property> - <property name="text"> - <string>Side</string> - </property> - </widget> - <widget class="QSpinBox" name="clip_blength_spin"> - <property name="geometry"> - <rect> - <x>40</x> - <y>140</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - <widget class="QLabel" name="label_52"> - <property name="geometry"> - <rect> - <x>70</x> - <y>70</y> - <width>16</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>R</string> - </property> - </widget> - </widget> - </item> - <item> - <widget class="QWidget" name="widget_3" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>140</height> - </size> - </property> - <widget class="QLabel" name="label_51"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>46</width> - <height>13</height> - </rect> - </property> - <property name="text"> - <string>Front</string> - </property> - </widget> - <widget class="QLabel" name="label_45"> - <property name="geometry"> - <rect> - <x>40</x> - <y>30</y> - <width>21</width> - <height>111</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/clip_front.png</pixmap> - </property> - </widget> - <widget class="QLabel" name="label_53"> - <property name="geometry"> - <rect> - <x>60</x> - <y>70</y> - <width>16</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>R</string> - </property> - </widget> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_6"> - <attribute name="title"> - <string>Cap</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_14"> - <item> - <widget class="QGroupBox" name="groupBox_9"> - <property name="title"> - <string>Model Dimensions (mm)</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_15"> - <item> - <widget class="QWidget" name="widget" native="true"> - <property name="minimumSize"> - <size> - <width>140</width> - <height>130</height> - </size> - </property> - <widget class="QLabel" name="label_46"> - <property name="geometry"> - <rect> - <x>20</x> - <y>50</y> - <width>111</width> - <height>81</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/cap_side.png</pixmap> - </property> - </widget> - <widget class="QSpinBox" name="cap_height_spin"> - <property name="geometry"> - <rect> - <x>30</x> - <y>80</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - <widget class="QLabel" name="label_54"> - <property name="geometry"> - <rect> - <x>130</x> - <y>50</y> - <width>16</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>R</string> - </property> - </widget> - <widget class="QLabel" name="label_48"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>46</width> - <height>13</height> - </rect> - </property> - <property name="text"> - <string>Side</string> - </property> - </widget> - <widget class="QSpinBox" name="cap_length_spin"> - <property name="geometry"> - <rect> - <x>50</x> - <y>40</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </widget> - </item> - <item> - <widget class="QWidget" name="widget_2" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>130</height> - </size> - </property> - <widget class="QLabel" name="label_49"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>46</width> - <height>13</height> - </rect> - </property> - <property name="text"> - <string>Front</string> - </property> - </widget> - <widget class="QLabel" name="label_55"> - <property name="geometry"> - <rect> - <x>30</x> - <y>50</y> - <width>16</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>R</string> - </property> - </widget> - <widget class="QLabel" name="label_47"> - <property name="geometry"> - <rect> - <x>10</x> - <y>50</y> - <width>81</width> - <height>81</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/cap_front.png</pixmap> - </property> - </widget> - <widget class="QSpinBox" name="cap_width_spin"> - <property name="geometry"> - <rect> - <x>50</x> - <y>30</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_7"> - <attribute name="title"> - <string>Custom</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_15"> - <item> - <widget class="QGroupBox" name="groupBox_7"> - <property name="title"> - <string>Model Dimensions (mm)</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_12"> - <item> - <widget class="QLabel" name="label_56"> - <property name="text"> - <string><html><head/><body><p>Location of the two remaining model points<br/>with respect to the reference point in default pose</p></body></html></string> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer_4"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_14"> - <item> - <spacer name="horizontalSpacer_14"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QGridLayout" name="gridLayout_4"> - <item row="3" column="2"> - <widget class="QSpinBox" name="m1z_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLabel" name="label_58"> - <property name="text"> - <string>y:</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QSpinBox" name="m1y_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLabel" name="label_57"> - <property name="text"> - <string>z:</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_60"> - <property name="text"> - <string>M1:</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QSpinBox" name="m1x_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="label_63"> - <property name="text"> - <string>x:</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_15"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QGridLayout" name="gridLayout_5"> - <item row="1" column="2"> - <widget class="QSpinBox" name="m2x_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="label_67"> - <property name="text"> - <string>x:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLabel" name="label_69"> - <property name="text"> - <string>z:</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QSpinBox" name="m2y_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLabel" name="label_70"> - <property name="text"> - <string>y:</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_64"> - <property name="text"> - <string>M2:</string> - </property> - </widget> - </item> - <item row="3" column="2"> - <widget class="QSpinBox" name="m2z_spin"> - <property name="suffix"> - <string/> - </property> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_16"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer_3"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_10"> - <property name="title"> - <string>Model Position (mm)</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_11"> - <item> - <widget class="QLabel" name="label_59"> - <property name="text"> - <string><html><head/><body><p>Translation from head center to model reference point<br/> in default pose</p></body></html></string> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_17"> - <item> - <spacer name="horizontalSpacer_17"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QGridLayout" name="gridLayout_6"> - <item row="3" column="1"> - <widget class="QSpinBox" name="tz_spin"> - <property name="suffix"> - <string/> - </property> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_61"> - <property name="text"> - <string>x:</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_62"> - <property name="text"> - <string>y:</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_66"> - <property name="text"> - <string>z:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="ty_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="tx_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_18"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="tcalib_button"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Calibrate</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_19"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_3"> - <attribute name="title"> - <string>About</string> - </attribute> - <widget class="QLabel" name="label_10"> - <property name="geometry"> - <rect> - <x>30</x> - <y>30</y> - <width>161</width> - <height>111</height> - </rect> - </property> - <property name="text"> - <string><html><head/><body><p><span style=" font-weight:600;">FTNoIR PointTracker Plugin<br/>Version 1.1</span></p><p><span style=" font-weight:600;">by Patrick Ruoff</span></p><p><a href="http://ftnoirpt.sourceforge.net/"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">Manual (external)</span></a></p></body></html></string> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - <widget class="QLabel" name="label_35"> - <property name="geometry"> - <rect> - <x>200</x> - <y>30</y> - <width>141</width> - <height>141</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/Logo_IR.png</pixmap> - </property> - </widget> - </widget> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_5"> - <property name="title"> - <string>Status</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <item> - <layout class="QFormLayout" name="formLayout"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="label_38"> - <property name="text"> - <string>Camera Info:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="caminfo_label"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>120</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Extracted Points:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="pointinfo_label"> - <property name="minimumSize"> - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QPushButton" name="btnApply"> - <property name="text"> - <string>Save</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_6"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="ok_button"> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="text"> - <string>Ok</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="cancel_button"> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="text"> - <string>Cancel</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <tabstops> - <tabstop>tabWidget</tabstop> - <tabstop>reset_spin</tabstop> - <tabstop>camdevice_combo</tabstop> - <tabstop>res_x_spin</tabstop> - <tabstop>res_y_spin</tabstop> - <tabstop>fps_spin</tabstop> - <tabstop>f_dspin</tabstop> - <tabstop>camroll_combo</tabstop> - <tabstop>campitch_spin</tabstop> - <tabstop>camyaw_spin</tabstop> - <tabstop>threshold_slider</tabstop> - <tabstop>mindiam_spin</tabstop> - <tabstop>maxdiam_spin</tabstop> - <tabstop>model_tabs</tabstop> - <tabstop>clip_tlength_spin</tabstop> - <tabstop>clip_theight_spin</tabstop> - <tabstop>clip_bheight_spin</tabstop> - <tabstop>clip_blength_spin</tabstop> - <tabstop>cap_length_spin</tabstop> - <tabstop>cap_height_spin</tabstop> - <tabstop>cap_width_spin</tabstop> - <tabstop>m1x_spin</tabstop> - <tabstop>m1y_spin</tabstop> - <tabstop>m1z_spin</tabstop> - <tabstop>m2x_spin</tabstop> - <tabstop>m2y_spin</tabstop> - <tabstop>m2z_spin</tabstop> - <tabstop>tx_spin</tabstop> - <tabstop>ty_spin</tabstop> - <tabstop>tz_spin</tabstop> - <tabstop>tcalib_button</tabstop> - <tabstop>ok_button</tabstop> - <tabstop>cancel_button</tabstop> - </tabstops> - <resources> - <include location="ftnoir_tracker_pt.qrc"/> - </resources> - <connections> - <connection> - <sender>dynpose_check</sender> - <signal>toggled(bool)</signal> - <receiver>reset_spin</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>172</x> - <y>110</y> - </hint> - <hint type="destinationlabel"> - <x>351</x> - <y>112</y> - </hint> - </hints> - </connection> - </connections> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UICPTClientControls</class> + <widget class="QWidget" name="UICPTClientControls"> + <property name="windowModality"> + <enum>Qt::NonModal</enum> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>459</width> + <height>621</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle"> + <string>PointTracker Settings</string> + </property> + <property name="windowIcon"> + <iconset resource="ftnoir_tracker_pt.qrc"> + <normaloff>:/Resources/Logo_IR.png</normaloff>:/Resources/Logo_IR.png</iconset> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="sizeConstraint"> + <enum>QLayout::SetFixedSize</enum> + </property> + <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>General</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QGroupBox" name="groupBox_6"> + <property name="title"> + <string>Tracker Thread</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label_43"> + <property name="text"> + <string>Auto-reset time</string> + </property> + <property name="buddy"> + <cstring>reset_spin</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="reset_spin"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Time until automatic reset of tracker's internal state when no valid tracking result is found</string> + </property> + <property name="suffix"> + <string>ms</string> + </property> + <property name="maximum"> + <number>9999</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_17"> + <property name="text"> + <string>Dynamic Pose Resolution</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QCheckBox" name="dynpose_check"> + <property name="toolTip"> + <string/> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QPushButton" name="reset_button"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Reset the tracker's internal state</string> + </property> + <property name="text"> + <string>Reset</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>Camera</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_7"> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="toolTip"> + <string>The camera device used as input</string> + </property> + <property name="title"> + <string>Camera Settings</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="label_2"> + <property name="minimumSize"> + <size> + <width>55</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Device</string> + </property> + <property name="buddy"> + <cstring>camdevice_combo</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="camdevice_combo"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Camera device used as input</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_8"> + <item> + <layout class="QGridLayout" name="gridLayout_8"> + <item row="0" column="0"> + <widget class="QLabel" name="label_36"> + <property name="minimumSize"> + <size> + <width>55</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Resolution</string> + </property> + </widget> + </item> + <item row="0" column="5"> + <widget class="QLabel" name="label_37"> + <property name="text"> + <string>FPS</string> + </property> + <property name="buddy"> + <cstring>fps_spin</cstring> + </property> + </widget> + </item> + <item row="0" column="6"> + <widget class="QSpinBox" name="fps_spin"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Desired capture framerate</string> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_41"> + <property name="text"> + <string>x</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="res_x_spin"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Desired capture width</string> + </property> + <property name="maximum"> + <number>2000</number> + </property> + <property name="singleStep"> + <number>10</number> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QSpinBox" name="res_y_spin"> + <property name="toolTip"> + <string>Desired capture height</string> + </property> + <property name="maximum"> + <number>2000</number> + </property> + <property name="singleStep"> + <number>10</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_34"> + <property name="text"> + <string>F/W</string> + </property> + <property name="buddy"> + <cstring>f_dspin</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QDoubleSpinBox" name="f_dspin"> + <property name="toolTip"> + <string>The camera's focal length devided by its sensor width</string> + </property> + <property name="decimals"> + <number>2</number> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> + <item row="0" column="4"> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="7"> + <spacer name="horizontalSpacer_9"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_7"/> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_4"> + <property name="title"> + <string>Camera Orientation</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_8"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <item> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="1" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Pitch</string> + </property> + <property name="buddy"> + <cstring>campitch_spin</cstring> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="campitch_spin"> + <property name="contextMenuPolicy"> + <enum>Qt::DefaultContextMenu</enum> + </property> + <property name="toolTip"> + <string>The angle the camera is facing upwards</string> + </property> + <property name="minimum"> + <number>-99</number> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_20"> + <property name="text"> + <string>Yaw</string> + </property> + <property name="buddy"> + <cstring>camyaw_spin</cstring> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QSpinBox" name="camyaw_spin"> + <property name="contextMenuPolicy"> + <enum>Qt::DefaultContextMenu</enum> + </property> + <property name="toolTip"> + <string>The angle the camera is facing leftwards</string> + </property> + <property name="minimum"> + <number>-99</number> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="label_21"> + <property name="text"> + <string>deg (positve = leftwards)</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="camroll_combo"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Rotation of the camera image</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>deg (positive = upwards)</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_19"> + <property name="text"> + <string>deg</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_18"> + <property name="text"> + <string>Roll</string> + </property> + <property name="buddy"> + <cstring>camroll_combo</cstring> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer_10"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Point Extraction</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Threshold</string> + </property> + <property name="buddy"> + <cstring>threshold_slider</cstring> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="threshold_slider"> + <property name="toolTip"> + <string>Intensity threshold for point extraction</string> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="value"> + <number>127</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_secondary"> + <item> + <widget class="QLabel" name="label_secondary"> + <property name="text"> + <string>Hysteresis</string> + </property> + <property name="buddy"> + <cstring>threshold_secondary_slider</cstring> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="threshold_secondary_slider"> + <property name="toolTip"> + <string>Per pixel hysteresis width (leave left if there is little difference between dot and non-dot, move right for increased stability against pixel noise)</string> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="pageStep"> + <number>1</number> + </property> + <property name="value"> + <number>100</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Min Diameter</string> + </property> + <property name="buddy"> + <cstring>mindiam_spin</cstring> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="mindiam_spin"> + <property name="toolTip"> + <string>Minimum point diameter</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_12"> + <property name="text"> + <string>px</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Max Diameter</string> + </property> + <property name="buddy"> + <cstring>maxdiam_spin</cstring> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="maxdiam_spin"> + <property name="toolTip"> + <string>Maximum point diameter</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_13"> + <property name="text"> + <string>px</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_4"> + <attribute name="title"> + <string>Model</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_16"> + <item> + <widget class="QTabWidget" name="model_tabs"> + <property name="tabShape"> + <enum>QTabWidget::Rounded</enum> + </property> + <property name="currentIndex"> + <number>2</number> + </property> + <property name="usesScrollButtons"> + <bool>false</bool> + </property> + <property name="documentMode"> + <bool>false</bool> + </property> + <property name="tabsClosable"> + <bool>false</bool> + </property> + <widget class="QWidget" name="tab_5"> + <attribute name="title"> + <string>Clip</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_13"> + <item> + <widget class="QGroupBox" name="groupBox_8"> + <property name="title"> + <string>Model Dimensions (mm)</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_16"> + <item> + <widget class="QWidget" name="widget_4" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>160</height> + </size> + </property> + <widget class="QLabel" name="label_44"> + <property name="geometry"> + <rect> + <x>30</x> + <y>30</y> + <width>71</width> + <height>111</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/clip_side.png</pixmap> + </property> + </widget> + <widget class="QSpinBox" name="clip_theight_spin"> + <property name="geometry"> + <rect> + <x>100</x> + <y>50</y> + <width>46</width> + <height>22</height> + </rect> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + <widget class="QSpinBox" name="clip_tlength_spin"> + <property name="geometry"> + <rect> + <x>60</x> + <y>10</y> + <width>46</width> + <height>22</height> + </rect> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + <widget class="QSpinBox" name="clip_bheight_spin"> + <property name="geometry"> + <rect> + <x>100</x> + <y>90</y> + <width>46</width> + <height>22</height> + </rect> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + <widget class="QLabel" name="label_50"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>46</width> + <height>13</height> + </rect> + </property> + <property name="text"> + <string>Side</string> + </property> + </widget> + <widget class="QSpinBox" name="clip_blength_spin"> + <property name="geometry"> + <rect> + <x>40</x> + <y>140</y> + <width>46</width> + <height>22</height> + </rect> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + <widget class="QLabel" name="label_52"> + <property name="geometry"> + <rect> + <x>70</x> + <y>70</y> + <width>16</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>R</string> + </property> + </widget> + </widget> + </item> + <item> + <widget class="QWidget" name="widget_3" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>140</height> + </size> + </property> + <widget class="QLabel" name="label_51"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>46</width> + <height>13</height> + </rect> + </property> + <property name="text"> + <string>Front</string> + </property> + </widget> + <widget class="QLabel" name="label_45"> + <property name="geometry"> + <rect> + <x>40</x> + <y>30</y> + <width>21</width> + <height>111</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/clip_front.png</pixmap> + </property> + </widget> + <widget class="QLabel" name="label_53"> + <property name="geometry"> + <rect> + <x>60</x> + <y>70</y> + <width>16</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>R</string> + </property> + </widget> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_6"> + <attribute name="title"> + <string>Cap</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_14"> + <item> + <widget class="QGroupBox" name="groupBox_9"> + <property name="title"> + <string>Model Dimensions (mm)</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_15"> + <item> + <widget class="QWidget" name="widget" native="true"> + <property name="minimumSize"> + <size> + <width>140</width> + <height>130</height> + </size> + </property> + <widget class="QLabel" name="label_46"> + <property name="geometry"> + <rect> + <x>20</x> + <y>50</y> + <width>111</width> + <height>81</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/cap_side.png</pixmap> + </property> + </widget> + <widget class="QSpinBox" name="cap_height_spin"> + <property name="geometry"> + <rect> + <x>30</x> + <y>80</y> + <width>46</width> + <height>22</height> + </rect> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + <widget class="QLabel" name="label_54"> + <property name="geometry"> + <rect> + <x>130</x> + <y>50</y> + <width>16</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>R</string> + </property> + </widget> + <widget class="QLabel" name="label_48"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>46</width> + <height>13</height> + </rect> + </property> + <property name="text"> + <string>Side</string> + </property> + </widget> + <widget class="QSpinBox" name="cap_length_spin"> + <property name="geometry"> + <rect> + <x>50</x> + <y>40</y> + <width>46</width> + <height>22</height> + </rect> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </widget> + </item> + <item> + <widget class="QWidget" name="widget_2" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>130</height> + </size> + </property> + <widget class="QLabel" name="label_49"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>46</width> + <height>13</height> + </rect> + </property> + <property name="text"> + <string>Front</string> + </property> + </widget> + <widget class="QLabel" name="label_55"> + <property name="geometry"> + <rect> + <x>30</x> + <y>50</y> + <width>16</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>R</string> + </property> + </widget> + <widget class="QLabel" name="label_47"> + <property name="geometry"> + <rect> + <x>10</x> + <y>50</y> + <width>81</width> + <height>81</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/cap_front.png</pixmap> + </property> + </widget> + <widget class="QSpinBox" name="cap_width_spin"> + <property name="geometry"> + <rect> + <x>50</x> + <y>30</y> + <width>46</width> + <height>22</height> + </rect> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_7"> + <attribute name="title"> + <string>Custom</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_15"> + <item> + <widget class="QGroupBox" name="groupBox_7"> + <property name="title"> + <string>Model Dimensions (mm)</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_12"> + <item> + <widget class="QLabel" name="label_56"> + <property name="text"> + <string><html><head/><body><p>Location of the two remaining model points<br/>with respect to the reference point in default pose</p></body></html></string> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer_4"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_14"> + <item> + <spacer name="horizontalSpacer_14"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>10</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="3" column="2"> + <widget class="QSpinBox" name="m1z_spin"> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLabel" name="label_58"> + <property name="text"> + <string>y:</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QSpinBox" name="m1y_spin"> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLabel" name="label_57"> + <property name="text"> + <string>z:</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_60"> + <property name="text"> + <string>M1:</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QSpinBox" name="m1x_spin"> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="label_63"> + <property name="text"> + <string>x:</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer_15"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QGridLayout" name="gridLayout_5"> + <item row="1" column="2"> + <widget class="QSpinBox" name="m2x_spin"> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="label_67"> + <property name="text"> + <string>x:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLabel" name="label_69"> + <property name="text"> + <string>z:</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QSpinBox" name="m2y_spin"> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLabel" name="label_70"> + <property name="text"> + <string>y:</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_64"> + <property name="text"> + <string>M2:</string> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QSpinBox" name="m2z_spin"> + <property name="suffix"> + <string/> + </property> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer_16"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>10</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer_3"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_10"> + <property name="title"> + <string>Model Position (mm)</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_11"> + <item> + <widget class="QLabel" name="label_59"> + <property name="text"> + <string><html><head/><body><p>Translation from head center to model reference point<br/> in default pose</p></body></html></string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_17"> + <item> + <spacer name="horizontalSpacer_17"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>10</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QGridLayout" name="gridLayout_6"> + <item row="3" column="1"> + <widget class="QSpinBox" name="tz_spin"> + <property name="suffix"> + <string/> + </property> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_61"> + <property name="text"> + <string>x:</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_62"> + <property name="text"> + <string>y:</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_66"> + <property name="text"> + <string>z:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QSpinBox" name="ty_spin"> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="tx_spin"> + <property name="minimum"> + <number>-999</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer_18"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="tcalib_button"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Calibrate</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_19"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>10</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_3"> + <attribute name="title"> + <string>About</string> + </attribute> + <widget class="QLabel" name="label_10"> + <property name="geometry"> + <rect> + <x>30</x> + <y>30</y> + <width>161</width> + <height>111</height> + </rect> + </property> + <property name="text"> + <string><html><head/><body><p><span style=" font-weight:600;">FTNoIR PointTracker Plugin<br/>Version 1.1</span></p><p><span style=" font-weight:600;">by Patrick Ruoff</span></p><p><a href="http://ftnoirpt.sourceforge.net/"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">Manual (external)</span></a></p></body></html></string> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + <widget class="QLabel" name="label_35"> + <property name="geometry"> + <rect> + <x>200</x> + <y>30</y> + <width>141</width> + <height>141</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/Logo_IR.png</pixmap> + </property> + </widget> + </widget> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_5"> + <property name="title"> + <string>Status</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <item> + <layout class="QFormLayout" name="formLayout"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_38"> + <property name="text"> + <string>Camera Info:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="caminfo_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>120</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Extracted Points:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="pointinfo_label"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QPushButton" name="btnApply"> + <property name="text"> + <string>Save</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_6"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="ok_button"> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="text"> + <string>Ok</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancel_button"> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <tabstops> + <tabstop>tabWidget</tabstop> + <tabstop>reset_spin</tabstop> + <tabstop>camdevice_combo</tabstop> + <tabstop>res_x_spin</tabstop> + <tabstop>res_y_spin</tabstop> + <tabstop>fps_spin</tabstop> + <tabstop>f_dspin</tabstop> + <tabstop>camroll_combo</tabstop> + <tabstop>campitch_spin</tabstop> + <tabstop>camyaw_spin</tabstop> + <tabstop>threshold_slider</tabstop> + <tabstop>mindiam_spin</tabstop> + <tabstop>maxdiam_spin</tabstop> + <tabstop>model_tabs</tabstop> + <tabstop>clip_tlength_spin</tabstop> + <tabstop>clip_theight_spin</tabstop> + <tabstop>clip_bheight_spin</tabstop> + <tabstop>clip_blength_spin</tabstop> + <tabstop>cap_length_spin</tabstop> + <tabstop>cap_height_spin</tabstop> + <tabstop>cap_width_spin</tabstop> + <tabstop>m1x_spin</tabstop> + <tabstop>m1y_spin</tabstop> + <tabstop>m1z_spin</tabstop> + <tabstop>m2x_spin</tabstop> + <tabstop>m2y_spin</tabstop> + <tabstop>m2z_spin</tabstop> + <tabstop>tx_spin</tabstop> + <tabstop>ty_spin</tabstop> + <tabstop>tz_spin</tabstop> + <tabstop>tcalib_button</tabstop> + <tabstop>ok_button</tabstop> + <tabstop>cancel_button</tabstop> + </tabstops> + <resources> + <include location="ftnoir_tracker_pt.qrc"/> + </resources> + <connections> + <connection> + <sender>dynpose_check</sender> + <signal>toggled(bool)</signal> + <receiver>reset_spin</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>172</x> + <y>110</y> + </hint> + <hint type="destinationlabel"> + <x>351</x> + <y>112</y> + </hint> + </hints> + </connection> + </connections> + <slots> + <slot>startEngineClicked()</slot> + <slot>stopEngineClicked()</slot> + <slot>cameraSettingsClicked()</slot> + </slots> +</ui> diff --git a/ftnoir_tracker_pt/Resources/Logo_IR.png b/ftnoir_tracker_pt/Resources/Logo_IR.png index 95032a25..85590691 100644 Binary files a/ftnoir_tracker_pt/Resources/Logo_IR.png and b/ftnoir_tracker_pt/Resources/Logo_IR.png differ diff --git a/ftnoir_tracker_pt/Resources/cap_front.png b/ftnoir_tracker_pt/Resources/cap_front.png index 14207a67..cbee28c9 100644 Binary files a/ftnoir_tracker_pt/Resources/cap_front.png and b/ftnoir_tracker_pt/Resources/cap_front.png differ diff --git a/ftnoir_tracker_pt/Resources/cap_side.png b/ftnoir_tracker_pt/Resources/cap_side.png index 5ad4ee65..27c28341 100644 Binary files a/ftnoir_tracker_pt/Resources/cap_side.png and b/ftnoir_tracker_pt/Resources/cap_side.png differ diff --git a/ftnoir_tracker_pt/Resources/clip_front.png b/ftnoir_tracker_pt/Resources/clip_front.png index 04880138..63fd70eb 100644 Binary files a/ftnoir_tracker_pt/Resources/clip_front.png and b/ftnoir_tracker_pt/Resources/clip_front.png differ diff --git a/ftnoir_tracker_pt/Resources/clip_side.png b/ftnoir_tracker_pt/Resources/clip_side.png index 72667ac7..1c295506 100644 Binary files a/ftnoir_tracker_pt/Resources/clip_side.png and b/ftnoir_tracker_pt/Resources/clip_side.png differ diff --git a/ftnoir_tracker_pt/camera.cpp b/ftnoir_tracker_pt/camera.cpp index 33e0ef2a..686e1b9b 100644 --- a/ftnoir_tracker_pt/camera.cpp +++ b/ftnoir_tracker_pt/camera.cpp @@ -1,346 +1,346 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - - #if defined(OPENTRACK_API) && defined(_WIN32) -#include <windows.h> -#include <dshow.h> -#endif - -#include "camera.h" -#include <string> -#include <QDebug> - -using namespace cv; - -#if defined(OPENTRACK_API) && (defined(__unix) || defined(__linux) || defined(__APPLE__)) -#include <unistd.h> -#endif - -#ifdef OPENTRACK_API -void get_camera_device_names(std::vector<std::string>& device_names) { -# if defined(_WIN32) - // Create the System Device Enumerator. - HRESULT hr; - ICreateDevEnum *pSysDevEnum = NULL; - hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **)&pSysDevEnum); - if (FAILED(hr)) - { - return; - } - // Obtain a class enumerator for the video compressor category. - IEnumMoniker *pEnumCat = NULL; - hr = pSysDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEnumCat, 0); - - if (hr == S_OK) { - // Enumerate the monikers. - IMoniker *pMoniker = NULL; - ULONG cFetched; - while (pEnumCat->Next(1, &pMoniker, &cFetched) == S_OK) { - IPropertyBag *pPropBag; - hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pPropBag); - if (SUCCEEDED(hr)) { - // To retrieve the filter's friendly name, do the following: - VARIANT varName; - VariantInit(&varName); - hr = pPropBag->Read(L"FriendlyName", &varName, 0); - if (SUCCEEDED(hr)) - { - auto wstr = std::wstring(varName.bstrVal); - auto str = std::string(wstr.begin(), wstr.end()); - device_names.push_back(str); - } - VariantClear(&varName); - - ////// To create an instance of the filter, do the following: - ////IBaseFilter *pFilter; - ////hr = pMoniker->BindToObject(NULL, NULL, IID_IBaseFilter, - //// (void**)&pFilter); - // Now add the filter to the graph. - //Remember to release pFilter later. - pPropBag->Release(); - } - pMoniker->Release(); - } - pEnumCat->Release(); - } - pSysDevEnum->Release(); -# else - for (int i = 0; i < 16; i++) { - char buf[128]; - sprintf(buf, "/dev/video%d", i); - if (access(buf, R_OK | W_OK) == 0) { - device_names.push_back(std::string(buf)); - } - } -# endif -} -#else -// ---------------------------------------------------------------------------- -void get_camera_device_names(std::vector<std::string>& device_names) -{ - videoInput VI; - VI.listDevices(); - std::string device_name; - for(int index = 0; ; ++index) { - device_name = VI.getDeviceName(index); - if (device_name.empty()) break; - device_names.push_back(device_name); - } -} -#endif - -// ---------------------------------------------------------------------------- -void Camera::set_device_index(int index) -{ - if (desired_index != index) - { - desired_index = index; - _set_device_index(); - - // reset fps - dt_valid = 0; - dt_mean = 0; - active_index = index; - } -} - -void Camera::set_f(float f) -{ - if (cam_desired.f != f) - { - cam_desired.f = f; - _set_f(); - } -} -void Camera::set_fps(int fps) -{ - if (cam_desired.fps != fps) - { - cam_desired.fps = fps; - _set_fps(); - } -} - -void Camera::set_res(int x_res, int y_res) -{ - if (cam_desired.res_x != x_res || cam_desired.res_y != y_res) - { - cam_desired.res_x = x_res; - cam_desired.res_y = y_res; - _set_res(); - _set_fps(); - } -} - -bool Camera::get_frame(float dt, cv::Mat* frame) -{ - bool new_frame = _get_frame(frame); - // measure fps of valid frames - const float dt_smoothing_const = 0.9; - dt_valid += dt; - if (new_frame) - { - dt_mean = dt_smoothing_const * dt_mean + (1.0 - dt_smoothing_const) * dt_valid; - cam_info.fps = 1.0 / dt_mean; - dt_valid = 0; - } - return new_frame; -} - -// ---------------------------------------------------------------------------- -#ifdef OPENTRACK_API -void CVCamera::start() -{ - cap = new VideoCapture(desired_index); - // extract camera info - if (cap->isOpened()) - { - active = true; - active_index = desired_index; - cam_info.res_x = cap->get(CV_CAP_PROP_FRAME_WIDTH); - cam_info.res_y = cap->get(CV_CAP_PROP_FRAME_HEIGHT); - } else { - delete cap; - cap = nullptr; - } -} - -void CVCamera::stop() -{ - if (cap) - { - cap->release(); - delete cap; - } - active = false; -} - -bool CVCamera::_get_frame(Mat* frame) -{ - if (cap && cap->isOpened()) - { - Mat img; - for (int i = 0; i < 100 && !cap->read(img); i++) - ;; - - if (img.empty()) - return false; - - *frame = img; - return true; - } - return false; -} - -void CVCamera::_set_index() -{ - if (active) restart(); -} - -void CVCamera::_set_f() -{ - cam_info.f = cam_desired.f; -} - -void CVCamera::_set_fps() -{ - if (cap) cap->set(CV_CAP_PROP_FPS, cam_desired.fps); -} - -void CVCamera::_set_res() -{ - if (cap) - { - cap->set(CV_CAP_PROP_FRAME_WIDTH, cam_desired.res_x); - cap->set(CV_CAP_PROP_FRAME_HEIGHT, cam_desired.res_y); - cam_info.res_x = cap->get(CV_CAP_PROP_FRAME_WIDTH); - cam_info.res_y = cap->get(CV_CAP_PROP_FRAME_HEIGHT); - } -} -void CVCamera::_set_device_index() -{ - if (cap) - { - cap->release(); - delete cap; - } - cap = new VideoCapture(desired_index); -} - -#else -// ---------------------------------------------------------------------------- -VICamera::VICamera() : frame_buffer(NULL) -{ - VI.listDevices(); -} - -void VICamera::start() -{ - if (desired_index >= 0) - { - if (cam_desired.res_x == 0 || cam_desired.res_y == 0) - VI.setupDevice(desired_index); - else - VI.setupDevice(desired_index, cam_desired.res_x, cam_desired.res_y); - - active = true; - active_index = desired_index; - - cam_info.res_x = VI.getWidth(active_index); - cam_info.res_y = VI.getHeight(active_index); - new_frame = cv::Mat(cam_info.res_y, cam_info.res_x, CV_8UC3); - // If matrix is not continuous we have to copy manually via frame_buffer - if (!new_frame.isContinuous()) { - unsigned int size = VI.getSize(active_index); - frame_buffer = new unsigned char[size]; - } - } -} - -void VICamera::stop() -{ - if (active) - { - VI.stopDevice(active_index); - } - if (frame_buffer) - { - delete[] frame_buffer; - frame_buffer = NULL; - } - active = false; -} - -bool VICamera::_get_frame(Mat* frame) -{ - if (active && VI.isFrameNew(active_index)) - { - if (new_frame.isContinuous()) - { - VI.getPixels(active_index, new_frame.data, false, true); - } - else - { - // If matrix is not continuous we have to copy manually via frame_buffer - VI.getPixels(active_index, frame_buffer, false, true); - new_frame = cv::Mat(cam_info.res_y, cam_info.res_x, CV_8UC3, frame_buffer).clone(); - } - *frame = new_frame; - return true; - } - return false; -} - -void VICamera::_set_device_index() -{ - if (active) restart(); -} - -void VICamera::_set_f() -{ - cam_info.f = cam_desired.f; -} - -void VICamera::_set_fps() -{ - bool was_active = active; - if (active) stop(); - VI.setIdealFramerate(desired_index, cam_desired.fps); - if (was_active) start(); -} - -void VICamera::_set_res() -{ - if (active) restart(); -} -#endif - -// ---------------------------------------------------------------------------- -Mat FrameRotation::rotate_frame(Mat frame) -{ - switch (rotation) - { - case CLOCKWISE: - { - Mat dst; - transpose(frame, dst); - flip(dst, dst, 1); - return dst; - } - - case COUNTER_CLOCKWISE: - { - Mat dst; - transpose(frame, dst); - flip(dst, dst, 0); - return dst; - } - - default: - return frame; - } -} +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + + #if defined(OPENTRACK_API) && defined(_WIN32) +#include <windows.h> +#include <dshow.h> +#endif + +#include "camera.h" +#include <string> +#include <QDebug> + +using namespace cv; + +#if defined(OPENTRACK_API) && (defined(__unix) || defined(__linux) || defined(__APPLE__)) +#include <unistd.h> +#endif + +#ifdef OPENTRACK_API +void get_camera_device_names(std::vector<std::string>& device_names) { +# if defined(_WIN32) + // Create the System Device Enumerator. + HRESULT hr; + ICreateDevEnum *pSysDevEnum = NULL; + hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **)&pSysDevEnum); + if (FAILED(hr)) + { + return; + } + // Obtain a class enumerator for the video compressor category. + IEnumMoniker *pEnumCat = NULL; + hr = pSysDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEnumCat, 0); + + if (hr == S_OK) { + // Enumerate the monikers. + IMoniker *pMoniker = NULL; + ULONG cFetched; + while (pEnumCat->Next(1, &pMoniker, &cFetched) == S_OK) { + IPropertyBag *pPropBag; + hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pPropBag); + if (SUCCEEDED(hr)) { + // To retrieve the filter's friendly name, do the following: + VARIANT varName; + VariantInit(&varName); + hr = pPropBag->Read(L"FriendlyName", &varName, 0); + if (SUCCEEDED(hr)) + { + auto wstr = std::wstring(varName.bstrVal); + auto str = std::string(wstr.begin(), wstr.end()); + device_names.push_back(str); + } + VariantClear(&varName); + + ////// To create an instance of the filter, do the following: + ////IBaseFilter *pFilter; + ////hr = pMoniker->BindToObject(NULL, NULL, IID_IBaseFilter, + //// (void**)&pFilter); + // Now add the filter to the graph. + //Remember to release pFilter later. + pPropBag->Release(); + } + pMoniker->Release(); + } + pEnumCat->Release(); + } + pSysDevEnum->Release(); +# else + for (int i = 0; i < 16; i++) { + char buf[128]; + sprintf(buf, "/dev/video%d", i); + if (access(buf, R_OK | W_OK) == 0) { + device_names.push_back(std::string(buf)); + } + } +# endif +} +#else +// ---------------------------------------------------------------------------- +void get_camera_device_names(std::vector<std::string>& device_names) +{ + videoInput VI; + VI.listDevices(); + std::string device_name; + for(int index = 0; ; ++index) { + device_name = VI.getDeviceName(index); + if (device_name.empty()) break; + device_names.push_back(device_name); + } +} +#endif + +// ---------------------------------------------------------------------------- +void Camera::set_device_index(int index) +{ + if (desired_index != index) + { + desired_index = index; + _set_device_index(); + + // reset fps + dt_valid = 0; + dt_mean = 0; + active_index = index; + } +} + +void Camera::set_f(float f) +{ + if (cam_desired.f != f) + { + cam_desired.f = f; + _set_f(); + } +} +void Camera::set_fps(int fps) +{ + if (cam_desired.fps != fps) + { + cam_desired.fps = fps; + _set_fps(); + } +} + +void Camera::set_res(int x_res, int y_res) +{ + if (cam_desired.res_x != x_res || cam_desired.res_y != y_res) + { + cam_desired.res_x = x_res; + cam_desired.res_y = y_res; + _set_res(); + _set_fps(); + } +} + +bool Camera::get_frame(float dt, cv::Mat* frame) +{ + bool new_frame = _get_frame(frame); + // measure fps of valid frames + const float dt_smoothing_const = 0.9; + dt_valid += dt; + if (new_frame) + { + dt_mean = dt_smoothing_const * dt_mean + (1.0 - dt_smoothing_const) * dt_valid; + cam_info.fps = 1.0 / dt_mean; + dt_valid = 0; + } + return new_frame; +} + +// ---------------------------------------------------------------------------- +#ifdef OPENTRACK_API +void CVCamera::start() +{ + cap = new VideoCapture(desired_index); + // extract camera info + if (cap->isOpened()) + { + active = true; + active_index = desired_index; + cam_info.res_x = cap->get(CV_CAP_PROP_FRAME_WIDTH); + cam_info.res_y = cap->get(CV_CAP_PROP_FRAME_HEIGHT); + } else { + delete cap; + cap = nullptr; + } +} + +void CVCamera::stop() +{ + if (cap) + { + cap->release(); + delete cap; + } + active = false; +} + +bool CVCamera::_get_frame(Mat* frame) +{ + if (cap && cap->isOpened()) + { + Mat img; + for (int i = 0; i < 100 && !cap->read(img); i++) + ;; + + if (img.empty()) + return false; + + *frame = img; + return true; + } + return false; +} + +void CVCamera::_set_index() +{ + if (active) restart(); +} + +void CVCamera::_set_f() +{ + cam_info.f = cam_desired.f; +} + +void CVCamera::_set_fps() +{ + if (cap) cap->set(CV_CAP_PROP_FPS, cam_desired.fps); +} + +void CVCamera::_set_res() +{ + if (cap) + { + cap->set(CV_CAP_PROP_FRAME_WIDTH, cam_desired.res_x); + cap->set(CV_CAP_PROP_FRAME_HEIGHT, cam_desired.res_y); + cam_info.res_x = cap->get(CV_CAP_PROP_FRAME_WIDTH); + cam_info.res_y = cap->get(CV_CAP_PROP_FRAME_HEIGHT); + } +} +void CVCamera::_set_device_index() +{ + if (cap) + { + cap->release(); + delete cap; + } + cap = new VideoCapture(desired_index); +} + +#else +// ---------------------------------------------------------------------------- +VICamera::VICamera() : frame_buffer(NULL) +{ + VI.listDevices(); +} + +void VICamera::start() +{ + if (desired_index >= 0) + { + if (cam_desired.res_x == 0 || cam_desired.res_y == 0) + VI.setupDevice(desired_index); + else + VI.setupDevice(desired_index, cam_desired.res_x, cam_desired.res_y); + + active = true; + active_index = desired_index; + + cam_info.res_x = VI.getWidth(active_index); + cam_info.res_y = VI.getHeight(active_index); + new_frame = cv::Mat(cam_info.res_y, cam_info.res_x, CV_8UC3); + // If matrix is not continuous we have to copy manually via frame_buffer + if (!new_frame.isContinuous()) { + unsigned int size = VI.getSize(active_index); + frame_buffer = new unsigned char[size]; + } + } +} + +void VICamera::stop() +{ + if (active) + { + VI.stopDevice(active_index); + } + if (frame_buffer) + { + delete[] frame_buffer; + frame_buffer = NULL; + } + active = false; +} + +bool VICamera::_get_frame(Mat* frame) +{ + if (active && VI.isFrameNew(active_index)) + { + if (new_frame.isContinuous()) + { + VI.getPixels(active_index, new_frame.data, false, true); + } + else + { + // If matrix is not continuous we have to copy manually via frame_buffer + VI.getPixels(active_index, frame_buffer, false, true); + new_frame = cv::Mat(cam_info.res_y, cam_info.res_x, CV_8UC3, frame_buffer).clone(); + } + *frame = new_frame; + return true; + } + return false; +} + +void VICamera::_set_device_index() +{ + if (active) restart(); +} + +void VICamera::_set_f() +{ + cam_info.f = cam_desired.f; +} + +void VICamera::_set_fps() +{ + bool was_active = active; + if (active) stop(); + VI.setIdealFramerate(desired_index, cam_desired.fps); + if (was_active) start(); +} + +void VICamera::_set_res() +{ + if (active) restart(); +} +#endif + +// ---------------------------------------------------------------------------- +Mat FrameRotation::rotate_frame(Mat frame) +{ + switch (rotation) + { + case CLOCKWISE: + { + Mat dst; + transpose(frame, dst); + flip(dst, dst, 1); + return dst; + } + + case COUNTER_CLOCKWISE: + { + Mat dst; + transpose(frame, dst); + flip(dst, dst, 0); + return dst; + } + + default: + return frame; + } +} diff --git a/ftnoir_tracker_pt/camera.h b/ftnoir_tracker_pt/camera.h index a9f60841..733cc61f 100644 --- a/ftnoir_tracker_pt/camera.h +++ b/ftnoir_tracker_pt/camera.h @@ -1,145 +1,145 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - -#ifndef CAMERA_H -#define CAMERA_H - -#include <opencv2/opencv.hpp> -#ifndef OPENTRACK_API -# include <boost/shared_ptr.hpp> -#else +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#ifndef CAMERA_H +#define CAMERA_H + +#include <opencv2/opencv.hpp> +#ifndef OPENTRACK_API +# include <boost/shared_ptr.hpp> +#else # include <memory> -# include <opencv2/highgui/highgui.hpp> -# include <opencv2/highgui/highgui_c.h> -#endif -#include <string> - -// ---------------------------------------------------------------------------- -void get_camera_device_names(std::vector<std::string>& device_names); - - -// ---------------------------------------------------------------------------- -struct CamInfo -{ - CamInfo() : res_x(0), res_y(0), fps(0), f(1) {} - - int res_x; - int res_y; - int fps; - float f; // (focal length) / (sensor width) -}; - -// ---------------------------------------------------------------------------- -// Base class for cameras, calculates the frame rate -class Camera -{ -public: - Camera() : dt_valid(0), dt_mean(0), desired_index(0), active_index(-1), active(false) {} - virtual ~Camera() {} - - // start/stop capturing - virtual void start() = 0; - virtual void stop() = 0; - void restart() { stop(); start(); } - - // calls corresponding template methods and reinitializes frame rate calculation - void set_device_index(int index); - void set_f(float f); - void set_fps(int fps); - void set_res(int x_res, int y_res); - - // gets a frame from the camera, dt: time since last call in seconds - bool get_frame(float dt, cv::Mat* frame); - - // WARNING: returned references are valid as long as object - const CamInfo& get_info() const { return cam_info; } - const CamInfo& get_desired() const { return cam_desired; } - -protected: - // get a frame from the camera - virtual bool _get_frame(cv::Mat* frame) = 0; - - // update the camera using cam_desired, write res and f to cam_info if successful - virtual void _set_device_index() = 0; - virtual void _set_f() = 0; - virtual void _set_fps() = 0; - virtual void _set_res() = 0; - - float dt_valid; - float dt_mean; - int desired_index; - int active_index; - bool active; - CamInfo cam_info; - CamInfo cam_desired; -}; - - -// ---------------------------------------------------------------------------- -// camera based on OpenCV's videoCapture -#ifdef OPENTRACK_API -class CVCamera : public Camera -{ -public: - CVCamera() : cap(NULL) {} - ~CVCamera() { stop(); } - - virtual void start(); - virtual void stop(); - -protected: - virtual bool _get_frame(cv::Mat* frame); - virtual void _set_index(); - virtual void _set_f(); - virtual void _set_fps(); - virtual void _set_res(); - virtual void _set_device_index(); - - cv::VideoCapture* cap; -}; -#else -// ---------------------------------------------------------------------------- -// Camera based on the videoInput library -class VICamera : public Camera -{ -public: - VICamera(); - ~VICamera() { stop(); } - - virtual void start(); - virtual void stop(); - -protected: - virtual bool _get_frame(cv::Mat* frame); - virtual void _set_device_index(); - virtual void _set_f(); - virtual void _set_fps(); - virtual void _set_res(); - - videoInput VI; - cv::Mat new_frame; - unsigned char* frame_buffer; -}; -#endif - -enum RotationType -{ - CLOCKWISE = 0, - ZERO = 1, - COUNTER_CLOCKWISE = 2 -}; - -// ---------------------------------------------------------------------------- -class FrameRotation -{ -public: - RotationType rotation; - - cv::Mat rotate_frame(cv::Mat frame); -}; - -#endif //CAMERA_H +# include <opencv2/highgui/highgui.hpp> +# include <opencv2/highgui/highgui_c.h> +#endif +#include <string> + +// ---------------------------------------------------------------------------- +void get_camera_device_names(std::vector<std::string>& device_names); + + +// ---------------------------------------------------------------------------- +struct CamInfo +{ + CamInfo() : res_x(0), res_y(0), fps(0), f(1) {} + + int res_x; + int res_y; + int fps; + float f; // (focal length) / (sensor width) +}; + +// ---------------------------------------------------------------------------- +// Base class for cameras, calculates the frame rate +class Camera +{ +public: + Camera() : dt_valid(0), dt_mean(0), desired_index(0), active_index(-1), active(false) {} + virtual ~Camera() {} + + // start/stop capturing + virtual void start() = 0; + virtual void stop() = 0; + void restart() { stop(); start(); } + + // calls corresponding template methods and reinitializes frame rate calculation + void set_device_index(int index); + void set_f(float f); + void set_fps(int fps); + void set_res(int x_res, int y_res); + + // gets a frame from the camera, dt: time since last call in seconds + bool get_frame(float dt, cv::Mat* frame); + + // WARNING: returned references are valid as long as object + const CamInfo& get_info() const { return cam_info; } + const CamInfo& get_desired() const { return cam_desired; } + +protected: + // get a frame from the camera + virtual bool _get_frame(cv::Mat* frame) = 0; + + // update the camera using cam_desired, write res and f to cam_info if successful + virtual void _set_device_index() = 0; + virtual void _set_f() = 0; + virtual void _set_fps() = 0; + virtual void _set_res() = 0; + + float dt_valid; + float dt_mean; + int desired_index; + int active_index; + bool active; + CamInfo cam_info; + CamInfo cam_desired; +}; + + +// ---------------------------------------------------------------------------- +// camera based on OpenCV's videoCapture +#ifdef OPENTRACK_API +class CVCamera : public Camera +{ +public: + CVCamera() : cap(NULL) {} + ~CVCamera() { stop(); } + + virtual void start(); + virtual void stop(); + +protected: + virtual bool _get_frame(cv::Mat* frame); + virtual void _set_index(); + virtual void _set_f(); + virtual void _set_fps(); + virtual void _set_res(); + virtual void _set_device_index(); + + cv::VideoCapture* cap; +}; +#else +// ---------------------------------------------------------------------------- +// Camera based on the videoInput library +class VICamera : public Camera +{ +public: + VICamera(); + ~VICamera() { stop(); } + + virtual void start(); + virtual void stop(); + +protected: + virtual bool _get_frame(cv::Mat* frame); + virtual void _set_device_index(); + virtual void _set_f(); + virtual void _set_fps(); + virtual void _set_res(); + + videoInput VI; + cv::Mat new_frame; + unsigned char* frame_buffer; +}; +#endif + +enum RotationType +{ + CLOCKWISE = 0, + ZERO = 1, + COUNTER_CLOCKWISE = 2 +}; + +// ---------------------------------------------------------------------------- +class FrameRotation +{ +public: + RotationType rotation; + + cv::Mat rotate_frame(cv::Mat frame); +}; + +#endif //CAMERA_H diff --git a/ftnoir_tracker_pt/doc/logo.png b/ftnoir_tracker_pt/doc/logo.png index 95032a25..85590691 100644 Binary files a/ftnoir_tracker_pt/doc/logo.png and b/ftnoir_tracker_pt/doc/logo.png differ diff --git a/ftnoir_tracker_pt/doc/settings1.png b/ftnoir_tracker_pt/doc/settings1.png index 35b84c5c..0725f5f4 100644 Binary files a/ftnoir_tracker_pt/doc/settings1.png and b/ftnoir_tracker_pt/doc/settings1.png differ diff --git a/ftnoir_tracker_pt/doc/settings2.png b/ftnoir_tracker_pt/doc/settings2.png index c6cfd1f3..382ed13a 100644 Binary files a/ftnoir_tracker_pt/doc/settings2.png and b/ftnoir_tracker_pt/doc/settings2.png differ diff --git a/ftnoir_tracker_pt/doc/settings3.png b/ftnoir_tracker_pt/doc/settings3.png index 5922403d..821453d1 100644 Binary files a/ftnoir_tracker_pt/doc/settings3.png and b/ftnoir_tracker_pt/doc/settings3.png differ diff --git a/ftnoir_tracker_pt/doc/style.css b/ftnoir_tracker_pt/doc/style.css index a8d3e333..0c3d29a6 100644 --- a/ftnoir_tracker_pt/doc/style.css +++ b/ftnoir_tracker_pt/doc/style.css @@ -1,131 +1,131 @@ -body { - width: 1000px; - font-size: 13px; - color: #000000; - padding: 0; - margin: 0 auto; - background: #444444; - font-family: verdana,arial; -} - -table { - border-width: 3px; - border-color: #0000FF; - border-style: ridge; - margin-top: 5px; - background-color: #E0E0FF; -} - -table.blind { - border: none; - background-color: #E6E6E6; -} - -fieldset.blind { - border: none; -} - -h1 { font-size: 160%; } -h2 { font-size: 140%; } -h3 { font-size: 115%; } - -.indent { - margin-left: 25px; -} - -p -{ - margin-left: 10px; -} - -li -{ - margin: 10px; -} - - -dl -{ - /*width: 80%;*/ - border-bottom: 1px solid #999; -} - -dt -{ - padding-top: 5px; - font-weight: bold; - border-top: 1px solid #999; -} - -dd -{ - padding: 5px; -} - - -hr { - color: #688938; -} - -a:link, a:visited { - color: #0000BF; -} -a:hover { - color: #0000FF; -} - -a.nav { - position: relative; - top: -30px; - display: block; - visibility: hidden; -} - -#navbar { - width: 1000px; - height: 30px; - background-color:#1a1a1b; - position: fixed; - margin: 0 auto; - padding: 0; -} - -#navbar ul -{ - list-style-type: none; - margin: 0 auto; - padding: 0; - overflow: hidden; -} - -#navbar li -{ - margin: 0 auto; - padding: 5px; - float:left; -} - -#navbar a:link,a:visited -{ - display:block; - width:150px; - font-weight:bold; - color:#e85d02; - text-align:center; - /*padding:4px;*/ - text-decoration:none; - /*text-transform:uppercase;*/ -} - -#navbar a:hover,a:active -{ - color:#ffffff; -} - -#content { - background-color:#ffffff; - padding: 15px; - padding-top: 40px; - padding-right: 40px; - margin: 0 auto; -} +body { + width: 1000px; + font-size: 13px; + color: #000000; + padding: 0; + margin: 0 auto; + background: #444444; + font-family: verdana,arial; +} + +table { + border-width: 3px; + border-color: #0000FF; + border-style: ridge; + margin-top: 5px; + background-color: #E0E0FF; +} + +table.blind { + border: none; + background-color: #E6E6E6; +} + +fieldset.blind { + border: none; +} + +h1 { font-size: 160%; } +h2 { font-size: 140%; } +h3 { font-size: 115%; } + +.indent { + margin-left: 25px; +} + +p +{ + margin-left: 10px; +} + +li +{ + margin: 10px; +} + + +dl +{ + /*width: 80%;*/ + border-bottom: 1px solid #999; +} + +dt +{ + padding-top: 5px; + font-weight: bold; + border-top: 1px solid #999; +} + +dd +{ + padding: 5px; +} + + +hr { + color: #688938; +} + +a:link, a:visited { + color: #0000BF; +} +a:hover { + color: #0000FF; +} + +a.nav { + position: relative; + top: -30px; + display: block; + visibility: hidden; +} + +#navbar { + width: 1000px; + height: 30px; + background-color:#1a1a1b; + position: fixed; + margin: 0 auto; + padding: 0; +} + +#navbar ul +{ + list-style-type: none; + margin: 0 auto; + padding: 0; + overflow: hidden; +} + +#navbar li +{ + margin: 0 auto; + padding: 5px; + float:left; +} + +#navbar a:link,a:visited +{ + display:block; + width:150px; + font-weight:bold; + color:#e85d02; + text-align:center; + /*padding:4px;*/ + text-decoration:none; + /*text-transform:uppercase;*/ +} + +#navbar a:hover,a:active +{ + color:#ffffff; +} + +#content { + background-color:#ffffff; + padding: 15px; + padding-top: 40px; + padding-right: 40px; + margin: 0 auto; +} diff --git a/ftnoir_tracker_pt/frame_observer.cpp b/ftnoir_tracker_pt/frame_observer.cpp index 281f3d57..76dee351 100644 --- a/ftnoir_tracker_pt/frame_observer.cpp +++ b/ftnoir_tracker_pt/frame_observer.cpp @@ -1,18 +1,18 @@ -/* Copyright (c) 2013 Patrick Ruoff - * - * 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 "frame_observer.h" - -//----------------------------------------------------------------------------- -FrameProvider::~FrameProvider() -{ - QMutexLocker lock(&observer_mutex); - for (std::set<FrameObserver*>::iterator iter=frame_observers.begin(); iter!=frame_observers.end(); ++iter) - { - (*iter)->on_frame_provider_destroy(); - } -} +/* Copyright (c) 2013 Patrick Ruoff + * + * 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 "frame_observer.h" + +//----------------------------------------------------------------------------- +FrameProvider::~FrameProvider() +{ + QMutexLocker lock(&observer_mutex); + for (std::set<FrameObserver*>::iterator iter=frame_observers.begin(); iter!=frame_observers.end(); ++iter) + { + (*iter)->on_frame_provider_destroy(); + } +} diff --git a/ftnoir_tracker_pt/frame_observer.h b/ftnoir_tracker_pt/frame_observer.h index c3c20259..ca8ffb46 100644 --- a/ftnoir_tracker_pt/frame_observer.h +++ b/ftnoir_tracker_pt/frame_observer.h @@ -1,76 +1,76 @@ -/* Copyright (c) 2013 Patrick Ruoff - * - * 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. - */ - -#ifndef FRAME_OBSERVER_H -#define FRAME_OBSERVER_H - -#include <QMutex> -#include <opencv2/opencv.hpp> -#ifndef OPENTRACK_API -# include <boost/shared_ptr.hpp> -#else +/* Copyright (c) 2013 Patrick Ruoff + * + * 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. + */ + +#ifndef FRAME_OBSERVER_H +#define FRAME_OBSERVER_H + +#include <QMutex> +#include <opencv2/opencv.hpp> +#ifndef OPENTRACK_API +# include <boost/shared_ptr.hpp> +#else # include <memory> -#endif -#include <set> - -//----------------------------------------------------------------------------- -// Forward declarations -class FrameObserver; - -//----------------------------------------------------------------------------- -// Provides means to copy frame and point information if it has observers -// Instantiate a FrameObserver to get the information -class FrameProvider -{ - friend class FrameObserver; -public: - ~FrameProvider(); - -protected: - virtual bool get_frame_and_points(cv::Mat& frame, std::shared_ptr< std::vector<cv::Vec2f> >& points) = 0; - - bool has_observers() const { QMutexLocker lock(&observer_mutex); return !frame_observers.empty(); } - -private: - mutable QMutex observer_mutex; - void add_observer(FrameObserver* obs) { QMutexLocker lock(&observer_mutex); frame_observers.insert(obs); } - void remove_observer(FrameObserver* obs) { QMutexLocker lock(&observer_mutex); frame_observers.erase(obs); } - std::set<FrameObserver*> frame_observers; -}; - -//----------------------------------------------------------------------------- -// Used to get frame and point information from MutexedFrameProvider -// Destroy instance if not interested anymore since a living -// FrameObserver instance causes MutexedFrameProvider to provide the information, -// potentially reducing its performance -class FrameObserver -{ -public: - FrameObserver(FrameProvider* provider) : provider(provider) { - provider->add_observer(this); - } - - ~FrameObserver() { - if (provider) provider->remove_observer(this); - } - - bool get_frame_and_points(cv::Mat& frame, std::shared_ptr< std::vector<cv::Vec2f> >& points) { - return provider ? provider->get_frame_and_points(frame, points) : false; - } - - void on_frame_provider_destroy() { - provider = NULL; - } - -protected: - FrameProvider* provider; - -private: - FrameObserver(const FrameObserver&); -}; - -#endif //FRAME_OBSERVER_H +#endif +#include <set> + +//----------------------------------------------------------------------------- +// Forward declarations +class FrameObserver; + +//----------------------------------------------------------------------------- +// Provides means to copy frame and point information if it has observers +// Instantiate a FrameObserver to get the information +class FrameProvider +{ + friend class FrameObserver; +public: + ~FrameProvider(); + +protected: + virtual bool get_frame_and_points(cv::Mat& frame, std::shared_ptr< std::vector<cv::Vec2f> >& points) = 0; + + bool has_observers() const { QMutexLocker lock(&observer_mutex); return !frame_observers.empty(); } + +private: + mutable QMutex observer_mutex; + void add_observer(FrameObserver* obs) { QMutexLocker lock(&observer_mutex); frame_observers.insert(obs); } + void remove_observer(FrameObserver* obs) { QMutexLocker lock(&observer_mutex); frame_observers.erase(obs); } + std::set<FrameObserver*> frame_observers; +}; + +//----------------------------------------------------------------------------- +// Used to get frame and point information from MutexedFrameProvider +// Destroy instance if not interested anymore since a living +// FrameObserver instance causes MutexedFrameProvider to provide the information, +// potentially reducing its performance +class FrameObserver +{ +public: + FrameObserver(FrameProvider* provider) : provider(provider) { + provider->add_observer(this); + } + + ~FrameObserver() { + if (provider) provider->remove_observer(this); + } + + bool get_frame_and_points(cv::Mat& frame, std::shared_ptr< std::vector<cv::Vec2f> >& points) { + return provider ? provider->get_frame_and_points(frame, points) : false; + } + + void on_frame_provider_destroy() { + provider = NULL; + } + +protected: + FrameProvider* provider; + +private: + FrameObserver(const FrameObserver&); +}; + +#endif //FRAME_OBSERVER_H diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 219c8990..3fa6910d 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -1,264 +1,264 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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 "ftnoir_tracker_pt.h" -#include <QHBoxLayout> -#include <cmath> -#include <QDebug> -#include <QFile> -#include <QCoreApplication> - -using namespace std; -using namespace cv; - -//#define PT_PERF_LOG //log performance - -const float rad2deg = 180.0/3.14159265; -const float deg2rad = 1.0/rad2deg; - -//----------------------------------------------------------------------------- -Tracker::Tracker() - : mutex(QMutex::Recursive), - commands(0), - video_widget(NULL), - video_frame(NULL), - tracking_valid(false), - new_settings(nullptr) - -{ - qDebug()<<"Tracker::Tracker"; -} - -Tracker::~Tracker() -{ - qDebug()<<"Tracker::~Tracker"; - // terminate tracker thread - set_command(ABORT); - wait(); - s.video_widget = false; - delete video_widget; - video_widget = NULL; - if (video_frame->layout()) delete video_frame->layout(); -} - -void Tracker::set_command(Command command) -{ - //QMutexLocker lock(&mutex); - commands |= command; -} - -void Tracker::reset_command(Command command) -{ - //QMutexLocker lock(&mutex); - commands &= ~command; -} - -void Tracker::run() -{ - qDebug()<<"Tracker:: Thread started"; - -#ifdef PT_PERF_LOG - QFile log_file(QCoreApplication::applicationDirPath() + "/PointTrackerPerformance.txt"); - if (!log_file.open(QIODevice::WriteOnly | QIODevice::Text)) return; - QTextStream log_stream(&log_file); -#endif - - time.start(); - double dt; - bool new_frame; - forever - { - if (commands & ABORT) break; - if (commands & PAUSE) continue; - commands = 0; - apply_inner(); - dt = time.start() / 1000000000.; - - new_frame = camera.get_frame(dt, &frame); - - if (new_frame && !frame.empty()) - { - QMutexLocker lock(&mutex); - - frame = frame_rotation.rotate_frame(frame); - const std::vector<cv::Vec2f>& points = point_extractor.extract_points(frame, dt, true); - for (auto p : points) - { - auto p2 = cv::Point(p[0] * frame.cols + frame.cols/2, -p[1] * frame.cols + frame.rows/2); - cv::Scalar color(0, 255, 0); - cv::line(frame, - cv::Point(p2.x - 20, p2.y), - cv::Point(p2.x + 20, p2.y), - color, - 4); - cv::line(frame, - cv::Point(p2.x, p2.y - 20), - cv::Point(p2.x, p2.y + 20), - color, - 4); - } - tracking_valid = point_tracker.track(points, camera.get_info().f, dt); - video_widget->update_image(frame); - } -#ifdef PT_PERF_LOG - log_stream<<"dt: "<<dt; - if (!frame.empty()) log_stream<<" fps: "<<camera.get_info().fps; - log_stream<<"\n"; -#endif - } - - qDebug()<<"Tracker:: Thread stopping"; -} -void Tracker::apply(settings& s) -{ - // caller guarantees object lifetime - new_settings = &s; -} - -void Tracker::apply_inner() -{ - settings* tmp = new_settings.exchange(nullptr); - if (tmp == nullptr) - return; - auto& s = *tmp; - qDebug()<<"Tracker:: Applying settings"; - camera.set_device_index(s.cam_index); - camera.set_res(s.cam_res_x, s.cam_res_y); - camera.set_fps(s.cam_fps); - camera.set_f(s.cam_f); - frame_rotation.rotation = static_cast<RotationType>(static_cast<int>(s.cam_roll)); - point_extractor.threshold_val = s.threshold; - point_extractor.threshold_secondary_val = s.threshold_secondary; - point_extractor.min_size = s.min_point_size; - point_extractor.max_size = s.max_point_size; - { - cv::Vec3f M01(s.m01_x, s.m01_y, s.m01_z); - cv::Vec3f M02(s.m02_x, s.m02_y, s.m02_z); - point_tracker.point_model = std::shared_ptr<PointModel>(new PointModel(M01, M02)); - } - point_tracker.dynamic_pose_resolution = s.dyn_pose_res; - point_tracker.dt_reset = s.reset_time / 1000.0; - t_MH = cv::Vec3f(s.t_MH_x, s.t_MH_y, s.t_MH_z); - R_GC = Matx33f( cos(deg2rad*s.cam_yaw), 0, sin(deg2rad*s.cam_yaw), - 0, 1, 0, - -sin(deg2rad*s.cam_yaw), 0, cos(deg2rad*s.cam_yaw)); - R_GC = R_GC * Matx33f( 1, 0, 0, - 0, cos(deg2rad*s.cam_pitch), sin(deg2rad*s.cam_pitch), - 0, -sin(deg2rad*s.cam_pitch), cos(deg2rad*s.cam_pitch)); - - FrameTrafo X_MH(Matx33f::eye(), t_MH); - X_GH_0 = R_GC * X_MH; - - qDebug()<<"Tracker::apply ends"; -} - -void Tracker::reset() -{ - QMutexLocker lock(&mutex); - point_tracker.reset(); -} - -void Tracker::center() -{ - point_tracker.reset(); // we also do a reset here since there is no reset shortkey yet - QMutexLocker lock(&mutex); - FrameTrafo X_CM_0 = point_tracker.get_pose(); - FrameTrafo X_MH(Matx33f::eye(), t_MH); - X_GH_0 = R_GC * X_CM_0 * X_MH; -} - -bool Tracker::get_frame_and_points(cv::Mat& frame_copy, std::shared_ptr< std::vector<Vec2f> >& points) -{ - QMutexLocker lock(&mutex); - if (frame.empty()) return false; - - // copy the frame and points from the tracker thread - frame_copy = frame.clone(); - points = std::shared_ptr< vector<Vec2f> >(new vector<Vec2f>(point_extractor.get_points())); - return true; -} - -void Tracker::refreshVideo() -{ - if (video_widget) video_widget->update_frame_and_points(); -} - -void Tracker::StartTracker(QFrame *parent_window) -{ - this->video_frame = parent_window; - video_frame->setAttribute(Qt::WA_NativeWindow); - video_frame->show(); - video_widget = new PTVideoWidget(video_frame, this); - QHBoxLayout* video_layout = new QHBoxLayout(parent_window); - video_layout->setContentsMargins(0, 0, 0, 0); - video_layout->addWidget(video_widget); - video_frame->setLayout(video_layout); - video_widget->resize(video_frame->width(), video_frame->height()); - camera.start(); - apply(s); - start(); - reset_command(PAUSE); -} - -#ifndef OPENTRACK_API -void Tracker::StopTracker(bool exit) -{ - set_command(PAUSE); -} -#endif - -#ifdef OPENTRACK_API -#define THeadPoseData double -#endif - -void Tracker::GetHeadPoseData(THeadPoseData *data) -{ - { - QMutexLocker lock(&mutex); - - if (!tracking_valid) return; - - FrameTrafo X_CM = point_tracker.get_pose(); - FrameTrafo X_MH(Matx33f::eye(), t_MH); - FrameTrafo X_GH = R_GC * X_CM * X_MH; - Matx33f R = X_GH.R * X_GH_0.R.t(); - Vec3f t = X_GH.t - X_GH_0.t; - - // get translation(s) - data[TX] = t[0] / 10.0; // convert to cm - data[TY] = t[1] / 10.0; - data[TZ] = t[2] / 10.0; - - // translate rotation matrix from opengl (G) to roll-pitch-yaw (E) frame - // -z -> x, y -> z, x -> -y - Matx33f R_EG( 0, 0,-1, - -1, 0, 0, - 0, 1, 0); - R = R_EG * R * R_EG.t(); - - // extract rotation angles - float alpha, beta, gamma; - beta = atan2( -R(2,0), sqrt(R(2,1)*R(2,1) + R(2,2)*R(2,2)) ); - alpha = atan2( R(1,0), R(0,0)); - gamma = atan2( R(2,1), R(2,2)); - - data[Yaw] = rad2deg * alpha; - data[Pitch] = - rad2deg * beta; // FTNoIR expects a minus here - data[Roll] = rad2deg * gamma; - } -} - -//----------------------------------------------------------------------------- -#ifdef OPENTRACK_API -extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() -#else -#pragma comment(linker, "/export:GetTracker=_GetTracker@0") -OPENTRACK_EXPORT ITrackerPtr __stdcall GetTracker() -#endif -{ - return new Tracker; -} +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 "ftnoir_tracker_pt.h" +#include <QHBoxLayout> +#include <cmath> +#include <QDebug> +#include <QFile> +#include <QCoreApplication> + +using namespace std; +using namespace cv; + +//#define PT_PERF_LOG //log performance + +const float rad2deg = 180.0/3.14159265; +const float deg2rad = 1.0/rad2deg; + +//----------------------------------------------------------------------------- +Tracker::Tracker() + : mutex(QMutex::Recursive), + commands(0), + video_widget(NULL), + video_frame(NULL), + tracking_valid(false), + new_settings(nullptr) + +{ + qDebug()<<"Tracker::Tracker"; +} + +Tracker::~Tracker() +{ + qDebug()<<"Tracker::~Tracker"; + // terminate tracker thread + set_command(ABORT); + wait(); + s.video_widget = false; + delete video_widget; + video_widget = NULL; + if (video_frame->layout()) delete video_frame->layout(); +} + +void Tracker::set_command(Command command) +{ + //QMutexLocker lock(&mutex); + commands |= command; +} + +void Tracker::reset_command(Command command) +{ + //QMutexLocker lock(&mutex); + commands &= ~command; +} + +void Tracker::run() +{ + qDebug()<<"Tracker:: Thread started"; + +#ifdef PT_PERF_LOG + QFile log_file(QCoreApplication::applicationDirPath() + "/PointTrackerPerformance.txt"); + if (!log_file.open(QIODevice::WriteOnly | QIODevice::Text)) return; + QTextStream log_stream(&log_file); +#endif + + time.start(); + double dt; + bool new_frame; + forever + { + if (commands & ABORT) break; + if (commands & PAUSE) continue; + commands = 0; + apply_inner(); + dt = time.start() / 1000000000.; + + new_frame = camera.get_frame(dt, &frame); + + if (new_frame && !frame.empty()) + { + QMutexLocker lock(&mutex); + + frame = frame_rotation.rotate_frame(frame); + const std::vector<cv::Vec2f>& points = point_extractor.extract_points(frame, dt, true); + for (auto p : points) + { + auto p2 = cv::Point(p[0] * frame.cols + frame.cols/2, -p[1] * frame.cols + frame.rows/2); + cv::Scalar color(0, 255, 0); + cv::line(frame, + cv::Point(p2.x - 20, p2.y), + cv::Point(p2.x + 20, p2.y), + color, + 4); + cv::line(frame, + cv::Point(p2.x, p2.y - 20), + cv::Point(p2.x, p2.y + 20), + color, + 4); + } + tracking_valid = point_tracker.track(points, camera.get_info().f, dt); + video_widget->update_image(frame); + } +#ifdef PT_PERF_LOG + log_stream<<"dt: "<<dt; + if (!frame.empty()) log_stream<<" fps: "<<camera.get_info().fps; + log_stream<<"\n"; +#endif + } + + qDebug()<<"Tracker:: Thread stopping"; +} +void Tracker::apply(settings& s) +{ + // caller guarantees object lifetime + new_settings = &s; +} + +void Tracker::apply_inner() +{ + settings* tmp = new_settings.exchange(nullptr); + if (tmp == nullptr) + return; + auto& s = *tmp; + qDebug()<<"Tracker:: Applying settings"; + camera.set_device_index(s.cam_index); + camera.set_res(s.cam_res_x, s.cam_res_y); + camera.set_fps(s.cam_fps); + camera.set_f(s.cam_f); + frame_rotation.rotation = static_cast<RotationType>(static_cast<int>(s.cam_roll)); + point_extractor.threshold_val = s.threshold; + point_extractor.threshold_secondary_val = s.threshold_secondary; + point_extractor.min_size = s.min_point_size; + point_extractor.max_size = s.max_point_size; + { + cv::Vec3f M01(s.m01_x, s.m01_y, s.m01_z); + cv::Vec3f M02(s.m02_x, s.m02_y, s.m02_z); + point_tracker.point_model = std::shared_ptr<PointModel>(new PointModel(M01, M02)); + } + point_tracker.dynamic_pose_resolution = s.dyn_pose_res; + point_tracker.dt_reset = s.reset_time / 1000.0; + t_MH = cv::Vec3f(s.t_MH_x, s.t_MH_y, s.t_MH_z); + R_GC = Matx33f( cos(deg2rad*s.cam_yaw), 0, sin(deg2rad*s.cam_yaw), + 0, 1, 0, + -sin(deg2rad*s.cam_yaw), 0, cos(deg2rad*s.cam_yaw)); + R_GC = R_GC * Matx33f( 1, 0, 0, + 0, cos(deg2rad*s.cam_pitch), sin(deg2rad*s.cam_pitch), + 0, -sin(deg2rad*s.cam_pitch), cos(deg2rad*s.cam_pitch)); + + FrameTrafo X_MH(Matx33f::eye(), t_MH); + X_GH_0 = R_GC * X_MH; + + qDebug()<<"Tracker::apply ends"; +} + +void Tracker::reset() +{ + QMutexLocker lock(&mutex); + point_tracker.reset(); +} + +void Tracker::center() +{ + point_tracker.reset(); // we also do a reset here since there is no reset shortkey yet + QMutexLocker lock(&mutex); + FrameTrafo X_CM_0 = point_tracker.get_pose(); + FrameTrafo X_MH(Matx33f::eye(), t_MH); + X_GH_0 = R_GC * X_CM_0 * X_MH; +} + +bool Tracker::get_frame_and_points(cv::Mat& frame_copy, std::shared_ptr< std::vector<Vec2f> >& points) +{ + QMutexLocker lock(&mutex); + if (frame.empty()) return false; + + // copy the frame and points from the tracker thread + frame_copy = frame.clone(); + points = std::shared_ptr< vector<Vec2f> >(new vector<Vec2f>(point_extractor.get_points())); + return true; +} + +void Tracker::refreshVideo() +{ + if (video_widget) video_widget->update_frame_and_points(); +} + +void Tracker::StartTracker(QFrame *parent_window) +{ + this->video_frame = parent_window; + video_frame->setAttribute(Qt::WA_NativeWindow); + video_frame->show(); + video_widget = new PTVideoWidget(video_frame, this); + QHBoxLayout* video_layout = new QHBoxLayout(parent_window); + video_layout->setContentsMargins(0, 0, 0, 0); + video_layout->addWidget(video_widget); + video_frame->setLayout(video_layout); + video_widget->resize(video_frame->width(), video_frame->height()); + camera.start(); + apply(s); + start(); + reset_command(PAUSE); +} + +#ifndef OPENTRACK_API +void Tracker::StopTracker(bool exit) +{ + set_command(PAUSE); +} +#endif + +#ifdef OPENTRACK_API +#define THeadPoseData double +#endif + +void Tracker::GetHeadPoseData(THeadPoseData *data) +{ + { + QMutexLocker lock(&mutex); + + if (!tracking_valid) return; + + FrameTrafo X_CM = point_tracker.get_pose(); + FrameTrafo X_MH(Matx33f::eye(), t_MH); + FrameTrafo X_GH = R_GC * X_CM * X_MH; + Matx33f R = X_GH.R * X_GH_0.R.t(); + Vec3f t = X_GH.t - X_GH_0.t; + + // get translation(s) + data[TX] = t[0] / 10.0; // convert to cm + data[TY] = t[1] / 10.0; + data[TZ] = t[2] / 10.0; + + // translate rotation matrix from opengl (G) to roll-pitch-yaw (E) frame + // -z -> x, y -> z, x -> -y + Matx33f R_EG( 0, 0,-1, + -1, 0, 0, + 0, 1, 0); + R = R_EG * R * R_EG.t(); + + // extract rotation angles + float alpha, beta, gamma; + beta = atan2( -R(2,0), sqrt(R(2,1)*R(2,1) + R(2,2)*R(2,2)) ); + alpha = atan2( R(1,0), R(0,0)); + gamma = atan2( R(2,1), R(2,2)); + + data[Yaw] = rad2deg * alpha; + data[Pitch] = - rad2deg * beta; // FTNoIR expects a minus here + data[Roll] = rad2deg * gamma; + } +} + +//----------------------------------------------------------------------------- +#ifdef OPENTRACK_API +extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +#else +#pragma comment(linker, "/export:GetTracker=_GetTracker@0") +OPENTRACK_EXPORT ITrackerPtr __stdcall GetTracker() +#endif +{ + return new Tracker; +} diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.h b/ftnoir_tracker_pt/ftnoir_tracker_pt.h index 63b8353e..3d9a83fd 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.h @@ -1,94 +1,94 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - -#ifndef FTNOIR_TRACKER_PT_H -#define FTNOIR_TRACKER_PT_H - -#ifdef OPENTRACK_API -# include "facetracknoir/plugin-api.hpp" -#endif -#include "ftnoir_tracker_pt_settings.h" -#include "frame_observer.h" -#include "camera.h" -#include "point_extractor.h" -#include "point_tracker.h" -#include "pt_video_widget.h" -#include "facetracknoir/timer.hpp" - -#include <QThread> -#include <QMutex> -#include <QMutexLocker> -#include <QTime> -#include <opencv2/opencv.hpp> -#include <atomic> -#ifndef OPENTRACK_API -# include <boost/shared_ptr.hpp> -#else +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#ifndef FTNOIR_TRACKER_PT_H +#define FTNOIR_TRACKER_PT_H + +#ifdef OPENTRACK_API +# include "facetracknoir/plugin-api.hpp" +#endif +#include "ftnoir_tracker_pt_settings.h" +#include "frame_observer.h" +#include "camera.h" +#include "point_extractor.h" +#include "point_tracker.h" +#include "pt_video_widget.h" +#include "facetracknoir/timer.hpp" + +#include <QThread> +#include <QMutex> +#include <QMutexLocker> +#include <QTime> +#include <opencv2/opencv.hpp> +#include <atomic> +#ifndef OPENTRACK_API +# include <boost/shared_ptr.hpp> +#else # include <memory> -#endif -#include <vector> - -//----------------------------------------------------------------------------- -// Constantly processes the tracking chain in a separate thread -class Tracker : public ITracker, QThread, public FrameProvider -{ -public: - Tracker(); - virtual ~Tracker(); - virtual void StartTracker(QFrame* parent_window); - virtual void GetHeadPoseData(double* data); - virtual void refreshVideo(); - - void apply(settings& s); - void apply_inner(); - void center(); - void reset(); // reset the trackers internal state variables - void run(); - - void get_pose(FrameTrafo* X_CM) { QMutexLocker lock(&mutex); *X_CM = point_tracker.get_pose(); } - int get_n_points() { QMutexLocker lock(&mutex); return point_extractor.get_points().size(); } - void get_cam_info(CamInfo* info) { QMutexLocker lock(&mutex); *info = camera.get_info(); } - -protected: - // --- MutexedFrameProvider interface --- - virtual bool get_frame_and_points(cv::Mat& frame, std::shared_ptr< std::vector<cv::Vec2f> >& points); - - // --- thread --- - QMutex mutex; - // thread commands - enum Command { - ABORT = 1<<0, - PAUSE = 1<<1 - }; - void set_command(Command command); - void reset_command(Command command); - volatile int commands; - - CVCamera camera; - FrameRotation frame_rotation; - PointExtractor point_extractor; - PointTracker point_tracker; - - FrameTrafo X_GH_0; // for centering - cv::Vec3f t_MH; // translation from model frame to head frame - cv::Matx33f R_GC; // rotation from opengl reference frame to camera frame - - // --- ui --- - cv::Mat frame; // the output frame for display - - PTVideoWidget* video_widget; - QFrame* video_frame; - bool tracking_valid; - - settings s; - std::atomic<settings*> new_settings; - Timer time; -}; - -#undef VideoWidget - -#endif // FTNOIR_TRACKER_PT_H +#endif +#include <vector> + +//----------------------------------------------------------------------------- +// Constantly processes the tracking chain in a separate thread +class Tracker : public ITracker, QThread, public FrameProvider +{ +public: + Tracker(); + virtual ~Tracker(); + virtual void StartTracker(QFrame* parent_window); + virtual void GetHeadPoseData(double* data); + virtual void refreshVideo(); + + void apply(settings& s); + void apply_inner(); + void center(); + void reset(); // reset the trackers internal state variables + void run(); + + void get_pose(FrameTrafo* X_CM) { QMutexLocker lock(&mutex); *X_CM = point_tracker.get_pose(); } + int get_n_points() { QMutexLocker lock(&mutex); return point_extractor.get_points().size(); } + void get_cam_info(CamInfo* info) { QMutexLocker lock(&mutex); *info = camera.get_info(); } + +protected: + // --- MutexedFrameProvider interface --- + virtual bool get_frame_and_points(cv::Mat& frame, std::shared_ptr< std::vector<cv::Vec2f> >& points); + + // --- thread --- + QMutex mutex; + // thread commands + enum Command { + ABORT = 1<<0, + PAUSE = 1<<1 + }; + void set_command(Command command); + void reset_command(Command command); + volatile int commands; + + CVCamera camera; + FrameRotation frame_rotation; + PointExtractor point_extractor; + PointTracker point_tracker; + + FrameTrafo X_GH_0; // for centering + cv::Vec3f t_MH; // translation from model frame to head frame + cv::Matx33f R_GC; // rotation from opengl reference frame to camera frame + + // --- ui --- + cv::Mat frame; // the output frame for display + + PTVideoWidget* video_widget; + QFrame* video_frame; + bool tracking_valid; + + settings s; + std::atomic<settings*> new_settings; + Timer time; +}; + +#undef VideoWidget + +#endif // FTNOIR_TRACKER_PT_H diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp index ae84ce8c..e037a099 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp @@ -1,314 +1,314 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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 "ftnoir_tracker_pt_dialog.h" - -#include <QMessageBox> -#include <QDebug> -#include <opencv2/opencv.hpp> -#ifndef OPENTRACK_API -# include <boost/shared_ptr.hpp> -#else -# include <memory> -#endif -#include <vector> - -using namespace std; - -//----------------------------------------------------------------------------- -TrackerDialog::TrackerDialog() - : tracker(NULL), - video_widget_dialog(NULL), - timer(this), - trans_calib_running(false) -{ - qDebug()<<"TrackerDialog::TrackerDialog"; - setAttribute(Qt::WA_DeleteOnClose, false); - - ui.setupUi( this ); - - vector<string> device_names; - get_camera_device_names(device_names); - for (vector<string>::iterator iter = device_names.begin(); iter != device_names.end(); ++iter) - { - ui.camdevice_combo->addItem(iter->c_str()); - } - - ui.camroll_combo->addItem("-90"); - ui.camroll_combo->addItem("0"); - ui.camroll_combo->addItem("90"); - - tie_setting(s.dyn_pose_res, ui.dynpose_check); - tie_setting(s.reset_time, ui.reset_spin); - - tie_setting(s.cam_index, ui.camdevice_combo); - tie_setting(s.cam_f, ui.f_dspin); - tie_setting(s.cam_res_x, ui.res_x_spin); - tie_setting(s.cam_res_y, ui.res_y_spin); - tie_setting(s.cam_fps, ui.fps_spin); - tie_setting(s.cam_roll, ui.camroll_combo); - tie_setting(s.cam_pitch, ui.campitch_spin); - tie_setting(s.cam_yaw, ui.camyaw_spin); - - tie_setting(s.threshold_secondary, ui.threshold_secondary_slider); - tie_setting(s.threshold, ui.threshold_slider); - - tie_setting(s.min_point_size, ui.mindiam_spin); - tie_setting(s.max_point_size, ui.maxdiam_spin); - - tie_setting(s.clip_by, ui.clip_bheight_spin); - tie_setting(s.clip_bz, ui.clip_blength_spin); - tie_setting(s.clip_ty, ui.clip_theight_spin); - tie_setting(s.clip_tz, ui.clip_tlength_spin); - - tie_setting(s.cap_x, ui.cap_width_spin); - tie_setting(s.cap_y, ui.cap_height_spin); - tie_setting(s.cap_z, ui.cap_length_spin); - - tie_setting(s.m01_x, ui.m1x_spin); - tie_setting(s.m01_y, ui.m1y_spin); - tie_setting(s.m01_z, ui.m1z_spin); - - tie_setting(s.m02_x, ui.m2x_spin); - tie_setting(s.m02_y, ui.m2y_spin); - tie_setting(s.m02_z, ui.m2z_spin); - - tie_setting(s.t_MH_x, ui.tx_spin); - tie_setting(s.t_MH_y, ui.ty_spin); - tie_setting(s.t_MH_z, ui.tz_spin); - - connect( ui.tcalib_button,SIGNAL(toggled(bool)), this,SLOT(startstop_trans_calib(bool)) ); - connect(ui.reset_button, SIGNAL(clicked()), this, SLOT(doReset())); - - connect(ui.ok_button, SIGNAL(clicked()), this, SLOT(doOK())); - connect(ui.cancel_button, SIGNAL(clicked()), this, SLOT(doCancel())); - connect(ui.btnApply, SIGNAL(clicked()), this, SLOT(doApply())); - - ui.model_tabs->setCurrentIndex(s.active_model_panel); - - connect(ui.model_tabs, SIGNAL(currentChanged(int)), this, SLOT(set_model(int))); - connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); - timer.start(100); - - connect(s.b.get(), SIGNAL(bundleChanged()), this, SLOT(do_apply_without_saving())); -} - -void TrackerDialog::set_model_clip() -{ - s.m01_x = 0; - s.m01_y = static_cast<double>(s.clip_ty); - s.m01_z = -static_cast<double>(s.clip_tz); - s.m02_x = 0; - s.m02_y = -static_cast<double>(s.clip_by); - s.m02_z = -static_cast<double>(s.clip_bz); - - settings_changed(); -} - -void TrackerDialog::set_model_cap() -{ - s.m01_x = -static_cast<double>(s.cap_x); - s.m01_y = -static_cast<double>(s.cap_y); - s.m01_z = -static_cast<double>(s.cap_z); - s.m02_x = static_cast<double>(s.cap_x); - s.m02_y = -static_cast<double>(s.cap_y); - s.m02_z = -static_cast<double>(s.cap_z); - - settings_changed(); -} - -void TrackerDialog::set_model_custom() -{ - settings_changed(); -} - -void TrackerDialog::set_model(int val) -{ - s.active_model_panel = val; -} - -void TrackerDialog::startstop_trans_calib(bool start) -{ - if (start) - { - qDebug()<<"TrackerDialog:: Starting translation calibration"; - trans_calib.reset(); - trans_calib_running = true; - } - else - { - qDebug()<<"TrackerDialog:: Stoppping translation calibration"; - trans_calib_running = false; - { - auto tmp = trans_calib.get_estimate(); - s.t_MH_x = tmp[0]; - s.t_MH_y = tmp[1]; - s.t_MH_z = tmp[2]; - } - settings_changed(); - } -} - -void TrackerDialog::trans_calib_step() -{ - if (tracker) - { - FrameTrafo X_CM; - tracker->get_pose(&X_CM); - trans_calib.update(X_CM.R, X_CM.t); - cv::Vec3f t_MH = trans_calib.get_estimate(); - s.t_MH_x = t_MH[0]; - s.t_MH_y = t_MH[1]; - s.t_MH_z = t_MH[2]; - } -} - -void TrackerDialog::settings_changed() -{ - if (tracker) tracker->apply(s); -} - -void TrackerDialog::doCenter() -{ - if (tracker) tracker->center(); -} - -void TrackerDialog::doReset() -{ - if (tracker) tracker->reset(); -} - -void TrackerDialog::save() -{ - do_apply_without_saving(); - s.b->save(); -} - -void TrackerDialog::doOK() -{ - save(); - close(); -} - -void TrackerDialog::do_apply_without_saving() -{ - switch (s.active_model_panel) { - default: - case 0: - set_model_clip(); - break; - case 1: - set_model_cap(); - break; - case 2: - set_model_custom(); - break; - } - if (tracker) tracker->apply(s); -} - -void TrackerDialog::doApply() -{ - save(); -} - -void TrackerDialog::doCancel() -{ - s.b->revert(); - close(); -} - -void TrackerDialog::widget_destroyed(QObject* obj) -{ - if (obj == video_widget_dialog) { - // widget was / will be already deleted by Qt - destroy_video_widget(false); - } -} - -void TrackerDialog::create_video_widget() -{ - // this should not happen but better be sure - if (video_widget_dialog) destroy_video_widget(); - if (!tracker) return; - - video_widget_dialog = new VideoWidgetDialog(this, tracker); - video_widget_dialog->setAttribute( Qt::WA_DeleteOnClose ); - connect( video_widget_dialog, SIGNAL(destroyed(QObject*)), this, SLOT(widget_destroyed(QObject*)) ); - video_widget_dialog->show(); -} - -void TrackerDialog::destroy_video_widget(bool do_delete /*= true*/) -{ - if (video_widget_dialog) { - if (do_delete) delete video_widget_dialog; - video_widget_dialog = NULL; - } -} - -void TrackerDialog::poll_tracker_info() -{ - if (tracker) - { - QString to_print; - - // display caminfo - CamInfo info; - tracker->get_cam_info(&info); - to_print = QString::number(info.res_x)+"x"+QString::number(info.res_y)+" @ "+QString::number(info.fps)+" FPS"; - ui.caminfo_label->setText(to_print); - - // display pointinfo - int n_points = tracker->get_n_points(); - to_print = QString::number(n_points); - if (n_points == 3) - to_print += " OK!"; - else - to_print += " BAD!"; - ui.pointinfo_label->setText(to_print); - - // update calibration - if (trans_calib_running) trans_calib_step(); - - // update videowidget - if (video_widget_dialog) { - video_widget_dialog->get_video_widget()->update_frame_and_points(); - } - } - else - { - QString to_print = "Tracker offline"; - ui.caminfo_label->setText(to_print); - ui.pointinfo_label->setText(to_print); - } -} - -void TrackerDialog::registerTracker(ITracker *t) -{ - qDebug()<<"TrackerDialog:: Tracker registered"; - tracker = static_cast<Tracker*>(t); - if (isVisible() & s.b->modifiedp()) - tracker->apply(s); - ui.tcalib_button->setEnabled(true); - //ui.center_button->setEnabled(true); - ui.reset_button->setEnabled(true); -} - -void TrackerDialog::unRegisterTracker() -{ - qDebug()<<"TrackerDialog:: Tracker un-registered"; - tracker = NULL; - destroy_video_widget(); - ui.tcalib_button->setEnabled(false); - //ui.center_button->setEnabled(false); - ui.reset_button->setEnabled(false); -} - -extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) -{ - return new TrackerDialog; -} +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 "ftnoir_tracker_pt_dialog.h" + +#include <QMessageBox> +#include <QDebug> +#include <opencv2/opencv.hpp> +#ifndef OPENTRACK_API +# include <boost/shared_ptr.hpp> +#else +# include <memory> +#endif +#include <vector> + +using namespace std; + +//----------------------------------------------------------------------------- +TrackerDialog::TrackerDialog() + : tracker(NULL), + video_widget_dialog(NULL), + timer(this), + trans_calib_running(false) +{ + qDebug()<<"TrackerDialog::TrackerDialog"; + setAttribute(Qt::WA_DeleteOnClose, false); + + ui.setupUi( this ); + + vector<string> device_names; + get_camera_device_names(device_names); + for (vector<string>::iterator iter = device_names.begin(); iter != device_names.end(); ++iter) + { + ui.camdevice_combo->addItem(iter->c_str()); + } + + ui.camroll_combo->addItem("-90"); + ui.camroll_combo->addItem("0"); + ui.camroll_combo->addItem("90"); + + tie_setting(s.dyn_pose_res, ui.dynpose_check); + tie_setting(s.reset_time, ui.reset_spin); + + tie_setting(s.cam_index, ui.camdevice_combo); + tie_setting(s.cam_f, ui.f_dspin); + tie_setting(s.cam_res_x, ui.res_x_spin); + tie_setting(s.cam_res_y, ui.res_y_spin); + tie_setting(s.cam_fps, ui.fps_spin); + tie_setting(s.cam_roll, ui.camroll_combo); + tie_setting(s.cam_pitch, ui.campitch_spin); + tie_setting(s.cam_yaw, ui.camyaw_spin); + + tie_setting(s.threshold_secondary, ui.threshold_secondary_slider); + tie_setting(s.threshold, ui.threshold_slider); + + tie_setting(s.min_point_size, ui.mindiam_spin); + tie_setting(s.max_point_size, ui.maxdiam_spin); + + tie_setting(s.clip_by, ui.clip_bheight_spin); + tie_setting(s.clip_bz, ui.clip_blength_spin); + tie_setting(s.clip_ty, ui.clip_theight_spin); + tie_setting(s.clip_tz, ui.clip_tlength_spin); + + tie_setting(s.cap_x, ui.cap_width_spin); + tie_setting(s.cap_y, ui.cap_height_spin); + tie_setting(s.cap_z, ui.cap_length_spin); + + tie_setting(s.m01_x, ui.m1x_spin); + tie_setting(s.m01_y, ui.m1y_spin); + tie_setting(s.m01_z, ui.m1z_spin); + + tie_setting(s.m02_x, ui.m2x_spin); + tie_setting(s.m02_y, ui.m2y_spin); + tie_setting(s.m02_z, ui.m2z_spin); + + tie_setting(s.t_MH_x, ui.tx_spin); + tie_setting(s.t_MH_y, ui.ty_spin); + tie_setting(s.t_MH_z, ui.tz_spin); + + connect( ui.tcalib_button,SIGNAL(toggled(bool)), this,SLOT(startstop_trans_calib(bool)) ); + connect(ui.reset_button, SIGNAL(clicked()), this, SLOT(doReset())); + + connect(ui.ok_button, SIGNAL(clicked()), this, SLOT(doOK())); + connect(ui.cancel_button, SIGNAL(clicked()), this, SLOT(doCancel())); + connect(ui.btnApply, SIGNAL(clicked()), this, SLOT(doApply())); + + ui.model_tabs->setCurrentIndex(s.active_model_panel); + + connect(ui.model_tabs, SIGNAL(currentChanged(int)), this, SLOT(set_model(int))); + connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); + timer.start(100); + + connect(s.b.get(), SIGNAL(bundleChanged()), this, SLOT(do_apply_without_saving())); +} + +void TrackerDialog::set_model_clip() +{ + s.m01_x = 0; + s.m01_y = static_cast<double>(s.clip_ty); + s.m01_z = -static_cast<double>(s.clip_tz); + s.m02_x = 0; + s.m02_y = -static_cast<double>(s.clip_by); + s.m02_z = -static_cast<double>(s.clip_bz); + + settings_changed(); +} + +void TrackerDialog::set_model_cap() +{ + s.m01_x = -static_cast<double>(s.cap_x); + s.m01_y = -static_cast<double>(s.cap_y); + s.m01_z = -static_cast<double>(s.cap_z); + s.m02_x = static_cast<double>(s.cap_x); + s.m02_y = -static_cast<double>(s.cap_y); + s.m02_z = -static_cast<double>(s.cap_z); + + settings_changed(); +} + +void TrackerDialog::set_model_custom() +{ + settings_changed(); +} + +void TrackerDialog::set_model(int val) +{ + s.active_model_panel = val; +} + +void TrackerDialog::startstop_trans_calib(bool start) +{ + if (start) + { + qDebug()<<"TrackerDialog:: Starting translation calibration"; + trans_calib.reset(); + trans_calib_running = true; + } + else + { + qDebug()<<"TrackerDialog:: Stoppping translation calibration"; + trans_calib_running = false; + { + auto tmp = trans_calib.get_estimate(); + s.t_MH_x = tmp[0]; + s.t_MH_y = tmp[1]; + s.t_MH_z = tmp[2]; + } + settings_changed(); + } +} + +void TrackerDialog::trans_calib_step() +{ + if (tracker) + { + FrameTrafo X_CM; + tracker->get_pose(&X_CM); + trans_calib.update(X_CM.R, X_CM.t); + cv::Vec3f t_MH = trans_calib.get_estimate(); + s.t_MH_x = t_MH[0]; + s.t_MH_y = t_MH[1]; + s.t_MH_z = t_MH[2]; + } +} + +void TrackerDialog::settings_changed() +{ + if (tracker) tracker->apply(s); +} + +void TrackerDialog::doCenter() +{ + if (tracker) tracker->center(); +} + +void TrackerDialog::doReset() +{ + if (tracker) tracker->reset(); +} + +void TrackerDialog::save() +{ + do_apply_without_saving(); + s.b->save(); +} + +void TrackerDialog::doOK() +{ + save(); + close(); +} + +void TrackerDialog::do_apply_without_saving() +{ + switch (s.active_model_panel) { + default: + case 0: + set_model_clip(); + break; + case 1: + set_model_cap(); + break; + case 2: + set_model_custom(); + break; + } + if (tracker) tracker->apply(s); +} + +void TrackerDialog::doApply() +{ + save(); +} + +void TrackerDialog::doCancel() +{ + s.b->revert(); + close(); +} + +void TrackerDialog::widget_destroyed(QObject* obj) +{ + if (obj == video_widget_dialog) { + // widget was / will be already deleted by Qt + destroy_video_widget(false); + } +} + +void TrackerDialog::create_video_widget() +{ + // this should not happen but better be sure + if (video_widget_dialog) destroy_video_widget(); + if (!tracker) return; + + video_widget_dialog = new VideoWidgetDialog(this, tracker); + video_widget_dialog->setAttribute( Qt::WA_DeleteOnClose ); + connect( video_widget_dialog, SIGNAL(destroyed(QObject*)), this, SLOT(widget_destroyed(QObject*)) ); + video_widget_dialog->show(); +} + +void TrackerDialog::destroy_video_widget(bool do_delete /*= true*/) +{ + if (video_widget_dialog) { + if (do_delete) delete video_widget_dialog; + video_widget_dialog = NULL; + } +} + +void TrackerDialog::poll_tracker_info() +{ + if (tracker) + { + QString to_print; + + // display caminfo + CamInfo info; + tracker->get_cam_info(&info); + to_print = QString::number(info.res_x)+"x"+QString::number(info.res_y)+" @ "+QString::number(info.fps)+" FPS"; + ui.caminfo_label->setText(to_print); + + // display pointinfo + int n_points = tracker->get_n_points(); + to_print = QString::number(n_points); + if (n_points == 3) + to_print += " OK!"; + else + to_print += " BAD!"; + ui.pointinfo_label->setText(to_print); + + // update calibration + if (trans_calib_running) trans_calib_step(); + + // update videowidget + if (video_widget_dialog) { + video_widget_dialog->get_video_widget()->update_frame_and_points(); + } + } + else + { + QString to_print = "Tracker offline"; + ui.caminfo_label->setText(to_print); + ui.pointinfo_label->setText(to_print); + } +} + +void TrackerDialog::registerTracker(ITracker *t) +{ + qDebug()<<"TrackerDialog:: Tracker registered"; + tracker = static_cast<Tracker*>(t); + if (isVisible() & s.b->modifiedp()) + tracker->apply(s); + ui.tcalib_button->setEnabled(true); + //ui.center_button->setEnabled(true); + ui.reset_button->setEnabled(true); +} + +void TrackerDialog::unRegisterTracker() +{ + qDebug()<<"TrackerDialog:: Tracker un-registered"; + tracker = NULL; + destroy_video_widget(); + ui.tcalib_button->setEnabled(false); + //ui.center_button->setEnabled(false); + ui.reset_button->setEnabled(false); +} + +extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) +{ + return new TrackerDialog; +} diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h index 5cb09130..a4d9c4b5 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h @@ -1,70 +1,70 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - -#ifndef FTNOIR_TRACKER_PT_DIALOG_H -#define FTNOIR_TRACKER_PT_DIALOG_H - -#ifdef OPENTRACK_API -# include "facetracknoir/plugin-api.hpp" -#else -#include "..\ftnoir_tracker_base\ftnoir_tracker_base.h" -#endif -#include "ftnoir_tracker_pt_settings.h" -#include "ftnoir_tracker_pt.h" -#include "trans_calib.h" -#include "pt_video_widget.h" -#include "ui_FTNoIR_PT_Controls.h" - -#include <QTimer> - -//----------------------------------------------------------------------------- -// The dialog that shows up when the user presses "Settings" -class TrackerDialog : public QWidget, Ui::UICPTClientControls, public ITrackerDialog -{ - Q_OBJECT -public: - TrackerDialog(); - void registerTracker(ITracker *tracker); - void unRegisterTracker(); - void save(); - void trans_calib_step(); - -public slots: - void doCenter(); - void doReset(); - void doOK(); - void doApply(); - void doCancel(); - void do_apply_without_saving(); - - void startstop_trans_calib(bool start); - void widget_destroyed(QObject* obj); - void create_video_widget(); - void poll_tracker_info(); - void set_model(int idx); - -protected: - void destroy_video_widget(bool do_delete = true); - - void set_model_clip(); - void set_model_cap(); - void set_model_custom(); - - void settings_changed(); - - settings s; - Tracker* tracker; - VideoWidgetDialog* video_widget_dialog; - QTimer timer; - - TranslationCalibrator trans_calib; - bool trans_calib_running; - - Ui::UICPTClientControls ui; -}; - -#endif //FTNOIR_TRACKER_PT_DIALOG_H +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#ifndef FTNOIR_TRACKER_PT_DIALOG_H +#define FTNOIR_TRACKER_PT_DIALOG_H + +#ifdef OPENTRACK_API +# include "facetracknoir/plugin-api.hpp" +#else +#include "..\ftnoir_tracker_base\ftnoir_tracker_base.h" +#endif +#include "ftnoir_tracker_pt_settings.h" +#include "ftnoir_tracker_pt.h" +#include "trans_calib.h" +#include "pt_video_widget.h" +#include "ui_FTNoIR_PT_Controls.h" + +#include <QTimer> + +//----------------------------------------------------------------------------- +// The dialog that shows up when the user presses "Settings" +class TrackerDialog : public QWidget, Ui::UICPTClientControls, public ITrackerDialog +{ + Q_OBJECT +public: + TrackerDialog(); + void registerTracker(ITracker *tracker); + void unRegisterTracker(); + void save(); + void trans_calib_step(); + +public slots: + void doCenter(); + void doReset(); + void doOK(); + void doApply(); + void doCancel(); + void do_apply_without_saving(); + + void startstop_trans_calib(bool start); + void widget_destroyed(QObject* obj); + void create_video_widget(); + void poll_tracker_info(); + void set_model(int idx); + +protected: + void destroy_video_widget(bool do_delete = true); + + void set_model_clip(); + void set_model_cap(); + void set_model_custom(); + + void settings_changed(); + + settings s; + Tracker* tracker; + VideoWidgetDialog* video_widget_dialog; + QTimer timer; + + TranslationCalibrator trans_calib; + bool trans_calib_running; + + Ui::UICPTClientControls ui; +}; + +#endif //FTNOIR_TRACKER_PT_DIALOG_H diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp index dd7b08d6..07e1d9e7 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp @@ -1,42 +1,42 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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 "ftnoir_tracker_pt_dll.h" -#include <QIcon> - -//----------------------------------------------------------------------------- -void TrackerDll::getFullName(QString *strToBeFilled) -{ - *strToBeFilled = "PointTracker 1.1"; -} - -void TrackerDll::getShortName(QString *strToBeFilled) -{ - *strToBeFilled = "PointTracker"; -} - -void TrackerDll::getDescription(QString *strToBeFilled) -{ - *strToBeFilled = "Tracks a 3-point model with know geometry like Freetrack / TrackIR"; -} - -void TrackerDll::getIcon(QIcon *icon) -{ - *icon = QIcon(":/Resources/Logo_IR.png"); -} - - -#ifdef OPENTRACK_API -# include "facetracknoir/plugin-support.h" -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() -#else -# pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0") -OPENTRACK_EXPORT ITrackerDllPtr __stdcall GetTrackerDll() -#endif -{ - return new TrackerDll; -} +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 "ftnoir_tracker_pt_dll.h" +#include <QIcon> + +//----------------------------------------------------------------------------- +void TrackerDll::getFullName(QString *strToBeFilled) +{ + *strToBeFilled = "PointTracker 1.1"; +} + +void TrackerDll::getShortName(QString *strToBeFilled) +{ + *strToBeFilled = "PointTracker"; +} + +void TrackerDll::getDescription(QString *strToBeFilled) +{ + *strToBeFilled = "Tracks a 3-point model with know geometry like Freetrack / TrackIR"; +} + +void TrackerDll::getIcon(QIcon *icon) +{ + *icon = QIcon(":/Resources/Logo_IR.png"); +} + + +#ifdef OPENTRACK_API +# include "facetracknoir/plugin-support.h" +extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +#else +# pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0") +OPENTRACK_EXPORT ITrackerDllPtr __stdcall GetTrackerDll() +#endif +{ + return new TrackerDll; +} diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h index fce7aec2..50f66a35 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h @@ -1,26 +1,26 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - -#if defined(OPENTRACK_API) -# include "facetracknoir/plugin-api.hpp" -#else -# include "../ftnoir_tracker_base/ftnoir_tracker_base.h" -#endif - -//----------------------------------------------------------------------------- -class TrackerDll : -#if defined(OPENTRACK_API) - public Metadata -#else - public ITrackerDll -#endif -{ - void getFullName(QString *strToBeFilled); - void getShortName(QString *strToBeFilled); - void getDescription(QString *strToBeFilled); - void getIcon(QIcon *icon); -}; +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#if defined(OPENTRACK_API) +# include "facetracknoir/plugin-api.hpp" +#else +# include "../ftnoir_tracker_base/ftnoir_tracker_base.h" +#endif + +//----------------------------------------------------------------------------- +class TrackerDll : +#if defined(OPENTRACK_API) + public Metadata +#else + public ITrackerDll +#endif +{ + void getFullName(QString *strToBeFilled); + void getShortName(QString *strToBeFilled); + void getDescription(QString *strToBeFilled); + void getIcon(QIcon *icon); +}; diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h index 1eca1e35..e4cb9ad3 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h @@ -1,81 +1,81 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - -#ifndef FTNOIR_TRACKER_PT_SETTINGS_H -#define FTNOIR_TRACKER_PT_SETTINGS_H - -#include <opencv2/opencv.hpp> -#include "point_tracker.h" - -#include "facetracknoir/options.h" -using namespace options; - -struct settings -{ - pbundle b; - value<int> cam_index, - cam_res_x, - cam_res_y, - cam_fps, - cam_roll, - cam_pitch, - cam_yaw, - threshold, - threshold_secondary, - min_point_size, - max_point_size; - value<double> cam_f; - - value<int> m01_x, m01_y, m01_z; - value<int> m02_x, m02_y, m02_z; - value<bool> dyn_pose_res, video_widget; - - value<int> t_MH_x, t_MH_y, t_MH_z; - - value<int> reset_time; - - value<int> clip_ty, clip_tz, clip_by, clip_bz; - value<int> active_model_panel, cap_x, cap_y, cap_z; - - settings() : - b(bundle("tracker-pt")), - cam_index(b, "camera-index", 0), - cam_res_x(b, "camera-res-width", 640), - cam_res_y(b, "camera-res-height", 480), - cam_fps(b, "camera-fps", 30), - cam_roll(b, "camera-roll", 1), - cam_pitch(b, "camera-pitch", 0), - cam_yaw(b, "camera-yaw", 0), - threshold(b, "threshold-primary", 128), - threshold_secondary(b, "threshold-secondary", 128), - min_point_size(b, "min-point-size", 10), - max_point_size(b, "max-point-size", 50), - cam_f(b, "camera-focal-length", 1), - m01_x(b, "m_01-x", 0), - m01_y(b, "m_01-y", 0), - m01_z(b, "m_01-z", 0), - m02_x(b, "m_02-x", 0), - m02_y(b, "m_02-y", 0), - m02_z(b, "m_02-z", 0), - dyn_pose_res(b, "dynamic-pose-resolution", false), - video_widget(b, "video-widget", true), - t_MH_x(b, "model-centroid-x", 0), - t_MH_y(b, "model-centroid-y", 0), - t_MH_z(b, "model-centroid-z", 0), - reset_time(b, "reset-time", 2000), - clip_ty(b, "clip-ty", 0), - clip_tz(b, "clip-tz", 0), - clip_by(b, "clip-by", 0), - clip_bz(b, "clip-bz", 0), - active_model_panel(b, "active-model-panel", 0), - cap_x(b, "cap-x", 0), - cap_y(b, "cap-y", 0), - cap_z(b, "cap-z", 0) - {} -}; - -#endif //FTNOIR_TRACKER_PT_SETTINGS_H +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#ifndef FTNOIR_TRACKER_PT_SETTINGS_H +#define FTNOIR_TRACKER_PT_SETTINGS_H + +#include <opencv2/opencv.hpp> +#include "point_tracker.h" + +#include "facetracknoir/options.h" +using namespace options; + +struct settings +{ + pbundle b; + value<int> cam_index, + cam_res_x, + cam_res_y, + cam_fps, + cam_roll, + cam_pitch, + cam_yaw, + threshold, + threshold_secondary, + min_point_size, + max_point_size; + value<double> cam_f; + + value<int> m01_x, m01_y, m01_z; + value<int> m02_x, m02_y, m02_z; + value<bool> dyn_pose_res, video_widget; + + value<int> t_MH_x, t_MH_y, t_MH_z; + + value<int> reset_time; + + value<int> clip_ty, clip_tz, clip_by, clip_bz; + value<int> active_model_panel, cap_x, cap_y, cap_z; + + settings() : + b(bundle("tracker-pt")), + cam_index(b, "camera-index", 0), + cam_res_x(b, "camera-res-width", 640), + cam_res_y(b, "camera-res-height", 480), + cam_fps(b, "camera-fps", 30), + cam_roll(b, "camera-roll", 1), + cam_pitch(b, "camera-pitch", 0), + cam_yaw(b, "camera-yaw", 0), + threshold(b, "threshold-primary", 128), + threshold_secondary(b, "threshold-secondary", 128), + min_point_size(b, "min-point-size", 10), + max_point_size(b, "max-point-size", 50), + cam_f(b, "camera-focal-length", 1), + m01_x(b, "m_01-x", 0), + m01_y(b, "m_01-y", 0), + m01_z(b, "m_01-z", 0), + m02_x(b, "m_02-x", 0), + m02_y(b, "m_02-y", 0), + m02_z(b, "m_02-z", 0), + dyn_pose_res(b, "dynamic-pose-resolution", false), + video_widget(b, "video-widget", true), + t_MH_x(b, "model-centroid-x", 0), + t_MH_y(b, "model-centroid-y", 0), + t_MH_z(b, "model-centroid-z", 0), + reset_time(b, "reset-time", 2000), + clip_ty(b, "clip-ty", 0), + clip_tz(b, "clip-tz", 0), + clip_by(b, "clip-by", 0), + clip_bz(b, "clip-bz", 0), + active_model_panel(b, "active-model-panel", 0), + cap_x(b, "cap-x", 0), + cap_y(b, "cap-y", 0), + cap_z(b, "cap-z", 0) + {} +}; + +#endif //FTNOIR_TRACKER_PT_SETTINGS_H diff --git a/ftnoir_tracker_pt/point_extractor.cpp b/ftnoir_tracker_pt/point_extractor.cpp index 968fe23e..b0e29270 100644 --- a/ftnoir_tracker_pt/point_extractor.cpp +++ b/ftnoir_tracker_pt/point_extractor.cpp @@ -1,163 +1,163 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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 "point_extractor.h" -#include <QDebug> - - -using namespace cv; -using namespace std; - - -PointExtractor::PointExtractor(){ - //if (!AllocConsole()){} - //else SetConsoleTitle("debug"); - //freopen("CON", "w", stdout); - //freopen("CON", "w", stderr); -} -// ---------------------------------------------------------------------------- -const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float /*dt*/, bool draw_output) -{ - const int W = frame.cols; - const int H = frame.rows; - - if (frame_last.cols != W || frame_last.rows != H) - { - frame_last = cv::Mat(); - } - - // clear old points - points.clear(); - - // convert to grayscale - Mat frame_gray; - cvtColor(frame, frame_gray, CV_RGB2GRAY); - - int secondary = threshold_secondary_val; - - // mask for everything that passes the threshold (or: the upper threshold of the hysteresis) - Mat frame_bin; - // only used if draw_output - Mat frame_bin_copy; - // mask for everything that passes - Mat frame_bin_low; - // mask for lower-threshold && combined result of last, needs to remain in scope until drawing, but is only used if secondary != 0 - Mat frame_last_and_low; - - if(secondary==0){ - threshold(frame_gray, frame_bin, threshold_val, 255, THRESH_BINARY); - }else{ - // we recombine a number of buffers, this might be slower than a single loop of per-pixel logic - // but it might as well be faster if openCV makes good use of SIMD - float t = threshold_val; - //float hyst = float(threshold_secondary_val)/512.; - //threshold(frame_gray, frame_bin, (t + ((255.-t)*hyst)), 255, THRESH_BINARY); - float hyst = float(threshold_secondary_val)/256.; - threshold(frame_gray, frame_bin, t, 255, THRESH_BINARY); - threshold(frame_gray, frame_bin_low,std::max(float(1), t - (t*hyst)), 255, THRESH_BINARY); - - if(draw_output) frame_bin.copyTo(frame_bin_copy); - if(frame_last.empty()){ - frame_bin.copyTo(frame_last); - }else{ - // keep pixels from last if they are above lower threshold - bitwise_and(frame_last, frame_bin_low, frame_last_and_low); - // union of pixels >= higher threshold and pixels >= lower threshold - bitwise_or(frame_bin, frame_last_and_low, frame_last); - frame_last.copyTo(frame_bin); - } - } - unsigned int region_size_min = 3.14*min_size*min_size/4.0; - unsigned int region_size_max = 3.14*max_size*max_size/4.0; - - int blob_index = 1; - for (int y=0; y<H; y++) - { - if (blob_index >= 255) break; - for (int x=0; x<W; x++) - { - if (blob_index >= 255) break; - - // find connected components with floodfill - if (frame_bin.at<unsigned char>(y,x) != 255) continue; - Rect rect; - - floodFill(frame_bin, Point(x,y), Scalar(blob_index), &rect, Scalar(0), Scalar(0), FLOODFILL_FIXED_RANGE); - blob_index++; - - // calculate the size of the connected component - unsigned int region_size = 0; - for (int i=rect.y; i < (rect.y+rect.height); i++) - { - for (int j=rect.x; j < (rect.x+rect.width); j++) - { - if (frame_bin.at<unsigned char>(i,j) != blob_index-1) continue; - region_size++; - } - } - - if (region_size < region_size_min || region_size > region_size_max) continue; - - // calculate the center of mass: - // mx = (sum_ij j*f(frame_grey_ij)) / (sum_ij f(frame_grey_ij)) - // my = ... - // f maps from [threshold,256] -> [0, 1], lower values are mapped to 0 - float m = 0; - float mx = 0; - float my = 0; - for (int i=rect.y; i < (rect.y+rect.height); i++) - { - for (int j=rect.x; j < (rect.x+rect.width); j++) - { - if (frame_bin.at<unsigned char>(i,j) != blob_index-1) continue; - float val; - - if(secondary==0){ - val = frame_gray.at<unsigned char>(i,j); - val = float(val - threshold_val)/(256 - threshold_val); - val = val*val; // makes it more stable (less emphasis on low values, more on the peak) - }else{ - //hysteresis point detection gets stability from ignoring pixel noise so we decidedly leave the actual pixel values out of the picture - val = frame_last.at<unsigned char>(i,j) / 256.; - } - - m += val; - mx += j * val; - my += i * val; - } - } - - // convert to centered camera coordinate system with y axis upwards - Vec2f c; - c[0] = (mx/m - W/2)/W; - c[1] = -(my/m - H/2)/W; - //qDebug()<<blob_index<<" => "<<c[0]<<" "<<c[1]; - points.push_back(c); - } - } - - // draw output image - if (draw_output) { - vector<Mat> channels; - if(secondary==0){ - frame_bin.setTo(170, frame_bin); - channels.push_back(frame_gray + frame_bin); - channels.push_back(frame_gray - frame_bin); - channels.push_back(frame_gray - frame_bin); - }else{ - frame_bin_copy.setTo(120, frame_bin_copy); - frame_bin_low.setTo(90, frame_bin_low); - channels.push_back(frame_gray + frame_bin_copy); - channels.push_back(frame_gray + frame_last_and_low); - channels.push_back(frame_gray + frame_bin_low); - //channels.push_back(frame_gray + frame_bin); - } - merge(channels, frame); - } - - return points; -} +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 "point_extractor.h" +#include <QDebug> + + +using namespace cv; +using namespace std; + + +PointExtractor::PointExtractor(){ + //if (!AllocConsole()){} + //else SetConsoleTitle("debug"); + //freopen("CON", "w", stdout); + //freopen("CON", "w", stderr); +} +// ---------------------------------------------------------------------------- +const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float /*dt*/, bool draw_output) +{ + const int W = frame.cols; + const int H = frame.rows; + + if (frame_last.cols != W || frame_last.rows != H) + { + frame_last = cv::Mat(); + } + + // clear old points + points.clear(); + + // convert to grayscale + Mat frame_gray; + cvtColor(frame, frame_gray, CV_RGB2GRAY); + + int secondary = threshold_secondary_val; + + // mask for everything that passes the threshold (or: the upper threshold of the hysteresis) + Mat frame_bin; + // only used if draw_output + Mat frame_bin_copy; + // mask for everything that passes + Mat frame_bin_low; + // mask for lower-threshold && combined result of last, needs to remain in scope until drawing, but is only used if secondary != 0 + Mat frame_last_and_low; + + if(secondary==0){ + threshold(frame_gray, frame_bin, threshold_val, 255, THRESH_BINARY); + }else{ + // we recombine a number of buffers, this might be slower than a single loop of per-pixel logic + // but it might as well be faster if openCV makes good use of SIMD + float t = threshold_val; + //float hyst = float(threshold_secondary_val)/512.; + //threshold(frame_gray, frame_bin, (t + ((255.-t)*hyst)), 255, THRESH_BINARY); + float hyst = float(threshold_secondary_val)/256.; + threshold(frame_gray, frame_bin, t, 255, THRESH_BINARY); + threshold(frame_gray, frame_bin_low,std::max(float(1), t - (t*hyst)), 255, THRESH_BINARY); + + if(draw_output) frame_bin.copyTo(frame_bin_copy); + if(frame_last.empty()){ + frame_bin.copyTo(frame_last); + }else{ + // keep pixels from last if they are above lower threshold + bitwise_and(frame_last, frame_bin_low, frame_last_and_low); + // union of pixels >= higher threshold and pixels >= lower threshold + bitwise_or(frame_bin, frame_last_and_low, frame_last); + frame_last.copyTo(frame_bin); + } + } + unsigned int region_size_min = 3.14*min_size*min_size/4.0; + unsigned int region_size_max = 3.14*max_size*max_size/4.0; + + int blob_index = 1; + for (int y=0; y<H; y++) + { + if (blob_index >= 255) break; + for (int x=0; x<W; x++) + { + if (blob_index >= 255) break; + + // find connected components with floodfill + if (frame_bin.at<unsigned char>(y,x) != 255) continue; + Rect rect; + + floodFill(frame_bin, Point(x,y), Scalar(blob_index), &rect, Scalar(0), Scalar(0), FLOODFILL_FIXED_RANGE); + blob_index++; + + // calculate the size of the connected component + unsigned int region_size = 0; + for (int i=rect.y; i < (rect.y+rect.height); i++) + { + for (int j=rect.x; j < (rect.x+rect.width); j++) + { + if (frame_bin.at<unsigned char>(i,j) != blob_index-1) continue; + region_size++; + } + } + + if (region_size < region_size_min || region_size > region_size_max) continue; + + // calculate the center of mass: + // mx = (sum_ij j*f(frame_grey_ij)) / (sum_ij f(frame_grey_ij)) + // my = ... + // f maps from [threshold,256] -> [0, 1], lower values are mapped to 0 + float m = 0; + float mx = 0; + float my = 0; + for (int i=rect.y; i < (rect.y+rect.height); i++) + { + for (int j=rect.x; j < (rect.x+rect.width); j++) + { + if (frame_bin.at<unsigned char>(i,j) != blob_index-1) continue; + float val; + + if(secondary==0){ + val = frame_gray.at<unsigned char>(i,j); + val = float(val - threshold_val)/(256 - threshold_val); + val = val*val; // makes it more stable (less emphasis on low values, more on the peak) + }else{ + //hysteresis point detection gets stability from ignoring pixel noise so we decidedly leave the actual pixel values out of the picture + val = frame_last.at<unsigned char>(i,j) / 256.; + } + + m += val; + mx += j * val; + my += i * val; + } + } + + // convert to centered camera coordinate system with y axis upwards + Vec2f c; + c[0] = (mx/m - W/2)/W; + c[1] = -(my/m - H/2)/W; + //qDebug()<<blob_index<<" => "<<c[0]<<" "<<c[1]; + points.push_back(c); + } + } + + // draw output image + if (draw_output) { + vector<Mat> channels; + if(secondary==0){ + frame_bin.setTo(170, frame_bin); + channels.push_back(frame_gray + frame_bin); + channels.push_back(frame_gray - frame_bin); + channels.push_back(frame_gray - frame_bin); + }else{ + frame_bin_copy.setTo(120, frame_bin_copy); + frame_bin_low.setTo(90, frame_bin_low); + channels.push_back(frame_gray + frame_bin_copy); + channels.push_back(frame_gray + frame_last_and_low); + channels.push_back(frame_gray + frame_bin_low); + //channels.push_back(frame_gray + frame_bin); + } + merge(channels, frame); + } + + return points; +} diff --git a/ftnoir_tracker_pt/point_extractor.h b/ftnoir_tracker_pt/point_extractor.h index ff36f3ce..8a76747b 100644 --- a/ftnoir_tracker_pt/point_extractor.h +++ b/ftnoir_tracker_pt/point_extractor.h @@ -1,35 +1,35 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - -#ifndef POINTEXTRACTOR_H -#define POINTEXTRACTOR_H - -#include <opencv2/opencv.hpp> -#include <opencv2/imgproc/imgproc_c.h> - -// ---------------------------------------------------------------------------- -// Extracts points from an opencv image -class PointExtractor -{ -public: - // extracts points from frame and draws some processing info into frame, if draw_output is set - // dt: time since last call in seconds - // WARNING: returned reference is valid as long as object - const std::vector<cv::Vec2f>& extract_points(cv::Mat frame, float dt, bool draw_output); - const std::vector<cv::Vec2f>& get_points() { return points; } - PointExtractor(); - - int threshold_val; - int threshold_secondary_val; - int min_size, max_size; - -protected: - std::vector<cv::Vec2f> points; - cv::Mat frame_last; -}; - -#endif //POINTEXTRACTOR_H +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#ifndef POINTEXTRACTOR_H +#define POINTEXTRACTOR_H + +#include <opencv2/opencv.hpp> +#include <opencv2/imgproc/imgproc_c.h> + +// ---------------------------------------------------------------------------- +// Extracts points from an opencv image +class PointExtractor +{ +public: + // extracts points from frame and draws some processing info into frame, if draw_output is set + // dt: time since last call in seconds + // WARNING: returned reference is valid as long as object + const std::vector<cv::Vec2f>& extract_points(cv::Mat frame, float dt, bool draw_output); + const std::vector<cv::Vec2f>& get_points() { return points; } + PointExtractor(); + + int threshold_val; + int threshold_secondary_val; + int min_size, max_size; + +protected: + std::vector<cv::Vec2f> points; + cv::Mat frame_last; +}; + +#endif //POINTEXTRACTOR_H diff --git a/ftnoir_tracker_pt/point_tracker.cpp b/ftnoir_tracker_pt/point_tracker.cpp index f83ff437..e9892d67 100644 --- a/ftnoir_tracker_pt/point_tracker.cpp +++ b/ftnoir_tracker_pt/point_tracker.cpp @@ -1,375 +1,375 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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 "point_tracker.h" - -#include <vector> -#include <algorithm> -#include <cmath> - -#include <QDebug> - -using namespace cv; -using namespace std; - -const float PI = 3.14159265358979323846f; - -// ---------------------------------------------------------------------------- -static void get_row(const Matx33f& m, int i, Vec3f& v) -{ - v[0] = m(i,0); - v[1] = m(i,1); - v[2] = m(i,2); -} - -static void set_row(Matx33f& m, int i, const Vec3f& v) -{ - m(i,0) = v[0]; - m(i,1) = v[1]; - m(i,2) = v[2]; -} - -// ---------------------------------------------------------------------------- -PointModel::PointModel(Vec3f M01, Vec3f M02) - : M01(M01), - M02(M02) -{ - // calculate u - u = M01.cross(M02); - u /= norm(u); - - // calculate projection matrix on M01,M02 plane - float s11 = M01.dot(M01); - float s12 = M01.dot(M02); - float s22 = M02.dot(M02); - P = 1.0/(s11*s22-s12*s12) * Matx22f(s22, -s12, - -s12, s11); - - // calculate d and d_order for simple freetrack-like point correspondence - vector<Vec2f> points; - points.push_back(Vec2f(0,0)); - points.push_back(Vec2f(M01[0], M01[1])); - points.push_back(Vec2f(M02[0], M02[1])); - // fit line to orthographically projected points - // ERROR: yields wrong results with colinear points?! - /* - Vec4f line; - fitLine(points, line, CV_DIST_L2, 0, 0.01, 0.01); - d[0] = line[0]; d[1] = line[1]; - */ - // TODO: fix this - d = Vec2f(M01[0]-M02[0], M01[1]-M02[1]); - - // sort model points - get_d_order(points, d_order); -} - -#ifdef OPENTRACK_API -static bool d_vals_sort(const pair<float,int> a, const pair<float,int> b) -{ - return a.first < b.first; -} -#endif - -void PointModel::get_d_order(const std::vector<cv::Vec2f>& points, int d_order[]) const -{ - // get sort indices with respect to d scalar product - vector< pair<float,int> > d_vals; - for (unsigned i = 0; i<points.size(); ++i) - d_vals.push_back(pair<float, int>(d.dot(points[i]), i)); - - std::sort(d_vals.begin(), - d_vals.end(), -#ifdef OPENTRACK_API - d_vals_sort -#else - comp -#endif - ); - - for (unsigned i = 0; i<points.size(); ++i) - d_order[i] = d_vals[i].second; -} - - -// ---------------------------------------------------------------------------- -PointTracker::PointTracker() : - dynamic_pose_resolution(true), - dt_reset(1), - init_phase(true), - dt_valid(0), - v_t(0,0,0), - v_r(0,0,0) -{ - X_CM.t[2] = 1000; // default position: 1 m away from cam; -} - -void PointTracker::reset() -{ - // enter init phase and reset velocities - init_phase = true; - dt_valid = 0; - reset_velocities(); -} - -void PointTracker::reset_velocities() -{ - v_t = Vec3f(0,0,0); - v_r = Vec3f(0,0,0); -} - - -bool PointTracker::track(const vector<Vec2f>& points, float f, float dt) -{ - if (!dynamic_pose_resolution) init_phase = true; - - dt_valid += dt; - // if there was no valid tracking result for too long, do a reset - if (dt_valid > dt_reset) - { - //qDebug()<<"dt_valid "<<dt_valid<<" > dt_reset "<<dt_reset; - reset(); - } - - bool no_model = -#ifdef OPENTRACK_API - point_model.get() == NULL; -#else - !point_model; -#endif - - // if there is a pointtracking problem, reset the velocities - if (no_model || points.size() != PointModel::N_POINTS) - { - //qDebug()<<"Wrong number of points!"; - reset_velocities(); - return false; - } - - X_CM_old = X_CM; // backup old transformation for velocity calculation - - if (!init_phase) - predict(dt_valid); - - // if there is a point correspondence problem something has gone wrong, do a reset - if (!find_correspondences(points, f)) - { - //qDebug()<<"Error in finding point correspondences!"; - X_CM = X_CM_old; // undo prediction - reset(); - return false; - } - - (void) POSIT(f); - //qDebug()<<"Number of POSIT iterations: "<<n_iter; - - if (!init_phase) - update_velocities(dt_valid); - - // we have a valid tracking result, leave init phase and reset time since valid result - init_phase = false; - dt_valid = 0; - return true; -} - -void PointTracker::predict(float dt) -{ - // predict with constant velocity - Matx33f R; - Rodrigues(dt*v_r, R); - X_CM.R = R*X_CM.R; - X_CM.t += dt * v_t; -} - -void PointTracker::update_velocities(float dt) -{ - // update velocities - Rodrigues(X_CM.R*X_CM_old.R.t(), v_r); - v_r /= dt; - v_t = (X_CM.t - X_CM_old.t)/dt; -} - -bool PointTracker::find_correspondences(const vector<Vec2f>& points, float f) -{ - if (init_phase) { - // We do a simple freetrack-like sorting in the init phase... - // sort points - int point_d_order[PointModel::N_POINTS]; - point_model->get_d_order(points, point_d_order); - - // set correspondences - for (int i=0; i<PointModel::N_POINTS; ++i) - { - p[point_model->d_order[i]] = points[point_d_order[i]]; - } - } - else { - // ... otherwise we look at the distance to the projection of the expected model points - // project model points under current pose - p_exp[0] = project(Vec3f(0,0,0), f); - p_exp[1] = project(point_model->M01, f); - p_exp[2] = project(point_model->M02, f); - - // set correspondences by minimum distance to projected model point - bool point_taken[PointModel::N_POINTS]; - for (int i=0; i<PointModel::N_POINTS; ++i) - point_taken[i] = false; - - float min_sdist = 0; - int min_idx = 0; - - for (int i=0; i<PointModel::N_POINTS; ++i) - { - // find closest point to projected model point i - for (int j=0; j<PointModel::N_POINTS; ++j) - { - Vec2f d = p_exp[i]-points[j]; - float sdist = d.dot(d); - if (sdist < min_sdist || j==0) - { - min_idx = j; - min_sdist = sdist; - } - } - // if one point is closest to more than one model point, abort - if (point_taken[min_idx]) return false; - point_taken[min_idx] = true; - p[i] = points[min_idx]; - } - } - return true; -} - - - -int PointTracker::POSIT(float f) -{ - // POSIT algorithm for coplanar points as presented in - // [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"] - // we use the same notation as in the paper here - - // The expected rotation used for resolving the ambiguity in POSIT: - // In every iteration step the rotation closer to R_expected is taken - Matx33f R_expected; - if (init_phase) - R_expected = Matx33f::eye(); // in the init phase, we want to be close to the default pose = no rotation - else - R_expected = X_CM.R; // later we want to be close to the last (predicted) rotation - - // initial pose = last (predicted) pose - Vec3f k; - get_row(R_expected, 2, k); - float Z0 = init_phase ? 1000 : X_CM.t[2]; - - float old_epsilon_1 = 0; - float old_epsilon_2 = 0; - float epsilon_1 = 1; - float epsilon_2 = 1; - - Vec3f I0, J0; - Vec2f I0_coeff, J0_coeff; - - Vec3f I_1, J_1, I_2, J_2; - Matx33f R_1, R_2; - Matx33f* R_current; - - const int MAX_ITER = 100; - const float EPS_THRESHOLD = 1e-4; - - int i=1; - for (; i<MAX_ITER; ++i) - { - epsilon_1 = k.dot(point_model->M01)/Z0; - epsilon_2 = k.dot(point_model->M02)/Z0; - - // vector of scalar products <I0, M0i> and <J0, M0i> - Vec2f I0_M0i(p[1][0]*(1.0 + epsilon_1) - p[0][0], - p[2][0]*(1.0 + epsilon_2) - p[0][0]); - Vec2f J0_M0i(p[1][1]*(1.0 + epsilon_1) - p[0][1], - p[2][1]*(1.0 + epsilon_2) - p[0][1]); - - // construct projection of I, J onto M0i plane: I0 and J0 - I0_coeff = point_model->P * I0_M0i; - J0_coeff = point_model->P * J0_M0i; - I0 = I0_coeff[0]*point_model->M01 + I0_coeff[1]*point_model->M02; - J0 = J0_coeff[0]*point_model->M01 + J0_coeff[1]*point_model->M02; - - // calculate u component of I, J - float II0 = I0.dot(I0); - float IJ0 = I0.dot(J0); - float JJ0 = J0.dot(J0); - float rho, theta; - if (JJ0 == II0) { - rho = sqrt(abs(2*IJ0)); - theta = -PI/4; - if (IJ0<0) theta *= -1; - } - else { - rho = sqrt(sqrt( (JJ0-II0)*(JJ0-II0) + 4*IJ0*IJ0 )); - theta = atan( -2*IJ0 / (JJ0-II0) ); - if (JJ0 - II0 < 0) theta += PI; - theta /= 2; - } - - // construct the two solutions - I_1 = I0 + rho*cos(theta)*point_model->u; - I_2 = I0 - rho*cos(theta)*point_model->u; - - J_1 = J0 + rho*sin(theta)*point_model->u; - J_2 = J0 - rho*sin(theta)*point_model->u; - - float norm_const = 1.0/norm(I_1); // all have the same norm - - // create rotation matrices - I_1 *= norm_const; J_1 *= norm_const; - I_2 *= norm_const; J_2 *= norm_const; - - set_row(R_1, 0, I_1); - set_row(R_1, 1, J_1); - set_row(R_1, 2, I_1.cross(J_1)); - - set_row(R_2, 0, I_2); - set_row(R_2, 1, J_2); - set_row(R_2, 2, I_2.cross(J_2)); - - // the single translation solution - Z0 = norm_const * f; - - // pick the rotation solution closer to the expected one - // in simple metric d(A,B) = || I - A * B^T || - float R_1_deviation = norm(Matx33f::eye() - R_expected * R_1.t()); - float R_2_deviation = norm(Matx33f::eye() - R_expected * R_2.t()); - - if (R_1_deviation < R_2_deviation) - R_current = &R_1; - else - R_current = &R_2; - - get_row(*R_current, 2, k); - - // check for convergence condition - if (abs(epsilon_1 - old_epsilon_1) + abs(epsilon_2 - old_epsilon_2) < EPS_THRESHOLD) - break; - old_epsilon_1 = epsilon_1; - old_epsilon_2 = epsilon_2; - } - - // apply results - X_CM.R = *R_current; - X_CM.t[0] = p[0][0] * Z0/f; - X_CM.t[1] = p[0][1] * Z0/f; - X_CM.t[2] = Z0; - - return i; - - //Rodrigues(X_CM.R, r); - //qDebug()<<"iter: "<<i; - //qDebug()<<"t: "<<X_CM.t[0]<<' '<<X_CM.t[1]<<' '<<X_CM.t[2]; - //Vec3f r; - // - //qDebug()<<"r: "<<r[0]<<' '<<r[1]<<' '<<r[2]<<'\n'; -} +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 "point_tracker.h" + +#include <vector> +#include <algorithm> +#include <cmath> + +#include <QDebug> + +using namespace cv; +using namespace std; + +const float PI = 3.14159265358979323846f; + +// ---------------------------------------------------------------------------- +static void get_row(const Matx33f& m, int i, Vec3f& v) +{ + v[0] = m(i,0); + v[1] = m(i,1); + v[2] = m(i,2); +} + +static void set_row(Matx33f& m, int i, const Vec3f& v) +{ + m(i,0) = v[0]; + m(i,1) = v[1]; + m(i,2) = v[2]; +} + +// ---------------------------------------------------------------------------- +PointModel::PointModel(Vec3f M01, Vec3f M02) + : M01(M01), + M02(M02) +{ + // calculate u + u = M01.cross(M02); + u /= norm(u); + + // calculate projection matrix on M01,M02 plane + float s11 = M01.dot(M01); + float s12 = M01.dot(M02); + float s22 = M02.dot(M02); + P = 1.0/(s11*s22-s12*s12) * Matx22f(s22, -s12, + -s12, s11); + + // calculate d and d_order for simple freetrack-like point correspondence + vector<Vec2f> points; + points.push_back(Vec2f(0,0)); + points.push_back(Vec2f(M01[0], M01[1])); + points.push_back(Vec2f(M02[0], M02[1])); + // fit line to orthographically projected points + // ERROR: yields wrong results with colinear points?! + /* + Vec4f line; + fitLine(points, line, CV_DIST_L2, 0, 0.01, 0.01); + d[0] = line[0]; d[1] = line[1]; + */ + // TODO: fix this + d = Vec2f(M01[0]-M02[0], M01[1]-M02[1]); + + // sort model points + get_d_order(points, d_order); +} + +#ifdef OPENTRACK_API +static bool d_vals_sort(const pair<float,int> a, const pair<float,int> b) +{ + return a.first < b.first; +} +#endif + +void PointModel::get_d_order(const std::vector<cv::Vec2f>& points, int d_order[]) const +{ + // get sort indices with respect to d scalar product + vector< pair<float,int> > d_vals; + for (unsigned i = 0; i<points.size(); ++i) + d_vals.push_back(pair<float, int>(d.dot(points[i]), i)); + + std::sort(d_vals.begin(), + d_vals.end(), +#ifdef OPENTRACK_API + d_vals_sort +#else + comp +#endif + ); + + for (unsigned i = 0; i<points.size(); ++i) + d_order[i] = d_vals[i].second; +} + + +// ---------------------------------------------------------------------------- +PointTracker::PointTracker() : + dynamic_pose_resolution(true), + dt_reset(1), + init_phase(true), + dt_valid(0), + v_t(0,0,0), + v_r(0,0,0) +{ + X_CM.t[2] = 1000; // default position: 1 m away from cam; +} + +void PointTracker::reset() +{ + // enter init phase and reset velocities + init_phase = true; + dt_valid = 0; + reset_velocities(); +} + +void PointTracker::reset_velocities() +{ + v_t = Vec3f(0,0,0); + v_r = Vec3f(0,0,0); +} + + +bool PointTracker::track(const vector<Vec2f>& points, float f, float dt) +{ + if (!dynamic_pose_resolution) init_phase = true; + + dt_valid += dt; + // if there was no valid tracking result for too long, do a reset + if (dt_valid > dt_reset) + { + //qDebug()<<"dt_valid "<<dt_valid<<" > dt_reset "<<dt_reset; + reset(); + } + + bool no_model = +#ifdef OPENTRACK_API + point_model.get() == NULL; +#else + !point_model; +#endif + + // if there is a pointtracking problem, reset the velocities + if (no_model || points.size() != PointModel::N_POINTS) + { + //qDebug()<<"Wrong number of points!"; + reset_velocities(); + return false; + } + + X_CM_old = X_CM; // backup old transformation for velocity calculation + + if (!init_phase) + predict(dt_valid); + + // if there is a point correspondence problem something has gone wrong, do a reset + if (!find_correspondences(points, f)) + { + //qDebug()<<"Error in finding point correspondences!"; + X_CM = X_CM_old; // undo prediction + reset(); + return false; + } + + (void) POSIT(f); + //qDebug()<<"Number of POSIT iterations: "<<n_iter; + + if (!init_phase) + update_velocities(dt_valid); + + // we have a valid tracking result, leave init phase and reset time since valid result + init_phase = false; + dt_valid = 0; + return true; +} + +void PointTracker::predict(float dt) +{ + // predict with constant velocity + Matx33f R; + Rodrigues(dt*v_r, R); + X_CM.R = R*X_CM.R; + X_CM.t += dt * v_t; +} + +void PointTracker::update_velocities(float dt) +{ + // update velocities + Rodrigues(X_CM.R*X_CM_old.R.t(), v_r); + v_r /= dt; + v_t = (X_CM.t - X_CM_old.t)/dt; +} + +bool PointTracker::find_correspondences(const vector<Vec2f>& points, float f) +{ + if (init_phase) { + // We do a simple freetrack-like sorting in the init phase... + // sort points + int point_d_order[PointModel::N_POINTS]; + point_model->get_d_order(points, point_d_order); + + // set correspondences + for (int i=0; i<PointModel::N_POINTS; ++i) + { + p[point_model->d_order[i]] = points[point_d_order[i]]; + } + } + else { + // ... otherwise we look at the distance to the projection of the expected model points + // project model points under current pose + p_exp[0] = project(Vec3f(0,0,0), f); + p_exp[1] = project(point_model->M01, f); + p_exp[2] = project(point_model->M02, f); + + // set correspondences by minimum distance to projected model point + bool point_taken[PointModel::N_POINTS]; + for (int i=0; i<PointModel::N_POINTS; ++i) + point_taken[i] = false; + + float min_sdist = 0; + int min_idx = 0; + + for (int i=0; i<PointModel::N_POINTS; ++i) + { + // find closest point to projected model point i + for (int j=0; j<PointModel::N_POINTS; ++j) + { + Vec2f d = p_exp[i]-points[j]; + float sdist = d.dot(d); + if (sdist < min_sdist || j==0) + { + min_idx = j; + min_sdist = sdist; + } + } + // if one point is closest to more than one model point, abort + if (point_taken[min_idx]) return false; + point_taken[min_idx] = true; + p[i] = points[min_idx]; + } + } + return true; +} + + + +int PointTracker::POSIT(float f) +{ + // POSIT algorithm for coplanar points as presented in + // [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"] + // we use the same notation as in the paper here + + // The expected rotation used for resolving the ambiguity in POSIT: + // In every iteration step the rotation closer to R_expected is taken + Matx33f R_expected; + if (init_phase) + R_expected = Matx33f::eye(); // in the init phase, we want to be close to the default pose = no rotation + else + R_expected = X_CM.R; // later we want to be close to the last (predicted) rotation + + // initial pose = last (predicted) pose + Vec3f k; + get_row(R_expected, 2, k); + float Z0 = init_phase ? 1000 : X_CM.t[2]; + + float old_epsilon_1 = 0; + float old_epsilon_2 = 0; + float epsilon_1 = 1; + float epsilon_2 = 1; + + Vec3f I0, J0; + Vec2f I0_coeff, J0_coeff; + + Vec3f I_1, J_1, I_2, J_2; + Matx33f R_1, R_2; + Matx33f* R_current; + + const int MAX_ITER = 100; + const float EPS_THRESHOLD = 1e-4; + + int i=1; + for (; i<MAX_ITER; ++i) + { + epsilon_1 = k.dot(point_model->M01)/Z0; + epsilon_2 = k.dot(point_model->M02)/Z0; + + // vector of scalar products <I0, M0i> and <J0, M0i> + Vec2f I0_M0i(p[1][0]*(1.0 + epsilon_1) - p[0][0], + p[2][0]*(1.0 + epsilon_2) - p[0][0]); + Vec2f J0_M0i(p[1][1]*(1.0 + epsilon_1) - p[0][1], + p[2][1]*(1.0 + epsilon_2) - p[0][1]); + + // construct projection of I, J onto M0i plane: I0 and J0 + I0_coeff = point_model->P * I0_M0i; + J0_coeff = point_model->P * J0_M0i; + I0 = I0_coeff[0]*point_model->M01 + I0_coeff[1]*point_model->M02; + J0 = J0_coeff[0]*point_model->M01 + J0_coeff[1]*point_model->M02; + + // calculate u component of I, J + float II0 = I0.dot(I0); + float IJ0 = I0.dot(J0); + float JJ0 = J0.dot(J0); + float rho, theta; + if (JJ0 == II0) { + rho = sqrt(abs(2*IJ0)); + theta = -PI/4; + if (IJ0<0) theta *= -1; + } + else { + rho = sqrt(sqrt( (JJ0-II0)*(JJ0-II0) + 4*IJ0*IJ0 )); + theta = atan( -2*IJ0 / (JJ0-II0) ); + if (JJ0 - II0 < 0) theta += PI; + theta /= 2; + } + + // construct the two solutions + I_1 = I0 + rho*cos(theta)*point_model->u; + I_2 = I0 - rho*cos(theta)*point_model->u; + + J_1 = J0 + rho*sin(theta)*point_model->u; + J_2 = J0 - rho*sin(theta)*point_model->u; + + float norm_const = 1.0/norm(I_1); // all have the same norm + + // create rotation matrices + I_1 *= norm_const; J_1 *= norm_const; + I_2 *= norm_const; J_2 *= norm_const; + + set_row(R_1, 0, I_1); + set_row(R_1, 1, J_1); + set_row(R_1, 2, I_1.cross(J_1)); + + set_row(R_2, 0, I_2); + set_row(R_2, 1, J_2); + set_row(R_2, 2, I_2.cross(J_2)); + + // the single translation solution + Z0 = norm_const * f; + + // pick the rotation solution closer to the expected one + // in simple metric d(A,B) = || I - A * B^T || + float R_1_deviation = norm(Matx33f::eye() - R_expected * R_1.t()); + float R_2_deviation = norm(Matx33f::eye() - R_expected * R_2.t()); + + if (R_1_deviation < R_2_deviation) + R_current = &R_1; + else + R_current = &R_2; + + get_row(*R_current, 2, k); + + // check for convergence condition + if (abs(epsilon_1 - old_epsilon_1) + abs(epsilon_2 - old_epsilon_2) < EPS_THRESHOLD) + break; + old_epsilon_1 = epsilon_1; + old_epsilon_2 = epsilon_2; + } + + // apply results + X_CM.R = *R_current; + X_CM.t[0] = p[0][0] * Z0/f; + X_CM.t[1] = p[0][1] * Z0/f; + X_CM.t[2] = Z0; + + return i; + + //Rodrigues(X_CM.R, r); + //qDebug()<<"iter: "<<i; + //qDebug()<<"t: "<<X_CM.t[0]<<' '<<X_CM.t[1]<<' '<<X_CM.t[2]; + //Vec3f r; + // + //qDebug()<<"r: "<<r[0]<<' '<<r[1]<<' '<<r[2]<<'\n'; +} diff --git a/ftnoir_tracker_pt/point_tracker.h b/ftnoir_tracker_pt/point_tracker.h index 3ff9c724..512681fc 100644 --- a/ftnoir_tracker_pt/point_tracker.h +++ b/ftnoir_tracker_pt/point_tracker.h @@ -1,129 +1,129 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - -#ifndef POINTTRACKER_H -#define POINTTRACKER_H - -#include <opencv2/opencv.hpp> -#ifndef OPENTRACK_API -# include <boost/shared_ptr.hpp> -#else +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#ifndef POINTTRACKER_H +#define POINTTRACKER_H + +#include <opencv2/opencv.hpp> +#ifndef OPENTRACK_API +# include <boost/shared_ptr.hpp> +#else # include <memory> -#endif -#include <list> - -// ---------------------------------------------------------------------------- -// Affine frame trafo -class FrameTrafo -{ -public: - FrameTrafo() : R(cv::Matx33f::eye()), t(0,0,0) {} - FrameTrafo(const cv::Matx33f& R, const cv::Vec3f& t) : R(R),t(t) {} - - cv::Matx33f R; - cv::Vec3f t; -}; - -inline FrameTrafo operator*(const FrameTrafo& X, const FrameTrafo& Y) -{ - return FrameTrafo(X.R*Y.R, X.R*Y.t + X.t); -} - -inline FrameTrafo operator*(const cv::Matx33f& X, const FrameTrafo& Y) -{ - return FrameTrafo(X*Y.R, X*Y.t); -} - -inline FrameTrafo operator*(const FrameTrafo& X, const cv::Matx33f& Y) -{ - return FrameTrafo(X.R*Y, X.t); -} - -inline cv::Vec3f operator*(const FrameTrafo& X, const cv::Vec3f& v) -{ - return X.R*v + X.t; -} - - -// ---------------------------------------------------------------------------- -// Describes a 3-point model -// nomenclature as in -// [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"] -class PointModel -{ - friend class PointTracker; -public: - static const int N_POINTS = 3; - - PointModel(cv::Vec3f M01, cv::Vec3f M02); - - const cv::Vec3f& get_M01() const { return M01; }; - const cv::Vec3f& get_M02() const { return M02; }; - -protected: - cv::Vec3f M01; // M01 in model frame - cv::Vec3f M02; // M02 in model frame - - cv::Vec3f u; // unit vector perpendicular to M01,M02-plane - - cv::Matx22f P; - - cv::Vec2f d; // discriminant vector for point correspondence - int d_order[3]; // sorting of projected model points with respect to d scalar product - - void get_d_order(const std::vector<cv::Vec2f>& points, int d_order[]) const; -}; - -// ---------------------------------------------------------------------------- -// Tracks a 3-point model -// implementing the POSIT algorithm for coplanar points as presented in -// [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"] -class PointTracker -{ -public: - PointTracker(); - - // track the pose using the set of normalized point coordinates (x pos in range -0.5:0.5) - // f : (focal length)/(sensor width) - // dt : time since last call - bool track(const std::vector<cv::Vec2f>& points, float f, float dt); - std::shared_ptr<PointModel> point_model; - - bool dynamic_pose_resolution; - float dt_reset; - - FrameTrafo get_pose() const { return X_CM; } - void reset(); - -protected: - inline cv::Vec2f project(const cv::Vec3f& v_M, float f) - { - cv::Vec3f v_C = X_CM * v_M; - return cv::Vec2f(f*v_C[0]/v_C[2], f*v_C[1]/v_C[2]); - } - - bool find_correspondences(const std::vector<cv::Vec2f>& points, float f); - - cv::Vec2f p[PointModel::N_POINTS]; // the points in model order - cv::Vec2f p_exp[PointModel::N_POINTS]; // the expected point positions - - void predict(float dt); - void update_velocities(float dt); - void reset_velocities(); - - - int POSIT(float f); // The POSIT algorithm, returns the number of iterations - - bool init_phase; - float dt_valid; // time since last valid tracking result - cv::Vec3f v_t; // velocities - cv::Vec3f v_r; - FrameTrafo X_CM; // trafo from model to camera - FrameTrafo X_CM_old; -}; - -#endif //POINTTRACKER_H +#endif +#include <list> + +// ---------------------------------------------------------------------------- +// Affine frame trafo +class FrameTrafo +{ +public: + FrameTrafo() : R(cv::Matx33f::eye()), t(0,0,0) {} + FrameTrafo(const cv::Matx33f& R, const cv::Vec3f& t) : R(R),t(t) {} + + cv::Matx33f R; + cv::Vec3f t; +}; + +inline FrameTrafo operator*(const FrameTrafo& X, const FrameTrafo& Y) +{ + return FrameTrafo(X.R*Y.R, X.R*Y.t + X.t); +} + +inline FrameTrafo operator*(const cv::Matx33f& X, const FrameTrafo& Y) +{ + return FrameTrafo(X*Y.R, X*Y.t); +} + +inline FrameTrafo operator*(const FrameTrafo& X, const cv::Matx33f& Y) +{ + return FrameTrafo(X.R*Y, X.t); +} + +inline cv::Vec3f operator*(const FrameTrafo& X, const cv::Vec3f& v) +{ + return X.R*v + X.t; +} + + +// ---------------------------------------------------------------------------- +// Describes a 3-point model +// nomenclature as in +// [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"] +class PointModel +{ + friend class PointTracker; +public: + static const int N_POINTS = 3; + + PointModel(cv::Vec3f M01, cv::Vec3f M02); + + const cv::Vec3f& get_M01() const { return M01; }; + const cv::Vec3f& get_M02() const { return M02; }; + +protected: + cv::Vec3f M01; // M01 in model frame + cv::Vec3f M02; // M02 in model frame + + cv::Vec3f u; // unit vector perpendicular to M01,M02-plane + + cv::Matx22f P; + + cv::Vec2f d; // discriminant vector for point correspondence + int d_order[3]; // sorting of projected model points with respect to d scalar product + + void get_d_order(const std::vector<cv::Vec2f>& points, int d_order[]) const; +}; + +// ---------------------------------------------------------------------------- +// Tracks a 3-point model +// implementing the POSIT algorithm for coplanar points as presented in +// [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"] +class PointTracker +{ +public: + PointTracker(); + + // track the pose using the set of normalized point coordinates (x pos in range -0.5:0.5) + // f : (focal length)/(sensor width) + // dt : time since last call + bool track(const std::vector<cv::Vec2f>& points, float f, float dt); + std::shared_ptr<PointModel> point_model; + + bool dynamic_pose_resolution; + float dt_reset; + + FrameTrafo get_pose() const { return X_CM; } + void reset(); + +protected: + inline cv::Vec2f project(const cv::Vec3f& v_M, float f) + { + cv::Vec3f v_C = X_CM * v_M; + return cv::Vec2f(f*v_C[0]/v_C[2], f*v_C[1]/v_C[2]); + } + + bool find_correspondences(const std::vector<cv::Vec2f>& points, float f); + + cv::Vec2f p[PointModel::N_POINTS]; // the points in model order + cv::Vec2f p_exp[PointModel::N_POINTS]; // the expected point positions + + void predict(float dt); + void update_velocities(float dt); + void reset_velocities(); + + + int POSIT(float f); // The POSIT algorithm, returns the number of iterations + + bool init_phase; + float dt_valid; // time since last valid tracking result + cv::Vec3f v_t; // velocities + cv::Vec3f v_r; + FrameTrafo X_CM; // trafo from model to camera + FrameTrafo X_CM_old; +}; + +#endif //POINTTRACKER_H diff --git a/ftnoir_tracker_pt/pt_video_widget.cpp b/ftnoir_tracker_pt/pt_video_widget.cpp index 02817cbf..cb3dc48e 100644 --- a/ftnoir_tracker_pt/pt_video_widget.cpp +++ b/ftnoir_tracker_pt/pt_video_widget.cpp @@ -1,64 +1,64 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - * - * 20130312, WVR: Add 7 lines to resizeGL after resize_frame. This should lower CPU-load. - */ - -#include "pt_video_widget.h" - -#include <QDebug> -#include <QHBoxLayout> - -using namespace cv; -using namespace std; - -void PTVideoWidget::update_image(const cv::Mat& frame) -{ - QMutexLocker foo(&mtx); - _frame = frame.clone(); - freshp = true; -} - -// ---------------------------------------------------------------------------- -VideoWidgetDialog::VideoWidgetDialog(QWidget *parent, FrameProvider* provider) - : QDialog(parent), - video_widget(NULL) -{ - const int VIDEO_FRAME_WIDTH = 640; - const int VIDEO_FRAME_HEIGHT = 480; - - video_widget = new PTVideoWidget(this, provider); - - QHBoxLayout* layout = new QHBoxLayout(); - layout->setContentsMargins(0, 0, 0, 0); - layout->addWidget(video_widget); - if (this->layout()) delete this->layout(); - setLayout(layout); - resize(VIDEO_FRAME_WIDTH, VIDEO_FRAME_HEIGHT); -} - -void PTVideoWidget::update_and_repaint() -{ - QMutexLocker foo(&mtx); - if (_frame.empty() || !freshp) - return; - freshp = false; - QImage qframe = QImage(_frame.cols, _frame.rows, QImage::Format_RGB888); - uchar* data = qframe.bits(); - const int pitch = qframe.bytesPerLine(); - for (int y = 0; y < _frame.rows; y++) - for (int x = 0; x < _frame.cols; x++) - { - const auto& elt = _frame.at<Vec3b>(y, x); - const cv::Scalar elt2 = static_cast<cv::Scalar>(elt); - data[y * pitch + x * 3 + 0] = elt2.val[2]; - data[y * pitch + x * 3 + 1] = elt2.val[1]; - data[y * pitch + x * 3 + 2] = elt2.val[0]; - } - qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); - texture = qframe; - update(); -} +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + * + * 20130312, WVR: Add 7 lines to resizeGL after resize_frame. This should lower CPU-load. + */ + +#include "pt_video_widget.h" + +#include <QDebug> +#include <QHBoxLayout> + +using namespace cv; +using namespace std; + +void PTVideoWidget::update_image(const cv::Mat& frame) +{ + QMutexLocker foo(&mtx); + _frame = frame.clone(); + freshp = true; +} + +// ---------------------------------------------------------------------------- +VideoWidgetDialog::VideoWidgetDialog(QWidget *parent, FrameProvider* provider) + : QDialog(parent), + video_widget(NULL) +{ + const int VIDEO_FRAME_WIDTH = 640; + const int VIDEO_FRAME_HEIGHT = 480; + + video_widget = new PTVideoWidget(this, provider); + + QHBoxLayout* layout = new QHBoxLayout(); + layout->setContentsMargins(0, 0, 0, 0); + layout->addWidget(video_widget); + if (this->layout()) delete this->layout(); + setLayout(layout); + resize(VIDEO_FRAME_WIDTH, VIDEO_FRAME_HEIGHT); +} + +void PTVideoWidget::update_and_repaint() +{ + QMutexLocker foo(&mtx); + if (_frame.empty() || !freshp) + return; + freshp = false; + QImage qframe = QImage(_frame.cols, _frame.rows, QImage::Format_RGB888); + uchar* data = qframe.bits(); + const int pitch = qframe.bytesPerLine(); + for (int y = 0; y < _frame.rows; y++) + for (int x = 0; x < _frame.cols; x++) + { + const auto& elt = _frame.at<Vec3b>(y, x); + const cv::Scalar elt2 = static_cast<cv::Scalar>(elt); + data[y * pitch + x * 3 + 0] = elt2.val[2]; + data[y * pitch + x * 3 + 1] = elt2.val[1]; + data[y * pitch + x * 3 + 2] = elt2.val[0]; + } + qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); + texture = qframe; + update(); +} diff --git a/ftnoir_tracker_pt/pt_video_widget.h b/ftnoir_tracker_pt/pt_video_widget.h index f7de4db8..1be5f5f2 100644 --- a/ftnoir_tracker_pt/pt_video_widget.h +++ b/ftnoir_tracker_pt/pt_video_widget.h @@ -1,71 +1,71 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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 "frame_observer.h" -#include <QObject> -#include <QTime> -#include <QDialog> -#include <opencv2/opencv.hpp> -#ifndef OPENTRACK_API -# include <QGLWidget> -# include <boost/shared_ptr.hpp> -#else +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 "frame_observer.h" +#include <QObject> +#include <QTime> +#include <QDialog> +#include <opencv2/opencv.hpp> +#ifndef OPENTRACK_API +# include <QGLWidget> +# include <boost/shared_ptr.hpp> +#else # include <memory> -# if defined(_WIN32) -# include <dshow.h> -# endif -#endif -#include <QPainter> -#include <QPaintEvent> -#include <QTimer> - -class PTVideoWidget : public QWidget, public FrameObserver -{ - Q_OBJECT - -public: - PTVideoWidget(QWidget *parent, FrameProvider* provider) : - QWidget(parent), - /* to avoid linker errors */ FrameObserver(provider), - freshp(false) - { - connect(&timer, SIGNAL(timeout()), this, SLOT(update_and_repaint())); - timer.start(40); - } - void update_image(const cv::Mat &frame); - void update_frame_and_points() {} -protected slots: - void paintEvent( QPaintEvent* e ) { - QMutexLocker foo(&mtx); - QPainter painter(this); - painter.drawImage(e->rect(), texture); - } - void update_and_repaint(); -private: - QMutex mtx; - QImage texture; - QTimer timer; - cv::Mat _frame; - bool freshp; -}; - -// ---------------------------------------------------------------------------- -// A VideoWidget embedded in a dialog frame -class VideoWidgetDialog : public QDialog -{ - Q_OBJECT -public: - VideoWidgetDialog(QWidget *parent, FrameProvider* provider); - virtual ~VideoWidgetDialog() {} - - PTVideoWidget* get_video_widget() { return video_widget; } - -private: - PTVideoWidget* video_widget; -}; +# if defined(_WIN32) +# include <dshow.h> +# endif +#endif +#include <QPainter> +#include <QPaintEvent> +#include <QTimer> + +class PTVideoWidget : public QWidget, public FrameObserver +{ + Q_OBJECT + +public: + PTVideoWidget(QWidget *parent, FrameProvider* provider) : + QWidget(parent), + /* to avoid linker errors */ FrameObserver(provider), + freshp(false) + { + connect(&timer, SIGNAL(timeout()), this, SLOT(update_and_repaint())); + timer.start(40); + } + void update_image(const cv::Mat &frame); + void update_frame_and_points() {} +protected slots: + void paintEvent( QPaintEvent* e ) { + QMutexLocker foo(&mtx); + QPainter painter(this); + painter.drawImage(e->rect(), texture); + } + void update_and_repaint(); +private: + QMutex mtx; + QImage texture; + QTimer timer; + cv::Mat _frame; + bool freshp; +}; + +// ---------------------------------------------------------------------------- +// A VideoWidget embedded in a dialog frame +class VideoWidgetDialog : public QDialog +{ + Q_OBJECT +public: + VideoWidgetDialog(QWidget *parent, FrameProvider* provider); + virtual ~VideoWidgetDialog() {} + + PTVideoWidget* get_video_widget() { return video_widget; } + +private: + PTVideoWidget* video_widget; +}; diff --git a/ftnoir_tracker_pt/trans_calib.cpp b/ftnoir_tracker_pt/trans_calib.cpp index 9b75a1b6..729a0b7f 100644 --- a/ftnoir_tracker_pt/trans_calib.cpp +++ b/ftnoir_tracker_pt/trans_calib.cpp @@ -1,44 +1,44 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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 "trans_calib.h" - -using namespace cv; - -//----------------------------------------------------------------------------- -TranslationCalibrator::TranslationCalibrator() -{ - reset(); -} - -void TranslationCalibrator::reset() -{ - P = Matx66f::zeros(); - y = Vec6f(0,0,0, 0,0,0); -} - -void TranslationCalibrator::update(const Matx33f& R_CM_k, const Vec3f& t_CM_k) -{ - Matx<float, 6,3> H_k_T = Matx<float, 6,3>::zeros(); - for (int i=0; i<3; ++i) { - for (int j=0; j<3; ++j) { - H_k_T(i,j) = R_CM_k(j,i); - } - } - for (int i=0; i<3; ++i) - { - H_k_T(3+i,i) = 1.0; - } - P += H_k_T * H_k_T.t(); - y += H_k_T * t_CM_k; -} - -Vec3f TranslationCalibrator::get_estimate() -{ - Vec6f x = P.inv() * y; - return Vec3f(-x[0], -x[1], -x[2]); +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 "trans_calib.h" + +using namespace cv; + +//----------------------------------------------------------------------------- +TranslationCalibrator::TranslationCalibrator() +{ + reset(); +} + +void TranslationCalibrator::reset() +{ + P = Matx66f::zeros(); + y = Vec6f(0,0,0, 0,0,0); +} + +void TranslationCalibrator::update(const Matx33f& R_CM_k, const Vec3f& t_CM_k) +{ + Matx<float, 6,3> H_k_T = Matx<float, 6,3>::zeros(); + for (int i=0; i<3; ++i) { + for (int j=0; j<3; ++j) { + H_k_T(i,j) = R_CM_k(j,i); + } + } + for (int i=0; i<3; ++i) + { + H_k_T(3+i,i) = 1.0; + } + P += H_k_T * H_k_T.t(); + y += H_k_T * t_CM_k; +} + +Vec3f TranslationCalibrator::get_estimate() +{ + Vec6f x = P.inv() * y; + return Vec3f(-x[0], -x[1], -x[2]); } \ No newline at end of file diff --git a/ftnoir_tracker_pt/trans_calib.h b/ftnoir_tracker_pt/trans_calib.h index f2521690..609c9af1 100644 --- a/ftnoir_tracker_pt/trans_calib.h +++ b/ftnoir_tracker_pt/trans_calib.h @@ -1,39 +1,39 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - -#ifndef TRANSCALIB_H -#define TRANSCALIB_H - -#include <opencv2/opencv.hpp> - -//----------------------------------------------------------------------------- -// Calibrates the translation from head to model = t_MH -// by recursive least squares / -// kalman filter in information form with identity noise covariance -// measurement equation when head position = t_CH is fixed: -// (R_CM_k , Id)*(-t_MH, t_CH) = t_CM_k - -class TranslationCalibrator -{ -public: - TranslationCalibrator(); - - // reset the calibration process - void reset(); - - // update the current estimate - void update(const cv::Matx33f& R_CM_k, const cv::Vec3f& t_CM_k); - - // get the current estimate for t_MH - cv::Vec3f get_estimate(); - -protected: - cv::Matx66f P; // normalized precision matrix = inverse covariance - cv::Vec6f y; // P*(-t_MH, t_CH) -}; - +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#ifndef TRANSCALIB_H +#define TRANSCALIB_H + +#include <opencv2/opencv.hpp> + +//----------------------------------------------------------------------------- +// Calibrates the translation from head to model = t_MH +// by recursive least squares / +// kalman filter in information form with identity noise covariance +// measurement equation when head position = t_CH is fixed: +// (R_CM_k , Id)*(-t_MH, t_CH) = t_CM_k + +class TranslationCalibrator +{ +public: + TranslationCalibrator(); + + // reset the calibration process + void reset(); + + // update the current estimate + void update(const cv::Matx33f& R_CM_k, const cv::Vec3f& t_CM_k); + + // get the current estimate for t_MH + cv::Vec3f get_estimate(); + +protected: + cv::Matx66f P; // normalized precision matrix = inverse covariance + cv::Vec6f y; // P*(-t_MH, t_CH) +}; + #endif //TRANSCALIB_H \ No newline at end of file -- cgit v1.2.3 From 33de6458080fa9dc9bf6a9d355e89f23f9ee1f02 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 22:37:07 +0200 Subject: PT tracker feature removal Some PT features got under the knife: - dynamic pose resolution velocity prediction model - tracker dialog's tracker tab - focal length coefficient --- ftnoir_tracker_pt/FTNoIR_PT_Controls.ui | 2206 ++++++++++-------------- ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 21 +- ftnoir_tracker_pt/ftnoir_tracker_pt.h | 4 +- ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp | 28 +- ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h | 6 +- ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h | 10 +- ftnoir_tracker_pt/point_tracker.cpp | 179 +- ftnoir_tracker_pt/point_tracker.h | 26 +- 8 files changed, 998 insertions(+), 1482 deletions(-) diff --git a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui index a2d5c47c..73b1f767 100644 --- a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui +++ b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui @@ -9,7 +9,7 @@ <rect> <x>0</x> <y>0</y> - <width>459</width> + <width>453</width> <height>621</height> </rect> </property> @@ -32,11 +32,83 @@ <property name="autoFillBackground"> <bool>false</bool> </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> + <layout class="QGridLayout" name="gridLayout_9"> <property name="sizeConstraint"> <enum>QLayout::SetFixedSize</enum> </property> - <item> + <item row="1" column="0"> + <widget class="QGroupBox" name="groupBox_5"> + <property name="title"> + <string>Status</string> + </property> + <layout class="QGridLayout" name="gridLayout_10"> + <item row="2" column="2"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Extracted Points:</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_38"> + <property name="text"> + <string>Camera Info:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QDialogButtonBox" name="buttonBox_2"> + <property name="standardButtons"> + <set>QDialogButtonBox::Apply</set> + </property> + <property name="centerButtons"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="caminfo_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>120</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="pointinfo_label"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="0"> <widget class="QTabWidget" name="tabWidget"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> @@ -56,73 +128,261 @@ <property name="currentIndex"> <number>0</number> </property> - <widget class="QWidget" name="tab"> + <widget class="QWidget" name="tab_2"> <attribute name="title"> - <string>General</string> + <string>Camera</string> </attribute> - <layout class="QVBoxLayout" name="verticalLayout_3"> + <layout class="QVBoxLayout" name="verticalLayout"> <item> - <widget class="QGroupBox" name="groupBox_6"> + <widget class="QGroupBox" name="groupBox"> <property name="title"> - <string>Tracker Thread</string> + <string>Camera settings</string> </property> - <layout class="QGridLayout" name="gridLayout"> + <layout class="QGridLayout" name="gridLayout_2"> <item row="0" column="0"> - <widget class="QLabel" name="label_43"> + <widget class="QLabel" name="label_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="text"> - <string>Auto-reset time</string> + <string>Device</string> </property> <property name="buddy"> - <cstring>reset_spin</cstring> + <cstring>camdevice_combo</cstring> </property> </widget> </item> <item row="0" column="1"> - <widget class="QSpinBox" name="reset_spin"> + <widget class="QComboBox" name="camdevice_combo"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumContentsLength"> + <number>10</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_36"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Width</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="res_x_spin"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Desired capture width</string> + </property> + <property name="suffix"> + <string> px</string> + </property> + <property name="maximum"> + <number>2000</number> + </property> + <property name="singleStep"> + <number>10</number> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_41"> <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Height</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QSpinBox" name="res_y_spin"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Desired capture height</string> + </property> + <property name="suffix"> + <string> px</string> + </property> + <property name="maximum"> + <number>2000</number> + </property> + <property name="singleStep"> + <number>10</number> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_37"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>FPS</string> + </property> + <property name="buddy"> + <cstring>fps_spin</cstring> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QSpinBox" name="fps_spin"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="toolTip"> - <string>Time until automatic reset of tracker's internal state when no valid tracking result is found</string> + <string>Desired capture framerate</string> </property> <property name="suffix"> - <string>ms</string> + <string> Hz</string> </property> <property name="maximum"> - <number>9999</number> + <number>2000</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_4"> + <property name="title"> + <string>Camera orientation</string> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="label_18"> + <property name="text"> + <string>Roll</string> + </property> + <property name="buddy"> + <cstring>camroll_combo</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="camroll_combo"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Rotation of the camera image</string> </property> </widget> </item> <item row="1" column="0"> - <widget class="QLabel" name="label_17"> + <widget class="QLabel" name="label_4"> <property name="text"> - <string>Dynamic Pose Resolution</string> + <string>Pitch</string> + </property> + <property name="buddy"> + <cstring>campitch_spin</cstring> </property> </widget> </item> <item row="1" column="1"> - <widget class="QCheckBox" name="dynpose_check"> + <widget class="QSpinBox" name="campitch_spin"> + <property name="contextMenuPolicy"> + <enum>Qt::DefaultContextMenu</enum> + </property> <property name="toolTip"> - <string/> + <string>The angle the camera is facing upwards</string> </property> + <property name="suffix"> + <string> deg</string> + </property> + <property name="minimum"> + <number>-180</number> + </property> + <property name="maximum"> + <number>180</number> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="label_5"> <property name="text"> - <string/> + <string>positive = upwards</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_20"> + <property name="text"> + <string>Yaw</string> + </property> + <property name="buddy"> + <cstring>camyaw_spin</cstring> </property> </widget> </item> <item row="2" column="1"> - <widget class="QPushButton" name="reset_button"> - <property name="enabled"> - <bool>false</bool> + <widget class="QSpinBox" name="camyaw_spin"> + <property name="contextMenuPolicy"> + <enum>Qt::DefaultContextMenu</enum> </property> <property name="toolTip"> - <string>Reset the tracker's internal state</string> + <string>The angle the camera is facing leftwards</string> </property> + <property name="suffix"> + <string> deg</string> + </property> + <property name="prefix"> + <string/> + </property> + <property name="minimum"> + <number>-180</number> + </property> + <property name="maximum"> + <number>180</number> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="label_21"> <property name="text"> - <string>Reset</string> + <string>positve = left</string> </property> </widget> </item> @@ -130,1071 +390,657 @@ </widget> </item> <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Point extraction</string> </property> - </spacer> + <layout class="QGridLayout" name="gridLayout_7"> + <item row="0" column="4"> + <widget class="QSpinBox" name="mindiam_spin"> + <property name="toolTip"> + <string>Minimum point diameter</string> + </property> + <property name="suffix"> + <string> px</string> + </property> + <property name="maximum"> + <number>1024</number> + </property> + </widget> + </item> + <item row="0" column="1" colspan="2"> + <widget class="QSlider" name="threshold_slider"> + <property name="toolTip"> + <string>Intensity threshold for point extraction</string> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="pageStep"> + <number>1</number> + </property> + <property name="value"> + <number>127</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksBothSides</enum> + </property> + <property name="tickInterval"> + <number>25</number> + </property> + </widget> + </item> + <item row="1" column="4"> + <widget class="QSpinBox" name="maxdiam_spin"> + <property name="toolTip"> + <string>Maximum point diameter</string> + </property> + <property name="suffix"> + <string> px</string> + </property> + <property name="maximum"> + <number>1024</number> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Max size</string> + </property> + <property name="buddy"> + <cstring>maxdiam_spin</cstring> + </property> + </widget> + </item> + <item row="1" column="1" colspan="2"> + <widget class="QSlider" name="threshold_secondary_slider"> + <property name="toolTip"> + <string>Per pixel hysteresis width (leave left if there is little difference between dot and non-dot, move right for increased stability against pixel noise)</string> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="pageStep"> + <number>1</number> + </property> + <property name="value"> + <number>100</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksBothSides</enum> + </property> + <property name="tickInterval"> + <number>25</number> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Threshold</string> + </property> + <property name="buddy"> + <cstring>threshold_slider</cstring> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_secondary"> + <property name="text"> + <string>Hysteresis</string> + </property> + <property name="buddy"> + <cstring>threshold_secondary_slider</cstring> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Min size</string> + </property> + <property name="buddy"> + <cstring>mindiam_spin</cstring> + </property> + </widget> + </item> + </layout> + </widget> </item> </layout> </widget> - <widget class="QWidget" name="tab_2"> + <widget class="QWidget" name="tab_4"> <attribute name="title"> - <string>Camera</string> + <string>Model</string> </attribute> - <layout class="QVBoxLayout" name="verticalLayout_7"> + <layout class="QVBoxLayout" name="verticalLayout_16"> <item> - <widget class="QGroupBox" name="groupBox"> - <property name="toolTip"> - <string>The camera device used as input</string> + <widget class="QTabWidget" name="model_tabs"> + <property name="tabShape"> + <enum>QTabWidget::Rounded</enum> </property> - <property name="title"> - <string>Camera Settings</string> + <property name="currentIndex"> + <number>1</number> + </property> + <property name="usesScrollButtons"> + <bool>false</bool> + </property> + <property name="documentMode"> + <bool>false</bool> + </property> + <property name="tabsClosable"> + <bool>false</bool> </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QLabel" name="label_2"> - <property name="minimumSize"> - <size> - <width>55</width> - <height>0</height> - </size> + <widget class="QWidget" name="tab_5"> + <attribute name="title"> + <string>Clip</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_6"> + <item row="0" column="0"> + <widget class="QGroupBox" name="groupBox_8"> + <property name="title"> + <string>Model Dimensions</string> + </property> + <widget class="QSpinBox" name="clip_tlength_spin"> + <property name="geometry"> + <rect> + <x>70</x> + <y>35</y> + <width>100</width> + <height>22</height> + </rect> </property> - <property name="text"> - <string>Device</string> + <property name="suffix"> + <string> units</string> </property> - <property name="buddy"> - <cstring>camdevice_combo</cstring> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65535</number> </property> </widget> - </item> - <item> - <widget class="QComboBox" name="camdevice_combo"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <widget class="QSpinBox" name="clip_bheight_spin"> + <property name="geometry"> + <rect> + <x>110</x> + <y>115</y> + <width>100</width> + <height>22</height> + </rect> </property> - <property name="toolTip"> - <string>Camera device used as input</string> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65535</number> </property> </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_8"> - <item> - <layout class="QGridLayout" name="gridLayout_8"> - <item row="0" column="0"> - <widget class="QLabel" name="label_36"> - <property name="minimumSize"> - <size> - <width>55</width> - <height>0</height> - </size> + <widget class="QLabel" name="label_44"> + <property name="geometry"> + <rect> + <x>40</x> + <y>55</y> + <width>71</width> + <height>111</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/clip_side.png</pixmap> + </property> + </widget> + <widget class="QLabel" name="label_50"> + <property name="geometry"> + <rect> + <x>10</x> + <y>35</y> + <width>46</width> + <height>13</height> + </rect> + </property> + <property name="text"> + <string>Side</string> + </property> + </widget> + <widget class="QSpinBox" name="clip_blength_spin"> + <property name="geometry"> + <rect> + <x>50</x> + <y>165</y> + <width>100</width> + <height>22</height> + </rect> + </property> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + <widget class="QSpinBox" name="clip_theight_spin"> + <property name="geometry"> + <rect> + <x>110</x> + <y>75</y> + <width>100</width> + <height>22</height> + </rect> + </property> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + <widget class="QLabel" name="label_51"> + <property name="geometry"> + <rect> + <x>255</x> + <y>40</y> + <width>46</width> + <height>13</height> + </rect> + </property> + <property name="text"> + <string>Front</string> + </property> + </widget> + <widget class="QLabel" name="label_45"> + <property name="geometry"> + <rect> + <x>265</x> + <y>60</y> + <width>21</width> + <height>111</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/clip_front.png</pixmap> + </property> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_6"> + <attribute name="title"> + <string>Cap</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_14"> + <item> + <widget class="QGroupBox" name="groupBox_9"> + <property name="title"> + <string>Model Dimensions</string> + </property> + <widget class="QLabel" name="label_46"> + <property name="geometry"> + <rect> + <x>30</x> + <y>90</y> + <width>111</width> + <height>81</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/cap_side.png</pixmap> + </property> + </widget> + <widget class="QLabel" name="label_48"> + <property name="geometry"> + <rect> + <x>20</x> + <y>35</y> + <width>46</width> + <height>13</height> + </rect> + </property> + <property name="text"> + <string>Side</string> + </property> + </widget> + <widget class="QSpinBox" name="cap_length_spin"> + <property name="geometry"> + <rect> + <x>20</x> + <y>70</y> + <width>101</width> + <height>22</height> + </rect> + </property> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + <widget class="QLabel" name="label_54"> + <property name="geometry"> + <rect> + <x>140</x> + <y>90</y> + <width>16</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>R</string> + </property> + </widget> + <widget class="QLabel" name="label_55"> + <property name="geometry"> + <rect> + <x>290</x> + <y>85</y> + <width>16</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>R</string> + </property> + </widget> + <widget class="QLabel" name="label_47"> + <property name="geometry"> + <rect> + <x>270</x> + <y>85</y> + <width>81</width> + <height>81</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/cap_front.png</pixmap> + </property> + </widget> + <widget class="QSpinBox" name="cap_width_spin"> + <property name="geometry"> + <rect> + <x>255</x> + <y>55</y> + <width>100</width> + <height>22</height> + </rect> + </property> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + <widget class="QLabel" name="label_49"> + <property name="geometry"> + <rect> + <x>290</x> + <y>35</y> + <width>46</width> + <height>13</height> + </rect> + </property> + <property name="text"> + <string>Front</string> + </property> + </widget> + <widget class="QSpinBox" name="cap_height_spin"> + <property name="geometry"> + <rect> + <x>60</x> + <y>120</y> + <width>116</width> + <height>22</height> + </rect> + </property> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_7"> + <attribute name="title"> + <string>Custom</string> + </attribute> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QGroupBox" name="groupBox_7"> + <property name="title"> + <string>Model Dimensions</string> + </property> + <layout class="QGridLayout" name="gridLayout_5"> + <item row="3" column="1"> + <widget class="QLabel" name="label_57"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="text"> - <string>Resolution</string> + <string>z:</string> </property> </widget> </item> - <item row="0" column="5"> - <widget class="QLabel" name="label_37"> - <property name="text"> - <string>FPS</string> + <item row="2" column="5"> + <widget class="QSpinBox" name="m2y_spin"> + <property name="suffix"> + <string> units</string> </property> - <property name="buddy"> - <cstring>fps_spin</cstring> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65535</number> </property> </widget> </item> - <item row="0" column="6"> - <widget class="QSpinBox" name="fps_spin"> + <item row="1" column="1"> + <widget class="QLabel" name="label_63"> <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="toolTip"> - <string>Desired capture framerate</string> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_41"> <property name="text"> - <string>x</string> + <string>x:</string> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="res_x_spin"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <item row="1" column="2"> + <widget class="QSpinBox" name="m1x_spin"> + <property name="suffix"> + <string> units</string> </property> - <property name="toolTip"> - <string>Desired capture width</string> + <property name="minimum"> + <number>-65535</number> </property> <property name="maximum"> - <number>2000</number> - </property> - <property name="singleStep"> - <number>10</number> + <number>65535</number> </property> </widget> </item> - <item row="0" column="3"> - <widget class="QSpinBox" name="res_y_spin"> - <property name="toolTip"> - <string>Desired capture height</string> - </property> - <property name="maximum"> - <number>2000</number> - </property> - <property name="singleStep"> - <number>10</number> + <item row="2" column="2"> + <widget class="QSpinBox" name="m1y_spin"> + <property name="suffix"> + <string> units</string> </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_34"> - <property name="text"> - <string>F/W</string> + <property name="minimum"> + <number>-65535</number> </property> - <property name="buddy"> - <cstring>f_dspin</cstring> + <property name="maximum"> + <number>65535</number> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QDoubleSpinBox" name="f_dspin"> - <property name="toolTip"> - <string>The camera's focal length devided by its sensor width</string> + <item row="3" column="5"> + <widget class="QSpinBox" name="m2z_spin"> + <property name="suffix"> + <string> units</string> </property> - <property name="decimals"> - <number>2</number> + <property name="minimum"> + <number>-65535</number> </property> - <property name="singleStep"> - <double>0.100000000000000</double> + <property name="maximum"> + <number>65535</number> </property> </widget> </item> - <item row="0" column="4"> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> + <item row="1" column="5"> + <widget class="QSpinBox" name="m2x_spin"> + <property name="suffix"> + <string> units</string> </property> - </spacer> - </item> - <item row="0" column="7"> - <spacer name="horizontalSpacer_9"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + <property name="minimum"> + <number>-65535</number> </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>20</height> - </size> + <property name="maximum"> + <number>65535</number> </property> - </spacer> + </widget> </item> - </layout> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_7"/> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_4"> - <property name="title"> - <string>Camera Orientation</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_8"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_6"> - <item> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="1" column="0"> - <widget class="QLabel" name="label_4"> + <item row="0" column="0" colspan="6"> + <widget class="QLabel" name="label_56"> <property name="text"> - <string>Pitch</string> - </property> - <property name="buddy"> - <cstring>campitch_spin</cstring> + <string><html><head/><body><p>Location of the two remaining model points<br/>with respect to the reference point in default pose</p><p>Use any units you want, e.g. millimeters, inches, parsecs...</p></body></html></string> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="campitch_spin"> - <property name="contextMenuPolicy"> - <enum>Qt::DefaultContextMenu</enum> - </property> - <property name="toolTip"> - <string>The angle the camera is facing upwards</string> + <item row="3" column="2"> + <widget class="QSpinBox" name="m1z_spin"> + <property name="suffix"> + <string> units</string> </property> <property name="minimum"> - <number>-99</number> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_20"> - <property name="text"> - <string>Yaw</string> + <number>-65535</number> </property> - <property name="buddy"> - <cstring>camyaw_spin</cstring> + <property name="maximum"> + <number>65535</number> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="camyaw_spin"> - <property name="contextMenuPolicy"> - <enum>Qt::DefaultContextMenu</enum> - </property> - <property name="toolTip"> - <string>The angle the camera is facing leftwards</string> - </property> - <property name="minimum"> - <number>-99</number> + <item row="2" column="4"> + <widget class="QLabel" name="label_70"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="label_21"> <property name="text"> - <string>deg (positve = leftwards)</string> + <string>y:</string> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QComboBox" name="camroll_combo"> + <item row="1" column="4"> + <widget class="QLabel" name="label_67"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>Rotation of the camera image</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="label_5"> <property name="text"> - <string>deg (positive = upwards)</string> + <string>x:</string> </property> </widget> </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_19"> - <property name="text"> - <string>deg</string> + <item row="1" column="3"> + <widget class="QLabel" name="label_64"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_18"> <property name="text"> - <string>Roll</string> - </property> - <property name="buddy"> - <cstring>camroll_combo</cstring> + <string><html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">3</span></p></body></html></string> </property> </widget> </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_10"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>Point Extraction</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Threshold</string> - </property> - <property name="buddy"> - <cstring>threshold_slider</cstring> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="threshold_slider"> - <property name="toolTip"> - <string>Intensity threshold for point extraction</string> - </property> - <property name="maximum"> - <number>255</number> - </property> - <property name="value"> - <number>127</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_secondary"> - <item> - <widget class="QLabel" name="label_secondary"> - <property name="text"> - <string>Hysteresis</string> - </property> - <property name="buddy"> - <cstring>threshold_secondary_slider</cstring> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="threshold_secondary_slider"> - <property name="toolTip"> - <string>Per pixel hysteresis width (leave left if there is little difference between dot and non-dot, move right for increased stability against pixel noise)</string> - </property> - <property name="maximum"> - <number>255</number> - </property> - <property name="pageStep"> - <number>1</number> - </property> - <property name="value"> - <number>100</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>Min Diameter</string> - </property> - <property name="buddy"> - <cstring>mindiam_spin</cstring> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="mindiam_spin"> - <property name="toolTip"> - <string>Minimum point diameter</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_12"> - <property name="text"> - <string>px</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>Max Diameter</string> - </property> - <property name="buddy"> - <cstring>maxdiam_spin</cstring> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="maxdiam_spin"> - <property name="toolTip"> - <string>Maximum point diameter</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_13"> - <property name="text"> - <string>px</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_4"> - <attribute name="title"> - <string>Model</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_16"> - <item> - <widget class="QTabWidget" name="model_tabs"> - <property name="tabShape"> - <enum>QTabWidget::Rounded</enum> - </property> - <property name="currentIndex"> - <number>2</number> - </property> - <property name="usesScrollButtons"> - <bool>false</bool> - </property> - <property name="documentMode"> - <bool>false</bool> - </property> - <property name="tabsClosable"> - <bool>false</bool> - </property> - <widget class="QWidget" name="tab_5"> - <attribute name="title"> - <string>Clip</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_13"> - <item> - <widget class="QGroupBox" name="groupBox_8"> - <property name="title"> - <string>Model Dimensions (mm)</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_16"> - <item> - <widget class="QWidget" name="widget_4" native="true"> + <item row="1" column="0"> + <widget class="QLabel" name="label_60"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>160</height> - </size> + <property name="text"> + <string><html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">3</span></p></body></html></string> </property> - <widget class="QLabel" name="label_44"> - <property name="geometry"> - <rect> - <x>30</x> - <y>30</y> - <width>71</width> - <height>111</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/clip_side.png</pixmap> - </property> - </widget> - <widget class="QSpinBox" name="clip_theight_spin"> - <property name="geometry"> - <rect> - <x>100</x> - <y>50</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - <widget class="QSpinBox" name="clip_tlength_spin"> - <property name="geometry"> - <rect> - <x>60</x> - <y>10</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - <widget class="QSpinBox" name="clip_bheight_spin"> - <property name="geometry"> - <rect> - <x>100</x> - <y>90</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - <widget class="QLabel" name="label_50"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>46</width> - <height>13</height> - </rect> - </property> - <property name="text"> - <string>Side</string> - </property> - </widget> - <widget class="QSpinBox" name="clip_blength_spin"> - <property name="geometry"> - <rect> - <x>40</x> - <y>140</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - <widget class="QLabel" name="label_52"> - <property name="geometry"> - <rect> - <x>70</x> - <y>70</y> - <width>16</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>R</string> - </property> - </widget> </widget> </item> - <item> - <widget class="QWidget" name="widget_3" native="true"> + <item row="3" column="4"> + <widget class="QLabel" name="label_69"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>140</height> - </size> - </property> - <widget class="QLabel" name="label_51"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>46</width> - <height>13</height> - </rect> - </property> - <property name="text"> - <string>Front</string> - </property> - </widget> - <widget class="QLabel" name="label_45"> - <property name="geometry"> - <rect> - <x>40</x> - <y>30</y> - <width>21</width> - <height>111</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/clip_front.png</pixmap> - </property> - </widget> - <widget class="QLabel" name="label_53"> - <property name="geometry"> - <rect> - <x>60</x> - <y>70</y> - <width>16</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>R</string> - </property> - </widget> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_6"> - <attribute name="title"> - <string>Cap</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_14"> - <item> - <widget class="QGroupBox" name="groupBox_9"> - <property name="title"> - <string>Model Dimensions (mm)</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_15"> - <item> - <widget class="QWidget" name="widget" native="true"> - <property name="minimumSize"> - <size> - <width>140</width> - <height>130</height> - </size> + <property name="text"> + <string>z:</string> </property> - <widget class="QLabel" name="label_46"> - <property name="geometry"> - <rect> - <x>20</x> - <y>50</y> - <width>111</width> - <height>81</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/cap_side.png</pixmap> - </property> - </widget> - <widget class="QSpinBox" name="cap_height_spin"> - <property name="geometry"> - <rect> - <x>30</x> - <y>80</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - <widget class="QLabel" name="label_54"> - <property name="geometry"> - <rect> - <x>130</x> - <y>50</y> - <width>16</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>R</string> - </property> - </widget> - <widget class="QLabel" name="label_48"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>46</width> - <height>13</height> - </rect> - </property> - <property name="text"> - <string>Side</string> - </property> - </widget> - <widget class="QSpinBox" name="cap_length_spin"> - <property name="geometry"> - <rect> - <x>50</x> - <y>40</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> </widget> </item> - <item> - <widget class="QWidget" name="widget_2" native="true"> + <item row="2" column="1"> + <widget class="QLabel" name="label_58"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>130</height> - </size> - </property> - <widget class="QLabel" name="label_49"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>46</width> - <height>13</height> - </rect> - </property> - <property name="text"> - <string>Front</string> - </property> - </widget> - <widget class="QLabel" name="label_55"> - <property name="geometry"> - <rect> - <x>30</x> - <y>50</y> - <width>16</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>R</string> - </property> - </widget> - <widget class="QLabel" name="label_47"> - <property name="geometry"> - <rect> - <x>10</x> - <y>50</y> - <width>81</width> - <height>81</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/cap_front.png</pixmap> - </property> - </widget> - <widget class="QSpinBox" name="cap_width_spin"> - <property name="geometry"> - <rect> - <x>50</x> - <y>30</y> - <width>46</width> - <height>22</height> - </rect> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_7"> - <attribute name="title"> - <string>Custom</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_15"> - <item> - <widget class="QGroupBox" name="groupBox_7"> - <property name="title"> - <string>Model Dimensions (mm)</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_12"> - <item> - <widget class="QLabel" name="label_56"> <property name="text"> - <string><html><head/><body><p>Location of the two remaining model points<br/>with respect to the reference point in default pose</p></body></html></string> + <string>y:</string> </property> </widget> </item> - <item> - <spacer name="verticalSpacer_4"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_14"> - <item> - <spacer name="horizontalSpacer_14"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QGridLayout" name="gridLayout_4"> - <item row="3" column="2"> - <widget class="QSpinBox" name="m1z_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLabel" name="label_58"> - <property name="text"> - <string>y:</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QSpinBox" name="m1y_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLabel" name="label_57"> - <property name="text"> - <string>z:</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_60"> - <property name="text"> - <string>M1:</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QSpinBox" name="m1x_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="label_63"> - <property name="text"> - <string>x:</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_15"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QGridLayout" name="gridLayout_5"> - <item row="1" column="2"> - <widget class="QSpinBox" name="m2x_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="label_67"> - <property name="text"> - <string>x:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLabel" name="label_69"> - <property name="text"> - <string>z:</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QSpinBox" name="m2y_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLabel" name="label_70"> - <property name="text"> - <string>y:</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_64"> - <property name="text"> - <string>M2:</string> - </property> - </widget> - </item> - <item row="3" column="2"> - <widget class="QSpinBox" name="m2z_spin"> - <property name="suffix"> - <string/> - </property> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_16"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer_3"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> </layout> </widget> </item> @@ -1205,129 +1051,88 @@ <item> <widget class="QGroupBox" name="groupBox_10"> <property name="title"> - <string>Model Position (mm)</string> + <string>Model position</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_11"> - <item> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="1" column="1"> + <widget class="QSpinBox" name="tx_spin"> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65536</number> + </property> + </widget> + </item> + <item row="0" column="0" colspan="3"> <widget class="QLabel" name="label_59"> <property name="text"> <string><html><head/><body><p>Translation from head center to model reference point<br/> in default pose</p></body></html></string> </property> </widget> </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_17"> - <item> - <spacer name="horizontalSpacer_17"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QGridLayout" name="gridLayout_6"> - <item row="3" column="1"> - <widget class="QSpinBox" name="tz_spin"> - <property name="suffix"> - <string/> - </property> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_61"> - <property name="text"> - <string>x:</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_62"> - <property name="text"> - <string>y:</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_66"> - <property name="text"> - <string>z:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="ty_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="tx_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_18"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="tcalib_button"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Calibrate</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_19"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> + <item row="2" column="1"> + <widget class="QSpinBox" name="ty_spin"> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65536</number> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_62"> + <property name="text"> + <string>y:</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_66"> + <property name="text"> + <string>z:</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_61"> + <property name="text"> + <string>x:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QSpinBox" name="tz_spin"> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65536</number> + </property> + </widget> + </item> + <item row="4" column="2"> + <widget class="QPushButton" name="tcalib_button"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Calibrate</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> </item> </layout> </widget> @@ -1338,171 +1143,48 @@ <attribute name="title"> <string>About</string> </attribute> - <widget class="QLabel" name="label_10"> - <property name="geometry"> - <rect> - <x>30</x> - <y>30</y> - <width>161</width> - <height>111</height> - </rect> - </property> - <property name="text"> - <string><html><head/><body><p><span style=" font-weight:600;">FTNoIR PointTracker Plugin<br/>Version 1.1</span></p><p><span style=" font-weight:600;">by Patrick Ruoff</span></p><p><a href="http://ftnoirpt.sourceforge.net/"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">Manual (external)</span></a></p></body></html></string> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - <widget class="QLabel" name="label_35"> - <property name="geometry"> - <rect> - <x>200</x> - <y>30</y> - <width>141</width> - <height>141</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/Logo_IR.png</pixmap> - </property> - </widget> + <layout class="QGridLayout" name="gridLayout_8"> + <item row="0" column="0"> + <widget class="QLabel" name="label_10"> + <property name="text"> + <string><html><head/><body><p><span style=" font-weight:600;">FTNoIR PointTracker Plugin<br/>Version 1.1</span></p><p><span style=" font-weight:600;">by Patrick Ruoff</span></p><p><a href="http://ftnoirpt.sourceforge.net/"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">Manual (external)</span></a></p></body></html></string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_35"> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/Logo_IR.png</pixmap> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + </widget> + </item> + </layout> </widget> </widget> </item> - <item> - <widget class="QGroupBox" name="groupBox_5"> - <property name="title"> - <string>Status</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <item> - <layout class="QFormLayout" name="formLayout"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="label_38"> - <property name="text"> - <string>Camera Info:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="caminfo_label"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>120</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Extracted Points:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="pointinfo_label"> - <property name="minimumSize"> - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QPushButton" name="btnApply"> - <property name="text"> - <string>Save</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_6"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="ok_button"> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="text"> - <string>Ok</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="cancel_button"> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="text"> - <string>Cancel</string> - </property> - </widget> - </item> - </layout> - </item> </layout> </widget> <tabstops> <tabstop>tabWidget</tabstop> - <tabstop>reset_spin</tabstop> <tabstop>camdevice_combo</tabstop> <tabstop>res_x_spin</tabstop> - <tabstop>res_y_spin</tabstop> - <tabstop>fps_spin</tabstop> - <tabstop>f_dspin</tabstop> <tabstop>camroll_combo</tabstop> <tabstop>campitch_spin</tabstop> <tabstop>camyaw_spin</tabstop> <tabstop>threshold_slider</tabstop> - <tabstop>mindiam_spin</tabstop> - <tabstop>maxdiam_spin</tabstop> <tabstop>model_tabs</tabstop> - <tabstop>clip_tlength_spin</tabstop> - <tabstop>clip_theight_spin</tabstop> - <tabstop>clip_bheight_spin</tabstop> - <tabstop>clip_blength_spin</tabstop> - <tabstop>cap_length_spin</tabstop> - <tabstop>cap_height_spin</tabstop> - <tabstop>cap_width_spin</tabstop> <tabstop>m1x_spin</tabstop> <tabstop>m1y_spin</tabstop> <tabstop>m1z_spin</tabstop> @@ -1512,31 +1194,11 @@ <tabstop>tx_spin</tabstop> <tabstop>ty_spin</tabstop> <tabstop>tz_spin</tabstop> - <tabstop>tcalib_button</tabstop> - <tabstop>ok_button</tabstop> - <tabstop>cancel_button</tabstop> </tabstops> <resources> <include location="ftnoir_tracker_pt.qrc"/> </resources> - <connections> - <connection> - <sender>dynpose_check</sender> - <signal>toggled(bool)</signal> - <receiver>reset_spin</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>172</x> - <y>110</y> - </hint> - <hint type="destinationlabel"> - <x>351</x> - <y>112</y> - </hint> - </hints> - </connection> - </connections> + <connections/> <slots> <slot>startEngineClicked()</slot> <slot>stopEngineClicked()</slot> diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 3fa6910d..768a3a71 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -26,7 +26,6 @@ Tracker::Tracker() commands(0), video_widget(NULL), video_frame(NULL), - tracking_valid(false), new_settings(nullptr) { @@ -68,16 +67,13 @@ void Tracker::run() #endif time.start(); - double dt; bool new_frame; forever { if (commands & ABORT) break; - if (commands & PAUSE) continue; commands = 0; - apply_inner(); - dt = time.start() / 1000000000.; - + apply_inner(); + const double dt = time.start() * 1e-9; new_frame = camera.get_frame(dt, &frame); if (new_frame && !frame.empty()) @@ -101,7 +97,7 @@ void Tracker::run() color, 4); } - tracking_valid = point_tracker.track(points, camera.get_info().f, dt); + point_tracker.track(points, camera.get_info().f); video_widget->update_image(frame); } #ifdef PT_PERF_LOG @@ -124,12 +120,13 @@ void Tracker::apply_inner() settings* tmp = new_settings.exchange(nullptr); if (tmp == nullptr) return; + reset(); auto& s = *tmp; qDebug()<<"Tracker:: Applying settings"; camera.set_device_index(s.cam_index); camera.set_res(s.cam_res_x, s.cam_res_y); camera.set_fps(s.cam_fps); - camera.set_f(s.cam_f); + camera.set_f(1); frame_rotation.rotation = static_cast<RotationType>(static_cast<int>(s.cam_roll)); point_extractor.threshold_val = s.threshold; point_extractor.threshold_secondary_val = s.threshold_secondary; @@ -140,8 +137,6 @@ void Tracker::apply_inner() cv::Vec3f M02(s.m02_x, s.m02_y, s.m02_z); point_tracker.point_model = std::shared_ptr<PointModel>(new PointModel(M01, M02)); } - point_tracker.dynamic_pose_resolution = s.dyn_pose_res; - point_tracker.dt_reset = s.reset_time / 1000.0; t_MH = cv::Vec3f(s.t_MH_x, s.t_MH_y, s.t_MH_z); R_GC = Matx33f( cos(deg2rad*s.cam_yaw), 0, sin(deg2rad*s.cam_yaw), 0, 1, 0, @@ -152,7 +147,6 @@ void Tracker::apply_inner() FrameTrafo X_MH(Matx33f::eye(), t_MH); X_GH_0 = R_GC * X_MH; - qDebug()<<"Tracker::apply ends"; } @@ -201,7 +195,6 @@ void Tracker::StartTracker(QFrame *parent_window) camera.start(); apply(s); start(); - reset_command(PAUSE); } #ifndef OPENTRACK_API @@ -220,9 +213,7 @@ void Tracker::GetHeadPoseData(THeadPoseData *data) { QMutexLocker lock(&mutex); - if (!tracking_valid) return; - - FrameTrafo X_CM = point_tracker.get_pose(); + FrameTrafo X_CM = point_tracker.get_pose(); FrameTrafo X_MH(Matx33f::eye(), t_MH); FrameTrafo X_GH = R_GC * X_CM * X_MH; Matx33f R = X_GH.R * X_GH_0.R.t(); diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.h b/ftnoir_tracker_pt/ftnoir_tracker_pt.h index 3d9a83fd..238dcd8f 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.h @@ -61,8 +61,7 @@ protected: QMutex mutex; // thread commands enum Command { - ABORT = 1<<0, - PAUSE = 1<<1 + ABORT = 1<<0 }; void set_command(Command command); void reset_command(Command command); @@ -82,7 +81,6 @@ protected: PTVideoWidget* video_widget; QFrame* video_frame; - bool tracking_valid; settings s; std::atomic<settings*> new_settings; diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp index e037a099..0e58a2e4 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp @@ -42,11 +42,7 @@ TrackerDialog::TrackerDialog() ui.camroll_combo->addItem("0"); ui.camroll_combo->addItem("90"); - tie_setting(s.dyn_pose_res, ui.dynpose_check); - tie_setting(s.reset_time, ui.reset_spin); - tie_setting(s.cam_index, ui.camdevice_combo); - tie_setting(s.cam_f, ui.f_dspin); tie_setting(s.cam_res_x, ui.res_x_spin); tie_setting(s.cam_res_y, ui.res_y_spin); tie_setting(s.cam_fps, ui.fps_spin); @@ -82,11 +78,9 @@ TrackerDialog::TrackerDialog() tie_setting(s.t_MH_z, ui.tz_spin); connect( ui.tcalib_button,SIGNAL(toggled(bool)), this,SLOT(startstop_trans_calib(bool)) ); - connect(ui.reset_button, SIGNAL(clicked()), this, SLOT(doReset())); - connect(ui.ok_button, SIGNAL(clicked()), this, SLOT(doOK())); - connect(ui.cancel_button, SIGNAL(clicked()), this, SLOT(doCancel())); - connect(ui.btnApply, SIGNAL(clicked()), this, SLOT(doApply())); + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); + connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); ui.model_tabs->setCurrentIndex(s.active_model_panel); @@ -94,7 +88,7 @@ TrackerDialog::TrackerDialog() connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); timer.start(100); - connect(s.b.get(), SIGNAL(bundleChanged()), this, SLOT(do_apply_without_saving())); + connect(ui.buttonBox_2, SIGNAL(clicked(QAbstractButton*)), this, SLOT(do_apply_without_saving(QAbstractButton*))); } void TrackerDialog::set_model_clip() @@ -172,19 +166,9 @@ void TrackerDialog::settings_changed() if (tracker) tracker->apply(s); } -void TrackerDialog::doCenter() -{ - if (tracker) tracker->center(); -} - -void TrackerDialog::doReset() -{ - if (tracker) tracker->reset(); -} - void TrackerDialog::save() { - do_apply_without_saving(); + do_apply_without_saving(nullptr); s.b->save(); } @@ -194,7 +178,7 @@ void TrackerDialog::doOK() close(); } -void TrackerDialog::do_apply_without_saving() +void TrackerDialog::do_apply_without_saving(QAbstractButton*) { switch (s.active_model_panel) { default: @@ -295,7 +279,6 @@ void TrackerDialog::registerTracker(ITracker *t) tracker->apply(s); ui.tcalib_button->setEnabled(true); //ui.center_button->setEnabled(true); - ui.reset_button->setEnabled(true); } void TrackerDialog::unRegisterTracker() @@ -305,7 +288,6 @@ void TrackerDialog::unRegisterTracker() destroy_video_widget(); ui.tcalib_button->setEnabled(false); //ui.center_button->setEnabled(false); - ui.reset_button->setEnabled(false); } extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h index a4d9c4b5..dbb93f30 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h @@ -34,12 +34,10 @@ public: void trans_calib_step(); public slots: - void doCenter(); - void doReset(); void doOK(); - void doApply(); void doCancel(); - void do_apply_without_saving(); + void doApply(); + void do_apply_without_saving(QAbstractButton *); void startstop_trans_calib(bool start); void widget_destroyed(QObject* obj); diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h index e4cb9ad3..7faad9ed 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h @@ -28,18 +28,17 @@ struct settings threshold_secondary, min_point_size, max_point_size; - value<double> cam_f; value<int> m01_x, m01_y, m01_z; value<int> m02_x, m02_y, m02_z; - value<bool> dyn_pose_res, video_widget; + value<bool> video_widget; value<int> t_MH_x, t_MH_y, t_MH_z; - value<int> reset_time; - value<int> clip_ty, clip_tz, clip_by, clip_bz; value<int> active_model_panel, cap_x, cap_y, cap_z; + + // XXX todo red channel only, good for crapola CCD sensors -sh 20140922 settings() : b(bundle("tracker-pt")), @@ -54,19 +53,16 @@ struct settings threshold_secondary(b, "threshold-secondary", 128), min_point_size(b, "min-point-size", 10), max_point_size(b, "max-point-size", 50), - cam_f(b, "camera-focal-length", 1), m01_x(b, "m_01-x", 0), m01_y(b, "m_01-y", 0), m01_z(b, "m_01-z", 0), m02_x(b, "m_02-x", 0), m02_y(b, "m_02-y", 0), m02_z(b, "m_02-z", 0), - dyn_pose_res(b, "dynamic-pose-resolution", false), video_widget(b, "video-widget", true), t_MH_x(b, "model-centroid-x", 0), t_MH_y(b, "model-centroid-y", 0), t_MH_z(b, "model-centroid-z", 0), - reset_time(b, "reset-time", 2000), clip_ty(b, "clip-ty", 0), clip_tz(b, "clip-tz", 0), clip_by(b, "clip-by", 0), diff --git a/ftnoir_tracker_pt/point_tracker.cpp b/ftnoir_tracker_pt/point_tracker.cpp index e9892d67..5f57baf5 100644 --- a/ftnoir_tracker_pt/point_tracker.cpp +++ b/ftnoir_tracker_pt/point_tracker.cpp @@ -37,7 +37,7 @@ static void set_row(Matx33f& m, int i, const Vec3f& v) PointModel::PointModel(Vec3f M01, Vec3f M02) : M01(M01), M02(M02) -{ +{ // calculate u u = M01.cross(M02); u /= norm(u); @@ -48,7 +48,6 @@ PointModel::PointModel(Vec3f M01, Vec3f M02) float s22 = M02.dot(M02); P = 1.0/(s11*s22-s12*s12) * Matx22f(s22, -s12, -s12, s11); - // calculate d and d_order for simple freetrack-like point correspondence vector<Vec2f> points; points.push_back(Vec2f(0,0)); @@ -97,151 +96,58 @@ void PointModel::get_d_order(const std::vector<cv::Vec2f>& points, int d_order[] // ---------------------------------------------------------------------------- -PointTracker::PointTracker() : - dynamic_pose_resolution(true), - dt_reset(1), - init_phase(true), - dt_valid(0), - v_t(0,0,0), - v_r(0,0,0) +PointTracker::PointTracker() { X_CM.t[2] = 1000; // default position: 1 m away from cam; } void PointTracker::reset() { - // enter init phase and reset velocities - init_phase = true; - dt_valid = 0; - reset_velocities(); -} - -void PointTracker::reset_velocities() -{ - v_t = Vec3f(0,0,0); - v_r = Vec3f(0,0,0); + // enter init phase + X_CM = FrameTrafo(); } - -bool PointTracker::track(const vector<Vec2f>& points, float f, float dt) +void PointTracker::track(const vector<Vec2f>& points, float f) { - if (!dynamic_pose_resolution) init_phase = true; - - dt_valid += dt; - // if there was no valid tracking result for too long, do a reset - if (dt_valid > dt_reset) - { - //qDebug()<<"dt_valid "<<dt_valid<<" > dt_reset "<<dt_reset; - reset(); - } - - bool no_model = -#ifdef OPENTRACK_API - point_model.get() == NULL; -#else - !point_model; -#endif - - // if there is a pointtracking problem, reset the velocities - if (no_model || points.size() != PointModel::N_POINTS) - { - //qDebug()<<"Wrong number of points!"; - reset_velocities(); - return false; - } - - X_CM_old = X_CM; // backup old transformation for velocity calculation - - if (!init_phase) - predict(dt_valid); - - // if there is a point correspondence problem something has gone wrong, do a reset - if (!find_correspondences(points, f)) - { - //qDebug()<<"Error in finding point correspondences!"; - X_CM = X_CM_old; // undo prediction - reset(); - return false; - } - + find_correspondences(points, f); (void) POSIT(f); //qDebug()<<"Number of POSIT iterations: "<<n_iter; - - if (!init_phase) - update_velocities(dt_valid); - - // we have a valid tracking result, leave init phase and reset time since valid result - init_phase = false; - dt_valid = 0; - return true; -} - -void PointTracker::predict(float dt) -{ - // predict with constant velocity - Matx33f R; - Rodrigues(dt*v_r, R); - X_CM.R = R*X_CM.R; - X_CM.t += dt * v_t; -} - -void PointTracker::update_velocities(float dt) -{ - // update velocities - Rodrigues(X_CM.R*X_CM_old.R.t(), v_r); - v_r /= dt; - v_t = (X_CM.t - X_CM_old.t)/dt; } -bool PointTracker::find_correspondences(const vector<Vec2f>& points, float f) +void PointTracker::find_correspondences(const std::vector<cv::Vec2f>& points, float f) { - if (init_phase) { - // We do a simple freetrack-like sorting in the init phase... - // sort points - int point_d_order[PointModel::N_POINTS]; - point_model->get_d_order(points, point_d_order); - - // set correspondences - for (int i=0; i<PointModel::N_POINTS; ++i) - { - p[point_model->d_order[i]] = points[point_d_order[i]]; - } - } - else { - // ... otherwise we look at the distance to the projection of the expected model points - // project model points under current pose - p_exp[0] = project(Vec3f(0,0,0), f); - p_exp[1] = project(point_model->M01, f); - p_exp[2] = project(point_model->M02, f); - - // set correspondences by minimum distance to projected model point - bool point_taken[PointModel::N_POINTS]; - for (int i=0; i<PointModel::N_POINTS; ++i) - point_taken[i] = false; - - float min_sdist = 0; - int min_idx = 0; - - for (int i=0; i<PointModel::N_POINTS; ++i) - { - // find closest point to projected model point i - for (int j=0; j<PointModel::N_POINTS; ++j) - { - Vec2f d = p_exp[i]-points[j]; - float sdist = d.dot(d); - if (sdist < min_sdist || j==0) - { - min_idx = j; - min_sdist = sdist; - } - } - // if one point is closest to more than one model point, abort - if (point_taken[min_idx]) return false; - point_taken[min_idx] = true; - p[i] = points[min_idx]; - } - } - return true; + // ... otherwise we look at the distance to the projection of the expected model points + // project model points under current pose + Vec2f p_exp[3]; + p_exp[0] = project(Vec3f(0,0,0), f); + p_exp[1] = project(point_model->M01, f); + p_exp[2] = project(point_model->M02, f); + + // set correspondences by minimum distance to projected model point + bool point_taken[PointModel::N_POINTS]; + for (int i=0; i<PointModel::N_POINTS; ++i) + point_taken[i] = false; + + for (int i=0; i<PointModel::N_POINTS; ++i) + { + float min_sdist = 1e4; + int min_idx = 0; + // find closest point to projected model point i + for (int j=0; j<PointModel::N_POINTS; ++j) + { + Vec2f d = p_exp[i]-points[j]; + float sdist = d.dot(d); + if (sdist < min_sdist) + { + min_idx = j; + min_sdist = sdist; + } + } + // if one point is closest to more than one model point, abort + if (point_taken[min_idx]) return; + point_taken[min_idx] = true; + p[i] = points[min_idx]; + } } @@ -255,15 +161,12 @@ int PointTracker::POSIT(float f) // The expected rotation used for resolving the ambiguity in POSIT: // In every iteration step the rotation closer to R_expected is taken Matx33f R_expected; - if (init_phase) - R_expected = Matx33f::eye(); // in the init phase, we want to be close to the default pose = no rotation - else - R_expected = X_CM.R; // later we want to be close to the last (predicted) rotation + R_expected = X_CM.R; // later we want to be close to the last (predicted) rotation // initial pose = last (predicted) pose Vec3f k; get_row(R_expected, 2, k); - float Z0 = init_phase ? 1000 : X_CM.t[2]; + float Z0 = std::abs(X_CM.t[2]) < 1e-3 ? 1e3 : X_CM.t[2]; float old_epsilon_1 = 0; float old_epsilon_2 = 0; diff --git a/ftnoir_tracker_pt/point_tracker.h b/ftnoir_tracker_pt/point_tracker.h index 512681fc..44bad28e 100644 --- a/ftnoir_tracker_pt/point_tracker.h +++ b/ftnoir_tracker_pt/point_tracker.h @@ -57,14 +57,14 @@ class PointModel { friend class PointTracker; public: - static const int N_POINTS = 3; + static constexpr int N_POINTS = 3; PointModel(cv::Vec3f M01, cv::Vec3f M02); - const cv::Vec3f& get_M01() const { return M01; }; - const cv::Vec3f& get_M02() const { return M02; }; + const cv::Vec3f& get_M01() const { return M01; } + const cv::Vec3f& get_M02() const { return M02; } -protected: +private: cv::Vec3f M01; // M01 in model frame cv::Vec3f M02; // M02 in model frame @@ -90,12 +90,9 @@ public: // track the pose using the set of normalized point coordinates (x pos in range -0.5:0.5) // f : (focal length)/(sensor width) // dt : time since last call - bool track(const std::vector<cv::Vec2f>& points, float f, float dt); + void track(const std::vector<cv::Vec2f>& points, float f); std::shared_ptr<PointModel> point_model; - bool dynamic_pose_resolution; - float dt_reset; - FrameTrafo get_pose() const { return X_CM; } void reset(); @@ -106,24 +103,13 @@ protected: return cv::Vec2f(f*v_C[0]/v_C[2], f*v_C[1]/v_C[2]); } - bool find_correspondences(const std::vector<cv::Vec2f>& points, float f); + void find_correspondences(const std::vector<cv::Vec2f>& points, float f); cv::Vec2f p[PointModel::N_POINTS]; // the points in model order - cv::Vec2f p_exp[PointModel::N_POINTS]; // the expected point positions - - void predict(float dt); - void update_velocities(float dt); - void reset_velocities(); - int POSIT(float f); // The POSIT algorithm, returns the number of iterations - bool init_phase; - float dt_valid; // time since last valid tracking result - cv::Vec3f v_t; // velocities - cv::Vec3f v_r; FrameTrafo X_CM; // trafo from model to camera - FrameTrafo X_CM_old; }; #endif //POINTTRACKER_H -- cgit v1.2.3 From d2809d533b7b0b85dec34fe31c1d4fa023cd5259 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 22:37:35 +0200 Subject: options: bundle no longer a QObject --- facetracknoir/options.h | 68 +++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/facetracknoir/options.h b/facetracknoir/options.h index 474d4ec2..d751051a 100644 --- a/facetracknoir/options.h +++ b/facetracknoir/options.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013 Stanislaw Halik +/* Copyright (c) 2013-2014 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 @@ -7,6 +7,7 @@ #pragma once +#include <memory> #include <QObject> #include <QSettings> #include <QMap> @@ -14,8 +15,6 @@ #include <QVariant> #include <QMutex> #include <QMutexLocker> -#include <memory> -#include <cassert> #include <QWidget> #include <QComboBox> #include <QCheckBox> @@ -67,26 +66,24 @@ namespace options { private: QMap<QString, QVariant> map; QString name; + static const QString ini_pathname() + { + QSettings settings(group::org); + return settings.value("SettingsFile", + QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); + } public: group(const QString& name) : name(name) { - QSettings settings(group::org); - QString currentFile = - settings.value("SettingsFile", - QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile(currentFile, QSettings::IniFormat); - iniFile.beginGroup(name); - for (auto& k : iniFile.childKeys()) - map[k] = iniFile.value(k); - iniFile.endGroup(); + QSettings conf(ini_pathname(), QSettings::IniFormat); + conf.beginGroup(name); + for (auto& k : conf.childKeys()) + map[k] = conf.value(k); + conf.endGroup(); } static constexpr const char* org = "opentrack"; void save() { - QSettings settings(group::org); - QString currentFile = - settings.value("SettingsFile", - QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings s(currentFile, QSettings::IniFormat); + QSettings s(ini_pathname(), QSettings::IniFormat); s.beginGroup(name); for (auto& k : map.keys()) s.setValue(k, map[k]); @@ -96,7 +93,6 @@ namespace options { T get(const QString& k) { return qcruft_to_t<T>(map.value(k)); } - void put(const QString& s, const QVariant& d) { map[s] = d; @@ -107,8 +103,7 @@ namespace options { } }; - class impl_bundle : public QObject { - Q_OBJECT + class impl_bundle { private: QMutex mtx; const QString group_name; @@ -117,6 +112,7 @@ namespace options { impl_bundle(const impl_bundle&) = delete; impl_bundle& operator=(const impl_bundle&) = delete; bool modified; + long priv_cookie; public: impl_bundle(const QString& group_name) : mtx(QMutex::Recursive), @@ -130,11 +126,7 @@ namespace options { QMutexLocker l(&mtx); saved = group(group_name); transient = saved; - emit reloaded(); - } - - std::shared_ptr<impl_bundle> make(const QString& name) { - return std::make_shared<impl_bundle>(name); + priv_cookie++; } void store(const QString& name, const QVariant& datum) { @@ -142,10 +134,10 @@ namespace options { if (!transient.contains(name) || datum != transient.get<QVariant>(name)) { if (!modified) - qDebug() << name << transient.get<QVariant>(name) << datum; + qDebug() << "bundle" << group_name << "modified due to" << name << transient.get<QVariant>(name) << datum; modified = true; transient.put(name, datum); - emit bundleChanged(); + priv_cookie++; } } bool contains(const QString& name) @@ -170,16 +162,16 @@ namespace options { QMutexLocker l(&mtx); modified = false; transient = saved; - emit bundleChanged(); + priv_cookie++; } bool modifiedp() { QMutexLocker l(&mtx); return modified; } - signals: - void bundleChanged(); - void reloaded(); + long cookie() const { + return priv_cookie; + } }; typedef std::shared_ptr<impl_bundle> pbundle; @@ -187,17 +179,21 @@ namespace options { class base_value : public QObject { Q_OBJECT public: - base_value(pbundle b, const QString& name) : b(b), self_name(name) { - connect(b.get(), SIGNAL(reloaded()), this, SLOT(reread_value())); - } + base_value(pbundle b, const QString& name) : b(b), self_name(name), cookie_snap(b->cookie()) {} protected: virtual QVariant operator=(const QVariant& datum) = 0; pbundle b; QString self_name; - public slots: + private: + long cookie_snap; void reread_value() { - this->operator=(b->get<QVariant>(self_name)); + long cookie = b->cookie(); + if (cookie_snap != cookie) + { + cookie_snap = cookie; + this->operator=(b->get<QVariant>(self_name)); + } } public slots: #define DEFINE_SLOT(t) void setValue(t datum) { this->operator=(qVariantFromValue(datum)); } -- cgit v1.2.3 From 29d11bc97afb5932aa1d394a6df295a364d983a9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 22:48:45 +0200 Subject: get rid of evil CALLING_CONVENTION macro --- facetracknoir/plugin-api.hpp | 6 - facetracknoir/plugin-support.cpp | 11 +- facetracknoir/plugin-support.h | 20 +-- ftnoir_filter_accela/ftnoir_filter_accela.cpp | 134 ++++++++++----------- .../ftnoir_filter_accela_dialog.cpp | 2 +- ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp | 2 +- ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp | 2 +- ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp | 2 +- ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp | 2 +- ftnoir_filter_kalman/kalman.cpp | 6 +- ftnoir_protocol_fg/ftnoir_protocol_fg.cpp | 2 +- ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp | 2 +- ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp | 2 +- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp | 2 +- .../ftnoir_protocol_fsuipc_dialog.cpp | 2 +- .../ftnoir_protocol_fsuipc_dll.cpp | 2 +- ftnoir_protocol_ft/ftnoir_protocol_ft.cpp | 2 +- ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp | 2 +- ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp | 2 +- ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp | 2 +- ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp | 2 +- ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp | 2 +- .../ftnoir_protocol_libevdev.cpp | 2 +- .../ftnoir_protocol_libevdev_dialog.cpp | 2 +- .../ftnoir_protocol_libevdev_dll.cpp | 2 +- ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp | 2 +- .../ftnoir_protocol_mouse_dialog.cpp | 2 +- .../ftnoir_protocol_mouse_dll.cpp | 2 +- ftnoir_protocol_sc/ftnoir_protocol_sc.cpp | 2 +- ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp | 2 +- ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp | 2 +- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp | 2 +- .../ftnoir_protocol_vjoy_dialog.cpp | 2 +- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp | 2 +- ftnoir_protocol_wine/ftnoir_protocol_wine.cpp | 2 +- .../ftnoir_protocol_wine_dialog.cpp | 2 +- ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp | 2 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 6 +- .../ftnoir_tracker_freepie-udp.cpp | 2 +- .../ftnoir_tracker_freepie-udp_dialog.cpp | 2 +- .../ftnoir_tracker_freepie-udp_dll.cpp | 2 +- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 6 +- ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp | 2 +- .../ftnoir_tracker_hydra_dialog.cpp | 2 +- ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp | 2 +- .../ftnoir_tracker_joystick.cpp | 2 +- .../ftnoir_tracker_joystick_dialog.cpp | 2 +- .../ftnoir_tracker_joystick_dll.cpp | 2 +- ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 2 +- ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp | 2 +- ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp | 2 +- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 2 +- ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp | 2 +- ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp | 2 +- ftnoir_tracker_udp/ftnoir_tracker_udp.cpp | 2 +- ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp | 2 +- ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp | 2 +- 57 files changed, 133 insertions(+), 156 deletions(-) diff --git a/facetracknoir/plugin-api.hpp b/facetracknoir/plugin-api.hpp index d458d25c..f352a6a9 100644 --- a/facetracknoir/plugin-api.hpp +++ b/facetracknoir/plugin-api.hpp @@ -2,12 +2,6 @@ #include "facetracknoir/export.hpp" -#if defined(_WIN32) -# define CALLING_CONVENTION __stdcall -#else -# define CALLING_CONVENTION -#endif - enum Axis { TX = 0, TY, TZ, Yaw, Pitch, Roll }; diff --git a/facetracknoir/plugin-support.cpp b/facetracknoir/plugin-support.cpp index c6622fe0..35cf8f29 100644 --- a/facetracknoir/plugin-support.cpp +++ b/facetracknoir/plugin-support.cpp @@ -1,11 +1,8 @@ +#include <cstdio> #include "plugin-support.h" #include <QCoreApplication> #include <QFile> -#if !(defined(_WIN32)) -# include <dlfcn.h> -#endif - SelectedLibraries* Libraries = NULL; SelectedLibraries::~SelectedLibraries() @@ -88,15 +85,15 @@ DynamicLibrary::DynamicLibrary(const QString& filename) : if (_foo::die(handle, !handle->load())) return; - Dialog = (DIALOG_FUNPTR) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetDialog" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); + Dialog = (DIALOG_FUNPTR) handle->resolve("GetDialog"); if (_foo::die(handle, !Dialog)) return; - Constructor = (CTOR_FUNPTR) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetConstructor" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); + Constructor = (CTOR_FUNPTR) handle->resolve("GetConstructor"); if (_foo::die(handle, !Constructor)) return; - Metadata = (METADATA_FUNPTR) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetMetadata" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); + Metadata = (METADATA_FUNPTR) handle->resolve("GetMetadata"); if (_foo::die(handle, !Metadata)) return; #else diff --git a/facetracknoir/plugin-support.h b/facetracknoir/plugin-support.h index 1e02bd60..3924fc09 100644 --- a/facetracknoir/plugin-support.h +++ b/facetracknoir/plugin-support.h @@ -2,20 +2,6 @@ #include "facetracknoir/plugin-api.hpp" -#if defined(_WIN32) -# define CALLING_CONVENTION_SUFFIX_VOID_FUNCTION "@0" -# ifdef _MSC_VER -# error "No support for MSVC anymore" -#else -# define MAYBE_STDCALL_UNDERSCORE "" -# endif -#else -# define CALLING_CONVENTION_SUFFIX_VOID_FUNCTION "" -# define MAYBE_STDCALL_UNDERSCORE "" -#endif - -#include <cstdio> - #include <QWidget> #include <QDebug> #include <QString> @@ -38,9 +24,9 @@ extern SelectedLibraries* Libraries; struct Metadata; -extern "C" typedef void* (CALLING_CONVENTION * CTOR_FUNPTR)(void); -extern "C" typedef Metadata* (CALLING_CONVENTION* METADATA_FUNPTR)(void); -extern "C" typedef void* (CALLING_CONVENTION* DIALOG_FUNPTR)(void); +extern "C" typedef void* (*CTOR_FUNPTR)(void); +extern "C" typedef Metadata* (*METADATA_FUNPTR)(void); +extern "C" typedef void* (*DIALOG_FUNPTR)(void); class DynamicLibrary { public: diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index b7aee77c..9b7b2cb2 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -1,67 +1,67 @@ -/* Copyright (c) 2012-2013 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 "ftnoir_filter_accela/ftnoir_filter_accela.h" -#include <algorithm> -#include <cmath> -#include <QDebug> -#include <QMutexLocker> -#include "facetracknoir/plugin-support.h" -using namespace std; - -FTNoIR_Filter::FTNoIR_Filter() : first_run(true) -{ -} - -static inline double parabola(const double a, const double x, const double dz, const double expt) -{ - const double sign = x > 0 ? 1 : -1; - const double a1 = 1./a; - return a1 * pow(std::max<double>(fabs(x) - dz, 0), expt) * sign; -} - -void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position, - double *new_camera_position) -{ - if (first_run) - { - for (int i = 0; i < 6; i++) - { - new_camera_position[i] = target_camera_position[i]; - for (int j = 0; j < 3; j++) - last_output[j][i] = target_camera_position[i]; - } - - first_run = false; - return; - } - - for (int i=0;i<6;i++) - { - const double vec = target_camera_position[i] - last_output[0][i]; - const double vec2 = target_camera_position[i] - last_output[1][i]; - const double vec3 = target_camera_position[i] - last_output[2][i]; - const int sign = vec < 0 ? -1 : 1; - const double a = i >= 3 ? s.rotation_alpha : s.translation_alpha; - const double a2 = a * s.second_order_alpha; - const double a3 = a * s.third_order_alpha; - const double deadzone = i >= 3 ? s.rot_deadzone : s.trans_deadzone; - const double velocity = - parabola(a, vec, deadzone, s.expt) + - parabola(a2, vec2, deadzone, s.expt) + - parabola(a3, vec3, deadzone, s.expt); - const double result = last_output[0][i] + velocity; - const bool done = sign > 0 ? result >= target_camera_position[i] : result <= target_camera_position[i]; - last_output[2][i] = last_output[1][i]; - last_output[1][i] = last_output[0][i]; - last_output[0][i] = new_camera_position[i] = done ? target_camera_position[i] : result; - } -} - -extern "C" OPENTRACK_EXPORT IFilter* CALLING_CONVENTION GetConstructor() -{ - return new FTNoIR_Filter; -} +/* Copyright (c) 2012-2013 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 "ftnoir_filter_accela/ftnoir_filter_accela.h" +#include <algorithm> +#include <cmath> +#include <QDebug> +#include <QMutexLocker> +#include "facetracknoir/plugin-support.h" +using namespace std; + +FTNoIR_Filter::FTNoIR_Filter() : first_run(true) +{ +} + +static inline double parabola(const double a, const double x, const double dz, const double expt) +{ + const double sign = x > 0 ? 1 : -1; + const double a1 = 1./a; + return a1 * pow(std::max<double>(fabs(x) - dz, 0), expt) * sign; +} + +void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position, + double *new_camera_position) +{ + if (first_run) + { + for (int i = 0; i < 6; i++) + { + new_camera_position[i] = target_camera_position[i]; + for (int j = 0; j < 3; j++) + last_output[j][i] = target_camera_position[i]; + } + + first_run = false; + return; + } + + for (int i=0;i<6;i++) + { + const double vec = target_camera_position[i] - last_output[0][i]; + const double vec2 = target_camera_position[i] - last_output[1][i]; + const double vec3 = target_camera_position[i] - last_output[2][i]; + const int sign = vec < 0 ? -1 : 1; + const double a = i >= 3 ? s.rotation_alpha : s.translation_alpha; + const double a2 = a * s.second_order_alpha; + const double a3 = a * s.third_order_alpha; + const double deadzone = i >= 3 ? s.rot_deadzone : s.trans_deadzone; + const double velocity = + parabola(a, vec, deadzone, s.expt) + + parabola(a2, vec2, deadzone, s.expt) + + parabola(a3, vec3, deadzone, s.expt); + const double result = last_output[0][i] + velocity; + const bool done = sign > 0 ? result >= target_camera_position[i] : result <= target_camera_position[i]; + last_output[2][i] = last_output[1][i]; + last_output[1][i] = last_output[0][i]; + last_output[0][i] = new_camera_position[i] = done ? target_camera_position[i] : result; + } +} + +extern "C" OPENTRACK_EXPORT IFilter* GetConstructor() +{ + return new FTNoIR_Filter; +} diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp index 7afcd014..965cb3ea 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp @@ -52,7 +52,7 @@ void FilterControls::save() { accela_filter->receiveSettings(); } -extern "C" OPENTRACK_EXPORT IFilterDialog* CALLING_CONVENTION GetDialog() +extern "C" OPENTRACK_EXPORT IFilterDialog* GetDialog() { return new FilterControls; } diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp index e908b873..65bee314 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dll.cpp @@ -1,7 +1,7 @@ #include "ftnoir_filter_accela.h" #include "facetracknoir/plugin-support.h" -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new FTNoIR_FilterDll; } diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp index 810cfef9..c7169faa 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp @@ -91,7 +91,7 @@ void FTNoIR_Filter::FilterHeadPoseData(const double *target_camera_position, } } -extern "C" OPENTRACK_EXPORT IFilter* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IFilter* GetConstructor() { return new FTNoIR_Filter; } diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp index 9e89bdb7..a32875b9 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp @@ -43,7 +43,7 @@ void FilterControls::save() { pFilter->receiveSettings(); } -extern "C" OPENTRACK_EXPORT IFilterDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT IFilterDialog* GetDialog( ) { return new FilterControls; } diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp index 9a5a9148..5ec6138a 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma_dll.cpp @@ -1,7 +1,7 @@ #include "ftnoir_filter_ewma2.h" #include "facetracknoir/plugin-support.h" -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new FTNoIR_FilterDll; } diff --git a/ftnoir_filter_kalman/kalman.cpp b/ftnoir_filter_kalman/kalman.cpp index cb622d79..70bbba8d 100644 --- a/ftnoir_filter_kalman/kalman.cpp +++ b/ftnoir_filter_kalman/kalman.cpp @@ -121,16 +121,16 @@ void FilterControls::doCancel() { close(); } -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new FTNoIR_FilterDll; } -extern "C" OPENTRACK_EXPORT IFilter* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IFilter* GetConstructor() { return new FTNoIR_Filter; } -extern "C" OPENTRACK_EXPORT IFilterDialog* CALLING_CONVENTION GetDialog() { +extern "C" OPENTRACK_EXPORT IFilterDialog* GetDialog() { return new FilterControls; } diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp index 45293796..b2d29118 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp @@ -57,7 +57,7 @@ bool FTNoIR_Protocol::checkServerInstallationOK() return outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); } -extern "C" OPENTRACK_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IProtocol* GetConstructor() { return new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp index eb8b9a81..1aa67b43 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp @@ -63,7 +63,7 @@ void FGControls::doCancel() { this->close(); } -extern "C" OPENTRACK_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT IProtocolDialog* GetDialog( ) { return new FGControls; } diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp index a1f065c7..f830f8f7 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg_dll.cpp @@ -26,7 +26,7 @@ #include <QDebug> #include "facetracknoir/plugin-support.h" -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp index f5e6d5ea..822cdb4d 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp @@ -158,7 +158,7 @@ bool FTNoIR_Protocol::checkServerInstallationOK() return true; } -extern "C" OPENTRACK_EXPORT FTNoIR_Protocol* CALLING_CONVENTION GetConstructor(void) +extern "C" OPENTRACK_EXPORT FTNoIR_Protocol* GetConstructor(void) { return new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp index e8c04dfe..d2af714f 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp @@ -56,7 +56,7 @@ void FSUIPCControls::getLocationOfDLL() } } -extern "C" OPENTRACK_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog(void) +extern "C" OPENTRACK_EXPORT IProtocolDialog* GetDialog(void) { return new FSUIPCControls; } diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp index b2cd6e02..dbea2c46 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dll.cpp @@ -25,7 +25,7 @@ #include "ftnoir_protocol_fsuipc.h" #include "facetracknoir/plugin-support.h" -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata(void) +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata(void) { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp index 8b8be63d..5c365697 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp @@ -171,7 +171,7 @@ bool FTNoIR_Protocol::checkServerInstallationOK() return true; } -extern "C" OPENTRACK_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IProtocol* GetConstructor() { return new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp index 626d5358..654f6c18 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp @@ -73,7 +73,7 @@ void FTControls::selectDLL() { } } -extern "C" OPENTRACK_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog() +extern "C" OPENTRACK_EXPORT IProtocolDialog* GetDialog() { return new FTControls; } diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp index d6f05bad..d7a13fa5 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp @@ -1,7 +1,7 @@ #include "facetracknoir/plugin-support.h" #include "ftnoir_protocol_ft/ftnoir_protocol_ft.h" -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp index 4ee7362b..ccff1ba5 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp @@ -48,7 +48,7 @@ bool FTNoIR_Protocol::checkServerInstallationOK() return outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); } -extern "C" OPENTRACK_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IProtocol* GetConstructor() { return new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp index b4a92b39..cab5b4ba 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp @@ -56,7 +56,7 @@ void FTNControls::doCancel() { this->close(); } -extern "C" OPENTRACK_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT IProtocolDialog* GetDialog( ) { return new FTNControls; } diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp index da89a9ca..0d24ccf8 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dll.cpp @@ -25,7 +25,7 @@ #include "ftnoir_protocol_ftn.h" #include "facetracknoir/plugin-support.h" -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp index ca395b34..1840fa03 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.cpp @@ -94,7 +94,7 @@ void FTNoIR_Protocol::sendHeadposeToGame(const double* headpose) { (void) libevdev_uinput_write_event(uidev, EV_SYN, SYN_REPORT, 0); } -extern "C" OPENTRACK_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IProtocol* GetConstructor() { return new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp index 152095d4..d522610b 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp @@ -20,7 +20,7 @@ void LibevdevControls::doCancel() { void LibevdevControls::save() { } -extern "C" OPENTRACK_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT IProtocolDialog* GetDialog( ) { return new LibevdevControls; } diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp index 01f7ff5f..e258b077 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dll.cpp @@ -10,7 +10,7 @@ FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll() } -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp index f78eb16d..47f7a67e 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp @@ -63,7 +63,7 @@ bool FTNoIR_Protocol::checkServerInstallationOK() return true; } -extern "C" OPENTRACK_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IProtocol* GetConstructor() { return new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp index 50ea8f2e..4b12a4f0 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp @@ -63,7 +63,7 @@ void MOUSEControls::doCancel() { this->close(); } -extern "C" OPENTRACK_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT IProtocolDialog* GetDialog( ) { return new MOUSEControls; } diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp index 50f889db..39bdf6e5 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp @@ -25,7 +25,7 @@ #include "ftnoir_protocol_mouse.h" #include "facetracknoir/plugin-support.h" -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp index 0901546a..72b800d2 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp @@ -246,7 +246,7 @@ void CALLBACK FTNoIR_Protocol::processNextSimconnectEvent(SIMCONNECT_RECV* pData } } -extern "C" OPENTRACK_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IProtocol* GetConstructor() { return new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp index 8845bec6..cd8c21f9 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp @@ -48,7 +48,7 @@ void SCControls::doCancel() { close(); } -extern "C" OPENTRACK_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT IProtocolDialog* GetDialog( ) { return new SCControls; } diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp index 6effb6d5..9bdbef09 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc_dll.cpp @@ -26,7 +26,7 @@ #include <QDebug> #include "facetracknoir/plugin-support.h" -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp index 2b8aa017..58fa2ab1 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp @@ -28,7 +28,7 @@ void FTNoIR_Protocol::sendHeadposeToGame( const double *headpose ) { VJoy_UpdateJoyState(0, state); } -extern "C" OPENTRACK_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT IProtocol* GetConstructor() { return new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp index 440b12dc..6bd82d9a 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp @@ -20,7 +20,7 @@ void VJoyControls::doCancel() { void VJoyControls::save() { } -extern "C" OPENTRACK_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT IProtocolDialog* GetDialog( ) { return new VJoyControls; } diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp index 812a2af9..367a0df6 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp @@ -10,7 +10,7 @@ FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll() } -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp index 8ebc394d..29a2a70c 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp @@ -56,7 +56,7 @@ bool FTNoIR_Protocol::checkServerInstallationOK() return lck_shm.success(); } -extern "C" OPENTRACK_EXPORT void* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT void* GetConstructor() { return (IProtocol*) new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp index bcd3df45..c092de42 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine_dialog.cpp @@ -17,7 +17,7 @@ void FTControls::doCancel() { this->close(); } -extern "C" OPENTRACK_EXPORT void* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT void* GetDialog( ) { return (IProtocolDialog*) new FTControls; } diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp index 16e3e7c7..c6e3d433 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine_dll.cpp @@ -9,7 +9,7 @@ FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll() { } -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index b27b96b8..97830c9a 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -421,19 +421,19 @@ void TrackerDll::getIcon(QIcon *icon) //----------------------------------------------------------------------------- //#pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0") -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new TrackerDll; } //#pragma comment(linker, "/export:GetTracker=_GetTracker@0") -extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT ITracker* GetConstructor() { return new Tracker; } -extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog( ) { return new TrackerControls; } diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp index c1faebeb..39b1f4a2 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp @@ -97,7 +97,7 @@ void TrackerImpl::GetHeadPoseData(double *data) data[Roll] = pose[Roll]; } -extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT ITracker* GetConstructor() { return new TrackerImpl; } diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp index ee6c4284..5a0cade4 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp @@ -21,7 +21,7 @@ void TrackerDialog::doCancel() { this->close(); } -extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog() +extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog() { return new TrackerDialog; } diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp index 7578150f..afcc8c6e 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dll.cpp @@ -21,7 +21,7 @@ void TrackerMeta::getIcon(QIcon *icon) *icon = QIcon(":/glovepie.png"); } -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new TrackerMeta; } diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 15bf3a76..05eb116c 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -229,17 +229,17 @@ void TrackerDll::getIcon(QIcon *icon) *icon = QIcon(":/images/ht.png"); } -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new TrackerDll; } -extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT ITracker* GetConstructor() { return new Tracker; } -extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog( ) { return new TrackerControls; } diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp index 03c756f9..42de16c1 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp @@ -45,7 +45,7 @@ void Hydra_Tracker::GetHeadPoseData(double *data) data[Roll] = ypr[2] * r2d; } -extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT ITracker* GetConstructor() { return new Hydra_Tracker; } diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp index 80b5fb22..dbd9981f 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp @@ -21,7 +21,7 @@ void TrackerControls::doCancel() { close(); } -extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog( ) { return new TrackerControls; } diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp index 8388ddfe..18efea05 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp @@ -23,7 +23,7 @@ void FTNoIR_TrackerDll::getIcon(QIcon *icon) *icon = QIcon(":/images/facetracknoir.png"); } -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new FTNoIR_TrackerDll; } diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index 9b98d4be..bb1076dd 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -200,7 +200,7 @@ void FTNoIR_Tracker::GetHeadPoseData(double *data) data[i] = values[i] * limits[i] / AXIS_MAX; } -extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT ITracker* GetConstructor() { return new FTNoIR_Tracker; } diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp index 67e480a3..4ddbcb0c 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp @@ -53,7 +53,7 @@ void TrackerControls::doCancel() { this->close(); } -extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog( ) { return new TrackerControls; } diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp index 075ed555..af1a9679 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dll.cpp @@ -22,7 +22,7 @@ void FTNoIR_TrackerDll::getIcon(QIcon *icon) *icon = QIcon(":/images/facetracknoir.png"); } -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new FTNoIR_TrackerDll; } diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 768a3a71..7e5ccc6c 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -245,7 +245,7 @@ void Tracker::GetHeadPoseData(THeadPoseData *data) //----------------------------------------------------------------------------- #ifdef OPENTRACK_API -extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT ITracker* GetConstructor() #else #pragma comment(linker, "/export:GetTracker=_GetTracker@0") OPENTRACK_EXPORT ITrackerPtr __stdcall GetTracker() diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp index 0e58a2e4..9529e268 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp @@ -290,7 +290,7 @@ void TrackerDialog::unRegisterTracker() //ui.center_button->setEnabled(false); } -extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog( ) { return new TrackerDialog; } diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp index 07e1d9e7..fb756a86 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp @@ -32,7 +32,7 @@ void TrackerDll::getIcon(QIcon *icon) #ifdef OPENTRACK_API # include "facetracknoir/plugin-support.h" -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() #else # pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0") OPENTRACK_EXPORT ITrackerDllPtr __stdcall GetTrackerDll() diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index 1cca6075..4198a4b8 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -67,7 +67,7 @@ void Rift_Tracker::GetHeadPoseData(double *data) } } -extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT ITracker* GetConstructor() { return new Rift_Tracker; } diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp index c95ce364..a66eb83b 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp @@ -25,7 +25,7 @@ void TrackerControls::doCancel() { close(); } -extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog() +extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog() { return new TrackerControls; } diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp index 22eec9b9..902c8051 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dll.cpp @@ -35,7 +35,7 @@ void FTNoIR_TrackerDll::getIcon(QIcon *icon) *icon = QIcon(":/images/rift_tiny.png"); } -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new FTNoIR_TrackerDll; } diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp index 6253529d..136e075d 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp @@ -36,7 +36,7 @@ void FTNoIR_Tracker::GetHeadPoseData(double *data) data[i] = last_recv_pose[i]; } -extern "C" OPENTRACK_EXPORT ITracker* CALLING_CONVENTION GetConstructor() +extern "C" OPENTRACK_EXPORT ITracker* GetConstructor() { return new FTNoIR_Tracker; } diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp index 59683ddc..b0f40ee9 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp @@ -22,7 +22,7 @@ void TrackerControls::doCancel() { this->close(); } -extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) +extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog( ) { return new TrackerControls; } diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp index 525a618f..7cd23552 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dll.cpp @@ -21,7 +21,7 @@ void FTNoIR_TrackerDll::getIcon(QIcon *icon) *icon = QIcon(":/images/facetracknoir.png"); } -extern "C" OPENTRACK_EXPORT Metadata* CALLING_CONVENTION GetMetadata() +extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { return new FTNoIR_TrackerDll; } -- cgit v1.2.3 From 7a9d80c1897db4a67384a93bccaff5416b30cb76 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 23:06:30 +0200 Subject: fixup! fix Wine proto bitrot --- facetracknoir/plugin-support.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/facetracknoir/plugin-support.cpp b/facetracknoir/plugin-support.cpp index 35cf8f29..553d4aed 100644 --- a/facetracknoir/plugin-support.cpp +++ b/facetracknoir/plugin-support.cpp @@ -3,6 +3,10 @@ #include <QCoreApplication> #include <QFile> +#ifndef _WIN32 +# include <dlfcn.h> +#endif + SelectedLibraries* Libraries = NULL; SelectedLibraries::~SelectedLibraries() -- cgit v1.2.3 From 12a1067416caaa51e614197d585cc876109259d6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 23:11:23 +0200 Subject: nix stderr spam --- ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 7e5ccc6c..49cefed2 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -29,13 +29,10 @@ Tracker::Tracker() new_settings(nullptr) { - qDebug()<<"Tracker::Tracker"; } Tracker::~Tracker() { - qDebug()<<"Tracker::~Tracker"; - // terminate tracker thread set_command(ABORT); wait(); s.video_widget = false; -- cgit v1.2.3 From 25d9ab287523961df97355da9728c9d3adf946bc Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 23:36:52 +0200 Subject: fixup! PT tracker feature removal Some PT features got under the knife: - dynamic pose resolution velocity prediction model - tracker dialog's tracker tab - focal length coefficient --- ftnoir_tracker_pt/camera.h | 3 --- ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 1 - ftnoir_tracker_pt/ftnoir_tracker_pt.h | 2 +- ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h | 2 -- ftnoir_tracker_pt/point_tracker.h | 10 ++++------ 5 files changed, 5 insertions(+), 13 deletions(-) diff --git a/ftnoir_tracker_pt/camera.h b/ftnoir_tracker_pt/camera.h index 733cc61f..9836435c 100644 --- a/ftnoir_tracker_pt/camera.h +++ b/ftnoir_tracker_pt/camera.h @@ -65,7 +65,6 @@ protected: // update the camera using cam_desired, write res and f to cam_info if successful virtual void _set_device_index() = 0; - virtual void _set_f() = 0; virtual void _set_fps() = 0; virtual void _set_res() = 0; @@ -94,7 +93,6 @@ public: protected: virtual bool _get_frame(cv::Mat* frame); virtual void _set_index(); - virtual void _set_f(); virtual void _set_fps(); virtual void _set_res(); virtual void _set_device_index(); @@ -116,7 +114,6 @@ public: protected: virtual bool _get_frame(cv::Mat* frame); virtual void _set_device_index(); - virtual void _set_f(); virtual void _set_fps(); virtual void _set_res(); diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 49cefed2..82408ec6 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -35,7 +35,6 @@ Tracker::~Tracker() { set_command(ABORT); wait(); - s.video_widget = false; delete video_widget; video_widget = NULL; if (video_frame->layout()) delete video_frame->layout(); diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.h b/ftnoir_tracker_pt/ftnoir_tracker_pt.h index 238dcd8f..6ddfbe5d 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.h @@ -53,7 +53,7 @@ public: int get_n_points() { QMutexLocker lock(&mutex); return point_extractor.get_points().size(); } void get_cam_info(CamInfo* info) { QMutexLocker lock(&mutex); *info = camera.get_info(); } -protected: +private: // --- MutexedFrameProvider interface --- virtual bool get_frame_and_points(cv::Mat& frame, std::shared_ptr< std::vector<cv::Vec2f> >& points); diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h index 7faad9ed..365776e4 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h @@ -31,7 +31,6 @@ struct settings value<int> m01_x, m01_y, m01_z; value<int> m02_x, m02_y, m02_z; - value<bool> video_widget; value<int> t_MH_x, t_MH_y, t_MH_z; @@ -59,7 +58,6 @@ struct settings m02_x(b, "m_02-x", 0), m02_y(b, "m_02-y", 0), m02_z(b, "m_02-z", 0), - video_widget(b, "video-widget", true), t_MH_x(b, "model-centroid-x", 0), t_MH_y(b, "model-centroid-y", 0), t_MH_z(b, "model-centroid-z", 0), diff --git a/ftnoir_tracker_pt/point_tracker.h b/ftnoir_tracker_pt/point_tracker.h index 44bad28e..a1f6f041 100644 --- a/ftnoir_tracker_pt/point_tracker.h +++ b/ftnoir_tracker_pt/point_tracker.h @@ -96,19 +96,17 @@ public: FrameTrafo get_pose() const { return X_CM; } void reset(); -protected: +private: inline cv::Vec2f project(const cv::Vec3f& v_M, float f) { cv::Vec3f v_C = X_CM * v_M; return cv::Vec2f(f*v_C[0]/v_C[2], f*v_C[1]/v_C[2]); } - void find_correspondences(const std::vector<cv::Vec2f>& points, float f); - + void find_correspondences(const std::vector<cv::Vec2f>& points, float f); + int POSIT(float f); // The POSIT algorithm, returns the number of iterations + cv::Vec2f p[PointModel::N_POINTS]; // the points in model order - - int POSIT(float f); // The POSIT algorithm, returns the number of iterations - FrameTrafo X_CM; // trafo from model to camera }; -- cgit v1.2.3 From fbf579e102af6eb178d9b4b07f0e1e3956985e56 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 23:37:08 +0200 Subject: fixup! fixup! PT tracker feature removal Some PT features got under the knife: - dynamic pose resolution velocity prediction model - tracker dialog's tracker tab - focal length coefficient --- ftnoir_tracker_pt/camera.cpp | 13 ------------- ftnoir_tracker_pt/camera.h | 1 - ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 1 - 3 files changed, 15 deletions(-) diff --git a/ftnoir_tracker_pt/camera.cpp b/ftnoir_tracker_pt/camera.cpp index 686e1b9b..74b24093 100644 --- a/ftnoir_tracker_pt/camera.cpp +++ b/ftnoir_tracker_pt/camera.cpp @@ -108,14 +108,6 @@ void Camera::set_device_index(int index) } } -void Camera::set_f(float f) -{ - if (cam_desired.f != f) - { - cam_desired.f = f; - _set_f(); - } -} void Camera::set_fps(int fps) { if (cam_desired.fps != fps) @@ -201,11 +193,6 @@ void CVCamera::_set_index() if (active) restart(); } -void CVCamera::_set_f() -{ - cam_info.f = cam_desired.f; -} - void CVCamera::_set_fps() { if (cap) cap->set(CV_CAP_PROP_FPS, cam_desired.fps); diff --git a/ftnoir_tracker_pt/camera.h b/ftnoir_tracker_pt/camera.h index 9836435c..e2ba56c4 100644 --- a/ftnoir_tracker_pt/camera.h +++ b/ftnoir_tracker_pt/camera.h @@ -48,7 +48,6 @@ public: // calls corresponding template methods and reinitializes frame rate calculation void set_device_index(int index); - void set_f(float f); void set_fps(int fps); void set_res(int x_res, int y_res); diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 82408ec6..23da97ca 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -122,7 +122,6 @@ void Tracker::apply_inner() camera.set_device_index(s.cam_index); camera.set_res(s.cam_res_x, s.cam_res_y); camera.set_fps(s.cam_fps); - camera.set_f(1); frame_rotation.rotation = static_cast<RotationType>(static_cast<int>(s.cam_roll)); point_extractor.threshold_val = s.threshold; point_extractor.threshold_secondary_val = s.threshold_secondary; -- cgit v1.2.3 From 460eb42ae913700903df7b25d50282397da95395 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 23:37:28 +0200 Subject: fix timer uninitialized memory access --- facetracknoir/timer.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/facetracknoir/timer.hpp b/facetracknoir/timer.hpp index 24d62e37..d2df1efd 100644 --- a/facetracknoir/timer.hpp +++ b/facetracknoir/timer.hpp @@ -53,8 +53,8 @@ public: long start() { struct timespec cur; (void) clock_gettime(CLOCK_MONOTONIC, &cur); - int ret = conv(cur); state = cur; + int ret = conv(cur); return ret; } long elapsed() { -- cgit v1.2.3 From c678574f6fd84ede6744a1fcc4453cd67d8a60da Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 02:11:45 +0200 Subject: options: fix cookie logic --- facetracknoir/options.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/facetracknoir/options.h b/facetracknoir/options.h index d751051a..0e275c77 100644 --- a/facetracknoir/options.h +++ b/facetracknoir/options.h @@ -179,14 +179,12 @@ namespace options { class base_value : public QObject { Q_OBJECT public: - base_value(pbundle b, const QString& name) : b(b), self_name(name), cookie_snap(b->cookie()) {} + base_value(pbundle b, const QString& name) : b(b), self_name(name), cookie_snap(0) {} protected: virtual QVariant operator=(const QVariant& datum) = 0; pbundle b; QString self_name; - private: - long cookie_snap; - void reread_value() + void maybe_lazy_change() { long cookie = b->cookie(); if (cookie_snap != cookie) @@ -195,6 +193,8 @@ namespace options { this->operator=(b->get<QVariant>(self_name)); } } + private: + long cookie_snap; public slots: #define DEFINE_SLOT(t) void setValue(t datum) { this->operator=(qVariantFromValue(datum)); } DEFINE_SLOT(double) @@ -229,7 +229,11 @@ namespace options { this->operator=(qVariantFromValue<T>(def)); } } - operator T() { return b->get<T>(self_name); } + operator T() + { + maybe_lazy_change(); + return b->get<T>(self_name); + } QVariant operator=(const T& datum) { return this->operator =(qVariantFromValue<T>(datum)); -- cgit v1.2.3 From 43096962390dfa8005aa81def09aa274ac6c90cb Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 02:11:53 +0200 Subject: qdebug harder --- facetracknoir/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/facetracknoir/options.h b/facetracknoir/options.h index 0e275c77..ce705033 100644 --- a/facetracknoir/options.h +++ b/facetracknoir/options.h @@ -134,7 +134,7 @@ namespace options { if (!transient.contains(name) || datum != transient.get<QVariant>(name)) { if (!modified) - qDebug() << "bundle" << group_name << "modified due to" << name << transient.get<QVariant>(name) << datum; + qDebug() << "bundle" << group_name << "modified due to" << name << transient.get<QVariant>(name) << datum << "->" << datum; modified = true; transient.put(name, datum); priv_cookie++; -- cgit v1.2.3 From cf84c354b30b39fe04a79f457947f7f778bc8fc7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 02:12:02 +0200 Subject: fix warn !_WIN32 --- facetracknoir/plugin-support.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/facetracknoir/plugin-support.cpp b/facetracknoir/plugin-support.cpp index 553d4aed..e9154bb7 100644 --- a/facetracknoir/plugin-support.cpp +++ b/facetracknoir/plugin-support.cpp @@ -124,7 +124,7 @@ DynamicLibrary::DynamicLibrary(const QString& filename) : handle = nullptr; return true; } - false; + return false; } }; -- cgit v1.2.3 From d74b99391bbdfb25f9559834082ae7ee6d30720d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 02:12:20 +0200 Subject: decruft PT more, so it doesn't crash finally --- ftnoir_tracker_pt/camera.cpp | 5 -- ftnoir_tracker_pt/camera.h | 20 +++-- ftnoir_tracker_pt/frame_observer.cpp | 18 ----- ftnoir_tracker_pt/frame_observer.h | 76 ----------------- ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 44 +++------- ftnoir_tracker_pt/ftnoir_tracker_pt.h | 23 +++--- ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp | 108 ++++++++----------------- ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h | 14 +--- ftnoir_tracker_pt/point_extractor.cpp | 36 ++++----- ftnoir_tracker_pt/point_extractor.h | 2 +- ftnoir_tracker_pt/point_tracker.cpp | 75 +++++++++-------- ftnoir_tracker_pt/point_tracker.h | 25 +++--- ftnoir_tracker_pt/pt_video_widget.cpp | 18 ----- ftnoir_tracker_pt/pt_video_widget.h | 25 ++---- 14 files changed, 150 insertions(+), 339 deletions(-) delete mode 100644 ftnoir_tracker_pt/frame_observer.cpp delete mode 100644 ftnoir_tracker_pt/frame_observer.h diff --git a/ftnoir_tracker_pt/camera.cpp b/ftnoir_tracker_pt/camera.cpp index 74b24093..861c83cc 100644 --- a/ftnoir_tracker_pt/camera.cpp +++ b/ftnoir_tracker_pt/camera.cpp @@ -188,11 +188,6 @@ bool CVCamera::_get_frame(Mat* frame) return false; } -void CVCamera::_set_index() -{ - if (active) restart(); -} - void CVCamera::_set_fps() { if (cap) cap->set(CV_CAP_PROP_FPS, cam_desired.fps); diff --git a/ftnoir_tracker_pt/camera.h b/ftnoir_tracker_pt/camera.h index e2ba56c4..86cafd42 100644 --- a/ftnoir_tracker_pt/camera.h +++ b/ftnoir_tracker_pt/camera.h @@ -25,12 +25,11 @@ void get_camera_device_names(std::vector<std::string>& device_names); // ---------------------------------------------------------------------------- struct CamInfo { - CamInfo() : res_x(0), res_y(0), fps(0), f(1) {} + CamInfo() : res_x(0), res_y(0), fps(0) {} int res_x; int res_y; int fps; - float f; // (focal length) / (sensor width) }; // ---------------------------------------------------------------------------- @@ -39,7 +38,7 @@ class Camera { public: Camera() : dt_valid(0), dt_mean(0), desired_index(0), active_index(-1), active(false) {} - virtual ~Camera() {} + virtual ~Camera() = 0; // start/stop capturing virtual void start() = 0; @@ -75,7 +74,7 @@ protected: CamInfo cam_info; CamInfo cam_desired; }; - +inline Camera::~Camera() {} // ---------------------------------------------------------------------------- // camera based on OpenCV's videoCapture @@ -86,15 +85,14 @@ public: CVCamera() : cap(NULL) {} ~CVCamera() { stop(); } - virtual void start(); - virtual void stop(); + void start() override; + void stop() override; protected: - virtual bool _get_frame(cv::Mat* frame); - virtual void _set_index(); - virtual void _set_fps(); - virtual void _set_res(); - virtual void _set_device_index(); + bool _get_frame(cv::Mat* frame) override; + void _set_fps() override; + void _set_res() override; + void _set_device_index() override; cv::VideoCapture* cap; }; diff --git a/ftnoir_tracker_pt/frame_observer.cpp b/ftnoir_tracker_pt/frame_observer.cpp deleted file mode 100644 index 76dee351..00000000 --- a/ftnoir_tracker_pt/frame_observer.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* Copyright (c) 2013 Patrick Ruoff - * - * 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 "frame_observer.h" - -//----------------------------------------------------------------------------- -FrameProvider::~FrameProvider() -{ - QMutexLocker lock(&observer_mutex); - for (std::set<FrameObserver*>::iterator iter=frame_observers.begin(); iter!=frame_observers.end(); ++iter) - { - (*iter)->on_frame_provider_destroy(); - } -} diff --git a/ftnoir_tracker_pt/frame_observer.h b/ftnoir_tracker_pt/frame_observer.h deleted file mode 100644 index ca8ffb46..00000000 --- a/ftnoir_tracker_pt/frame_observer.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (c) 2013 Patrick Ruoff - * - * 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. - */ - -#ifndef FRAME_OBSERVER_H -#define FRAME_OBSERVER_H - -#include <QMutex> -#include <opencv2/opencv.hpp> -#ifndef OPENTRACK_API -# include <boost/shared_ptr.hpp> -#else -# include <memory> -#endif -#include <set> - -//----------------------------------------------------------------------------- -// Forward declarations -class FrameObserver; - -//----------------------------------------------------------------------------- -// Provides means to copy frame and point information if it has observers -// Instantiate a FrameObserver to get the information -class FrameProvider -{ - friend class FrameObserver; -public: - ~FrameProvider(); - -protected: - virtual bool get_frame_and_points(cv::Mat& frame, std::shared_ptr< std::vector<cv::Vec2f> >& points) = 0; - - bool has_observers() const { QMutexLocker lock(&observer_mutex); return !frame_observers.empty(); } - -private: - mutable QMutex observer_mutex; - void add_observer(FrameObserver* obs) { QMutexLocker lock(&observer_mutex); frame_observers.insert(obs); } - void remove_observer(FrameObserver* obs) { QMutexLocker lock(&observer_mutex); frame_observers.erase(obs); } - std::set<FrameObserver*> frame_observers; -}; - -//----------------------------------------------------------------------------- -// Used to get frame and point information from MutexedFrameProvider -// Destroy instance if not interested anymore since a living -// FrameObserver instance causes MutexedFrameProvider to provide the information, -// potentially reducing its performance -class FrameObserver -{ -public: - FrameObserver(FrameProvider* provider) : provider(provider) { - provider->add_observer(this); - } - - ~FrameObserver() { - if (provider) provider->remove_observer(this); - } - - bool get_frame_and_points(cv::Mat& frame, std::shared_ptr< std::vector<cv::Vec2f> >& points) { - return provider ? provider->get_frame_and_points(frame, points) : false; - } - - void on_frame_provider_destroy() { - provider = NULL; - } - -protected: - FrameProvider* provider; - -private: - FrameObserver(const FrameObserver&); -}; - -#endif //FRAME_OBSERVER_H diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 23da97ca..1136ad4a 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -17,9 +17,6 @@ using namespace cv; //#define PT_PERF_LOG //log performance -const float rad2deg = 180.0/3.14159265; -const float deg2rad = 1.0/rad2deg; - //----------------------------------------------------------------------------- Tracker::Tracker() : mutex(QMutex::Recursive), @@ -27,7 +24,6 @@ Tracker::Tracker() video_widget(NULL), video_frame(NULL), new_settings(nullptr) - { } @@ -54,30 +50,28 @@ void Tracker::reset_command(Command command) void Tracker::run() { - qDebug()<<"Tracker:: Thread started"; + qDebug()<< "pt: thread started"; #ifdef PT_PERF_LOG QFile log_file(QCoreApplication::applicationDirPath() + "/PointTrackerPerformance.txt"); if (!log_file.open(QIODevice::WriteOnly | QIODevice::Text)) return; QTextStream log_stream(&log_file); #endif - time.start(); - bool new_frame; forever { if (commands & ABORT) break; commands = 0; apply_inner(); const double dt = time.start() * 1e-9; - new_frame = camera.get_frame(dt, &frame); + const bool new_frame = camera.get_frame(dt, &frame); if (new_frame && !frame.empty()) { QMutexLocker lock(&mutex); frame = frame_rotation.rotate_frame(frame); - const std::vector<cv::Vec2f>& points = point_extractor.extract_points(frame, dt, true); + const std::vector<cv::Vec2f>& points = point_extractor.extract_points(frame); for (auto p : points) { auto p2 = cv::Point(p[0] * frame.cols + frame.cols/2, -p[1] * frame.cols + frame.rows/2); @@ -93,7 +87,8 @@ void Tracker::run() color, 4); } - point_tracker.track(points, camera.get_info().f); + if (points.size() == PointModel::N_POINTS) + point_tracker.track(points, model); video_widget->update_image(frame); } #ifdef PT_PERF_LOG @@ -119,6 +114,12 @@ void Tracker::apply_inner() reset(); auto& s = *tmp; qDebug()<<"Tracker:: Applying settings"; + + { + cv::Vec3f M01(s.m01_x, s.m01_y, s.m01_z); + cv::Vec3f M02(s.m02_x, s.m02_y, s.m02_z); + model = PointModel(M01, M02); + } camera.set_device_index(s.cam_index); camera.set_res(s.cam_res_x, s.cam_res_y); camera.set_fps(s.cam_fps); @@ -127,11 +128,6 @@ void Tracker::apply_inner() point_extractor.threshold_secondary_val = s.threshold_secondary; point_extractor.min_size = s.min_point_size; point_extractor.max_size = s.max_point_size; - { - cv::Vec3f M01(s.m01_x, s.m01_y, s.m01_z); - cv::Vec3f M02(s.m02_x, s.m02_y, s.m02_z); - point_tracker.point_model = std::shared_ptr<PointModel>(new PointModel(M01, M02)); - } t_MH = cv::Vec3f(s.t_MH_x, s.t_MH_y, s.t_MH_z); R_GC = Matx33f( cos(deg2rad*s.cam_yaw), 0, sin(deg2rad*s.cam_yaw), 0, 1, 0, @@ -160,28 +156,12 @@ void Tracker::center() X_GH_0 = R_GC * X_CM_0 * X_MH; } -bool Tracker::get_frame_and_points(cv::Mat& frame_copy, std::shared_ptr< std::vector<Vec2f> >& points) -{ - QMutexLocker lock(&mutex); - if (frame.empty()) return false; - - // copy the frame and points from the tracker thread - frame_copy = frame.clone(); - points = std::shared_ptr< vector<Vec2f> >(new vector<Vec2f>(point_extractor.get_points())); - return true; -} - -void Tracker::refreshVideo() -{ - if (video_widget) video_widget->update_frame_and_points(); -} - void Tracker::StartTracker(QFrame *parent_window) { this->video_frame = parent_window; video_frame->setAttribute(Qt::WA_NativeWindow); video_frame->show(); - video_widget = new PTVideoWidget(video_frame, this); + video_widget = new PTVideoWidget(video_frame); QHBoxLayout* video_layout = new QHBoxLayout(parent_window); video_layout->setContentsMargins(0, 0, 0, 0); video_layout->addWidget(video_widget); diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.h b/ftnoir_tracker_pt/ftnoir_tracker_pt.h index 6ddfbe5d..5bcfd37d 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.h @@ -12,7 +12,6 @@ # include "facetracknoir/plugin-api.hpp" #endif #include "ftnoir_tracker_pt_settings.h" -#include "frame_observer.h" #include "camera.h" #include "point_extractor.h" #include "point_tracker.h" @@ -34,30 +33,25 @@ //----------------------------------------------------------------------------- // Constantly processes the tracking chain in a separate thread -class Tracker : public ITracker, QThread, public FrameProvider +class Tracker : public ITracker, protected QThread { public: Tracker(); - virtual ~Tracker(); - virtual void StartTracker(QFrame* parent_window); - virtual void GetHeadPoseData(double* data); - virtual void refreshVideo(); + ~Tracker() override; + void StartTracker(QFrame* parent_window) override; + void GetHeadPoseData(double* data) override; void apply(settings& s); void apply_inner(); void center(); void reset(); // reset the trackers internal state variables - void run(); void get_pose(FrameTrafo* X_CM) { QMutexLocker lock(&mutex); *X_CM = point_tracker.get_pose(); } int get_n_points() { QMutexLocker lock(&mutex); return point_extractor.get_points().size(); } void get_cam_info(CamInfo* info) { QMutexLocker lock(&mutex); *info = camera.get_info(); } - +protected: + void run() override; private: - // --- MutexedFrameProvider interface --- - virtual bool get_frame_and_points(cv::Mat& frame, std::shared_ptr< std::vector<cv::Vec2f> >& points); - - // --- thread --- QMutex mutex; // thread commands enum Command { @@ -85,6 +79,11 @@ private: settings s; std::atomic<settings*> new_settings; Timer time; + + static constexpr double rad2deg = 180.0/3.14159265; + static constexpr double deg2rad = 3.14159265/180.0; + + PointModel model; }; #undef VideoWidget diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp index 9529e268..6cd6135c 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp @@ -22,13 +22,9 @@ using namespace std; //----------------------------------------------------------------------------- TrackerDialog::TrackerDialog() : tracker(NULL), - video_widget_dialog(NULL), - timer(this), - trans_calib_running(false) + timer(this), + trans_calib_running(false) { - qDebug()<<"TrackerDialog::TrackerDialog"; - setAttribute(Qt::WA_DeleteOnClose, false); - ui.setupUi( this ); vector<string> device_names; @@ -147,6 +143,38 @@ void TrackerDialog::startstop_trans_calib(bool start) } } +void TrackerDialog::poll_tracker_info() +{ + if (tracker) + { + QString to_print; + + // display caminfo + CamInfo info; + tracker->get_cam_info(&info); + to_print = QString::number(info.res_x)+"x"+QString::number(info.res_y)+" @ "+QString::number(info.fps)+" FPS"; + ui.caminfo_label->setText(to_print); + + // display pointinfo + int n_points = tracker->get_n_points(); + to_print = QString::number(n_points); + if (n_points == 3) + to_print += " OK!"; + else + to_print += " BAD!"; + ui.pointinfo_label->setText(to_print); + + // update calibration + if (trans_calib_running) trans_calib_step(); + } + else + { + QString to_print = "Tracker offline"; + ui.caminfo_label->setText(to_print); + ui.pointinfo_label->setText(to_print); + } +} + void TrackerDialog::trans_calib_step() { if (tracker) @@ -197,7 +225,7 @@ void TrackerDialog::do_apply_without_saving(QAbstractButton*) void TrackerDialog::doApply() { - save(); + save(); } void TrackerDialog::doCancel() @@ -206,71 +234,6 @@ void TrackerDialog::doCancel() close(); } -void TrackerDialog::widget_destroyed(QObject* obj) -{ - if (obj == video_widget_dialog) { - // widget was / will be already deleted by Qt - destroy_video_widget(false); - } -} - -void TrackerDialog::create_video_widget() -{ - // this should not happen but better be sure - if (video_widget_dialog) destroy_video_widget(); - if (!tracker) return; - - video_widget_dialog = new VideoWidgetDialog(this, tracker); - video_widget_dialog->setAttribute( Qt::WA_DeleteOnClose ); - connect( video_widget_dialog, SIGNAL(destroyed(QObject*)), this, SLOT(widget_destroyed(QObject*)) ); - video_widget_dialog->show(); -} - -void TrackerDialog::destroy_video_widget(bool do_delete /*= true*/) -{ - if (video_widget_dialog) { - if (do_delete) delete video_widget_dialog; - video_widget_dialog = NULL; - } -} - -void TrackerDialog::poll_tracker_info() -{ - if (tracker) - { - QString to_print; - - // display caminfo - CamInfo info; - tracker->get_cam_info(&info); - to_print = QString::number(info.res_x)+"x"+QString::number(info.res_y)+" @ "+QString::number(info.fps)+" FPS"; - ui.caminfo_label->setText(to_print); - - // display pointinfo - int n_points = tracker->get_n_points(); - to_print = QString::number(n_points); - if (n_points == 3) - to_print += " OK!"; - else - to_print += " BAD!"; - ui.pointinfo_label->setText(to_print); - - // update calibration - if (trans_calib_running) trans_calib_step(); - - // update videowidget - if (video_widget_dialog) { - video_widget_dialog->get_video_widget()->update_frame_and_points(); - } - } - else - { - QString to_print = "Tracker offline"; - ui.caminfo_label->setText(to_print); - ui.pointinfo_label->setText(to_print); - } -} - void TrackerDialog::registerTracker(ITracker *t) { qDebug()<<"TrackerDialog:: Tracker registered"; @@ -285,7 +248,6 @@ void TrackerDialog::unRegisterTracker() { qDebug()<<"TrackerDialog:: Tracker un-registered"; tracker = NULL; - destroy_video_widget(); ui.tcalib_button->setEnabled(false); //ui.center_button->setEnabled(false); } diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h index dbb93f30..bff12dd0 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h @@ -23,13 +23,13 @@ //----------------------------------------------------------------------------- // The dialog that shows up when the user presses "Settings" -class TrackerDialog : public QWidget, Ui::UICPTClientControls, public ITrackerDialog +class TrackerDialog : public QWidget, public ITrackerDialog { Q_OBJECT public: TrackerDialog(); - void registerTracker(ITracker *tracker); - void unRegisterTracker(); + void registerTracker(ITracker *tracker) override; + void unRegisterTracker() override; void save(); void trans_calib_step(); @@ -40,14 +40,9 @@ public slots: void do_apply_without_saving(QAbstractButton *); void startstop_trans_calib(bool start); - void widget_destroyed(QObject* obj); - void create_video_widget(); void poll_tracker_info(); void set_model(int idx); - -protected: - void destroy_video_widget(bool do_delete = true); - +private: void set_model_clip(); void set_model_cap(); void set_model_custom(); @@ -56,7 +51,6 @@ protected: settings s; Tracker* tracker; - VideoWidgetDialog* video_widget_dialog; QTimer timer; TranslationCalibrator trans_calib; diff --git a/ftnoir_tracker_pt/point_extractor.cpp b/ftnoir_tracker_pt/point_extractor.cpp index b0e29270..819bf5e8 100644 --- a/ftnoir_tracker_pt/point_extractor.cpp +++ b/ftnoir_tracker_pt/point_extractor.cpp @@ -20,7 +20,7 @@ PointExtractor::PointExtractor(){ //freopen("CON", "w", stderr); } // ---------------------------------------------------------------------------- -const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float /*dt*/, bool draw_output) +const vector<Vec2f>& PointExtractor::extract_points(Mat& frame) { const int W = frame.cols; const int H = frame.rows; @@ -60,7 +60,7 @@ const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float /*dt*/, boo threshold(frame_gray, frame_bin, t, 255, THRESH_BINARY); threshold(frame_gray, frame_bin_low,std::max(float(1), t - (t*hyst)), 255, THRESH_BINARY); - if(draw_output) frame_bin.copyTo(frame_bin_copy); + frame_bin.copyTo(frame_bin_copy); if(frame_last.empty()){ frame_bin.copyTo(frame_last); }else{ @@ -141,23 +141,21 @@ const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float /*dt*/, boo } // draw output image - if (draw_output) { - vector<Mat> channels; - if(secondary==0){ - frame_bin.setTo(170, frame_bin); - channels.push_back(frame_gray + frame_bin); - channels.push_back(frame_gray - frame_bin); - channels.push_back(frame_gray - frame_bin); - }else{ - frame_bin_copy.setTo(120, frame_bin_copy); - frame_bin_low.setTo(90, frame_bin_low); - channels.push_back(frame_gray + frame_bin_copy); - channels.push_back(frame_gray + frame_last_and_low); - channels.push_back(frame_gray + frame_bin_low); - //channels.push_back(frame_gray + frame_bin); - } - merge(channels, frame); - } + vector<Mat> channels; + if(secondary==0){ + frame_bin.setTo(170, frame_bin); + channels.push_back(frame_gray + frame_bin); + channels.push_back(frame_gray - frame_bin); + channels.push_back(frame_gray - frame_bin); + }else{ + frame_bin_copy.setTo(120, frame_bin_copy); + frame_bin_low.setTo(90, frame_bin_low); + channels.push_back(frame_gray + frame_bin_copy); + channels.push_back(frame_gray + frame_last_and_low); + channels.push_back(frame_gray + frame_bin_low); + //channels.push_back(frame_gray + frame_bin); + } + merge(channels, frame); return points; } diff --git a/ftnoir_tracker_pt/point_extractor.h b/ftnoir_tracker_pt/point_extractor.h index 8a76747b..21d548af 100644 --- a/ftnoir_tracker_pt/point_extractor.h +++ b/ftnoir_tracker_pt/point_extractor.h @@ -19,7 +19,7 @@ public: // extracts points from frame and draws some processing info into frame, if draw_output is set // dt: time since last call in seconds // WARNING: returned reference is valid as long as object - const std::vector<cv::Vec2f>& extract_points(cv::Mat frame, float dt, bool draw_output); + const std::vector<cv::Vec2f>& extract_points(cv::Mat &frame); const std::vector<cv::Vec2f>& get_points() { return points; } PointExtractor(); diff --git a/ftnoir_tracker_pt/point_tracker.cpp b/ftnoir_tracker_pt/point_tracker.cpp index 5f57baf5..8a633c5d 100644 --- a/ftnoir_tracker_pt/point_tracker.cpp +++ b/ftnoir_tracker_pt/point_tracker.cpp @@ -33,10 +33,14 @@ static void set_row(Matx33f& m, int i, const Vec3f& v) m(i,2) = v[2]; } -// ---------------------------------------------------------------------------- +PointModel::PointModel() : + M01 { 0, 0, 0 }, + M02 { 0, 0, 0 } +{ +} + PointModel::PointModel(Vec3f M01, Vec3f M02) - : M01(M01), - M02(M02) + : M01(M01), M02(M02) { // calculate u u = M01.cross(M02); @@ -107,27 +111,31 @@ void PointTracker::reset() X_CM = FrameTrafo(); } -void PointTracker::track(const vector<Vec2f>& points, float f) +void PointTracker::track(const vector<Vec2f>& projected_points, const PointModel& model) { - find_correspondences(points, f); - (void) POSIT(f); - //qDebug()<<"Number of POSIT iterations: "<<n_iter; + const PointOrder& order = find_correspondences(projected_points, model); + int iters = POSIT(model, order); + qDebug()<<"POSIT iterations:"<<iters; } -void PointTracker::find_correspondences(const std::vector<cv::Vec2f>& points, float f) +PointTracker::PointOrder PointTracker::find_correspondences(const std::vector<cv::Vec2f>& projected_points, const PointModel& model) { // ... otherwise we look at the distance to the projection of the expected model points // project model points under current pose Vec2f p_exp[3]; - p_exp[0] = project(Vec3f(0,0,0), f); - p_exp[1] = project(point_model->M01, f); - p_exp[2] = project(point_model->M02, f); + p_exp[0] = project(Vec3f(0,0,0)); + p_exp[1] = project(model.get_M01()); + p_exp[2] = project(model.get_M02()); // set correspondences by minimum distance to projected model point bool point_taken[PointModel::N_POINTS]; for (int i=0; i<PointModel::N_POINTS; ++i) point_taken[i] = false; + PointOrder p; + for (int i=0; i<PointModel::N_POINTS; ++i) + p.points[i] = Vec2f(0, 0); + for (int i=0; i<PointModel::N_POINTS; ++i) { float min_sdist = 1e4; @@ -135,7 +143,7 @@ void PointTracker::find_correspondences(const std::vector<cv::Vec2f>& points, fl // find closest point to projected model point i for (int j=0; j<PointModel::N_POINTS; ++j) { - Vec2f d = p_exp[i]-points[j]; + Vec2f d = p_exp[i]-projected_points[j]; float sdist = d.dot(d); if (sdist < min_sdist) { @@ -144,15 +152,16 @@ void PointTracker::find_correspondences(const std::vector<cv::Vec2f>& points, fl } } // if one point is closest to more than one model point, abort - if (point_taken[min_idx]) return; + if (point_taken[min_idx]) return p; point_taken[min_idx] = true; - p[i] = points[min_idx]; + p.points[i] = projected_points[min_idx]; } + return p; } -int PointTracker::POSIT(float f) +int PointTracker::POSIT(const PointModel& model, const PointOrder& order_) { // POSIT algorithm for coplanar points as presented in // [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"] @@ -182,24 +191,26 @@ int PointTracker::POSIT(float f) const int MAX_ITER = 100; const float EPS_THRESHOLD = 1e-4; + + const cv::Vec2f* order = order_.points; int i=1; for (; i<MAX_ITER; ++i) { - epsilon_1 = k.dot(point_model->M01)/Z0; - epsilon_2 = k.dot(point_model->M02)/Z0; + epsilon_1 = k.dot(model.M01)/Z0; + epsilon_2 = k.dot(model.M02)/Z0; // vector of scalar products <I0, M0i> and <J0, M0i> - Vec2f I0_M0i(p[1][0]*(1.0 + epsilon_1) - p[0][0], - p[2][0]*(1.0 + epsilon_2) - p[0][0]); - Vec2f J0_M0i(p[1][1]*(1.0 + epsilon_1) - p[0][1], - p[2][1]*(1.0 + epsilon_2) - p[0][1]); + Vec2f I0_M0i(order[1][0]*(1.0 + epsilon_1) - order[0][0], + order[2][0]*(1.0 + epsilon_2) - order[0][0]); + Vec2f J0_M0i(order[1][1]*(1.0 + epsilon_1) - order[0][1], + order[2][1]*(1.0 + epsilon_2) - order[0][1]); // construct projection of I, J onto M0i plane: I0 and J0 - I0_coeff = point_model->P * I0_M0i; - J0_coeff = point_model->P * J0_M0i; - I0 = I0_coeff[0]*point_model->M01 + I0_coeff[1]*point_model->M02; - J0 = J0_coeff[0]*point_model->M01 + J0_coeff[1]*point_model->M02; + I0_coeff = model.P * I0_M0i; + J0_coeff = model.P * J0_M0i; + I0 = I0_coeff[0]*model.M01 + I0_coeff[1]*model.M02; + J0 = J0_coeff[0]*model.M01 + J0_coeff[1]*model.M02; // calculate u component of I, J float II0 = I0.dot(I0); @@ -219,11 +230,11 @@ int PointTracker::POSIT(float f) } // construct the two solutions - I_1 = I0 + rho*cos(theta)*point_model->u; - I_2 = I0 - rho*cos(theta)*point_model->u; + I_1 = I0 + rho*cos(theta)*model.u; + I_2 = I0 - rho*cos(theta)*model.u; - J_1 = J0 + rho*sin(theta)*point_model->u; - J_2 = J0 - rho*sin(theta)*point_model->u; + J_1 = J0 + rho*sin(theta)*model.u; + J_2 = J0 - rho*sin(theta)*model.u; float norm_const = 1.0/norm(I_1); // all have the same norm @@ -240,7 +251,7 @@ int PointTracker::POSIT(float f) set_row(R_2, 2, I_2.cross(J_2)); // the single translation solution - Z0 = norm_const * f; + Z0 = norm_const * focal_length; // pick the rotation solution closer to the expected one // in simple metric d(A,B) = || I - A * B^T || @@ -263,8 +274,8 @@ int PointTracker::POSIT(float f) // apply results X_CM.R = *R_current; - X_CM.t[0] = p[0][0] * Z0/f; - X_CM.t[1] = p[0][1] * Z0/f; + X_CM.t[0] = order[0][0] * Z0/focal_length; + X_CM.t[1] = order[0][1] * Z0/focal_length; X_CM.t[2] = Z0; return i; diff --git a/ftnoir_tracker_pt/point_tracker.h b/ftnoir_tracker_pt/point_tracker.h index a1f6f041..0339f392 100644 --- a/ftnoir_tracker_pt/point_tracker.h +++ b/ftnoir_tracker_pt/point_tracker.h @@ -14,7 +14,7 @@ #else # include <memory> #endif -#include <list> +#include <vector> // ---------------------------------------------------------------------------- // Affine frame trafo @@ -60,9 +60,10 @@ public: static constexpr int N_POINTS = 3; PointModel(cv::Vec3f M01, cv::Vec3f M02); + PointModel(); - const cv::Vec3f& get_M01() const { return M01; } - const cv::Vec3f& get_M02() const { return M02; } + inline const cv::Vec3f& get_M01() const { return M01; } + inline const cv::Vec3f& get_M02() const { return M02; } private: cv::Vec3f M01; // M01 in model frame @@ -86,27 +87,27 @@ class PointTracker { public: PointTracker(); - // track the pose using the set of normalized point coordinates (x pos in range -0.5:0.5) // f : (focal length)/(sensor width) // dt : time since last call - void track(const std::vector<cv::Vec2f>& points, float f); - std::shared_ptr<PointModel> point_model; - + void track(const std::vector<cv::Vec2f>& projected_points, const PointModel& model); FrameTrafo get_pose() const { return X_CM; } void reset(); private: - inline cv::Vec2f project(const cv::Vec3f& v_M, float f) + // the points in model order + typedef struct { cv::Vec2f points[PointModel::N_POINTS]; } PointOrder; + static constexpr float focal_length = 1.0f; + + inline cv::Vec2f project(const cv::Vec3f& v_M) { cv::Vec3f v_C = X_CM * v_M; - return cv::Vec2f(f*v_C[0]/v_C[2], f*v_C[1]/v_C[2]); + return cv::Vec2f(focal_length*v_C[0]/v_C[2], focal_length*v_C[1]/v_C[2]); } - void find_correspondences(const std::vector<cv::Vec2f>& points, float f); - int POSIT(float f); // The POSIT algorithm, returns the number of iterations + PointOrder find_correspondences(const std::vector<cv::Vec2f>& projected_points, const PointModel &model); + int POSIT(const PointModel& point_model, const PointOrder& order); // The POSIT algorithm, returns the number of iterations - cv::Vec2f p[PointModel::N_POINTS]; // the points in model order FrameTrafo X_CM; // trafo from model to camera }; diff --git a/ftnoir_tracker_pt/pt_video_widget.cpp b/ftnoir_tracker_pt/pt_video_widget.cpp index cb3dc48e..aefb8199 100644 --- a/ftnoir_tracker_pt/pt_video_widget.cpp +++ b/ftnoir_tracker_pt/pt_video_widget.cpp @@ -22,24 +22,6 @@ void PTVideoWidget::update_image(const cv::Mat& frame) freshp = true; } -// ---------------------------------------------------------------------------- -VideoWidgetDialog::VideoWidgetDialog(QWidget *parent, FrameProvider* provider) - : QDialog(parent), - video_widget(NULL) -{ - const int VIDEO_FRAME_WIDTH = 640; - const int VIDEO_FRAME_HEIGHT = 480; - - video_widget = new PTVideoWidget(this, provider); - - QHBoxLayout* layout = new QHBoxLayout(); - layout->setContentsMargins(0, 0, 0, 0); - layout->addWidget(video_widget); - if (this->layout()) delete this->layout(); - setLayout(layout); - resize(VIDEO_FRAME_WIDTH, VIDEO_FRAME_HEIGHT); -} - void PTVideoWidget::update_and_repaint() { QMutexLocker foo(&mtx); diff --git a/ftnoir_tracker_pt/pt_video_widget.h b/ftnoir_tracker_pt/pt_video_widget.h index 1be5f5f2..de2c7efb 100644 --- a/ftnoir_tracker_pt/pt_video_widget.h +++ b/ftnoir_tracker_pt/pt_video_widget.h @@ -7,7 +7,6 @@ #pragma once -#include "frame_observer.h" #include <QObject> #include <QTime> #include <QDialog> @@ -24,15 +23,16 @@ #include <QPainter> #include <QPaintEvent> #include <QTimer> +#include <QMutex> +#include <QMutexLocker> -class PTVideoWidget : public QWidget, public FrameObserver +class PTVideoWidget : public QWidget { Q_OBJECT public: - PTVideoWidget(QWidget *parent, FrameProvider* provider) : + PTVideoWidget(QWidget *parent) : QWidget(parent), - /* to avoid linker errors */ FrameObserver(provider), freshp(false) { connect(&timer, SIGNAL(timeout()), this, SLOT(update_and_repaint())); @@ -52,20 +52,5 @@ private: QImage texture; QTimer timer; cv::Mat _frame; - bool freshp; -}; - -// ---------------------------------------------------------------------------- -// A VideoWidget embedded in a dialog frame -class VideoWidgetDialog : public QDialog -{ - Q_OBJECT -public: - VideoWidgetDialog(QWidget *parent, FrameProvider* provider); - virtual ~VideoWidgetDialog() {} - - PTVideoWidget* get_video_widget() { return video_widget; } - -private: - PTVideoWidget* video_widget; + volatile bool freshp; }; -- cgit v1.2.3 From d67dc3326169a2f71f024c5fd45fdb6ab07d5376 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 02:21:35 +0200 Subject: fix gitattributes --- .gitattributes | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index fcadb2cf..5f7a58f5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,8 @@ -* text eol=lf +*.cpp text=auto eol=lf +*.hpp text=auto eol=lf +*.c text=auto eol=lf +*.h text=auto eol=lf +*.cxx text=auto eol=lf +*.txt text=auto eol=lf +*.ui text=auto eol=lf +*.qrc text=auto eol=lf -- cgit v1.2.3 From 1f2e498d8e7ceeb5594696819ccebb4383845022 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 19:42:19 +0200 Subject: fix comment Likely as per <http://www.purplemath.com/modules/determs.htm> meant det --- ftnoir_tracker_pt/point_tracker.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftnoir_tracker_pt/point_tracker.h b/ftnoir_tracker_pt/point_tracker.h index 0339f392..c8212538 100644 --- a/ftnoir_tracker_pt/point_tracker.h +++ b/ftnoir_tracker_pt/point_tracker.h @@ -73,7 +73,7 @@ private: cv::Matx22f P; - cv::Vec2f d; // discriminant vector for point correspondence + cv::Vec2f d; // determinant vector for point correspondence int d_order[3]; // sorting of projected model points with respect to d scalar product void get_d_order(const std::vector<cv::Vec2f>& points, int d_order[]) const; -- cgit v1.2.3 From 967b9c8ccd9912c6752013f02c997c768a3ed90d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 19:44:07 +0200 Subject: remove dead cache var --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 79bb2b1b..7ae2c6d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,7 +86,6 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/ftnoir_posewidget) set(SDK_ARUCO_LIBPATH "" CACHE FILEPATH "Path to Aruco static library") -SET(SDK_OPENCV_STATIC FALSE CACHE BOOL "Whether OpenCV is statically linked") if(WIN32) set(SDK_SIMCONNECT "" CACHE PATH "Path to SimConnect SDK") set(SDK_FSUIPC "" CACHE PATH "Path to FSUIPC") -- cgit v1.2.3 From 25c431af2607923eebaa8f6b6c8f4754594f1254 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 19:44:26 +0200 Subject: qt macro nonsense --- ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 1136ad4a..e64c4ca7 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -58,7 +58,7 @@ void Tracker::run() QTextStream log_stream(&log_file); #endif time.start(); - forever + while(1) { if (commands & ABORT) break; commands = 0; -- cgit v1.2.3 From 7c0bcbc7d4f8da28450e0b57a9e52fd50a212d4f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 20:32:39 +0200 Subject: no need for pragma here Revert part of ae8f78bf5e9096b44e700b1b2e1e4edc03a0b93d --- x-plane-plugin/plugin.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/x-plane-plugin/plugin.c b/x-plane-plugin/plugin.c index b91151c1..62c9d6f0 100644 --- a/x-plane-plugin/plugin.c +++ b/x-plane-plugin/plugin.c @@ -52,8 +52,6 @@ static void reinit_offset() { # define OT_UNUSED(varname) varname #endif -#pragma GCC diagnostic ignored "-Wunused-result" - PortableLockedShm* PortableLockedShm_init(const char *shmName, const char *OT_UNUSED(mutexName), int mapSize) { PortableLockedShm* self = malloc(sizeof(PortableLockedShm)); -- cgit v1.2.3 From 9b3c04d1187ceeb83e7e1eead0714fd4578d07d7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 20:56:57 +0200 Subject: initialize first union member (clang warning) --- ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp index 39b1f4a2..ea44133c 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp @@ -41,7 +41,7 @@ void TrackerImpl::run() { while (sock.hasPendingDatagrams()) { - data = decltype(data){0,0, 0,0,0}; + data = decltype(data){0,0, {0,0,0, 0,0,0}}; int sz = sock.readDatagram(reinterpret_cast<char*>(&data), sizeof(data)); int flags = data.flags & F::Mask; -- cgit v1.2.3 From fadd2f3475aed347d2a06a08cc9c2e7fe53fbba9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 15:25:19 +0200 Subject: fix Wine bitrot rather than only saying so name mangling has issues so partial revert --- .../opentrack-wrapper-wine-main.cxx | 75 ++++++++++++++-------- .../opentrack-wrapper-wine-posix.cxx | 12 ++-- .../opentrack-wrapper-wine-windows.cxx | 5 -- 3 files changed, 54 insertions(+), 38 deletions(-) diff --git a/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx b/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx index fe5a95f9..40f36f8d 100644 --- a/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx +++ b/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx @@ -10,33 +10,57 @@ #include "compat/compat.h" void create_registry_key(void); -ptr<BasePortableLockedShm> make_shm_posix(); -ptr<BasePortableLockedShm> make_shm_win32(); + +class ShmPosix { +public: + ShmPosix(const char *shmName, const char *mutexName, int mapSize); + ~ShmPosix(); + void lock(); + void unlock(); + bool success(); + inline void* ptr() { return mem; } +private: + void* mem; + int fd, size; +}; + +class ShmWine { +public: + ShmWine(const char *shmName, const char *mutexName, int mapSize); + ~ShmWine(); + void lock(); + void unlock(); + bool success(); + inline void* ptr() { return mem; } +private: + void* mem; + void *hMutex, *hMapFile; +}; +#include <windows.h> int main(void) { - ptr<BasePortableLockedShm> lck_posix = make_shm_posix(); - ptr<BasePortableLockedShm> lck_wine = make_shm_win32(); - if(!lck_posix->success()) { - printf("Can't open posix map: %d\n", errno); - return 1; - } - if(!lck_wine->success()) { - printf("Can't open Wine map\n"); - return 1; - } - WineSHM* shm_posix = (WineSHM*) lck_posix->ptr(); - FTHeap* shm_wine = (FTHeap*) lck_wine->ptr(); + ShmPosix lck_posix(WINE_SHM_NAME, WINE_MTX_NAME, sizeof(WineSHM)); + ShmWine lck_wine("FT_SharedMem", "FT_Mutext", sizeof(FTHeap)); + if(!lck_posix.success()) { + printf("Can't open posix map: %d\n", errno); + return 1; + } + if(!lck_wine.success()) { + printf("Can't open Wine map\n"); + return 1; + } + WineSHM* shm_posix = (WineSHM*) lck_posix.ptr(); + FTHeap* shm_wine = (FTHeap*) lck_wine.ptr(); FTData* data = &shm_wine->data; create_registry_key(); - while (1) { - (void) Sleep(4); - lck_posix->lock(); - if (shm_posix->stop) { - lck_posix->unlock(); - break; - } - lck_wine->lock(); + while (1) { + lck_posix.lock(); + if (shm_posix->stop) { + lck_posix.unlock(); + break; + } + lck_wine.lock(); data->Yaw = shm_posix->data[Yaw]; data->Pitch = shm_posix->data[Pitch]; data->Roll = shm_posix->data[Roll]; @@ -50,7 +74,8 @@ int main(void) shm_posix->gameid = shm_wine->GameID; for (int i = 0; i < 8; i++) shm_wine->table[i] = shm_posix->table[i]; - lck_wine->unlock(); - lck_posix->unlock(); - } + lck_wine.unlock(); + lck_posix.unlock(); + (void) Sleep(4); + } } diff --git a/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx b/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx index ea01ff03..010c4440 100644 --- a/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx +++ b/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx @@ -1,12 +1,8 @@ #define OPENTRACK_COMPAT_BUNDLED +#ifdef _WIN32 +# undef _WIN32 +#endif + #define PortableLockedShm ShmPosix -#undef _WIN32 -#include "ftnoir_protocol_ft/fttypes.h" -#include "wine-shm.h" #include "compat/compat.h" #include "compat/compat.cpp" - -ptr<BasePortableLockedShm> make_shm_posix() -{ - return std::make_shared<ShmPosix>(FREETRACK_HEAP, FREETRACK_MUTEX, sizeof(FTHeap)); -} diff --git a/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx b/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx index 715dcc69..b7dc531c 100644 --- a/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx +++ b/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx @@ -8,11 +8,6 @@ #include "compat/compat.cpp" #include "wine-shm.h" -ptr<BasePortableLockedShm> make_shm_win32() -{ - return std::make_shared<ShmWine>(WINE_SHM_NAME, WINE_MTX_NAME, sizeof(WineSHM)); -} - void create_registry_key(void) { char dir[8192]; -- cgit v1.2.3 From 0d80cd4a9c77b2ecbb515fb9d20c78f400c40851 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 23:13:17 +0200 Subject: nix needless include --- ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp index 42de16c1..b7d078c2 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp @@ -1,7 +1,6 @@ /* Copyright: "i couldn't care less what anyone does with the 5 lines of code i wrote" - mm0zct */ #include "ftnoir_tracker_hydra.h" #include "facetracknoir/plugin-support.h" -#include "facetracknoir/rotation.h" #include <cstdio> #ifdef _WIN32 # define SIXENSE_STATIC_LIB -- cgit v1.2.3 From ea1c5f78af31c91521fac2a1f170eb668074f751 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 23:13:34 +0200 Subject: unbreak hopefully --- x-plane-plugin/plugin.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/x-plane-plugin/plugin.c b/x-plane-plugin/plugin.c index 62c9d6f0..3958c895 100644 --- a/x-plane-plugin/plugin.c +++ b/x-plane-plugin/plugin.c @@ -13,8 +13,6 @@ #include <XPLMCamera.h> #include <XPLMProcessing.h> -#include "ftnoir_tracker_base/ftnoir_tracker_types.h" - #ifndef PLUGIN_API #define PLUGIN_API #endif @@ -23,6 +21,10 @@ #define WINE_SHM_NAME "facetracknoir-wine-shm" #define WINE_MTX_NAME "facetracknoir-wine-mtx" +enum Axis { + TX = 0, TY, TZ, Yaw, Pitch, Roll +}; + typedef struct PortableLockedShm { void* mem; int fd, size; -- cgit v1.2.3 From 6c7f296a3dd11be3612af0e172280712ba8028a8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 23:30:36 +0200 Subject: fix dos2unix fiasco --- ftnoir_tracker_pt/Resources/Logo_IR.png | Bin 10385 -> 10386 bytes ftnoir_tracker_pt/Resources/cap_front.png | Bin 1163 -> 1164 bytes ftnoir_tracker_pt/Resources/cap_side.png | Bin 1732 -> 1733 bytes ftnoir_tracker_pt/Resources/clip_front.png | Bin 570 -> 571 bytes ftnoir_tracker_pt/Resources/clip_side.png | Bin 2676 -> 2677 bytes ftnoir_tracker_pt/doc/logo.png | Bin 10385 -> 10386 bytes ftnoir_tracker_pt/doc/settings1.png | Bin 25012 -> 25013 bytes ftnoir_tracker_pt/doc/settings2.png | Bin 26840 -> 26841 bytes ftnoir_tracker_pt/doc/settings3.png | Bin 29546 -> 29547 bytes 9 files changed, 0 insertions(+), 0 deletions(-) diff --git a/ftnoir_tracker_pt/Resources/Logo_IR.png b/ftnoir_tracker_pt/Resources/Logo_IR.png index 85590691..95032a25 100644 Binary files a/ftnoir_tracker_pt/Resources/Logo_IR.png and b/ftnoir_tracker_pt/Resources/Logo_IR.png differ diff --git a/ftnoir_tracker_pt/Resources/cap_front.png b/ftnoir_tracker_pt/Resources/cap_front.png index cbee28c9..14207a67 100644 Binary files a/ftnoir_tracker_pt/Resources/cap_front.png and b/ftnoir_tracker_pt/Resources/cap_front.png differ diff --git a/ftnoir_tracker_pt/Resources/cap_side.png b/ftnoir_tracker_pt/Resources/cap_side.png index 27c28341..5ad4ee65 100644 Binary files a/ftnoir_tracker_pt/Resources/cap_side.png and b/ftnoir_tracker_pt/Resources/cap_side.png differ diff --git a/ftnoir_tracker_pt/Resources/clip_front.png b/ftnoir_tracker_pt/Resources/clip_front.png index 63fd70eb..04880138 100644 Binary files a/ftnoir_tracker_pt/Resources/clip_front.png and b/ftnoir_tracker_pt/Resources/clip_front.png differ diff --git a/ftnoir_tracker_pt/Resources/clip_side.png b/ftnoir_tracker_pt/Resources/clip_side.png index 1c295506..72667ac7 100644 Binary files a/ftnoir_tracker_pt/Resources/clip_side.png and b/ftnoir_tracker_pt/Resources/clip_side.png differ diff --git a/ftnoir_tracker_pt/doc/logo.png b/ftnoir_tracker_pt/doc/logo.png index 85590691..95032a25 100644 Binary files a/ftnoir_tracker_pt/doc/logo.png and b/ftnoir_tracker_pt/doc/logo.png differ diff --git a/ftnoir_tracker_pt/doc/settings1.png b/ftnoir_tracker_pt/doc/settings1.png index 0725f5f4..35b84c5c 100644 Binary files a/ftnoir_tracker_pt/doc/settings1.png and b/ftnoir_tracker_pt/doc/settings1.png differ diff --git a/ftnoir_tracker_pt/doc/settings2.png b/ftnoir_tracker_pt/doc/settings2.png index 382ed13a..c6cfd1f3 100644 Binary files a/ftnoir_tracker_pt/doc/settings2.png and b/ftnoir_tracker_pt/doc/settings2.png differ diff --git a/ftnoir_tracker_pt/doc/settings3.png b/ftnoir_tracker_pt/doc/settings3.png index 821453d1..5922403d 100644 Binary files a/ftnoir_tracker_pt/doc/settings3.png and b/ftnoir_tracker_pt/doc/settings3.png differ -- cgit v1.2.3 From e41e19fb072caf7598f18b5244b4d32c10eed161 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 24 Sep 2014 17:54:28 +0200 Subject: timer: convert to ms on demand --- facetracknoir/timer.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/facetracknoir/timer.hpp b/facetracknoir/timer.hpp index d2df1efd..8eb6b943 100644 --- a/facetracknoir/timer.hpp +++ b/facetracknoir/timer.hpp @@ -62,4 +62,7 @@ public: (void) clock_gettime(CLOCK_MONOTONIC, &cur); return conv(cur); } + long elapsed_ms() { + return elapsed() / 1000000L; + } }; -- cgit v1.2.3 From d1b51c8c818e3b5745d926976799842a714a6e30 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 24 Sep 2014 17:54:53 +0200 Subject: core: fix timer units --- facetracknoir/tracker.cpp | 384 +++++++++++++++++++++++----------------------- 1 file changed, 192 insertions(+), 192 deletions(-) diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 90e9bdad..6d5a7ec9 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -1,192 +1,192 @@ -/* Copyright (c) 2012-2013 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. - */ - -/* - * this file appeared originally in facetracknoir, was rewritten completely - * following opentrack fork. - * - * originally written by Wim Vriend. - */ - -#include "tracker.h" -#include "facetracknoir.h" -#include <opencv2/core/core.hpp> -#include <cmath> -#include <algorithm> - -#if defined(_WIN32) -# include <windows.h> -#endif - -Tracker::Tracker(FaceTrackNoIR *parent , main_settings& s) : - mainApp(parent), - s(s), - should_quit(false), - do_center(false), - enabled(true) -{ -} - -Tracker::~Tracker() -{ - should_quit = true; - wait(); -} - -static void get_curve(double pos, double& out, THeadPoseDOF& axis) { - bool altp = (pos < 0) && axis.opts.altp; - axis.curve.setTrackingActive( !altp ); - axis.curveAlt.setTrackingActive( altp ); - auto& fc = altp ? axis.curveAlt : axis.curve; - out = (axis.opts.invert ? -1 : 1) * fc.getValue(pos); - - out += axis.opts.zero; -} - -static void t_compensate(double* input, double* output, bool rz) -{ - const auto H = input[Yaw] * M_PI / -180; - const auto P = input[Pitch] * M_PI / -180; - const auto B = input[Roll] * M_PI / 180; - - const auto cosH = cos(H); - const auto sinH = sin(H); - const auto cosP = cos(P); - const auto sinP = sin(P); - const auto cosB = cos(B); - const auto sinB = sin(B); - - double foo[] = { - cosH * cosB - sinH * sinP * sinB, - - sinB * cosP, - sinH * cosB + cosH * sinP * sinB, - cosH * sinB + sinH * sinP * cosB, - cosB * cosP, - sinB * sinH - cosH * sinP * cosB, - - sinH * cosP, - - sinP, - cosH * cosP, - }; - - cv::Mat rmat(3, 3, CV_64F, foo); - const cv::Mat tvec(3, 1, CV_64F, input); - cv::Mat ret = rmat * tvec; - - const int max = !rz ? 3 : 2; - - for (int i = 0; i < max; i++) - output[i] = ret.at<double>(i); -} - -void Tracker::run() { - T6DOF offset_camera; - - double newpose[6] = {0}; - int sleep_ms = 15; - - if (Libraries->pTracker) - sleep_ms = std::min(sleep_ms, 1000 / Libraries->pTracker->preferredHz()); - - qDebug() << "tracker Hz:" << 1000 / sleep_ms; - -#if defined(_WIN32) - (void) timeBeginPeriod(1); -#endif - - for (;;) - { - t.start(); - - if (should_quit) - break; - - if (Libraries->pTracker) { - Libraries->pTracker->GetHeadPoseData(newpose); - } - - { - QMutexLocker foo(&mtx); - - for (int i = 0; i < 6; i++) - { - raw_6dof.axes[i] = newpose[i]; - - auto& axis = mainApp->axis(i); - - int k = axis.opts.src; - if (k < 0 || k >= 6) - continue; - - axis.headPos = newpose[k]; - } - - if (do_center) { - for (int i = 0; i < 6; i++) - offset_camera.axes[i] = mainApp->axis(i).headPos; - - do_center = false; - - if (Libraries->pFilter) - Libraries->pFilter->reset(); - } - - T6DOF target_camera, target_camera2, new_camera; - - if (enabled) - { - for (int i = 0; i < 6; i++) - target_camera.axes[i] = mainApp->axis(i).headPos; - - target_camera2 = target_camera - offset_camera; - } - - if (Libraries->pFilter) { - Libraries->pFilter->FilterHeadPoseData(target_camera2.axes, new_camera.axes); - } else { - new_camera = target_camera2; - } - - for (int i = 0; i < 6; i++) { - get_curve(new_camera.axes[i], output_camera.axes[i], mainApp->axis(i)); - } - - if (mainApp->s.tcomp_p) - t_compensate(output_camera.axes, output_camera.axes, mainApp->s.tcomp_tz); - - if (Libraries->pProtocol) { - Libraries->pProtocol->sendHeadposeToGame( output_camera.axes ); - } - } - - const long q = std::max(0L, sleep_ms * 1000L - std::max(0L, t.elapsed())); - - usleep(q); - } -#if defined(_WIN32) - (void) timeEndPeriod(1); -#endif - - for (int i = 0; i < 6; i++) - { - mainApp->axis(i).curve.setTrackingActive(false); - mainApp->axis(i).curveAlt.setTrackingActive(false); - } -} - -void Tracker::getHeadPose( double *data ) { - QMutexLocker foo(&mtx); - for (int i = 0; i < 6; i++) - { - data[i] = raw_6dof.axes[i]; - } -} - -void Tracker::getOutputHeadPose( double *data ) { - QMutexLocker foo(&mtx); - for (int i = 0; i < 6; i++) - data[i] = output_camera.axes[i]; -} +/* Copyright (c) 2012-2013 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. + */ + +/* + * this file appeared originally in facetracknoir, was rewritten completely + * following opentrack fork. + * + * originally written by Wim Vriend. + */ + +#include "tracker.h" +#include "facetracknoir.h" +#include <opencv2/core/core.hpp> +#include <cmath> +#include <algorithm> + +#if defined(_WIN32) +# include <windows.h> +#endif + +Tracker::Tracker(FaceTrackNoIR *parent , main_settings& s) : + mainApp(parent), + s(s), + should_quit(false), + do_center(false), + enabled(true) +{ +} + +Tracker::~Tracker() +{ + should_quit = true; + wait(); +} + +static void get_curve(double pos, double& out, THeadPoseDOF& axis) { + bool altp = (pos < 0) && axis.opts.altp; + axis.curve.setTrackingActive( !altp ); + axis.curveAlt.setTrackingActive( altp ); + auto& fc = altp ? axis.curveAlt : axis.curve; + out = (axis.opts.invert ? -1 : 1) * fc.getValue(pos); + + out += axis.opts.zero; +} + +static void t_compensate(double* input, double* output, bool rz) +{ + const auto H = input[Yaw] * M_PI / -180; + const auto P = input[Pitch] * M_PI / -180; + const auto B = input[Roll] * M_PI / 180; + + const auto cosH = cos(H); + const auto sinH = sin(H); + const auto cosP = cos(P); + const auto sinP = sin(P); + const auto cosB = cos(B); + const auto sinB = sin(B); + + double foo[] = { + cosH * cosB - sinH * sinP * sinB, + - sinB * cosP, + sinH * cosB + cosH * sinP * sinB, + cosH * sinB + sinH * sinP * cosB, + cosB * cosP, + sinB * sinH - cosH * sinP * cosB, + - sinH * cosP, + - sinP, + cosH * cosP, + }; + + cv::Mat rmat(3, 3, CV_64F, foo); + const cv::Mat tvec(3, 1, CV_64F, input); + cv::Mat ret = rmat * tvec; + + const int max = !rz ? 3 : 2; + + for (int i = 0; i < max; i++) + output[i] = ret.at<double>(i); +} + +void Tracker::run() { + T6DOF offset_camera; + + double newpose[6] = {0}; + int sleep_ms = 15; + + if (Libraries->pTracker) + sleep_ms = std::min(sleep_ms, 1000 / Libraries->pTracker->preferredHz()); + + qDebug() << "tracker Hz:" << 1000 / sleep_ms; + +#if defined(_WIN32) + (void) timeBeginPeriod(1); +#endif + + for (;;) + { + t.start(); + + if (should_quit) + break; + + if (Libraries->pTracker) { + Libraries->pTracker->GetHeadPoseData(newpose); + } + + { + QMutexLocker foo(&mtx); + + for (int i = 0; i < 6; i++) + { + raw_6dof.axes[i] = newpose[i]; + + auto& axis = mainApp->axis(i); + + int k = axis.opts.src; + if (k < 0 || k >= 6) + continue; + + axis.headPos = newpose[k]; + } + + if (do_center) { + for (int i = 0; i < 6; i++) + offset_camera.axes[i] = mainApp->axis(i).headPos; + + do_center = false; + + if (Libraries->pFilter) + Libraries->pFilter->reset(); + } + + T6DOF target_camera, target_camera2, new_camera; + + if (enabled) + { + for (int i = 0; i < 6; i++) + target_camera.axes[i] = mainApp->axis(i).headPos; + + target_camera2 = target_camera - offset_camera; + } + + if (Libraries->pFilter) { + Libraries->pFilter->FilterHeadPoseData(target_camera2.axes, new_camera.axes); + } else { + new_camera = target_camera2; + } + + for (int i = 0; i < 6; i++) { + get_curve(new_camera.axes[i], output_camera.axes[i], mainApp->axis(i)); + } + + if (mainApp->s.tcomp_p) + t_compensate(output_camera.axes, output_camera.axes, mainApp->s.tcomp_tz); + + if (Libraries->pProtocol) { + Libraries->pProtocol->sendHeadposeToGame( output_camera.axes ); + } + } + + const long q = std::max(0L, sleep_ms * 1000000L - std::max(0L, t.elapsed())); + + usleep(q); + } +#if defined(_WIN32) + (void) timeEndPeriod(1); +#endif + + for (int i = 0; i < 6; i++) + { + mainApp->axis(i).curve.setTrackingActive(false); + mainApp->axis(i).curveAlt.setTrackingActive(false); + } +} + +void Tracker::getHeadPose( double *data ) { + QMutexLocker foo(&mtx); + for (int i = 0; i < 6; i++) + { + data[i] = raw_6dof.axes[i]; + } +} + +void Tracker::getOutputHeadPose( double *data ) { + QMutexLocker foo(&mtx); + for (int i = 0; i < 6; i++) + data[i] = output_camera.axes[i]; +} -- cgit v1.2.3 From d5cf8540bf5d04fdcdce543b3cf0dc531dfd464f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 24 Sep 2014 17:55:05 +0200 Subject: half gain logic done --- facetracknoir/gain-control.hpp | 175 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 facetracknoir/gain-control.hpp diff --git a/facetracknoir/gain-control.hpp b/facetracknoir/gain-control.hpp new file mode 100644 index 00000000..28887700 --- /dev/null +++ b/facetracknoir/gain-control.hpp @@ -0,0 +1,175 @@ +#pragma once + +#include <algorithm> +#undef NDEBUG +#include <cassert> +#include <iterator> +#include <tuple> +#include <deque> +#include <vector> + +#include "timer.hpp" + +#include <opencv2/core/core.hpp> +#include <opencv2/highgui/highgui.hpp> +#include <opencv2/imgproc/imgproc.hpp> + +#include <QDebug> + +namespace detail { + template<typename t1, typename t2, typename t, typename m = t> + class zip_iterator : public std::iterator<std::forward_iterator_tag, t> + { + private: + using self = zip_iterator<t1, t2, t, m>; + t1 x1, z1; + t2 x2, z2; + void maybe_end() { if (x1 == z1 || x2 == z2) *this = end(); } + public: + zip_iterator(const t1& it1, const t1& end1, const t2& it2, const t2& end2) + : x1(it1), z1(end1), x2(it2), z2(end2) { maybe_end(); } + constexpr zip_iterator() {} + + static constexpr self end() { return self(); } + + self operator++() { x1++; x2++; self tmp = *this; maybe_end(); return tmp; } + self operator++(int) { self tmp(*this); x1++; x2++; maybe_end(); return tmp; } + bool operator==(const self& rhs) const { return x1 == rhs.x1 && x2 == rhs.x2; } + bool operator!=(const self& rhs) const { return !this->operator ==(rhs); } + t operator*() { return m(*x1, *x2); } + }; +} + +class Gain { +private: + static constexpr bool use_box_filter = true; + static constexpr int box_size = 20 / 640.; + static constexpr double control_upper_bound = 1.0; // XXX FIXME implement for logitech crapola + static constexpr int GAIN_HISTORY_COUNT = 15, GAIN_HISTORY_EVERY_MS = 200; + + int control; + double step, eps; + + std::deque<double> means_history; + + Timer debug_timer, history_timer; + + typedef unsigned char px; + template<typename t1, typename t2, typename t, typename m = t> + using zip_iterator = detail::zip_iterator<t1, t2, t, m>; + + static double mean(const cv::Mat& frame) + { + // grayscale only + assert(frame.channels() == 1); + assert(frame.elemSize() == 1); + assert(!frame.empty()); + + return std::accumulate(frame.begin<px>(), frame.end<px>(), 0.) / (frame.rows * frame.cols); + } + + static double get_variance(const cv::Mat& frame, double mean) + { + struct variance { + private: + double mu; + public: + variance(double mu) : mu(mu) {} + double operator()(double seed, px p) + { + double tmp = p - mu; + return seed + tmp * tmp; + } + } logic(mean); + + return std::accumulate(frame.begin<unsigned char>(), frame.end<unsigned char>(), 0., logic) / (frame.rows * frame.cols); + } + + static double get_covariance(const cv::Mat& frame, double mean, double prev_mean) + { + struct covariance { + public: + using pair = std::tuple<px, px>; + private: + double mu_0, mu_1; + + inline double Cov(double seed, const pair& t) + { + px p0 = std::get<0>(t); + px p1 = std::get<1>(t); + return seed + (p0 - mu_0) * (p1 - mu_1); + } + public: + covariance(double mu_0, double mu_1) : mu_0(mu_0), mu_1(mu_1) {} + + double operator()(double seed, const pair& t) + { + return Cov(seed, t); + } + } logic(mean, prev_mean); + + const double N = frame.rows * frame.cols; + + using zipper = zip_iterator<cv::MatConstIterator_<px>, + cv::MatConstIterator_<px>, + std::tuple<px, px>>; + + zipper zip(frame.begin<px>(), + frame.end<px>(), + frame.begin<px>(), + frame.end<px>()); + std::vector<covariance::pair> values(zip, zipper::end()); + + return std::accumulate(values.begin(), values.end(), 0., logic) / N; + } + +#pragma GCC diagnostic ignored "-Wsign-compare" + +public: + Gain(int control = CV_CAP_PROP_GAIN, double step = 0.3, double eps = 0.02) : + control(control), step(step), eps(eps) + { + } + + void tick(cv::VideoCapture&, const cv::Mat& frame_) + { + cv::Mat frame; + + if (use_box_filter) + { + cv::Mat tmp(frame_); + static constexpr int min_box = 3; + static constexpr int box = 2 * box_size; + cv::blur(frame_, tmp, cv::Size(min_box + box * frame_.cols, min_box + box * frame_.rows)); + frame = tmp; + } + else + frame = frame_; + + const double mu = mean(frame); + const double var = get_variance(frame, mu); + + if (debug_timer.elapsed_ms() > 500) + { + debug_timer.start(); + qDebug() << "gain:" << "mean" << mu << "variance" << var; + } + + const int sz = means_history.size(); + + for (int i = 0; i < sz; i++) + { + const double cov = get_covariance(frame, mu, means_history[i]); + + qDebug() << "cov" << i << cov; + } + + if (GAIN_HISTORY_COUNT > means_history.size() && history_timer.elapsed_ms() > GAIN_HISTORY_EVERY_MS) + { + means_history.push_front(mu); + + if (GAIN_HISTORY_COUNT == means_history.size()) + means_history.pop_back(); + } + } +}; -- cgit v1.2.3 From 8f12f50a6b06e6c1104efcee37c2f29087dbd3da Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 24 Sep 2014 17:55:27 +0200 Subject: use gain class already for debugging sake --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 ++ ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 97830c9a..e216d319 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -214,6 +214,8 @@ void Tracker::run() grayscale = channel[2]; } else cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); + + gain.tick(camera, grayscale); const int scale = frame.cols > 480 ? 2 : 1; detector.setThresholdParams(scale > 1 ? 11 : 7, 4); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 81332a26..5416bb52 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -21,6 +21,9 @@ #include "facetracknoir/options.h" #include "ftnoir_tracker_aruco/trans_calib.h" #include "facetracknoir/plugin-api.hpp" + +#include "facetracknoir/gain-control.hpp" + using namespace options; struct settings { @@ -65,9 +68,9 @@ private: cv::VideoCapture camera; cv::Matx33f r; cv::Vec3f t; + Gain gain; }; -// Widget that has controls for FTNoIR protocol client-settings. class TrackerControls : public QWidget, public ITrackerDialog { Q_OBJECT -- cgit v1.2.3 From 749b04f00d58974bb1afe4d271f8b1216519cd92 Mon Sep 17 00:00:00 2001 From: Andrew <KyokushinPL@users.noreply.github.com> Date: Wed, 24 Sep 2014 19:23:04 +0200 Subject: New UI --- facetracknoir/facetracknoir.ui | 442 +++++++++++++++++++++++++---------------- 1 file changed, 275 insertions(+), 167 deletions(-) diff --git a/facetracknoir/facetracknoir.ui b/facetracknoir/facetracknoir.ui index 481260d3..215b9b55 100644 --- a/facetracknoir/facetracknoir.ui +++ b/facetracknoir/facetracknoir.ui @@ -7,8 +7,8 @@ <rect> <x>0</x> <y>0</y> - <width>879</width> - <height>422</height> + <width>597</width> + <height>506</height> </rect> </property> <property name="sizePolicy"> @@ -22,42 +22,13 @@ <normaloff>:/images/facetracknoir.png</normaloff>:/images/facetracknoir.png</iconset> </property> <widget class="QWidget" name="centralWidget"> - <widget class="QPushButton" name="btnShortcuts"> - <property name="geometry"> - <rect> - <x>760</x> - <y>280</y> - <width>96</width> - <height>38</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Keys</string> - </property> - <property name="icon"> - <iconset resource="main-facetracknoir.qrc"> - <normaloff>:/uielements/tools.png</normaloff>:/uielements/tools.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>98</width> - <height>24</height> - </size> - </property> - </widget> <widget class="QGroupBox" name="box_mapped_headpose"> <property name="geometry"> <rect> - <x>120</x> - <y>20</y> - <width>169</width> - <height>137</height> + <x>140</x> + <y>15</y> + <width>126</width> + <height>161</height> </rect> </property> <property name="title"> @@ -297,10 +268,10 @@ <widget class="QGroupBox" name="groupGameProtocol"> <property name="geometry"> <rect> - <x>345</x> - <y>255</y> - <width>246</width> - <height>65</height> + <x>405</x> + <y>380</y> + <width>181</width> + <height>56</height> </rect> </property> <property name="title"> @@ -341,10 +312,10 @@ <widget class="QGroupBox" name="groupTrackerSource"> <property name="geometry"> <rect> - <x>345</x> - <y>175</y> - <width>246</width> - <height>65</height> + <x>405</x> + <y>215</y> + <width>181</width> + <height>56</height> </rect> </property> <property name="title"> @@ -385,10 +356,10 @@ <widget class="QGroupBox" name="groupFilter"> <property name="geometry"> <rect> - <x>345</x> - <y>335</y> - <width>246</width> - <height>65</height> + <x>405</x> + <y>325</y> + <width>181</width> + <height>56</height> </rect> </property> <property name="title"> @@ -426,13 +397,57 @@ </item> </layout> </widget> + <widget class="QGroupBox" name="groupBox_3"> + <property name="geometry"> + <rect> + <x>405</x> + <y>270</y> + <width>181</width> + <height>56</height> + </rect> + </property> + <property name="title"> + <string>Auxiliary tracker</string> + </property> + <layout class="QHBoxLayout" name="_6"> + <item> + <widget class="QComboBox" name="cbxSecondTrackerSource"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxVisibleItems"> + <number>42</number> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btnShowSecondTrackerSettings"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Settings</string> + </property> + </widget> + </item> + </layout> + </widget> <widget class="QFrame" name="video_frame"> <property name="geometry"> <rect> - <x>10</x> - <y>170</y> - <width>320</width> - <height>240</height> + <x>24</x> + <y>204</y> + <width>366</width> + <height>281</height> </rect> </property> <property name="sizePolicy"> @@ -446,8 +461,8 @@ <rect> <x>0</x> <y>0</y> - <width>320</width> - <height>240</height> + <width>366</width> + <height>281</height> </rect> </property> <property name="sizePolicy"> @@ -470,29 +485,16 @@ <widget class="QGroupBox" name="groupProfile"> <property name="geometry"> <rect> - <x>525</x> - <y>40</y> - <width>311</width> - <height>111</height> + <x>405</x> + <y>15</y> + <width>181</width> + <height>81</height> </rect> </property> <property name="title"> <string>Profile</string> </property> <layout class="QGridLayout" name="_2"> - <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboProfile"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maxVisibleItems"> - <number>10</number> - </property> - </widget> - </item> <item row="0" column="1"> <widget class="QPushButton" name="btnSave"> <property name="enabled"> @@ -538,60 +540,28 @@ </property> </widget> </item> + <item row="0" column="0"> + <widget class="QComboBox" name="iconcomboProfile"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxVisibleItems"> + <number>10</number> + </property> + </widget> + </item> </layout> </widget> - <widget class="QPushButton" name="btnEditCurves"> - <property name="geometry"> - <rect> - <x>615</x> - <y>280</y> - <width>141</width> - <height>38</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Mapping</string> - </property> - <property name="icon"> - <iconset resource="main-facetracknoir.qrc"> - <normaloff>:/uielements/curves.png</normaloff>:/uielements/curves.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>60</width> - <height>37</height> - </size> - </property> - </widget> - <widget class="GLWidget" name="pose_display" native="true"> - <property name="geometry"> - <rect> - <x>0</x> - <y>10</y> - <width>81</width> - <height>100</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> <widget class="QGroupBox" name="groupStartStop"> <property name="geometry"> <rect> - <x>635</x> - <y>335</y> - <width>201</width> - <height>65</height> + <x>405</x> + <y>440</y> + <width>181</width> + <height>56</height> </rect> </property> <property name="minimumSize"> @@ -609,9 +579,6 @@ <property name="title"> <string notr="true">Controls</string> </property> - <property name="alignment"> - <set>Qt::AlignHCenter|Qt::AlignTop</set> - </property> <layout class="QGridLayout"> <item row="0" column="0"> <widget class="QPushButton" name="btnStartTracker"> @@ -644,37 +611,28 @@ </item> </layout> </widget> - <widget class="QLabel" name="game_name"> - <property name="geometry"> - <rect> - <x>460</x> - <y>10</y> - <width>115</width> - <height>19</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> <widget class="QGroupBox" name="box_raw_headpose"> <property name="geometry"> <rect> - <x>320</x> - <y>20</y> - <width>169</width> - <height>137</height> + <x>273</x> + <y>15</y> + <width>126</width> + <height>161</height> </rect> </property> <property name="title"> <string notr="true">Raw pose</string> </property> <layout class="QGridLayout" name="gridLayout_13"> - <item row="0" column="1"> - <widget class="QLCDNumber" name="lcdNumX"> + <item row="0" column="0"> + <widget class="QLabel" name="lblX_3"> + <property name="text"> + <string>TX</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLCDNumber" name="lcdNumZ"> <property name="enabled"> <bool>true</bool> </property> @@ -702,13 +660,6 @@ </property> </widget> </item> - <item row="0" column="0"> - <widget class="QLabel" name="lblX_3"> - <property name="text"> - <string>TX</string> - </property> - </widget> - </item> <item row="1" column="3"> <widget class="QLCDNumber" name="lcdNumRotY"> <property name="enabled"> @@ -738,8 +689,8 @@ </property> </widget> </item> - <item row="2" column="1"> - <widget class="QLCDNumber" name="lcdNumZ"> + <item row="0" column="1"> + <widget class="QLCDNumber" name="lcdNumX"> <property name="enabled"> <bool>true</bool> </property> @@ -796,13 +747,6 @@ </property> </widget> </item> - <item row="0" column="2"> - <widget class="QLabel" name="lblRotX_3"> - <property name="text"> - <string>yaw</string> - </property> - </widget> - </item> <item row="0" column="3"> <widget class="QLCDNumber" name="lcdNumRotX"> <property name="enabled"> @@ -832,13 +776,6 @@ </property> </widget> </item> - <item row="2" column="2"> - <widget class="QLabel" name="lblRotZ_3"> - <property name="text"> - <string>roll</string> - </property> - </widget> - </item> <item row="1" column="0"> <widget class="QLabel" name="lblY_3"> <property name="enabled"> @@ -901,8 +838,179 @@ </property> </widget> </item> + <item row="0" column="2"> + <widget class="QLabel" name="lblRotX_3"> + <property name="text"> + <string>yaw</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="lblRotZ_3"> + <property name="text"> + <string>roll</string> + </property> + </widget> + </item> </layout> </widget> + <widget class="QGroupBox" name="groupBox"> + <property name="geometry"> + <rect> + <x>15</x> + <y>179</y> + <width>386</width> + <height>316</height> + </rect> + </property> + <property name="title"> + <string>Video preview</string> + </property> + </widget> + <widget class="QGroupBox" name="groupBox_2"> + <property name="geometry"> + <rect> + <x>405</x> + <y>95</y> + <width>181</width> + <height>80</height> + </rect> + </property> + <property name="title"> + <string>Settings</string> + </property> + <widget class="QPushButton" name="btnShortcuts"> + <property name="geometry"> + <rect> + <x>10</x> + <y>45</y> + <width>161</width> + <height>26</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Keys</string> + </property> + <property name="icon"> + <iconset resource="main-facetracknoir.qrc"> + <normaloff>:/uielements/tools.png</normaloff>:/uielements/tools.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>98</width> + <height>24</height> + </size> + </property> + </widget> + <widget class="QPushButton" name="btnEditCurves"> + <property name="geometry"> + <rect> + <x>10</x> + <y>15</y> + <width>161</width> + <height>26</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Mapping</string> + </property> + <property name="icon"> + <iconset resource="main-facetracknoir.qrc"> + <normaloff>:/uielements/curves.png</normaloff>:/uielements/curves.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>60</width> + <height>37</height> + </size> + </property> + </widget> + </widget> + <widget class="QGroupBox" name="groupBox_4"> + <property name="geometry"> + <rect> + <x>15</x> + <y>15</y> + <width>116</width> + <height>161</height> + </rect> + </property> + <property name="title"> + <string>Tracking preview</string> + </property> + <widget class="GLWidget" name="pose_display" native="true"> + <property name="geometry"> + <rect> + <x>5</x> + <y>15</y> + <width>106</width> + <height>141</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </widget> + <widget class="QGroupBox" name="groupBox_5"> + <property name="geometry"> + <rect> + <x>405</x> + <y>180</y> + <width>181</width> + <height>36</height> + </rect> + </property> + <property name="title"> + <string>Detected app</string> + </property> + <widget class="QLabel" name="game_name"> + <property name="geometry"> + <rect> + <x>10</x> + <y>15</y> + <width>115</width> + <height>16</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </widget> + <zorder>box_mapped_headpose</zorder> + <zorder>groupGameProtocol</zorder> + <zorder>groupTrackerSource</zorder> + <zorder>groupFilter</zorder> + <zorder>groupBox_3</zorder> + <zorder>video_frame</zorder> + <zorder>groupProfile</zorder> + <zorder>groupStartStop</zorder> + <zorder>box_raw_headpose</zorder> + <zorder>video_frame_label</zorder> + <zorder>video_frame_label</zorder> + <zorder>groupBox</zorder> + <zorder>groupBox_2</zorder> + <zorder>groupBox_4</zorder> + <zorder>groupBox_5</zorder> </widget> </widget> <customwidgets> -- cgit v1.2.3 From 90acf0e706bb4c7b33b6e6b4da7258699231df84 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 20:32:39 +0200 Subject: no need for pragma here Revert part of ae8f78bf5e9096b44e700b1b2e1e4edc03a0b93d --- x-plane-plugin/plugin.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/x-plane-plugin/plugin.c b/x-plane-plugin/plugin.c index b91151c1..62c9d6f0 100644 --- a/x-plane-plugin/plugin.c +++ b/x-plane-plugin/plugin.c @@ -52,8 +52,6 @@ static void reinit_offset() { # define OT_UNUSED(varname) varname #endif -#pragma GCC diagnostic ignored "-Wunused-result" - PortableLockedShm* PortableLockedShm_init(const char *shmName, const char *OT_UNUSED(mutexName), int mapSize) { PortableLockedShm* self = malloc(sizeof(PortableLockedShm)); -- cgit v1.2.3 From b236bf6a23172a5008d0e715c913e44fb69d5e31 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 20:56:57 +0200 Subject: initialize first union member (clang warning) --- ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp index 39b1f4a2..ea44133c 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp @@ -41,7 +41,7 @@ void TrackerImpl::run() { while (sock.hasPendingDatagrams()) { - data = decltype(data){0,0, 0,0,0}; + data = decltype(data){0,0, {0,0,0, 0,0,0}}; int sz = sock.readDatagram(reinterpret_cast<char*>(&data), sizeof(data)); int flags = data.flags & F::Mask; -- cgit v1.2.3 From 6310488fda7a85b0f330e4ca6c7781873fe5b582 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Mon, 22 Sep 2014 15:25:19 +0200 Subject: fix Wine bitrot rather than only saying so name mangling has issues so partial revert --- .../opentrack-wrapper-wine-main.cxx | 75 ++++++++++++++-------- .../opentrack-wrapper-wine-posix.cxx | 12 ++-- .../opentrack-wrapper-wine-windows.cxx | 5 -- 3 files changed, 54 insertions(+), 38 deletions(-) diff --git a/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx b/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx index fe5a95f9..40f36f8d 100644 --- a/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx +++ b/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx @@ -10,33 +10,57 @@ #include "compat/compat.h" void create_registry_key(void); -ptr<BasePortableLockedShm> make_shm_posix(); -ptr<BasePortableLockedShm> make_shm_win32(); + +class ShmPosix { +public: + ShmPosix(const char *shmName, const char *mutexName, int mapSize); + ~ShmPosix(); + void lock(); + void unlock(); + bool success(); + inline void* ptr() { return mem; } +private: + void* mem; + int fd, size; +}; + +class ShmWine { +public: + ShmWine(const char *shmName, const char *mutexName, int mapSize); + ~ShmWine(); + void lock(); + void unlock(); + bool success(); + inline void* ptr() { return mem; } +private: + void* mem; + void *hMutex, *hMapFile; +}; +#include <windows.h> int main(void) { - ptr<BasePortableLockedShm> lck_posix = make_shm_posix(); - ptr<BasePortableLockedShm> lck_wine = make_shm_win32(); - if(!lck_posix->success()) { - printf("Can't open posix map: %d\n", errno); - return 1; - } - if(!lck_wine->success()) { - printf("Can't open Wine map\n"); - return 1; - } - WineSHM* shm_posix = (WineSHM*) lck_posix->ptr(); - FTHeap* shm_wine = (FTHeap*) lck_wine->ptr(); + ShmPosix lck_posix(WINE_SHM_NAME, WINE_MTX_NAME, sizeof(WineSHM)); + ShmWine lck_wine("FT_SharedMem", "FT_Mutext", sizeof(FTHeap)); + if(!lck_posix.success()) { + printf("Can't open posix map: %d\n", errno); + return 1; + } + if(!lck_wine.success()) { + printf("Can't open Wine map\n"); + return 1; + } + WineSHM* shm_posix = (WineSHM*) lck_posix.ptr(); + FTHeap* shm_wine = (FTHeap*) lck_wine.ptr(); FTData* data = &shm_wine->data; create_registry_key(); - while (1) { - (void) Sleep(4); - lck_posix->lock(); - if (shm_posix->stop) { - lck_posix->unlock(); - break; - } - lck_wine->lock(); + while (1) { + lck_posix.lock(); + if (shm_posix->stop) { + lck_posix.unlock(); + break; + } + lck_wine.lock(); data->Yaw = shm_posix->data[Yaw]; data->Pitch = shm_posix->data[Pitch]; data->Roll = shm_posix->data[Roll]; @@ -50,7 +74,8 @@ int main(void) shm_posix->gameid = shm_wine->GameID; for (int i = 0; i < 8; i++) shm_wine->table[i] = shm_posix->table[i]; - lck_wine->unlock(); - lck_posix->unlock(); - } + lck_wine.unlock(); + lck_posix.unlock(); + (void) Sleep(4); + } } diff --git a/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx b/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx index ea01ff03..010c4440 100644 --- a/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx +++ b/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx @@ -1,12 +1,8 @@ #define OPENTRACK_COMPAT_BUNDLED +#ifdef _WIN32 +# undef _WIN32 +#endif + #define PortableLockedShm ShmPosix -#undef _WIN32 -#include "ftnoir_protocol_ft/fttypes.h" -#include "wine-shm.h" #include "compat/compat.h" #include "compat/compat.cpp" - -ptr<BasePortableLockedShm> make_shm_posix() -{ - return std::make_shared<ShmPosix>(FREETRACK_HEAP, FREETRACK_MUTEX, sizeof(FTHeap)); -} diff --git a/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx b/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx index 715dcc69..b7dc531c 100644 --- a/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx +++ b/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx @@ -8,11 +8,6 @@ #include "compat/compat.cpp" #include "wine-shm.h" -ptr<BasePortableLockedShm> make_shm_win32() -{ - return std::make_shared<ShmWine>(WINE_SHM_NAME, WINE_MTX_NAME, sizeof(WineSHM)); -} - void create_registry_key(void) { char dir[8192]; -- cgit v1.2.3 From cc5c36f5cba605cb416d116b4861e447e555ad8a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 23:13:17 +0200 Subject: nix needless include --- ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp index 42de16c1..b7d078c2 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp @@ -1,7 +1,6 @@ /* Copyright: "i couldn't care less what anyone does with the 5 lines of code i wrote" - mm0zct */ #include "ftnoir_tracker_hydra.h" #include "facetracknoir/plugin-support.h" -#include "facetracknoir/rotation.h" #include <cstdio> #ifdef _WIN32 # define SIXENSE_STATIC_LIB -- cgit v1.2.3 From 459202a781fa997f6d8f841e9a55cd9325fd4cc9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 23:13:34 +0200 Subject: unbreak hopefully --- x-plane-plugin/plugin.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/x-plane-plugin/plugin.c b/x-plane-plugin/plugin.c index 62c9d6f0..3958c895 100644 --- a/x-plane-plugin/plugin.c +++ b/x-plane-plugin/plugin.c @@ -13,8 +13,6 @@ #include <XPLMCamera.h> #include <XPLMProcessing.h> -#include "ftnoir_tracker_base/ftnoir_tracker_types.h" - #ifndef PLUGIN_API #define PLUGIN_API #endif @@ -23,6 +21,10 @@ #define WINE_SHM_NAME "facetracknoir-wine-shm" #define WINE_MTX_NAME "facetracknoir-wine-mtx" +enum Axis { + TX = 0, TY, TZ, Yaw, Pitch, Roll +}; + typedef struct PortableLockedShm { void* mem; int fd, size; -- cgit v1.2.3 From a12fe2ca53136a6c9f978ae82fc203f8557f2a59 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 23 Sep 2014 23:30:36 +0200 Subject: fix dos2unix fiasco --- ftnoir_tracker_pt/Resources/Logo_IR.png | Bin 10385 -> 10386 bytes ftnoir_tracker_pt/Resources/cap_front.png | Bin 1163 -> 1164 bytes ftnoir_tracker_pt/Resources/cap_side.png | Bin 1732 -> 1733 bytes ftnoir_tracker_pt/Resources/clip_front.png | Bin 570 -> 571 bytes ftnoir_tracker_pt/Resources/clip_side.png | Bin 2676 -> 2677 bytes ftnoir_tracker_pt/doc/logo.png | Bin 10385 -> 10386 bytes ftnoir_tracker_pt/doc/settings1.png | Bin 25012 -> 25013 bytes ftnoir_tracker_pt/doc/settings2.png | Bin 26840 -> 26841 bytes ftnoir_tracker_pt/doc/settings3.png | Bin 29546 -> 29547 bytes 9 files changed, 0 insertions(+), 0 deletions(-) diff --git a/ftnoir_tracker_pt/Resources/Logo_IR.png b/ftnoir_tracker_pt/Resources/Logo_IR.png index 85590691..95032a25 100644 Binary files a/ftnoir_tracker_pt/Resources/Logo_IR.png and b/ftnoir_tracker_pt/Resources/Logo_IR.png differ diff --git a/ftnoir_tracker_pt/Resources/cap_front.png b/ftnoir_tracker_pt/Resources/cap_front.png index cbee28c9..14207a67 100644 Binary files a/ftnoir_tracker_pt/Resources/cap_front.png and b/ftnoir_tracker_pt/Resources/cap_front.png differ diff --git a/ftnoir_tracker_pt/Resources/cap_side.png b/ftnoir_tracker_pt/Resources/cap_side.png index 27c28341..5ad4ee65 100644 Binary files a/ftnoir_tracker_pt/Resources/cap_side.png and b/ftnoir_tracker_pt/Resources/cap_side.png differ diff --git a/ftnoir_tracker_pt/Resources/clip_front.png b/ftnoir_tracker_pt/Resources/clip_front.png index 63fd70eb..04880138 100644 Binary files a/ftnoir_tracker_pt/Resources/clip_front.png and b/ftnoir_tracker_pt/Resources/clip_front.png differ diff --git a/ftnoir_tracker_pt/Resources/clip_side.png b/ftnoir_tracker_pt/Resources/clip_side.png index 1c295506..72667ac7 100644 Binary files a/ftnoir_tracker_pt/Resources/clip_side.png and b/ftnoir_tracker_pt/Resources/clip_side.png differ diff --git a/ftnoir_tracker_pt/doc/logo.png b/ftnoir_tracker_pt/doc/logo.png index 85590691..95032a25 100644 Binary files a/ftnoir_tracker_pt/doc/logo.png and b/ftnoir_tracker_pt/doc/logo.png differ diff --git a/ftnoir_tracker_pt/doc/settings1.png b/ftnoir_tracker_pt/doc/settings1.png index 0725f5f4..35b84c5c 100644 Binary files a/ftnoir_tracker_pt/doc/settings1.png and b/ftnoir_tracker_pt/doc/settings1.png differ diff --git a/ftnoir_tracker_pt/doc/settings2.png b/ftnoir_tracker_pt/doc/settings2.png index 382ed13a..c6cfd1f3 100644 Binary files a/ftnoir_tracker_pt/doc/settings2.png and b/ftnoir_tracker_pt/doc/settings2.png differ diff --git a/ftnoir_tracker_pt/doc/settings3.png b/ftnoir_tracker_pt/doc/settings3.png index 821453d1..5922403d 100644 Binary files a/ftnoir_tracker_pt/doc/settings3.png and b/ftnoir_tracker_pt/doc/settings3.png differ -- cgit v1.2.3 From cdbb9238b898369e778f546272ed563636f1fdb0 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 24 Sep 2014 17:54:28 +0200 Subject: timer: convert to ms on demand --- facetracknoir/timer.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/facetracknoir/timer.hpp b/facetracknoir/timer.hpp index d2df1efd..8eb6b943 100644 --- a/facetracknoir/timer.hpp +++ b/facetracknoir/timer.hpp @@ -62,4 +62,7 @@ public: (void) clock_gettime(CLOCK_MONOTONIC, &cur); return conv(cur); } + long elapsed_ms() { + return elapsed() / 1000000L; + } }; -- cgit v1.2.3 From 3685c645e0c3ffba4edc61536957ac6b9f9cac3e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 24 Sep 2014 17:54:53 +0200 Subject: core: fix timer units --- facetracknoir/facetracknoir.ui | 2088 ++++++++++++++++++++-------------------- facetracknoir/tracker.cpp | 384 ++++---- 2 files changed, 1236 insertions(+), 1236 deletions(-) diff --git a/facetracknoir/facetracknoir.ui b/facetracknoir/facetracknoir.ui index 215b9b55..7f6b863c 100644 --- a/facetracknoir/facetracknoir.ui +++ b/facetracknoir/facetracknoir.ui @@ -1,1044 +1,1044 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <author>WVR</author> - <class>OpentrackUI</class> - <widget class="QMainWindow" name="OpentrackUI"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>597</width> - <height>506</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="windowIcon"> - <iconset resource="main-facetracknoir.qrc"> - <normaloff>:/images/facetracknoir.png</normaloff>:/images/facetracknoir.png</iconset> - </property> - <widget class="QWidget" name="centralWidget"> - <widget class="QGroupBox" name="box_mapped_headpose"> - <property name="geometry"> - <rect> - <x>140</x> - <y>15</y> - <width>126</width> - <height>161</height> - </rect> - </property> - <property name="title"> - <string notr="true">Game data</string> - </property> - <layout class="QGridLayout" name="gridLayout_10"> - <item row="0" column="1"> - <widget class="QLCDNumber" name="lcdNumOutputPosX"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="lblX_2"> - <property name="text"> - <string>TX</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLCDNumber" name="lcdNumOutputRotY"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLCDNumber" name="lcdNumOutputPosZ"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLCDNumber" name="lcdNumOutputRotZ"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="lblRotX_2"> - <property name="text"> - <string>yaw</string> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLCDNumber" name="lcdNumOutputRotX"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="lblRotZ_2"> - <property name="text"> - <string>roll</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="lblY_2"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="text"> - <string>TY</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="lblZ_2"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="text"> - <string>TZ</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLCDNumber" name="lcdNumOutputPosY"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="lblRotY_2"> - <property name="text"> - <string>pitch</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QGroupBox" name="groupGameProtocol"> - <property name="geometry"> - <rect> - <x>405</x> - <y>380</y> - <width>181</width> - <height>56</height> - </rect> - </property> - <property name="title"> - <string>Protocol</string> - </property> - <layout class="QHBoxLayout" name="_4"> - <item> - <widget class="QComboBox" name="iconcomboProtocol"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maxVisibleItems"> - <number>42</number> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnShowServerControls"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Settings</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QGroupBox" name="groupTrackerSource"> - <property name="geometry"> - <rect> - <x>405</x> - <y>215</y> - <width>181</width> - <height>56</height> - </rect> - </property> - <property name="title"> - <string>Tracker</string> - </property> - <layout class="QHBoxLayout" name="_3"> - <item> - <widget class="QComboBox" name="iconcomboTrackerSource"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maxVisibleItems"> - <number>42</number> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnShowEngineControls"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Settings</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QGroupBox" name="groupFilter"> - <property name="geometry"> - <rect> - <x>405</x> - <y>325</y> - <width>181</width> - <height>56</height> - </rect> - </property> - <property name="title"> - <string>Filter</string> - </property> - <layout class="QHBoxLayout" name="_5"> - <item> - <widget class="QComboBox" name="iconcomboFilter"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maxVisibleItems"> - <number>42</number> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnShowFilterControls"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Settings</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QGroupBox" name="groupBox_3"> - <property name="geometry"> - <rect> - <x>405</x> - <y>270</y> - <width>181</width> - <height>56</height> - </rect> - </property> - <property name="title"> - <string>Auxiliary tracker</string> - </property> - <layout class="QHBoxLayout" name="_6"> - <item> - <widget class="QComboBox" name="cbxSecondTrackerSource"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maxVisibleItems"> - <number>42</number> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnShowSecondTrackerSettings"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Settings</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QFrame" name="video_frame"> - <property name="geometry"> - <rect> - <x>24</x> - <y>204</y> - <width>366</width> - <height>281</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <widget class="QLabel" name="video_frame_label"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>366</width> - <height>281</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="font"> - <font> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="text"> - <string/> - </property> - </widget> - </widget> - <widget class="QGroupBox" name="groupProfile"> - <property name="geometry"> - <rect> - <x>405</x> - <y>15</y> - <width>181</width> - <height>81</height> - </rect> - </property> - <property name="title"> - <string>Profile</string> - </property> - <layout class="QGridLayout" name="_2"> - <item row="0" column="1"> - <widget class="QPushButton" name="btnSave"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Save</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QPushButton" name="btnLoad"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Load</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QPushButton" name="btnSaveAs"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Save As ...</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboProfile"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maxVisibleItems"> - <number>10</number> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QGroupBox" name="groupStartStop"> - <property name="geometry"> - <rect> - <x>405</x> - <y>440</y> - <width>181</width> - <height>56</height> - </rect> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="title"> - <string notr="true">Controls</string> - </property> - <layout class="QGridLayout"> - <item row="0" column="0"> - <widget class="QPushButton" name="btnStartTracker"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Start</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QPushButton" name="btnStopTracker"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Stop</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QGroupBox" name="box_raw_headpose"> - <property name="geometry"> - <rect> - <x>273</x> - <y>15</y> - <width>126</width> - <height>161</height> - </rect> - </property> - <property name="title"> - <string notr="true">Raw pose</string> - </property> - <layout class="QGridLayout" name="gridLayout_13"> - <item row="0" column="0"> - <widget class="QLabel" name="lblX_3"> - <property name="text"> - <string>TX</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLCDNumber" name="lcdNumZ"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLCDNumber" name="lcdNumRotY"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLCDNumber" name="lcdNumX"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLCDNumber" name="lcdNumRotZ"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLCDNumber" name="lcdNumRotX"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="lblY_3"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="text"> - <string>TY</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="lblZ_3"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="text"> - <string>TZ</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLCDNumber" name="lcdNumY"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="lblRotY_3"> - <property name="text"> - <string>pitch</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="lblRotX_3"> - <property name="text"> - <string>yaw</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="lblRotZ_3"> - <property name="text"> - <string>roll</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QGroupBox" name="groupBox"> - <property name="geometry"> - <rect> - <x>15</x> - <y>179</y> - <width>386</width> - <height>316</height> - </rect> - </property> - <property name="title"> - <string>Video preview</string> - </property> - </widget> - <widget class="QGroupBox" name="groupBox_2"> - <property name="geometry"> - <rect> - <x>405</x> - <y>95</y> - <width>181</width> - <height>80</height> - </rect> - </property> - <property name="title"> - <string>Settings</string> - </property> - <widget class="QPushButton" name="btnShortcuts"> - <property name="geometry"> - <rect> - <x>10</x> - <y>45</y> - <width>161</width> - <height>26</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Keys</string> - </property> - <property name="icon"> - <iconset resource="main-facetracknoir.qrc"> - <normaloff>:/uielements/tools.png</normaloff>:/uielements/tools.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>98</width> - <height>24</height> - </size> - </property> - </widget> - <widget class="QPushButton" name="btnEditCurves"> - <property name="geometry"> - <rect> - <x>10</x> - <y>15</y> - <width>161</width> - <height>26</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Mapping</string> - </property> - <property name="icon"> - <iconset resource="main-facetracknoir.qrc"> - <normaloff>:/uielements/curves.png</normaloff>:/uielements/curves.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>60</width> - <height>37</height> - </size> - </property> - </widget> - </widget> - <widget class="QGroupBox" name="groupBox_4"> - <property name="geometry"> - <rect> - <x>15</x> - <y>15</y> - <width>116</width> - <height>161</height> - </rect> - </property> - <property name="title"> - <string>Tracking preview</string> - </property> - <widget class="GLWidget" name="pose_display" native="true"> - <property name="geometry"> - <rect> - <x>5</x> - <y>15</y> - <width>106</width> - <height>141</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </widget> - <widget class="QGroupBox" name="groupBox_5"> - <property name="geometry"> - <rect> - <x>405</x> - <y>180</y> - <width>181</width> - <height>36</height> - </rect> - </property> - <property name="title"> - <string>Detected app</string> - </property> - <widget class="QLabel" name="game_name"> - <property name="geometry"> - <rect> - <x>10</x> - <y>15</y> - <width>115</width> - <height>16</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </widget> - <zorder>box_mapped_headpose</zorder> - <zorder>groupGameProtocol</zorder> - <zorder>groupTrackerSource</zorder> - <zorder>groupFilter</zorder> - <zorder>groupBox_3</zorder> - <zorder>video_frame</zorder> - <zorder>groupProfile</zorder> - <zorder>groupStartStop</zorder> - <zorder>box_raw_headpose</zorder> - <zorder>video_frame_label</zorder> - <zorder>video_frame_label</zorder> - <zorder>groupBox</zorder> - <zorder>groupBox_2</zorder> - <zorder>groupBox_4</zorder> - <zorder>groupBox_5</zorder> - </widget> - </widget> - <customwidgets> - <customwidget> - <class>GLWidget</class> - <extends>QWidget</extends> - <header>glwidget.h</header> - </customwidget> - </customwidgets> - <resources> - <include location="main-facetracknoir.qrc"/> - </resources> - <connections/> - <designerdata> - <property name="gridDeltaX"> - <number>5</number> - </property> - <property name="gridDeltaY"> - <number>5</number> - </property> - <property name="gridSnapX"> - <bool>true</bool> - </property> - <property name="gridSnapY"> - <bool>true</bool> - </property> - <property name="gridVisible"> - <bool>true</bool> - </property> - </designerdata> -</ui> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <author>WVR</author> + <class>OpentrackUI</class> + <widget class="QMainWindow" name="OpentrackUI"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>597</width> + <height>506</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowIcon"> + <iconset resource="main-facetracknoir.qrc"> + <normaloff>:/images/facetracknoir.png</normaloff>:/images/facetracknoir.png</iconset> + </property> + <widget class="QWidget" name="centralWidget"> + <widget class="QGroupBox" name="box_mapped_headpose"> + <property name="geometry"> + <rect> + <x>140</x> + <y>15</y> + <width>126</width> + <height>161</height> + </rect> + </property> + <property name="title"> + <string notr="true">Game data</string> + </property> + <layout class="QGridLayout" name="gridLayout_10"> + <item row="0" column="1"> + <widget class="QLCDNumber" name="lcdNumOutputPosX"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>2</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="lblX_2"> + <property name="text"> + <string>TX</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLCDNumber" name="lcdNumOutputRotY"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>2</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLCDNumber" name="lcdNumOutputPosZ"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>2</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLCDNumber" name="lcdNumOutputRotZ"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>2</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="lblRotX_2"> + <property name="text"> + <string>yaw</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLCDNumber" name="lcdNumOutputRotX"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>2</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="lblRotZ_2"> + <property name="text"> + <string>roll</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lblY_2"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="text"> + <string>TY</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="lblZ_2"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="text"> + <string>TZ</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLCDNumber" name="lcdNumOutputPosY"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>2</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="lblRotY_2"> + <property name="text"> + <string>pitch</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QGroupBox" name="groupGameProtocol"> + <property name="geometry"> + <rect> + <x>405</x> + <y>380</y> + <width>181</width> + <height>56</height> + </rect> + </property> + <property name="title"> + <string>Protocol</string> + </property> + <layout class="QHBoxLayout" name="_4"> + <item> + <widget class="QComboBox" name="iconcomboProtocol"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxVisibleItems"> + <number>42</number> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btnShowServerControls"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Settings</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QGroupBox" name="groupTrackerSource"> + <property name="geometry"> + <rect> + <x>405</x> + <y>215</y> + <width>181</width> + <height>56</height> + </rect> + </property> + <property name="title"> + <string>Tracker</string> + </property> + <layout class="QHBoxLayout" name="_3"> + <item> + <widget class="QComboBox" name="iconcomboTrackerSource"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxVisibleItems"> + <number>42</number> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btnShowEngineControls"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Settings</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QGroupBox" name="groupFilter"> + <property name="geometry"> + <rect> + <x>405</x> + <y>325</y> + <width>181</width> + <height>56</height> + </rect> + </property> + <property name="title"> + <string>Filter</string> + </property> + <layout class="QHBoxLayout" name="_5"> + <item> + <widget class="QComboBox" name="iconcomboFilter"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxVisibleItems"> + <number>42</number> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btnShowFilterControls"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Settings</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QGroupBox" name="groupBox_3"> + <property name="geometry"> + <rect> + <x>405</x> + <y>270</y> + <width>181</width> + <height>56</height> + </rect> + </property> + <property name="title"> + <string>Auxiliary tracker</string> + </property> + <layout class="QHBoxLayout" name="_6"> + <item> + <widget class="QComboBox" name="cbxSecondTrackerSource"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxVisibleItems"> + <number>42</number> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btnShowSecondTrackerSettings"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Settings</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QFrame" name="video_frame"> + <property name="geometry"> + <rect> + <x>24</x> + <y>204</y> + <width>366</width> + <height>281</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <widget class="QLabel" name="video_frame_label"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>366</width> + <height>281</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="text"> + <string/> + </property> + </widget> + </widget> + <widget class="QGroupBox" name="groupProfile"> + <property name="geometry"> + <rect> + <x>405</x> + <y>15</y> + <width>181</width> + <height>81</height> + </rect> + </property> + <property name="title"> + <string>Profile</string> + </property> + <layout class="QGridLayout" name="_2"> + <item row="0" column="1"> + <widget class="QPushButton" name="btnSave"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Save</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QPushButton" name="btnLoad"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Load</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QPushButton" name="btnSaveAs"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Save As ...</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QComboBox" name="iconcomboProfile"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxVisibleItems"> + <number>10</number> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QGroupBox" name="groupStartStop"> + <property name="geometry"> + <rect> + <x>405</x> + <y>440</y> + <width>181</width> + <height>56</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>65536</width> + <height>65536</height> + </size> + </property> + <property name="title"> + <string notr="true">Controls</string> + </property> + <layout class="QGridLayout"> + <item row="0" column="0"> + <widget class="QPushButton" name="btnStartTracker"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Start</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="btnStopTracker"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Stop</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QGroupBox" name="box_raw_headpose"> + <property name="geometry"> + <rect> + <x>273</x> + <y>15</y> + <width>126</width> + <height>161</height> + </rect> + </property> + <property name="title"> + <string notr="true">Raw pose</string> + </property> + <layout class="QGridLayout" name="gridLayout_13"> + <item row="0" column="0"> + <widget class="QLabel" name="lblX_3"> + <property name="text"> + <string>TX</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLCDNumber" name="lcdNumZ"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>2</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLCDNumber" name="lcdNumRotY"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>2</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLCDNumber" name="lcdNumX"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>2</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLCDNumber" name="lcdNumRotZ"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>2</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLCDNumber" name="lcdNumRotX"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>2</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lblY_3"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="text"> + <string>TY</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="lblZ_3"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="text"> + <string>TZ</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLCDNumber" name="lcdNumY"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>2</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="lblRotY_3"> + <property name="text"> + <string>pitch</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="lblRotX_3"> + <property name="text"> + <string>yaw</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="lblRotZ_3"> + <property name="text"> + <string>roll</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QGroupBox" name="groupBox"> + <property name="geometry"> + <rect> + <x>15</x> + <y>179</y> + <width>386</width> + <height>316</height> + </rect> + </property> + <property name="title"> + <string>Video preview</string> + </property> + </widget> + <widget class="QGroupBox" name="groupBox_2"> + <property name="geometry"> + <rect> + <x>405</x> + <y>95</y> + <width>181</width> + <height>80</height> + </rect> + </property> + <property name="title"> + <string>Settings</string> + </property> + <widget class="QPushButton" name="btnShortcuts"> + <property name="geometry"> + <rect> + <x>10</x> + <y>45</y> + <width>161</width> + <height>26</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Keys</string> + </property> + <property name="icon"> + <iconset resource="main-facetracknoir.qrc"> + <normaloff>:/uielements/tools.png</normaloff>:/uielements/tools.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>98</width> + <height>24</height> + </size> + </property> + </widget> + <widget class="QPushButton" name="btnEditCurves"> + <property name="geometry"> + <rect> + <x>10</x> + <y>15</y> + <width>161</width> + <height>26</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Mapping</string> + </property> + <property name="icon"> + <iconset resource="main-facetracknoir.qrc"> + <normaloff>:/uielements/curves.png</normaloff>:/uielements/curves.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>60</width> + <height>37</height> + </size> + </property> + </widget> + </widget> + <widget class="QGroupBox" name="groupBox_4"> + <property name="geometry"> + <rect> + <x>15</x> + <y>15</y> + <width>116</width> + <height>161</height> + </rect> + </property> + <property name="title"> + <string>Tracking preview</string> + </property> + <widget class="GLWidget" name="pose_display" native="true"> + <property name="geometry"> + <rect> + <x>5</x> + <y>15</y> + <width>106</width> + <height>141</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </widget> + <widget class="QGroupBox" name="groupBox_5"> + <property name="geometry"> + <rect> + <x>405</x> + <y>180</y> + <width>181</width> + <height>36</height> + </rect> + </property> + <property name="title"> + <string>Detected app</string> + </property> + <widget class="QLabel" name="game_name"> + <property name="geometry"> + <rect> + <x>10</x> + <y>15</y> + <width>115</width> + <height>16</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </widget> + <zorder>box_mapped_headpose</zorder> + <zorder>groupGameProtocol</zorder> + <zorder>groupTrackerSource</zorder> + <zorder>groupFilter</zorder> + <zorder>groupBox_3</zorder> + <zorder>video_frame</zorder> + <zorder>groupProfile</zorder> + <zorder>groupStartStop</zorder> + <zorder>box_raw_headpose</zorder> + <zorder>video_frame_label</zorder> + <zorder>video_frame_label</zorder> + <zorder>groupBox</zorder> + <zorder>groupBox_2</zorder> + <zorder>groupBox_4</zorder> + <zorder>groupBox_5</zorder> + </widget> + </widget> + <customwidgets> + <customwidget> + <class>GLWidget</class> + <extends>QWidget</extends> + <header>glwidget.h</header> + </customwidget> + </customwidgets> + <resources> + <include location="main-facetracknoir.qrc"/> + </resources> + <connections/> + <designerdata> + <property name="gridDeltaX"> + <number>5</number> + </property> + <property name="gridDeltaY"> + <number>5</number> + </property> + <property name="gridSnapX"> + <bool>true</bool> + </property> + <property name="gridSnapY"> + <bool>true</bool> + </property> + <property name="gridVisible"> + <bool>true</bool> + </property> + </designerdata> +</ui> diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 90e9bdad..72ad22b4 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -1,192 +1,192 @@ -/* Copyright (c) 2012-2013 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. - */ - -/* - * this file appeared originally in facetracknoir, was rewritten completely - * following opentrack fork. - * - * originally written by Wim Vriend. - */ - -#include "tracker.h" -#include "facetracknoir.h" -#include <opencv2/core/core.hpp> -#include <cmath> -#include <algorithm> - -#if defined(_WIN32) -# include <windows.h> -#endif - -Tracker::Tracker(FaceTrackNoIR *parent , main_settings& s) : - mainApp(parent), - s(s), - should_quit(false), - do_center(false), - enabled(true) -{ -} - -Tracker::~Tracker() -{ - should_quit = true; - wait(); -} - -static void get_curve(double pos, double& out, THeadPoseDOF& axis) { - bool altp = (pos < 0) && axis.opts.altp; - axis.curve.setTrackingActive( !altp ); - axis.curveAlt.setTrackingActive( altp ); - auto& fc = altp ? axis.curveAlt : axis.curve; - out = (axis.opts.invert ? -1 : 1) * fc.getValue(pos); - - out += axis.opts.zero; -} - -static void t_compensate(double* input, double* output, bool rz) -{ - const auto H = input[Yaw] * M_PI / -180; - const auto P = input[Pitch] * M_PI / -180; - const auto B = input[Roll] * M_PI / 180; - - const auto cosH = cos(H); - const auto sinH = sin(H); - const auto cosP = cos(P); - const auto sinP = sin(P); - const auto cosB = cos(B); - const auto sinB = sin(B); - - double foo[] = { - cosH * cosB - sinH * sinP * sinB, - - sinB * cosP, - sinH * cosB + cosH * sinP * sinB, - cosH * sinB + sinH * sinP * cosB, - cosB * cosP, - sinB * sinH - cosH * sinP * cosB, - - sinH * cosP, - - sinP, - cosH * cosP, - }; - - cv::Mat rmat(3, 3, CV_64F, foo); - const cv::Mat tvec(3, 1, CV_64F, input); - cv::Mat ret = rmat * tvec; - - const int max = !rz ? 3 : 2; - - for (int i = 0; i < max; i++) - output[i] = ret.at<double>(i); -} - -void Tracker::run() { - T6DOF offset_camera; - - double newpose[6] = {0}; - int sleep_ms = 15; - - if (Libraries->pTracker) - sleep_ms = std::min(sleep_ms, 1000 / Libraries->pTracker->preferredHz()); - - qDebug() << "tracker Hz:" << 1000 / sleep_ms; - -#if defined(_WIN32) - (void) timeBeginPeriod(1); -#endif - - for (;;) - { - t.start(); - - if (should_quit) - break; - - if (Libraries->pTracker) { - Libraries->pTracker->GetHeadPoseData(newpose); - } - - { - QMutexLocker foo(&mtx); - - for (int i = 0; i < 6; i++) - { - raw_6dof.axes[i] = newpose[i]; - - auto& axis = mainApp->axis(i); - - int k = axis.opts.src; - if (k < 0 || k >= 6) - continue; - - axis.headPos = newpose[k]; - } - - if (do_center) { - for (int i = 0; i < 6; i++) - offset_camera.axes[i] = mainApp->axis(i).headPos; - - do_center = false; - - if (Libraries->pFilter) - Libraries->pFilter->reset(); - } - - T6DOF target_camera, target_camera2, new_camera; - - if (enabled) - { - for (int i = 0; i < 6; i++) - target_camera.axes[i] = mainApp->axis(i).headPos; - - target_camera2 = target_camera - offset_camera; - } - - if (Libraries->pFilter) { - Libraries->pFilter->FilterHeadPoseData(target_camera2.axes, new_camera.axes); - } else { - new_camera = target_camera2; - } - - for (int i = 0; i < 6; i++) { - get_curve(new_camera.axes[i], output_camera.axes[i], mainApp->axis(i)); - } - - if (mainApp->s.tcomp_p) - t_compensate(output_camera.axes, output_camera.axes, mainApp->s.tcomp_tz); - - if (Libraries->pProtocol) { - Libraries->pProtocol->sendHeadposeToGame( output_camera.axes ); - } - } - - const long q = std::max(0L, sleep_ms * 1000L - std::max(0L, t.elapsed())); - - usleep(q); - } -#if defined(_WIN32) - (void) timeEndPeriod(1); -#endif - - for (int i = 0; i < 6; i++) - { - mainApp->axis(i).curve.setTrackingActive(false); - mainApp->axis(i).curveAlt.setTrackingActive(false); - } -} - -void Tracker::getHeadPose( double *data ) { - QMutexLocker foo(&mtx); - for (int i = 0; i < 6; i++) - { - data[i] = raw_6dof.axes[i]; - } -} - -void Tracker::getOutputHeadPose( double *data ) { - QMutexLocker foo(&mtx); - for (int i = 0; i < 6; i++) - data[i] = output_camera.axes[i]; -} +/* Copyright (c) 2012-2013 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. + */ + +/* + * this file appeared originally in facetracknoir, was rewritten completely + * following opentrack fork. + * + * originally written by Wim Vriend. + */ + +#include "tracker.h" +#include "facetracknoir.h" +#include <opencv2/core/core.hpp> +#include <cmath> +#include <algorithm> + +#if defined(_WIN32) +# include <windows.h> +#endif + +Tracker::Tracker(FaceTrackNoIR *parent , main_settings& s) : + mainApp(parent), + s(s), + should_quit(false), + do_center(false), + enabled(true) +{ +} + +Tracker::~Tracker() +{ + should_quit = true; + wait(); +} + +static void get_curve(double pos, double& out, THeadPoseDOF& axis) { + bool altp = (pos < 0) && axis.opts.altp; + axis.curve.setTrackingActive( !altp ); + axis.curveAlt.setTrackingActive( altp ); + auto& fc = altp ? axis.curveAlt : axis.curve; + out = (axis.opts.invert ? -1 : 1) * fc.getValue(pos); + + out += axis.opts.zero; +} + +static void t_compensate(double* input, double* output, bool rz) +{ + const auto H = input[Yaw] * M_PI / -180; + const auto P = input[Pitch] * M_PI / -180; + const auto B = input[Roll] * M_PI / 180; + + const auto cosH = cos(H); + const auto sinH = sin(H); + const auto cosP = cos(P); + const auto sinP = sin(P); + const auto cosB = cos(B); + const auto sinB = sin(B); + + double foo[] = { + cosH * cosB - sinH * sinP * sinB, + - sinB * cosP, + sinH * cosB + cosH * sinP * sinB, + cosH * sinB + sinH * sinP * cosB, + cosB * cosP, + sinB * sinH - cosH * sinP * cosB, + - sinH * cosP, + - sinP, + cosH * cosP, + }; + + cv::Mat rmat(3, 3, CV_64F, foo); + const cv::Mat tvec(3, 1, CV_64F, input); + cv::Mat ret = rmat * tvec; + + const int max = !rz ? 3 : 2; + + for (int i = 0; i < max; i++) + output[i] = ret.at<double>(i); +} + +void Tracker::run() { + T6DOF offset_camera; + + double newpose[6] = {0}; + int sleep_ms = 15; + + if (Libraries->pTracker) + sleep_ms = std::min(sleep_ms, 1000 / Libraries->pTracker->preferredHz()); + + qDebug() << "tracker Hz:" << 1000 / sleep_ms; + +#if defined(_WIN32) + (void) timeBeginPeriod(1); +#endif + + for (;;) + { + t.start(); + + if (should_quit) + break; + + if (Libraries->pTracker) { + Libraries->pTracker->GetHeadPoseData(newpose); + } + + { + QMutexLocker foo(&mtx); + + for (int i = 0; i < 6; i++) + { + raw_6dof.axes[i] = newpose[i]; + + auto& axis = mainApp->axis(i); + + int k = axis.opts.src; + if (k < 0 || k >= 6) + continue; + + axis.headPos = newpose[k]; + } + + if (do_center) { + for (int i = 0; i < 6; i++) + offset_camera.axes[i] = mainApp->axis(i).headPos; + + do_center = false; + + if (Libraries->pFilter) + Libraries->pFilter->reset(); + } + + T6DOF target_camera, target_camera2, new_camera; + + if (enabled) + { + for (int i = 0; i < 6; i++) + target_camera.axes[i] = mainApp->axis(i).headPos; + + target_camera2 = target_camera - offset_camera; + } + + if (Libraries->pFilter) { + Libraries->pFilter->FilterHeadPoseData(target_camera2.axes, new_camera.axes); + } else { + new_camera = target_camera2; + } + + for (int i = 0; i < 6; i++) { + get_curve(new_camera.axes[i], output_camera.axes[i], mainApp->axis(i)); + } + + if (mainApp->s.tcomp_p) + t_compensate(output_camera.axes, output_camera.axes, mainApp->s.tcomp_tz); + + if (Libraries->pProtocol) { + Libraries->pProtocol->sendHeadposeToGame( output_camera.axes ); + } + } + + const long q = std::max(0L, sleep_ms * 1000L - std::max(0L, t.elapsed())); + + usleep(q); + } +#if defined(_WIN32) + (void) timeEndPeriod(1); +#endif + + for (int i = 0; i < 6; i++) + { + mainApp->axis(i).curve.setTrackingActive(false); + mainApp->axis(i).curveAlt.setTrackingActive(false); + } +} + +void Tracker::getHeadPose( double *data ) { + QMutexLocker foo(&mtx); + for (int i = 0; i < 6; i++) + { + data[i] = raw_6dof.axes[i]; + } +} + +void Tracker::getOutputHeadPose( double *data ) { + QMutexLocker foo(&mtx); + for (int i = 0; i < 6; i++) + data[i] = output_camera.axes[i]; +} -- cgit v1.2.3 From bc8ad8274d9dd0d5693fa48db5325bcacff9cadf Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 24 Sep 2014 17:55:05 +0200 Subject: half gain logic done --- facetracknoir/gain-control.hpp | 175 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 facetracknoir/gain-control.hpp diff --git a/facetracknoir/gain-control.hpp b/facetracknoir/gain-control.hpp new file mode 100644 index 00000000..28887700 --- /dev/null +++ b/facetracknoir/gain-control.hpp @@ -0,0 +1,175 @@ +#pragma once + +#include <algorithm> +#undef NDEBUG +#include <cassert> +#include <iterator> +#include <tuple> +#include <deque> +#include <vector> + +#include "timer.hpp" + +#include <opencv2/core/core.hpp> +#include <opencv2/highgui/highgui.hpp> +#include <opencv2/imgproc/imgproc.hpp> + +#include <QDebug> + +namespace detail { + template<typename t1, typename t2, typename t, typename m = t> + class zip_iterator : public std::iterator<std::forward_iterator_tag, t> + { + private: + using self = zip_iterator<t1, t2, t, m>; + t1 x1, z1; + t2 x2, z2; + void maybe_end() { if (x1 == z1 || x2 == z2) *this = end(); } + public: + zip_iterator(const t1& it1, const t1& end1, const t2& it2, const t2& end2) + : x1(it1), z1(end1), x2(it2), z2(end2) { maybe_end(); } + constexpr zip_iterator() {} + + static constexpr self end() { return self(); } + + self operator++() { x1++; x2++; self tmp = *this; maybe_end(); return tmp; } + self operator++(int) { self tmp(*this); x1++; x2++; maybe_end(); return tmp; } + bool operator==(const self& rhs) const { return x1 == rhs.x1 && x2 == rhs.x2; } + bool operator!=(const self& rhs) const { return !this->operator ==(rhs); } + t operator*() { return m(*x1, *x2); } + }; +} + +class Gain { +private: + static constexpr bool use_box_filter = true; + static constexpr int box_size = 20 / 640.; + static constexpr double control_upper_bound = 1.0; // XXX FIXME implement for logitech crapola + static constexpr int GAIN_HISTORY_COUNT = 15, GAIN_HISTORY_EVERY_MS = 200; + + int control; + double step, eps; + + std::deque<double> means_history; + + Timer debug_timer, history_timer; + + typedef unsigned char px; + template<typename t1, typename t2, typename t, typename m = t> + using zip_iterator = detail::zip_iterator<t1, t2, t, m>; + + static double mean(const cv::Mat& frame) + { + // grayscale only + assert(frame.channels() == 1); + assert(frame.elemSize() == 1); + assert(!frame.empty()); + + return std::accumulate(frame.begin<px>(), frame.end<px>(), 0.) / (frame.rows * frame.cols); + } + + static double get_variance(const cv::Mat& frame, double mean) + { + struct variance { + private: + double mu; + public: + variance(double mu) : mu(mu) {} + double operator()(double seed, px p) + { + double tmp = p - mu; + return seed + tmp * tmp; + } + } logic(mean); + + return std::accumulate(frame.begin<unsigned char>(), frame.end<unsigned char>(), 0., logic) / (frame.rows * frame.cols); + } + + static double get_covariance(const cv::Mat& frame, double mean, double prev_mean) + { + struct covariance { + public: + using pair = std::tuple<px, px>; + private: + double mu_0, mu_1; + + inline double Cov(double seed, const pair& t) + { + px p0 = std::get<0>(t); + px p1 = std::get<1>(t); + return seed + (p0 - mu_0) * (p1 - mu_1); + } + public: + covariance(double mu_0, double mu_1) : mu_0(mu_0), mu_1(mu_1) {} + + double operator()(double seed, const pair& t) + { + return Cov(seed, t); + } + } logic(mean, prev_mean); + + const double N = frame.rows * frame.cols; + + using zipper = zip_iterator<cv::MatConstIterator_<px>, + cv::MatConstIterator_<px>, + std::tuple<px, px>>; + + zipper zip(frame.begin<px>(), + frame.end<px>(), + frame.begin<px>(), + frame.end<px>()); + std::vector<covariance::pair> values(zip, zipper::end()); + + return std::accumulate(values.begin(), values.end(), 0., logic) / N; + } + +#pragma GCC diagnostic ignored "-Wsign-compare" + +public: + Gain(int control = CV_CAP_PROP_GAIN, double step = 0.3, double eps = 0.02) : + control(control), step(step), eps(eps) + { + } + + void tick(cv::VideoCapture&, const cv::Mat& frame_) + { + cv::Mat frame; + + if (use_box_filter) + { + cv::Mat tmp(frame_); + static constexpr int min_box = 3; + static constexpr int box = 2 * box_size; + cv::blur(frame_, tmp, cv::Size(min_box + box * frame_.cols, min_box + box * frame_.rows)); + frame = tmp; + } + else + frame = frame_; + + const double mu = mean(frame); + const double var = get_variance(frame, mu); + + if (debug_timer.elapsed_ms() > 500) + { + debug_timer.start(); + qDebug() << "gain:" << "mean" << mu << "variance" << var; + } + + const int sz = means_history.size(); + + for (int i = 0; i < sz; i++) + { + const double cov = get_covariance(frame, mu, means_history[i]); + + qDebug() << "cov" << i << cov; + } + + if (GAIN_HISTORY_COUNT > means_history.size() && history_timer.elapsed_ms() > GAIN_HISTORY_EVERY_MS) + { + means_history.push_front(mu); + + if (GAIN_HISTORY_COUNT == means_history.size()) + means_history.pop_back(); + } + } +}; -- cgit v1.2.3 From e9e291bb7c571337745cabc81ec7141f80e9a629 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 24 Sep 2014 17:55:27 +0200 Subject: use gain class already for debugging sake --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 ++ ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 97830c9a..e216d319 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -214,6 +214,8 @@ void Tracker::run() grayscale = channel[2]; } else cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); + + gain.tick(camera, grayscale); const int scale = frame.cols > 480 ? 2 : 1; detector.setThresholdParams(scale > 1 ? 11 : 7, 4); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 81332a26..5416bb52 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -21,6 +21,9 @@ #include "facetracknoir/options.h" #include "ftnoir_tracker_aruco/trans_calib.h" #include "facetracknoir/plugin-api.hpp" + +#include "facetracknoir/gain-control.hpp" + using namespace options; struct settings { @@ -65,9 +68,9 @@ private: cv::VideoCapture camera; cv::Matx33f r; cv::Vec3f t; + Gain gain; }; -// Widget that has controls for FTNoIR protocol client-settings. class TrackerControls : public QWidget, public ITrackerDialog { Q_OBJECT -- cgit v1.2.3 From 609008e798f3d59f50fa3f5dc4b3f04d5da24092 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 24 Sep 2014 19:27:58 +0200 Subject: gain: more work, still incomplete --- facetracknoir/gain-control.hpp | 44 ++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/facetracknoir/gain-control.hpp b/facetracknoir/gain-control.hpp index 28887700..dcaee692 100644 --- a/facetracknoir/gain-control.hpp +++ b/facetracknoir/gain-control.hpp @@ -43,14 +43,15 @@ namespace detail { class Gain { private: static constexpr bool use_box_filter = true; - static constexpr int box_size = 20 / 640.; + static constexpr int box_size = 32 / 640.; static constexpr double control_upper_bound = 1.0; // XXX FIXME implement for logitech crapola - static constexpr int GAIN_HISTORY_COUNT = 15, GAIN_HISTORY_EVERY_MS = 200; + static constexpr int GAIN_HISTORY_COUNT = 15, GAIN_HISTORY_EVERY_MS = 115; int control; double step, eps; std::deque<double> means_history; + cv::Mat last_frame; Timer debug_timer, history_timer; @@ -85,8 +86,10 @@ private: return std::accumulate(frame.begin<unsigned char>(), frame.end<unsigned char>(), 0., logic) / (frame.rows * frame.cols); } - static double get_covariance(const cv::Mat& frame, double mean, double prev_mean) + static double get_covariance(const cv::Mat& frame, const cv::Mat& old_frame) { + double mean_0 = mean(frame), mean_1 = mean(old_frame); + struct covariance { public: using pair = std::tuple<px, px>; @@ -106,18 +109,18 @@ private: { return Cov(seed, t); } - } logic(mean, prev_mean); + } logic(mean_0, mean_1); const double N = frame.rows * frame.cols; using zipper = zip_iterator<cv::MatConstIterator_<px>, - cv::MatConstIterator_<px>, - std::tuple<px, px>>; + cv::MatConstIterator_<px>, + std::tuple<px, px>>; zipper zip(frame.begin<px>(), - frame.end<px>(), - frame.begin<px>(), - frame.end<px>()); + frame.end<px>(), + old_frame.begin<px>(), + old_frame.end<px>()); std::vector<covariance::pair> values(zip, zipper::end()); return std::accumulate(values.begin(), values.end(), 0., logic) / N; @@ -145,28 +148,27 @@ public: } else frame = frame_; - - const double mu = mean(frame); - const double var = get_variance(frame, mu); - if (debug_timer.elapsed_ms() > 500) + if (debug_timer.elapsed_ms() > 1000) { + const double mu = mean(frame); + const double var = get_variance(frame, mu); + debug_timer.start(); - qDebug() << "gain:" << "mean" << mu << "variance" << var; + qDebug() << "---- gain:" << "mean" << mu << "variance" << var; + for (int i = 0; i < means_history.size(); i++) + qDebug() << "cov" << i << means_history[i]; } - const int sz = means_history.size(); - - for (int i = 0; i < sz; i++) + if (last_frame.cols != frame.cols || last_frame.rows != frame.rows) { - const double cov = get_covariance(frame, mu, means_history[i]); - - qDebug() << "cov" << i << cov; + last_frame = frame; + means_history.clear(); } if (GAIN_HISTORY_COUNT > means_history.size() && history_timer.elapsed_ms() > GAIN_HISTORY_EVERY_MS) { - means_history.push_front(mu); + means_history.push_front(get_covariance(frame, last_frame)); if (GAIN_HISTORY_COUNT == means_history.size()) means_history.pop_back(); -- cgit v1.2.3 From 4b21008a53f2d89a0143976305368584d4ed1e44 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 24 Sep 2014 19:38:08 +0200 Subject: CRLF -> LF conversion .git/index removal Forgot to do it earlier, hence trash commits in recent days --- facetracknoir/clientfiles/FlightGear/readme.txt | 16 +- facetracknoir/ftnoir_curves.ui | 2354 ++++++++++---------- facetracknoir/ftnoir_keyboardshortcuts.ui | 434 ++-- ftnoir_filter_accela/ftnoir_filter_accela.h | 158 +- ftnoir_protocol_fg/ftnoir_fgcontrols.ui | 286 +-- ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui | 268 +-- ftnoir_protocol_ft/ftnoir_ftcontrols.ui | 446 ++-- ftnoir_protocol_ftn/ftnoir_ftncontrols.ui | 532 ++--- ftnoir_protocol_mouse/ftnoir_mousecontrols.ui | 410 ++-- ftnoir_protocol_sc/ftnoir_sccontrols.ui | 144 +- ftnoir_tracker_aruco/trans_calib.cpp | 88 +- ftnoir_tracker_aruco/trans_calib.h | 76 +- ftnoir_tracker_freepie-udp/freepie-udp-controls.ui | 138 +- ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui | 132 +- qxt-mini/plat/qxtglobalshortcut_mac.cpp | 456 ++-- qxt-mini/plat/qxtglobalshortcut_x11.cpp | 470 ++-- qxt-mini/qxtglobalshortcut.cpp | 448 ++-- qxt-mini/qxtglobalshortcut.h | 128 +- 18 files changed, 3492 insertions(+), 3492 deletions(-) diff --git a/facetracknoir/clientfiles/FlightGear/readme.txt b/facetracknoir/clientfiles/FlightGear/readme.txt index 0b3d9dfe..48cee837 100644 --- a/facetracknoir/clientfiles/FlightGear/readme.txt +++ b/facetracknoir/clientfiles/FlightGear/readme.txt @@ -1,8 +1,8 @@ -Copy Protocol/headtracker.xml to fgdata/Protocol/headtracker.xml - -$ fgfs --generic=socket,in,25,localhost,5542,udp,headtracker - -Adjust paths as necessary. - -cheers, --sh 20131008 +Copy Protocol/headtracker.xml to fgdata/Protocol/headtracker.xml + +$ fgfs --generic=socket,in,25,localhost,5542,udp,headtracker + +Adjust paths as necessary. + +cheers, +-sh 20131008 diff --git a/facetracknoir/ftnoir_curves.ui b/facetracknoir/ftnoir_curves.ui index f98bf884..7d6671aa 100644 --- a/facetracknoir/ftnoir_curves.ui +++ b/facetracknoir/ftnoir_curves.ui @@ -1,1177 +1,1177 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UICCurveConfigurationDialog</class> - <widget class="QWidget" name="UICCurveConfigurationDialog"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>970</width> - <height>655</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="windowTitle"> - <string>Mapping properties</string> - </property> - <property name="windowIcon"> - <iconset> - <normaloff>images/facetracknoir.png</normaloff>images/facetracknoir.png</iconset> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true">background-color: #ccc;</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QTabWidget" name="tabWidget"> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="tabPosition"> - <enum>QTabWidget::North</enum> - </property> - <property name="currentIndex"> - <number>6</number> - </property> - <widget class="QWidget" name="tabWidgetPage1"> - <attribute name="title"> - <string>Yaw</string> - </attribute> - <widget class="QFunctionConfigurator" name="rxconfig" native="true"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>930</width> - <height>260</height> - </rect> - </property> - <property name="maxInputEGU" stdset="0"> - <number>180</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>180</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>5</number> - </property> - <property name="colorBezier" stdset="0"> - <color> - <red>255</red> - <green>0</green> - <blue>0</blue> - </color> - </property> - <property name="colorBackground" stdset="0"> - <color> - <red>240</red> - <green>240</green> - <blue>240</blue> - </color> - </property> - </widget> - <widget class="QCheckBox" name="rx_altp"> - <property name="geometry"> - <rect> - <x>10</x> - <y>260</y> - <width>166</width> - <height>21</height> - </rect> - </property> - <property name="text"> - <string>Asymmetric mapping below</string> - </property> - </widget> - <widget class="QFunctionConfigurator" name="rxconfig_alt" native="true"> - <property name="geometry"> - <rect> - <x>0</x> - <y>300</y> - <width>930</width> - <height>260</height> - </rect> - </property> - <property name="maxInputEGU" stdset="0"> - <number>180</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>180</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>5</number> - </property> - <property name="colorBezier" stdset="0"> - <color> - <red>255</red> - <green>0</green> - <blue>0</blue> - </color> - </property> - <property name="colorBackground" stdset="0"> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </property> - </widget> - </widget> - <widget class="QWidget" name="tabWidgetPage2"> - <attribute name="title"> - <string>Pitch</string> - </attribute> - <widget class="QFunctionConfigurator" name="ryconfig" native="true"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>930</width> - <height>260</height> - </rect> - </property> - <property name="maxInputEGU" stdset="0"> - <number>90</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>90</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>10</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>2</number> - </property> - <property name="colorBezier" stdset="0"> - <color> - <red>0</red> - <green>255</green> - <blue>0</blue> - </color> - </property> - <property name="colorBackground" stdset="0"> - <color> - <red>240</red> - <green>240</green> - <blue>240</blue> - </color> - </property> - </widget> - <widget class="QCheckBox" name="ry_altp"> - <property name="geometry"> - <rect> - <x>10</x> - <y>260</y> - <width>199</width> - <height>21</height> - </rect> - </property> - <property name="text"> - <string>Asymmetric mapping below</string> - </property> - </widget> - <widget class="QFunctionConfigurator" name="ryconfig_alt" native="true"> - <property name="geometry"> - <rect> - <x>0</x> - <y>300</y> - <width>930</width> - <height>260</height> - </rect> - </property> - <property name="maxInputEGU" stdset="0"> - <number>90</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>90</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>10</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>2</number> - </property> - <property name="colorBezier" stdset="0"> - <color> - <red>0</red> - <green>255</green> - <blue>0</blue> - </color> - </property> - <property name="colorBackground" stdset="0"> - <color> - <red>240</red> - <green>240</green> - <blue>240</blue> - </color> - </property> - </widget> - </widget> - <widget class="QWidget" name="tabWidgetPage3"> - <attribute name="title"> - <string>Roll</string> - </attribute> - <widget class="QFunctionConfigurator" name="rzconfig" native="true"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>930</width> - <height>260</height> - </rect> - </property> - <property name="maxInputEGU" stdset="0"> - <number>180</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>180</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>5</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>1</number> - </property> - <property name="colorBezier" stdset="0"> - <color> - <red>0</red> - <green>0</green> - <blue>255</blue> - </color> - </property> - <property name="colorBackground" stdset="0"> - <color> - <red>240</red> - <green>240</green> - <blue>240</blue> - </color> - </property> - </widget> - <widget class="QCheckBox" name="rz_altp"> - <property name="geometry"> - <rect> - <x>10</x> - <y>260</y> - <width>271</width> - <height>21</height> - </rect> - </property> - <property name="text"> - <string>Asymmetric mapping below</string> - </property> - </widget> - <widget class="QFunctionConfigurator" name="rzconfig_alt" native="true"> - <property name="geometry"> - <rect> - <x>0</x> - <y>300</y> - <width>930</width> - <height>260</height> - </rect> - </property> - <property name="maxInputEGU" stdset="0"> - <number>180</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>180</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>5</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>1</number> - </property> - <property name="colorBezier" stdset="0"> - <color> - <red>0</red> - <green>0</green> - <blue>255</blue> - </color> - </property> - <property name="colorBackground" stdset="0"> - <color> - <red>240</red> - <green>240</green> - <blue>240</blue> - </color> - </property> - </widget> - </widget> - <widget class="QWidget" name="tabWidgetPage4"> - <attribute name="title"> - <string>X</string> - </attribute> - <widget class="QFunctionConfigurator" name="txconfig" native="true"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>930</width> - <height>260</height> - </rect> - </property> - <property name="maxInputEGU" stdset="0"> - <number>100</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>100</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>28</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>2</number> - </property> - <property name="colorBezier" stdset="0"> - <color> - <red>255</red> - <green>0</green> - <blue>255</blue> - </color> - </property> - <property name="colorBackground" stdset="0"> - <color> - <red>240</red> - <green>240</green> - <blue>240</blue> - </color> - </property> - </widget> - <widget class="QCheckBox" name="tx_altp"> - <property name="geometry"> - <rect> - <x>10</x> - <y>270</y> - <width>228</width> - <height>21</height> - </rect> - </property> - <property name="text"> - <string>Asymmetric mapping below</string> - </property> - </widget> - <widget class="QFunctionConfigurator" name="txconfig_alt" native="true"> - <property name="geometry"> - <rect> - <x>0</x> - <y>300</y> - <width>930</width> - <height>260</height> - </rect> - </property> - <property name="maxInputEGU" stdset="0"> - <number>100</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>100</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>28</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>2</number> - </property> - <property name="colorBezier" stdset="0"> - <color> - <red>255</red> - <green>0</green> - <blue>255</blue> - </color> - </property> - <property name="colorBackground" stdset="0"> - <color> - <red>240</red> - <green>240</green> - <blue>240</blue> - </color> - </property> - </widget> - </widget> - <widget class="QWidget" name="tabWidgetPage5"> - <attribute name="title"> - <string>Y</string> - </attribute> - <widget class="QFunctionConfigurator" name="tyconfig" native="true"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>930</width> - <height>260</height> - </rect> - </property> - <property name="maxInputEGU" stdset="0"> - <number>100</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>100</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>28</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>2</number> - </property> - <property name="colorBezier" stdset="0"> - <color> - <red>255</red> - <green>255</green> - <blue>0</blue> - </color> - </property> - <property name="colorBackground" stdset="0"> - <color> - <red>240</red> - <green>240</green> - <blue>240</blue> - </color> - </property> - </widget> - <widget class="QCheckBox" name="ty_altp"> - <property name="geometry"> - <rect> - <x>10</x> - <y>270</y> - <width>229</width> - <height>21</height> - </rect> - </property> - <property name="text"> - <string>Asymmetric mapping below</string> - </property> - </widget> - <widget class="QFunctionConfigurator" name="tyconfig_alt" native="true"> - <property name="geometry"> - <rect> - <x>0</x> - <y>300</y> - <width>930</width> - <height>260</height> - </rect> - </property> - <property name="maxInputEGU" stdset="0"> - <number>100</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>100</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>28</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>2</number> - </property> - <property name="colorBezier" stdset="0"> - <color> - <red>255</red> - <green>255</green> - <blue>0</blue> - </color> - </property> - <property name="colorBackground" stdset="0"> - <color> - <red>240</red> - <green>240</green> - <blue>240</blue> - </color> - </property> - </widget> - </widget> - <widget class="QWidget" name="tabWidgetPage6"> - <attribute name="title"> - <string>Z</string> - </attribute> - <widget class="QFunctionConfigurator" name="tzconfig" native="true"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>930</width> - <height>260</height> - </rect> - </property> - <property name="maxInputEGU" stdset="0"> - <number>100</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>100</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>28</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>2</number> - </property> - <property name="colorBezier" stdset="0"> - <color> - <red>0</red> - <green>255</green> - <blue>255</blue> - </color> - </property> - <property name="colorBackground" stdset="0"> - <color> - <red>240</red> - <green>240</green> - <blue>240</blue> - </color> - </property> - </widget> - <widget class="QCheckBox" name="tz_altp"> - <property name="geometry"> - <rect> - <x>10</x> - <y>270</y> - <width>263</width> - <height>21</height> - </rect> - </property> - <property name="text"> - <string>Asymmetric mapping below</string> - </property> - </widget> - <widget class="QFunctionConfigurator" name="tzconfig_alt" native="true"> - <property name="geometry"> - <rect> - <x>0</x> - <y>300</y> - <width>930</width> - <height>260</height> - </rect> - </property> - <property name="maxInputEGU" stdset="0"> - <number>100</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>100</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>28</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>2</number> - </property> - <property name="colorBezier" stdset="0"> - <color> - <red>0</red> - <green>255</green> - <blue>255</blue> - </color> - </property> - <property name="colorBackground" stdset="0"> - <color> - <red>240</red> - <green>240</green> - <blue>240</blue> - </color> - </property> - </widget> - </widget> - <widget class="QWidget" name="tabWidgetPage7"> - <attribute name="title"> - <string>Options</string> - </attribute> - <layout class="QFormLayout" name="formLayout"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Center pose</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - <property name="flat"> - <bool>true</bool> - </property> - <property name="checkable"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="2" column="1"> - <widget class="QDoubleSpinBox" name="pos_rz"> - <property name="suffix"> - <string> deg.</string> - </property> - <property name="decimals"> - <number>3</number> - </property> - <property name="minimum"> - <double>-180.000000000000000</double> - </property> - <property name="maximum"> - <double>180.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QDoubleSpinBox" name="pos_tz"> - <property name="suffix"> - <string> cm</string> - </property> - <property name="decimals"> - <number>3</number> - </property> - <property name="minimum"> - <double>-100.000000000000000</double> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>TX</string> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QDoubleSpinBox" name="pos_tx"> - <property name="suffix"> - <string> cm</string> - </property> - <property name="decimals"> - <number>3</number> - </property> - <property name="minimum"> - <double>-100.000000000000000</double> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>RY</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>TY</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QDoubleSpinBox" name="pos_ry"> - <property name="suffix"> - <string> deg.</string> - </property> - <property name="decimals"> - <number>3</number> - </property> - <property name="minimum"> - <double>-180.000000000000000</double> - </property> - <property name="maximum"> - <double>180.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>TZ</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>RZ</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QDoubleSpinBox" name="pos_ty"> - <property name="suffix"> - <string> cm</string> - </property> - <property name="decimals"> - <number>3</number> - </property> - <property name="minimum"> - <double>-100.000000000000000</double> - </property> - <property name="maximum"> - <double>100.000000000000000</double> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>RX</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QDoubleSpinBox" name="pos_rx"> - <property name="suffix"> - <string> deg.</string> - </property> - <property name="decimals"> - <number>3</number> - </property> - <property name="minimum"> - <double>-180.000000000000000</double> - </property> - <property name="maximum"> - <double>180.000000000000000</double> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="1" column="0"> - <widget class="QGroupBox" name="groupBox_4"> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="font"> - <font> - <kerning>true</kerning> - </font> - </property> - <property name="title"> - <string>Output remap</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - <property name="flat"> - <bool>true</bool> - </property> - <property name="checkable"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout_4" rowstretch="0,0,0,0,0,0,0" columnstretch="0,0,0"> - <property name="sizeConstraint"> - <enum>QLayout::SetMinAndMaxSize</enum> - </property> - <property name="spacing"> - <number>6</number> - </property> - <item row="4" column="0"> - <widget class="QLabel" name="label_10"> - <property name="text"> - <string>X</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>Yaw</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>Pitch</string> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="label_11"> - <property name="text"> - <string>Y</string> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="label_12"> - <property name="text"> - <string>Z</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_9"> - <property name="text"> - <string>Roll</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QCheckBox" name="invert_yaw"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QCheckBox" name="invert_pitch"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="4" column="2"> - <widget class="QCheckBox" name="invert_x"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="3" column="2"> - <widget class="QCheckBox" name="invert_roll"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="5" column="2"> - <widget class="QCheckBox" name="invert_y"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="6" column="2"> - <widget class="QCheckBox" name="invert_z"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="src_yaw"> - <item> - <property name="text"> - <string>X</string> - </property> - </item> - <item> - <property name="text"> - <string>Y</string> - </property> - </item> - <item> - <property name="text"> - <string>Z</string> - </property> - </item> - <item> - <property name="text"> - <string>Yaw</string> - </property> - </item> - <item> - <property name="text"> - <string>Pitch</string> - </property> - </item> - <item> - <property name="text"> - <string>Roll</string> - </property> - </item> - </widget> - </item> - <item row="2" column="1"> - <widget class="QComboBox" name="src_pitch"> - <item> - <property name="text"> - <string>X</string> - </property> - </item> - <item> - <property name="text"> - <string>Y</string> - </property> - </item> - <item> - <property name="text"> - <string>Z</string> - </property> - </item> - <item> - <property name="text"> - <string>Yaw</string> - </property> - </item> - <item> - <property name="text"> - <string>Pitch</string> - </property> - </item> - <item> - <property name="text"> - <string>Roll</string> - </property> - </item> - </widget> - </item> - <item row="3" column="1"> - <widget class="QComboBox" name="src_roll"> - <item> - <property name="text"> - <string>X</string> - </property> - </item> - <item> - <property name="text"> - <string>Y</string> - </property> - </item> - <item> - <property name="text"> - <string>Z</string> - </property> - </item> - <item> - <property name="text"> - <string>Yaw</string> - </property> - </item> - <item> - <property name="text"> - <string>Pitch</string> - </property> - </item> - <item> - <property name="text"> - <string>Roll</string> - </property> - </item> - </widget> - </item> - <item row="4" column="1"> - <widget class="QComboBox" name="src_x"> - <item> - <property name="text"> - <string>X</string> - </property> - </item> - <item> - <property name="text"> - <string>Y</string> - </property> - </item> - <item> - <property name="text"> - <string>Z</string> - </property> - </item> - <item> - <property name="text"> - <string>Yaw</string> - </property> - </item> - <item> - <property name="text"> - <string>Pitch</string> - </property> - </item> - <item> - <property name="text"> - <string>Roll</string> - </property> - </item> - </widget> - </item> - <item row="5" column="1"> - <widget class="QComboBox" name="src_y"> - <item> - <property name="text"> - <string>X</string> - </property> - </item> - <item> - <property name="text"> - <string>Y</string> - </property> - </item> - <item> - <property name="text"> - <string>Z</string> - </property> - </item> - <item> - <property name="text"> - <string>Yaw</string> - </property> - </item> - <item> - <property name="text"> - <string>Pitch</string> - </property> - </item> - <item> - <property name="text"> - <string>Roll</string> - </property> - </item> - </widget> - </item> - <item row="6" column="1"> - <widget class="QComboBox" name="src_z"> - <item> - <property name="text"> - <string>X</string> - </property> - </item> - <item> - <property name="text"> - <string>Y</string> - </property> - </item> - <item> - <property name="text"> - <string>Z</string> - </property> - </item> - <item> - <property name="text"> - <string>Yaw</string> - </property> - </item> - <item> - <property name="text"> - <string>Pitch</string> - </property> - </item> - <item> - <property name="text"> - <string>Roll</string> - </property> - </item> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="label_13"> - <property name="text"> - <string>Source</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_14"> - <property name="text"> - <string>Invert</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_15"> - <property name="text"> - <string>Destination</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="0" column="1"> - <widget class="QGroupBox" name="groupBox_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="title"> - <string>Translation compensation</string> - </property> - <property name="flat"> - <bool>true</bool> - </property> - <layout class="QFormLayout" name="formLayout_2"> - <item row="0" column="0"> - <widget class="QCheckBox" name="tcomp_enable"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string>Enable</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QCheckBox" name="tcomp_rz"> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string>Disable Z axis compensation</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>QFunctionConfigurator</class> - <extends>QWidget</extends> - <header>qfunctionconfigurator.h</header> - </customwidget> - </customwidgets> - <tabstops> - <tabstop>pos_rx</tabstop> - <tabstop>pos_ry</tabstop> - <tabstop>pos_rz</tabstop> - <tabstop>ry_altp</tabstop> - <tabstop>rz_altp</tabstop> - <tabstop>tx_altp</tabstop> - <tabstop>ty_altp</tabstop> - <tabstop>tz_altp</tabstop> - <tabstop>tcomp_enable</tabstop> - <tabstop>tabWidget</tabstop> - <tabstop>pos_tx</tabstop> - <tabstop>buttonBox</tabstop> - <tabstop>pos_ty</tabstop> - <tabstop>rx_altp</tabstop> - <tabstop>pos_tz</tabstop> - </tabstops> - <resources/> - <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UICCurveConfigurationDialog</class> + <widget class="QWidget" name="UICCurveConfigurationDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>970</width> + <height>655</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle"> + <string>Mapping properties</string> + </property> + <property name="windowIcon"> + <iconset> + <normaloff>images/facetracknoir.png</normaloff>images/facetracknoir.png</iconset> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="styleSheet"> + <string notr="true">background-color: #ccc;</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="tabPosition"> + <enum>QTabWidget::North</enum> + </property> + <property name="currentIndex"> + <number>6</number> + </property> + <widget class="QWidget" name="tabWidgetPage1"> + <attribute name="title"> + <string>Yaw</string> + </attribute> + <widget class="QFunctionConfigurator" name="rxconfig" native="true"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>930</width> + <height>260</height> + </rect> + </property> + <property name="maxInputEGU" stdset="0"> + <number>180</number> + </property> + <property name="maxOutputEGU" stdset="0"> + <number>180</number> + </property> + <property name="pixPerEGU_Input" stdset="0"> + <number>5</number> + </property> + <property name="colorBezier" stdset="0"> + <color> + <red>255</red> + <green>0</green> + <blue>0</blue> + </color> + </property> + <property name="colorBackground" stdset="0"> + <color> + <red>240</red> + <green>240</green> + <blue>240</blue> + </color> + </property> + </widget> + <widget class="QCheckBox" name="rx_altp"> + <property name="geometry"> + <rect> + <x>10</x> + <y>260</y> + <width>166</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Asymmetric mapping below</string> + </property> + </widget> + <widget class="QFunctionConfigurator" name="rxconfig_alt" native="true"> + <property name="geometry"> + <rect> + <x>0</x> + <y>300</y> + <width>930</width> + <height>260</height> + </rect> + </property> + <property name="maxInputEGU" stdset="0"> + <number>180</number> + </property> + <property name="maxOutputEGU" stdset="0"> + <number>180</number> + </property> + <property name="pixPerEGU_Input" stdset="0"> + <number>5</number> + </property> + <property name="colorBezier" stdset="0"> + <color> + <red>255</red> + <green>0</green> + <blue>0</blue> + </color> + </property> + <property name="colorBackground" stdset="0"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + </widget> + </widget> + <widget class="QWidget" name="tabWidgetPage2"> + <attribute name="title"> + <string>Pitch</string> + </attribute> + <widget class="QFunctionConfigurator" name="ryconfig" native="true"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>930</width> + <height>260</height> + </rect> + </property> + <property name="maxInputEGU" stdset="0"> + <number>90</number> + </property> + <property name="maxOutputEGU" stdset="0"> + <number>90</number> + </property> + <property name="pixPerEGU_Input" stdset="0"> + <number>10</number> + </property> + <property name="pixPerEGU_Output" stdset="0"> + <number>2</number> + </property> + <property name="colorBezier" stdset="0"> + <color> + <red>0</red> + <green>255</green> + <blue>0</blue> + </color> + </property> + <property name="colorBackground" stdset="0"> + <color> + <red>240</red> + <green>240</green> + <blue>240</blue> + </color> + </property> + </widget> + <widget class="QCheckBox" name="ry_altp"> + <property name="geometry"> + <rect> + <x>10</x> + <y>260</y> + <width>199</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Asymmetric mapping below</string> + </property> + </widget> + <widget class="QFunctionConfigurator" name="ryconfig_alt" native="true"> + <property name="geometry"> + <rect> + <x>0</x> + <y>300</y> + <width>930</width> + <height>260</height> + </rect> + </property> + <property name="maxInputEGU" stdset="0"> + <number>90</number> + </property> + <property name="maxOutputEGU" stdset="0"> + <number>90</number> + </property> + <property name="pixPerEGU_Input" stdset="0"> + <number>10</number> + </property> + <property name="pixPerEGU_Output" stdset="0"> + <number>2</number> + </property> + <property name="colorBezier" stdset="0"> + <color> + <red>0</red> + <green>255</green> + <blue>0</blue> + </color> + </property> + <property name="colorBackground" stdset="0"> + <color> + <red>240</red> + <green>240</green> + <blue>240</blue> + </color> + </property> + </widget> + </widget> + <widget class="QWidget" name="tabWidgetPage3"> + <attribute name="title"> + <string>Roll</string> + </attribute> + <widget class="QFunctionConfigurator" name="rzconfig" native="true"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>930</width> + <height>260</height> + </rect> + </property> + <property name="maxInputEGU" stdset="0"> + <number>180</number> + </property> + <property name="maxOutputEGU" stdset="0"> + <number>180</number> + </property> + <property name="pixPerEGU_Input" stdset="0"> + <number>5</number> + </property> + <property name="pixPerEGU_Output" stdset="0"> + <number>1</number> + </property> + <property name="colorBezier" stdset="0"> + <color> + <red>0</red> + <green>0</green> + <blue>255</blue> + </color> + </property> + <property name="colorBackground" stdset="0"> + <color> + <red>240</red> + <green>240</green> + <blue>240</blue> + </color> + </property> + </widget> + <widget class="QCheckBox" name="rz_altp"> + <property name="geometry"> + <rect> + <x>10</x> + <y>260</y> + <width>271</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Asymmetric mapping below</string> + </property> + </widget> + <widget class="QFunctionConfigurator" name="rzconfig_alt" native="true"> + <property name="geometry"> + <rect> + <x>0</x> + <y>300</y> + <width>930</width> + <height>260</height> + </rect> + </property> + <property name="maxInputEGU" stdset="0"> + <number>180</number> + </property> + <property name="maxOutputEGU" stdset="0"> + <number>180</number> + </property> + <property name="pixPerEGU_Input" stdset="0"> + <number>5</number> + </property> + <property name="pixPerEGU_Output" stdset="0"> + <number>1</number> + </property> + <property name="colorBezier" stdset="0"> + <color> + <red>0</red> + <green>0</green> + <blue>255</blue> + </color> + </property> + <property name="colorBackground" stdset="0"> + <color> + <red>240</red> + <green>240</green> + <blue>240</blue> + </color> + </property> + </widget> + </widget> + <widget class="QWidget" name="tabWidgetPage4"> + <attribute name="title"> + <string>X</string> + </attribute> + <widget class="QFunctionConfigurator" name="txconfig" native="true"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>930</width> + <height>260</height> + </rect> + </property> + <property name="maxInputEGU" stdset="0"> + <number>100</number> + </property> + <property name="maxOutputEGU" stdset="0"> + <number>100</number> + </property> + <property name="pixPerEGU_Input" stdset="0"> + <number>28</number> + </property> + <property name="pixPerEGU_Output" stdset="0"> + <number>2</number> + </property> + <property name="colorBezier" stdset="0"> + <color> + <red>255</red> + <green>0</green> + <blue>255</blue> + </color> + </property> + <property name="colorBackground" stdset="0"> + <color> + <red>240</red> + <green>240</green> + <blue>240</blue> + </color> + </property> + </widget> + <widget class="QCheckBox" name="tx_altp"> + <property name="geometry"> + <rect> + <x>10</x> + <y>270</y> + <width>228</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Asymmetric mapping below</string> + </property> + </widget> + <widget class="QFunctionConfigurator" name="txconfig_alt" native="true"> + <property name="geometry"> + <rect> + <x>0</x> + <y>300</y> + <width>930</width> + <height>260</height> + </rect> + </property> + <property name="maxInputEGU" stdset="0"> + <number>100</number> + </property> + <property name="maxOutputEGU" stdset="0"> + <number>100</number> + </property> + <property name="pixPerEGU_Input" stdset="0"> + <number>28</number> + </property> + <property name="pixPerEGU_Output" stdset="0"> + <number>2</number> + </property> + <property name="colorBezier" stdset="0"> + <color> + <red>255</red> + <green>0</green> + <blue>255</blue> + </color> + </property> + <property name="colorBackground" stdset="0"> + <color> + <red>240</red> + <green>240</green> + <blue>240</blue> + </color> + </property> + </widget> + </widget> + <widget class="QWidget" name="tabWidgetPage5"> + <attribute name="title"> + <string>Y</string> + </attribute> + <widget class="QFunctionConfigurator" name="tyconfig" native="true"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>930</width> + <height>260</height> + </rect> + </property> + <property name="maxInputEGU" stdset="0"> + <number>100</number> + </property> + <property name="maxOutputEGU" stdset="0"> + <number>100</number> + </property> + <property name="pixPerEGU_Input" stdset="0"> + <number>28</number> + </property> + <property name="pixPerEGU_Output" stdset="0"> + <number>2</number> + </property> + <property name="colorBezier" stdset="0"> + <color> + <red>255</red> + <green>255</green> + <blue>0</blue> + </color> + </property> + <property name="colorBackground" stdset="0"> + <color> + <red>240</red> + <green>240</green> + <blue>240</blue> + </color> + </property> + </widget> + <widget class="QCheckBox" name="ty_altp"> + <property name="geometry"> + <rect> + <x>10</x> + <y>270</y> + <width>229</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Asymmetric mapping below</string> + </property> + </widget> + <widget class="QFunctionConfigurator" name="tyconfig_alt" native="true"> + <property name="geometry"> + <rect> + <x>0</x> + <y>300</y> + <width>930</width> + <height>260</height> + </rect> + </property> + <property name="maxInputEGU" stdset="0"> + <number>100</number> + </property> + <property name="maxOutputEGU" stdset="0"> + <number>100</number> + </property> + <property name="pixPerEGU_Input" stdset="0"> + <number>28</number> + </property> + <property name="pixPerEGU_Output" stdset="0"> + <number>2</number> + </property> + <property name="colorBezier" stdset="0"> + <color> + <red>255</red> + <green>255</green> + <blue>0</blue> + </color> + </property> + <property name="colorBackground" stdset="0"> + <color> + <red>240</red> + <green>240</green> + <blue>240</blue> + </color> + </property> + </widget> + </widget> + <widget class="QWidget" name="tabWidgetPage6"> + <attribute name="title"> + <string>Z</string> + </attribute> + <widget class="QFunctionConfigurator" name="tzconfig" native="true"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>930</width> + <height>260</height> + </rect> + </property> + <property name="maxInputEGU" stdset="0"> + <number>100</number> + </property> + <property name="maxOutputEGU" stdset="0"> + <number>100</number> + </property> + <property name="pixPerEGU_Input" stdset="0"> + <number>28</number> + </property> + <property name="pixPerEGU_Output" stdset="0"> + <number>2</number> + </property> + <property name="colorBezier" stdset="0"> + <color> + <red>0</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="colorBackground" stdset="0"> + <color> + <red>240</red> + <green>240</green> + <blue>240</blue> + </color> + </property> + </widget> + <widget class="QCheckBox" name="tz_altp"> + <property name="geometry"> + <rect> + <x>10</x> + <y>270</y> + <width>263</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Asymmetric mapping below</string> + </property> + </widget> + <widget class="QFunctionConfigurator" name="tzconfig_alt" native="true"> + <property name="geometry"> + <rect> + <x>0</x> + <y>300</y> + <width>930</width> + <height>260</height> + </rect> + </property> + <property name="maxInputEGU" stdset="0"> + <number>100</number> + </property> + <property name="maxOutputEGU" stdset="0"> + <number>100</number> + </property> + <property name="pixPerEGU_Input" stdset="0"> + <number>28</number> + </property> + <property name="pixPerEGU_Output" stdset="0"> + <number>2</number> + </property> + <property name="colorBezier" stdset="0"> + <color> + <red>0</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="colorBackground" stdset="0"> + <color> + <red>240</red> + <green>240</green> + <blue>240</blue> + </color> + </property> + </widget> + </widget> + <widget class="QWidget" name="tabWidgetPage7"> + <attribute name="title"> + <string>Options</string> + </attribute> + <layout class="QFormLayout" name="formLayout"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <item row="0" column="0"> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Center pose</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="flat"> + <bool>true</bool> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="2" column="1"> + <widget class="QDoubleSpinBox" name="pos_rz"> + <property name="suffix"> + <string> deg.</string> + </property> + <property name="decimals"> + <number>3</number> + </property> + <property name="minimum"> + <double>-180.000000000000000</double> + </property> + <property name="maximum"> + <double>180.000000000000000</double> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QDoubleSpinBox" name="pos_tz"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="decimals"> + <number>3</number> + </property> + <property name="minimum"> + <double>-100.000000000000000</double> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>TX</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QDoubleSpinBox" name="pos_tx"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="decimals"> + <number>3</number> + </property> + <property name="minimum"> + <double>-100.000000000000000</double> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>RY</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>TY</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QDoubleSpinBox" name="pos_ry"> + <property name="suffix"> + <string> deg.</string> + </property> + <property name="decimals"> + <number>3</number> + </property> + <property name="minimum"> + <double>-180.000000000000000</double> + </property> + <property name="maximum"> + <double>180.000000000000000</double> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>TZ</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>RZ</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QDoubleSpinBox" name="pos_ty"> + <property name="suffix"> + <string> cm</string> + </property> + <property name="decimals"> + <number>3</number> + </property> + <property name="minimum"> + <double>-100.000000000000000</double> + </property> + <property name="maximum"> + <double>100.000000000000000</double> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>RX</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QDoubleSpinBox" name="pos_rx"> + <property name="suffix"> + <string> deg.</string> + </property> + <property name="decimals"> + <number>3</number> + </property> + <property name="minimum"> + <double>-180.000000000000000</double> + </property> + <property name="maximum"> + <double>180.000000000000000</double> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="0"> + <widget class="QGroupBox" name="groupBox_4"> + <property name="maximumSize"> + <size> + <width>65536</width> + <height>65536</height> + </size> + </property> + <property name="font"> + <font> + <kerning>true</kerning> + </font> + </property> + <property name="title"> + <string>Output remap</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="flat"> + <bool>true</bool> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout_4" rowstretch="0,0,0,0,0,0,0" columnstretch="0,0,0"> + <property name="sizeConstraint"> + <enum>QLayout::SetMinAndMaxSize</enum> + </property> + <property name="spacing"> + <number>6</number> + </property> + <item row="4" column="0"> + <widget class="QLabel" name="label_10"> + <property name="text"> + <string>X</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Yaw</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Pitch</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="label_11"> + <property name="text"> + <string>Y</string> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="label_12"> + <property name="text"> + <string>Z</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_9"> + <property name="text"> + <string>Roll</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QCheckBox" name="invert_yaw"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QCheckBox" name="invert_pitch"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="4" column="2"> + <widget class="QCheckBox" name="invert_x"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QCheckBox" name="invert_roll"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="5" column="2"> + <widget class="QCheckBox" name="invert_y"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="6" column="2"> + <widget class="QCheckBox" name="invert_z"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="src_yaw"> + <item> + <property name="text"> + <string>X</string> + </property> + </item> + <item> + <property name="text"> + <string>Y</string> + </property> + </item> + <item> + <property name="text"> + <string>Z</string> + </property> + </item> + <item> + <property name="text"> + <string>Yaw</string> + </property> + </item> + <item> + <property name="text"> + <string>Pitch</string> + </property> + </item> + <item> + <property name="text"> + <string>Roll</string> + </property> + </item> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="src_pitch"> + <item> + <property name="text"> + <string>X</string> + </property> + </item> + <item> + <property name="text"> + <string>Y</string> + </property> + </item> + <item> + <property name="text"> + <string>Z</string> + </property> + </item> + <item> + <property name="text"> + <string>Yaw</string> + </property> + </item> + <item> + <property name="text"> + <string>Pitch</string> + </property> + </item> + <item> + <property name="text"> + <string>Roll</string> + </property> + </item> + </widget> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="src_roll"> + <item> + <property name="text"> + <string>X</string> + </property> + </item> + <item> + <property name="text"> + <string>Y</string> + </property> + </item> + <item> + <property name="text"> + <string>Z</string> + </property> + </item> + <item> + <property name="text"> + <string>Yaw</string> + </property> + </item> + <item> + <property name="text"> + <string>Pitch</string> + </property> + </item> + <item> + <property name="text"> + <string>Roll</string> + </property> + </item> + </widget> + </item> + <item row="4" column="1"> + <widget class="QComboBox" name="src_x"> + <item> + <property name="text"> + <string>X</string> + </property> + </item> + <item> + <property name="text"> + <string>Y</string> + </property> + </item> + <item> + <property name="text"> + <string>Z</string> + </property> + </item> + <item> + <property name="text"> + <string>Yaw</string> + </property> + </item> + <item> + <property name="text"> + <string>Pitch</string> + </property> + </item> + <item> + <property name="text"> + <string>Roll</string> + </property> + </item> + </widget> + </item> + <item row="5" column="1"> + <widget class="QComboBox" name="src_y"> + <item> + <property name="text"> + <string>X</string> + </property> + </item> + <item> + <property name="text"> + <string>Y</string> + </property> + </item> + <item> + <property name="text"> + <string>Z</string> + </property> + </item> + <item> + <property name="text"> + <string>Yaw</string> + </property> + </item> + <item> + <property name="text"> + <string>Pitch</string> + </property> + </item> + <item> + <property name="text"> + <string>Roll</string> + </property> + </item> + </widget> + </item> + <item row="6" column="1"> + <widget class="QComboBox" name="src_z"> + <item> + <property name="text"> + <string>X</string> + </property> + </item> + <item> + <property name="text"> + <string>Y</string> + </property> + </item> + <item> + <property name="text"> + <string>Z</string> + </property> + </item> + <item> + <property name="text"> + <string>Yaw</string> + </property> + </item> + <item> + <property name="text"> + <string>Pitch</string> + </property> + </item> + <item> + <property name="text"> + <string>Roll</string> + </property> + </item> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_13"> + <property name="text"> + <string>Source</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_14"> + <property name="text"> + <string>Invert</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_15"> + <property name="text"> + <string>Destination</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="1"> + <widget class="QGroupBox" name="groupBox_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="title"> + <string>Translation compensation</string> + </property> + <property name="flat"> + <bool>true</bool> + </property> + <layout class="QFormLayout" name="formLayout_2"> + <item row="0" column="0"> + <widget class="QCheckBox" name="tcomp_enable"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string>Enable</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QCheckBox" name="tcomp_rz"> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string>Disable Z axis compensation</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>QFunctionConfigurator</class> + <extends>QWidget</extends> + <header>qfunctionconfigurator.h</header> + </customwidget> + </customwidgets> + <tabstops> + <tabstop>pos_rx</tabstop> + <tabstop>pos_ry</tabstop> + <tabstop>pos_rz</tabstop> + <tabstop>ry_altp</tabstop> + <tabstop>rz_altp</tabstop> + <tabstop>tx_altp</tabstop> + <tabstop>ty_altp</tabstop> + <tabstop>tz_altp</tabstop> + <tabstop>tcomp_enable</tabstop> + <tabstop>tabWidget</tabstop> + <tabstop>pos_tx</tabstop> + <tabstop>buttonBox</tabstop> + <tabstop>pos_ty</tabstop> + <tabstop>rx_altp</tabstop> + <tabstop>pos_tz</tabstop> + </tabstops> + <resources/> + <connections/> + <slots> + <slot>startEngineClicked()</slot> + <slot>stopEngineClicked()</slot> + <slot>cameraSettingsClicked()</slot> + </slots> +</ui> diff --git a/facetracknoir/ftnoir_keyboardshortcuts.ui b/facetracknoir/ftnoir_keyboardshortcuts.ui index 5bdc3334..245b503a 100644 --- a/facetracknoir/ftnoir_keyboardshortcuts.ui +++ b/facetracknoir/ftnoir_keyboardshortcuts.ui @@ -1,217 +1,217 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UICKeyboardShortcutDialog</class> - <widget class="QWidget" name="UICKeyboardShortcutDialog"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>371</width> - <height>125</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="windowTitle"> - <string>Keyboard shortcuts</string> - </property> - <property name="windowIcon"> - <iconset> - <normaloff>images/facetracknoir.png</normaloff>images/facetracknoir.png</iconset> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="2" column="1"> - <widget class="QCheckBox" name="chkToggleShift"> - <property name="maximumSize"> - <size> - <width>50</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Shift</string> - </property> - </widget> - </item> - <item row="2" column="4"> - <widget class="QComboBox" name="cbxToggleKey"> - <property name="minimumSize"> - <size> - <width>90</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>Select Number</string> - </property> - <property name="insertPolicy"> - <enum>QComboBox::InsertAlphabetically</enum> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="textLabel2_5"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Toggle</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QCheckBox" name="chkCenterAlt"> - <property name="maximumSize"> - <size> - <width>50</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Alt</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QCheckBox" name="chkCenterCtrl"> - <property name="maximumSize"> - <size> - <width>50</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Ctrl</string> - </property> - </widget> - </item> - <item row="1" column="4"> - <widget class="QComboBox" name="cbxCenterKey"> - <property name="minimumSize"> - <size> - <width>90</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>Select Number</string> - </property> - <property name="insertPolicy"> - <enum>QComboBox::InsertAlphabetically</enum> - </property> - </widget> - </item> - <item row="0" column="4"> - <widget class="QLabel" name="textLabel2_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Keyboard</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="4" column="3" colspan="2"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QCheckBox" name="chkToggleCtrl"> - <property name="maximumSize"> - <size> - <width>50</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Ctrl</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="textLabel2_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Center</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QCheckBox" name="chkToggleAlt"> - <property name="maximumSize"> - <size> - <width>50</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Alt</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="chkCenterShift"> - <property name="maximumSize"> - <size> - <width>50</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Shift</string> - </property> - </widget> - </item> - <item row="3" column="0" colspan="2"> - <widget class="QCheckBox" name="ding"> - <property name="text"> - <string>Ding!</string> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UICKeyboardShortcutDialog</class> + <widget class="QWidget" name="UICKeyboardShortcutDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>371</width> + <height>125</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle"> + <string>Keyboard shortcuts</string> + </property> + <property name="windowIcon"> + <iconset> + <normaloff>images/facetracknoir.png</normaloff>images/facetracknoir.png</iconset> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="2" column="1"> + <widget class="QCheckBox" name="chkToggleShift"> + <property name="maximumSize"> + <size> + <width>50</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Shift</string> + </property> + </widget> + </item> + <item row="2" column="4"> + <widget class="QComboBox" name="cbxToggleKey"> + <property name="minimumSize"> + <size> + <width>90</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Select Number</string> + </property> + <property name="insertPolicy"> + <enum>QComboBox::InsertAlphabetically</enum> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="textLabel2_5"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Toggle</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QCheckBox" name="chkCenterAlt"> + <property name="maximumSize"> + <size> + <width>50</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Alt</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QCheckBox" name="chkCenterCtrl"> + <property name="maximumSize"> + <size> + <width>50</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Ctrl</string> + </property> + </widget> + </item> + <item row="1" column="4"> + <widget class="QComboBox" name="cbxCenterKey"> + <property name="minimumSize"> + <size> + <width>90</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Select Number</string> + </property> + <property name="insertPolicy"> + <enum>QComboBox::InsertAlphabetically</enum> + </property> + </widget> + </item> + <item row="0" column="4"> + <widget class="QLabel" name="textLabel2_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Keyboard</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="4" column="3" colspan="2"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QCheckBox" name="chkToggleCtrl"> + <property name="maximumSize"> + <size> + <width>50</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Ctrl</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="textLabel2_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Center</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QCheckBox" name="chkToggleAlt"> + <property name="maximumSize"> + <size> + <width>50</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Alt</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QCheckBox" name="chkCenterShift"> + <property name="maximumSize"> + <size> + <width>50</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Shift</string> + </property> + </widget> + </item> + <item row="3" column="0" colspan="2"> + <widget class="QCheckBox" name="ding"> + <property name="text"> + <string>Ding!</string> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> + <slots> + <slot>startEngineClicked()</slot> + <slot>stopEngineClicked()</slot> + <slot>cameraSettingsClicked()</slot> + </slots> +</ui> diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index c9a434e7..0a736042 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -1,79 +1,79 @@ -#pragma once -#include "ui_ftnoir_accela_filtercontrols.h" -#include "facetracknoir/plugin-api.hpp" -#include <QMutex> - -#define ACCELA_SMOOTHING_ROTATION 60.0 -#define ACCELA_SMOOTHING_TRANSLATION 40.0 -#define ACCELA_SECOND_ORDER_ALPHA 100.0 -#define ACCELA_THIRD_ORDER_ALPHA 180.0 - -#include <facetracknoir/options.h> -using namespace options; - -struct settings { - pbundle b; - value<double> rotation_alpha, - translation_alpha, - second_order_alpha, - third_order_alpha, - rot_deadzone, - trans_deadzone, - expt; - settings() : - b(bundle("Accela")), - rotation_alpha(b, "rotation-alpha", ACCELA_SMOOTHING_ROTATION), - translation_alpha(b, "translation-alpha", ACCELA_SMOOTHING_TRANSLATION), - second_order_alpha(b, "second-order-alpha", ACCELA_SECOND_ORDER_ALPHA), - third_order_alpha(b, "third-order-alpha", ACCELA_THIRD_ORDER_ALPHA), - rot_deadzone(b, "rotation-deadband", 0), - trans_deadzone(b, "translation-deadband", 0), - expt(b, "exponent", 2) - {} -}; - -class FTNoIR_Filter : public IFilter -{ -public: - FTNoIR_Filter(); - void FilterHeadPoseData(const double* target_camera_position, double *new_camera_position); - void reset() { - first_run = true; - } - void receiveSettings() { - s.b->reload(); - } - -private: - settings s; - bool first_run; - double last_output[3][6]; -}; - -class FilterControls: public QWidget, public IFilterDialog -{ - Q_OBJECT -public: - FilterControls(); - void registerFilter(IFilter* filter); - void unregisterFilter(); -private: - Ui::AccelaUICFilterControls ui; - void discard(); - void save(); - FTNoIR_Filter* accela_filter; - settings s; -private slots: - void doOK(); - void doCancel(); -}; - -class FTNoIR_FilterDll : public Metadata -{ -public: - void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("Accela Filter Mk4"); } - void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("Accela Mk4"); } - void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Accela filter Mk4"); } - - void getIcon(QIcon *icon){ *icon = QIcon(":/images/filter-16.png"); } -}; +#pragma once +#include "ui_ftnoir_accela_filtercontrols.h" +#include "facetracknoir/plugin-api.hpp" +#include <QMutex> + +#define ACCELA_SMOOTHING_ROTATION 60.0 +#define ACCELA_SMOOTHING_TRANSLATION 40.0 +#define ACCELA_SECOND_ORDER_ALPHA 100.0 +#define ACCELA_THIRD_ORDER_ALPHA 180.0 + +#include <facetracknoir/options.h> +using namespace options; + +struct settings { + pbundle b; + value<double> rotation_alpha, + translation_alpha, + second_order_alpha, + third_order_alpha, + rot_deadzone, + trans_deadzone, + expt; + settings() : + b(bundle("Accela")), + rotation_alpha(b, "rotation-alpha", ACCELA_SMOOTHING_ROTATION), + translation_alpha(b, "translation-alpha", ACCELA_SMOOTHING_TRANSLATION), + second_order_alpha(b, "second-order-alpha", ACCELA_SECOND_ORDER_ALPHA), + third_order_alpha(b, "third-order-alpha", ACCELA_THIRD_ORDER_ALPHA), + rot_deadzone(b, "rotation-deadband", 0), + trans_deadzone(b, "translation-deadband", 0), + expt(b, "exponent", 2) + {} +}; + +class FTNoIR_Filter : public IFilter +{ +public: + FTNoIR_Filter(); + void FilterHeadPoseData(const double* target_camera_position, double *new_camera_position); + void reset() { + first_run = true; + } + void receiveSettings() { + s.b->reload(); + } + +private: + settings s; + bool first_run; + double last_output[3][6]; +}; + +class FilterControls: public QWidget, public IFilterDialog +{ + Q_OBJECT +public: + FilterControls(); + void registerFilter(IFilter* filter); + void unregisterFilter(); +private: + Ui::AccelaUICFilterControls ui; + void discard(); + void save(); + FTNoIR_Filter* accela_filter; + settings s; +private slots: + void doOK(); + void doCancel(); +}; + +class FTNoIR_FilterDll : public Metadata +{ +public: + void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("Accela Filter Mk4"); } + void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("Accela Mk4"); } + void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Accela filter Mk4"); } + + void getIcon(QIcon *icon){ *icon = QIcon(":/images/filter-16.png"); } +}; diff --git a/ftnoir_protocol_fg/ftnoir_fgcontrols.ui b/ftnoir_protocol_fg/ftnoir_fgcontrols.ui index a4092c05..575549d6 100644 --- a/ftnoir_protocol_fg/ftnoir_fgcontrols.ui +++ b/ftnoir_protocol_fg/ftnoir_fgcontrols.ui @@ -1,143 +1,143 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UICFGControls</class> - <widget class="QWidget" name="UICFGControls"> - <property name="windowModality"> - <enum>Qt::NonModal</enum> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>415</width> - <height>112</height> - </rect> - </property> - <property name="windowTitle"> - <string>FlightGear protocol settings</string> - </property> - <property name="windowIcon"> - <iconset resource="../ftnoir_filter_ewma2/ewma-filter.qrc"> - <normaloff>:/images/filter-16.png</normaloff>:/images/filter-16.png</iconset> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>IP-address remote PC</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="spinIPFirstNibble"> - <property name="maximumSize"> - <size> - <width>60</width> - <height>16777215</height> - </size> - </property> - <property name="maximum"> - <number>255</number> - </property> - <property name="singleStep"> - <number>1</number> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QSpinBox" name="spinIPSecondNibble"> - <property name="maximumSize"> - <size> - <width>60</width> - <height>16777215</height> - </size> - </property> - <property name="maximum"> - <number>255</number> - </property> - <property name="singleStep"> - <number>1</number> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QSpinBox" name="spinIPThirdNibble"> - <property name="maximumSize"> - <size> - <width>60</width> - <height>16777215</height> - </size> - </property> - <property name="maximum"> - <number>255</number> - </property> - <property name="singleStep"> - <number>1</number> - </property> - </widget> - </item> - <item row="0" column="4"> - <widget class="QSpinBox" name="spinIPFourthNibble"> - <property name="maximumSize"> - <size> - <width>60</width> - <height>16777215</height> - </size> - </property> - <property name="maximum"> - <number>255</number> - </property> - <property name="singleStep"> - <number>1</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Port-number</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="spinPortNumber"> - <property name="minimum"> - <number>1000</number> - </property> - <property name="maximum"> - <number>10000</number> - </property> - </widget> - </item> - <item row="2" column="2" colspan="3"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </widget> - <tabstops> - <tabstop>spinIPFirstNibble</tabstop> - <tabstop>spinIPSecondNibble</tabstop> - <tabstop>spinIPThirdNibble</tabstop> - <tabstop>spinIPFourthNibble</tabstop> - <tabstop>spinPortNumber</tabstop> - </tabstops> - <resources> - <include location="../ftnoir_filter_ewma2/ewma-filter.qrc"/> - </resources> - <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UICFGControls</class> + <widget class="QWidget" name="UICFGControls"> + <property name="windowModality"> + <enum>Qt::NonModal</enum> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>415</width> + <height>112</height> + </rect> + </property> + <property name="windowTitle"> + <string>FlightGear protocol settings</string> + </property> + <property name="windowIcon"> + <iconset resource="../ftnoir_filter_ewma2/ewma-filter.qrc"> + <normaloff>:/images/filter-16.png</normaloff>:/images/filter-16.png</iconset> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>IP-address remote PC</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="spinIPFirstNibble"> + <property name="maximumSize"> + <size> + <width>60</width> + <height>16777215</height> + </size> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QSpinBox" name="spinIPSecondNibble"> + <property name="maximumSize"> + <size> + <width>60</width> + <height>16777215</height> + </size> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QSpinBox" name="spinIPThirdNibble"> + <property name="maximumSize"> + <size> + <width>60</width> + <height>16777215</height> + </size> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + </widget> + </item> + <item row="0" column="4"> + <widget class="QSpinBox" name="spinIPFourthNibble"> + <property name="maximumSize"> + <size> + <width>60</width> + <height>16777215</height> + </size> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Port-number</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="spinPortNumber"> + <property name="minimum"> + <number>1000</number> + </property> + <property name="maximum"> + <number>10000</number> + </property> + </widget> + </item> + <item row="2" column="2" colspan="3"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <tabstops> + <tabstop>spinIPFirstNibble</tabstop> + <tabstop>spinIPSecondNibble</tabstop> + <tabstop>spinIPThirdNibble</tabstop> + <tabstop>spinIPFourthNibble</tabstop> + <tabstop>spinPortNumber</tabstop> + </tabstops> + <resources> + <include location="../ftnoir_filter_ewma2/ewma-filter.qrc"/> + </resources> + <connections/> + <slots> + <slot>startEngineClicked()</slot> + <slot>stopEngineClicked()</slot> + <slot>cameraSettingsClicked()</slot> + </slots> +</ui> diff --git a/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui b/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui index 6cb066bd..637e4dba 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui +++ b/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui @@ -1,134 +1,134 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UICFSUIPCControls</class> - <widget class="QWidget" name="UICFSUIPCControls"> - <property name="windowModality"> - <enum>Qt::NonModal</enum> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>512</width> - <height>100</height> - </rect> - </property> - <property name="windowTitle"> - <string>FSUIPC settings FaceTrackNoIR</string> - </property> - <property name="windowIcon"> - <iconset> - <normaloff>images/FaceTrackNoIR.png</normaloff>images/FaceTrackNoIR.png</iconset> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="2" column="1"> - <widget class="QPushButton" name="btnCancel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Cancel</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="txtLocationOfDLL"> - <property name="minimumSize"> - <size> - <width>230</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>Location of FSUIPC.dll</string> - </property> - <property name="frameShape"> - <enum>QFrame::Box</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Sunken</enum> - </property> - <property name="lineWidth"> - <number>1</number> - </property> - <property name="text"> - <string>Location of FSUIPC.dll</string> - </property> - </widget> - </item> - <item row="1" column="0" colspan="2"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>The DLL should be located in the Modules/ directory of MS FS 2004</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QPushButton" name="btnOK"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>OK</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QPushButton" name="btnFindDLL"> - <property name="maximumSize"> - <size> - <width>35</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>...</string> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UICFSUIPCControls</class> + <widget class="QWidget" name="UICFSUIPCControls"> + <property name="windowModality"> + <enum>Qt::NonModal</enum> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>512</width> + <height>100</height> + </rect> + </property> + <property name="windowTitle"> + <string>FSUIPC settings FaceTrackNoIR</string> + </property> + <property name="windowIcon"> + <iconset> + <normaloff>images/FaceTrackNoIR.png</normaloff>images/FaceTrackNoIR.png</iconset> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="2" column="1"> + <widget class="QPushButton" name="btnCancel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="txtLocationOfDLL"> + <property name="minimumSize"> + <size> + <width>230</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Location of FSUIPC.dll</string> + </property> + <property name="frameShape"> + <enum>QFrame::Box</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="text"> + <string>Location of FSUIPC.dll</string> + </property> + </widget> + </item> + <item row="1" column="0" colspan="2"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>The DLL should be located in the Modules/ directory of MS FS 2004</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QPushButton" name="btnOK"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>OK</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="btnFindDLL"> + <property name="maximumSize"> + <size> + <width>35</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> + <slots> + <slot>startEngineClicked()</slot> + <slot>stopEngineClicked()</slot> + <slot>cameraSettingsClicked()</slot> + </slots> +</ui> diff --git a/ftnoir_protocol_ft/ftnoir_ftcontrols.ui b/ftnoir_protocol_ft/ftnoir_ftcontrols.ui index 941aaff0..554e681a 100644 --- a/ftnoir_protocol_ft/ftnoir_ftcontrols.ui +++ b/ftnoir_protocol_ft/ftnoir_ftcontrols.ui @@ -1,223 +1,223 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UICFTControls</class> - <widget class="QWidget" name="UICFTControls"> - <property name="windowModality"> - <enum>Qt::NonModal</enum> - </property> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>489</width> - <height>402</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="windowTitle"> - <string>freetrack protocol settings</string> - </property> - <property name="windowIcon"> - <iconset resource="ft-protocol.qrc"> - <normaloff>:/images/freetrack.png</normaloff>:/images/freetrack.png</iconset> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QGroupBox" name="groupBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>TIRViews</string> - </property> - <property name="alignment"> - <set>Qt::AlignJustify|Qt::AlignTop</set> - </property> - <property name="flat"> - <bool>false</bool> - </property> - <layout class="QFormLayout" name="formLayout_2"> - <item row="0" column="0"> - <widget class="QCheckBox" name="chkTIRViews"> - <property name="layoutDirection"> - <enum>Qt::RightToLeft</enum> - </property> - <property name="text"> - <string>Memory hacks</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Only for very old and buggy old games such as CFS3.</string> - </property> - <property name="scaledContents"> - <bool>false</bool> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="1" column="0"> - <widget class="QGroupBox" name="groupBox_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>TrackIR.exe</string> - </property> - <property name="alignment"> - <set>Qt::AlignJustify|Qt::AlignTop</set> - </property> - <property name="flat"> - <bool>false</bool> - </property> - <layout class="QFormLayout" name="formLayout_3"> - <item row="0" column="0"> - <widget class="QCheckBox" name="chkStartDummy"> - <property name="layoutDirection"> - <enum>Qt::RightToLeft</enum> - </property> - <property name="text"> - <string>Using EZCA</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>FSX-specific EZCA protocol hacks</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="2" column="0"> - <widget class="QGroupBox" name="groupBox_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Select interface</string> - </property> - <property name="alignment"> - <set>Qt::AlignJustify|Qt::AlignTop</set> - </property> - <property name="flat"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="0" column="0"> - <widget class="QComboBox" name="cbxSelectInterface"/> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>Disable one of the protocols if game is confused by presence of both at the same time.</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="3" column="0"> - <widget class="QGroupBox" name="groupBox_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Repair NPClient location</string> - </property> - <property name="alignment"> - <set>Qt::AlignJustify|Qt::AlignTop</set> - </property> - <property name="flat"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QPushButton" name="bntLocateNPClient"> - <property name="text"> - <string>Locate DLL</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="label_10"> - <property name="text"> - <string>Replace the registry entry if you want to use other software with the NPClient protocol and it doesn't work automatically.</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="4" column="0"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </widget> - <resources> - <include location="ft-protocol.qrc"/> - </resources> - <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UICFTControls</class> + <widget class="QWidget" name="UICFTControls"> + <property name="windowModality"> + <enum>Qt::NonModal</enum> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>489</width> + <height>402</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="windowTitle"> + <string>freetrack protocol settings</string> + </property> + <property name="windowIcon"> + <iconset resource="ft-protocol.qrc"> + <normaloff>:/images/freetrack.png</normaloff>:/images/freetrack.png</iconset> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QGroupBox" name="groupBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>TIRViews</string> + </property> + <property name="alignment"> + <set>Qt::AlignJustify|Qt::AlignTop</set> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <layout class="QFormLayout" name="formLayout_2"> + <item row="0" column="0"> + <widget class="QCheckBox" name="chkTIRViews"> + <property name="layoutDirection"> + <enum>Qt::RightToLeft</enum> + </property> + <property name="text"> + <string>Memory hacks</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Only for very old and buggy old games such as CFS3.</string> + </property> + <property name="scaledContents"> + <bool>false</bool> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="0"> + <widget class="QGroupBox" name="groupBox_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>TrackIR.exe</string> + </property> + <property name="alignment"> + <set>Qt::AlignJustify|Qt::AlignTop</set> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <layout class="QFormLayout" name="formLayout_3"> + <item row="0" column="0"> + <widget class="QCheckBox" name="chkStartDummy"> + <property name="layoutDirection"> + <enum>Qt::RightToLeft</enum> + </property> + <property name="text"> + <string>Using EZCA</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>FSX-specific EZCA protocol hacks</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="2" column="0"> + <widget class="QGroupBox" name="groupBox_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Select interface</string> + </property> + <property name="alignment"> + <set>Qt::AlignJustify|Qt::AlignTop</set> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> + <widget class="QComboBox" name="cbxSelectInterface"/> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Disable one of the protocols if game is confused by presence of both at the same time.</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="3" column="0"> + <widget class="QGroupBox" name="groupBox_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Repair NPClient location</string> + </property> + <property name="alignment"> + <set>Qt::AlignJustify|Qt::AlignTop</set> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QPushButton" name="bntLocateNPClient"> + <property name="text"> + <string>Locate DLL</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_10"> + <property name="text"> + <string>Replace the registry entry if you want to use other software with the NPClient protocol and it doesn't work automatically.</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="4" column="0"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources> + <include location="ft-protocol.qrc"/> + </resources> + <connections/> + <slots> + <slot>startEngineClicked()</slot> + <slot>stopEngineClicked()</slot> + <slot>cameraSettingsClicked()</slot> + </slots> +</ui> diff --git a/ftnoir_protocol_ftn/ftnoir_ftncontrols.ui b/ftnoir_protocol_ftn/ftnoir_ftncontrols.ui index 48679f3c..ca811e99 100644 --- a/ftnoir_protocol_ftn/ftnoir_ftncontrols.ui +++ b/ftnoir_protocol_ftn/ftnoir_ftncontrols.ui @@ -1,266 +1,266 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UICFTNControls</class> - <widget class="QWidget" name="UICFTNControls"> - <property name="windowModality"> - <enum>Qt::NonModal</enum> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>411</width> - <height>169</height> - </rect> - </property> - <property name="windowTitle"> - <string>UDP protocol settings</string> - </property> - <property name="windowIcon"> - <iconset resource="../facetracknoir/main-facetracknoir.qrc"> - <normaloff>:/images/facetracknoir.png</normaloff>:/images/facetracknoir.png</iconset> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QVBoxLayout" name="_vertical_layout"> - <item> - <layout class="QGridLayout" name="gridLayout"> - <item row="1" column="4"> - <widget class="QSpinBox" name="spinIPFourthNibble"> - <property name="maximumSize"> - <size> - <width>60</width> - <height>16777215</height> - </size> - </property> - <property name="maximum"> - <number>255</number> - </property> - <property name="singleStep"> - <number>1</number> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="spinIPFirstNibble"> - <property name="maximumSize"> - <size> - <width>60</width> - <height>16777215</height> - </size> - </property> - <property name="maximum"> - <number>255</number> - </property> - <property name="singleStep"> - <number>1</number> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QSpinBox" name="spinIPSecondNibble"> - <property name="maximumSize"> - <size> - <width>60</width> - <height>16777215</height> - </size> - </property> - <property name="maximum"> - <number>255</number> - </property> - <property name="singleStep"> - <number>1</number> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QSpinBox" name="spinIPThirdNibble"> - <property name="maximumSize"> - <size> - <width>60</width> - <height>16777215</height> - </size> - </property> - <property name="maximum"> - <number>255</number> - </property> - <property name="singleStep"> - <number>1</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>IP-address remote PC</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Port-number</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="spinPortNumber"> - <property name="minimum"> - <number>1000</number> - </property> - <property name="maximum"> - <number>10000</number> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Enter IP-address and port-number for the remote PC.</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Remember: you may have to change firewall-settings too!</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="sizeConstraint"> - <enum>QLayout::SetDefaultConstraint</enum> - </property> - <item> - <widget class="QPushButton" name="btnOK"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>OK</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnCancel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Cancel</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - <tabstops> - <tabstop>spinIPFirstNibble</tabstop> - <tabstop>spinIPSecondNibble</tabstop> - <tabstop>spinIPThirdNibble</tabstop> - <tabstop>spinIPFourthNibble</tabstop> - <tabstop>spinPortNumber</tabstop> - <tabstop>btnOK</tabstop> - <tabstop>btnCancel</tabstop> - </tabstops> - <resources> - <include location="../facetracknoir/main-facetracknoir.qrc"/> - </resources> - <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UICFTNControls</class> + <widget class="QWidget" name="UICFTNControls"> + <property name="windowModality"> + <enum>Qt::NonModal</enum> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>411</width> + <height>169</height> + </rect> + </property> + <property name="windowTitle"> + <string>UDP protocol settings</string> + </property> + <property name="windowIcon"> + <iconset resource="../facetracknoir/main-facetracknoir.qrc"> + <normaloff>:/images/facetracknoir.png</normaloff>:/images/facetracknoir.png</iconset> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <layout class="QVBoxLayout" name="_vertical_layout"> + <item> + <layout class="QGridLayout" name="gridLayout"> + <item row="1" column="4"> + <widget class="QSpinBox" name="spinIPFourthNibble"> + <property name="maximumSize"> + <size> + <width>60</width> + <height>16777215</height> + </size> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="spinIPFirstNibble"> + <property name="maximumSize"> + <size> + <width>60</width> + <height>16777215</height> + </size> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QSpinBox" name="spinIPSecondNibble"> + <property name="maximumSize"> + <size> + <width>60</width> + <height>16777215</height> + </size> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QSpinBox" name="spinIPThirdNibble"> + <property name="maximumSize"> + <size> + <width>60</width> + <height>16777215</height> + </size> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>IP-address remote PC</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Port-number</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QSpinBox" name="spinPortNumber"> + <property name="minimum"> + <number>1000</number> + </property> + <property name="maximum"> + <number>10000</number> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Enter IP-address and port-number for the remote PC.</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Remember: you may have to change firewall-settings too!</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="sizeConstraint"> + <enum>QLayout::SetDefaultConstraint</enum> + </property> + <item> + <widget class="QPushButton" name="btnOK"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>OK</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btnCancel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>10</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + <tabstops> + <tabstop>spinIPFirstNibble</tabstop> + <tabstop>spinIPSecondNibble</tabstop> + <tabstop>spinIPThirdNibble</tabstop> + <tabstop>spinIPFourthNibble</tabstop> + <tabstop>spinPortNumber</tabstop> + <tabstop>btnOK</tabstop> + <tabstop>btnCancel</tabstop> + </tabstops> + <resources> + <include location="../facetracknoir/main-facetracknoir.qrc"/> + </resources> + <connections/> + <slots> + <slot>startEngineClicked()</slot> + <slot>stopEngineClicked()</slot> + <slot>cameraSettingsClicked()</slot> + </slots> +</ui> diff --git a/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui b/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui index 2705fff7..258ed06a 100644 --- a/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui +++ b/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui @@ -1,205 +1,205 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UICMOUSEControls</class> - <widget class="QWidget" name="UICMOUSEControls"> - <property name="windowModality"> - <enum>Qt::NonModal</enum> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>257</width> - <height>114</height> - </rect> - </property> - <property name="windowTitle"> - <string>Mouse protocol settings</string> - </property> - <property name="windowIcon"> - <iconset resource="win32-mouse-protocol.qrc"> - <normaloff>:/images/mouse.png</normaloff>:/images/mouse.png</iconset> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QVBoxLayout" name="_vertical_layout"> - <item> - <layout class="QGridLayout" name="gridLayout"> - <item row="1" column="1"> - <widget class="QComboBox" name="cbxSelectMouse_Y"> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Select Number</string> - </property> - <property name="insertPolicy"> - <enum>QComboBox::InsertAlphabetically</enum> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="textLabel2_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Map mouse Y to:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="textLabel2_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Map mouse X to:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="cbxSelectMouse_X"> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Select Number</string> - </property> - <property name="insertPolicy"> - <enum>QComboBox::InsertAlphabetically</enum> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="sizeConstraint"> - <enum>QLayout::SetDefaultConstraint</enum> - </property> - <item> - <widget class="QPushButton" name="btnOK"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>OK</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnCancel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Cancel</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - <resources> - <include location="win32-mouse-protocol.qrc"/> - </resources> - <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UICMOUSEControls</class> + <widget class="QWidget" name="UICMOUSEControls"> + <property name="windowModality"> + <enum>Qt::NonModal</enum> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>257</width> + <height>114</height> + </rect> + </property> + <property name="windowTitle"> + <string>Mouse protocol settings</string> + </property> + <property name="windowIcon"> + <iconset resource="win32-mouse-protocol.qrc"> + <normaloff>:/images/mouse.png</normaloff>:/images/mouse.png</iconset> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <layout class="QVBoxLayout" name="_vertical_layout"> + <item> + <layout class="QGridLayout" name="gridLayout"> + <item row="1" column="1"> + <widget class="QComboBox" name="cbxSelectMouse_Y"> + <property name="maximumSize"> + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Select Number</string> + </property> + <property name="insertPolicy"> + <enum>QComboBox::InsertAlphabetically</enum> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="textLabel2_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Map mouse Y to:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="textLabel2_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Map mouse X to:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="cbxSelectMouse_X"> + <property name="maximumSize"> + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Select Number</string> + </property> + <property name="insertPolicy"> + <enum>QComboBox::InsertAlphabetically</enum> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="sizeConstraint"> + <enum>QLayout::SetDefaultConstraint</enum> + </property> + <item> + <widget class="QPushButton" name="btnOK"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>OK</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btnCancel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>10</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + <resources> + <include location="win32-mouse-protocol.qrc"/> + </resources> + <connections/> + <slots> + <slot>startEngineClicked()</slot> + <slot>stopEngineClicked()</slot> + <slot>cameraSettingsClicked()</slot> + </slots> +</ui> diff --git a/ftnoir_protocol_sc/ftnoir_sccontrols.ui b/ftnoir_protocol_sc/ftnoir_sccontrols.ui index 87dc8d86..5b2fd291 100644 --- a/ftnoir_protocol_sc/ftnoir_sccontrols.ui +++ b/ftnoir_protocol_sc/ftnoir_sccontrols.ui @@ -1,72 +1,72 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UICSCControls</class> - <widget class="QWidget" name="UICSCControls"> - <property name="windowModality"> - <enum>Qt::NonModal</enum> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>290</width> - <height>79</height> - </rect> - </property> - <property name="windowTitle"> - <string>SimConnect settings FaceTrackNoIR</string> - </property> - <property name="windowIcon"> - <iconset> - <normaloff>images/FaceTrackNoIR.png</normaloff>images/FaceTrackNoIR.png</iconset> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>FSX version</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="comboBox"> - <item> - <property name="text"> - <string>SP1</string> - </property> - </item> - <item> - <property name="text"> - <string>SP2</string> - </property> - </item> - <item> - <property name="text"> - <string>Acceleration</string> - </property> - </item> - </widget> - </item> - <item row="1" column="1"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UICSCControls</class> + <widget class="QWidget" name="UICSCControls"> + <property name="windowModality"> + <enum>Qt::NonModal</enum> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>290</width> + <height>79</height> + </rect> + </property> + <property name="windowTitle"> + <string>SimConnect settings FaceTrackNoIR</string> + </property> + <property name="windowIcon"> + <iconset> + <normaloff>images/FaceTrackNoIR.png</normaloff>images/FaceTrackNoIR.png</iconset> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>FSX version</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="comboBox"> + <item> + <property name="text"> + <string>SP1</string> + </property> + </item> + <item> + <property name="text"> + <string>SP2</string> + </property> + </item> + <item> + <property name="text"> + <string>Acceleration</string> + </property> + </item> + </widget> + </item> + <item row="1" column="1"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> + <slots> + <slot>startEngineClicked()</slot> + <slot>stopEngineClicked()</slot> + <slot>cameraSettingsClicked()</slot> + </slots> +</ui> diff --git a/ftnoir_tracker_aruco/trans_calib.cpp b/ftnoir_tracker_aruco/trans_calib.cpp index dd18399a..b1f956b4 100644 --- a/ftnoir_tracker_aruco/trans_calib.cpp +++ b/ftnoir_tracker_aruco/trans_calib.cpp @@ -1,44 +1,44 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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 "trans_calib.h" - -using namespace cv; - -//----------------------------------------------------------------------------- -TranslationCalibrator::TranslationCalibrator() -{ - reset(); -} - -void TranslationCalibrator::reset() -{ - P = Matx66f::zeros(); - y = Vec6f(0,0,0, 0,0,0); -} - -void TranslationCalibrator::update(const Matx33f& R_CM_k, const Vec3f& t_CM_k) -{ - Matx<float, 6,3> H_k_T = Matx<float, 6,3>::zeros(); - for (int i=0; i<3; ++i) { - for (int j=0; j<3; ++j) { - H_k_T(i,j) = R_CM_k(j,i); - } - } - for (int i=0; i<3; ++i) - { - H_k_T(3+i,i) = 1.0; - } - P += H_k_T * H_k_T.t(); - y += H_k_T * t_CM_k; -} - -Vec3f TranslationCalibrator::get_estimate() -{ - Vec6f x = P.inv() * y; - return Vec3f(x[0], x[1], x[2]); -} +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 "trans_calib.h" + +using namespace cv; + +//----------------------------------------------------------------------------- +TranslationCalibrator::TranslationCalibrator() +{ + reset(); +} + +void TranslationCalibrator::reset() +{ + P = Matx66f::zeros(); + y = Vec6f(0,0,0, 0,0,0); +} + +void TranslationCalibrator::update(const Matx33f& R_CM_k, const Vec3f& t_CM_k) +{ + Matx<float, 6,3> H_k_T = Matx<float, 6,3>::zeros(); + for (int i=0; i<3; ++i) { + for (int j=0; j<3; ++j) { + H_k_T(i,j) = R_CM_k(j,i); + } + } + for (int i=0; i<3; ++i) + { + H_k_T(3+i,i) = 1.0; + } + P += H_k_T * H_k_T.t(); + y += H_k_T * t_CM_k; +} + +Vec3f TranslationCalibrator::get_estimate() +{ + Vec6f x = P.inv() * y; + return Vec3f(x[0], x[1], x[2]); +} diff --git a/ftnoir_tracker_aruco/trans_calib.h b/ftnoir_tracker_aruco/trans_calib.h index f2521690..609c9af1 100644 --- a/ftnoir_tracker_aruco/trans_calib.h +++ b/ftnoir_tracker_aruco/trans_calib.h @@ -1,39 +1,39 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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. - */ - -#ifndef TRANSCALIB_H -#define TRANSCALIB_H - -#include <opencv2/opencv.hpp> - -//----------------------------------------------------------------------------- -// Calibrates the translation from head to model = t_MH -// by recursive least squares / -// kalman filter in information form with identity noise covariance -// measurement equation when head position = t_CH is fixed: -// (R_CM_k , Id)*(-t_MH, t_CH) = t_CM_k - -class TranslationCalibrator -{ -public: - TranslationCalibrator(); - - // reset the calibration process - void reset(); - - // update the current estimate - void update(const cv::Matx33f& R_CM_k, const cv::Vec3f& t_CM_k); - - // get the current estimate for t_MH - cv::Vec3f get_estimate(); - -protected: - cv::Matx66f P; // normalized precision matrix = inverse covariance - cv::Vec6f y; // P*(-t_MH, t_CH) -}; - +/* Copyright (c) 2012 Patrick Ruoff + * + * 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. + */ + +#ifndef TRANSCALIB_H +#define TRANSCALIB_H + +#include <opencv2/opencv.hpp> + +//----------------------------------------------------------------------------- +// Calibrates the translation from head to model = t_MH +// by recursive least squares / +// kalman filter in information form with identity noise covariance +// measurement equation when head position = t_CH is fixed: +// (R_CM_k , Id)*(-t_MH, t_CH) = t_CM_k + +class TranslationCalibrator +{ +public: + TranslationCalibrator(); + + // reset the calibration process + void reset(); + + // update the current estimate + void update(const cv::Matx33f& R_CM_k, const cv::Vec3f& t_CM_k); + + // get the current estimate for t_MH + cv::Vec3f get_estimate(); + +protected: + cv::Matx66f P; // normalized precision matrix = inverse covariance + cv::Vec6f y; // P*(-t_MH, t_CH) +}; + #endif //TRANSCALIB_H \ No newline at end of file diff --git a/ftnoir_tracker_freepie-udp/freepie-udp-controls.ui b/ftnoir_tracker_freepie-udp/freepie-udp-controls.ui index 9870372a..48290bf2 100644 --- a/ftnoir_tracker_freepie-udp/freepie-udp-controls.ui +++ b/ftnoir_tracker_freepie-udp/freepie-udp-controls.ui @@ -1,69 +1,69 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UI_freepie_udp_dialog</class> - <widget class="QWidget" name="UI_freepie_udp_dialog"> - <property name="windowModality"> - <enum>Qt::NonModal</enum> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>198</width> - <height>71</height> - </rect> - </property> - <property name="windowTitle"> - <string>UDP tracker settings</string> - </property> - <property name="windowIcon"> - <iconset> - <normaloff>../facetracknoir/images/facetracknoir.png</normaloff>../facetracknoir/images/facetracknoir.png</iconset> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label_5"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>UDP port</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="port"> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - </item> - <item row="1" column="0" colspan="2"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UI_freepie_udp_dialog</class> + <widget class="QWidget" name="UI_freepie_udp_dialog"> + <property name="windowModality"> + <enum>Qt::NonModal</enum> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>198</width> + <height>71</height> + </rect> + </property> + <property name="windowTitle"> + <string>UDP tracker settings</string> + </property> + <property name="windowIcon"> + <iconset> + <normaloff>../facetracknoir/images/facetracknoir.png</normaloff>../facetracknoir/images/facetracknoir.png</iconset> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label_5"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>UDP port</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="port"> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + </item> + <item row="1" column="0" colspan="2"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> + <slots> + <slot>startEngineClicked()</slot> + <slot>stopEngineClicked()</slot> + <slot>cameraSettingsClicked()</slot> + </slots> +</ui> diff --git a/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui b/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui index f485e67f..4a5624cf 100644 --- a/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui +++ b/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui @@ -1,66 +1,66 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UICFTNClientControls</class> - <widget class="QWidget" name="UICFTNClientControls"> - <property name="windowModality"> - <enum>Qt::NonModal</enum> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>216</width> - <height>71</height> - </rect> - </property> - <property name="windowTitle"> - <string>UDP tracker settings</string> - </property> - <property name="windowIcon"> - <iconset> - <normaloff>../facetracknoir/images/facetracknoir.png</normaloff>../facetracknoir/images/facetracknoir.png</iconset> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Port</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="spinPortNumber"> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </widget> - <tabstops> - <tabstop>spinPortNumber</tabstop> - </tabstops> - <resources/> - <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UICFTNClientControls</class> + <widget class="QWidget" name="UICFTNClientControls"> + <property name="windowModality"> + <enum>Qt::NonModal</enum> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>216</width> + <height>71</height> + </rect> + </property> + <property name="windowTitle"> + <string>UDP tracker settings</string> + </property> + <property name="windowIcon"> + <iconset> + <normaloff>../facetracknoir/images/facetracknoir.png</normaloff>../facetracknoir/images/facetracknoir.png</iconset> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Port</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="spinPortNumber"> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <tabstops> + <tabstop>spinPortNumber</tabstop> + </tabstops> + <resources/> + <connections/> + <slots> + <slot>startEngineClicked()</slot> + <slot>stopEngineClicked()</slot> + <slot>cameraSettingsClicked()</slot> + </slots> +</ui> diff --git a/qxt-mini/plat/qxtglobalshortcut_mac.cpp b/qxt-mini/plat/qxtglobalshortcut_mac.cpp index f43c773a..fbf86a94 100644 --- a/qxt-mini/plat/qxtglobalshortcut_mac.cpp +++ b/qxt-mini/plat/qxtglobalshortcut_mac.cpp @@ -1,4 +1,4 @@ -#include <Carbon/Carbon.h> +#include <Carbon/Carbon.h> /**************************************************************************** ** Copyright (c) 2006 - 2011, the LibQxt project. ** See the Qxt AUTHORS file for a list of authors and copyright holders. @@ -29,235 +29,235 @@ ** <http://libqxt.org> <foundation@libqxt.org> *****************************************************************************/ -#include "qxtglobalshortcut_p.h" -#include <QMap> -#include <QHash> -#include <QtDebug> -#include <QApplication> - -typedef QPair<uint, uint> Identifier; -static QMap<quint32, EventHotKeyRef> keyRefs; -static QHash<Identifier, quint32> keyIDs; -static quint32 hotKeySerial = 0; -static bool qxt_mac_handler_installed = false; - -OSStatus qxt_mac_handle_hot_key(EventHandlerCallRef nextHandler, EventRef event, void* data) -{ - Q_UNUSED(nextHandler); - Q_UNUSED(data); - if (GetEventClass(event) == kEventClassKeyboard && GetEventKind(event) == kEventHotKeyPressed) - { - EventHotKeyID keyID; - GetEventParameter(event, kEventParamDirectObject, typeEventHotKeyID, NULL, sizeof(keyID), NULL, &keyID); - Identifier id = keyIDs.key(keyID.id); +#include "qxtglobalshortcut_p.h" +#include <QMap> +#include <QHash> +#include <QtDebug> +#include <QApplication> + +typedef QPair<uint, uint> Identifier; +static QMap<quint32, EventHotKeyRef> keyRefs; +static QHash<Identifier, quint32> keyIDs; +static quint32 hotKeySerial = 0; +static bool qxt_mac_handler_installed = false; + +OSStatus qxt_mac_handle_hot_key(EventHandlerCallRef nextHandler, EventRef event, void* data) +{ + Q_UNUSED(nextHandler); + Q_UNUSED(data); + if (GetEventClass(event) == kEventClassKeyboard && GetEventKind(event) == kEventHotKeyPressed) + { + EventHotKeyID keyID; + GetEventParameter(event, kEventParamDirectObject, typeEventHotKeyID, NULL, sizeof(keyID), NULL, &keyID); + Identifier id = keyIDs.key(keyID.id); if(id != Identifier()) - QxtGlobalShortcutPrivate::activateShortcut(id.second, id.first); - } - return noErr; -} - -quint32 QxtGlobalShortcutPrivate::nativeModifiers(Qt::KeyboardModifiers modifiers) -{ - quint32 native = 0; - if (modifiers & Qt::ShiftModifier) - native |= shiftKey; - if (modifiers & Qt::ControlModifier) - native |= cmdKey; - if (modifiers & Qt::AltModifier) - native |= optionKey; - if (modifiers & Qt::MetaModifier) - native |= controlKey; - if (modifiers & Qt::KeypadModifier) - native |= kEventKeyModifierNumLockMask; - return native; -} - -quint32 QxtGlobalShortcutPrivate::nativeKeycode(Qt::Key key) -{ - UTF16Char ch; - // Constants found in NSEvent.h from AppKit.framework - switch (key) - { - case Qt::Key_Return: - return kVK_Return; - case Qt::Key_Enter: - return kVK_ANSI_KeypadEnter; - case Qt::Key_Tab: - return kVK_Tab; - case Qt::Key_Space: - return kVK_Space; - case Qt::Key_Backspace: - return kVK_Delete; - case Qt::Key_Control: - return kVK_Command; - case Qt::Key_Shift: - return kVK_Shift; - case Qt::Key_CapsLock: - return kVK_CapsLock; - case Qt::Key_Option: - return kVK_Option; - case Qt::Key_Meta: - return kVK_Control; - case Qt::Key_F17: - return kVK_F17; - case Qt::Key_VolumeUp: - return kVK_VolumeUp; - case Qt::Key_VolumeDown: - return kVK_VolumeDown; - case Qt::Key_F18: - return kVK_F18; - case Qt::Key_F19: - return kVK_F19; - case Qt::Key_F20: - return kVK_F20; - case Qt::Key_F5: - return kVK_F5; - case Qt::Key_F6: - return kVK_F6; - case Qt::Key_F7: - return kVK_F7; - case Qt::Key_F3: - return kVK_F3; - case Qt::Key_F8: - return kVK_F8; - case Qt::Key_F9: - return kVK_F9; - case Qt::Key_F11: - return kVK_F11; - case Qt::Key_F13: - return kVK_F13; - case Qt::Key_F16: - return kVK_F16; - case Qt::Key_F14: - return kVK_F14; - case Qt::Key_F10: - return kVK_F10; - case Qt::Key_F12: - return kVK_F12; - case Qt::Key_F15: - return kVK_F15; - case Qt::Key_Help: - return kVK_Help; - case Qt::Key_Home: - return kVK_Home; - case Qt::Key_PageUp: - return kVK_PageUp; - case Qt::Key_Delete: - return kVK_ForwardDelete; - case Qt::Key_F4: - return kVK_F4; - case Qt::Key_End: - return kVK_End; - case Qt::Key_F2: - return kVK_F2; - case Qt::Key_PageDown: - return kVK_PageDown; - case Qt::Key_F1: - return kVK_F1; - case Qt::Key_Left: - return kVK_LeftArrow; - case Qt::Key_Right: - return kVK_RightArrow; - case Qt::Key_Down: - return kVK_DownArrow; - case Qt::Key_Up: - return kVK_UpArrow; - default: - ; - } - - if (key == Qt::Key_Escape) ch = 27; - else if (key == Qt::Key_Return) ch = 13; - else if (key == Qt::Key_Enter) ch = 3; - else if (key == Qt::Key_Tab) ch = 9; - else ch = key; - - CFDataRef currentLayoutData; - TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource(); - - if (currentKeyboard == NULL) - return 0; - - currentLayoutData = (CFDataRef)TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData); - CFRelease(currentKeyboard); - if (currentLayoutData == NULL) - return 0; - - UCKeyboardLayout* header = (UCKeyboardLayout*)CFDataGetBytePtr(currentLayoutData); - UCKeyboardTypeHeader* table = header->keyboardTypeList; - - uint8_t *data = (uint8_t*)header; - // God, would a little documentation for this shit kill you... - for (quint32 i=0; i < header->keyboardTypeCount; i++) - { - UCKeyStateRecordsIndex* stateRec = 0; - if (table[i].keyStateRecordsIndexOffset != 0) - { - stateRec = reinterpret_cast<UCKeyStateRecordsIndex*>(data + table[i].keyStateRecordsIndexOffset); - if (stateRec->keyStateRecordsIndexFormat != kUCKeyStateRecordsIndexFormat) stateRec = 0; - } - - UCKeyToCharTableIndex* charTable = reinterpret_cast<UCKeyToCharTableIndex*>(data + table[i].keyToCharTableIndexOffset); - if (charTable->keyToCharTableIndexFormat != kUCKeyToCharTableIndexFormat) continue; - - for (quint32 j=0; j < charTable->keyToCharTableCount; j++) - { - UCKeyOutput* keyToChar = reinterpret_cast<UCKeyOutput*>(data + charTable->keyToCharTableOffsets[j]); - for (quint32 k=0; k < charTable->keyToCharTableSize; k++) - { - if (keyToChar[k] & kUCKeyOutputTestForIndexMask) - { - long idx = keyToChar[k] & kUCKeyOutputGetIndexMask; - if (stateRec && idx < stateRec->keyStateRecordCount) - { - UCKeyStateRecord* rec = reinterpret_cast<UCKeyStateRecord*>(data + stateRec->keyStateRecordOffsets[idx]); - if (rec->stateZeroCharData == ch) return k; - } - } - else if (!(keyToChar[k] & kUCKeyOutputSequenceIndexMask) && keyToChar[k] < 0xFFFE) - { - if (keyToChar[k] == ch) return k; - } - } // for k - } // for j - } // for i - return 0; -} - -bool QxtGlobalShortcutPrivate::registerShortcut(quint32 nativeKey, quint32 nativeMods) -{ - if (!qxt_mac_handler_installed) - { + QxtGlobalShortcutPrivate::activateShortcut(id.second, id.first); + } + return noErr; +} + +quint32 QxtGlobalShortcutPrivate::nativeModifiers(Qt::KeyboardModifiers modifiers) +{ + quint32 native = 0; + if (modifiers & Qt::ShiftModifier) + native |= shiftKey; + if (modifiers & Qt::ControlModifier) + native |= cmdKey; + if (modifiers & Qt::AltModifier) + native |= optionKey; + if (modifiers & Qt::MetaModifier) + native |= controlKey; + if (modifiers & Qt::KeypadModifier) + native |= kEventKeyModifierNumLockMask; + return native; +} + +quint32 QxtGlobalShortcutPrivate::nativeKeycode(Qt::Key key) +{ + UTF16Char ch; + // Constants found in NSEvent.h from AppKit.framework + switch (key) + { + case Qt::Key_Return: + return kVK_Return; + case Qt::Key_Enter: + return kVK_ANSI_KeypadEnter; + case Qt::Key_Tab: + return kVK_Tab; + case Qt::Key_Space: + return kVK_Space; + case Qt::Key_Backspace: + return kVK_Delete; + case Qt::Key_Control: + return kVK_Command; + case Qt::Key_Shift: + return kVK_Shift; + case Qt::Key_CapsLock: + return kVK_CapsLock; + case Qt::Key_Option: + return kVK_Option; + case Qt::Key_Meta: + return kVK_Control; + case Qt::Key_F17: + return kVK_F17; + case Qt::Key_VolumeUp: + return kVK_VolumeUp; + case Qt::Key_VolumeDown: + return kVK_VolumeDown; + case Qt::Key_F18: + return kVK_F18; + case Qt::Key_F19: + return kVK_F19; + case Qt::Key_F20: + return kVK_F20; + case Qt::Key_F5: + return kVK_F5; + case Qt::Key_F6: + return kVK_F6; + case Qt::Key_F7: + return kVK_F7; + case Qt::Key_F3: + return kVK_F3; + case Qt::Key_F8: + return kVK_F8; + case Qt::Key_F9: + return kVK_F9; + case Qt::Key_F11: + return kVK_F11; + case Qt::Key_F13: + return kVK_F13; + case Qt::Key_F16: + return kVK_F16; + case Qt::Key_F14: + return kVK_F14; + case Qt::Key_F10: + return kVK_F10; + case Qt::Key_F12: + return kVK_F12; + case Qt::Key_F15: + return kVK_F15; + case Qt::Key_Help: + return kVK_Help; + case Qt::Key_Home: + return kVK_Home; + case Qt::Key_PageUp: + return kVK_PageUp; + case Qt::Key_Delete: + return kVK_ForwardDelete; + case Qt::Key_F4: + return kVK_F4; + case Qt::Key_End: + return kVK_End; + case Qt::Key_F2: + return kVK_F2; + case Qt::Key_PageDown: + return kVK_PageDown; + case Qt::Key_F1: + return kVK_F1; + case Qt::Key_Left: + return kVK_LeftArrow; + case Qt::Key_Right: + return kVK_RightArrow; + case Qt::Key_Down: + return kVK_DownArrow; + case Qt::Key_Up: + return kVK_UpArrow; + default: + ; + } + + if (key == Qt::Key_Escape) ch = 27; + else if (key == Qt::Key_Return) ch = 13; + else if (key == Qt::Key_Enter) ch = 3; + else if (key == Qt::Key_Tab) ch = 9; + else ch = key; + + CFDataRef currentLayoutData; + TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource(); + + if (currentKeyboard == NULL) + return 0; + + currentLayoutData = (CFDataRef)TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData); + CFRelease(currentKeyboard); + if (currentLayoutData == NULL) + return 0; + + UCKeyboardLayout* header = (UCKeyboardLayout*)CFDataGetBytePtr(currentLayoutData); + UCKeyboardTypeHeader* table = header->keyboardTypeList; + + uint8_t *data = (uint8_t*)header; + // God, would a little documentation for this shit kill you... + for (quint32 i=0; i < header->keyboardTypeCount; i++) + { + UCKeyStateRecordsIndex* stateRec = 0; + if (table[i].keyStateRecordsIndexOffset != 0) + { + stateRec = reinterpret_cast<UCKeyStateRecordsIndex*>(data + table[i].keyStateRecordsIndexOffset); + if (stateRec->keyStateRecordsIndexFormat != kUCKeyStateRecordsIndexFormat) stateRec = 0; + } + + UCKeyToCharTableIndex* charTable = reinterpret_cast<UCKeyToCharTableIndex*>(data + table[i].keyToCharTableIndexOffset); + if (charTable->keyToCharTableIndexFormat != kUCKeyToCharTableIndexFormat) continue; + + for (quint32 j=0; j < charTable->keyToCharTableCount; j++) + { + UCKeyOutput* keyToChar = reinterpret_cast<UCKeyOutput*>(data + charTable->keyToCharTableOffsets[j]); + for (quint32 k=0; k < charTable->keyToCharTableSize; k++) + { + if (keyToChar[k] & kUCKeyOutputTestForIndexMask) + { + long idx = keyToChar[k] & kUCKeyOutputGetIndexMask; + if (stateRec && idx < stateRec->keyStateRecordCount) + { + UCKeyStateRecord* rec = reinterpret_cast<UCKeyStateRecord*>(data + stateRec->keyStateRecordOffsets[idx]); + if (rec->stateZeroCharData == ch) return k; + } + } + else if (!(keyToChar[k] & kUCKeyOutputSequenceIndexMask) && keyToChar[k] < 0xFFFE) + { + if (keyToChar[k] == ch) return k; + } + } // for k + } // for j + } // for i + return 0; +} + +bool QxtGlobalShortcutPrivate::registerShortcut(quint32 nativeKey, quint32 nativeMods) +{ + if (!qxt_mac_handler_installed) + { qxt_mac_handler_installed = true; - EventTypeSpec t; - t.eventClass = kEventClassKeyboard; - t.eventKind = kEventHotKeyPressed; - InstallApplicationEventHandler(&qxt_mac_handle_hot_key, 1, &t, NULL, NULL); - } - - EventHotKeyID keyID; - keyID.signature = 'cute'; - keyID.id = ++hotKeySerial; - - EventHotKeyRef ref = 0; - bool rv = !RegisterEventHotKey(nativeKey, nativeMods, keyID, GetApplicationEventTarget(), 0, &ref); - if (rv) - { - keyIDs.insert(Identifier(nativeMods, nativeKey), keyID.id); - keyRefs.insert(keyID.id, ref); - } - return rv; -} - -bool QxtGlobalShortcutPrivate::unregisterShortcut(quint32 nativeKey, quint32 nativeMods) -{ - Identifier id(nativeMods, nativeKey); - if (!keyIDs.contains(id)) return false; - - EventHotKeyRef ref = keyRefs.take(keyIDs[id]); - keyIDs.remove(id); - return !UnregisterEventHotKey(ref); -} + EventTypeSpec t; + t.eventClass = kEventClassKeyboard; + t.eventKind = kEventHotKeyPressed; + InstallApplicationEventHandler(&qxt_mac_handle_hot_key, 1, &t, NULL, NULL); + } + + EventHotKeyID keyID; + keyID.signature = 'cute'; + keyID.id = ++hotKeySerial; + + EventHotKeyRef ref = 0; + bool rv = !RegisterEventHotKey(nativeKey, nativeMods, keyID, GetApplicationEventTarget(), 0, &ref); + if (rv) + { + keyIDs.insert(Identifier(nativeMods, nativeKey), keyID.id); + keyRefs.insert(keyID.id, ref); + } + return rv; +} + +bool QxtGlobalShortcutPrivate::unregisterShortcut(quint32 nativeKey, quint32 nativeMods) +{ + Identifier id(nativeMods, nativeKey); + if (!keyIDs.contains(id)) return false; + + EventHotKeyRef ref = keyRefs.take(keyIDs[id]); + keyIDs.remove(id); + return !UnregisterEventHotKey(ref); +} bool QxtGlobalShortcutPrivate::nativeEventFilter(const QByteArray & eventType, void *message, long *result) { diff --git a/qxt-mini/plat/qxtglobalshortcut_x11.cpp b/qxt-mini/plat/qxtglobalshortcut_x11.cpp index 0c203dd8..f18f86db 100644 --- a/qxt-mini/plat/qxtglobalshortcut_x11.cpp +++ b/qxt-mini/plat/qxtglobalshortcut_x11.cpp @@ -1,235 +1,235 @@ -#include "../qxtglobalshortcut_p.h" -/**************************************************************************** -** Copyright (c) 2006 - 2011, the LibQxt project. -** See the Qxt AUTHORS file for a list of authors and copyright holders. -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** * Neither the name of the LibQxt project nor the -** names of its contributors may be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -** DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY -** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -** -** <http://libqxt.org> <foundation@libqxt.org> -*****************************************************************************/ - -#include <QVector> -#include <QApplication> -// include private header for great justice -sh 20131015 -#include <X11/Xlib.h> -#include <xcb/xcb.h> -#include "qplatformnativeinterface.h" - -namespace { - -const QVector<quint32> maskModifiers = QVector<quint32>() - << 0 << Mod2Mask << LockMask << (Mod2Mask | LockMask); - -typedef int (*X11ErrorHandler)(Display *display, XErrorEvent *event); - -class QxtX11ErrorHandler { -public: - static bool error; - - static int qxtX11ErrorHandler(Display *display, XErrorEvent *event) - { - Q_UNUSED(display); - switch (event->error_code) - { - case BadAccess: - case BadValue: - case BadWindow: - if (event->request_code == 33 /* X_GrabKey */ || - event->request_code == 34 /* X_UngrabKey */) - { - error = true; - //TODO: - //char errstr[256]; - //XGetErrorText(dpy, err->error_code, errstr, 256); - } - } - return 0; - } - - QxtX11ErrorHandler() - { - error = false; - m_previousErrorHandler = XSetErrorHandler(qxtX11ErrorHandler); - } - - ~QxtX11ErrorHandler() - { - XSetErrorHandler(m_previousErrorHandler); - } - -private: - X11ErrorHandler m_previousErrorHandler; -}; - -bool QxtX11ErrorHandler::error = false; - -class QxtX11Data { -public: - QxtX11Data() - { -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) - m_display = QX11Info::display(); -#else - QPlatformNativeInterface *native = qApp->platformNativeInterface(); - void *display = native->nativeResourceForScreen(QByteArray("display"), - QGuiApplication::primaryScreen()); - m_display = reinterpret_cast<Display *>(display); -#endif - } - - bool isValid() - { - return m_display != 0; - } - - Display *display() - { - Q_ASSERT(isValid()); - return m_display; - } - - Window rootWindow() - { - return DefaultRootWindow(display()); - } - - bool grabKey(quint32 keycode, quint32 modifiers, Window window) - { - QxtX11ErrorHandler errorHandler; - - for (int i = 0; !errorHandler.error && i < maskModifiers.size(); ++i) { - XGrabKey(display(), keycode, modifiers | maskModifiers[i], window, True, - GrabModeAsync, GrabModeAsync); - } - - if (errorHandler.error) { - ungrabKey(keycode, modifiers, window); - return false; - } - - return true; - } - - bool ungrabKey(quint32 keycode, quint32 modifiers, Window window) - { - QxtX11ErrorHandler errorHandler; - - foreach (quint32 maskMods, maskModifiers) { - XUngrabKey(display(), keycode, modifiers | maskMods, window); - } - - return !errorHandler.error; - } - -private: - Display *m_display; -}; - -} // namespace - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -bool QxtGlobalShortcutPrivate::eventFilter(void *message) -{ - XEvent *event = static_cast<XEvent *>(message); - if (event->type == KeyPress) - { - XKeyEvent *key = reinterpret_cast<XKeyEvent *>(event); - unsigned int keycode = key->keycode; - unsigned int keystate = key->state; -#else -bool QxtGlobalShortcutPrivate::nativeEventFilter(const QByteArray & eventType, - void *message, long *result) -{ - Q_UNUSED(result); - - xcb_key_press_event_t *kev = 0; - if (eventType == "xcb_generic_event_t") { - xcb_generic_event_t *ev = static_cast<xcb_generic_event_t *>(message); - if ((ev->response_type & 127) == XCB_KEY_PRESS) - kev = static_cast<xcb_key_press_event_t *>(message); - } - - if (kev != 0) { - unsigned int keycode = kev->detail; - unsigned int keystate = 0; - if(kev->state & XCB_MOD_MASK_1) - keystate |= Mod1Mask; - if(kev->state & XCB_MOD_MASK_CONTROL) - keystate |= ControlMask; - if(kev->state & XCB_MOD_MASK_4) - keystate |= Mod4Mask; - if(kev->state & XCB_MOD_MASK_SHIFT) - keystate |= ShiftMask; -#endif - activateShortcut(keycode, - // Mod1Mask == Alt, Mod4Mask == Meta - keystate & (ShiftMask | ControlMask | Mod1Mask | Mod4Mask)); - } - return false; -} - -quint32 QxtGlobalShortcutPrivate::nativeModifiers(Qt::KeyboardModifiers modifiers) -{ - // ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, and Mod5Mask - quint32 native = 0; - if (modifiers & Qt::ShiftModifier) - native |= ShiftMask; - if (modifiers & Qt::ControlModifier) - native |= ControlMask; - if (modifiers & Qt::AltModifier) - native |= Mod1Mask; - if (modifiers & Qt::MetaModifier) - native |= Mod4Mask; - - // TODO: resolve these? - //if (modifiers & Qt::MetaModifier) - //if (modifiers & Qt::KeypadModifier) - //if (modifiers & Qt::GroupSwitchModifier) - return native; -} - -quint32 QxtGlobalShortcutPrivate::nativeKeycode(Qt::Key key) -{ - QxtX11Data x11; - if (!x11.isValid()) - return 0; - - KeySym keysym = XStringToKeysym(QKeySequence(key).toString().toLatin1().data()); - if (keysym == NoSymbol) - keysym = static_cast<ushort>(key); - - return XKeysymToKeycode(x11.display(), keysym); -} - -bool QxtGlobalShortcutPrivate::registerShortcut(quint32 nativeKey, quint32 nativeMods) -{ - QxtX11Data x11; - return x11.isValid() && x11.grabKey(nativeKey, nativeMods, x11.rootWindow()); -} - -bool QxtGlobalShortcutPrivate::unregisterShortcut(quint32 nativeKey, quint32 nativeMods) -{ - QxtX11Data x11; - return x11.isValid() && x11.ungrabKey(nativeKey, nativeMods, x11.rootWindow()); -} +#include "../qxtglobalshortcut_p.h" +/**************************************************************************** +** Copyright (c) 2006 - 2011, the LibQxt project. +** See the Qxt AUTHORS file for a list of authors and copyright holders. +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** * Neither the name of the LibQxt project nor the +** names of its contributors may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY +** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +** <http://libqxt.org> <foundation@libqxt.org> +*****************************************************************************/ + +#include <QVector> +#include <QApplication> +// include private header for great justice -sh 20131015 +#include <X11/Xlib.h> +#include <xcb/xcb.h> +#include "qplatformnativeinterface.h" + +namespace { + +const QVector<quint32> maskModifiers = QVector<quint32>() + << 0 << Mod2Mask << LockMask << (Mod2Mask | LockMask); + +typedef int (*X11ErrorHandler)(Display *display, XErrorEvent *event); + +class QxtX11ErrorHandler { +public: + static bool error; + + static int qxtX11ErrorHandler(Display *display, XErrorEvent *event) + { + Q_UNUSED(display); + switch (event->error_code) + { + case BadAccess: + case BadValue: + case BadWindow: + if (event->request_code == 33 /* X_GrabKey */ || + event->request_code == 34 /* X_UngrabKey */) + { + error = true; + //TODO: + //char errstr[256]; + //XGetErrorText(dpy, err->error_code, errstr, 256); + } + } + return 0; + } + + QxtX11ErrorHandler() + { + error = false; + m_previousErrorHandler = XSetErrorHandler(qxtX11ErrorHandler); + } + + ~QxtX11ErrorHandler() + { + XSetErrorHandler(m_previousErrorHandler); + } + +private: + X11ErrorHandler m_previousErrorHandler; +}; + +bool QxtX11ErrorHandler::error = false; + +class QxtX11Data { +public: + QxtX11Data() + { +#if QT_VERSION < QT_VERSION_CHECK(5,0,0) + m_display = QX11Info::display(); +#else + QPlatformNativeInterface *native = qApp->platformNativeInterface(); + void *display = native->nativeResourceForScreen(QByteArray("display"), + QGuiApplication::primaryScreen()); + m_display = reinterpret_cast<Display *>(display); +#endif + } + + bool isValid() + { + return m_display != 0; + } + + Display *display() + { + Q_ASSERT(isValid()); + return m_display; + } + + Window rootWindow() + { + return DefaultRootWindow(display()); + } + + bool grabKey(quint32 keycode, quint32 modifiers, Window window) + { + QxtX11ErrorHandler errorHandler; + + for (int i = 0; !errorHandler.error && i < maskModifiers.size(); ++i) { + XGrabKey(display(), keycode, modifiers | maskModifiers[i], window, True, + GrabModeAsync, GrabModeAsync); + } + + if (errorHandler.error) { + ungrabKey(keycode, modifiers, window); + return false; + } + + return true; + } + + bool ungrabKey(quint32 keycode, quint32 modifiers, Window window) + { + QxtX11ErrorHandler errorHandler; + + foreach (quint32 maskMods, maskModifiers) { + XUngrabKey(display(), keycode, modifiers | maskMods, window); + } + + return !errorHandler.error; + } + +private: + Display *m_display; +}; + +} // namespace + +#if QT_VERSION < QT_VERSION_CHECK(5,0,0) +bool QxtGlobalShortcutPrivate::eventFilter(void *message) +{ + XEvent *event = static_cast<XEvent *>(message); + if (event->type == KeyPress) + { + XKeyEvent *key = reinterpret_cast<XKeyEvent *>(event); + unsigned int keycode = key->keycode; + unsigned int keystate = key->state; +#else +bool QxtGlobalShortcutPrivate::nativeEventFilter(const QByteArray & eventType, + void *message, long *result) +{ + Q_UNUSED(result); + + xcb_key_press_event_t *kev = 0; + if (eventType == "xcb_generic_event_t") { + xcb_generic_event_t *ev = static_cast<xcb_generic_event_t *>(message); + if ((ev->response_type & 127) == XCB_KEY_PRESS) + kev = static_cast<xcb_key_press_event_t *>(message); + } + + if (kev != 0) { + unsigned int keycode = kev->detail; + unsigned int keystate = 0; + if(kev->state & XCB_MOD_MASK_1) + keystate |= Mod1Mask; + if(kev->state & XCB_MOD_MASK_CONTROL) + keystate |= ControlMask; + if(kev->state & XCB_MOD_MASK_4) + keystate |= Mod4Mask; + if(kev->state & XCB_MOD_MASK_SHIFT) + keystate |= ShiftMask; +#endif + activateShortcut(keycode, + // Mod1Mask == Alt, Mod4Mask == Meta + keystate & (ShiftMask | ControlMask | Mod1Mask | Mod4Mask)); + } + return false; +} + +quint32 QxtGlobalShortcutPrivate::nativeModifiers(Qt::KeyboardModifiers modifiers) +{ + // ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, and Mod5Mask + quint32 native = 0; + if (modifiers & Qt::ShiftModifier) + native |= ShiftMask; + if (modifiers & Qt::ControlModifier) + native |= ControlMask; + if (modifiers & Qt::AltModifier) + native |= Mod1Mask; + if (modifiers & Qt::MetaModifier) + native |= Mod4Mask; + + // TODO: resolve these? + //if (modifiers & Qt::MetaModifier) + //if (modifiers & Qt::KeypadModifier) + //if (modifiers & Qt::GroupSwitchModifier) + return native; +} + +quint32 QxtGlobalShortcutPrivate::nativeKeycode(Qt::Key key) +{ + QxtX11Data x11; + if (!x11.isValid()) + return 0; + + KeySym keysym = XStringToKeysym(QKeySequence(key).toString().toLatin1().data()); + if (keysym == NoSymbol) + keysym = static_cast<ushort>(key); + + return XKeysymToKeycode(x11.display(), keysym); +} + +bool QxtGlobalShortcutPrivate::registerShortcut(quint32 nativeKey, quint32 nativeMods) +{ + QxtX11Data x11; + return x11.isValid() && x11.grabKey(nativeKey, nativeMods, x11.rootWindow()); +} + +bool QxtGlobalShortcutPrivate::unregisterShortcut(quint32 nativeKey, quint32 nativeMods) +{ + QxtX11Data x11; + return x11.isValid() && x11.ungrabKey(nativeKey, nativeMods, x11.rootWindow()); +} diff --git a/qxt-mini/qxtglobalshortcut.cpp b/qxt-mini/qxtglobalshortcut.cpp index 8515a6b2..45576d37 100644 --- a/qxt-mini/qxtglobalshortcut.cpp +++ b/qxt-mini/qxtglobalshortcut.cpp @@ -1,224 +1,224 @@ -#include "qxtglobalshortcut.h" -/**************************************************************************** -** Copyright (c) 2006 - 2011, the LibQxt project. -** See the Qxt AUTHORS file for a list of authors and copyright holders. -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** * Neither the name of the LibQxt project nor the -** names of its contributors may be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -** DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY -** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -** -** <http://libqxt.org> <foundation@libqxt.org> -*****************************************************************************/ - -#include "qxtglobalshortcut_p.h" -#include <QAbstractEventDispatcher> -#include <QtDebug> - -#ifndef Q_OS_MAC -int QxtGlobalShortcutPrivate::ref = 0; -# if QT_VERSION < QT_VERSION_CHECK(5,0,0) -QAbstractEventDispatcher::EventFilter QxtGlobalShortcutPrivate::prevEventFilter = 0; -# endif -#endif // Q_OS_MAC -QHash<QPair<quint32, quint32>, QxtGlobalShortcut*> QxtGlobalShortcutPrivate::shortcuts; - -QxtGlobalShortcutPrivate::QxtGlobalShortcutPrivate() : enabled(true), key(Qt::Key(0)), mods(Qt::NoModifier) -{ -#ifndef Q_OS_MAC - if (ref == 0) { -# if QT_VERSION < QT_VERSION_CHECK(5,0,0) - prevEventFilter = QAbstractEventDispatcher::instance()->setEventFilter(eventFilter); -# else - QAbstractEventDispatcher::instance()->installNativeEventFilter(this); -#endif - } - ++ref; -#endif // Q_OS_MAC -} - -QxtGlobalShortcutPrivate::~QxtGlobalShortcutPrivate() -{ -#ifndef Q_OS_MAC - --ref; - if (ref == 0) { - QAbstractEventDispatcher *ed = QAbstractEventDispatcher::instance(); - if (ed != 0) { -# if QT_VERSION < QT_VERSION_CHECK(5,0,0) - ed->setEventFilter(prevEventFilter); -# else - ed->removeNativeEventFilter(this); -# endif - } - } -#endif // Q_OS_MAC -} - -bool QxtGlobalShortcutPrivate::setShortcut(const QKeySequence& shortcut) -{ - if (shortcut.toString() == "") return false; - Qt::KeyboardModifiers allMods = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier; - key = shortcut.isEmpty() ? Qt::Key(0) : Qt::Key((shortcut[0] ^ allMods) & shortcut[0]); - mods = shortcut.isEmpty() ? Qt::KeyboardModifiers(0) : Qt::KeyboardModifiers(shortcut[0] & allMods); - const quint32 nativeKey = nativeKeycode(key); - const quint32 nativeMods = nativeModifiers(mods); - const bool res = registerShortcut(nativeKey, nativeMods); - if (res) - shortcuts.insert(qMakePair(nativeKey, nativeMods), &qxt_p()); - else - qWarning() << "QxtGlobalShortcut failed to register:" << QKeySequence(key + mods).toString(); - return res; -} - -bool QxtGlobalShortcutPrivate::unsetShortcut() -{ - bool res = false; - const quint32 nativeKey = nativeKeycode(key); - const quint32 nativeMods = nativeModifiers(mods); - if (shortcuts.value(qMakePair(nativeKey, nativeMods)) == &qxt_p()) - res = unregisterShortcut(nativeKey, nativeMods); - if (res) - shortcuts.remove(qMakePair(nativeKey, nativeMods)); - else - qWarning() << "QxtGlobalShortcut failed to unregister:" << QKeySequence(key + mods).toString(); - key = Qt::Key(0); - mods = Qt::KeyboardModifiers(0); - return res; -} - -void QxtGlobalShortcutPrivate::activateShortcut(quint32 nativeKey, quint32 nativeMods) -{ - QxtGlobalShortcut* shortcut = shortcuts.value(qMakePair(nativeKey, nativeMods)); - if (shortcut && shortcut->isEnabled()) - emit shortcut->activated(); -} - -/*! - \class QxtGlobalShortcut - \inmodule QxtWidgets - \brief The QxtGlobalShortcut class provides a global shortcut aka "hotkey". - - A global shortcut triggers even if the application is not active. This - makes it easy to implement applications that react to certain shortcuts - still if some other application is active or if the application is for - example minimized to the system tray. - - Example usage: - \code - QxtGlobalShortcut* shortcut = new QxtGlobalShortcut(window); - connect(shortcut, SIGNAL(activated()), window, SLOT(toggleVisibility())); - shortcut->setShortcut(QKeySequence("Ctrl+Shift+F12")); - \endcode - - \bold {Note:} Since Qxt 0.6 QxtGlobalShortcut no more requires QxtApplication. - */ - -/*! - \fn QxtGlobalShortcut::activated() - - This signal is emitted when the user types the shortcut's key sequence. - - \sa shortcut - */ - -/*! - Constructs a new QxtGlobalShortcut with \a parent. - */ -QxtGlobalShortcut::QxtGlobalShortcut(QObject* parent) - : QObject(parent) -{ - QXT_INIT_PRIVATE(QxtGlobalShortcut); -} - -/*! - Constructs a new QxtGlobalShortcut with \a shortcut and \a parent. - */ -QxtGlobalShortcut::QxtGlobalShortcut(const QKeySequence& shortcut, QObject* parent) - : QObject(parent) -{ - QXT_INIT_PRIVATE(QxtGlobalShortcut); - setShortcut(shortcut); -} - -/*! - Destructs the QxtGlobalShortcut. - */ -QxtGlobalShortcut::~QxtGlobalShortcut() -{ - if (qxt_d().key != 0) - qxt_d().unsetShortcut(); -} - -/*! - \property QxtGlobalShortcut::shortcut - \brief the shortcut key sequence - - \bold {Note:} Notice that corresponding key press and release events are not - delivered for registered global shortcuts even if they are disabled. - Also, comma separated key sequences are not supported. - Only the first part is used: - - \code - qxtShortcut->setShortcut(QKeySequence("Ctrl+Alt+A,Ctrl+Alt+B")); - Q_ASSERT(qxtShortcut->shortcut() == QKeySequence("Ctrl+Alt+A")); - \endcode - */ -QKeySequence QxtGlobalShortcut::shortcut() const -{ - return QKeySequence(qxt_d().key | qxt_d().mods); -} - -bool QxtGlobalShortcut::setShortcut(const QKeySequence& shortcut) -{ - if (qxt_d().key != 0) - qxt_d().unsetShortcut(); - return qxt_d().setShortcut(shortcut); -} - -/*! - \property QxtGlobalShortcut::enabled - \brief whether the shortcut is enabled - - A disabled shortcut does not get activated. - - The default value is \c true. - - \sa setDisabled() - */ -bool QxtGlobalShortcut::isEnabled() const -{ - return qxt_d().enabled; -} - -void QxtGlobalShortcut::setEnabled(bool enabled) -{ - qxt_d().enabled = enabled; -} - -/*! - Sets the shortcut \a disabled. - - \sa enabled - */ -void QxtGlobalShortcut::setDisabled(bool disabled) -{ - qxt_d().enabled = !disabled; -} +#include "qxtglobalshortcut.h" +/**************************************************************************** +** Copyright (c) 2006 - 2011, the LibQxt project. +** See the Qxt AUTHORS file for a list of authors and copyright holders. +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** * Neither the name of the LibQxt project nor the +** names of its contributors may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY +** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +** <http://libqxt.org> <foundation@libqxt.org> +*****************************************************************************/ + +#include "qxtglobalshortcut_p.h" +#include <QAbstractEventDispatcher> +#include <QtDebug> + +#ifndef Q_OS_MAC +int QxtGlobalShortcutPrivate::ref = 0; +# if QT_VERSION < QT_VERSION_CHECK(5,0,0) +QAbstractEventDispatcher::EventFilter QxtGlobalShortcutPrivate::prevEventFilter = 0; +# endif +#endif // Q_OS_MAC +QHash<QPair<quint32, quint32>, QxtGlobalShortcut*> QxtGlobalShortcutPrivate::shortcuts; + +QxtGlobalShortcutPrivate::QxtGlobalShortcutPrivate() : enabled(true), key(Qt::Key(0)), mods(Qt::NoModifier) +{ +#ifndef Q_OS_MAC + if (ref == 0) { +# if QT_VERSION < QT_VERSION_CHECK(5,0,0) + prevEventFilter = QAbstractEventDispatcher::instance()->setEventFilter(eventFilter); +# else + QAbstractEventDispatcher::instance()->installNativeEventFilter(this); +#endif + } + ++ref; +#endif // Q_OS_MAC +} + +QxtGlobalShortcutPrivate::~QxtGlobalShortcutPrivate() +{ +#ifndef Q_OS_MAC + --ref; + if (ref == 0) { + QAbstractEventDispatcher *ed = QAbstractEventDispatcher::instance(); + if (ed != 0) { +# if QT_VERSION < QT_VERSION_CHECK(5,0,0) + ed->setEventFilter(prevEventFilter); +# else + ed->removeNativeEventFilter(this); +# endif + } + } +#endif // Q_OS_MAC +} + +bool QxtGlobalShortcutPrivate::setShortcut(const QKeySequence& shortcut) +{ + if (shortcut.toString() == "") return false; + Qt::KeyboardModifiers allMods = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier; + key = shortcut.isEmpty() ? Qt::Key(0) : Qt::Key((shortcut[0] ^ allMods) & shortcut[0]); + mods = shortcut.isEmpty() ? Qt::KeyboardModifiers(0) : Qt::KeyboardModifiers(shortcut[0] & allMods); + const quint32 nativeKey = nativeKeycode(key); + const quint32 nativeMods = nativeModifiers(mods); + const bool res = registerShortcut(nativeKey, nativeMods); + if (res) + shortcuts.insert(qMakePair(nativeKey, nativeMods), &qxt_p()); + else + qWarning() << "QxtGlobalShortcut failed to register:" << QKeySequence(key + mods).toString(); + return res; +} + +bool QxtGlobalShortcutPrivate::unsetShortcut() +{ + bool res = false; + const quint32 nativeKey = nativeKeycode(key); + const quint32 nativeMods = nativeModifiers(mods); + if (shortcuts.value(qMakePair(nativeKey, nativeMods)) == &qxt_p()) + res = unregisterShortcut(nativeKey, nativeMods); + if (res) + shortcuts.remove(qMakePair(nativeKey, nativeMods)); + else + qWarning() << "QxtGlobalShortcut failed to unregister:" << QKeySequence(key + mods).toString(); + key = Qt::Key(0); + mods = Qt::KeyboardModifiers(0); + return res; +} + +void QxtGlobalShortcutPrivate::activateShortcut(quint32 nativeKey, quint32 nativeMods) +{ + QxtGlobalShortcut* shortcut = shortcuts.value(qMakePair(nativeKey, nativeMods)); + if (shortcut && shortcut->isEnabled()) + emit shortcut->activated(); +} + +/*! + \class QxtGlobalShortcut + \inmodule QxtWidgets + \brief The QxtGlobalShortcut class provides a global shortcut aka "hotkey". + + A global shortcut triggers even if the application is not active. This + makes it easy to implement applications that react to certain shortcuts + still if some other application is active or if the application is for + example minimized to the system tray. + + Example usage: + \code + QxtGlobalShortcut* shortcut = new QxtGlobalShortcut(window); + connect(shortcut, SIGNAL(activated()), window, SLOT(toggleVisibility())); + shortcut->setShortcut(QKeySequence("Ctrl+Shift+F12")); + \endcode + + \bold {Note:} Since Qxt 0.6 QxtGlobalShortcut no more requires QxtApplication. + */ + +/*! + \fn QxtGlobalShortcut::activated() + + This signal is emitted when the user types the shortcut's key sequence. + + \sa shortcut + */ + +/*! + Constructs a new QxtGlobalShortcut with \a parent. + */ +QxtGlobalShortcut::QxtGlobalShortcut(QObject* parent) + : QObject(parent) +{ + QXT_INIT_PRIVATE(QxtGlobalShortcut); +} + +/*! + Constructs a new QxtGlobalShortcut with \a shortcut and \a parent. + */ +QxtGlobalShortcut::QxtGlobalShortcut(const QKeySequence& shortcut, QObject* parent) + : QObject(parent) +{ + QXT_INIT_PRIVATE(QxtGlobalShortcut); + setShortcut(shortcut); +} + +/*! + Destructs the QxtGlobalShortcut. + */ +QxtGlobalShortcut::~QxtGlobalShortcut() +{ + if (qxt_d().key != 0) + qxt_d().unsetShortcut(); +} + +/*! + \property QxtGlobalShortcut::shortcut + \brief the shortcut key sequence + + \bold {Note:} Notice that corresponding key press and release events are not + delivered for registered global shortcuts even if they are disabled. + Also, comma separated key sequences are not supported. + Only the first part is used: + + \code + qxtShortcut->setShortcut(QKeySequence("Ctrl+Alt+A,Ctrl+Alt+B")); + Q_ASSERT(qxtShortcut->shortcut() == QKeySequence("Ctrl+Alt+A")); + \endcode + */ +QKeySequence QxtGlobalShortcut::shortcut() const +{ + return QKeySequence(qxt_d().key | qxt_d().mods); +} + +bool QxtGlobalShortcut::setShortcut(const QKeySequence& shortcut) +{ + if (qxt_d().key != 0) + qxt_d().unsetShortcut(); + return qxt_d().setShortcut(shortcut); +} + +/*! + \property QxtGlobalShortcut::enabled + \brief whether the shortcut is enabled + + A disabled shortcut does not get activated. + + The default value is \c true. + + \sa setDisabled() + */ +bool QxtGlobalShortcut::isEnabled() const +{ + return qxt_d().enabled; +} + +void QxtGlobalShortcut::setEnabled(bool enabled) +{ + qxt_d().enabled = enabled; +} + +/*! + Sets the shortcut \a disabled. + + \sa enabled + */ +void QxtGlobalShortcut::setDisabled(bool disabled) +{ + qxt_d().enabled = !disabled; +} diff --git a/qxt-mini/qxtglobalshortcut.h b/qxt-mini/qxtglobalshortcut.h index a81942d2..641c07c9 100644 --- a/qxt-mini/qxtglobalshortcut.h +++ b/qxt-mini/qxtglobalshortcut.h @@ -1,64 +1,64 @@ -#ifndef QXTGLOBALSHORTCUT_H -/**************************************************************************** -** Copyright (c) 2006 - 2011, the LibQxt project. -** See the Qxt AUTHORS file for a list of authors and copyright holders. -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** * Neither the name of the LibQxt project nor the -** names of its contributors may be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -** DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY -** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -** -** <http://libqxt.org> <foundation@libqxt.org> -*****************************************************************************/ - -#define QXTGLOBALSHORTCUT_H - -#include "qxtglobal.h" -#include <QObject> -#include <QKeySequence> -class QxtGlobalShortcutPrivate; - -class QXT_GUI_EXPORT QxtGlobalShortcut : public QObject -{ - Q_OBJECT - QXT_DECLARE_PRIVATE(QxtGlobalShortcut) - Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) - Q_PROPERTY(QKeySequence shortcut READ shortcut WRITE setShortcut) - -public: - explicit QxtGlobalShortcut(QObject* parent = 0); - explicit QxtGlobalShortcut(const QKeySequence& shortcut, QObject* parent = 0); - virtual ~QxtGlobalShortcut(); - - QKeySequence shortcut() const; - bool setShortcut(const QKeySequence& shortcut); - - bool isEnabled() const; - -public Q_SLOTS: - void setEnabled(bool enabled = true); - void setDisabled(bool disabled = true); - -Q_SIGNALS: - void activated(); -}; - -#endif // QXTGLOBALSHORTCUT_H +#ifndef QXTGLOBALSHORTCUT_H +/**************************************************************************** +** Copyright (c) 2006 - 2011, the LibQxt project. +** See the Qxt AUTHORS file for a list of authors and copyright holders. +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** * Neither the name of the LibQxt project nor the +** names of its contributors may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY +** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +** <http://libqxt.org> <foundation@libqxt.org> +*****************************************************************************/ + +#define QXTGLOBALSHORTCUT_H + +#include "qxtglobal.h" +#include <QObject> +#include <QKeySequence> +class QxtGlobalShortcutPrivate; + +class QXT_GUI_EXPORT QxtGlobalShortcut : public QObject +{ + Q_OBJECT + QXT_DECLARE_PRIVATE(QxtGlobalShortcut) + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) + Q_PROPERTY(QKeySequence shortcut READ shortcut WRITE setShortcut) + +public: + explicit QxtGlobalShortcut(QObject* parent = 0); + explicit QxtGlobalShortcut(const QKeySequence& shortcut, QObject* parent = 0); + virtual ~QxtGlobalShortcut(); + + QKeySequence shortcut() const; + bool setShortcut(const QKeySequence& shortcut); + + bool isEnabled() const; + +public Q_SLOTS: + void setEnabled(bool enabled = true); + void setDisabled(bool disabled = true); + +Q_SIGNALS: + void activated(); +}; + +#endif // QXTGLOBALSHORTCUT_H -- cgit v1.2.3 From c656655dfc7def89c7ed6001039b93d12582ed4d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 24 Sep 2014 22:53:18 +0200 Subject: missing header --- facetracknoir/facetracknoir.h | 1 + 1 file changed, 1 insertion(+) diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 9bdda749..c722ad5c 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -35,6 +35,7 @@ #include <QLayout> #include <QPixmap> #include <QLabel> +#include <QTimer> #if !defined(_WIN32) # include "qxt-mini/QxtGlobalShortcut" #else -- cgit v1.2.3 From 71acf73ec93f370d7bee4240c9b17891e257f129 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 24 Sep 2014 22:53:30 +0200 Subject: stock octopus drawing --- .../cute-octopus-vector-material_15-1831.jpg | Bin 0 -> 71514 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 facetracknoir/clientfiles/cute-octopus-vector-material_15-1831.jpg diff --git a/facetracknoir/clientfiles/cute-octopus-vector-material_15-1831.jpg b/facetracknoir/clientfiles/cute-octopus-vector-material_15-1831.jpg new file mode 100644 index 00000000..c4e5318f Binary files /dev/null and b/facetracknoir/clientfiles/cute-octopus-vector-material_15-1831.jpg differ -- cgit v1.2.3 From e18f3e2172bd85bfaa227b250a51d2e08952481e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 24 Sep 2014 23:11:02 +0200 Subject: fix UI somewhat After @KyokushinPL made look-and-feel changes, fix Qt layouts and property values. --- facetracknoir/facetracknoir.ui | 2067 ++++++++++++++++++++++------------------ 1 file changed, 1164 insertions(+), 903 deletions(-) diff --git a/facetracknoir/facetracknoir.ui b/facetracknoir/facetracknoir.ui index 7f6b863c..6a645acb 100644 --- a/facetracknoir/facetracknoir.ui +++ b/facetracknoir/facetracknoir.ui @@ -7,8 +7,8 @@ <rect> <x>0</x> <y>0</y> - <width>597</width> - <height>506</height> + <width>956</width> + <height>740</height> </rect> </property> <property name="sizePolicy"> @@ -21,996 +21,1274 @@ <iconset resource="main-facetracknoir.qrc"> <normaloff>:/images/facetracknoir.png</normaloff>:/images/facetracknoir.png</iconset> </property> + <property name="styleSheet"> + <string notr="true">#headpose, #video_frame_label, #controls, #video_frame { border: 0; } +#video_frame { margin: 0; padding: 0; }</string> + </property> <widget class="QWidget" name="centralWidget"> - <widget class="QGroupBox" name="box_mapped_headpose"> + <widget class="QGroupBox" name="video_feed"> <property name="geometry"> <rect> - <x>140</x> - <y>15</y> - <width>126</width> - <height>161</height> + <x>10</x> + <y>225</y> + <width>655</width> + <height>505</height> </rect> </property> <property name="title"> - <string notr="true">Game data</string> + <string>Video preview</string> </property> - <layout class="QGridLayout" name="gridLayout_10"> - <item row="0" column="1"> - <widget class="QLCDNumber" name="lcdNumOutputPosX"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> + <layout class="QFormLayout"> + <property name="horizontalSpacing"> + <number>0</number> + </property> + <property name="verticalSpacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> <item row="0" column="0"> - <widget class="QLabel" name="lblX_2"> - <property name="text"> - <string>TX</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLCDNumber" name="lcdNumOutputRotY"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLCDNumber" name="lcdNumOutputPosZ"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLCDNumber" name="lcdNumOutputRotZ"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="lblRotX_2"> - <property name="text"> - <string>yaw</string> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLCDNumber" name="lcdNumOutputRotX"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="lblRotZ_2"> - <property name="text"> - <string>roll</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="lblY_2"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="text"> - <string>TY</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="lblZ_2"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="text"> - <string>TZ</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLCDNumber" name="lcdNumOutputPosY"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="lblRotY_2"> - <property name="text"> - <string>pitch</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QGroupBox" name="groupGameProtocol"> - <property name="geometry"> - <rect> - <x>405</x> - <y>380</y> - <width>181</width> - <height>56</height> - </rect> - </property> - <property name="title"> - <string>Protocol</string> - </property> - <layout class="QHBoxLayout" name="_4"> - <item> - <widget class="QComboBox" name="iconcomboProtocol"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maxVisibleItems"> - <number>42</number> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnShowServerControls"> - <property name="enabled"> - <bool>true</bool> - </property> + <widget class="QFrame" name="video_frame"> <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="text"> - <string>Settings</string> - </property> + <property name="minimumSize"> + <size> + <width>640</width> + <height>480</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>640</width> + <height>480</height> + </size> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="video_frame_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>640</width> + <height>480</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>640</width> + <height>480</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> </widget> </item> </layout> </widget> - <widget class="QGroupBox" name="groupTrackerSource"> + <widget class="QGroupBox" name="controls"> <property name="geometry"> <rect> - <x>405</x> - <y>215</y> - <width>181</width> - <height>56</height> + <x>675</x> + <y>225</y> + <width>271</width> + <height>506</height> </rect> </property> <property name="title"> - <string>Tracker</string> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set> </property> - <layout class="QHBoxLayout" name="_3"> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Connected game</string> + </property> + <layout class="QGridLayout" name="gridLayout_9"> + <property name="topMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="verticalSpacing"> + <number>3</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="game_name"> + <property name="text"> + <string>Not connected</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> <item> - <widget class="QComboBox" name="iconcomboTrackerSource"> + <widget class="QGroupBox" name="groupProfile"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="maxVisibleItems"> - <number>42</number> - </property> + <property name="title"> + <string>Profile</string> + </property> + <layout class="QGridLayout" name="gridLayout_7"> + <property name="topMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="verticalSpacing"> + <number>3</number> + </property> + <item row="1" column="1"> + <widget class="QPushButton" name="btnSave"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Save</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QPushButton" name="btnLoad"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Load</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QComboBox" name="iconcomboProfile"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxVisibleItems"> + <number>10</number> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QPushButton" name="btnSaveAs"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Save As ...</string> + </property> + </widget> + </item> + </layout> </widget> </item> <item> - <widget class="QPushButton" name="btnShowEngineControls"> - <property name="enabled"> - <bool>true</bool> - </property> + <widget class="QGroupBox" name="groupWindows"> <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="text"> + <property name="title"> <string>Settings</string> </property> + <layout class="QGridLayout" name="gridLayout_6"> + <property name="topMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="verticalSpacing"> + <number>3</number> + </property> + <item row="0" column="0"> + <widget class="QPushButton" name="btnEditCurves"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Mapping</string> + </property> + <property name="icon"> + <iconset resource="main-facetracknoir.qrc"> + <normaloff>:/uielements/curves.png</normaloff>:/uielements/curves.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>91</width> + <height>25</height> + </size> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QPushButton" name="btnShortcuts"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Keys</string> + </property> + <property name="icon"> + <iconset resource="main-facetracknoir.qrc"> + <normaloff>:/uielements/tools.png</normaloff>:/uielements/tools.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>98</width> + <height>24</height> + </size> + </property> + </widget> + </item> + </layout> </widget> </item> - </layout> - </widget> - <widget class="QGroupBox" name="groupFilter"> - <property name="geometry"> - <rect> - <x>405</x> - <y>325</y> - <width>181</width> - <height>56</height> - </rect> - </property> - <property name="title"> - <string>Filter</string> - </property> - <layout class="QHBoxLayout" name="_5"> <item> - <widget class="QComboBox" name="iconcomboFilter"> + <widget class="QGroupBox" name="groupTrackerSource"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="maxVisibleItems"> - <number>42</number> - </property> + <property name="title"> + <string>Tracker</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="topMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="verticalSpacing"> + <number>3</number> + </property> + <item row="0" column="0"> + <widget class="QComboBox" name="iconcomboTrackerSource"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="btnShowEngineControls"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Settings</string> + </property> + </widget> + </item> + </layout> </widget> </item> <item> - <widget class="QPushButton" name="btnShowFilterControls"> - <property name="enabled"> - <bool>true</bool> - </property> + <widget class="QGroupBox" name="groupFilter"> <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="text"> - <string>Settings</string> - </property> + <property name="title"> + <string>Filter</string> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <property name="topMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="verticalSpacing"> + <number>3</number> + </property> + <item row="0" column="0"> + <widget class="QComboBox" name="iconcomboFilter"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="btnShowFilterControls"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Settings</string> + </property> + </widget> + </item> + </layout> </widget> </item> - </layout> - </widget> - <widget class="QGroupBox" name="groupBox_3"> - <property name="geometry"> - <rect> - <x>405</x> - <y>270</y> - <width>181</width> - <height>56</height> - </rect> - </property> - <property name="title"> - <string>Auxiliary tracker</string> - </property> - <layout class="QHBoxLayout" name="_6"> <item> - <widget class="QComboBox" name="cbxSecondTrackerSource"> + <widget class="QGroupBox" name="groupGameProtocol"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="maxVisibleItems"> - <number>42</number> - </property> + <property name="title"> + <string>Protocol</string> + </property> + <layout class="QGridLayout" name="gridLayout_4"> + <property name="topMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="verticalSpacing"> + <number>3</number> + </property> + <item row="0" column="1"> + <widget class="QPushButton" name="btnShowServerControls"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Settings</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QComboBox" name="iconcomboProtocol"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> </widget> </item> <item> - <widget class="QPushButton" name="btnShowSecondTrackerSettings"> - <property name="enabled"> - <bool>true</bool> - </property> + <widget class="QGroupBox" name="groupStartStop"> <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="text"> - <string>Settings</string> - </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>65536</width> + <height>65536</height> + </size> + </property> + <property name="title"> + <string notr="true">Controls</string> + </property> + <layout class="QGridLayout" name="gridLayout_5"> + <property name="topMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="verticalSpacing"> + <number>3</number> + </property> + <item row="0" column="0"> + <widget class="QPushButton" name="btnStartTracker"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Start</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="btnStopTracker"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Stop</string> + </property> + </widget> + </item> + </layout> </widget> </item> </layout> </widget> - <widget class="QFrame" name="video_frame"> + <widget class="QGroupBox" name="headpose"> <property name="geometry"> <rect> - <x>24</x> - <y>204</y> - <width>366</width> - <height>281</height> + <x>185</x> + <y>10</y> + <width>761</width> + <height>211</height> </rect> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="title"> + <string/> </property> - <widget class="QLabel" name="video_frame_label"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>366</width> - <height>281</height> - </rect> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>10</number> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="leftMargin"> + <number>0</number> </property> - <property name="font"> - <font> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> + <property name="topMargin"> + <number>0</number> </property> - <property name="text"> - <string/> + <property name="rightMargin"> + <number>0</number> </property> - </widget> - </widget> - <widget class="QGroupBox" name="groupProfile"> - <property name="geometry"> - <rect> - <x>405</x> - <y>15</y> - <width>181</width> - <height>81</height> - </rect> - </property> - <property name="title"> - <string>Profile</string> - </property> - <layout class="QGridLayout" name="_2"> - <item row="0" column="1"> - <widget class="QPushButton" name="btnSave"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Save</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QPushButton" name="btnLoad"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Load</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QPushButton" name="btnSaveAs"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Save As ...</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboProfile"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maxVisibleItems"> - <number>10</number> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QGroupBox" name="groupStartStop"> - <property name="geometry"> - <rect> - <x>405</x> - <y>440</y> - <width>181</width> - <height>56</height> - </rect> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="title"> - <string notr="true">Controls</string> - </property> - <layout class="QGridLayout"> - <item row="0" column="0"> - <widget class="QPushButton" name="btnStartTracker"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Start</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QPushButton" name="btnStopTracker"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Stop</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QGroupBox" name="box_raw_headpose"> - <property name="geometry"> - <rect> - <x>273</x> - <y>15</y> - <width>126</width> - <height>161</height> - </rect> - </property> - <property name="title"> - <string notr="true">Raw pose</string> - </property> - <layout class="QGridLayout" name="gridLayout_13"> - <item row="0" column="0"> - <widget class="QLabel" name="lblX_3"> - <property name="text"> - <string>TX</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLCDNumber" name="lcdNumZ"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLCDNumber" name="lcdNumRotY"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLCDNumber" name="lcdNumX"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLCDNumber" name="lcdNumRotZ"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLCDNumber" name="lcdNumRotX"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="lblY_3"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="text"> - <string>TY</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="lblZ_3"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="text"> - <string>TZ</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLCDNumber" name="lcdNumY"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>2</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="lblRotY_3"> - <property name="text"> - <string>pitch</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="lblRotX_3"> - <property name="text"> - <string>yaw</string> - </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QGroupBox" name="box_mapped_headpose"> + <property name="title"> + <string notr="true">Game data</string> + </property> + <layout class="QGridLayout" name="gridLayout_10"> + <item row="0" column="0"> + <widget class="QLabel" name="lblX_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TX</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLCDNumber" name="lcdNumOutputPosX"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLCDNumber" name="lcdNumOutputPosY"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="lblRotY_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>pitch</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLCDNumber" name="lcdNumOutputRotY"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="lblZ_2"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TZ</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLCDNumber" name="lcdNumOutputRotX"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lblY_2"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TY</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="lblRotX_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>yaw</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLCDNumber" name="lcdNumOutputPosZ"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="lblRotZ_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>roll</string> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLCDNumber" name="lcdNumOutputRotZ"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + </layout> </widget> </item> - <item row="2" column="2"> - <widget class="QLabel" name="lblRotZ_3"> - <property name="text"> - <string>roll</string> - </property> + <item> + <widget class="QGroupBox" name="box_raw_headpose"> + <property name="title"> + <string notr="true">Raw pose</string> + </property> + <layout class="QGridLayout" name="gridLayout_8"> + <item row="0" column="0"> + <widget class="QLabel" name="lblX_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>TX</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLCDNumber" name="lcdNumX"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="lblRotX_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>yaw</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLCDNumber" name="lcdNumRotX"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lblY_3"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="text"> + <string>TY</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLCDNumber" name="lcdNumY"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="lblRotY_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>pitch</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLCDNumber" name="lcdNumRotY"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="lblZ_3"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="text"> + <string>TZ</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLCDNumber" name="lcdNumZ"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="lblRotZ_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>roll</string> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLCDNumber" name="lcdNumRotZ"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + </layout> </widget> </item> </layout> </widget> - <widget class="QGroupBox" name="groupBox"> - <property name="geometry"> - <rect> - <x>15</x> - <y>179</y> - <width>386</width> - <height>316</height> - </rect> - </property> - <property name="title"> - <string>Video preview</string> - </property> - </widget> - <widget class="QGroupBox" name="groupBox_2"> + <widget class="QGroupBox" name="tracking_preview"> <property name="geometry"> <rect> - <x>405</x> - <y>95</y> - <width>181</width> - <height>80</height> + <x>10</x> + <y>10</y> + <width>166</width> + <height>211</height> </rect> </property> - <property name="title"> - <string>Settings</string> - </property> - <widget class="QPushButton" name="btnShortcuts"> - <property name="geometry"> - <rect> - <x>10</x> - <y>45</y> - <width>161</width> - <height>26</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Keys</string> - </property> - <property name="icon"> - <iconset resource="main-facetracknoir.qrc"> - <normaloff>:/uielements/tools.png</normaloff>:/uielements/tools.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>98</width> - <height>24</height> - </size> - </property> - </widget> - <widget class="QPushButton" name="btnEditCurves"> - <property name="geometry"> - <rect> - <x>10</x> - <y>15</y> - <width>161</width> - <height>26</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Mapping</string> - </property> - <property name="icon"> - <iconset resource="main-facetracknoir.qrc"> - <normaloff>:/uielements/curves.png</normaloff>:/uielements/curves.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>60</width> - <height>37</height> - </size> - </property> - </widget> - </widget> - <widget class="QGroupBox" name="groupBox_4"> - <property name="geometry"> - <rect> - <x>15</x> - <y>15</y> - <width>116</width> - <height>161</height> - </rect> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="title"> <string>Tracking preview</string> </property> - <widget class="GLWidget" name="pose_display" native="true"> - <property name="geometry"> - <rect> - <x>5</x> - <y>15</y> - <width>106</width> - <height>141</height> - </rect> + <layout class="QGridLayout" name="gridLayout_2"> + <property name="leftMargin"> + <number>0</number> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="topMargin"> + <number>0</number> </property> - </widget> - </widget> - <widget class="QGroupBox" name="groupBox_5"> - <property name="geometry"> - <rect> - <x>405</x> - <y>180</y> - <width>181</width> - <height>36</height> - </rect> - </property> - <property name="title"> - <string>Detected app</string> - </property> - <widget class="QLabel" name="game_name"> - <property name="geometry"> - <rect> - <x>10</x> - <y>15</y> - <width>115</width> - <height>16</height> - </rect> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="spacing"> + <number>0</number> </property> - </widget> + <item row="0" column="0"> + <widget class="GLWidget" name="pose_display" native="true"/> + </item> + </layout> </widget> - <zorder>box_mapped_headpose</zorder> - <zorder>groupGameProtocol</zorder> - <zorder>groupTrackerSource</zorder> - <zorder>groupFilter</zorder> - <zorder>groupBox_3</zorder> - <zorder>video_frame</zorder> - <zorder>groupProfile</zorder> - <zorder>groupStartStop</zorder> - <zorder>box_raw_headpose</zorder> - <zorder>video_frame_label</zorder> - <zorder>video_frame_label</zorder> - <zorder>groupBox</zorder> - <zorder>groupBox_2</zorder> - <zorder>groupBox_4</zorder> - <zorder>groupBox_5</zorder> </widget> </widget> <customwidgets> @@ -1024,21 +1302,4 @@ <include location="main-facetracknoir.qrc"/> </resources> <connections/> - <designerdata> - <property name="gridDeltaX"> - <number>5</number> - </property> - <property name="gridDeltaY"> - <number>5</number> - </property> - <property name="gridSnapX"> - <bool>true</bool> - </property> - <property name="gridSnapY"> - <bool>true</bool> - </property> - <property name="gridVisible"> - <bool>true</bool> - </property> - </designerdata> </ui> -- cgit v1.2.3 From 6467fde8a45d71a0dca639a934f648461383867a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 24 Sep 2014 23:17:10 +0200 Subject: reorder some widgets --- facetracknoir/facetracknoir.ui | 264 ++++++++++++++++++++--------------------- 1 file changed, 132 insertions(+), 132 deletions(-) diff --git a/facetracknoir/facetracknoir.ui b/facetracknoir/facetracknoir.ui index 6a645acb..5cc2ab0e 100644 --- a/facetracknoir/facetracknoir.ui +++ b/facetracknoir/facetracknoir.ui @@ -129,7 +129,7 @@ <x>675</x> <y>225</y> <width>271</width> - <height>506</height> + <height>505</height> </rect> </property> <property name="title"> @@ -140,7 +140,7 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <property name="spacing"> - <number>0</number> + <number>3</number> </property> <property name="leftMargin"> <number>0</number> @@ -262,7 +262,7 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupWindows"> + <widget class="QGroupBox" name="groupTrackerSource"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -270,9 +270,9 @@ </sizepolicy> </property> <property name="title"> - <string>Settings</string> + <string>Tracker</string> </property> - <layout class="QGridLayout" name="gridLayout_6"> + <layout class="QGridLayout" name="gridLayout"> <property name="topMargin"> <number>6</number> </property> @@ -283,48 +283,28 @@ <number>3</number> </property> <item row="0" column="0"> - <widget class="QPushButton" name="btnEditCurves"> + <widget class="QComboBox" name="iconcomboTrackerSource"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="text"> - <string>Mapping</string> - </property> - <property name="icon"> - <iconset resource="main-facetracknoir.qrc"> - <normaloff>:/uielements/curves.png</normaloff>:/uielements/curves.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>91</width> - <height>25</height> - </size> - </property> </widget> </item> - <item row="1" column="0"> - <widget class="QPushButton" name="btnShortcuts"> + <item row="0" column="1"> + <widget class="QPushButton" name="btnShowEngineControls"> + <property name="enabled"> + <bool>true</bool> + </property> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="text"> - <string>Keys</string> - </property> - <property name="icon"> - <iconset resource="main-facetracknoir.qrc"> - <normaloff>:/uielements/tools.png</normaloff>:/uielements/tools.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>98</width> - <height>24</height> - </size> + <string>Settings</string> </property> </widget> </item> @@ -332,17 +312,17 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupTrackerSource"> + <widget class="QGroupBox" name="groupFilter"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="title"> - <string>Tracker</string> + <string>Filter</string> </property> - <layout class="QGridLayout" name="gridLayout"> + <layout class="QGridLayout" name="gridLayout_3"> <property name="topMargin"> <number>6</number> </property> @@ -353,7 +333,7 @@ <number>3</number> </property> <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboTrackerSource"> + <widget class="QComboBox" name="iconcomboFilter"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -363,7 +343,7 @@ </widget> </item> <item row="0" column="1"> - <widget class="QPushButton" name="btnShowEngineControls"> + <widget class="QPushButton" name="btnShowFilterControls"> <property name="enabled"> <bool>true</bool> </property> @@ -382,17 +362,17 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupFilter"> + <widget class="QGroupBox" name="groupGameProtocol"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="title"> - <string>Filter</string> + <string>Protocol</string> </property> - <layout class="QGridLayout" name="gridLayout_3"> + <layout class="QGridLayout" name="gridLayout_4"> <property name="topMargin"> <number>6</number> </property> @@ -402,18 +382,8 @@ <property name="verticalSpacing"> <number>3</number> </property> - <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboFilter"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> <item row="0" column="1"> - <widget class="QPushButton" name="btnShowFilterControls"> + <widget class="QPushButton" name="btnShowServerControls"> <property name="enabled"> <bool>true</bool> </property> @@ -428,11 +398,21 @@ </property> </widget> </item> + <item row="0" column="0"> + <widget class="QComboBox" name="iconcomboProtocol"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> </layout> </widget> </item> <item> - <widget class="QGroupBox" name="groupGameProtocol"> + <widget class="QGroupBox" name="groupWindows"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -440,9 +420,9 @@ </sizepolicy> </property> <property name="title"> - <string>Protocol</string> + <string>Settings</string> </property> - <layout class="QGridLayout" name="gridLayout_4"> + <layout class="QGridLayout" name="gridLayout_6"> <property name="topMargin"> <number>6</number> </property> @@ -452,30 +432,50 @@ <property name="verticalSpacing"> <number>3</number> </property> - <item row="0" column="1"> - <widget class="QPushButton" name="btnShowServerControls"> - <property name="enabled"> - <bool>true</bool> - </property> + <item row="0" column="0"> + <widget class="QPushButton" name="btnEditCurves"> <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="text"> - <string>Settings</string> + <string>Mapping</string> + </property> + <property name="icon"> + <iconset resource="main-facetracknoir.qrc"> + <normaloff>:/uielements/curves.png</normaloff>:/uielements/curves.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>91</width> + <height>20</height> + </size> </property> </widget> </item> - <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboProtocol"> + <item row="1" column="0"> + <widget class="QPushButton" name="btnShortcuts"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> + <property name="text"> + <string>Keys</string> + </property> + <property name="icon"> + <iconset resource="main-facetracknoir.qrc"> + <normaloff>:/uielements/tools.png</normaloff>:/uielements/tools.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>98</width> + <height>24</height> + </size> + </property> </widget> </item> </layout> @@ -514,8 +514,11 @@ <property name="verticalSpacing"> <number>3</number> </property> - <item row="0" column="0"> - <widget class="QPushButton" name="btnStartTracker"> + <item row="0" column="1"> + <widget class="QPushButton" name="btnStopTracker"> + <property name="enabled"> + <bool>false</bool> + </property> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -523,15 +526,12 @@ </sizepolicy> </property> <property name="text"> - <string>Start</string> + <string>Stop</string> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QPushButton" name="btnStopTracker"> - <property name="enabled"> - <bool>false</bool> - </property> + <item row="0" column="0"> + <widget class="QPushButton" name="btnStartTracker"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -539,7 +539,7 @@ </sizepolicy> </property> <property name="text"> - <string>Stop</string> + <string>Start</string> </property> </widget> </item> @@ -945,21 +945,8 @@ <string notr="true">Raw pose</string> </property> <layout class="QGridLayout" name="gridLayout_8"> - <item row="0" column="0"> - <widget class="QLabel" name="lblX_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>TX</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLCDNumber" name="lcdNumX"> + <item row="1" column="1"> + <widget class="QLCDNumber" name="lcdNumY"> <property name="enabled"> <bool>true</bool> </property> @@ -993,19 +980,6 @@ </property> </widget> </item> - <item row="0" column="2"> - <widget class="QLabel" name="lblRotX_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>yaw</string> - </property> - </widget> - </item> <item row="0" column="3"> <widget class="QLCDNumber" name="lcdNumRotX"> <property name="enabled"> @@ -1041,27 +1015,34 @@ </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="lblY_3"> - <property name="enabled"> - <bool>true</bool> - </property> + <item row="1" column="2"> + <widget class="QLabel" name="lblRotY_3"> <property name="sizePolicy"> <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="autoFillBackground"> - <bool>false</bool> + <property name="text"> + <string>pitch</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="lblX_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="text"> - <string>TY</string> + <string>TX</string> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QLCDNumber" name="lcdNumY"> + <item row="2" column="1"> + <widget class="QLCDNumber" name="lcdNumZ"> <property name="enabled"> <bool>true</bool> </property> @@ -1095,21 +1076,8 @@ </property> </widget> </item> - <item row="1" column="2"> - <widget class="QLabel" name="lblRotY_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>pitch</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLCDNumber" name="lcdNumRotY"> + <item row="0" column="1"> + <widget class="QLCDNumber" name="lcdNumX"> <property name="enabled"> <bool>true</bool> </property> @@ -1162,8 +1130,27 @@ </property> </widget> </item> - <item row="2" column="1"> - <widget class="QLCDNumber" name="lcdNumZ"> + <item row="1" column="0"> + <widget class="QLabel" name="lblY_3"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="text"> + <string>TY</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLCDNumber" name="lcdNumRotY"> <property name="enabled"> <bool>true</bool> </property> @@ -1197,6 +1184,19 @@ </property> </widget> </item> + <item row="0" column="2"> + <widget class="QLabel" name="lblRotX_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>yaw</string> + </property> + </widget> + </item> <item row="2" column="2"> <widget class="QLabel" name="lblRotZ_3"> <property name="sizePolicy"> -- cgit v1.2.3 From 2cd3d41a6b35ea978ebf797dcc10a800bd78c658 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Thu, 25 Sep 2014 01:16:15 +0200 Subject: gain progress --- facetracknoir/gain-control.hpp | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/facetracknoir/gain-control.hpp b/facetracknoir/gain-control.hpp index dcaee692..005ef9cc 100644 --- a/facetracknoir/gain-control.hpp +++ b/facetracknoir/gain-control.hpp @@ -8,6 +8,8 @@ #include <deque> #include <vector> +#include <cstdio> + #include "timer.hpp" #include <opencv2/core/core.hpp> @@ -43,16 +45,14 @@ namespace detail { class Gain { private: static constexpr bool use_box_filter = true; - static constexpr int box_size = 32 / 640.; + static constexpr int box_size = 16 / 640.; static constexpr double control_upper_bound = 1.0; // XXX FIXME implement for logitech crapola - static constexpr int GAIN_HISTORY_COUNT = 15, GAIN_HISTORY_EVERY_MS = 115; + static constexpr int GAIN_HISTORY_COUNT = 90, GAIN_HISTORY_EVERY_MS = 85; int control; double step, eps; - std::deque<double> means_history; - cv::Mat last_frame; - + std::deque<cv::Mat> means_history; Timer debug_timer, history_timer; typedef unsigned char px; @@ -156,19 +156,30 @@ public: debug_timer.start(); qDebug() << "---- gain:" << "mean" << mu << "variance" << var; - for (int i = 0; i < means_history.size(); i++) - qDebug() << "cov" << i << means_history[i]; - } - - if (last_frame.cols != frame.cols || last_frame.rows != frame.rows) - { - last_frame = frame; - means_history.clear(); + + const int sz = means_history.size(); + + if (sz) + fprintf(stderr, "covs: "); + + for (int i = 0; i < sz; i++) + { + if (means_history[i].rows != frame.rows || means_history[i].cols != frame.cols) + { + means_history.clear(); + qDebug() << "\n!!! resolution reset"; + break; + } + fprintf(stderr, "%f ", get_covariance(frame, means_history[i])); + } + + if (sz) + fprintf(stderr, "\n"); } if (GAIN_HISTORY_COUNT > means_history.size() && history_timer.elapsed_ms() > GAIN_HISTORY_EVERY_MS) { - means_history.push_front(get_covariance(frame, last_frame)); + means_history.push_front(frame); if (GAIN_HISTORY_COUNT == means_history.size()) means_history.pop_back(); -- cgit v1.2.3 From b4663bbb85428ec3e4dd6725bb2d2ff2afa57bf6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Thu, 25 Sep 2014 13:38:53 +0200 Subject: frames got clobbered, opencv sucks as usual --- facetracknoir/gain-control.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/facetracknoir/gain-control.hpp b/facetracknoir/gain-control.hpp index 005ef9cc..98d45711 100644 --- a/facetracknoir/gain-control.hpp +++ b/facetracknoir/gain-control.hpp @@ -179,7 +179,7 @@ public: if (GAIN_HISTORY_COUNT > means_history.size() && history_timer.elapsed_ms() > GAIN_HISTORY_EVERY_MS) { - means_history.push_front(frame); + means_history.push_front(frame.clone()); if (GAIN_HISTORY_COUNT == means_history.size()) means_history.pop_back(); -- cgit v1.2.3 From 6f43254665afbef2b4e44889e10d397fee2f7ce6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Thu, 25 Sep 2014 13:53:24 +0200 Subject: how about this no-feed image? --- facetracknoir/uielements/no-feed.png | Bin 20196 -> 128664 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/facetracknoir/uielements/no-feed.png b/facetracknoir/uielements/no-feed.png index 7c2f52bf..6494e9c6 100644 Binary files a/facetracknoir/uielements/no-feed.png and b/facetracknoir/uielements/no-feed.png differ -- cgit v1.2.3 From bc130b2812700047002f2866012784853c88670e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Thu, 25 Sep 2014 18:15:50 +0200 Subject: core: link with winmm on win32 Reported-by: @KyokushinPL --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ae2c6d8..fc6fe98a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -455,6 +455,8 @@ endif() target_link_libraries(opentrack opentrack-version opentrack-pose-widget opentrack-spline-widget ${MY_QT_LIBS} ${QXT_QXTCORE_LIB_RELEASE} ${QXT_QXTWIDGETS_LIB_RELEASE}) if(NOT WIN32) target_link_libraries(opentrack dl) +else() + target_link_libraries(opentrack winmm) endif() # make install -- cgit v1.2.3 From 63e5d03cd8ccdb0c21d0b7e96bb08e656f1f99ca Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 26 Sep 2014 23:53:10 +0200 Subject: replace raw headpose box a bit --- facetracknoir/facetracknoir.ui | 460 ++++++++++++++++------------------------- 1 file changed, 173 insertions(+), 287 deletions(-) diff --git a/facetracknoir/facetracknoir.ui b/facetracknoir/facetracknoir.ui index 5cc2ab0e..1a006809 100644 --- a/facetracknoir/facetracknoir.ui +++ b/facetracknoir/facetracknoir.ui @@ -23,7 +23,8 @@ </property> <property name="styleSheet"> <string notr="true">#headpose, #video_frame_label, #controls, #video_frame { border: 0; } -#video_frame { margin: 0; padding: 0; }</string> +#video_frame { margin: 0; padding: 0; } +</string> </property> <widget class="QWidget" name="centralWidget"> <widget class="QGroupBox" name="video_feed"> @@ -577,35 +578,13 @@ <number>0</number> </property> <item> - <widget class="QGroupBox" name="box_mapped_headpose"> + <widget class="QGroupBox" name="box_raw_headpose"> <property name="title"> - <string notr="true">Game data</string> + <string notr="true">Raw pose</string> </property> - <layout class="QGridLayout" name="gridLayout_10"> - <item row="0" column="0"> - <widget class="QLabel" name="lblX_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="font"> - <font> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>TX</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLCDNumber" name="lcdNumOutputPosX"> + <layout class="QGridLayout" name="gridLayout_8"> + <item row="1" column="1"> + <widget class="QLCDNumber" name="lcdNumY"> <property name="enabled"> <bool>true</bool> </property> @@ -615,32 +594,19 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> <property name="digitCount"> - <number>4</number> + <number>1</number> </property> <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> + <enum>QLCDNumber::Outline</enum> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QLCDNumber" name="lcdNumOutputPosY"> + <item row="0" column="3"> + <widget class="QLCDNumber" name="lcdNumRotX"> <property name="enabled"> <bool>true</bool> </property> @@ -650,117 +616,67 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> <property name="digitCount"> - <number>4</number> + <number>1</number> </property> <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> + <enum>QLCDNumber::Outline</enum> </property> </widget> </item> <item row="1" column="2"> - <widget class="QLabel" name="lblRotY_2"> + <widget class="QLabel" name="lblRotY_3"> <property name="sizePolicy"> <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="font"> - <font> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> <property name="text"> <string>pitch</string> </property> </widget> </item> - <item row="1" column="3"> - <widget class="QLCDNumber" name="lcdNumOutputRotY"> - <property name="enabled"> - <bool>true</bool> - </property> + <item row="0" column="0"> + <widget class="QLabel" name="lblX_3"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> + <property name="text"> + <string>TX</string> </property> </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="lblZ_2"> + <item row="2" column="1"> + <widget class="QLCDNumber" name="lcdNumZ"> <property name="enabled"> <bool>true</bool> </property> <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="font"> - <font> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="autoFillBackground"> - <bool>false</bool> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> + <property name="digitCount"> + <number>1</number> </property> - <property name="text"> - <string>TZ</string> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> </property> </widget> </item> - <item row="0" column="3"> - <widget class="QLCDNumber" name="lcdNumOutputRotX"> + <item row="0" column="1"> + <widget class="QLCDNumber" name="lcdNumX"> <property name="enabled"> <bool>true</bool> </property> @@ -770,32 +686,19 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> <property name="digitCount"> - <number>4</number> + <number>1</number> </property> <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> + <enum>QLCDNumber::Outline</enum> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="lblY_2"> + <item row="2" column="0"> + <widget class="QLabel" name="lblZ_3"> <property name="enabled"> <bool>true</bool> </property> @@ -805,47 +708,35 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="font"> - <font> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> <property name="autoFillBackground"> <bool>false</bool> </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> <property name="text"> - <string>TY</string> + <string>TZ</string> </property> </widget> </item> - <item row="0" column="2"> - <widget class="QLabel" name="lblRotX_2"> + <item row="1" column="0"> + <widget class="QLabel" name="lblY_3"> + <property name="enabled"> + <bool>true</bool> + </property> <property name="sizePolicy"> <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="font"> - <font> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> + <property name="autoFillBackground"> + <bool>false</bool> </property> <property name="text"> - <string>yaw</string> + <string>TY</string> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QLCDNumber" name="lcdNumOutputPosZ"> + <item row="1" column="3"> + <widget class="QLCDNumber" name="lcdNumRotY"> <property name="enabled"> <bool>true</bool> </property> @@ -855,46 +746,37 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> <property name="digitCount"> - <number>4</number> + <number>1</number> </property> <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> + <enum>QLCDNumber::Outline</enum> </property> </widget> </item> - <item row="2" column="2"> - <widget class="QLabel" name="lblRotZ_2"> + <item row="0" column="2"> + <widget class="QLabel" name="lblRotX_3"> <property name="sizePolicy"> <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="font"> - <font> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> + <property name="text"> + <string>yaw</string> </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="lblRotZ_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="text"> <string>roll</string> @@ -902,7 +784,7 @@ </widget> </item> <item row="2" column="3"> - <widget class="QLCDNumber" name="lcdNumOutputRotZ"> + <widget class="QLCDNumber" name="lcdNumRotZ"> <property name="enabled"> <bool>true</bool> </property> @@ -912,27 +794,14 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> <property name="digitCount"> - <number>4</number> + <number>1</number> </property> <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> + <enum>QLCDNumber::Outline</enum> </property> </widget> </item> @@ -940,29 +809,44 @@ </widget> </item> <item> - <widget class="QGroupBox" name="box_raw_headpose"> + <widget class="QGroupBox" name="box_mapped_headpose"> <property name="title"> - <string notr="true">Raw pose</string> + <string notr="true">Game data</string> </property> - <layout class="QGridLayout" name="gridLayout_8"> - <item row="1" column="1"> - <widget class="QLCDNumber" name="lcdNumY"> - <property name="enabled"> - <bool>true</bool> - </property> + <layout class="QGridLayout" name="gridLayout_10"> + <item row="0" column="0"> + <widget class="QLabel" name="lblX_2"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="font"> <font> - <pointsize>13</pointsize> <stylestrategy>NoAntialias</stylestrategy> <kerning>false</kerning> </font> </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TX</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLCDNumber" name="lcdNumOutputPosX"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> @@ -973,15 +857,15 @@ <bool>true</bool> </property> <property name="digitCount"> - <number>4</number> + <number>1</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> </property> </widget> </item> - <item row="0" column="3"> - <widget class="QLCDNumber" name="lcdNumRotX"> + <item row="1" column="1"> + <widget class="QLCDNumber" name="lcdNumOutputPosY"> <property name="enabled"> <bool>true</bool> </property> @@ -991,13 +875,6 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> @@ -1008,7 +885,7 @@ <bool>true</bool> </property> <property name="digitCount"> - <number>4</number> + <number>1</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> @@ -1016,33 +893,29 @@ </widget> </item> <item row="1" column="2"> - <widget class="QLabel" name="lblRotY_3"> + <widget class="QLabel" name="lblRotY_2"> <property name="sizePolicy"> <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="text"> - <string>pitch</string> + <property name="font"> + <font> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="lblX_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> </property> <property name="text"> - <string>TX</string> + <string>pitch</string> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QLCDNumber" name="lcdNumZ"> + <item row="1" column="3"> + <widget class="QLCDNumber" name="lcdNumOutputRotY"> <property name="enabled"> <bool>true</bool> </property> @@ -1052,13 +925,6 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> @@ -1069,31 +935,52 @@ <bool>true</bool> </property> <property name="digitCount"> - <number>4</number> + <number>1</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QLCDNumber" name="lcdNumX"> + <item row="2" column="0"> + <widget class="QLabel" name="lblZ_2"> <property name="enabled"> <bool>true</bool> </property> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="font"> <font> - <pointsize>13</pointsize> <stylestrategy>NoAntialias</stylestrategy> <kerning>false</kerning> </font> </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TZ</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLCDNumber" name="lcdNumOutputRotX"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> @@ -1104,15 +991,15 @@ <bool>true</bool> </property> <property name="digitCount"> - <number>4</number> + <number>1</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> </property> </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="lblZ_3"> + <item row="1" column="0"> + <widget class="QLabel" name="lblY_2"> <property name="enabled"> <bool>true</bool> </property> @@ -1122,35 +1009,47 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="font"> + <font> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> <property name="autoFillBackground"> <bool>false</bool> </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> <property name="text"> - <string>TZ</string> + <string>TY</string> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="lblY_3"> - <property name="enabled"> - <bool>true</bool> - </property> + <item row="0" column="2"> + <widget class="QLabel" name="lblRotX_2"> <property name="sizePolicy"> <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="autoFillBackground"> - <bool>false</bool> + <property name="font"> + <font> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> </property> <property name="text"> - <string>TY</string> + <string>yaw</string> </property> </widget> </item> - <item row="1" column="3"> - <widget class="QLCDNumber" name="lcdNumRotY"> + <item row="2" column="1"> + <widget class="QLCDNumber" name="lcdNumOutputPosZ"> <property name="enabled"> <bool>true</bool> </property> @@ -1160,13 +1059,6 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> @@ -1177,33 +1069,29 @@ <bool>true</bool> </property> <property name="digitCount"> - <number>4</number> + <number>1</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> </property> </widget> </item> - <item row="0" column="2"> - <widget class="QLabel" name="lblRotX_3"> + <item row="2" column="2"> + <widget class="QLabel" name="lblRotZ_2"> <property name="sizePolicy"> <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="text"> - <string>yaw</string> + <property name="font"> + <font> + <stylestrategy>NoAntialias</stylestrategy> + <kerning>false</kerning> + </font> </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="lblRotZ_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> </property> <property name="text"> <string>roll</string> @@ -1211,7 +1099,7 @@ </widget> </item> <item row="2" column="3"> - <widget class="QLCDNumber" name="lcdNumRotZ"> + <widget class="QLCDNumber" name="lcdNumOutputRotZ"> <property name="enabled"> <bool>true</bool> </property> @@ -1221,13 +1109,6 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> @@ -1238,7 +1119,7 @@ <bool>true</bool> </property> <property name="digitCount"> - <number>4</number> + <number>1</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> @@ -1250,7 +1131,7 @@ </item> </layout> </widget> - <widget class="QGroupBox" name="tracking_preview"> + <widget class="QGroupBox" name="octopus"> <property name="geometry"> <rect> <x>10</x> @@ -1289,6 +1170,11 @@ </item> </layout> </widget> + <zorder>video_feed</zorder> + <zorder>controls</zorder> + <zorder>headpose</zorder> + <zorder>octopus</zorder> + <zorder>box_mapped_headpose</zorder> </widget> </widget> <customwidgets> -- cgit v1.2.3 From 3d20e3159a634ec52fe496ffbbf8cfab7063d7e9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 26 Sep 2014 23:55:20 +0200 Subject: ft2: multiply right axis for "ezca mode" Issue: #70 --- ftnoir_protocol_ft/ftnoir_protocol_ft.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp index 5c365697..107735e2 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp @@ -49,8 +49,8 @@ FTNoIR_Protocol::~FTNoIR_Protocol() } void FTNoIR_Protocol::sendHeadposeToGame(const double* headpose) { - float yaw = getRadsFromDegrees(headpose[Yaw]) * (s.useDummyExe ? 2.0 : 1.0); - float pitch = getRadsFromDegrees(headpose[Pitch]); + float yaw = getRadsFromDegrees(headpose[Yaw]); + float pitch = getRadsFromDegrees(headpose[Pitch]) * (s.useDummyExe ? 2.0 : 1.0); float roll = getRadsFromDegrees(headpose[Roll]); float tx = headpose[TX] * 10.f; float ty = headpose[TY] * 10.f; -- cgit v1.2.3 From 0b839d6faf8bcf5ceff41dc1f5bfcb588e83a85e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 26 Sep 2014 23:56:39 +0200 Subject: ft2: more accurate descriptions --- ftnoir_protocol_ft/ftnoir_ftcontrols.ui | 102 ++++++++++++++++---------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/ftnoir_protocol_ft/ftnoir_ftcontrols.ui b/ftnoir_protocol_ft/ftnoir_ftcontrols.ui index 554e681a..172d0f8d 100644 --- a/ftnoir_protocol_ft/ftnoir_ftcontrols.ui +++ b/ftnoir_protocol_ft/ftnoir_ftcontrols.ui @@ -12,8 +12,8 @@ <rect> <x>0</x> <y>0</y> - <width>489</width> - <height>402</height> + <width>520</width> + <height>449</height> </rect> </property> <property name="sizePolicy"> @@ -42,53 +42,6 @@ <bool>false</bool> </property> <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QGroupBox" name="groupBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>TIRViews</string> - </property> - <property name="alignment"> - <set>Qt::AlignJustify|Qt::AlignTop</set> - </property> - <property name="flat"> - <bool>false</bool> - </property> - <layout class="QFormLayout" name="formLayout_2"> - <item row="0" column="0"> - <widget class="QCheckBox" name="chkTIRViews"> - <property name="layoutDirection"> - <enum>Qt::RightToLeft</enum> - </property> - <property name="text"> - <string>Memory hacks</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Only for very old and buggy old games such as CFS3.</string> - </property> - <property name="scaledContents"> - <bool>false</bool> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> <item row="1" column="0"> <widget class="QGroupBox" name="groupBox_2"> <property name="sizePolicy"> @@ -113,14 +66,14 @@ <enum>Qt::RightToLeft</enum> </property> <property name="text"> - <string>Using EZCA</string> + <string>EZCA mode</string> </property> </widget> </item> <item row="0" column="1"> <widget class="QLabel" name="label"> <property name="text"> - <string>FSX-specific EZCA protocol hacks</string> + <string>Can enable for 180° pitch range (not shown in UI) rather than regular 90°</string> </property> <property name="wordWrap"> <bool>true</bool> @@ -209,6 +162,53 @@ </property> </widget> </item> + <item row="0" column="0"> + <widget class="QGroupBox" name="groupBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>TIRViews</string> + </property> + <property name="alignment"> + <set>Qt::AlignJustify|Qt::AlignTop</set> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <layout class="QFormLayout" name="formLayout_2"> + <item row="0" column="0"> + <widget class="QCheckBox" name="chkTIRViews"> + <property name="layoutDirection"> + <enum>Qt::RightToLeft</enum> + </property> + <property name="text"> + <string>Memory hacks</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Only for very old and buggy old games such as CFS3.</string> + </property> + <property name="scaledContents"> + <bool>false</bool> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> </layout> </widget> <resources> -- cgit v1.2.3 From d20dde371d1ddac288267d7d051735b685a24697 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 26 Sep 2014 23:56:50 +0200 Subject: gain: stupido --- facetracknoir/gain-control.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/facetracknoir/gain-control.hpp b/facetracknoir/gain-control.hpp index 98d45711..73155cd8 100644 --- a/facetracknoir/gain-control.hpp +++ b/facetracknoir/gain-control.hpp @@ -47,7 +47,7 @@ private: static constexpr bool use_box_filter = true; static constexpr int box_size = 16 / 640.; static constexpr double control_upper_bound = 1.0; // XXX FIXME implement for logitech crapola - static constexpr int GAIN_HISTORY_COUNT = 90, GAIN_HISTORY_EVERY_MS = 85; + static constexpr int GAIN_HISTORY_COUNT = 50, GAIN_HISTORY_EVERY_MS = 998; int control; double step, eps; @@ -179,6 +179,7 @@ public: if (GAIN_HISTORY_COUNT > means_history.size() && history_timer.elapsed_ms() > GAIN_HISTORY_EVERY_MS) { + history_timer.start(); means_history.push_front(frame.clone()); if (GAIN_HISTORY_COUNT == means_history.size()) -- cgit v1.2.3 From 2229536858acf1b995ee23bb85196a870473d573 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 26 Sep 2014 23:57:41 +0200 Subject: freepie: try fix apk interop Maybe @KyokushinPL gets it to work now Issue: #48 --- .../ftnoir_tracker_freepie-udp.cpp | 28 ++++++++++++++++++---- .../ftnoir_tracker_freepie-udp.h | 3 ++- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp index ea44133c..9fd9b08f 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp @@ -1,7 +1,6 @@ #include "ftnoir_tracker_freepie-udp.h" #include "facetracknoir/plugin-support.h" -#include <cstddef> #include <cinttypes> TrackerImpl::TrackerImpl() : pose { 0,0,0, 0,0,0 }, should_quit(false) @@ -34,6 +33,15 @@ void TrackerImpl::run() { }; while (1) { + struct check { + union { + std::uint16_t half; + unsigned char bytes[2]; + }; + bool convertp; + check() : bytes { 255, 0 }, convertp(half > 255) {} + } crapola; + if (should_quit) break; { @@ -45,13 +53,14 @@ void TrackerImpl::run() { int sz = sock.readDatagram(reinterpret_cast<char*>(&data), sizeof(data)); int flags = data.flags & F::Mask; - - static constexpr int minsz = offsetof(decltype(data), raw_rot) + sizeof(decltype(data)::raw_rot); + + using t = decltype(data); + static constexpr int minsz = offsetof(t, raw_rot) + sizeof(t::raw_rot); const bool flags_came_out_wrong = minsz > sz; - + if (flags_came_out_wrong) flags &= ~F::flag_Raw; - + switch (flags) { case flag_Raw: @@ -66,6 +75,15 @@ void TrackerImpl::run() { } if (orient) { + if (crapola.convertp) + { + constexpr int sz = sizeof(float[6]); + const int len = sz / 2; + unsigned char* alias = reinterpret_cast<unsigned char*>(orient); + for (int i = 0; i < sz; i++) + alias[i] = alias[sz-i]; + } + QMutexLocker foo(&mtx); for (int i = 0; i < 3; i++) pose[Yaw + i] = orient[i]; diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h index 23f3ace9..de32e64b 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.h @@ -5,9 +5,10 @@ * copyright notice and this permission notice appear in all copies. */ -#include "ui_freepie-udp-controls.h" +#include <cinttypes> #include <QUdpSocket> #include <QThread> +#include "ui_freepie-udp-controls.h" #include "facetracknoir/plugin-api.hpp" #include "facetracknoir/options.h" using namespace options; -- cgit v1.2.3 From c3f704dbb7bf86883ea121dc703b36e46756bdf2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 27 Sep 2014 00:51:17 +0200 Subject: freepie: goddamn hell --- ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp index 9fd9b08f..deea6c7c 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp @@ -39,7 +39,7 @@ void TrackerImpl::run() { unsigned char bytes[2]; }; bool convertp; - check() : bytes { 255, 0 }, convertp(half > 255) {} + check() : bytes { 0, 255 }, convertp(half > 255) {} } crapola; if (should_quit) @@ -80,7 +80,7 @@ void TrackerImpl::run() { constexpr int sz = sizeof(float[6]); const int len = sz / 2; unsigned char* alias = reinterpret_cast<unsigned char*>(orient); - for (int i = 0; i < sz; i++) + for (int i = 0; i < len; i++) alias[i] = alias[sz-i]; } -- cgit v1.2.3 From 0c4ee9855309f2bdadd777e642cbbe6d4a3c5e4a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 27 Sep 2014 10:42:47 +0200 Subject: freepie: once more, with feeling (tm) - don't hand-code octet reversal - don't check for endianness every iteration - in flag_Raw case float[6] orient was being clobbered, use a temporary - reset float[6]* orient ptr to null after usage - don't special-case .apk sending too short dgrams Thanks-to: @KyokushinPL --- .../ftnoir_tracker_freepie-udp.cpp | 90 ++++++++++------------ 1 file changed, 42 insertions(+), 48 deletions(-) diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp index deea6c7c..26726b18 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp @@ -2,6 +2,7 @@ #include "facetracknoir/plugin-support.h" #include <cinttypes> +#include <algorithm> TrackerImpl::TrackerImpl() : pose { 0,0,0, 0,0,0 }, should_quit(false) { @@ -32,62 +33,55 @@ void TrackerImpl::run() { Mask = flag_Raw | flag_Orient }; - while (1) { - struct check { - union { - std::uint16_t half; - unsigned char bytes[2]; - }; - bool convertp; - check() : bytes { 0, 255 }, convertp(half > 255) {} - } crapola; + struct check { + union { + std::uint16_t half; + unsigned char bytes[2]; + }; + bool convertp; + check() : bytes { 0, 255 }, convertp(half > 255) {} + } crapola; + while (1) { if (should_quit) break; - { - float* orient = nullptr; - while (sock.hasPendingDatagrams()) - { - data = decltype(data){0,0, {0,0,0, 0,0,0}}; - int sz = sock.readDatagram(reinterpret_cast<char*>(&data), sizeof(data)); - - int flags = data.flags & F::Mask; + float* orient = nullptr; - using t = decltype(data); - static constexpr int minsz = offsetof(t, raw_rot) + sizeof(t::raw_rot); - const bool flags_came_out_wrong = minsz > sz; - - if (flags_came_out_wrong) - flags &= ~F::flag_Raw; + while (sock.hasPendingDatagrams()) + { + using t = decltype(data); + t tmp {0,0, {0,0,0, 0,0,0}}; + (void) sock.readDatagram(reinterpret_cast<char*>(&tmp), sizeof(data)); + int flags = data.flags & F::Mask; - switch (flags) - { - case flag_Raw: - continue; - case flag_Raw | flag_Orient: - orient = data.raw_rot.rot; - break; - case flag_Orient: - orient = data.rot; - break; - } + switch (flags) + { + case flag_Raw: + continue; + case flag_Raw | flag_Orient: + orient = data.raw_rot.rot; + break; + case flag_Orient: + orient = data.rot; + break; } - if (orient) + data = tmp; + } + if (orient) + { + if (crapola.convertp) { - if (crapola.convertp) - { - constexpr int sz = sizeof(float[6]); - const int len = sz / 2; - unsigned char* alias = reinterpret_cast<unsigned char*>(orient); - for (int i = 0; i < len; i++) - alias[i] = alias[sz-i]; - } - - QMutexLocker foo(&mtx); - for (int i = 0; i < 3; i++) - pose[Yaw + i] = orient[i]; + unsigned char* alias = reinterpret_cast<unsigned char*>(orient); + constexpr int sz = sizeof(float[6]); + std::reverse(alias, alias + sz); } + + QMutexLocker foo(&mtx); + for (int i = 0; i < 3; i++) + pose[Yaw + i] = orient[i]; + + orient = nullptr; } usleep(4000); } @@ -96,7 +90,7 @@ void TrackerImpl::run() { void TrackerImpl::StartTracker(QFrame*) { (void) sock.bind(QHostAddress::Any, (int) s.port, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); - start(); + start(); } void TrackerImpl::GetHeadPoseData(double *data) -- cgit v1.2.3 From c04f90dcc3054d296dc1f6798ccf22f71a10836b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 27 Sep 2014 10:44:23 +0200 Subject: gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 8ea15e74..b1b38c3e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ *~ /build* /installer/Output +# merely git cola saves there +/patches/ -- cgit v1.2.3 From 01f1a5f2b9ed1846423eee0336450f32b836536b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 27 Sep 2014 20:04:47 +0200 Subject: make stuff private, not protected clang generates warnings for unused private stuff, so use that. --- facetracknoir/rotation.h | 60 ++++++++++++++++++------------------- ftnoir_tracker_aruco/trans_calib.h | 22 +++++++------- ftnoir_tracker_pt/camera.h | 53 ++++++++++++++++---------------- ftnoir_tracker_pt/point_extractor.h | 26 ++++++++-------- ftnoir_tracker_pt/trans_calib.h | 22 +++++++------- 5 files changed, 92 insertions(+), 91 deletions(-) diff --git a/facetracknoir/rotation.h b/facetracknoir/rotation.h index d40fb6cf..5ff5ce61 100644 --- a/facetracknoir/rotation.h +++ b/facetracknoir/rotation.h @@ -11,40 +11,40 @@ class RotationType { public: - RotationType() : a(1.0),b(0.0),c(0.0),d(0.0) {} - RotationType(double yaw, double pitch, double roll) { fromEuler(yaw, pitch, roll); } - RotationType(double a, double b, double c, double d) : a(a),b(b),c(c),d(d) {} - - RotationType inv(){ - return RotationType(a,-b,-c, -d); - } - - - // conversions - // see http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles - void fromEuler(double yaw, double pitch, double roll) - { - - double sin_phi = sin(roll/2.0); - double cos_phi = cos(roll/2.0); - double sin_the = sin(pitch/2.0); - double cos_the = cos(pitch/2.0); - double sin_psi = sin(yaw/2.0); - double cos_psi = cos(yaw/2.0); - - a = cos_phi*cos_the*cos_psi + sin_phi*sin_the*sin_psi; - b = sin_phi*cos_the*cos_psi - cos_phi*sin_the*sin_psi; - c = cos_phi*sin_the*cos_psi + sin_phi*cos_the*sin_psi; - d = cos_phi*cos_the*sin_psi - sin_phi*sin_the*cos_psi; - } - + RotationType() : a(1.0),b(0.0),c(0.0),d(0.0) {} + RotationType(double yaw, double pitch, double roll) { fromEuler(yaw, pitch, roll); } + RotationType(double a, double b, double c, double d) : a(a),b(b),c(c),d(d) {} + + RotationType inv(){ + return RotationType(a,-b,-c, -d); + } + + + // conversions + // see http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles + void fromEuler(double yaw, double pitch, double roll) + { + + double sin_phi = sin(roll/2.0); + double cos_phi = cos(roll/2.0); + double sin_the = sin(pitch/2.0); + double cos_the = cos(pitch/2.0); + double sin_psi = sin(yaw/2.0); + double cos_psi = cos(yaw/2.0); + + a = cos_phi*cos_the*cos_psi + sin_phi*sin_the*sin_psi; + b = sin_phi*cos_the*cos_psi - cos_phi*sin_the*sin_psi; + c = cos_phi*sin_the*cos_psi + sin_phi*cos_the*sin_psi; + d = cos_phi*cos_the*sin_psi - sin_phi*sin_the*cos_psi; + } + void toEuler(double& yaw, double& pitch, double& roll) const { roll = atan2(2.0*(a*b + c*d), 1.0 - 2.0*(b*b + c*c)); pitch = asin(2.0*(a*c - b*d)); yaw = atan2(2.0*(a*d + b*c), 1.0 - 2.0*(c*c + d*d)); } - + const RotationType operator*(const RotationType& B) const { const RotationType& A = *this; @@ -54,6 +54,6 @@ public: A.a*B.d + A.b*B.c - A.c*B.b + A.d*B.a); } -protected: - double a,b,c,d; // quaternion coefficients +private: + double a,b,c,d; // quaternion coefficients }; diff --git a/ftnoir_tracker_aruco/trans_calib.h b/ftnoir_tracker_aruco/trans_calib.h index 609c9af1..5c321b2c 100644 --- a/ftnoir_tracker_aruco/trans_calib.h +++ b/ftnoir_tracker_aruco/trans_calib.h @@ -20,20 +20,20 @@ class TranslationCalibrator { public: - TranslationCalibrator(); + TranslationCalibrator(); - // reset the calibration process - void reset(); + // reset the calibration process + void reset(); - // update the current estimate - void update(const cv::Matx33f& R_CM_k, const cv::Vec3f& t_CM_k); + // update the current estimate + void update(const cv::Matx33f& R_CM_k, const cv::Vec3f& t_CM_k); - // get the current estimate for t_MH - cv::Vec3f get_estimate(); + // get the current estimate for t_MH + cv::Vec3f get_estimate(); -protected: - cv::Matx66f P; // normalized precision matrix = inverse covariance - cv::Vec6f y; // P*(-t_MH, t_CH) +private: + cv::Matx66f P; // normalized precision matrix = inverse covariance + cv::Vec6f y; // P*(-t_MH, t_CH) }; -#endif //TRANSCALIB_H \ No newline at end of file +#endif //TRANSCALIB_H diff --git a/ftnoir_tracker_pt/camera.h b/ftnoir_tracker_pt/camera.h index 86cafd42..2bca88a1 100644 --- a/ftnoir_tracker_pt/camera.h +++ b/ftnoir_tracker_pt/camera.h @@ -25,11 +25,11 @@ void get_camera_device_names(std::vector<std::string>& device_names); // ---------------------------------------------------------------------------- struct CamInfo { - CamInfo() : res_x(0), res_y(0), fps(0) {} + CamInfo() : res_x(0), res_y(0), fps(0) {} - int res_x; - int res_y; - int fps; + int res_x; + int res_y; + int fps; }; // ---------------------------------------------------------------------------- @@ -65,7 +65,7 @@ protected: virtual void _set_device_index() = 0; virtual void _set_fps() = 0; virtual void _set_res() = 0; - +private: float dt_valid; float dt_mean; int desired_index; @@ -82,18 +82,19 @@ inline Camera::~Camera() {} class CVCamera : public Camera { public: - CVCamera() : cap(NULL) {} - ~CVCamera() { stop(); } + CVCamera() : cap(NULL) {} + ~CVCamera() { stop(); } - void start() override; - void stop() override; + void start() override; + void stop() override; protected: - bool _get_frame(cv::Mat* frame) override; - void _set_fps() override; - void _set_res() override; + bool _get_frame(cv::Mat* frame) override; + void _set_fps() override; + void _set_res() override; void _set_device_index() override; +private: cv::VideoCapture* cap; }; #else @@ -102,21 +103,21 @@ protected: class VICamera : public Camera { public: - VICamera(); - ~VICamera() { stop(); } + VICamera(); + ~VICamera() { stop(); } - virtual void start(); - virtual void stop(); + virtual void start(); + virtual void stop(); protected: - virtual bool _get_frame(cv::Mat* frame); - virtual void _set_device_index(); - virtual void _set_fps(); - virtual void _set_res(); - - videoInput VI; - cv::Mat new_frame; - unsigned char* frame_buffer; + virtual bool _get_frame(cv::Mat* frame); + virtual void _set_device_index(); + virtual void _set_fps(); + virtual void _set_res(); + + videoInput VI; + cv::Mat new_frame; + unsigned char* frame_buffer; }; #endif @@ -128,12 +129,12 @@ enum RotationType }; // ---------------------------------------------------------------------------- -class FrameRotation +class FrameRotation { public: RotationType rotation; - cv::Mat rotate_frame(cv::Mat frame); + cv::Mat rotate_frame(cv::Mat frame); }; #endif //CAMERA_H diff --git a/ftnoir_tracker_pt/point_extractor.h b/ftnoir_tracker_pt/point_extractor.h index 21d548af..3ef82900 100644 --- a/ftnoir_tracker_pt/point_extractor.h +++ b/ftnoir_tracker_pt/point_extractor.h @@ -15,21 +15,21 @@ // Extracts points from an opencv image class PointExtractor { -public: - // extracts points from frame and draws some processing info into frame, if draw_output is set - // dt: time since last call in seconds - // WARNING: returned reference is valid as long as object - const std::vector<cv::Vec2f>& extract_points(cv::Mat &frame); - const std::vector<cv::Vec2f>& get_points() { return points; } - PointExtractor(); +public: + // extracts points from frame and draws some processing info into frame, if draw_output is set + // dt: time since last call in seconds + // WARNING: returned reference is valid as long as object + const std::vector<cv::Vec2f>& extract_points(cv::Mat &frame); + const std::vector<cv::Vec2f>& get_points() { return points; } + PointExtractor(); - int threshold_val; - int threshold_secondary_val; - int min_size, max_size; + int threshold_val; + int threshold_secondary_val; + int min_size, max_size; -protected: - std::vector<cv::Vec2f> points; - cv::Mat frame_last; +private: + std::vector<cv::Vec2f> points; + cv::Mat frame_last; }; #endif //POINTEXTRACTOR_H diff --git a/ftnoir_tracker_pt/trans_calib.h b/ftnoir_tracker_pt/trans_calib.h index 609c9af1..5c321b2c 100644 --- a/ftnoir_tracker_pt/trans_calib.h +++ b/ftnoir_tracker_pt/trans_calib.h @@ -20,20 +20,20 @@ class TranslationCalibrator { public: - TranslationCalibrator(); + TranslationCalibrator(); - // reset the calibration process - void reset(); + // reset the calibration process + void reset(); - // update the current estimate - void update(const cv::Matx33f& R_CM_k, const cv::Vec3f& t_CM_k); + // update the current estimate + void update(const cv::Matx33f& R_CM_k, const cv::Vec3f& t_CM_k); - // get the current estimate for t_MH - cv::Vec3f get_estimate(); + // get the current estimate for t_MH + cv::Vec3f get_estimate(); -protected: - cv::Matx66f P; // normalized precision matrix = inverse covariance - cv::Vec6f y; // P*(-t_MH, t_CH) +private: + cv::Matx66f P; // normalized precision matrix = inverse covariance + cv::Vec6f y; // P*(-t_MH, t_CH) }; -#endif //TRANSCALIB_H \ No newline at end of file +#endif //TRANSCALIB_H -- cgit v1.2.3 From e44bc913ca3d212e5e8eea8c70c47d58c633f335 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 27 Sep 2014 20:58:23 +0200 Subject: options: move to base class for clarity --- facetracknoir/options.h | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/facetracknoir/options.h b/facetracknoir/options.h index ce705033..291ac071 100644 --- a/facetracknoir/options.h +++ b/facetracknoir/options.h @@ -29,6 +29,8 @@ namespace options { template<typename T> + // don't elide usages of the function, qvariant default implicit + // conversion results in nonsensical runtime behavior -sh inline T qcruft_to_t (const QVariant& t); template<> @@ -174,16 +176,28 @@ namespace options { } }; - typedef std::shared_ptr<impl_bundle> pbundle; + using pbundle = std::shared_ptr<impl_bundle>; class base_value : public QObject { Q_OBJECT public: base_value(pbundle b, const QString& name) : b(b), self_name(name), cookie_snap(0) {} - protected: virtual QVariant operator=(const QVariant& datum) = 0; + template<typename T> + QVariant operator=(const T& datum) + { + return this->operator =(qVariantFromValue<T>(datum)); + } + protected: pbundle b; QString self_name; + template<typename T> + QVariant store(const T& datum) + { + b->store(self_name, qVariantFromValue<T>(datum)); + emit valueChanged(datum); + return datum; + } void maybe_lazy_change() { long cookie = b->cookie(); @@ -211,33 +225,22 @@ namespace options { template<typename T> class value : public base_value { - protected: + public: QVariant operator=(const QVariant& datum) { - auto foo = qcruft_to_t<T>(datum); - b->store(self_name, qVariantFromValue<T>(foo)); - emit valueChanged(foo); - return datum; + return store(qcruft_to_t<T>(datum)); } - public: static constexpr const Qt::ConnectionType QT_CONNTYPE = Qt::UniqueConnection; static constexpr const Qt::ConnectionType OPT_CONNTYPE = Qt::UniqueConnection; - value(pbundle b, const QString& name, T def) : - base_value(b, name) + value(pbundle b, const QString& name, T def) : base_value(b, name) { if (!b->contains(name) || b->get<QVariant>(name).type() == QVariant::Invalid) - { this->operator=(qVariantFromValue<T>(def)); - } } operator T() { maybe_lazy_change(); return b->get<T>(self_name); } - QVariant operator=(const T& datum) - { - return this->operator =(qVariantFromValue<T>(datum)); - } }; template<typename T, typename Q> -- cgit v1.2.3 From 8ba44aa35d45c1b16e755e2917421281b3e3f7bd Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 27 Sep 2014 20:58:40 +0200 Subject: whitespace only --- facetracknoir/curve-config.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/facetracknoir/curve-config.cpp b/facetracknoir/curve-config.cpp index 81383688..abf03a5e 100644 --- a/facetracknoir/curve-config.cpp +++ b/facetracknoir/curve-config.cpp @@ -3,11 +3,11 @@ CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidget *parent) : QWidget( parent, Qt::Dialog ), mainApp(ftnoir) { - ui.setupUi( this ); - + ui.setupUi( this ); + // rest of mapping settings taken care of by options::value<t> mainApp->load_mappings(); - + { struct { QFunctionConfigurator* qfc; @@ -21,7 +21,7 @@ CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidge { ui.txconfig, TX, false }, { ui.tyconfig, TY, false }, { ui.tzconfig, TZ, false }, - + { ui.rxconfig_alt, Yaw, true }, { ui.ryconfig_alt, Pitch, true}, { ui.rzconfig_alt, Roll, true }, @@ -30,24 +30,21 @@ CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidge { ui.tzconfig_alt, TZ, true }, { nullptr, Yaw, false } }; - + for (int i = 0; qfcs[i].qfc; i++) { const bool altp = qfcs[i].altp; THeadPoseDOF& axis = mainApp->axis(qfcs[i].axis); FunctionConfig* conf = altp ? &axis.curveAlt : &axis.curve; const auto& name = qfcs[i].altp ? axis.name2 : axis.name1; - + qfcs[i].qfc->setConfig(conf, name); } } - + setFont(qApp->font()); QPoint offsetpos(120, 30); - this->move(parent->pos() + offsetpos); - - - + this->move(parent->pos() + offsetpos); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); @@ -75,7 +72,7 @@ CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidge tie_setting(mainApp->s.a_x.invert, ui.invert_x); tie_setting(mainApp->s.a_y.invert, ui.invert_y); tie_setting(mainApp->s.a_z.invert, ui.invert_z); - + tie_setting(mainApp->s.a_yaw.src, ui.src_yaw); tie_setting(mainApp->s.a_pitch.src, ui.src_pitch); tie_setting(mainApp->s.a_roll.src, ui.src_roll); @@ -85,8 +82,8 @@ CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidge } void CurveConfigurationDialog::doOK() { - save(); - this->close(); + save(); + this->close(); } void CurveConfigurationDialog::doCancel() { -- cgit v1.2.3 From 70ee3ec9e12f70c581911882b14aa1e31c8a4033 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 27 Sep 2014 20:58:59 +0200 Subject: unbreak build, needs access from subclass --- ftnoir_tracker_pt/camera.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ftnoir_tracker_pt/camera.h b/ftnoir_tracker_pt/camera.h index 2bca88a1..7ebbcb67 100644 --- a/ftnoir_tracker_pt/camera.h +++ b/ftnoir_tracker_pt/camera.h @@ -68,6 +68,7 @@ protected: private: float dt_valid; float dt_mean; +protected: int desired_index; int active_index; bool active; -- cgit v1.2.3 From 64c4efe12e7cc1739551578b242b73481b99931b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 27 Sep 2014 20:59:22 +0200 Subject: don't recalculate covariance for N frames like a drooling retard --- facetracknoir/gain-control.hpp | 96 ++++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 45 deletions(-) diff --git a/facetracknoir/gain-control.hpp b/facetracknoir/gain-control.hpp index 73155cd8..5958e945 100644 --- a/facetracknoir/gain-control.hpp +++ b/facetracknoir/gain-control.hpp @@ -31,9 +31,9 @@ namespace detail { zip_iterator(const t1& it1, const t1& end1, const t2& it2, const t2& end2) : x1(it1), z1(end1), x2(it2), z2(end2) { maybe_end(); } constexpr zip_iterator() {} - + static constexpr self end() { return self(); } - + self operator++() { x1++; x2++; self tmp = *this; maybe_end(); return tmp; } self operator++(int) { self tmp(*this); x1++; x2++; maybe_end(); return tmp; } bool operator==(const self& rhs) const { return x1 == rhs.x1 && x2 == rhs.x2; } @@ -48,27 +48,30 @@ private: static constexpr int box_size = 16 / 640.; static constexpr double control_upper_bound = 1.0; // XXX FIXME implement for logitech crapola static constexpr int GAIN_HISTORY_COUNT = 50, GAIN_HISTORY_EVERY_MS = 998; - + + using t_frame = cv::Mat_<unsigned char>; + int control; double step, eps; - - std::deque<cv::Mat> means_history; + + t_frame last_frame; + std::deque<double> means_history; Timer debug_timer, history_timer; - + typedef unsigned char px; template<typename t1, typename t2, typename t, typename m = t> using zip_iterator = detail::zip_iterator<t1, t2, t, m>; - + static double mean(const cv::Mat& frame) { // grayscale only assert(frame.channels() == 1); assert(frame.elemSize() == 1); assert(!frame.empty()); - + return std::accumulate(frame.begin<px>(), frame.end<px>(), 0.) / (frame.rows * frame.cols); } - + static double get_variance(const cv::Mat& frame, double mean) { struct variance { @@ -82,20 +85,20 @@ private: return seed + tmp * tmp; } } logic(mean); - + return std::accumulate(frame.begin<unsigned char>(), frame.end<unsigned char>(), 0., logic) / (frame.rows * frame.cols); } - + static double get_covariance(const cv::Mat& frame, const cv::Mat& old_frame) { double mean_0 = mean(frame), mean_1 = mean(old_frame); - + struct covariance { public: using pair = std::tuple<px, px>; private: double mu_0, mu_1; - + inline double Cov(double seed, const pair& t) { px p0 = std::get<0>(t); @@ -104,40 +107,40 @@ private: } public: covariance(double mu_0, double mu_1) : mu_0(mu_0), mu_1(mu_1) {} - + double operator()(double seed, const pair& t) { return Cov(seed, t); } } logic(mean_0, mean_1); - + const double N = frame.rows * frame.cols; - + using zipper = zip_iterator<cv::MatConstIterator_<px>, cv::MatConstIterator_<px>, std::tuple<px, px>>; - + zipper zip(frame.begin<px>(), frame.end<px>(), old_frame.begin<px>(), old_frame.end<px>()); std::vector<covariance::pair> values(zip, zipper::end()); - + return std::accumulate(values.begin(), values.end(), 0., logic) / N; } - + #pragma GCC diagnostic ignored "-Wsign-compare" - + public: Gain(int control = CV_CAP_PROP_GAIN, double step = 0.3, double eps = 0.02) : control(control), step(step), eps(eps) { } - + void tick(cv::VideoCapture&, const cv::Mat& frame_) { cv::Mat frame; - + if (use_box_filter) { cv::Mat tmp(frame_); @@ -148,42 +151,45 @@ public: } else frame = frame_; - + + if (last_frame.rows != frame.rows || last_frame.cols != frame.cols) + last_frame = t_frame(); + + if (last_frame.empty()) + { + last_frame = frame.clone(); + //return; + } + + if (history_timer.elapsed_ms() > GAIN_HISTORY_EVERY_MS) + { + const double cov = get_covariance(frame, last_frame); + history_timer.start(); + last_frame = frame.clone(); + + if (means_history.size() == GAIN_HISTORY_COUNT) + means_history.pop_back(); + } + if (debug_timer.elapsed_ms() > 1000) { const double mu = mean(frame); const double var = get_variance(frame, mu); - + debug_timer.start(); qDebug() << "---- gain:" << "mean" << mu << "variance" << var; const int sz = means_history.size(); if (sz) - fprintf(stderr, "covs: "); - - for (int i = 0; i < sz; i++) { - if (means_history[i].rows != frame.rows || means_history[i].cols != frame.cols) - { - means_history.clear(); - qDebug() << "\n!!! resolution reset"; - break; - } - fprintf(stderr, "%f ", get_covariance(frame, means_history[i])); - } + fprintf(stderr, "covs{%d}: ", sz); + + for (int i = 0; i < sz; i++) + fprintf(stderr, "%f ", means_history[i]); - if (sz) fprintf(stderr, "\n"); - } - - if (GAIN_HISTORY_COUNT > means_history.size() && history_timer.elapsed_ms() > GAIN_HISTORY_EVERY_MS) - { - history_timer.start(); - means_history.push_front(frame.clone()); - - if (GAIN_HISTORY_COUNT == means_history.size()) - means_history.pop_back(); + } } } }; -- cgit v1.2.3 From 2843048fcb63485989bfc82d47280c1a5c94d689 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 27 Sep 2014 22:22:20 +0200 Subject: fix FreePIE udp sender finally With enormous thanks to @KyokushinPL for resources invested. Issue: #48 --- .../ftnoir_tracker_freepie-udp.cpp | 63 ++++++++-------------- 1 file changed, 21 insertions(+), 42 deletions(-) diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp index 26726b18..ad505229 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp.cpp @@ -15,73 +15,59 @@ TrackerImpl::~TrackerImpl() } void TrackerImpl::run() { +#pragma pack(push, 1) struct { - uint8_t pad; + uint8_t pad1; uint8_t flags; - union { - float rot[6]; - struct { - float pad[9]; - float rot[6]; - } raw_rot; - }; + uint8_t pad2; + float fl[12]; } data; - +#pragma pack(pop) enum F { flag_Raw = 1 << 0, flag_Orient = 1 << 1, Mask = flag_Raw | flag_Orient }; - struct check { - union { - std::uint16_t half; - unsigned char bytes[2]; - }; - bool convertp; - check() : bytes { 0, 255 }, convertp(half > 255) {} - } crapola; - while (1) { if (should_quit) break; - float* orient = nullptr; + float orient[3]; + bool filled = false; while (sock.hasPendingDatagrams()) { using t = decltype(data); - t tmp {0,0, {0,0,0, 0,0,0}}; + t tmp {0,0,0, {0,0,0, 0,0,0}}; (void) sock.readDatagram(reinterpret_cast<char*>(&tmp), sizeof(data)); - int flags = data.flags & F::Mask; + + int flags = tmp.flags & F::Mask; switch (flags) { case flag_Raw: continue; case flag_Raw | flag_Orient: - orient = data.raw_rot.rot; + for (int i = 0; i < 3; i++) + orient[i] = tmp.fl[i+9]; break; case flag_Orient: - orient = data.rot; + for (int i = 0; i < 3; i++) + orient[i] = tmp.fl[i]; break; } + + filled = true; data = tmp; } - if (orient) - { - if (crapola.convertp) - { - unsigned char* alias = reinterpret_cast<unsigned char*>(orient); - constexpr int sz = sizeof(float[6]); - std::reverse(alias, alias + sz); - } + if (filled) + { QMutexLocker foo(&mtx); + static constexpr double d2r = 57.295781; for (int i = 0; i < 3; i++) - pose[Yaw + i] = orient[i]; - - orient = nullptr; + pose[Yaw + i] = d2r * orient[i]; } usleep(4000); } @@ -96,14 +82,7 @@ void TrackerImpl::StartTracker(QFrame*) void TrackerImpl::GetHeadPoseData(double *data) { QMutexLocker foo(&mtx); -#if 0 - if (s.enable_x) - data[TX] = pose[TX]; - if (s.enable_y) - data[TY] = pose[TY]; - if (s.enable_z) - data[TZ] = pose[TZ]; -#endif + data[Yaw] = pose[Yaw]; data[Pitch] = pose[Pitch]; data[Roll] = pose[Roll]; -- cgit v1.2.3 From e1d3df8a07177ae04948dc6e9b7c4d2af7972b5f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 28 Sep 2014 00:33:21 +0200 Subject: fix pose digitcount --- facetracknoir/facetracknoir.ui | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/facetracknoir/facetracknoir.ui b/facetracknoir/facetracknoir.ui index 1a006809..1d769f0d 100644 --- a/facetracknoir/facetracknoir.ui +++ b/facetracknoir/facetracknoir.ui @@ -598,7 +598,7 @@ <enum>QFrame::NoFrame</enum> </property> <property name="digitCount"> - <number>1</number> + <number>3</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Outline</enum> @@ -620,7 +620,7 @@ <enum>QFrame::NoFrame</enum> </property> <property name="digitCount"> - <number>1</number> + <number>3</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Outline</enum> @@ -668,7 +668,7 @@ <enum>QFrame::NoFrame</enum> </property> <property name="digitCount"> - <number>1</number> + <number>3</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Outline</enum> @@ -690,7 +690,7 @@ <enum>QFrame::NoFrame</enum> </property> <property name="digitCount"> - <number>1</number> + <number>3</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Outline</enum> @@ -750,7 +750,7 @@ <enum>QFrame::NoFrame</enum> </property> <property name="digitCount"> - <number>1</number> + <number>3</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Outline</enum> @@ -798,7 +798,7 @@ <enum>QFrame::NoFrame</enum> </property> <property name="digitCount"> - <number>1</number> + <number>3</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Outline</enum> @@ -857,7 +857,7 @@ <bool>true</bool> </property> <property name="digitCount"> - <number>1</number> + <number>3</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> @@ -885,7 +885,7 @@ <bool>true</bool> </property> <property name="digitCount"> - <number>1</number> + <number>3</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> @@ -935,7 +935,7 @@ <bool>true</bool> </property> <property name="digitCount"> - <number>1</number> + <number>3</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> @@ -991,7 +991,7 @@ <bool>true</bool> </property> <property name="digitCount"> - <number>1</number> + <number>3</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> @@ -1069,7 +1069,7 @@ <bool>true</bool> </property> <property name="digitCount"> - <number>1</number> + <number>3</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> @@ -1119,7 +1119,7 @@ <bool>true</bool> </property> <property name="digitCount"> - <number>1</number> + <number>3</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> @@ -1170,11 +1170,6 @@ </item> </layout> </widget> - <zorder>video_feed</zorder> - <zorder>controls</zorder> - <zorder>headpose</zorder> - <zorder>octopus</zorder> - <zorder>box_mapped_headpose</zorder> </widget> </widget> <customwidgets> -- cgit v1.2.3 From 355ac9296f00eac6dca51fd183f2a0b742729810 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 1 Oct 2014 07:56:47 +0200 Subject: add tarball target --- CMakeLists.txt | 9 +++++++++ make-tar.sh | 17 +++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 make-tar.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index fc6fe98a..18486080 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -498,3 +498,12 @@ endif() if(WIN32) install(FILES "${CMAKE_SOURCE_DIR}/bin/cleye.config" DESTINATION .) endif() + +string(TIMESTAMP filename-date "%Y%m%d") +set(filename-ostype ${CMAKE_SYSTEM_NAME}) +set(filename_0 opentrack-build-${filename-ostype}-${filename-date}) +string(TOLOWER "${filename_0}" filename_1) +set(filename "${CMAKE_BINARY_DIR}/${filename_1}.tar.xz") + +add_custom_command(OUTPUT ${filename} COMMAND env sh "${CMAKE_SOURCE_DIR}/make-tar.sh" "${CMAKE_INSTALL_PREFIX}" "${filename}") +add_custom_target(tarball DEPENDS ${filename}) diff --git a/make-tar.sh b/make-tar.sh new file mode 100644 index 00000000..26b65dcb --- /dev/null +++ b/make-tar.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +prefix="$1" +filename="$2" + +if : && + make install && + cd $(dirname -- "${prefix}") && + tar Jcf "${filename}" $(basename "${prefix}") +then + ls -lh -- "${filename}" +else + rm -fv -- "${filename}" + exit 1 +fi + +exit 0 -- cgit v1.2.3 From feaa7dae8e55b0d5c18868fe298bc8ad2122860f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Wed, 1 Oct 2014 08:20:48 +0200 Subject: prettify tarball names --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 18486080..1ceffd54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -501,7 +501,13 @@ endif() string(TIMESTAMP filename-date "%Y%m%d") set(filename-ostype ${CMAKE_SYSTEM_NAME}) -set(filename_0 opentrack-build-${filename-ostype}-${filename-date}) +get_git_head_revision(filename-branch_0 filename-hash_0) +if(filename-hash_0) + string(SUBSTRING "${filename-hash_0}" 0 7 filename-hash) +endif() +string(REPLACE "refs/heads/" "" filename-branch_1 "${filename-branch_0}") +string(REPLACE "/" "-" filename-branch "${filename-branch_1}") +set(filename_0 opentrack-${filename-ostype}-${filename-branch}-${filename-date}-${filename-hash}) string(TOLOWER "${filename_0}" filename_1) set(filename "${CMAKE_BINARY_DIR}/${filename_1}.tar.xz") -- cgit v1.2.3 From 3f18a2e9bf16ea1f9eb681d42aefe0d1270612a8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 3 Oct 2014 20:53:30 +0200 Subject: prevent reset to origin on pause hotkey Issue: #72 Reported-by: @Pretagonist --- facetracknoir/tracker.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 72ad22b4..003324a7 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -40,10 +40,10 @@ Tracker::~Tracker() static void get_curve(double pos, double& out, THeadPoseDOF& axis) { bool altp = (pos < 0) && axis.opts.altp; axis.curve.setTrackingActive( !altp ); - axis.curveAlt.setTrackingActive( altp ); + axis.curveAlt.setTrackingActive( altp ); auto& fc = altp ? axis.curveAlt : axis.curve; out = (axis.opts.invert ? -1 : 1) * fc.getValue(pos); - + out += axis.opts.zero; } @@ -114,13 +114,13 @@ void Tracker::run() { for (int i = 0; i < 6; i++) { raw_6dof.axes[i] = newpose[i]; - + auto& axis = mainApp->axis(i); - + int k = axis.opts.src; if (k < 0 || k >= 6) continue; - + axis.headPos = newpose[k]; } @@ -143,6 +143,8 @@ void Tracker::run() { target_camera2 = target_camera - offset_camera; } + else + target_camera2 = raw_6dof; if (Libraries->pFilter) { Libraries->pFilter->FilterHeadPoseData(target_camera2.axes, new_camera.axes); @@ -158,7 +160,7 @@ void Tracker::run() { t_compensate(output_camera.axes, output_camera.axes, mainApp->s.tcomp_tz); if (Libraries->pProtocol) { - Libraries->pProtocol->sendHeadposeToGame( output_camera.axes ); + Libraries->pProtocol->sendHeadposeToGame(output_camera.axes); } } -- cgit v1.2.3 From b8c5e24223988c84331693371bb9b0d71b7ef821 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Fri, 3 Oct 2014 21:12:41 +0200 Subject: fix toggle axis enablement properly --- facetracknoir/tracker.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 003324a7..17f1af5f 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -136,15 +136,13 @@ void Tracker::run() { T6DOF target_camera, target_camera2, new_camera; - if (enabled) - { + if (!enabled) + target_camera = raw_6dof; + else for (int i = 0; i < 6; i++) target_camera.axes[i] = mainApp->axis(i).headPos; - target_camera2 = target_camera - offset_camera; - } - else - target_camera2 = raw_6dof; + target_camera2 = target_camera - offset_camera; if (Libraries->pFilter) { Libraries->pFilter->FilterHeadPoseData(target_camera2.axes, new_camera.axes); -- cgit v1.2.3 From 97bd173ee4b6f30c12ca590e213b21bbc83f8617 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 4 Oct 2014 17:28:49 +0200 Subject: flush before windows breaks and data lossage --- CMakeLists.txt | 14 +- .../README-CREDIT.txt | 6 + .../ft_tester/Makefile.am | 54 +++ .../ft_tester/Makefile.in | 491 ++++++++++++++++++++ .../ft_tester/fttester.rc.in | 67 +++ .../ft_tester/main.cpp | 211 +++++++++ .../ft_tester/resource.h | 27 ++ .../important-stuff/NPClient.h | 17 + .../important-stuff/NPClient.spec | 23 + .../important-stuff/NPClient_dll.h | 58 +++ .../important-stuff/NPClient_main.c | 444 ++++++++++++++++++ .../important-stuff/game_data.c | 149 ++++++ .../important-stuff/game_data.h | 17 + .../tester/Makefile.am | 78 ++++ .../tester/Makefile.in | 512 +++++++++++++++++++++ .../tester/main.cpp | 100 ++++ .../tester/npifc.c | 302 ++++++++++++ .../tester/npifc.h | 66 +++ .../tester/npview.rc.in | 49 ++ .../tester/resource.h | 23 + .../tester/rest.c | 1 + .../tester/rest.h | 1 + facetracknoir/curve-config.cpp | 71 +-- facetracknoir/curve-config.h | 8 +- facetracknoir/facetracknoir.cpp | 213 ++++----- facetracknoir/facetracknoir.h | 59 ++- facetracknoir/mappings.hpp | 79 ++++ facetracknoir/plugin-qt-api.hpp | 8 +- facetracknoir/plugin-support.h | 2 +- facetracknoir/qcopyable-mutex.hpp | 37 ++ facetracknoir/rotation.h | 19 +- facetracknoir/tracker.cpp | 82 ++-- facetracknoir/tracker.h | 77 +--- facetracknoir/tracker_types.cpp | 43 -- facetracknoir/tracker_types.h | 65 ++- freetrackclient/freetrackclient.c | 38 +- ftnoir_filter_kalman/ftnoir_filter_kalman.h | 11 +- ftnoir_protocol_ft/fttypes.h | 10 +- qfunctionconfigurator/functionconfig.cpp | 24 +- qfunctionconfigurator/functionconfig.h | 81 +--- qfunctionconfigurator/qfunctionconfigurator.cpp | 2 +- qfunctionconfigurator/qfunctionconfigurator.h | 6 +- 42 files changed, 3173 insertions(+), 472 deletions(-) create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/resource.h create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.h create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.spec create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_dll.h create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_main.c create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in create mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h create mode 120000 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c create mode 120000 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h create mode 100644 facetracknoir/mappings.hpp create mode 100644 facetracknoir/qcopyable-mutex.hpp delete mode 100644 facetracknoir/tracker_types.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ceffd54..655d70c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.11) cmake_policy(SET CMP0020 NEW) if(MSVC) - message(FATAL_ERROR "Support for MSVC removed due to incomplete C++11 support") + message(FATAL_ERROR "Support for MSVC removed due to incomplete C++11 support") endif() include(CMakeParseArguments) @@ -131,9 +131,9 @@ endif() set(EXTRA-MOCS "${CMAKE_SOURCE_DIR}/facetracknoir/options.h") function(link_with_dinput8 n) - if(WIN32) - target_link_libraries(${n} dinput8 dxguid strmiids) - endif() + if(WIN32) + target_link_libraries(${n} dinput8 dxguid strmiids) + endif() endfunction() macro(opentrack_module n dir) @@ -376,9 +376,9 @@ if(SDK_RIFT) target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" winmm setupapi ws2_32 imagehlp wbemuuid) else() if(NOT APPLE) - target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" udev Xinerama) + target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a" udev Xinerama) else() - target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a") + target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/libLibOVR.a") endif() endif() endif() @@ -426,7 +426,7 @@ if(UNIX OR APPLE) SET_TARGET_PROPERTIES(opentrack-qxt-mini PROPERTIES COMPILE_FLAGS "-DBUILD_QXT_CORE=42 -DBUILD_QXT_WIDGETS=42 -DBUILD_QXT_GUI=42") target_link_libraries(opentrack-qxt-mini ${MY_QT_LIBS}) if(NOT APPLE) - target_link_libraries(opentrack-qxt-mini X11) + target_link_libraries(opentrack-qxt-mini X11) endif() endif() diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt b/facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt new file mode 100644 index 00000000..82214139 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt @@ -0,0 +1,6 @@ +The contents of the directory written by one and only, uglyDwarf. + +Obtained at epoch time 1412397452 from the mithril-mine's shaft, where +the elite dwarves reside. + +For the latest happenings, visit <https://code.google.com/p/linux-track/> diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am new file mode 100644 index 00000000..02747edb --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am @@ -0,0 +1,54 @@ +noinst_SCRIPTS = +if WINE_PLUGIN + noinst_SCRIPTS += ftc.exe.so +endif #WINE_PLUGIN + +if DARWIN + LDFLAGS += -Wl,-no_arch_warnings +else + LDFLAGS += -Wl,--no-warn-search-mismatch +endif + +CC = winegcc + +CXX = wineg++ + +SUFFIXES = .o .cpp .c .rc + +.cpp.o : + $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< + +CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ +CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ +RCFLAGS = -I @srcdir@ +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + +ftc.exe.so : main.o fttester.o + wineg++ -g -o $@ -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +fttester.o : fttester.rc resource.h config.h + +main.o : main.cpp + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +EXTRA_DIST = resource.h fttester.rc main.cpp + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in new file mode 100644 index 00000000..d1fff34d --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in @@ -0,0 +1,491 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@WINE_PLUGIN_TRUE@am__append_1 = ftc.exe.so +@DARWIN_TRUE@am__append_2 = -Wl,-no_arch_warnings +@DARWIN_FALSE@am__append_3 = -Wl,--no-warn-search-mismatch +subdir = src/wine_bridge/ft_tester +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/fttester.rc.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = fttester.rc +CONFIG_CLEAN_VPATH_FILES = +SCRIPTS = $(noinst_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON = @BISON@ +CC = winegcc +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = wineg++ +CXXCPP = @CXXCPP@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ $(am__append_2) $(am__append_3) +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIB32DIR = @LIB32DIR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENCV_CFLAGS = @OPENCV_CFLAGS@ +OPENCV_LIBS = @OPENCV_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +QMAKE_PATH = @QMAKE_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WINE64_LIBS = @WINE64_LIBS@ +WINE_LIBS = @WINE_LIBS@ +XPL_CPPFLAGS = @XPL_CPPFLAGS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +with_makensis = @with_makensis@ +with_wine64 = @with_wine64@ +noinst_SCRIPTS = $(am__append_1) +SUFFIXES = .o .cpp .c .rc +CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ +CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ +RCFLAGS = -I @srcdir@ +EXTRA_DIST = resource.h fttester.rc main.cpp +all: all-am + +.SUFFIXES: +.SUFFIXES: .o .cpp .c .rc +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/ft_tester/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/ft_tester/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +fttester.rc: $(top_builddir)/config.status $(srcdir)/fttester.rc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-local + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + clean-local cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distclean-local distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am + + +.cpp.o : + $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + +ftc.exe.so : main.o fttester.o + wineg++ -g -o $@ -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +fttester.o : fttester.rc resource.h config.h + +main.o : main.cpp + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in new file mode 100644 index 00000000..332f3c73 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in @@ -0,0 +1,67 @@ +// Generated by ResEdit 1.5.9 +// Copyright (C) 2006-2011 +// http://www.resedit.net + +#include <windows.h> +#include <commctrl.h> +#include <richedit.h> +#include "resource.h" + +#ifdef HAVE_CONFIG_H + #include "../../../config.h" +#endif + + + + +// +// Dialog resources +// +//LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_DIALOG1 DIALOGEX 0, 0, 333, 183 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "FreeTrack client test utility v@PACKAGE_VERSION@" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + DEFPUSHBUTTON "Quit", IDQUIT, 262, 153, 50, 14 + PUSHBUTTON "Start", IDC_START, 199, 153, 50, 14 + EDITTEXT IDC_YAW, 38, 15, 48, 14, ES_AUTOHSCROLL + RTEXT "Yaw", IDC_STATIC, 12, 17, 21, 14, SS_RIGHT + EDITTEXT IDC_PITCH, 38, 38, 48, 14, ES_AUTOHSCROLL + RTEXT "Pitch", IDC_STATIC, 16, 40, 17, 14, SS_RIGHT + EDITTEXT IDC_ROLL, 38, 61, 48, 14, ES_AUTOHSCROLL + RTEXT "Roll", IDC_STATIC, 20, 63, 13, 14, SS_RIGHT + EDITTEXT IDC_X, 38, 84, 48, 14, ES_AUTOHSCROLL + RTEXT "X", IDC_STATIC, 27, 86, 6, 14, SS_RIGHT + EDITTEXT IDC_Y, 38, 107, 48, 14, ES_AUTOHSCROLL + RTEXT "Y", IDC_STATIC, 27, 109, 6, 14, SS_RIGHT + EDITTEXT IDC_Z, 38, 130, 48, 14, ES_AUTOHSCROLL + RTEXT "Z", IDC_STATIC, 27, 132, 6, 14, SS_RIGHT + EDITTEXT IDC_RYAW, 137, 15, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Yaw", IDC_STATIC, 101, 17, 32, 8, SS_RIGHT + EDITTEXT IDC_RPITCH, 137, 38, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Pitch", IDC_STATIC, 99, 40, 34, 8, SS_RIGHT + EDITTEXT IDC_RROLL, 137, 61, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Roll", IDC_STATIC, 103, 63, 30, 8, SS_RIGHT + EDITTEXT IDC_RX, 137, 84, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw X", IDC_STATIC, 111, 86, 22, 8, SS_RIGHT + EDITTEXT IDC_RY, 137, 107, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Y", IDC_STATIC, 111, 109, 22, 8, SS_RIGHT + EDITTEXT IDC_RZ, 137, 130, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Z", IDC_STATIC, 111, 132, 22, 8, SS_RIGHT + EDITTEXT IDC_NUM, 264, 15, 48, 14, ES_AUTOHSCROLL + RTEXT "Frame Number", IDC_STATIC, 212, 17, 47, 8, SS_RIGHT + EDITTEXT IDC_RES, 264, 38, 48, 14, ES_AUTOHSCROLL + RTEXT "Camera Resolution", IDC_STATIC, 199, 40, 60, 8, SS_RIGHT + EDITTEXT IDC_PT0, 227, 61, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 1", IDC_STATIC, 199, 63, 23, 8, SS_RIGHT + EDITTEXT IDC_PT1, 227, 84, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 2", IDC_STATIC, 199, 86, 23, 8, SS_RIGHT + EDITTEXT IDC_PT2, 227, 107, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 3", IDC_STATIC, 199, 109, 23, 8, SS_RIGHT + EDITTEXT IDC_PT3, 227, 130, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 4", IDC_STATIC, 199, 132, 23, 8, SS_RIGHT + EDITTEXT IDC_TITLE, 38, 153, 147, 14, ES_AUTOHSCROLL + RTEXT "Title", IDC_STATIC, 19, 155, 14, 8, SS_RIGHT +} + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp new file mode 100644 index 00000000..a737f88f --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp @@ -0,0 +1,211 @@ +#define WIN32_LEAN_AND_MEAN + +#include <windows.h> +#include <cstdio> +#include <stdint.h> +#include <sstream> +#include <cstdlib> +#include <iomanip> + +#include "resource.h" + +HINSTANCE hInst; +UINT_PTR timer = 0; + +HMODULE ftclient; + +typedef struct +{ + unsigned int dataID; + int res_x; int res_y; + float yaw; // positive yaw to the left + float pitch;// positive pitch up + float roll;// positive roll to the left + float x; + float y; + float z; + // raw pose with no smoothing, sensitivity, response curve etc. + float ryaw; + float rpitch; + float rroll; + float rx; + float ry; + float rz; + // raw points, sorted by Y, origin top left corner + float x0, y0; + float x1, y1; + float x2, y2; + float x3, y3; +}FreeTrackData; + + +typedef bool (WINAPI *importGetData)(FreeTrackData * data); +typedef char *(WINAPI *importGetDllVersion)(void); +typedef void (WINAPI *importReportName)(char *name); +typedef char *(WINAPI *importProvider)(void); + +importGetData getData; +importGetDllVersion getDllVersion; +importReportName reportName; +importProvider provider; + + +char *client_path() +{ + HKEY hkey = 0; + RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Freetrack\\FreetrackClient", 0, + KEY_QUERY_VALUE, &hkey); + if(!hkey){ + printf("Can't open registry key\n"); + return NULL; + } + + BYTE path[1024]; + DWORD buf_len = 1024; + LONG result = RegQueryValueEx(hkey, "Path", NULL, NULL, path, &buf_len); + char *full_path = (char *)malloc(2048); + if(result == ERROR_SUCCESS && buf_len > 0){ + sprintf(full_path, "%s\\FreeTrackClient.dll", path); + } + RegCloseKey(hkey); + return full_path; +} + + +bool start(HWND hwnd) +{ + char *libname = client_path(); + if(libname == NULL){ + printf("Freetrack client not found!\n"); + return false; + } + ftclient = LoadLibrary(libname); + if(ftclient == NULL){ + printf("Couldn't load Freetrack client library '%s'!\n", libname); + return false; + } + printf("Freetrack client library %s loaded.\n", client_path()); + + + getData = (importGetData)GetProcAddress(ftclient, "FTGetData"); + getDllVersion = (importGetDllVersion)GetProcAddress(ftclient, "FTGetDllVersion"); + reportName = (importReportName)GetProcAddress(ftclient, "FTReportName"); + provider = (importProvider)GetProcAddress(ftclient, "FTProvider"); + + if((getData == NULL) || (getDllVersion == NULL) || (reportName == NULL) || (provider == NULL)){ + printf("Couldn't load Freetrack client functions!\n"); + FreeLibrary(ftclient); + return false; + } + + printf("Dll version: %s\n", getDllVersion()); + printf("Provider: %s\n", provider()); + char title[1024]; + GetDlgItemText(hwnd, IDC_TITLE, title, 1020); + reportName(title); + return true; +} + +void reportError(std::string msg) +{ + MessageBoxA(0, "FreeTrack client test", msg.c_str(), 0); +} +VOID CALLBACK TimerProcedure(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +{ + (void) uMsg; + (void) idEvent; + (void) dwTime; + FreeTrackData d; + getData(&d); + SetDlgItemInt(hwnd, IDC_PITCH, d.pitch, true); + SetDlgItemInt(hwnd, IDC_ROLL, d.roll, true); + SetDlgItemInt(hwnd, IDC_YAW, d.yaw, true); + + SetDlgItemInt(hwnd, IDC_X, d.x, true); + SetDlgItemInt(hwnd, IDC_Y, d.y, true); + SetDlgItemInt(hwnd, IDC_Z, d.z, true); + + SetDlgItemInt(hwnd, IDC_RPITCH, d.rpitch, true); + SetDlgItemInt(hwnd, IDC_RROLL, d.rroll, true); + SetDlgItemInt(hwnd, IDC_RYAW, d.ryaw, true); + + SetDlgItemInt(hwnd, IDC_RX, d.rx, true); + SetDlgItemInt(hwnd, IDC_RY, d.ry, true); + SetDlgItemInt(hwnd, IDC_RZ, d.rz, true); + + std::ostringstream s; + s.str(std::string()); + s<<"("<<std::fixed<<std::setprecision(1)<<d.x0<<"; "<<d.y0<<")"; + SetDlgItemText(hwnd, IDC_PT0, s.str().c_str()); + + s.str(std::string()); + s<<"("<<std::fixed<<std::setprecision(1)<<d.x1<<"; "<<d.y1<<")"; + SetDlgItemText(hwnd, IDC_PT1, s.str().c_str()); + + s.str(std::string()); + s<<"("<<std::fixed<<std::setprecision(1)<<d.x2<<"; "<<d.y2<<")"; + SetDlgItemText(hwnd, IDC_PT2, s.str().c_str()); + + s.str(std::string()); + s<<"("<<std::fixed<<std::setprecision(1)<<d.x3<<"; "<<d.y3<<")"; + SetDlgItemText(hwnd, IDC_PT3, s.str().c_str()); + + s.str(std::string()); + s<<d.res_x<<"x"<<d.res_y; + SetDlgItemText(hwnd, IDC_RES, s.str().c_str()); + SetDlgItemInt(hwnd, IDC_NUM, d.dataID, true); +} + +BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + (void) lParam; + switch(uMsg) + { + case WM_INITDIALOG: + SetDlgItemText(hwndDlg, IDC_TITLE, "Default"); + return TRUE; + + case WM_CLOSE: + EndDialog(hwndDlg, 0); + return TRUE; + + case WM_COMMAND: + switch(LOWORD(wParam)) + { + /* + * TODO: Add more control ID's, when needed. + */ + case IDQUIT: + FreeLibrary(ftclient); + EndDialog(hwndDlg, 0); + return TRUE; + case IDC_START: + start(hwndDlg); +//l int ok; +// int num = GetDlgItemInt(hwndDlg, IDC_APPID, (BOOL*)&ok, false); + if(timer != 0){ + KillTimer(hwndDlg, timer); + timer = 0; + } + timer = SetTimer(hwndDlg, 0, 50, TimerProcedure); + break; + + } + } + + return FALSE; +} + + +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) +{ + (void) hPrevInstance; + (void) lpCmdLine; + (void) nShowCmd; + hInst = hInstance; + + // The user interface is a modal dialog box + return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DialogProc); +} + + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/resource.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/resource.h new file mode 100644 index 00000000..8bba17b4 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/resource.h @@ -0,0 +1,27 @@ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_DIALOG1 100 +#define IDQUIT 1002 +#define IDC_YAW 1005 +#define IDC_PITCH 1023 +#define IDC_ROLL 1024 +#define IDC_X 1025 +#define IDC_Y 1026 +#define IDC_Z 1027 +#define IDC_RYAW 1028 +#define IDC_RPITCH 1029 +#define IDC_RROLL 1030 +#define IDC_RX 1031 +#define IDC_RY 1032 +#define IDC_RZ 1033 +#define IDC_NUM 1034 +#define IDC_RES 1035 +#define IDC_PT0 1036 +#define IDC_PT1 1037 +#define IDC_PT2 1038 +#define IDC_PT3 1039 +#define IDC_START 1040 +#define IDC_TITLE 1041 + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.h new file mode 100644 index 00000000..770e1c71 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.h @@ -0,0 +1,17 @@ + +extern int NP_RegisterWindowHandle (HWND hwnd); +extern int NP_UnregisterWindowHandle (void); +extern int NP_RegisterProgramProfileID (unsigned short id); +extern int NP_QueryVersion (unsigned short *version); +extern int NP_RequestData (unsigned short req); +extern int NP_GetSignature (tir_signature_t *sig); +extern int NP_GetData (tir_data_t *data); +extern int NP_GetParameter (void); +extern int NP_SetParameter (void); +extern int NP_StartCursor (void); +extern int NP_StopCursor (void); +extern int NP_ReCenter (void); +extern int NP_StartDataTransmission (void); +extern int NP_StopDataTransmission (void); + + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.spec b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.spec new file mode 100644 index 00000000..7fe5f1b4 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.spec @@ -0,0 +1,23 @@ +# Generated from NPClient.dll by winedump + +1 stub NPPriv_ClientNotify +2 stub NPPriv_GetLastError +3 stub NPPriv_SetData +4 stub NPPriv_SetLastError +5 stub NPPriv_SetParameter +6 stub NPPriv_SetSignature +7 stub NPPriv_SetVersion +8 stdcall NP_GetData( ptr ) NPCLIENT_NP_GetData +9 stdcall NP_GetParameter( long long) NPCLIENT_NP_GetParameter +10 stdcall NP_GetSignature( ptr ) NPCLIENT_NP_GetSignature +11 stdcall NP_QueryVersion( ptr ) NPCLIENT_NP_QueryVersion +12 stdcall NP_ReCenter() NPCLIENT_NP_ReCenter +13 stdcall NP_RegisterProgramProfileID( long ) NPCLIENT_NP_RegisterProgramProfileID +14 stdcall NP_RegisterWindowHandle( ptr ) NPCLIENT_NP_RegisterWindowHandle +15 stdcall NP_RequestData( long ) NPCLIENT_NP_RequestData +16 stdcall NP_SetParameter( long long ) NPCLIENT_NP_SetParameter +17 stdcall NP_StartCursor() NPCLIENT_NP_StartCursor +18 stdcall NP_StartDataTransmission() NPCLIENT_NP_StartDataTransmission +19 stdcall NP_StopCursor() NPCLIENT_NP_StopCursor +20 stdcall NP_StopDataTransmission() NPCLIENT_NP_StopDataTransmission +21 stdcall NP_UnregisterWindowHandle() NPCLIENT_NP_UnregisterWindowHandle diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_dll.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_dll.h new file mode 100644 index 00000000..b0bab5db --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_dll.h @@ -0,0 +1,58 @@ +/* + * NPClient.dll + * + * Generated from NPClient.dll by winedump. + * + * DO NOT SEND GENERATED DLLS FOR INCLUSION INTO WINE ! + * + */ +#ifndef __WINE_NPCLIENT_DLL_H +#define __WINE_NPCLIENT_DLL_H + +#include "windef.h" +#include "wine/debug.h" +#include "winbase.h" +#include "winnt.h" + +#pragma pack(1) +typedef struct tir_data{ + short status; + short frame; + unsigned int cksum; + float roll, pitch, yaw; + float tx, ty, tz; + float padding[9]; +} tir_data_t; + +typedef struct tir_signature{ + char DllSignature[200]; + char AppSignature[200]; +} tir_signature_t; +#pragma pack(0) + + +/* __stdcall NPCLIENT_NPPriv_ClientNotify(); */ +/* __stdcall NPCLIENT_NPPriv_GetLastError(); */ +/* __stdcall NPCLIENT_NPPriv_SetData(); */ +/* __stdcall NPCLIENT_NPPriv_SetLastError(); */ +/* __stdcall NPCLIENT_NPPriv_SetParameter(); */ +/* __stdcall NPCLIENT_NPPriv_SetSignature(); */ +/* __stdcall NPCLIENT_NPPriv_SetVersion(); */ +int __stdcall NPCLIENT_NP_GetData(tir_data_t * data); +int __stdcall NPCLIENT_NP_GetParameter(int arg0, int arg1); +int __stdcall NPCLIENT_NP_GetSignature(tir_signature_t * sig); +int __stdcall NPCLIENT_NP_QueryVersion(unsigned short * version); +int __stdcall NPCLIENT_NP_ReCenter(void); +int __stdcall NPCLIENT_NP_RegisterProgramProfileID(unsigned short id); +int __stdcall NPCLIENT_NP_RegisterWindowHandle(HWND hwnd); +int __stdcall NPCLIENT_NP_RequestData(unsigned short req); +int __stdcall NPCLIENT_NP_SetParameter(int arg0, int arg1); +int __stdcall NPCLIENT_NP_StartCursor(void); +int __stdcall NPCLIENT_NP_StartDataTransmission(void); +int __stdcall NPCLIENT_NP_StopCursor(void); +int __stdcall NPCLIENT_NP_StopDataTransmission(void); +int __stdcall NPCLIENT_NP_UnregisterWindowHandle(void); + + + +#endif /* __WINE_NPCLIENT_DLL_H */ diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_main.c b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_main.c new file mode 100644 index 00000000..f892f89e --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_main.c @@ -0,0 +1,444 @@ +/* + * NPClient.dll + * + * Generated from NPClient.dll by winedump. + * + * DO NOT SUBMIT GENERATED DLLS FOR INCLUSION INTO WINE! + * + */ + +#include <linuxtrack.h> +#include "rest.h" +//#include "config.h" +#define __WINESRC__ + +#include <stdarg.h> +#include <string.h> +#include <stdbool.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include "windef.h" +#include "winbase.h" +#include "NPClient_dll.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(NPClient); + +bool crypted = false; +static unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static int dbg_flag; + +static void dbg_report(const char *msg,...) +{ + static FILE *f = NULL; + if(dbg_flag){ + if(f == NULL){ + f = fopen("NPClient.log", "w"); + } + va_list ap; + va_start(ap,msg); + vfprintf(f, msg, ap); + fflush(f); + va_end(ap); + } +} + + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); + + switch (fdwReason) + { + case DLL_WINE_PREATTACH: + return TRUE; + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + dbg_flag = getDebugFlag('w'); + dbg_report("Attach request\n"); + break; + case DLL_PROCESS_DETACH: + linuxtrack_shutdown(); + break; + } + + return TRUE; +} +/****************************************************************** + * NPPriv_ClientNotify (NPCLIENT.1) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_ClientNotify() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_GetLastError (NPCLIENT.2) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_GetLastError() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetData (NPCLIENT.3) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetData() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetLastError (NPCLIENT.4) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetLastError() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetParameter (NPCLIENT.5) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetParameter() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetSignature (NPCLIENT.6) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetSignature() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetVersion (NPCLIENT.7) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetVersion() +{ + /* @stub in .spec */ +} +#endif + +static float limit_num(float min, float val, float max) +{ + if(val < min) return min; + if(val > max) return max; + return val; +} + +static unsigned int cksum(unsigned char buf[], unsigned int size) +{ + if((size == 0) || (buf == NULL)){ + return 0; + } + + int rounds = size >> 2; + int rem = size % 4; + + int c = size; + int a0, a2; +// printf("Orig: "); +//for(a0 = 0; a0 < (int)size; ++a0) +//{ +// printf("%02X", buf[a0]); +//} +//printf("\n"); + while(rounds != 0){ + a0 = *(short int*)buf; + a2 = *(short int*)(buf+2); + buf += 4; + c += a0; + a2 ^= (c << 5); + a2 <<= 11; + c ^= a2; + c += (c >> 11); + --rounds; + } + switch(rem){ + case 3: + a0 = *(short int*)buf; + a2 = *(signed char*)(buf+2); + c += a0; + a2 = (a2 << 2) ^ c; + c ^= (a2 << 16); + a2 = (c >> 11); + break; + case 2: + a2 = *(short int*)buf; + c += a2; + c ^= (c << 11); + a2 = (c >> 17); + break; + case 1: + a2 = *(signed char*)(buf); + c += a2; + c ^= (c << 10); + a2 = (c >> 1); + break; + default: + break; + } + if(rem != 0){ + c+=a2; + } + + c ^= (c << 3); + c += (c >> 5); + c ^= (c << 4); + c += (c >> 17); + c ^= (c << 25); + c += (c >> 6); + + return (unsigned int)c; +} + +static void enhance(unsigned char buf[], unsigned int size, + unsigned char codetable[], unsigned int table_size) +{ + unsigned int table_ptr = 0; + unsigned char var = 0x88; + unsigned char tmp; + if((size <= 0) || (table_size <= 0) || + (buf == NULL) || (codetable == NULL)){ + return; + } + do{ + tmp = buf[--size]; + buf[size] = tmp ^ codetable[table_ptr] ^ var; + var += size + tmp; + ++table_ptr; + if(table_ptr >= table_size){ + table_ptr -= table_size; + } + }while(size != 0); +} + + +/****************************************************************** + * NP_GetData (NPCLIENT.8) + * + * + */ +int __stdcall NPCLIENT_NP_GetData(tir_data_t * data) +{ + float r, p, y, tx, ty, tz; + unsigned int frame; + int res = linuxtrack_get_pose(&y, &p, &r, &tx, &ty, &tz, &frame); + memset((char *)data, 0, sizeof(tir_data_t)); + data->status = (linuxtrack_get_tracking_state() == RUNNING) ? 0 : 1; + data->frame = frame & 0xFFFF; + data->cksum = 0; + data->roll = r / 180.0 * 16383; + data->pitch = -p / 180.0 * 16383; + data->yaw = y / 180.0 * 16383; + data->tx = -limit_num(-16383.0, 15 * tx, 16383); + data->ty = limit_num(-16383.0, 15 * ty, 16383); + data->tz = limit_num(-16383.0, 15 * tz, 16383); + data->cksum = cksum((unsigned char*)data, sizeof(tir_data_t)); + //printf("Cksum: %04X\n", data->cksum); + if(crypted){ + enhance((unsigned char*)data, sizeof(tir_data_t), table, sizeof(table)); + } + return (res >= 0) ? 0: 1; +} +/****************************************************************** + * NP_GetParameter (NPCLIENT.9) + * + * + */ +int __stdcall NPCLIENT_NP_GetParameter(int arg0, int arg1) +{ + dbg_report("GetParameter request: %d %d\n", arg0, arg1); + TRACE("(void): stub\n"); + return (int) 0; +} + +/****************************************************************** + * NP_GetSignature (NPCLIENT.10) + * + * + */ +int __stdcall NPCLIENT_NP_GetSignature(tir_signature_t * sig) +{ + dbg_report("GetSignature request\n"); + if(getSomeSeriousPoetry(sig->DllSignature, sig->AppSignature)){ + printf("Signature result: OK\n"); + return 0; + }else{ + printf("Signature result: NOT OK!\n"); + return 1; + } +} +/****************************************************************** + * NP_QueryVersion (NPCLIENT.11) + * + * + */ +int __stdcall NPCLIENT_NP_QueryVersion(unsigned short * version) +{ + dbg_report("QueryVersion request\n"); + *version=0x0500; + return 0; +} +/****************************************************************** + * NP_ReCenter (NPCLIENT.12) + * + * + */ +int __stdcall NPCLIENT_NP_ReCenter(void) +{ + dbg_report("ReCenter request\n"); + linuxtrack_recenter(); + return 0; +} + +/****************************************************************** + * NP_RegisterProgramProfileID (NPCLIENT.13) + * + * + */ +int __stdcall NPCLIENT_NP_RegisterProgramProfileID(unsigned short id) +{ + dbg_report("RegisterProgramProfileID request: %d\n", id); + game_desc_t gd; + if(game_data_get_desc(id, &gd)){ + printf("Application ID: %d - %s!!!\n", id, gd.name); + if(game_data_get_desc(id, &gd)){ + crypted = gd.encrypted; + if(gd.encrypted){ + printf("Table: %02X %02X %02X %02X %02X %02X %02X %02X\n", table[0],table[1],table[2],table[3],table[4], + table[5], table[6], table[7]); + table[0] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[1] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[2] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[3] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[4] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[5] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[6] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[7] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + } + } + if(linuxtrack_init(gd.name) != 0){ + return 1; + } + }else{ + if(!linuxtrack_init("Default")){ + return 1; + } + } + linuxtrack_suspend(); + return 0; +} +/****************************************************************** + * NP_RegisterWindowHandle (NPCLIENT.14) + * + * + */ +int __stdcall NPCLIENT_NP_RegisterWindowHandle(HWND hwnd) +{ + dbg_report("RegisterWindowHandle request: 0x%X\n", hwnd); + TRACE("((HWND)%p): stub\n",hwnd); + return (int) 0; +} +/****************************************************************** + * NP_RequestData (NPCLIENT.15) + * + * + */ +int __stdcall NPCLIENT_NP_RequestData(unsigned short req) +{ + dbg_report("RequestData request: %d\n", req); + TRACE("((unsigned short)%d): stub\n",req); + return (int) 0; +} +/****************************************************************** + * NP_SetParameter (NPCLIENT.16) + * + * + */ +int __stdcall NPCLIENT_NP_SetParameter(int arg0, int arg1) +{ + dbg_report("SetParameter request: %d %d\n", arg0, arg1); + TRACE("(void): stub\n"); + return (int) 0; +} +/****************************************************************** + * NP_StartCursor (NPCLIENT.17) + * + * + */ +int __stdcall NPCLIENT_NP_StartCursor(void) +{ + dbg_report("StartCursor request\n"); + TRACE("(void): stub\n"); + return (int) 0; +} +/****************************************************************** + * NP_StartDataTransmission (NPCLIENT.18) + * + * + */ +int __stdcall NPCLIENT_NP_StartDataTransmission(void) +{ + dbg_report("StartDataTransmission request\n"); + linuxtrack_wakeup(); + return 0; +} +/****************************************************************** + * NP_StopCursor (NPCLIENT.19) + * + * + */ +int __stdcall NPCLIENT_NP_StopCursor(void) +{ + dbg_report("StopCursor request\n"); + TRACE("(void): stub\n"); + return (int) 0; +} +/****************************************************************** + * NP_StopDataTransmission (NPCLIENT.20) + * + * + */ +int __stdcall NPCLIENT_NP_StopDataTransmission(void) +{ + dbg_report("StopDataTransmission request\n"); + linuxtrack_suspend(); + return 0; +} +/****************************************************************** + * NP_UnregisterWindowHandle (NPCLIENT.21) + * + * + */ +int __stdcall NPCLIENT_NP_UnregisterWindowHandle(void) +{ + dbg_report("UnregisterWindowHandle request\n"); + TRACE("(void): stub\n"); + return (int) 0; +} + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c new file mode 100644 index 00000000..3197ba37 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c @@ -0,0 +1,149 @@ +#define _GNU_SOURCE +#include <stdio.h> +#include <stdlib.h> +#include <mxml.h> +#include <stdbool.h> +#include <stdint.h> +#include <sys/stat.h> +#include <string.h> +#include <utils.h> + + +//First 5 bytes is MD5 hash of "NaturalPoint" +static uint8_t secret_key[] = {0x0e, 0x9a, 0x63, 0x71, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static uint8_t S[256] = {0}; + +static char *decoded = NULL; + +static mxml_node_t *xml = NULL; +static mxml_node_t *tree = NULL; + +static void ksa(uint8_t key[], size_t len) +{ + unsigned int i, j; + for(i = 0; i < 256; ++i){ + S[i] = i; + } + j = 0; + for(i = 0; i < 256; ++i){ + j = (j + S[i] + key[i % len]) % 256; + uint8_t tmp = S[i]; + S[i] = S[j]; + S[j] = tmp; + } +} + +static uint8_t rc4() +{ + static uint8_t i = 0; + static uint8_t j = 0; + + i += 1; + j += S[i]; + uint8_t tmp = S[i]; + S[i] = S[j]; + S[j] = tmp; + return S[(S[i] + S[j]) % 256]; +} + +static bool decrypt_file(const char *fname, bool from_update) +{ + uint32_t header[5]; + size_t datlen; + ksa(secret_key, 16); + FILE *inp; + struct stat fst; + + if((inp = fopen(fname, "rb")) == NULL){ + printf("Can't open input file '%s'", fname); + return false; + } + + if(fstat(fileno(inp), &fst) != 0){ + fclose(inp); + printf("Cannot stat file '%s'\n", fname); + return false; + } + + if(from_update){ + if(fread(&header, sizeof(uint32_t), 5, inp) != 5){ + fclose(inp); + printf("Can't read the header - file '%s' is less than 20 bytes long?\n", fname); + return false; + } + datlen = header[4]; + }else{ + datlen = fst.st_size; + } + if((decoded = (char *)malloc(datlen+1)) == NULL){ + printf("malloc failed!\n"); + return false; + } + memset(decoded, 0, datlen+1); + size_t i; + size_t len = fread(decoded, 1, datlen, inp); + (void) len; + for(i = 0; i < datlen; ++i) decoded[i] ^= rc4(); + fclose(inp); + + //inp = fopen("tmp.dump", "w"); + //fwrite(decoded, 1, datlen, inp); + //fclose(inp); + + return true; +} + +static bool game_data_init(const char *fname, bool from_update) +{ + static bool initialized = false; + if(initialized){ + return true; + } + if(!decrypt_file(fname, from_update)){ + printf("Error decrypting file!\n"); + return false; + } + xml = mxmlNewXML("1.0"); + tree = mxmlLoadString(xml, decoded, MXML_TEXT_CALLBACK); + return (tree != NULL); +} + +static void game_data_close() +{ + mxmlDelete(tree); + free(decoded); +} + +bool get_game_data(const char *input_fname, const char *output_fname, bool from_update) +{ + FILE *outfile = NULL; + if((outfile = fopen(output_fname, "w")) == NULL){ + ltr_int_log_message("Can't open the output file '%s'!\n", output_fname); + return false; + } + if(!game_data_init(input_fname, from_update)){ + ltr_int_log_message("Can't process the data file '%s'!\n", input_fname); + return false; + } + + mxml_node_t *game; + const char *name; + const char *id; + for(game = mxmlFindElement(tree, tree, "Game", NULL, NULL, MXML_DESCEND); + game != NULL; + game = mxmlFindElement(game, tree, "Game", NULL, NULL, MXML_DESCEND)){ + name = mxmlElementGetAttr(game, "Name"); + id = mxmlElementGetAttr(game, "Id"); + + mxml_node_t *appid = mxmlFindElement(game, game, "ApplicationID", NULL, NULL, MXML_DESCEND); + if(appid == NULL){ + fprintf(outfile, "%s \"%s\"\n", id, name); + }else{ + fprintf(outfile, "%s \"%s\" (%s)\n", id, name, appid->child->value.text.string); + } + } + fclose(outfile); + game_data_close(); + return true; +} + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h new file mode 100644 index 00000000..b71f7a15 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h @@ -0,0 +1,17 @@ +#ifndef GAME_DATA__H +#define GAME_DATA__H + +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + +bool get_game_data(const char *input_fname, const char *output_fname, bool from_update); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am new file mode 100644 index 00000000..e025209a --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am @@ -0,0 +1,78 @@ +noinst_SCRIPTS = +if WINE_PLUGIN + noinst_SCRIPTS += Tester.exe +if WINE64 + noinst_SCRIPTS += Tester64.exe +endif #WINE64 +endif #WINE_PLUGIN + +if DARWIN + LDFLAGS += -Wl,-no_arch_warnings +else + LDFLAGS += -Wl,--no-warn-search-mismatch +endif + +CC = winegcc + +CXX = wineg++ + +SUFFIXES = .o .cpp .c .rc 64.o + +.cpp.o : + $(CXX) -c $(CXXFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS) -m32 -o $@ $< + +.cpp64.o : + $(CXX) -c $(CXXFLAGS) -o $@ $< + +.c64.o : + $(CC) -c $(CFLAGS) -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< + +CXXFLAGS += -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ +CFLAGS += -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ +RCFLAGS = -I @srcdir@ +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + + +Tester64.exe : main64.o rest64.o npifc64.o npview.o + wineg++ -g -o Tester64 -L. $(WINE64_LIBS) $(LDFLAGS) -Wall -Wextra $^ + +Tester.exe : main.o npview.o rest.o npifc.o + wineg++ -g -o Tester -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +main.o : main.cpp Makefile + +main64.o : main.cpp Makefile + +npview.o : npview.rc + +rest.o : rest.c rest.h Makefile + +rest64.o : rest.c rest.h Makefile + +npifc.o : npifc.c npifc.h Makefile + +npifc64.o : CFLAGS+="-DFOR_WIN64=1" +npifc64.o : npifc.c npifc.h Makefile + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +EXTRA_DIST = main.cpp npifc.c npifc.h resource.h rest.c rest.h + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in new file mode 100644 index 00000000..cc49d754 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in @@ -0,0 +1,512 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@WINE_PLUGIN_TRUE@am__append_1 = Tester.exe +@WINE64_TRUE@@WINE_PLUGIN_TRUE@am__append_2 = Tester64.exe +@DARWIN_TRUE@am__append_3 = -Wl,-no_arch_warnings +@DARWIN_FALSE@am__append_4 = -Wl,--no-warn-search-mismatch +subdir = src/wine_bridge/tester +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/npview.rc.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = npview.rc +CONFIG_CLEAN_VPATH_FILES = +SCRIPTS = $(noinst_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON = @BISON@ +CC = winegcc +CFLAGS = @CFLAGS@ -g -I../.. -I../../.. -DHAVE_CONFIG_H \ + -I@srcdir@/../.. -I@top_builddir@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = wineg++ +CXXCPP = @CXXCPP@ +CXXFLAGS = @CXXFLAGS@ -g -DHAVE_CONFIG_H -I../../.. -I. \ + -I@srcdir@/../.. -I@top_builddir@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ $(am__append_3) $(am__append_4) +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIB32DIR = @LIB32DIR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENCV_CFLAGS = @OPENCV_CFLAGS@ +OPENCV_LIBS = @OPENCV_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +QMAKE_PATH = @QMAKE_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WINE64_LIBS = @WINE64_LIBS@ +WINE_LIBS = @WINE_LIBS@ +XPL_CPPFLAGS = @XPL_CPPFLAGS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +with_makensis = @with_makensis@ +with_wine64 = @with_wine64@ +noinst_SCRIPTS = $(am__append_1) $(am__append_2) +SUFFIXES = .o .cpp .c .rc 64.o +RCFLAGS = -I @srcdir@ +EXTRA_DIST = main.cpp npifc.c npifc.h resource.h rest.c rest.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .o .cpp .c .rc 64.o +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/tester/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/tester/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +npview.rc: $(top_builddir)/config.status $(srcdir)/npview.rc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-local + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + clean-local cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distclean-local distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am + + +.cpp.o : + $(CXX) -c $(CXXFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS) -m32 -o $@ $< + +.cpp64.o : + $(CXX) -c $(CXXFLAGS) -o $@ $< + +.c64.o : + $(CC) -c $(CFLAGS) -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + +Tester64.exe : main64.o rest64.o npifc64.o npview.o + wineg++ -g -o Tester64 -L. $(WINE64_LIBS) $(LDFLAGS) -Wall -Wextra $^ + +Tester.exe : main.o npview.o rest.o npifc.o + wineg++ -g -o Tester -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +main.o : main.cpp Makefile + +main64.o : main.cpp Makefile + +npview.o : npview.rc + +rest.o : rest.c rest.h Makefile + +rest64.o : rest.c rest.h Makefile + +npifc.o : npifc.c npifc.h Makefile + +npifc64.o : CFLAGS+="-DFOR_WIN64=1" +npifc64.o : npifc.c npifc.h Makefile + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp new file mode 100644 index 00000000..95ca0d9b --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp @@ -0,0 +1,100 @@ +#define WIN32_LEAN_AND_MEAN + +#include <windows.h> +#include <stdio.h> +#include <stdint.h> +#include "resource.h" +#include "rest.h" +#include "npifc.h" + +HINSTANCE hInst; +UINT_PTR timer = 0; + +VOID CALLBACK TimerProcedure(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +{ + (void) uMsg; + (void) idEvent; + (void) dwTime; + tir_data_t td; + npifc_getdata(&td); + SetDlgItemInt(hwnd, IDC_PITCH, td.pitch, true); + SetDlgItemInt(hwnd, IDC_ROLL, td.roll, true); + SetDlgItemInt(hwnd, IDC_YAW, td.yaw, true); + + SetDlgItemInt(hwnd, IDC_X1, td.tx, true); + SetDlgItemInt(hwnd, IDC_Y1, td.ty, true); + SetDlgItemInt(hwnd, IDC_Z1, td.tz, true); + + SetDlgItemInt(hwnd, IDC_X2, td.padding[0], true); + SetDlgItemInt(hwnd, IDC_Y2, td.padding[1], true); + SetDlgItemInt(hwnd, IDC_Z2, td.padding[2], true); + SetDlgItemInt(hwnd, IDC_X3, td.padding[3], true); + SetDlgItemInt(hwnd, IDC_Y3, td.padding[4], true); + SetDlgItemInt(hwnd, IDC_Z3, td.padding[5], true); + SetDlgItemInt(hwnd, IDC_S, td.status, true); + SetDlgItemInt(hwnd, IDC_F, td.frame, true); +} + +BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + (void) lParam; + switch(uMsg) + { + case WM_INITDIALOG: + SetDlgItemInt(hwndDlg, IDC_APPID, 2307, true); + return TRUE; + + case WM_CLOSE: + EndDialog(hwndDlg, 0); + return TRUE; + + case WM_COMMAND: + switch(LOWORD(wParam)) + { + /* + * TODO: Add more control ID's, when needed. + */ + case IDQUIT: + npifc_close(); + EndDialog(hwndDlg, 0); + return TRUE; + case IDSTART: + int ok; + int num = GetDlgItemInt(hwndDlg, IDC_APPID, (BOOL*)&ok, false); + if(!ok){ + num = 2307; + } + game_desc_t gd; + if(timer != 0){ + KillTimer(hwndDlg, timer); + timer = 0; + } + if(game_data_get_desc(num, &gd)){ + printf("Application ID: %d - %s\n", num, gd.name); + if(npifc_init(hwndDlg, num)){ + timer = SetTimer(hwndDlg, 0, 50, TimerProcedure); + } + }else{ + printf("Unknown Application ID: %d\n", num); + } + break; + + } + } + + return FALSE; +} + + +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) +{ + (void) hPrevInstance; + (void) lpCmdLine; + (void) nShowCmd; + hInst = hInstance; + + // The user interface is a modal dialog box + return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DialogProc); +} + + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c new file mode 100644 index 00000000..b036464e --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c @@ -0,0 +1,302 @@ +#define _GNU_SOURCE +#include <stdio.h> +#include <stdint.h> +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include "npifc.h" +#include "rest.h" + + +tir_signature_t ts; +HMODULE npclient; +/* +typedef int (*NP_RegisterWindowHandle_t)(HWND hwnd); +typedef int (*NP_UnregisterWindowHandle_t)(void); +typedef int (*NP_RegisterProgramProfileID_t)(unsigned short id); +typedef int (*NP_QueryVersion_t)(unsigned short *version); +typedef int (*NP_RequestData_t)(unsigned short req); +typedef int (*NP_GetSignature_t)(tir_signature_t *sig); +typedef int (*NP_GetData_t)(tir_data_t *data); +typedef int (*NP_GetParameter_t)(void); +typedef int (*NP_SetParameter_t)(void); +typedef int (*NP_StartCursor_t)(void); +typedef int (*NP_StopCursor_t)(void); +typedef int (*NP_ReCenter_t)(void); +typedef int (*NP_StartDataTransmission_t)(void); +typedef int (*NP_StopDataTransmission_t)(void); +*/ +NP_RegisterWindowHandle_t NP_RegisterWindowHandle = NULL; +NP_UnregisterWindowHandle_t NP_UnregisterWindowHandle = NULL; +NP_RegisterProgramProfileID_t NP_RegisterProgramProfileID = NULL; +NP_QueryVersion_t NP_QueryVersion = NULL; +NP_RequestData_t NP_RequestData = NULL; +NP_GetSignature_t NP_GetSignature = NULL; +NP_GetData_t NP_GetData = NULL; +NP_GetParameter_t NP_GetParameter = NULL; +NP_SetParameter_t NP_SetParameter = NULL; +NP_StartCursor_t NP_StartCursor = NULL; +NP_StopCursor_t NP_StopCursor = NULL; +NP_ReCenter_t NP_ReCenter = NULL; +NP_StartDataTransmission_t NP_StartDataTransmission = NULL; +NP_StopDataTransmission_t NP_StopDataTransmission = NULL; + +bool crypted = false; + + + +unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +char *client_path() +{ + HKEY hkey = 0; + RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\NaturalPoint\\NATURALPOINT\\NPClient Location", 0, + KEY_QUERY_VALUE, &hkey); + if(!hkey){ + printf("Can't open registry key\n"); + return NULL; + } + + BYTE path[1024]; + DWORD buf_len = 1024; + LONG result = RegQueryValueEx(hkey, "Path", NULL, NULL, path, &buf_len); + char *full_path = NULL; + int res = -1; + if(result == ERROR_SUCCESS && buf_len > 0){ +#ifdef FOR_WIN64 + res = asprintf(&full_path, "%s/NPClient64.dll", path); +#else + res = asprintf(&full_path, "%s/NPClient.dll", path); +#endif + } + RegCloseKey(hkey); + if(res > 0){ + return full_path; + }else{ + return NULL; + } +} + +bool initialized = false; + +bool npifc_init(HWND wnd, int id) +{ + //table[] = {0xb3, 0x16, 0x36, 0xeb, 0xb9, 0x05, 0x4f, 0xa4}; + game_desc_t gd; + if(game_data_get_desc(id, &gd)){ + crypted = gd.encrypted; + if(gd.encrypted){ + table[0] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[1] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[2] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[3] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[4] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[5] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[6] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[7] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + } + } + printf("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + table[0], table[1], table[2], table[3], + table[4], table[5], table[6], table[7]); + + char *client = client_path(); + if(client == NULL){ + printf("Couldn't obtain client path!\n"); + return false; + } + npclient = LoadLibrary(client); + if(!npclient){ + printf("Can't load client %s\n", client); + return false; + } + + NP_RegisterWindowHandle = (NP_RegisterWindowHandle_t)GetProcAddress(npclient, "NP_RegisterWindowHandle"); + NP_UnregisterWindowHandle = (NP_UnregisterWindowHandle_t)GetProcAddress(npclient, "NP_UnregisterWindowHandle"); + NP_RegisterProgramProfileID = (NP_RegisterProgramProfileID_t)GetProcAddress(npclient, "NP_RegisterProgramProfileID"); + NP_QueryVersion = (NP_QueryVersion_t)GetProcAddress(npclient, "NP_QueryVersion"); + NP_RequestData = (NP_RequestData_t)GetProcAddress(npclient, "NP_RequestData"); + NP_GetSignature = (NP_GetSignature_t)GetProcAddress(npclient, "NP_GetSignature"); + NP_GetData = (NP_GetData_t)GetProcAddress(npclient, "NP_GetData"); + NP_GetParameter = (NP_GetParameter_t)GetProcAddress(npclient, "NP_GetParameter"); + NP_SetParameter = (NP_SetParameter_t)GetProcAddress(npclient, "NP_SetParameter"); + NP_StartCursor = (NP_StartCursor_t)GetProcAddress(npclient, "NP_StartCursor"); + NP_StopCursor = (NP_StopCursor_t)GetProcAddress(npclient, "NP_StopCursor"); + NP_ReCenter = (NP_ReCenter_t)GetProcAddress(npclient, "NP_ReCenter"); + NP_StartDataTransmission = (NP_StartDataTransmission_t)GetProcAddress(npclient, "NP_StartDataTransmission"); + NP_StopDataTransmission = (NP_StopDataTransmission_t)GetProcAddress(npclient, "NP_StopDataTransmission"); + if((NP_RegisterWindowHandle == NULL) || (NP_UnregisterWindowHandle == NULL) + || (NP_RegisterProgramProfileID == NULL) || (NP_QueryVersion == NULL) || (NP_RequestData == NULL) + || (NP_GetSignature == NULL) || (NP_GetData == NULL) || (NP_GetParameter == NULL) + || (NP_SetParameter == NULL) || (NP_StartCursor == NULL) || (NP_StopCursor == NULL) + || (NP_ReCenter == NULL) || (NP_StartDataTransmission == NULL) || (NP_StopDataTransmission == NULL)){ + printf("Couldn't bind all necessary functions!\n"); + return false; + } + tir_signature_t sig; + int res; + if((res = NP_GetSignature(&sig)) != 0){ + printf("Error retrieving signature! %d\n", res); + return false; + } + printf("Dll Sig:%s\nApp Sig2:%s\n", sig.DllSignature, sig.AppSignature); + NP_RegisterWindowHandle(wnd); + if(NP_RegisterProgramProfileID(id) != 0){ + printf("Couldn't register profile id!\n"); + return false; + } + printf("Program profile registered!\n"); + NP_RequestData(65535); + NP_StopCursor(); + NP_StartDataTransmission(); + initialized = true; + return true; +} + +void npifc_close() +{ + if(initialized){ + NP_StopDataTransmission(); + NP_StartCursor(); + NP_UnregisterWindowHandle(); + } + initialized = false; +} + +void c_encrypt(unsigned char buf[], unsigned int size, + unsigned char code_table[], unsigned int table_size) +{ + unsigned int table_ptr = 0; + unsigned char var = 0x88; + unsigned char tmp; + if((size <= 0) || (table_size <= 0) || + (buf == NULL) || (code_table == NULL)) + return; + do{ + tmp = buf[--size]; + buf[size] = tmp ^ code_table[table_ptr] ^ var; + var += size + tmp; + ++table_ptr; + if(table_ptr >= table_size){ + table_ptr -= table_size; + } + }while(size != 0); +} + + + +void decrypt(unsigned char buf[], unsigned int size, + unsigned char code_table[], unsigned int table_size) +{ + unsigned int table_ptr = 0; + unsigned char var = 0x88; + unsigned char tmp; + if((size <= 0) || (table_size <= 0) || + (buf == NULL) || (code_table == NULL)){ + return; + } + do{ + tmp = buf[--size]; + buf[size] = tmp ^ code_table[table_ptr] ^ var; + var += size + buf[size]; + ++table_ptr; + if(table_ptr >= table_size){ + table_ptr -= table_size; + } + }while(size != 0); +} + +unsigned int cksum(unsigned char buf[], unsigned int size) +{ + if((size == 0) || (buf == NULL)){ + return 0; + } + int rounds = size >> 2; + int rem = size % 4; + + int c = size; + int a0 = 0; + int a2 = 0; + + while(rounds != 0){ + a0 = *(short int*)buf; + a2 = *(short int*)(buf+2); + buf += 4; + c += a0; + a2 ^= (c << 5); + a2 <<= 11; + c ^= a2; + c += (c >> 11); + --rounds; + } + switch(rem){ + case 3: + a0 = *(short int*)buf; + a2 = *(signed char*)(buf+2); + c += a0; + a2 = (a2 << 2) ^ c; + c ^= (a2 << 16); + a2 = (c >> 11); + break; + case 2: + a2 = *(short int*)buf; + c += a2; + c ^= (c << 11); + a2 = (c >> 17); + break; + case 1: + a2 = *(signed char*)(buf); + c += a2; + c ^= (c << 10); + a2 = (c >> 1); + break; + default: + break; + } + if(rem != 0){ + c+=a2; + } + + c ^= (c << 3); + c += (c >> 5); + c ^= (c << 4); + c += (c >> 17); + c ^= (c << 25); + c += (c >> 6); + + return (unsigned int)c; +} + +int decode_frame(tir_data_t *td) +{ + //printf("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + // table[0], table[1], table[2], table[3], + // table[4], table[5], table[6], table[7]); + unsigned int csum; + decrypt((unsigned char*)td, sizeof(*td), table, sizeof(table)); + csum = td->cksum; + td->cksum = 0; + if(csum != cksum((unsigned char*)td, sizeof(*td))){ + printf("Problem with frame!\n"); + //int a0; + //printf("Dec: "); + //for(a0 = 0; a0 < (int)sizeof(tir_data_t); ++a0) + //{ + // printf("%02X", ((unsigned char *)td)[a0]); + //} + //printf("\n"); + //printf("Cksum: %04X vs computed: %04X\n", csum, cksum((unsigned char*)td, sizeof(*td))); + return -1; + } + //printf("Frame OK!\n"); + return 0; +} + +int npifc_getdata(tir_data_t *data) +{ + int res = NP_GetData(data); + if(crypted){ + decode_frame(data); + } + return res; +} + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h new file mode 100644 index 00000000..d580e16d --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h @@ -0,0 +1,66 @@ +#ifndef NPIFC__H +#define NPIFC__H + + +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + bool npifc_init(HWND wnd, int id); + void npifc_close(); + +#pragma pack(1) +typedef struct tir_data{ + short status; + short frame; + unsigned int cksum; + float roll, pitch, yaw; + float tx, ty, tz; + float padding[9]; +} tir_data_t; + +typedef struct tir_signature{ + char DllSignature[200]; + char AppSignature[200]; +} tir_signature_t; +#pragma pack(0) + +int npifc_getdata(tir_data_t *data); + +typedef int __stdcall (*NP_RegisterWindowHandle_t)(HWND hwnd); +typedef int __stdcall (*NP_UnregisterWindowHandle_t)(void); +typedef int __stdcall (*NP_RegisterProgramProfileID_t)(unsigned short id); +typedef int __stdcall (*NP_QueryVersion_t)(unsigned short *version); +typedef int __stdcall (*NP_RequestData_t)(unsigned short req); +typedef int __stdcall (*NP_GetSignature_t)(tir_signature_t *sig); +typedef int __stdcall (*NP_GetData_t)(tir_data_t *data); +typedef int __stdcall (*NP_GetParameter_t)(void); +typedef int __stdcall (*NP_SetParameter_t)(void); +typedef int __stdcall (*NP_StartCursor_t)(void); +typedef int __stdcall (*NP_StopCursor_t)(void); +typedef int __stdcall (*NP_ReCenter_t)(void); +typedef int __stdcall (*NP_StartDataTransmission_t)(void); +typedef int __stdcall (*NP_StopDataTransmission_t)(void); + +extern NP_RegisterWindowHandle_t NP_RegisterWindowHandle; +extern NP_UnregisterWindowHandle_t NP_UnregisterWindowHandle; +extern NP_RegisterProgramProfileID_t NP_RegisterProgramProfileID; +extern NP_QueryVersion_t NP_QueryVersion; +extern NP_RequestData_t NP_RequestData; +extern NP_GetSignature_t NP_GetSignature; +extern NP_GetData_t NP_GetData; +extern NP_GetParameter_t NP_GetParameter; +extern NP_SetParameter_t NP_SetParameter; +extern NP_StartCursor_t NP_StartCursor; +extern NP_StopCursor_t NP_StopCursor; +extern NP_ReCenter_t NP_ReCenter; +extern NP_StartDataTransmission_t NP_StartDataTransmission; +extern NP_StopDataTransmission_t NP_StopDataTransmission; + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in new file mode 100644 index 00000000..231002f1 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in @@ -0,0 +1,49 @@ +// Generated by ResEdit 1.5.9 +// Copyright (C) 2006-2011 +// http://www.resedit.net + +#include <windows.h> +#include <commctrl.h> +#include <richedit.h> +#include "resource.h" + +#ifdef HAVE_CONFIG_H + #include "../../../config.h" +#endif + + + +// +// Dialog resources +// +//LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_DIALOG1 DIALOGEX 0, 0, 379, 124 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "NPTest v@PACKAGE_VERSION@" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + DEFPUSHBUTTON "Quit", IDQUIT, 262, 102, 50, 14 + DEFPUSHBUTTON "Start", IDSTART, 7, 102, 50, 14 + EDITTEXT IDC_PITCH, 32, 32, 51, 14, ES_AUTOHSCROLL + LTEXT "Pitch", IDC_STATIC, 11, 34, 20, 8, SS_LEFT + LTEXT "Yaw", IDC_STATIC, 11, 59, 20, 8, SS_LEFT + EDITTEXT IDC_YAW, 32, 57, 51, 14, ES_AUTOHSCROLL + LTEXT "Roll", IDC_STATIC, 11, 84, 20, 8, SS_LEFT + EDITTEXT IDC_ROLL, 32, 82, 51, 14, ES_AUTOHSCROLL + LTEXT "X", IDC_STATIC, 101, 35, 6, 8, SS_LEFT + EDITTEXT IDC_X1, 112, 32, 51, 14, ES_AUTOHSCROLL + LTEXT "Y", IDC_STATIC, 101, 60, 6, 8, SS_LEFT + EDITTEXT IDC_Y1, 112, 57, 51, 14, ES_AUTOHSCROLL + LTEXT "Z", IDC_STATIC, 101, 85, 6, 8, SS_LEFT + EDITTEXT IDC_Z1, 112, 82, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_X2, 172, 32, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Y2, 172, 57, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Z2, 172, 82, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_X3, 232, 32, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Y3, 232, 57, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Z3, 232, 82, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_S, 292, 32, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_F, 292, 57, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_APPID, 32, 12, 51, 12, ES_AUTOHSCROLL + LTEXT "ID", IDC_STATIC, 17, 14, 8, 8, SS_LEFT +} diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h new file mode 100644 index 00000000..328d9cb7 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h @@ -0,0 +1,23 @@ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_DIALOG1 100 +#define IDQUIT 1002 +#define IDSTART 1003 +#define IDC_APPID 1016 +#define IDC_PITCH 1017 +#define IDC_YAW 1018 +#define IDC_ROLL 1019 +#define IDC_X1 1020 +#define IDC_X2 1021 +#define IDC_X3 1022 +#define IDC_Y1 1023 +#define IDC_Y2 1024 +#define IDC_Y3 1025 +#define IDC_Z1 1026 +#define IDC_Z2 1027 +#define IDC_Z3 1028 +#define IDC_S 1029 +#define IDC_F 1030 + diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c new file mode 120000 index 00000000..663c21a9 --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c @@ -0,0 +1 @@ +../client/rest.c \ No newline at end of file diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h new file mode 120000 index 00000000..6dca182a --- /dev/null +++ b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h @@ -0,0 +1 @@ +../client/rest.h \ No newline at end of file diff --git a/facetracknoir/curve-config.cpp b/facetracknoir/curve-config.cpp index abf03a5e..886e40fa 100644 --- a/facetracknoir/curve-config.cpp +++ b/facetracknoir/curve-config.cpp @@ -1,12 +1,13 @@ -#include "facetracknoir/facetracknoir.h" -#include "facetracknoir/curve-config.h" -CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidget *parent) : - QWidget( parent, Qt::Dialog ), mainApp(ftnoir) +#include "./facetracknoir.h" +#include "./curve-config.h" +#include "./main-settings.hpp" +CurveConfigurationDialog::CurveConfigurationDialog(Mappings& m, main_settings& s, QWidget *parent) : QWidget(parent, Qt::Dialog), + m(m) { ui.setupUi( this ); // rest of mapping settings taken care of by options::value<t> - mainApp->load_mappings(); + m.load_mappings(); { struct { @@ -34,8 +35,8 @@ CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidge for (int i = 0; qfcs[i].qfc; i++) { const bool altp = qfcs[i].altp; - THeadPoseDOF& axis = mainApp->axis(qfcs[i].axis); - FunctionConfig* conf = altp ? &axis.curveAlt : &axis.curve; + Mapping& axis = m(qfcs[i].axis); + Map* conf = altp ? &axis.curveAlt : &axis.curve; const auto& name = qfcs[i].altp ? axis.name2 : axis.name1; qfcs[i].qfc->setConfig(conf, name); @@ -49,36 +50,36 @@ CurveConfigurationDialog::CurveConfigurationDialog(FaceTrackNoIR *ftnoir, QWidge connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - tie_setting(mainApp->s.a_x.altp, ui.tx_altp); - tie_setting(mainApp->s.a_y.altp, ui.ty_altp); - tie_setting(mainApp->s.a_z.altp, ui.tz_altp); - tie_setting(mainApp->s.a_yaw.altp, ui.rx_altp); - tie_setting(mainApp->s.a_pitch.altp, ui.ry_altp); - tie_setting(mainApp->s.a_roll.altp, ui.rz_altp); + tie_setting(s.a_x.altp, ui.tx_altp); + tie_setting(s.a_y.altp, ui.ty_altp); + tie_setting(s.a_z.altp, ui.tz_altp); + tie_setting(s.a_yaw.altp, ui.rx_altp); + tie_setting(s.a_pitch.altp, ui.ry_altp); + tie_setting(s.a_roll.altp, ui.rz_altp); - tie_setting(mainApp->s.tcomp_p, ui.tcomp_enable); - tie_setting(mainApp->s.tcomp_tz, ui.tcomp_rz); + tie_setting(s.tcomp_p, ui.tcomp_enable); + tie_setting(s.tcomp_tz, ui.tcomp_rz); - tie_setting(mainApp->s.a_x.zero, ui.pos_tx); - tie_setting(mainApp->s.a_y.zero, ui.pos_ty); - tie_setting(mainApp->s.a_z.zero, ui.pos_tz); - tie_setting(mainApp->s.a_yaw.zero, ui.pos_rx); - tie_setting(mainApp->s.a_pitch.zero, ui.pos_ry); - tie_setting(mainApp->s.a_roll.zero, ui.pos_rz); + tie_setting(s.a_x.zero, ui.pos_tx); + tie_setting(s.a_y.zero, ui.pos_ty); + tie_setting(s.a_z.zero, ui.pos_tz); + tie_setting(s.a_yaw.zero, ui.pos_rx); + tie_setting(s.a_pitch.zero, ui.pos_ry); + tie_setting(s.a_roll.zero, ui.pos_rz); - tie_setting(mainApp->s.a_yaw.invert, ui.invert_yaw); - tie_setting(mainApp->s.a_pitch.invert, ui.invert_pitch); - tie_setting(mainApp->s.a_roll.invert, ui.invert_roll); - tie_setting(mainApp->s.a_x.invert, ui.invert_x); - tie_setting(mainApp->s.a_y.invert, ui.invert_y); - tie_setting(mainApp->s.a_z.invert, ui.invert_z); + tie_setting(s.a_yaw.invert, ui.invert_yaw); + tie_setting(s.a_pitch.invert, ui.invert_pitch); + tie_setting(s.a_roll.invert, ui.invert_roll); + tie_setting(s.a_x.invert, ui.invert_x); + tie_setting(s.a_y.invert, ui.invert_y); + tie_setting(s.a_z.invert, ui.invert_z); - tie_setting(mainApp->s.a_yaw.src, ui.src_yaw); - tie_setting(mainApp->s.a_pitch.src, ui.src_pitch); - tie_setting(mainApp->s.a_roll.src, ui.src_roll); - tie_setting(mainApp->s.a_x.src, ui.src_x); - tie_setting(mainApp->s.a_y.src, ui.src_y); - tie_setting(mainApp->s.a_z.src, ui.src_z); + tie_setting(s.a_yaw.src, ui.src_yaw); + tie_setting(s.a_pitch.src, ui.src_pitch); + tie_setting(s.a_roll.src, ui.src_roll); + tie_setting(s.a_x.src, ui.src_x); + tie_setting(s.a_y.src, ui.src_y); + tie_setting(s.a_z.src, ui.src_z); } void CurveConfigurationDialog::doOK() { @@ -87,10 +88,10 @@ void CurveConfigurationDialog::doOK() { } void CurveConfigurationDialog::doCancel() { - mainApp->load_mappings(); + m.load_mappings(); this->close(); } void CurveConfigurationDialog::save() { - mainApp->save_mappings(); + m.save_mappings(); } diff --git a/facetracknoir/curve-config.h b/facetracknoir/curve-config.h index 49aba7bd..67a588e2 100644 --- a/facetracknoir/curve-config.h +++ b/facetracknoir/curve-config.h @@ -1,19 +1,17 @@ #pragma once #include <QWidget> -#include <QPalette> +#include "./mappings.hpp" #include "ui_ftnoir_curves.h" -class FaceTrackNoIR; - class CurveConfigurationDialog: public QWidget { Q_OBJECT public: - CurveConfigurationDialog( FaceTrackNoIR *ftnoir, QWidget *parent ); + CurveConfigurationDialog(Mappings &m, main_settings &s, QWidget *parent ); private: Ui::UICCurveConfigurationDialog ui; + Mappings& m; void save(); - FaceTrackNoIR *mainApp; private slots: void doOK(); void doCancel(); diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 868b6dbf..af76f09b 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -75,8 +75,8 @@ static void fill_combobox(const QString& filter, QList<DynamicLibrary*>& list, Q } } -FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : - QMainWindow(parent), +FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : QMainWindow(parent), + tracker(nullptr), #if defined(_WIN32) keybindingWorker(NULL), #else @@ -87,34 +87,21 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : s(b), pose(std::vector<axis_opts*>{&s.a_x, &s.a_y, &s.a_z, &s.a_yaw, &s.a_pitch, &s.a_roll}), timUpdateHeadPose(this), - pTrackerDialog(NULL), - pProtocolDialog(NULL), - pFilterDialog(NULL), + pTrackerDialog(nullptr), + pProtocolDialog(nullptr), + pFilterDialog(nullptr), + shortcuts_widget(nullptr), + mapping_widget(new CurveConfigurationDialog(pose, s, this)), kbd_quit(QKeySequence("Ctrl+Q"), this), looping(0), video_frame_layout(new QVBoxLayout()), no_feed_pixmap(":/uielements/no-feed.png") -{ +{ ui.setupUi(this); setFixedSize(size()); ui.video_frame_label->setPixmap(no_feed_pixmap); updateButtonState(false, false); - _keyboard_shortcuts = 0; - _curve_config = 0; - - tracker = 0; - - CurveConfigurationDialog* ccd; - - if (!_curve_config) - { - ccd = new CurveConfigurationDialog( this, this ); - _curve_config = ccd; - } else { - ccd = dynamic_cast<CurveConfigurationDialog*>(_curve_config); - } - QDir::setCurrent(QCoreApplication::applicationDirPath()); fill_profile_cbx(); @@ -157,7 +144,7 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : FaceTrackNoIR::~FaceTrackNoIR() { - stopTracker(); + stopTracker(); save(); if (Libraries) delete Libraries; @@ -171,38 +158,26 @@ QFrame* FaceTrackNoIR::get_video_widget() { void FaceTrackNoIR::open() { QFileDialog dialog(this); dialog.setFileMode(QFileDialog::ExistingFile); - - QString fileName = dialog.getOpenFileName( - this, + + QString fileName = dialog.getOpenFileName( + this, tr("Open the settings file"), - QCoreApplication::applicationDirPath() + "/settings/", + QCoreApplication::applicationDirPath() + "/settings/", tr("Settings file (*.ini);;All Files (*)"), NULL); - if (! fileName.isEmpty() ) { + if (! fileName.isEmpty() ) { { QSettings settings("opentrack"); settings.setValue ("SettingsFile", QFileInfo(fileName).absoluteFilePath()); } fill_profile_cbx(); - loadSettings(); + loadSettings(); } } void FaceTrackNoIR::save_mappings() { - QSettings settings("opentrack"); - - QString currentFile = - settings.value("SettingsFile", - QCoreApplication::applicationDirPath() + "/settings/default.ini") - .toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); - - for (int i = 0; i < 6; i++) - { - axis(i).curve.saveSettings(iniFile, axis(i).name1); - axis(i).curveAlt.saveSettings(iniFile, axis(i).name2); - } + pose.save_mappings(); } #if defined(__unix) || defined(__linux) || defined(__APPLE__) @@ -212,7 +187,7 @@ void FaceTrackNoIR::save_mappings() { void FaceTrackNoIR::save() { b->save(); save_mappings(); - + #if defined(__unix) || defined(__linux) QSettings settings("opentrack"); const QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); @@ -229,27 +204,27 @@ void FaceTrackNoIR::save() { void FaceTrackNoIR::saveAs() { looping++; - QSettings settings("opentrack"); - QString oldFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); + QSettings settings("opentrack"); + QString oldFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QString fileName = QFileDialog::getSaveFileName(this, tr("Save file"), - oldFile, + QString fileName = QFileDialog::getSaveFileName(this, tr("Save file"), + oldFile, tr("Settings file (*.ini);;All Files (*)")); - if (!fileName.isEmpty()) { + if (!fileName.isEmpty()) { - QFileInfo newFileInfo ( fileName ); - if ((newFileInfo.exists()) && (oldFile != fileName)) { - QFile newFileFile ( fileName ); - newFileFile.remove(); - } + QFileInfo newFileInfo ( fileName ); + if ((newFileInfo.exists()) && (oldFile != fileName)) { + QFile newFileFile ( fileName ); + newFileFile.remove(); + } - QFileInfo oldFileInfo ( oldFile ); - if (oldFileInfo.exists()) { - QFile oldFileFile ( oldFile ); - oldFileFile.copy( fileName ); - } + QFileInfo oldFileInfo ( oldFile ); + if (oldFileInfo.exists()) { + QFile oldFileFile ( oldFile ); + oldFileFile.copy( fileName ); + } - settings.setValue ("SettingsFile", fileName); + settings.setValue ("SettingsFile", fileName); save(); } @@ -258,15 +233,7 @@ void FaceTrackNoIR::saveAs() } void FaceTrackNoIR::load_mappings() { - QSettings settings("opentrack"); - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); - - for (int i = 0; i < 6; i++) - { - axis(i).curve.loadSettings(iniFile, axis(i).name1); - axis(i).curveAlt.loadSettings(iniFile, axis(i).name2); - } + pose.load_mappings(); } void FaceTrackNoIR::loadSettings() { @@ -303,7 +270,7 @@ void FaceTrackNoIR::startTracker( ) { stopTracker(); return; } - + #if defined(_WIN32) keybindingWorker = new KeybindingWorker(*this, keyCenter, keyToggle); keybindingWorker->start(); @@ -313,15 +280,15 @@ void FaceTrackNoIR::startTracker( ) { delete tracker; } - tracker = new Tracker ( this, s ); + tracker = new Tracker(s, pose); if (pTrackerDialog && Libraries->pTracker) { pTrackerDialog->registerTracker( Libraries->pTracker ); - } - + } + if (pFilterDialog && Libraries->pFilter) pFilterDialog->registerFilter(Libraries->pFilter); - + tracker->start(); ui.video_frame->show(); @@ -345,7 +312,7 @@ void FaceTrackNoIR::stopTracker( ) { keybindingWorker = NULL; } #endif - timUpdateHeadPose.stop(); + timUpdateHeadPose.stop(); ui.pose_display->rotateBy(0, 0, 0); if (pTrackerDialog) { @@ -366,44 +333,41 @@ void FaceTrackNoIR::stopTracker( ) { } if ( tracker ) { - delete tracker; - tracker = 0; + delete tracker; + tracker = 0; if (Libraries) { delete Libraries; Libraries = NULL; } - } + } updateButtonState(false, false); } -void FaceTrackNoIR::showHeadPose() { - double newdata[6]; - - tracker->getHeadPose(newdata); - ui.lcdNumX->display(newdata[TX]); - ui.lcdNumY->display(newdata[TY]); - ui.lcdNumZ->display(newdata[TZ]); - +void FaceTrackNoIR::showHeadPose() +{ + double mapped[6], raw[6]; - ui.lcdNumRotX->display(newdata[Yaw]); - ui.lcdNumRotY->display(newdata[Pitch]); - ui.lcdNumRotZ->display(newdata[Roll]); + tracker->get_raw_and_mapped_poses(mapped, raw); - tracker->getOutputHeadPose(newdata); + ui.pose_display->rotateBy(mapped[Yaw], mapped[Roll], mapped[Pitch]); - ui.pose_display->rotateBy(newdata[Yaw], newdata[Roll], newdata[Pitch]); + if (mapping_widget) + mapping_widget->update(); - ui.lcdNumOutputPosX->display(newdata[TX]); - ui.lcdNumOutputPosY->display(newdata[TY]); - ui.lcdNumOutputPosZ->display(newdata[TZ]); + ui.lcdNumX->display(raw[TX]); + ui.lcdNumY->display(raw[TY]); + ui.lcdNumZ->display(raw[TZ]); + ui.lcdNumRotX->display(raw[Yaw]); + ui.lcdNumRotY->display(raw[Pitch]); + ui.lcdNumRotZ->display(raw[Roll]); - ui.lcdNumOutputRotX->display(newdata[Yaw]); - ui.lcdNumOutputRotY->display(newdata[Pitch]); - ui.lcdNumOutputRotZ->display(newdata[Roll]); + ui.lcdNumOutputPosX->display(mapped[TX]); + ui.lcdNumOutputPosY->display(mapped[TY]); + ui.lcdNumOutputPosZ->display(mapped[TZ]); + ui.lcdNumOutputRotX->display(mapped[Yaw]); + ui.lcdNumOutputRotY->display(mapped[Pitch]); + ui.lcdNumOutputRotZ->display(mapped[Roll]); - if (_curve_config) { - _curve_config->update(); - } if (Libraries->pProtocol) { const QString name = Libraries->pProtocol->getGameName(); @@ -411,11 +375,12 @@ void FaceTrackNoIR::showHeadPose() { } } -void FaceTrackNoIR::showTrackerSettings() { - if (pTrackerDialog) { - delete pTrackerDialog; - pTrackerDialog = NULL; - } +void FaceTrackNoIR::showTrackerSettings() +{ + if (pTrackerDialog) { + delete pTrackerDialog; + pTrackerDialog = NULL; + } DynamicLibrary* lib = dlopen_trackers.value(ui.iconcomboTrackerSource->currentIndex(), (DynamicLibrary*) NULL); @@ -470,24 +435,24 @@ void FaceTrackNoIR::showFilterControls() { } void FaceTrackNoIR::showKeyboardShortcuts() { - if (!_keyboard_shortcuts) + if (!shortcuts_widget) { - _keyboard_shortcuts = new KeyboardShortcutDialog( this, this ); + shortcuts_widget = new KeyboardShortcutDialog( this, this ); } - _keyboard_shortcuts->show(); - _keyboard_shortcuts->raise(); + shortcuts_widget->show(); + shortcuts_widget->raise(); } -void FaceTrackNoIR::showCurveConfiguration() { - if (!_curve_config) - _curve_config = new CurveConfigurationDialog( this, this ); - - _curve_config->show(); - _curve_config->raise(); +void FaceTrackNoIR::showCurveConfiguration() { + if (!mapping_widget) + mapping_widget = new CurveConfigurationDialog(pose, s, this); + + mapping_widget->show(); + mapping_widget->raise(); } void FaceTrackNoIR::exit() { - QCoreApplication::exit(0); + QCoreApplication::exit(0); } extern "C" volatile const char* opentrack_version; @@ -515,11 +480,11 @@ void FaceTrackNoIR::fill_profile_cbx() void FaceTrackNoIR::profileSelected(int index) { - QSettings settings("opentrack"); - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); + QSettings settings("opentrack"); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QFileInfo pathInfo ( currentFile ); settings.setValue ("SettingsFile", pathInfo.absolutePath() + "/" + ui.iconcomboProfile->itemText(index)); - loadSettings(); + loadSettings(); } #if !defined(_WIN32) @@ -542,8 +507,8 @@ void FaceTrackNoIR::bind_keyboard_shortcut(QxtGlobalShortcut& key, key_opts& k) key.setShortcut(QKeySequence::fromString(seq, QKeySequence::PortableText)); key.setEnabled(); } else { - key.setDisabled(); - } + key.setDisabled(); + } } } #else @@ -590,20 +555,18 @@ void FaceTrackNoIR::bindKeyboardShortcuts() void FaceTrackNoIR::shortcutRecentered() { + qDebug() << "Center"; if (s.dingp) QApplication::beep(); - - qDebug() << "Center"; if (tracker) - tracker->do_center = true; + tracker->center(); } void FaceTrackNoIR::shortcutToggled() { + qDebug() << "Toggle"; if (s.dingp) QApplication::beep(); - - qDebug() << "Toggle"; if (tracker) - tracker->enabled = !tracker->enabled; + tracker->toggle_enabled(); } diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index c722ad5c..09f96147 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -44,31 +44,29 @@ #include "ui_facetracknoir.h" -#include "facetracknoir/options.h" -using namespace options; - -#include "facetracknoir/main-settings.hpp" - -#include "facetracknoir/plugin-support.h" -#include "tracker.h" -#include "facetracknoir/shortcuts.h" +#include "./options.h" +#include "./main-settings.hpp" +#include "./plugin-support.h" +#include "./tracker.h" +#include "./shortcuts.h" +#include "./curve-config.h" -class Tracker; // pre-define class to avoid circular includes -class FaceTrackNoIR; - -class KeybindingWorker; +using namespace options; class FaceTrackNoIR : public QMainWindow, IDynamicLibraryProvider { - Q_OBJECT + Q_OBJECT public: FaceTrackNoIR(QWidget *parent = 0); - ~FaceTrackNoIR(); + ~FaceTrackNoIR(); QFrame *get_video_widget(); Tracker *tracker; void bindKeyboardShortcuts(); + + // XXX this shit stinks -sh 20141004 + // TODO move to separate class representing running tracker state DynamicLibrary* current_tracker1() override { return dlopen_trackers.value(ui.iconcomboTrackerSource->currentIndex(), (DynamicLibrary*) NULL); } @@ -78,15 +76,12 @@ public: DynamicLibrary* current_filter() override { return dlopen_filters.value(ui.iconcomboFilter->currentIndex(), (DynamicLibrary*) NULL); } - THeadPoseDOF& axis(int idx) { - return pose.axes[idx]; - } #if defined(_WIN32) Key keyCenter; Key keyToggle; KeybindingWorker* keybindingWorker; -#else +#else QxtGlobalShortcut keyCenter; QxtGlobalShortcut keyToggle; #endif @@ -95,22 +90,20 @@ public: public slots: void shortcutRecentered(); void shortcutToggled(); - private: - HeadPoseData pose; + Mappings pose; Ui::OpentrackUI ui; - QTimer timUpdateHeadPose; + QTimer timUpdateHeadPose; ITrackerDialog* pTrackerDialog; IProtocolDialog* pProtocolDialog; IFilterDialog* pFilterDialog; - QWidget *_keyboard_shortcuts; - QWidget *_curve_config; + QWidget *shortcuts_widget; + CurveConfigurationDialog* mapping_widget; - void createIconGroupBox(); - - void loadSettings(); + void createIconGroupBox(); + void loadSettings(); void updateButtonState(bool running, bool inertialp); QList<DynamicLibrary*> dlopen_filters; @@ -118,33 +111,33 @@ private: QList<DynamicLibrary*> dlopen_protocols; QShortcut kbd_quit; int looping; - + QLayout* video_frame_layout; QPixmap no_feed_pixmap; #ifndef _WIN32 void bind_keyboard_shortcut(QxtGlobalShortcut&, key_opts& k); #endif void fill_profile_cbx(); - + private slots: void open(); void save(); void saveAs(); void exit(); void profileSelected(int index); - + void showTrackerSettings(); - + void showServerControls(); void showFilterControls(); void showKeyboardShortcuts(); void showCurveConfiguration(); - + void showHeadPose(); - + void startTracker(); void stopTracker(); - + public: void save_mappings(); void load_mappings(); diff --git a/facetracknoir/mappings.hpp b/facetracknoir/mappings.hpp new file mode 100644 index 00000000..4dae7a90 --- /dev/null +++ b/facetracknoir/mappings.hpp @@ -0,0 +1,79 @@ +#pragma once + +#include <QSettings> +#include "options.h" +using namespace options; +#include "../qfunctionconfigurator/functionconfig.h" +#include "main-settings.hpp" + +class Mapping { +public: + Mapping(QString primary, + QString secondary, + int maxInput1, + int maxOutput1, + int maxInput2, + int maxOutput2, + axis_opts& opts) : + curve(maxInput1, maxOutput1), + curveAlt(maxInput2, maxOutput2), + opts(opts), + name1(primary), + name2(secondary) + { + // XXX TODO move all this qsettings boilerplate into a single header -sh 20141004 + QSettings settings("opentrack"); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); + QSettings iniFile(currentFile, QSettings::IniFormat); + curve.loadSettings(iniFile, primary); + curveAlt.loadSettings(iniFile, secondary); + } + Map curve; + Map curveAlt; + axis_opts& opts; + QString name1, name2; +}; + +class Mappings { +private: + Mapping axes[6]; +public: + Mappings(std::vector<axis_opts*> opts) : + axes { + Mapping("tx","tx_alt", 100, 100, 100, 100, *opts[TX]), + Mapping("ty","ty_alt", 100, 100, 100, 100, *opts[TY]), + Mapping("tz","tz_alt", 100, 100, 100, 100, *opts[TZ]), + Mapping("rx", "rx_alt", 180, 180, 180, 180, *opts[Yaw]), + Mapping("ry", "ry_alt", 90, 90, 90, 90, *opts[Pitch]), + Mapping("rz", "rz_alt", 180, 180, 180, 180, *opts[Roll]) + } + {} + + inline Mapping& operator()(int i) { return axes[i]; } + inline const Mapping& operator()(int i) const { return axes[i]; } + + void load_mappings() + { + QSettings settings("opentrack"); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); + QSettings iniFile( currentFile, QSettings::IniFormat ); + + for (int i = 0; i < 6; i++) + { + axes[i].curve.loadSettings(iniFile, axes[i].name1); + axes[i].curveAlt.loadSettings(iniFile, axes[i].name2); + } + } + void save_mappings() + { + QSettings settings("opentrack"); + QString currentFile = settings.value("SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini").toString(); + QSettings iniFile(currentFile, QSettings::IniFormat); + + for (int i = 0; i < 6; i++) + { + axes[i].curve.saveSettings(iniFile, axes[i].name1); + axes[i].curveAlt.saveSettings(iniFile, axes[i].name2); + } + } +}; diff --git a/facetracknoir/plugin-qt-api.hpp b/facetracknoir/plugin-qt-api.hpp index a8dd153b..0e2e3c32 100644 --- a/facetracknoir/plugin-qt-api.hpp +++ b/facetracknoir/plugin-qt-api.hpp @@ -14,11 +14,15 @@ struct Metadata virtual void getIcon(QIcon *icon) = 0; }; +// XXX TODO get rid of QString/QFrame to fix ABI woes +// will lead plugins from different C++ runtimes working -sh 20141004 + +// XXX TODO make virtual public the mess -sh 20141004 + struct IFilter { virtual ~IFilter() = 0; virtual void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position) = 0; - virtual void reset() = 0; }; inline IFilter::~IFilter() {} @@ -62,4 +66,4 @@ struct ITrackerDialog virtual void registerTracker(ITracker *tracker) = 0; virtual void unRegisterTracker() = 0; }; -inline ITrackerDialog::~ITrackerDialog() {} \ No newline at end of file +inline ITrackerDialog::~ITrackerDialog() {} diff --git a/facetracknoir/plugin-support.h b/facetracknoir/plugin-support.h index 3924fc09..c3914cfb 100644 --- a/facetracknoir/plugin-support.h +++ b/facetracknoir/plugin-support.h @@ -45,7 +45,7 @@ private: }; -// merely to break a circular header dependency -sh +// TODO it can die if running tracker state separated into class -sh 20141004 class IDynamicLibraryProvider { public: virtual DynamicLibrary* current_tracker1() = 0; diff --git a/facetracknoir/qcopyable-mutex.hpp b/facetracknoir/qcopyable-mutex.hpp new file mode 100644 index 00000000..f7f36f93 --- /dev/null +++ b/facetracknoir/qcopyable-mutex.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include <QMutex> + +class MyMutex { +private: + QMutex inner; + +public: + QMutex* operator->() { return &inner; } + QMutex* operator->() const { return &const_cast<MyMutex*>(this)->inner; } + + MyMutex operator=(const MyMutex& datum) + { + auto mode = + datum->isRecursive() + ? QMutex::Recursive + : QMutex::NonRecursive; + + return MyMutex(mode); + } + + MyMutex(const MyMutex& datum) + { + *this = datum; + } + + MyMutex(QMutex::RecursionMode mode = QMutex::NonRecursive) : + inner(mode) + { + } + + QMutex* operator&() + { + return &inner; + } +}; diff --git a/facetracknoir/rotation.h b/facetracknoir/rotation.h index 5ff5ce61..b3bb891e 100644 --- a/facetracknoir/rotation.h +++ b/facetracknoir/rotation.h @@ -8,18 +8,17 @@ #pragma once #include <cmath> -class RotationType { +class Quat { public: - RotationType() : a(1.0),b(0.0),c(0.0),d(0.0) {} - RotationType(double yaw, double pitch, double roll) { fromEuler(yaw, pitch, roll); } - RotationType(double a, double b, double c, double d) : a(a),b(b),c(c),d(d) {} + Quat() : a(1.0),b(0.0),c(0.0),d(0.0) {} + Quat(double yaw, double pitch, double roll) { fromEuler(yaw, pitch, roll); } + Quat(double a, double b, double c, double d) : a(a),b(b),c(c),d(d) {} - RotationType inv(){ - return RotationType(a,-b,-c, -d); + Quat inv(){ + return Quat(a,-b,-c, -d); } - // conversions // see http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles void fromEuler(double yaw, double pitch, double roll) @@ -45,10 +44,10 @@ public: yaw = atan2(2.0*(a*d + b*c), 1.0 - 2.0*(c*c + d*d)); } - const RotationType operator*(const RotationType& B) const + const Quat operator*(const Quat& B) const { - const RotationType& A = *this; - return RotationType(A.a*B.a - A.b*B.b - A.c*B.c - A.d*B.d, // quaternion multiplication + const Quat& A = *this; + return Quat(A.a*B.a - A.b*B.b - A.c*B.c - A.d*B.d, // quaternion multiplication A.a*B.b + A.b*B.a + A.c*B.d - A.d*B.c, A.a*B.c - A.b*B.d + A.c*B.a + A.d*B.b, A.a*B.d + A.b*B.c - A.c*B.b + A.d*B.a); diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 17f1af5f..0c2d289f 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -22,12 +22,12 @@ # include <windows.h> #endif -Tracker::Tracker(FaceTrackNoIR *parent , main_settings& s) : - mainApp(parent), +Tracker::Tracker(main_settings& s, Mappings &m) : s(s), - should_quit(false), - do_center(false), - enabled(true) + m(m), + centerp(false), + enabledp(true), + should_quit(false) { } @@ -37,7 +37,7 @@ Tracker::~Tracker() wait(); } -static void get_curve(double pos, double& out, THeadPoseDOF& axis) { +void Tracker::get_curve(double pos, double& out, Mapping& axis) { bool altp = (pos < 0) && axis.opts.altp; axis.curve.setTrackingActive( !altp ); axis.curveAlt.setTrackingActive( altp ); @@ -83,7 +83,7 @@ static void t_compensate(double* input, double* output, bool rz) } void Tracker::run() { - T6DOF offset_camera; + T6DOF pose_offset, unstopped_pose; double newpose[6] = {0}; int sleep_ms = 15; @@ -113,52 +113,42 @@ void Tracker::run() { for (int i = 0; i < 6; i++) { - raw_6dof.axes[i] = newpose[i]; - - auto& axis = mainApp->axis(i); - + auto& axis = m(i); int k = axis.opts.src; if (k < 0 || k >= 6) continue; - - axis.headPos = newpose[k]; + // not really raw, after axis remap -sh + raw_6dof(i) = newpose[k]; } - if (do_center) { - for (int i = 0; i < 6; i++) - offset_camera.axes[i] = mainApp->axis(i).headPos; - - do_center = false; - - if (Libraries->pFilter) - Libraries->pFilter->reset(); + if (centerp) { + centerp = false; + pose_offset = raw_6dof; } - T6DOF target_camera, target_camera2, new_camera; + { + if (enabledp) + unstopped_pose = raw_6dof; - if (!enabled) - target_camera = raw_6dof; - else - for (int i = 0; i < 6; i++) - target_camera.axes[i] = mainApp->axis(i).headPos; + { - target_camera2 = target_camera - offset_camera; + if (Libraries->pFilter) + Libraries->pFilter->FilterHeadPoseData(unstopped_pose, output_pose); + else + output_pose = unstopped_pose; - if (Libraries->pFilter) { - Libraries->pFilter->FilterHeadPoseData(target_camera2.axes, new_camera.axes); - } else { - new_camera = target_camera2; - } + output_pose = output_pose - pose_offset; + } - for (int i = 0; i < 6; i++) { - get_curve(new_camera.axes[i], output_camera.axes[i], mainApp->axis(i)); + for (int i = 0; i < 6; i++) + get_curve(output_pose(i), output_pose(i), m(i)); } - if (mainApp->s.tcomp_p) - t_compensate(output_camera.axes, output_camera.axes, mainApp->s.tcomp_tz); + if (s.tcomp_p) + t_compensate(output_pose, output_pose, s.tcomp_tz); if (Libraries->pProtocol) { - Libraries->pProtocol->sendHeadposeToGame(output_camera.axes); + Libraries->pProtocol->sendHeadposeToGame(output_pose); } } @@ -172,21 +162,17 @@ void Tracker::run() { for (int i = 0; i < 6; i++) { - mainApp->axis(i).curve.setTrackingActive(false); - mainApp->axis(i).curveAlt.setTrackingActive(false); + m(i).curve.setTrackingActive(false); + m(i).curveAlt.setTrackingActive(false); } } -void Tracker::getHeadPose( double *data ) { - QMutexLocker foo(&mtx); +void Tracker::get_raw_and_mapped_poses(double* mapped, double* raw) const { + QMutexLocker foo(&const_cast<Tracker&>(*this).mtx); for (int i = 0; i < 6; i++) { - data[i] = raw_6dof.axes[i]; + raw[i] = raw_6dof(i); + mapped[i] = output_pose(i); } } -void Tracker::getOutputHeadPose( double *data ) { - QMutexLocker foo(&mtx); - for (int i = 0; i < 6; i++) - data[i] = output_camera.axes[i]; -} diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index 54350164..05ae4180 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -11,85 +11,42 @@ #include <QDebug> #include <QMutex> #include "plugin-support.h" +#include "mappings.hpp" + #include <vector> +#include <atomic> #include <qfunctionconfigurator/functionconfig.h> #include "tracker_types.h" #include "facetracknoir/main-settings.hpp" #include "facetracknoir/options.h" #include "facetracknoir/timer.hpp" -using namespace options; -class THeadPoseDOF { -public: - THeadPoseDOF(QString primary, - QString secondary, - int maxInput1, - int maxOutput1, - int maxInput2, - int maxOutput2, - axis_opts* opts) : - headPos(0), - curve(maxInput1, maxOutput1), - curveAlt(maxInput2, maxOutput2), - opts(*opts), - name1(primary), - name2(secondary) - { - QSettings settings("opentrack"); - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); - curve.loadSettings(iniFile, primary); - curveAlt.loadSettings(iniFile, secondary); - } - volatile double headPos; - FunctionConfig curve; - FunctionConfig curveAlt; - axis_opts& opts; - QString name1, name2; -}; -class FaceTrackNoIR; class Tracker : protected QThread { - Q_OBJECT - + Q_OBJECT private: - FaceTrackNoIR *mainApp; QMutex mtx; main_settings& s; - volatile bool should_quit; + // XXX can be const-cast when functionconfig const-correct -sh 20141004 + Mappings& m; Timer t; -protected: - void run(); + T6DOF output_pose, raw_6dof; + std::atomic<bool> centerp; + std::atomic<bool> enabledp; + std::atomic<bool> should_quit; + static void get_curve(double pos, double& out, Mapping& axis); +protected: + void run() override; public: - Tracker( FaceTrackNoIR *parent, main_settings& s); + Tracker(main_settings& s, Mappings& m); ~Tracker(); - void getHeadPose(double *data); - void getOutputHeadPose(double *data); - volatile bool do_center; - volatile bool enabled; - - T6DOF output_camera, raw_6dof; - + void get_raw_and_mapped_poses(double* mapped, double* raw) const; void start() { QThread::start(); } + void center() { centerp.store(true); } + void toggle_enabled() { enabledp.store(!enabledp.load()); } }; - -class HeadPoseData { -public: - THeadPoseDOF axes[6]; - HeadPoseData(std::vector<axis_opts*> opts) : - axes { - THeadPoseDOF("tx","tx_alt", 100, 100, 100, 100, opts[TX]), - THeadPoseDOF("ty","ty_alt", 100, 100, 100, 100, opts[TY]), - THeadPoseDOF("tz","tz_alt", 100, 100, 100, 100, opts[TZ]), - THeadPoseDOF("rx", "rx_alt", 180, 180, 180, 180, opts[Yaw]), - THeadPoseDOF("ry", "ry_alt", 90, 90, 90, 90, opts[Pitch]), - THeadPoseDOF("rz", "rz_alt", 180, 180, 180, 180, opts[Roll]) - } - {} -}; - #endif diff --git a/facetracknoir/tracker_types.cpp b/facetracknoir/tracker_types.cpp deleted file mode 100644 index 2d7ec45a..00000000 --- a/facetracknoir/tracker_types.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "tracker_types.h" -#include "rotation.h" -#include "facetracknoir/plugin-api.hpp" - -#define PI 3.14159265358979323846264 -#define D2R PI/180.0 -#define R2D 180.0/PI - -T6DOF operator-(const T6DOF& A, const T6DOF& B) -{ - RotationType R_A(A.axes[Yaw]*D2R, A.axes[Pitch]*D2R, A.axes[Roll]*D2R); - RotationType R_B(B.axes[Yaw]*D2R, B.axes[Pitch]*D2R, B.axes[Roll]*D2R); - RotationType R_C = R_A * R_B.inv(); - - T6DOF C; - R_C.toEuler(C.axes[Yaw], C.axes[Pitch], C.axes[Roll]); - C.axes[Yaw] *= R2D; - C.axes[Pitch] *= R2D; - C.axes[Roll] *= R2D; - - C.axes[TX] = A.axes[TX] - B.axes[TX]; - C.axes[TY] = A.axes[TY] - B.axes[TY]; - C.axes[TZ] = A.axes[TZ] - B.axes[TZ]; - return C; -} - -T6DOF operator+(const T6DOF& A, const T6DOF& B) -{ - RotationType R_A(A.axes[Yaw]*D2R, A.axes[Pitch]*D2R, A.axes[Roll]*D2R); - RotationType R_B(B.axes[Yaw]*D2R, B.axes[Pitch]*D2R, B.axes[Roll]*D2R); - RotationType R_C = R_A * R_B; - - T6DOF C; - R_C.toEuler(C.axes[Yaw], C.axes[Pitch], C.axes[Roll]); - C.axes[Yaw] *= R2D; - C.axes[Pitch] *= R2D; - C.axes[Roll] *= R2D; - - C.axes[TX] = A.axes[TX] + B.axes[TX]; - C.axes[TY] = A.axes[TY] + B.axes[TY]; - C.axes[TZ] = A.axes[TZ] + B.axes[TZ]; - return C; -} diff --git a/facetracknoir/tracker_types.h b/facetracknoir/tracker_types.h index 80b74759..c667498e 100644 --- a/facetracknoir/tracker_types.h +++ b/facetracknoir/tracker_types.h @@ -1,11 +1,66 @@ #pragma once +#include <utility> +#include <algorithm> +#include "rotation.h" +#include "plugin-api.hpp" + struct T6DOF { -public: - double axes[6]; +private: + static constexpr double PI = 3.14159265358979323846264; + static constexpr double D2R = PI/180.0; + static constexpr double R2D = 180.0/PI; + double axes[6]; +public: T6DOF() : axes {0,0,0, 0,0,0 } {} -}; -T6DOF operator-(const T6DOF& A, const T6DOF& B); // get new pose with respect to reference pose B -T6DOF operator+(const T6DOF& A, const T6DOF& B); // get new pose with respect to reference pose B^-1 + inline operator double*() { return axes; } + inline operator const double*() const { return axes; } + + inline double& operator()(int i) { return axes[i]; } + inline double operator()(int i) const { return axes[i]; } + + Quat quat() const + { + return Quat(axes[Yaw]*D2R, axes[Pitch]*D2R, axes[Roll]*D2R); + } + + static T6DOF fromQuat(const Quat& q) + { + T6DOF ret; + q.toEuler(ret(Yaw), ret(Pitch), ret(Roll)); + return ret; + } + + T6DOF operator-(const T6DOF& B) const + { + const Quat q = (quat() * B.quat().inv()); + T6DOF ret = fromQuat(q); + for (int i = TX; i < Yaw; i++) + ret(i) = B(i); + return ret; + } + + T6DOF operator+(const T6DOF& B) const + { + const Quat q = (quat() * B.quat().inv()); + T6DOF ret = fromQuat(q); + for (int i = TX; i < Yaw; i++) + ret(i) = B(i); + return ret; + } + + T6DOF operator|(const T6DOF& replacement) const + { + T6DOF ret = *this; + for (int i = 0; i < 6; i++) + { + static constexpr double eps = 1e-5; + // NB replace zero-valued elements with argument's + if (std::abs(ret(i)) < eps) + ret(i) = replacement(i); + } + return ret; + } +}; diff --git a/freetrackclient/freetrackclient.c b/freetrackclient/freetrackclient.c index 5323bcae..200242b9 100644 --- a/freetrackclient/freetrackclient.c +++ b/freetrackclient/freetrackclient.c @@ -27,27 +27,27 @@ #include <string.h> #include <windows.h> -#include "ftnoir_protocol_ft/fttypes.h" +#include "../ftnoir_protocol_ft/fttypes.h" #define FT_EXPORT(t) __declspec(dllexport) t __stdcall #if 0 -#include <stdio.h> +# include <stdio.h> static FILE *debug_stream = fopen("c:\\FreeTrackClient.log", "a"); -#define dbg_report(...) if (debug_stream) { fprintf(debug_stream, __VA_ARGS__); fflush(debug_stream); } +# define dbg_report(...) if (debug_stream) { fprintf(debug_stream, __VA_ARGS__); fflush(debug_stream); } #else #define dbg_report(...) ((void)0) #endif static HANDLE hFTMemMap = 0; -static FTHeap *pMemData = 0; -static HANDLE hFTMutex = 0; +static FTHeap* ipc_heap = 0; +static HANDLE ipc_mutex = 0; static const char* dllVersion = "1.0.0.0"; static const char* dllProvider = "FreeTrack"; -static bool FTCreateMapping(void) +static bool impl_create_mapping(void) { - if (pMemData != NULL) + if (ipc_heap != NULL) return true; hFTMemMap = CreateFileMappingA(INVALID_HANDLE_VALUE, @@ -58,26 +58,27 @@ static bool FTCreateMapping(void) (LPCSTR) FREETRACK_HEAP); if (hFTMemMap == NULL) - return (pMemData = NULL), false; + return (ipc_heap = NULL), false; - pMemData = (FTHeap*) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof(FTHeap)); - hFTMutex = CreateMutexA(NULL, false, FREETRACK_MUTEX); + ipc_heap = (FTHeap*) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof(FTHeap)); + ipc_mutex = CreateMutexA(NULL, false, FREETRACK_MUTEX); return true; } +#pragma comment (linker, "/export:FTGetData") FT_EXPORT(bool) FTGetData(FTData* data) { - if (FTCreateMapping() == false) + if (impl_create_mapping() == false) return false; - if (hFTMutex && WaitForSingleObject(hFTMutex, 16) == WAIT_OBJECT_0) { - if (pMemData) { - if (pMemData->data.DataID > (1 << 29)) - pMemData->data.DataID = 0; - data->DataID = pMemData->data.DataID; + if (ipc_mutex && WaitForSingleObject(ipc_mutex, 16) == WAIT_OBJECT_0) { + if (ipc_heap) { + if (ipc_heap->data.DataID > (1 << 29)) + ipc_heap->data.DataID = 0; + data->DataID = ipc_heap->data.DataID; } - ReleaseMutex(hFTMutex); + ReleaseMutex(ipc_mutex); } return true; } @@ -87,17 +88,20 @@ FT_EXPORT(bool) FTGetData(FTData* data) // The Delphi-code from the FreeTrack repo suggest a char * as argument, so it cost me an afternoon to figure it out (and keep ArmA2 from crashing). // Thanks guys! */ +#pragma comment (linker, "/export:FTReportName") FT_EXPORT(void) FTReportName( int name ) { dbg_report("FTReportName request (ID = %d).\n", name); } +#pragma comment (linker, "/export:FTGetDllVersion") FT_EXPORT(const char*) FTGetDllVersion(void) { dbg_report("FTGetDllVersion request.\n"); return dllVersion; } +#pragma comment (linker, "/export:FTProvider") FT_EXPORT(const char*) FTProvider(void) { dbg_report("FTProvider request.\n"); diff --git a/ftnoir_filter_kalman/ftnoir_filter_kalman.h b/ftnoir_filter_kalman/ftnoir_filter_kalman.h index a47ebf4f..cbe728ab 100755 --- a/ftnoir_filter_kalman/ftnoir_filter_kalman.h +++ b/ftnoir_filter_kalman/ftnoir_filter_kalman.h @@ -1,6 +1,6 @@ #pragma once /* Copyright (c) 2013 Stanisław 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. @@ -10,13 +10,12 @@ #include "ui_ftnoir_kalman_filtercontrols.h" #include "facetracknoir/plugin-api.hpp" -#include <opencv2/opencv.hpp> +#include <opencv2/core/core.hpp> +#include <opencv2/video/video.hpp> #include <vector> #include <QString> -#include <QIcon> -#include <QWidget> #include <QElapsedTimer> -#include <QObject> +#include <QWidget> #include "facetracknoir/options.h" using namespace options; @@ -24,7 +23,7 @@ class OPENTRACK_EXPORT FTNoIR_Filter : public IFilter { public: FTNoIR_Filter(); - void reset() override; + void reset(); void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position) override; cv::KalmanFilter kalman; diff --git a/ftnoir_protocol_ft/fttypes.h b/ftnoir_protocol_ft/fttypes.h index 0558f881..f41350c8 100644 --- a/ftnoir_protocol_ft/fttypes.h +++ b/ftnoir_protocol_ft/fttypes.h @@ -19,7 +19,11 @@ #pragma once -#include <inttypes.h> +#ifndef _MSC_VER +# include <inttypes.h> +#else +typedef unsigned __int32 uint32_t; +#endif #define FREETRACK_HEAP "FT_SharedMem" #define FREETRACK_MUTEX "FT_Mutext" @@ -54,7 +58,9 @@ typedef struct __FTData { float Y4; } FTData; -typedef struct __FTAlloc { +/* we add some shit at the end for other legacy proto, sadly */ + +typedef struct __FTHeap { FTData data; int32_t GameID; unsigned char table[8]; diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index 159f350e..f39562c1 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -17,12 +17,12 @@ #include <cmath> #include <QPixmap> -void FunctionConfig::setTrackingActive(bool blnActive) +void Map::setTrackingActive(bool blnActive) { activep = blnActive; } -FunctionConfig::FunctionConfig() : +Map::Map() : _mutex(QMutex::Recursive), data(0), activep(false), @@ -31,7 +31,7 @@ FunctionConfig::FunctionConfig() : { } -float FunctionConfig::getValue(float x) { +float Map::getValue(float x) { QMutexLocker foo(&_mutex); int x2 = (int) (std::min<float>(std::max<float>(x, -360), 360) * MEMOIZE_PRECISION); float ret = getValueInternal(x2); @@ -40,13 +40,13 @@ float FunctionConfig::getValue(float x) { return ret; } -bool FunctionConfig::getLastPoint(QPointF& point ) { +bool Map::getLastPoint(QPointF& point ) { QMutexLocker foo(&_mutex); point = last_input_value; return activep; } -float FunctionConfig::getValueInternal(int x) { +float Map::getValueInternal(int x) { float sign = x < 0 ? -1 : 1; x = x < 0 ? -x : x; float ret; @@ -75,7 +75,7 @@ static bool sortFn(const QPointF& one, const QPointF& two) { return one.x() < two.x(); } -void FunctionConfig::reload() { +void Map::reload() { if (input.size()) qStableSort(input.begin(), input.end(), sortFn); @@ -132,7 +132,7 @@ void FunctionConfig::reload() { } } -void FunctionConfig::removePoint(int i) { +void Map::removePoint(int i) { QMutexLocker foo(&_mutex); if (i >= 0 && i < input.size()) { @@ -141,13 +141,13 @@ void FunctionConfig::removePoint(int i) { } } -void FunctionConfig::addPoint(QPointF pt) { +void Map::addPoint(QPointF pt) { QMutexLocker foo(&_mutex); input.append(pt); reload(); } -void FunctionConfig::movePoint(int idx, QPointF pt) { +void Map::movePoint(int idx, QPointF pt) { QMutexLocker foo(&_mutex); if (idx >= 0 && idx < input.size()) { @@ -156,13 +156,13 @@ void FunctionConfig::movePoint(int idx, QPointF pt) { } } -const QList<QPointF> FunctionConfig::getPoints() { +const QList<QPointF> Map::getPoints() { QMutexLocker foo(&_mutex); // NB can't pass by reference return input; } -void FunctionConfig::loadSettings(QSettings& settings, const QString& title) { +void Map::loadSettings(QSettings& settings, const QString& title) { QMutexLocker foo(&_mutex); QPointF newPoint; @@ -187,7 +187,7 @@ void FunctionConfig::loadSettings(QSettings& settings, const QString& title) { reload(); } -void FunctionConfig::saveSettings(QSettings& settings, const QString& title) { +void Map::saveSettings(QSettings& settings, const QString& title) { QMutexLocker foo(&_mutex); settings.beginGroup(QString("Curves-%1").arg(title)); int max = input.size(); diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h index 66e7f3e8..ccfd1ba3 100644 --- a/qfunctionconfigurator/functionconfig.h +++ b/qfunctionconfigurator/functionconfig.h @@ -13,88 +13,55 @@ #include <QString> #include <QSettings> #include <QMutex> -#include "facetracknoir/plugin-api.hpp" #include <vector> +#include "../facetracknoir/plugin-api.hpp" +#include "../facetracknoir/qcopyable-mutex.hpp" #define MEMOIZE_PRECISION 100 -class MyMutex { -private: - QMutex inner; - -public: - QMutex* operator->() { return &inner; } - QMutex* operator->() const { return &const_cast<MyMutex*>(this)->inner; } - - MyMutex operator=(const MyMutex& datum) - { - auto mode = - datum->isRecursive() - ? QMutex::Recursive - : QMutex::NonRecursive; - - return MyMutex(mode); - } - - MyMutex(const MyMutex& datum) - { - *this = datum; - } - - MyMutex(QMutex::RecursionMode mode = QMutex::NonRecursive) : - inner(mode) - { - } - - QMutex* operator&() - { - return &inner; - } -}; - -class OPENTRACK_EXPORT FunctionConfig { +class OPENTRACK_EXPORT Map { private: void reload(); float getValueInternal(int x); - + MyMutex _mutex; - QList<QPointF> input; + QList<QPointF> input; std::vector<float> data; - QPointF last_input_value; + QPointF last_input_value; volatile bool activep; - int max_x; - int max_y; + int max_x; + int max_y; public: int maxInput() const { return max_x; } int maxOutput() const { return max_y; } - FunctionConfig(); - FunctionConfig(int maxx, int maxy) + Map(); + Map(int maxx, int maxy) { setMaxInput(maxx); setMaxOutput(maxy); } float getValue(float x); - bool getLastPoint(QPointF& point); - void removePoint(int i); + bool getLastPoint(QPointF& point); + void removePoint(int i); void removeAllPoints() { QMutexLocker foo(&_mutex); input.clear(); reload(); } - void addPoint(QPointF pt); - void movePoint(int idx, QPointF pt); - const QList<QPointF> getPoints(); - void setMaxInput(int MaxInput) { - max_x = MaxInput; - } - void setMaxOutput(int MaxOutput) { - max_y = MaxOutput; - } + void addPoint(QPointF pt); + void movePoint(int idx, QPointF pt); + const QList<QPointF> getPoints(); + void setMaxInput(int MaxInput) { + max_x = MaxInput; + } + void setMaxOutput(int MaxOutput) { + max_y = MaxOutput; + } - void saveSettings(QSettings& settings, const QString& title); - void loadSettings(QSettings& settings, const QString& title); + void saveSettings(QSettings& settings, const QString& title); + void loadSettings(QSettings& settings, const QString& title); - void setTrackingActive(bool blnActive); + void setTrackingActive(bool blnActive); }; diff --git a/qfunctionconfigurator/qfunctionconfigurator.cpp b/qfunctionconfigurator/qfunctionconfigurator.cpp index 1e5b957c..57d1500a 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.cpp +++ b/qfunctionconfigurator/qfunctionconfigurator.cpp @@ -37,7 +37,7 @@ QFunctionConfigurator::QFunctionConfigurator(QWidget *parent) : setMouseTracking(true); } -void QFunctionConfigurator::setConfig(FunctionConfig* config, const QString& name) { +void QFunctionConfigurator::setConfig(Map* config, const QString& name) { QSettings settings("opentrack"); QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); diff --git a/qfunctionconfigurator/qfunctionconfigurator.h b/qfunctionconfigurator/qfunctionconfigurator.h index facc5bbe..e35d0bc3 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.h +++ b/qfunctionconfigurator/qfunctionconfigurator.h @@ -20,8 +20,8 @@ class OPENTRACK_EXPORT QFunctionConfigurator : public QWidget public: QFunctionConfigurator(QWidget *parent = 0); - FunctionConfig* config(); - void setConfig(FunctionConfig* config, const QString &name); + Map* config(); + void setConfig(Map* config, const QString &name); QColor colorBezier() const { @@ -65,7 +65,7 @@ private: QPointF pixel_coord_to_point (const QPointF& point); QPointF point_to_pixel (const QPointF& point); - FunctionConfig* _config; + Map* _config; // bounds of the rectangle user can interact with QRectF pixel_bounds; -- cgit v1.2.3 From cfffa29e29db6b2234c7f534b1ebcd612b7f4914 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 5 Oct 2014 01:22:11 +0200 Subject: flush --- CMakeLists.txt | 3 +- facetracknoir/quat.hpp | 66 ++++++++++ facetracknoir/rotation.h | 58 -------- facetracknoir/tracker.h | 2 - facetracknoir/tracker_types.h | 14 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 148 ++++++++++----------- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 13 +- ftnoir_tracker_aruco/include/aruco.h | 29 ++-- ftnoir_tracker_aruco/include/arucofidmarkers.h | 15 +-- ftnoir_tracker_aruco/include/board.h | 168 ------------------------ ftnoir_tracker_aruco/include/boarddetector.h | 139 -------------------- ftnoir_tracker_aruco/include/cameraparameters.h | 6 +- ftnoir_tracker_aruco/include/cvdrawingutils.h | 19 +-- ftnoir_tracker_aruco/include/exports.h | 6 +- ftnoir_tracker_aruco/include/marker.h | 16 +-- ftnoir_tracker_aruco/include/markerdetector.h | 56 ++++---- ftnoir_tracker_aruco/trans_calib.h | 2 +- ftnoir_tracker_pt/camera.h | 2 +- ftnoir_tracker_pt/ftnoir_tracker_pt.h | 54 ++++---- ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp | 88 ++++++------- ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h | 4 +- ftnoir_tracker_pt/point_extractor.h | 4 +- ftnoir_tracker_pt/point_tracker.h | 74 +++++------ ftnoir_tracker_pt/pt_video_widget.h | 2 +- ftnoir_tracker_pt/trans_calib.h | 2 +- 25 files changed, 338 insertions(+), 652 deletions(-) create mode 100644 facetracknoir/quat.hpp delete mode 100644 facetracknoir/rotation.h delete mode 100644 ftnoir_tracker_aruco/include/board.h delete mode 100644 ftnoir_tracker_aruco/include/boarddetector.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 655d70c3..2de8856d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -344,7 +344,6 @@ opentrack_library(opentrack-tracker-ht) target_link_libraries(opentrack-tracker-ht opentrack-compat) if(SDK_ARUCO_LIBPATH) - include_directories(${CMAKE_SOURCE_DIR}/ftnoir_tracker_aruco/include) opentrack_library(opentrack-tracker-aruco) target_link_libraries(opentrack-tracker-aruco ${SDK_ARUCO_LIBPATH} ${OpenCV_LIBS}) endif() @@ -477,7 +476,7 @@ install(DIRECTORY "${CMAKE_SOURCE_DIR}/3rdparty-notices" DESTINATION .) install(FILES "${CMAKE_SOURCE_DIR}/bin/NPClient.dll" "${CMAKE_SOURCE_DIR}/bin/NPClient64.dll" "${CMAKE_SOURCE_DIR}/bin/TrackIR.exe" DESTINATION .) install(DIRECTORY "${CMAKE_SOURCE_DIR}/bin/settings" "${CMAKE_SOURCE_DIR}/facetracknoir/clientfiles" DESTINATION .) -if(NOT WIN32 AND SDK_WINE_PREFIX) +if(NOT WIN32 AND SDK_WINE_PREFIX AND NOT SDK_WINE_NO_WRAPPER) install(FILES "${CMAKE_BINARY_DIR}/opentrack-wrapper-wine.exe.so" DESTINATION .) endif() diff --git a/facetracknoir/quat.hpp b/facetracknoir/quat.hpp new file mode 100644 index 00000000..1e268963 --- /dev/null +++ b/facetracknoir/quat.hpp @@ -0,0 +1,66 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * 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 <cmath> + +class Quat { +private: + static constexpr double pi = 3.141592653; + static constexpr double r2d = 180./pi; + double a,b,c,d; // quaternion coefficients +public: + Quat() : a(1.0),b(0.0),c(0.0),d(0.0) {} + Quat(double yaw, double pitch, double roll) { from_euler_rads(yaw, pitch, roll); } + Quat(double a, double b, double c, double d) : a(a),b(b),c(c),d(d) {} + + Quat inv(){ + return Quat(a,-b,-c, -d); + } + + // conversions + // see http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles + void from_euler_rads(double yaw, double pitch, double roll) + { + + double sin_phi = sin(roll/2.0); + double cos_phi = cos(roll/2.0); + double sin_the = sin(pitch/2.0); + double cos_the = cos(pitch/2.0); + double sin_psi = sin(yaw/2.0); + double cos_psi = cos(yaw/2.0); + + a = cos_phi*cos_the*cos_psi + sin_phi*sin_the*sin_psi; + b = sin_phi*cos_the*cos_psi - cos_phi*sin_the*sin_psi; + c = cos_phi*sin_the*cos_psi + sin_phi*cos_the*sin_psi; + d = cos_phi*cos_the*sin_psi - sin_phi*sin_the*cos_psi; + } + + void to_euler_rads(double& yaw, double& pitch, double& roll) const + { + roll = atan2(2.0*(a*b + c*d), 1.0 - 2.0*(b*b + c*c)); + pitch = asin(2.0*(a*c - b*d)); + yaw = atan2(2.0*(a*d + b*c), 1.0 - 2.0*(c*c + d*d)); + } + + void to_euler_degrees(double& yaw, double& pitch, double& roll) const + { + to_euler_rads(yaw, pitch, roll); + yaw *= r2d; + pitch *= r2d; + roll *= r2d; + } + + const Quat operator*(const Quat& B) const + { + const Quat& A = *this; + return Quat(A.a*B.a - A.b*B.b - A.c*B.c - A.d*B.d, // quaternion multiplication + A.a*B.b + A.b*B.a + A.c*B.d - A.d*B.c, + A.a*B.c - A.b*B.d + A.c*B.a + A.d*B.b, + A.a*B.d + A.b*B.c - A.c*B.b + A.d*B.a); + } +}; diff --git a/facetracknoir/rotation.h b/facetracknoir/rotation.h deleted file mode 100644 index b3bb891e..00000000 --- a/facetracknoir/rotation.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * 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 <cmath> - -class Quat { - -public: - Quat() : a(1.0),b(0.0),c(0.0),d(0.0) {} - Quat(double yaw, double pitch, double roll) { fromEuler(yaw, pitch, roll); } - Quat(double a, double b, double c, double d) : a(a),b(b),c(c),d(d) {} - - Quat inv(){ - return Quat(a,-b,-c, -d); - } - - // conversions - // see http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles - void fromEuler(double yaw, double pitch, double roll) - { - - double sin_phi = sin(roll/2.0); - double cos_phi = cos(roll/2.0); - double sin_the = sin(pitch/2.0); - double cos_the = cos(pitch/2.0); - double sin_psi = sin(yaw/2.0); - double cos_psi = cos(yaw/2.0); - - a = cos_phi*cos_the*cos_psi + sin_phi*sin_the*sin_psi; - b = sin_phi*cos_the*cos_psi - cos_phi*sin_the*sin_psi; - c = cos_phi*sin_the*cos_psi + sin_phi*cos_the*sin_psi; - d = cos_phi*cos_the*sin_psi - sin_phi*sin_the*cos_psi; - } - - void toEuler(double& yaw, double& pitch, double& roll) const - { - roll = atan2(2.0*(a*b + c*d), 1.0 - 2.0*(b*b + c*c)); - pitch = asin(2.0*(a*c - b*d)); - yaw = atan2(2.0*(a*d + b*c), 1.0 - 2.0*(c*c + d*d)); - } - - const Quat operator*(const Quat& B) const - { - const Quat& A = *this; - return Quat(A.a*B.a - A.b*B.b - A.c*B.c - A.d*B.d, // quaternion multiplication - A.a*B.b + A.b*B.a + A.c*B.d - A.d*B.c, - A.a*B.c - A.b*B.d + A.c*B.a + A.d*B.b, - A.a*B.d + A.b*B.c - A.c*B.b + A.d*B.a); - } - -private: - double a,b,c,d; // quaternion coefficients -}; diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index 05ae4180..3d9a3858 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -22,8 +22,6 @@ #include "facetracknoir/options.h" #include "facetracknoir/timer.hpp" - - class Tracker : protected QThread { Q_OBJECT private: diff --git a/facetracknoir/tracker_types.h b/facetracknoir/tracker_types.h index c667498e..02aacdcf 100644 --- a/facetracknoir/tracker_types.h +++ b/facetracknoir/tracker_types.h @@ -2,14 +2,14 @@ #include <utility> #include <algorithm> -#include "rotation.h" -#include "plugin-api.hpp" +#include "./quat.hpp" +#include "./plugin-api.hpp" struct T6DOF { private: - static constexpr double PI = 3.14159265358979323846264; - static constexpr double D2R = PI/180.0; - static constexpr double R2D = 180.0/PI; + static constexpr double pi = 3.141592653; + static constexpr double d2r = pi/180.0; + static constexpr double r2d = 180./pi; double axes[6]; public: @@ -23,13 +23,13 @@ public: Quat quat() const { - return Quat(axes[Yaw]*D2R, axes[Pitch]*D2R, axes[Roll]*D2R); + return Quat(axes[Yaw]*d2r, axes[Pitch]*d2r, axes[Roll]*d2r); } static T6DOF fromQuat(const Quat& q) { T6DOF ret; - q.toEuler(ret(Yaw), ret(Pitch), ret(Roll)); + q.to_euler_rads(ret(Yaw), ret(Pitch), ret(Roll)); return ret; } diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index e216d319..a1e15721 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -8,13 +8,13 @@ #include "ftnoir_tracker_aruco.h" #include "ui_aruco-trackercontrols.h" #include "facetracknoir/plugin-api.hpp" -#include <cmath> #include <QMutexLocker> -#include <aruco.h> -#include <opencv2/opencv.hpp> -#include <opencv/highgui.h> +#include "include/markerdetector.h" +#include <opencv2/core/core.hpp> +#include <opencv2/highgui/highgui.hpp> #include <vector> #include <cstdio> +#include <cmath> #if defined(_WIN32) # undef NOMINMAX @@ -29,51 +29,51 @@ static QList<QString> get_camera_names(void) { QList<QString> ret; #if defined(_WIN32) - // Create the System Device Enumerator. - HRESULT hr; - ICreateDevEnum *pSysDevEnum = NULL; - hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **)&pSysDevEnum); - if (FAILED(hr)) - { - return ret; - } - // Obtain a class enumerator for the video compressor category. - IEnumMoniker *pEnumCat = NULL; - hr = pSysDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEnumCat, 0); - - if (hr == S_OK) { - // Enumerate the monikers. - IMoniker *pMoniker = NULL; - ULONG cFetched; - while (pEnumCat->Next(1, &pMoniker, &cFetched) == S_OK) { - IPropertyBag *pPropBag; - hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pPropBag); - if (SUCCEEDED(hr)) { - // To retrieve the filter's friendly name, do the following: - VARIANT varName; - VariantInit(&varName); - hr = pPropBag->Read(L"FriendlyName", &varName, 0); - if (SUCCEEDED(hr)) - { - // Display the name in your UI somehow. - QString str((QChar*)varName.bstrVal, wcslen(varName.bstrVal)); - ret.append(str); - } - VariantClear(&varName); - - ////// To create an instance of the filter, do the following: - ////IBaseFilter *pFilter; - ////hr = pMoniker->BindToObject(NULL, NULL, IID_IBaseFilter, - //// (void**)&pFilter); - // Now add the filter to the graph. - //Remember to release pFilter later. - pPropBag->Release(); - } - pMoniker->Release(); - } - pEnumCat->Release(); - } - pSysDevEnum->Release(); + // Create the System Device Enumerator. + HRESULT hr; + ICreateDevEnum *pSysDevEnum = NULL; + hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **)&pSysDevEnum); + if (FAILED(hr)) + { + return ret; + } + // Obtain a class enumerator for the video compressor category. + IEnumMoniker *pEnumCat = NULL; + hr = pSysDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEnumCat, 0); + + if (hr == S_OK) { + // Enumerate the monikers. + IMoniker *pMoniker = NULL; + ULONG cFetched; + while (pEnumCat->Next(1, &pMoniker, &cFetched) == S_OK) { + IPropertyBag *pPropBag; + hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pPropBag); + if (SUCCEEDED(hr)) { + // To retrieve the filter's friendly name, do the following: + VARIANT varName; + VariantInit(&varName); + hr = pPropBag->Read(L"FriendlyName", &varName, 0); + if (SUCCEEDED(hr)) + { + // Display the name in your UI somehow. + QString str((QChar*)varName.bstrVal, wcslen(varName.bstrVal)); + ret.append(str); + } + VariantClear(&varName); + + ////// To create an instance of the filter, do the following: + ////IBaseFilter *pFilter; + ////hr = pMoniker->BindToObject(NULL, NULL, IID_IBaseFilter, + //// (void**)&pFilter); + // Now add the filter to the graph. + //Remember to release pFilter later. + pPropBag->Release(); + } + pMoniker->Release(); + } + pEnumCat->Release(); + } + pSysDevEnum->Release(); #else for (int i = 0; i < 16; i++) { char buf[128]; @@ -89,15 +89,15 @@ static QList<QString> get_camera_names(void) { } typedef struct { - int width; - int height; + int width; + int height; } resolution_tuple; static resolution_tuple resolution_choices[] = { - { 640, 480 }, - { 320, 240 }, - { 320, 200 }, - { 0, 0 } + { 640, 480 }, + { 320, 240 }, + { 320, 200 }, + { 0, 0 } }; Tracker::Tracker() : stop(false), layout(nullptr), videoWidget(nullptr) @@ -108,8 +108,8 @@ Tracker::~Tracker() { stop = true; wait(); - if (videoWidget) - delete videoWidget; + if (videoWidget) + delete videoWidget; if(layout) delete layout; qDebug() << "releasing camera, brace for impact"; @@ -178,7 +178,7 @@ void Tracker::run() } if (fps) camera.set(CV_CAP_PROP_FPS, fps); - + aruco::MarkerDetector detector; detector.setDesiredSpeed(3); @@ -187,7 +187,7 @@ void Tracker::run() cv::Mat color, color_, grayscale, rvec, tvec; const double stateful_coeff = 0.88; - + if (!camera.isOpened()) { fprintf(stderr, "aruco tracker: can't open camera\n"); @@ -214,7 +214,7 @@ void Tracker::run() grayscale = channel[2]; } else cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); - + gain.tick(camera, grayscale); const int scale = frame.cols > 480 ? 2 : 1; @@ -280,11 +280,11 @@ void Tracker::run() cv::putText(frame, buf, cv::Point(10, 32), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(0, 255, 0), scale); ::sprintf(buf, "Jiffies: %ld", (long) (10000 * (time - tm) / freq)); cv::putText(frame, buf, cv::Point(10, 54), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(80, 255, 0), scale); - + if (markers.size() == 1 && markers[0].size() == 4) { const auto& m = markers.at(0); const float size = 40; - + const double p = s.marker_pitch; const double sq = sin(p * HT_PI / 180); const double cq = cos(p * HT_PI / 180); @@ -380,7 +380,7 @@ void Tracker::run() void Tracker::GetHeadPoseData(double *data) { QMutexLocker lck(&mtx); - + data[Yaw] = pose[Yaw]; data[Pitch] = pose[Pitch]; data[Roll] = pose[Roll]; @@ -391,11 +391,11 @@ void Tracker::GetHeadPoseData(double *data) class TrackerDll : public Metadata { - // ITrackerDll interface - void getFullName(QString *strToBeFilled); - void getShortName(QString *strToBeFilled); - void getDescription(QString *strToBeFilled); - void getIcon(QIcon *icon); + // ITrackerDll interface + void getFullName(QString *strToBeFilled); + void getShortName(QString *strToBeFilled); + void getDescription(QString *strToBeFilled); + void getIcon(QIcon *icon); }; //----------------------------------------------------------------------------- @@ -406,12 +406,12 @@ void TrackerDll::getFullName(QString *strToBeFilled) void TrackerDll::getShortName(QString *strToBeFilled) { - *strToBeFilled = "aruco"; + *strToBeFilled = "aruco"; } void TrackerDll::getDescription(QString *strToBeFilled) { - *strToBeFilled = ""; + *strToBeFilled = ""; } void TrackerDll::getIcon(QIcon *icon) @@ -425,7 +425,7 @@ void TrackerDll::getIcon(QIcon *icon) extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() { - return new TrackerDll; + return new TrackerDll; } //#pragma comment(linker, "/export:GetTracker=_GetTracker@0") @@ -444,11 +444,11 @@ TrackerControls::TrackerControls() { tracker = nullptr; calib_timer.setInterval(200); - ui.setupUi(this); + ui.setupUi(this); setAttribute(Qt::WA_NativeWindow, true); ui.cameraName->addItems(get_camera_names()); tie_setting(s.camera_index, ui.cameraName); - tie_setting(s.resolution, ui.resolution); + tie_setting(s.resolution, ui.resolution); tie_setting(s.force_fps, ui.cameraFPS); tie_setting(s.fov, ui.cameraFOV); tie_setting(s.headpos_x, ui.cx); @@ -500,7 +500,7 @@ void TrackerControls::doOK() s.b->save(); if (tracker) tracker->reload(); - this->close(); + this->close(); } void TrackerControls::doCancel() diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 5416bb52..9ac57417 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -16,12 +16,9 @@ #include <QHBoxLayout> #include <QDialog> #include <QTimer> -#include <opencv2/opencv.hpp> -#include <opencv/highgui.h> #include "facetracknoir/options.h" #include "ftnoir_tracker_aruco/trans_calib.h" #include "facetracknoir/plugin-api.hpp" - #include "facetracknoir/gain-control.hpp" using namespace options; @@ -50,7 +47,7 @@ class Tracker : protected QThread, public ITracker { Q_OBJECT public: - Tracker(); + Tracker(); ~Tracker() override; void StartTracker(QFrame* frame); void GetHeadPoseData(double *data); @@ -61,7 +58,7 @@ private: QMutex mtx; volatile bool stop; QHBoxLayout* layout; - ArucoVideoWidget* videoWidget; + ArucoVideoWidget* videoWidget; settings s; double pose[6]; cv::Mat frame; @@ -83,14 +80,14 @@ public: tracker = nullptr; } private: - Ui::Form ui; + Ui::Form ui; Tracker* tracker; settings s; TranslationCalibrator calibrator; QTimer calib_timer; private slots: - void doOK(); - void doCancel(); + void doOK(); + void doCancel(); void toggleCalibrate(); void cleanupCalib(); void update_tracker_calibration(); diff --git a/ftnoir_tracker_aruco/include/aruco.h b/ftnoir_tracker_aruco/include/aruco.h index 569b95fb..8ea583a8 100644 --- a/ftnoir_tracker_aruco/include/aruco.h +++ b/ftnoir_tracker_aruco/include/aruco.h @@ -26,12 +26,12 @@ The views and conclusions contained in the software and documentation are those authors and should not be interpreted as representing official policies, either expressed or implied, of Rafael Muñoz Salinas. - - + + \mainpage ArUco: Augmented Reality library from the University of Cordoba -ArUco is a minimal C++ library for detection of Augmented Reality markers based on OpenCv exclusively. +ArUco is a minimal C++ library for detection of Augmented Reality markers based on OpenCv exclusively. It is an educational project to show student how to detect augmented reality markers and it is provided under BSD license. @@ -54,11 +54,11 @@ Aruco allows the possibility to employ board. Boards are markers composed by an The library comes with five applications that will help you to learn how to use the library: - aruco_create_marker: which creates marker and saves it in a jpg file you can print. - - aruco_simple : simple test aplication that detects the markers in a image + - aruco_simple : simple test aplication that detects the markers in a image - aruco_test: this is the main application for detection. It reads images either from the camera of from a video and detect markers. Additionally, if you provide the intrinsics of the camera(obtained by OpenCv calibration) and the size of the marker in meters, the library calculates the marker intrinsics so that you can easily create your AR applications. - aruco_test_gl: shows how to use the library AR applications using OpenGL for rendering - aruco_create_board: application that helps you to create a board - - aruco_simple_board: simple test aplication that detects a board of markers in a image + - aruco_simple_board: simple test aplication that detects a board of markers in a image - aruco_test_board: application that detects boards - aruco_test_board_gl: application that detects boards and uses OpenGL to draw @@ -66,7 +66,7 @@ The library comes with five applications that will help you to learn how to use The ArUco library contents are divided in two main directories. The src directory, which contains the library itself. And the utils directory which contains the applications. -The library main classes are: +The library main classes are: - aruco::CameraParameters: represent the information of the camera that captures the images. Here you must set the calibration info. - aruco::Marker: which represent a marker detected in the image - aruco::MarkerDetector: that is in charge of deteting the markers in a image Detection is done by simple calling the member funcion ArMarkerDetector::detect(). Additionally, the classes contain members to create the required matrices for rendering using OpenGL. See aruco_test_gl for details @@ -101,34 +101,33 @@ The library has been compiled using MinGW and codeblocks. Below I describe the b -# Download the source code and compile it using cmake and codeblocks. Note: install the library in C:\ if you want it to be easily detected by cmake afterwards - step 4) aruco -# Download and decompress. - -# Open cmake gui application and set the path to the main library directory and also set a path where the project is going to be built. + -# Open cmake gui application and set the path to the main library directory and also set a path where the project is going to be built. -# Generate the codeblock project. -# Open the project with codeblock and compile then, install. The programs will be probably generated into the bin directory OpenGL: by default, the mingw version installed has not the glut library. So, the opengl programs are not compiled. If you want to compile with OpenGL support, you must install glut, or prefereably freeglut. -Thus, - - Download the library (http://www.martinpayne.me.uk/software/development/GLUT/freeglut-MinGW.zip) for mingw. - - Decompress in a directory X. +Thus, + - Download the library (http://www.martinpayne.me.uk/software/development/GLUT/freeglut-MinGW.zip) for mingw. + - Decompress in a directory X. - Then, rerun cmake setting the variable GLU_PATH to that directory (>cmake .. -DGLUT_PATH="C:\X") - Finally, recompile and test. Indeed, you should move the freeglut.dll to the directory with the binaries or to any other place in the PATH. CONCLUSION: Move to Linux, things are simpler :P - -\section Testing + +\section Testing For testing the applications, the library provides videos and the corresponding camera parameters of these videos. Into the directories you will find information on how to run the examples. - + \section Final Notes - REQUIREMENTS: OpenCv >= 2.1.0. and OpenGL for (aruco_test_gl and aruco_test_board_gl) - CONTACT: Rafael Munoz-Salinas: rmsalinas@uco.es - This libary is free software and come with no guaratee! - + */ #include "markerdetector.h" -#include "boarddetector.h" #include "cvdrawingutils.h" diff --git a/ftnoir_tracker_aruco/include/arucofidmarkers.h b/ftnoir_tracker_aruco/include/arucofidmarkers.h index 7dad4672..15eb8e4c 100644 --- a/ftnoir_tracker_aruco/include/arucofidmarkers.h +++ b/ftnoir_tracker_aruco/include/arucofidmarkers.h @@ -31,7 +31,6 @@ or implied, of Rafael Muñoz Salinas. #include <opencv2/core/core.hpp> #include "exports.h" #include "marker.h" -#include "board.h" namespace aruco { class ARUCO_EXPORTS FiducidalMarkers { @@ -80,7 +79,7 @@ public: * @param gridSize grid layout (numer of sqaures in x and Y) * @param MarkerSize size of markers sides in pixels * @param MarkerDistance distance between the markers - * @param TInfo output + * @param TInfo output * @param excludedIds set of ids excluded from the board */ static cv::Mat createBoardImage( cv::Size gridSize,int MarkerSize,int MarkerDistance, BoardConfiguration& TInfo ,vector<int> *excludedIds=NULL ) throw (cv::Exception); @@ -89,24 +88,24 @@ public: /**Creates a printable image of a board in chessboard_like manner * @param gridSize grid layout (numer of sqaures in x and Y) * @param MarkerSize size of markers sides in pixels - * @param TInfo output + * @param TInfo output * @param setDataCentered indicates if the center is set at the center of the board. Otherwise it is the left-upper corner - * + * */ static cv::Mat createBoardImage_ChessBoard( cv::Size gridSize,int MarkerSize, BoardConfiguration& TInfo ,bool setDataCentered=true ,vector<int> *excludedIds=NULL) throw (cv::Exception); - /**Creates a printable image of a board in a frame fashion + /**Creates a printable image of a board in a frame fashion * @param gridSize grid layout (numer of sqaures in x and Y) * @param MarkerSize size of markers sides in pixels * @param MarkerDistance distance between the markers - * @param TInfo output + * @param TInfo output * @param setDataCentered indicates if the center is set at the center of the board. Otherwise it is the left-upper corner - * + * */ static cv::Mat createBoardImage_Frame( cv::Size gridSize,int MarkerSize,int MarkerDistance, BoardConfiguration& TInfo ,bool setDataCentered=true,vector<int> *excludedIds=NULL ) throw (cv::Exception); private: - + static vector<int> getListOfValidMarkersIds_random(int nMarkers,vector<int> *excluded) throw (cv::Exception); static cv::Mat rotate(const cv::Mat & in); static int hammDistMarker(cv::Mat bits); diff --git a/ftnoir_tracker_aruco/include/board.h b/ftnoir_tracker_aruco/include/board.h deleted file mode 100644 index c1d79292..00000000 --- a/ftnoir_tracker_aruco/include/board.h +++ /dev/null @@ -1,168 +0,0 @@ -/***************************** -Copyright 2011 Rafael Muñoz Salinas. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are -permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this list of - conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, this list - of conditions and the following disclaimer in the documentation and/or other materials - provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The views and conclusions contained in the software and documentation are those of the -authors and should not be interpreted as representing official policies, either expressed -or implied, of Rafael Muñoz Salinas. -********************************/ -#ifndef _Aruco_board_h -#define _Aruco_board_h -#include <opencv2/opencv.hpp> -#include <string> -#include <vector> -#include "exports.h" -#include "marker.h" -using namespace std; -namespace aruco { -/** - * 3d representation of a marker - */ -struct ARUCO_EXPORTS MarkerInfo:public vector<cv::Point3f> { - MarkerInfo() {} - MarkerInfo(int _id) {id=_id; } - MarkerInfo(const MarkerInfo&MI): vector<cv::Point3f>(MI){id=MI.id; } - MarkerInfo & operator=(const MarkerInfo&MI){ - vector<cv::Point3f> ::operator=(MI); - id=MI.id; - return *this; - } - int id;//maker id -}; - -/**\brief This class defines a board with several markers. - * A Board contains several markers so that they are more robustly detected. - * - * In general, a board is a set of markers. So BoardConfiguration is only a list - * of the id of the markers along with the position of their corners. - * - * The position of the corners can be specified either in pixels (in a non-specific size) or in meters. - * The first is the typical case in which you generate the image of board and the print it. Since you do not know in advance the real - * size of the markers, their corners are specified in pixels, and then, the translation to meters can be made once you know the real size. - * - * On the other hand, you may want to have the information of your boards in meters. The BoardConfiguration allows you to do so. - * - * The point is in the mInfoType variable. It can be either PIX or METERS according to your needs. - * -*/ - - -class ARUCO_EXPORTS BoardConfiguration: public vector<MarkerInfo> -{ - friend class Board; -public: - enum MarkerInfoType {NONE=-1,PIX=0,METERS=1};//indicates if the data in MakersInfo is expressed in meters or in pixels so as to do conversion internally - //variable indicates if the data in MakersInfo is expressed in meters or in pixels so as to do conversion internally - int mInfoType; - /** - */ - BoardConfiguration(); - - /** - */ - BoardConfiguration(const BoardConfiguration &T); - - /** - */ - BoardConfiguration & operator=(const BoardConfiguration &T); - /**Saves the board info to a file - */ - void saveToFile(string sfile)throw (cv::Exception); - /**Reads board info from a file - */ - void readFromFile(string sfile)throw (cv::Exception); - /**Indicates if the corners are expressed in meters - */ - bool isExpressedInMeters()const { - return mInfoType==METERS; - } - /**Indicates if the corners are expressed in meters - */ - bool isExpressedInPixels()const { - return mInfoType==PIX; - } - /**Returns the index of the marker with id indicated, if is in the list - */ - int getIndexOfMarkerId(int id)const; - /**Returns the Info of the marker with id specified. If not in the set, throws exception - */ - const MarkerInfo& getMarkerInfo(int id)const throw (cv::Exception); - /**Set in the list passed the set of the ids - */ - void getIdList(vector<int> &ids,bool append=true)const; -private: - /**Saves the board info to a file - */ - void saveToFile(cv::FileStorage &fs)throw (cv::Exception); - /**Reads board info from a file - */ - void readFromFile(cv::FileStorage &fs)throw (cv::Exception); -}; - -/** -*/ -class ARUCO_EXPORTS Board:public vector<Marker> -{ - -public: - BoardConfiguration conf; - //matrices of rotation and translation respect to the camera - cv::Mat Rvec,Tvec; - /** - */ - Board() - { - Rvec.create(3,1,CV_32FC1); - Tvec.create(3,1,CV_32FC1); - for (int i=0;i<3;i++) - Tvec.at<float>(i,0)=Rvec.at<float>(i,0)=-999999; - } - - /**Given the extrinsic camera parameters returns the GL_MODELVIEW matrix for opengl. - * Setting this matrix, the reference corrdinate system will be set in this board - */ - void glGetModelViewMatrix(double modelview_matrix[16])throw(cv::Exception); - - /** - * Returns position vector and orientation quaternion for an Ogre scene node or entity. - * Use: - * ... - * Ogre::Vector3 ogrePos (position[0], position[1], position[2]); - * Ogre::Quaternion ogreOrient (orientation[0], orientation[1], orientation[2], orientation[3]); - * mySceneNode->setPosition( ogrePos ); - * mySceneNode->setOrientation( ogreOrient ); - * ... - */ - void OgreGetPoseParameters( double position[3], double orientation[4] )throw(cv::Exception); - - - /**Save this from a file - */ - void saveToFile(string filePath)throw(cv::Exception); - /**Read this from a file - */ - void readFromFile(string filePath)throw(cv::Exception); - -}; -} - -#endif diff --git a/ftnoir_tracker_aruco/include/boarddetector.h b/ftnoir_tracker_aruco/include/boarddetector.h deleted file mode 100644 index 4770b5c9..00000000 --- a/ftnoir_tracker_aruco/include/boarddetector.h +++ /dev/null @@ -1,139 +0,0 @@ -/***************************** -Copyright 2011 Rafael Muñoz Salinas. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are -permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this list of - conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, this list - of conditions and the following disclaimer in the documentation and/or other materials - provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The views and conclusions contained in the software and documentation are those of the -authors and should not be interpreted as representing official policies, either expressed -or implied, of Rafael Muñoz Salinas. -********************************/ -#ifndef _Aruco_BoardDetector_H -#define _Aruco_BoardDetector_H -#include <opencv2/opencv.hpp> -#include "exports.h" -#include "board.h" -#include "cameraparameters.h" -#include "markerdetector.h" -using namespace std; - -namespace aruco -{ - -/**\brief This class detects AR boards - * Version 1.2 - * There are two modes for board detection. - * First, the old way. (You first detect markers with MarkerDetector and then call to detect in this class. - * - * Second: New mode, marker detection is included in the class - * \code - - CameraParameters CP; - CP.readFromFile(path_cp) - BoardConfiguration BC; - BC.readFromFile(path_bc); - BoardDetector BD; - BD.setParams(BC,CP); //or only BD.setParams(BC) - //capture image - cv::Mat im; - capture_image(im); - - float prob=BD.detect(im); - if (prob>0.3) - CvDrawingUtils::draw3DAxis(im,BD.getDetectedBoard(),CP); - - \endcode - * -*/ -class ARUCO_EXPORTS BoardDetector -{ -public: - /** See discussion in @see enableRotateXAxis. - * Do not change unless you know what you are doing - */ - BoardDetector(bool setYPerperdicular=true); - - - /** - * Use if you plan to let this class to perform marker detection too - */ - void setParams(const BoardConfiguration &bc,const CameraParameters &cp, float markerSizeMeters=-1); - void setParams(const BoardConfiguration &bc); - /** - * Detect markers, and then, look for the board indicated in setParams() - * @return value indicating the likelihood of having found the marker - */ - float detect(const cv::Mat &im)throw (cv::Exception); - /**Returns a reference to the board detected - */ - Board & getDetectedBoard(){return _boardDetected;} - /**Returns a reference to the internal marker detector - */ - MarkerDetector &getMarkerDetector(){return _mdetector;} - /**Returns the vector of markers detected - */ - vector<Marker> &getDetectedMarkers(){return _vmarkers;} - - - //ALTERNATIVE DETECTION METHOD, BASED ON MARKERS PREVIOUSLY DETECTED - - /** Given the markers detected, determines if there is the board passed - * @param detectedMarkers result provided by aruco::ArMarkerDetector - * @param BConf the board you want to see if is present - * @param Bdetected output information of the detected board - * @param camMatrix camera matrix with intrinsics - * @param distCoeff camera distorsion coeff - * @param camMatrix intrinsic camera information. - * @param distCoeff camera distorsion coefficient. If set Mat() if is assumed no camera distorion - * @param markerSizeMeters size of the marker sides expressed in meters - * @return value indicating the likelihood of having found the marker - */ - float detect(const vector<Marker> &detectedMarkers,const BoardConfiguration &BConf, Board &Bdetected, cv::Mat camMatrix=cv::Mat(),cv::Mat distCoeff=cv::Mat(), float markerSizeMeters=-1 )throw (cv::Exception); - float detect(const vector<Marker> &detectedMarkers,const BoardConfiguration &BConf, Board &Bdetected,const CameraParameters &cp, float markerSizeMeters=-1 )throw (cv::Exception); - - - /** - * By default, the Y axis is set to point up. However this is not the default - * operation mode of opencv, which produces the Z axis pointing up instead. - * So, to achieve this change, we have to rotate the X axis. - */ - void setYPerperdicular(bool enable){_setYPerperdicular=enable;} - - - - -private: - void rotateXAxis(cv::Mat &rotation); - bool _setYPerperdicular; - - //-- Functionality to detect markers inside - bool _areParamsSet; - BoardConfiguration _bconf; - Board _boardDetected; - float _markerSize; - CameraParameters _camParams; - MarkerDetector _mdetector;//internal markerdetector - vector<Marker> _vmarkers;//markers detected in the call to : float detect(const cv::Mat &im); - -}; - -} -#endif - diff --git a/ftnoir_tracker_aruco/include/cameraparameters.h b/ftnoir_tracker_aruco/include/cameraparameters.h index c3381a74..a419afbe 100644 --- a/ftnoir_tracker_aruco/include/cameraparameters.h +++ b/ftnoir_tracker_aruco/include/cameraparameters.h @@ -28,7 +28,7 @@ or implied, of Rafael Muñoz Salinas. #ifndef _Aruco_CameraParameters_H #define _Aruco_CameraParameters_H #include "exports.h" -#include <opencv2/opencv.hpp> +#include <opencv2/core/core.hpp> #include <string> using namespace std; namespace aruco @@ -105,7 +105,7 @@ public: * @param invert: indicates if the output projection matrix has to yield a horizontally inverted image because image data has not been stored in the order of glDrawPixels: bottom-to-top. */ void glGetProjectionMatrix( cv::Size orgImgSize, cv::Size size,double proj_matrix[16],double gnear,double gfar,bool invert=false )throw(cv::Exception); - + /** * setup camera for an Ogre project. * Use: @@ -117,7 +117,7 @@ public: * As in OpenGL, it assumes no camera distorsion */ void OgreGetProjectionMatrix( cv::Size orgImgSize, cv::Size size,double proj_matrix[16],double gnear,double gfar,bool invert=false )throw(cv::Exception); - + private: //GL routines diff --git a/ftnoir_tracker_aruco/include/cvdrawingutils.h b/ftnoir_tracker_aruco/include/cvdrawingutils.h index 38e9986e..24bfe630 100644 --- a/ftnoir_tracker_aruco/include/cvdrawingutils.h +++ b/ftnoir_tracker_aruco/include/cvdrawingutils.h @@ -33,19 +33,12 @@ namespace aruco { /**\brief A set of functions to draw in opencv images */ - class ARUCO_EXPORTS CvDrawingUtils - { - public: - - static void draw3dAxis(cv::Mat &Image,Marker &m,const CameraParameters &CP); - - static void draw3dCube(cv::Mat &Image,Marker &m,const CameraParameters &CP); - - static void draw3dAxis(cv::Mat &Image,Board &m,const CameraParameters &CP); - - static void draw3dCube(cv::Mat &Image,Board &m,const CameraParameters &CP); - - }; + class ARUCO_EXPORTS CvDrawingUtils + { + public: + static void draw3dAxis(cv::Mat &Image,Marker &m,const CameraParameters &CP); + static void draw3dCube(cv::Mat &Image,Marker &m,const CameraParameters &CP); + }; } #endif diff --git a/ftnoir_tracker_aruco/include/exports.h b/ftnoir_tracker_aruco/include/exports.h index 154605ec..044a1367 100644 --- a/ftnoir_tracker_aruco/include/exports.h +++ b/ftnoir_tracker_aruco/include/exports.h @@ -25,7 +25,7 @@ The views and conclusions contained in the software and documentation are those authors and should not be interpreted as representing official policies, either expressed or implied, of Rafael Muñoz Salinas. ********************************/ - + #ifndef __OPENARUCO_CORE_TYPES_H__ @@ -37,9 +37,9 @@ or implied, of Rafael Muñoz Salinas. #if (defined WIN32 || defined _WIN32 || defined WINCE) && defined DSO_EXPORTS - #define ARUCO_EXPORTS __declspec(dllexport) + #define ARUCO_EXPORTS __declspec(dllexport) __attribute__((visibility ("default"))) #else - #define ARUCO_EXPORTS + #define ARUCO_EXPORTS __attribute__((visibility ("default"))) #endif diff --git a/ftnoir_tracker_aruco/include/marker.h b/ftnoir_tracker_aruco/include/marker.h index dc6bb28c..89961002 100644 --- a/ftnoir_tracker_aruco/include/marker.h +++ b/ftnoir_tracker_aruco/include/marker.h @@ -29,7 +29,7 @@ or implied, of Rafael Muñoz Salinas. #define _Aruco_Marker_H #include <vector> #include <iostream> -#include <opencv2/opencv.hpp> +#include <opencv2/core/core.hpp> #include "exports.h" #include "cameraparameters.h" using namespace std; @@ -81,12 +81,12 @@ public: * @param setYPerperdicular If set the Y axis will be perpendicular to the surface. Otherwise, it will be the Z axis */ void calculateExtrinsics(float markerSize,cv::Mat CameraMatrix,cv::Mat Distorsion=cv::Mat(),bool setYPerperdicular=true)throw(cv::Exception); - + /**Given the extrinsic camera parameters returns the GL_MODELVIEW matrix for opengl. * Setting this matrix, the reference coordinate system will be set in this marker */ void glGetModelViewMatrix( double modelview_matrix[16])throw(cv::Exception); - + /** * Returns position vector and orientation quaternion for an Ogre scene node or entity. * Use: @@ -97,8 +97,8 @@ public: * mySceneNode->setOrientation( ogreOrient ); * ... */ - void OgreGetPoseParameters( double position[3], double orientation[4] )throw(cv::Exception); - + void OgreGetPoseParameters( double position[3], double orientation[4] )throw(cv::Exception); + /**Returns the centroid of the marker */ cv::Point2f getCenter()const; @@ -132,11 +132,11 @@ public: return str; } - - + + private: void rotateXAxis(cv::Mat &rotation); - + }; } diff --git a/ftnoir_tracker_aruco/include/markerdetector.h b/ftnoir_tracker_aruco/include/markerdetector.h index 4d6e7b90..a4656527 100644 --- a/ftnoir_tracker_aruco/include/markerdetector.h +++ b/ftnoir_tracker_aruco/include/markerdetector.h @@ -27,7 +27,7 @@ or implied, of Rafael Muñoz Salinas. ********************************/ #ifndef _ARUCO_MarkerDetector_H #define _ARUCO_MarkerDetector_H -#include <opencv2/opencv.hpp> +#include <opencv2/core/core.hpp> #include <cstdio> #include <iostream> #include "cameraparameters.h" @@ -47,7 +47,7 @@ class ARUCO_EXPORTS MarkerDetector class MarkerCandidate: public Marker{ public: MarkerCandidate(){} - MarkerCandidate(const Marker &M): Marker(M){} + MarkerCandidate(const Marker &M): Marker(M){} MarkerCandidate(const MarkerCandidate &M): Marker(M){ contour=M.contour; idx=M.idx; @@ -60,20 +60,20 @@ class ARUCO_EXPORTS MarkerDetector idx=M.idx; return M; } - + vector<cv::Point> contour;//all the points of its contour int idx;//index position in the global contour list }; public: /** - * See + * See */ - MarkerDetector(); + MarkerDetector() {} /** */ - ~MarkerDetector(); + ~MarkerDetector() {} /**Detects the markers in the image passed * @@ -161,17 +161,17 @@ public: * of cols and rows. * @param min size of the contour to consider a possible marker as valid (0,1] * @param max size of the contour to consider a possible marker as valid [0,1) - * + * */ void setMinMaxSize(float min=0.03,float max=0.5)throw(cv::Exception); - + /**reads the min and max sizes employed * @param min output size of the contour to consider a possible marker as valid (0,1] * @param max output size of the contour to consider a possible marker as valid [0,1) - * + * */ void getMinMaxSize(float &min,float &max){min=_minSize;max=_maxSize;} - + /**Enables/Disables erosion process that is REQUIRED for chessboard like boards. * By default, this property is enabled */ @@ -210,10 +210,10 @@ public: markerIdDetector_ptrfunc=markerdetector_func; } - /** Use an smaller version of the input image for marker detection. + /** Use an smaller version of the input image for marker detection. * If your marker is small enough, you can employ an smaller image to perform the detection without noticeable reduction in the precision. * Internally, we are performing a pyrdown operation - * + * * @param level number of times the image size is divided by 2. Internally, we are performing a pyrdown. */ void pyrDown(unsigned int level){pyrdown_level=level;} @@ -247,17 +247,17 @@ public: * @return true if the operation succeed */ bool warp(cv::Mat &in,cv::Mat &out,cv::Size size, std::vector<cv::Point2f> points)throw (cv::Exception); - - - + + + /** Refine MarkerCandidate Corner using LINES method * @param candidate candidate to refine corners */ - void refineCandidateLines(MarkerCandidate &candidate); - - + void refineCandidateLines(MarkerCandidate &candidate); + + /**DEPRECATED!!! Use the member function in CameraParameters - * + * * Given the intrinsic camera parameters returns the GL_PROJECTION matrix for opengl. * PLease NOTE that when using OpenGL, it is assumed no camera distorsion! So, if it is not true, you should have * undistor image @@ -308,26 +308,26 @@ private: */ int perimeter(std::vector<cv::Point2f> &a); - + // //GL routines -// +// // static void argConvGLcpara2( double cparam[3][4], int width, int height, double gnear, double gfar, double m[16], bool invert )throw(cv::Exception); // static int arParamDecompMat( double source[3][4], double cpara[3][4], double trans[3][4] )throw(cv::Exception); // static double norm( double a, double b, double c ); // static double dot( double a1, double a2, double a3, // double b1, double b2, double b3 ); -// +// //detection of the void findBestCornerInRegion_harris(const cv::Mat & grey,vector<cv::Point2f> & Corners,int blockSize); - - + + // auxiliar functions to perform LINES refinement void interpolate2Dline( const vector< cv::Point > &inPoints, cv::Point3f &outLine); - cv::Point2f getCrossPoint(const cv::Point3f& line1, const cv::Point3f& line2); - - - /**Given a vector vinout with elements and a boolean vector indicating the lements from it to remove, + cv::Point2f getCrossPoint(const cv::Point3f& line1, const cv::Point3f& line2); + + + /**Given a vector vinout with elements and a boolean vector indicating the lements from it to remove, * this function remove the elements * @param vinout * @param toRemove diff --git a/ftnoir_tracker_aruco/trans_calib.h b/ftnoir_tracker_aruco/trans_calib.h index 5c321b2c..c2c02b38 100644 --- a/ftnoir_tracker_aruco/trans_calib.h +++ b/ftnoir_tracker_aruco/trans_calib.h @@ -8,7 +8,7 @@ #ifndef TRANSCALIB_H #define TRANSCALIB_H -#include <opencv2/opencv.hpp> +#include <opencv2/core/core.hpp> //----------------------------------------------------------------------------- // Calibrates the translation from head to model = t_MH diff --git a/ftnoir_tracker_pt/camera.h b/ftnoir_tracker_pt/camera.h index 7ebbcb67..889bf2d3 100644 --- a/ftnoir_tracker_pt/camera.h +++ b/ftnoir_tracker_pt/camera.h @@ -8,7 +8,7 @@ #ifndef CAMERA_H #define CAMERA_H -#include <opencv2/opencv.hpp> +#include <opencv2/core/core.hpp> #ifndef OPENTRACK_API # include <boost/shared_ptr.hpp> #else diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.h b/ftnoir_tracker_pt/ftnoir_tracker_pt.h index 5bcfd37d..fff8d4ab 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.h @@ -22,7 +22,7 @@ #include <QMutex> #include <QMutexLocker> #include <QTime> -#include <opencv2/opencv.hpp> +#include <opencv2/core/core.hpp> #include <atomic> #ifndef OPENTRACK_API # include <boost/shared_ptr.hpp> @@ -36,53 +36,53 @@ class Tracker : public ITracker, protected QThread { public: - Tracker(); + Tracker(); ~Tracker() override; void StartTracker(QFrame* parent_window) override; void GetHeadPoseData(double* data) override; void apply(settings& s); - void apply_inner(); - void center(); - void reset(); // reset the trackers internal state variables + void apply_inner(); + void center(); + void reset(); // reset the trackers internal state variables - void get_pose(FrameTrafo* X_CM) { QMutexLocker lock(&mutex); *X_CM = point_tracker.get_pose(); } - int get_n_points() { QMutexLocker lock(&mutex); return point_extractor.get_points().size(); } - void get_cam_info(CamInfo* info) { QMutexLocker lock(&mutex); *info = camera.get_info(); } + void get_pose(FrameTrafo* X_CM) { QMutexLocker lock(&mutex); *X_CM = point_tracker.get_pose(); } + int get_n_points() { QMutexLocker lock(&mutex); return point_extractor.get_points().size(); } + void get_cam_info(CamInfo* info) { QMutexLocker lock(&mutex); *info = camera.get_info(); } protected: void run() override; private: - QMutex mutex; - // thread commands - enum Command { - ABORT = 1<<0 - }; - void set_command(Command command); - void reset_command(Command command); + QMutex mutex; + // thread commands + enum Command { + ABORT = 1<<0 + }; + void set_command(Command command); + void reset_command(Command command); volatile int commands; CVCamera camera; - FrameRotation frame_rotation; - PointExtractor point_extractor; - PointTracker point_tracker; + FrameRotation frame_rotation; + PointExtractor point_extractor; + PointTracker point_tracker; - FrameTrafo X_GH_0; // for centering - cv::Vec3f t_MH; // translation from model frame to head frame - cv::Matx33f R_GC; // rotation from opengl reference frame to camera frame + FrameTrafo X_GH_0; // for centering + cv::Vec3f t_MH; // translation from model frame to head frame + cv::Matx33f R_GC; // rotation from opengl reference frame to camera frame - // --- ui --- - cv::Mat frame; // the output frame for display + // --- ui --- + cv::Mat frame; // the output frame for display PTVideoWidget* video_widget; - QFrame* video_frame; - + QFrame* video_frame; + settings s; std::atomic<settings*> new_settings; Timer time; - + static constexpr double rad2deg = 180.0/3.14159265; static constexpr double deg2rad = 3.14159265/180.0; - + PointModel model; }; diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp index 6cd6135c..3af7b560 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp @@ -9,7 +9,7 @@ #include <QMessageBox> #include <QDebug> -#include <opencv2/opencv.hpp> +#include <opencv2/core/core.hpp> #ifndef OPENTRACK_API # include <boost/shared_ptr.hpp> #else @@ -25,14 +25,14 @@ TrackerDialog::TrackerDialog() timer(this), trans_calib_running(false) { - ui.setupUi( this ); + ui.setupUi( this ); vector<string> device_names; - get_camera_device_names(device_names); + get_camera_device_names(device_names); for (vector<string>::iterator iter = device_names.begin(); iter != device_names.end(); ++iter) - { - ui.camdevice_combo->addItem(iter->c_str()); - } + { + ui.camdevice_combo->addItem(iter->c_str()); + } ui.camroll_combo->addItem("-90"); ui.camroll_combo->addItem("0"); @@ -82,7 +82,7 @@ TrackerDialog::TrackerDialog() connect(ui.model_tabs, SIGNAL(currentChanged(int)), this, SLOT(set_model(int))); connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); - timer.start(100); + timer.start(100); connect(ui.buttonBox_2, SIGNAL(clicked(QAbstractButton*)), this, SLOT(do_apply_without_saving(QAbstractButton*))); } @@ -96,7 +96,7 @@ void TrackerDialog::set_model_clip() s.m02_y = -static_cast<double>(s.clip_by); s.m02_z = -static_cast<double>(s.clip_bz); - settings_changed(); + settings_changed(); } void TrackerDialog::set_model_cap() @@ -108,12 +108,12 @@ void TrackerDialog::set_model_cap() s.m02_y = -static_cast<double>(s.cap_y); s.m02_z = -static_cast<double>(s.cap_z); - settings_changed(); + settings_changed(); } void TrackerDialog::set_model_custom() { - settings_changed(); + settings_changed(); } void TrackerDialog::set_model(int val) @@ -123,38 +123,38 @@ void TrackerDialog::set_model(int val) void TrackerDialog::startstop_trans_calib(bool start) { - if (start) - { - qDebug()<<"TrackerDialog:: Starting translation calibration"; - trans_calib.reset(); - trans_calib_running = true; - } - else - { - qDebug()<<"TrackerDialog:: Stoppping translation calibration"; - trans_calib_running = false; + if (start) + { + qDebug()<<"TrackerDialog:: Starting translation calibration"; + trans_calib.reset(); + trans_calib_running = true; + } + else + { + qDebug()<<"TrackerDialog:: Stoppping translation calibration"; + trans_calib_running = false; { auto tmp = trans_calib.get_estimate(); s.t_MH_x = tmp[0]; s.t_MH_y = tmp[1]; s.t_MH_z = tmp[2]; } - settings_changed(); - } + settings_changed(); + } } void TrackerDialog::poll_tracker_info() { if (tracker) - { + { QString to_print; - + // display caminfo CamInfo info; tracker->get_cam_info(&info); to_print = QString::number(info.res_x)+"x"+QString::number(info.res_y)+" @ "+QString::number(info.fps)+" FPS"; ui.caminfo_label->setText(to_print); - + // display pointinfo int n_points = tracker->get_n_points(); to_print = QString::number(n_points); @@ -163,7 +163,7 @@ void TrackerDialog::poll_tracker_info() else to_print += " BAD!"; ui.pointinfo_label->setText(to_print); - + // update calibration if (trans_calib_running) trans_calib_step(); } @@ -177,16 +177,16 @@ void TrackerDialog::poll_tracker_info() void TrackerDialog::trans_calib_step() { - if (tracker) - { - FrameTrafo X_CM; - tracker->get_pose(&X_CM); - trans_calib.update(X_CM.R, X_CM.t); - cv::Vec3f t_MH = trans_calib.get_estimate(); + if (tracker) + { + FrameTrafo X_CM; + tracker->get_pose(&X_CM); + trans_calib.update(X_CM.R, X_CM.t); + cv::Vec3f t_MH = trans_calib.get_estimate(); s.t_MH_x = t_MH[0]; s.t_MH_y = t_MH[1]; s.t_MH_z = t_MH[2]; - } + } } void TrackerDialog::settings_changed() @@ -203,7 +203,7 @@ void TrackerDialog::save() void TrackerDialog::doOK() { save(); - close(); + close(); } void TrackerDialog::do_apply_without_saving(QAbstractButton*) @@ -225,7 +225,7 @@ void TrackerDialog::do_apply_without_saving(QAbstractButton*) void TrackerDialog::doApply() { - save(); + save(); } void TrackerDialog::doCancel() @@ -236,23 +236,23 @@ void TrackerDialog::doCancel() void TrackerDialog::registerTracker(ITracker *t) { - qDebug()<<"TrackerDialog:: Tracker registered"; - tracker = static_cast<Tracker*>(t); + qDebug()<<"TrackerDialog:: Tracker registered"; + tracker = static_cast<Tracker*>(t); if (isVisible() & s.b->modifiedp()) tracker->apply(s); - ui.tcalib_button->setEnabled(true); - //ui.center_button->setEnabled(true); + ui.tcalib_button->setEnabled(true); + //ui.center_button->setEnabled(true); } void TrackerDialog::unRegisterTracker() { - qDebug()<<"TrackerDialog:: Tracker un-registered"; - tracker = NULL; - ui.tcalib_button->setEnabled(false); - //ui.center_button->setEnabled(false); + qDebug()<<"TrackerDialog:: Tracker un-registered"; + tracker = NULL; + ui.tcalib_button->setEnabled(false); + //ui.center_button->setEnabled(false); } extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog( ) { - return new TrackerDialog; + return new TrackerDialog; } diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h index 365776e4..e8cac679 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h @@ -8,7 +8,7 @@ #ifndef FTNOIR_TRACKER_PT_SETTINGS_H #define FTNOIR_TRACKER_PT_SETTINGS_H -#include <opencv2/opencv.hpp> +#include <opencv2/core/core.hpp> #include "point_tracker.h" #include "facetracknoir/options.h" @@ -36,7 +36,7 @@ struct settings value<int> clip_ty, clip_tz, clip_by, clip_bz; value<int> active_model_panel, cap_x, cap_y, cap_z; - + // XXX todo red channel only, good for crapola CCD sensors -sh 20140922 settings() : diff --git a/ftnoir_tracker_pt/point_extractor.h b/ftnoir_tracker_pt/point_extractor.h index 3ef82900..5252b68d 100644 --- a/ftnoir_tracker_pt/point_extractor.h +++ b/ftnoir_tracker_pt/point_extractor.h @@ -8,8 +8,8 @@ #ifndef POINTEXTRACTOR_H #define POINTEXTRACTOR_H -#include <opencv2/opencv.hpp> -#include <opencv2/imgproc/imgproc_c.h> +#include <opencv2/core/core.hpp> +#include <opencv2/imgproc/imgproc.hpp> // ---------------------------------------------------------------------------- // Extracts points from an opencv image diff --git a/ftnoir_tracker_pt/point_tracker.h b/ftnoir_tracker_pt/point_tracker.h index c8212538..d65494a4 100644 --- a/ftnoir_tracker_pt/point_tracker.h +++ b/ftnoir_tracker_pt/point_tracker.h @@ -8,7 +8,7 @@ #ifndef POINTTRACKER_H #define POINTTRACKER_H -#include <opencv2/opencv.hpp> +#include <opencv2/core/core.hpp> #ifndef OPENTRACK_API # include <boost/shared_ptr.hpp> #else @@ -21,31 +21,31 @@ class FrameTrafo { public: - FrameTrafo() : R(cv::Matx33f::eye()), t(0,0,0) {} - FrameTrafo(const cv::Matx33f& R, const cv::Vec3f& t) : R(R),t(t) {} + FrameTrafo() : R(cv::Matx33f::eye()), t(0,0,0) {} + FrameTrafo(const cv::Matx33f& R, const cv::Vec3f& t) : R(R),t(t) {} - cv::Matx33f R; - cv::Vec3f t; + cv::Matx33f R; + cv::Vec3f t; }; inline FrameTrafo operator*(const FrameTrafo& X, const FrameTrafo& Y) { - return FrameTrafo(X.R*Y.R, X.R*Y.t + X.t); + return FrameTrafo(X.R*Y.R, X.R*Y.t + X.t); } inline FrameTrafo operator*(const cv::Matx33f& X, const FrameTrafo& Y) { - return FrameTrafo(X*Y.R, X*Y.t); + return FrameTrafo(X*Y.R, X*Y.t); } inline FrameTrafo operator*(const FrameTrafo& X, const cv::Matx33f& Y) { - return FrameTrafo(X.R*Y, X.t); + return FrameTrafo(X.R*Y, X.t); } inline cv::Vec3f operator*(const FrameTrafo& X, const cv::Vec3f& v) { - return X.R*v + X.t; + return X.R*v + X.t; } @@ -55,28 +55,28 @@ inline cv::Vec3f operator*(const FrameTrafo& X, const cv::Vec3f& v) // [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"] class PointModel { - friend class PointTracker; + friend class PointTracker; public: - static constexpr int N_POINTS = 3; + static constexpr int N_POINTS = 3; - PointModel(cv::Vec3f M01, cv::Vec3f M02); + PointModel(cv::Vec3f M01, cv::Vec3f M02); PointModel(); - inline const cv::Vec3f& get_M01() const { return M01; } - inline const cv::Vec3f& get_M02() const { return M02; } + inline const cv::Vec3f& get_M01() const { return M01; } + inline const cv::Vec3f& get_M02() const { return M02; } private: - cv::Vec3f M01; // M01 in model frame - cv::Vec3f M02; // M02 in model frame + cv::Vec3f M01; // M01 in model frame + cv::Vec3f M02; // M02 in model frame - cv::Vec3f u; // unit vector perpendicular to M01,M02-plane + cv::Vec3f u; // unit vector perpendicular to M01,M02-plane - cv::Matx22f P; + cv::Matx22f P; - cv::Vec2f d; // determinant vector for point correspondence - int d_order[3]; // sorting of projected model points with respect to d scalar product + cv::Vec2f d; // determinant vector for point correspondence + int d_order[3]; // sorting of projected model points with respect to d scalar product - void get_d_order(const std::vector<cv::Vec2f>& points, int d_order[]) const; + void get_d_order(const std::vector<cv::Vec2f>& points, int d_order[]) const; }; // ---------------------------------------------------------------------------- @@ -86,29 +86,29 @@ private: class PointTracker { public: - PointTracker(); - // track the pose using the set of normalized point coordinates (x pos in range -0.5:0.5) - // f : (focal length)/(sensor width) - // dt : time since last call - void track(const std::vector<cv::Vec2f>& projected_points, const PointModel& model); - FrameTrafo get_pose() const { return X_CM; } - void reset(); + PointTracker(); + // track the pose using the set of normalized point coordinates (x pos in range -0.5:0.5) + // f : (focal length)/(sensor width) + // dt : time since last call + void track(const std::vector<cv::Vec2f>& projected_points, const PointModel& model); + FrameTrafo get_pose() const { return X_CM; } + void reset(); private: // the points in model order typedef struct { cv::Vec2f points[PointModel::N_POINTS]; } PointOrder; - static constexpr float focal_length = 1.0f; - - inline cv::Vec2f project(const cv::Vec3f& v_M) - { - cv::Vec3f v_C = X_CM * v_M; - return cv::Vec2f(focal_length*v_C[0]/v_C[2], focal_length*v_C[1]/v_C[2]); - } + static constexpr float focal_length = 1.0f; + + inline cv::Vec2f project(const cv::Vec3f& v_M) + { + cv::Vec3f v_C = X_CM * v_M; + return cv::Vec2f(focal_length*v_C[0]/v_C[2], focal_length*v_C[1]/v_C[2]); + } PointOrder find_correspondences(const std::vector<cv::Vec2f>& projected_points, const PointModel &model); int POSIT(const PointModel& point_model, const PointOrder& order); // The POSIT algorithm, returns the number of iterations - - FrameTrafo X_CM; // trafo from model to camera + + FrameTrafo X_CM; // trafo from model to camera }; #endif //POINTTRACKER_H diff --git a/ftnoir_tracker_pt/pt_video_widget.h b/ftnoir_tracker_pt/pt_video_widget.h index de2c7efb..f2b41d63 100644 --- a/ftnoir_tracker_pt/pt_video_widget.h +++ b/ftnoir_tracker_pt/pt_video_widget.h @@ -10,7 +10,7 @@ #include <QObject> #include <QTime> #include <QDialog> -#include <opencv2/opencv.hpp> +#include <opencv2/core/core.hpp> #ifndef OPENTRACK_API # include <QGLWidget> # include <boost/shared_ptr.hpp> diff --git a/ftnoir_tracker_pt/trans_calib.h b/ftnoir_tracker_pt/trans_calib.h index 5c321b2c..c2c02b38 100644 --- a/ftnoir_tracker_pt/trans_calib.h +++ b/ftnoir_tracker_pt/trans_calib.h @@ -8,7 +8,7 @@ #ifndef TRANSCALIB_H #define TRANSCALIB_H -#include <opencv2/opencv.hpp> +#include <opencv2/core/core.hpp> //----------------------------------------------------------------------------- // Calibrates the translation from head to model = t_MH -- cgit v1.2.3 From f4754d23984126de847279f4abad4ae713d9e386 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 5 Oct 2014 19:55:05 +0200 Subject: flush and push --- .../README-CREDIT.txt | 6 - .../ft_tester/Makefile.am | 54 --- .../ft_tester/Makefile.in | 491 -------------------- .../ft_tester/fttester.rc.in | 67 --- .../ft_tester/main.cpp | 211 --------- .../ft_tester/resource.h | 27 -- .../important-stuff/NPClient.h | 17 - .../important-stuff/NPClient.spec | 23 - .../important-stuff/NPClient_dll.h | 58 --- .../important-stuff/NPClient_main.c | 444 ------------------ .../important-stuff/game_data.c | 149 ------ .../important-stuff/game_data.h | 17 - .../tester/Makefile.am | 78 ---- .../tester/Makefile.in | 512 --------------------- .../tester/main.cpp | 100 ---- .../tester/npifc.c | 302 ------------ .../tester/npifc.h | 66 --- .../tester/npview.rc.in | 49 -- .../tester/resource.h | 23 - .../tester/rest.c | 1 - .../tester/rest.h | 1 - facetracknoir/clientfiles/make-csv.pl | 72 +++ .../very-important-source-code/README-CREDIT.txt | 6 + .../ft_tester/Makefile.am | 54 +++ .../ft_tester/Makefile.in | 491 ++++++++++++++++++++ .../ft_tester/fttester.rc.in | 67 +++ .../very-important-source-code/ft_tester/main.cpp | 211 +++++++++ .../ft_tester/resource.h | 27 ++ .../important-stuff/NPClient.h | 17 + .../important-stuff/NPClient.spec | 23 + .../important-stuff/NPClient_dll.h | 58 +++ .../important-stuff/NPClient_main.c | 444 ++++++++++++++++++ .../important-stuff/game_data.c | 150 ++++++ .../important-stuff/game_data.h | 17 + .../very-important-source-code/tester/Makefile.am | 78 ++++ .../very-important-source-code/tester/Makefile.in | 512 +++++++++++++++++++++ .../very-important-source-code/tester/main.cpp | 100 ++++ .../very-important-source-code/tester/npifc.c | 302 ++++++++++++ .../very-important-source-code/tester/npifc.h | 66 +++ .../very-important-source-code/tester/npview.rc.in | 49 ++ .../very-important-source-code/tester/resource.h | 23 + .../very-important-source-code/tester/rest.c | 1 + .../very-important-source-code/tester/rest.h | 1 + facetracknoir/plugin-qt-api.hpp | 1 - facetracknoir/pose.hpp | 66 +++ facetracknoir/quat.hpp | 26 +- facetracknoir/tracker.cpp | 40 +- facetracknoir/tracker.h | 9 +- facetracknoir/tracker_types.h | 66 --- freetrackclient/build-msvc.sh | 33 ++ freetrackclient/freetrackclient.c | 4 + ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 11 +- ftnoir_tracker_aruco/include/aruco.h | 29 +- ftnoir_tracker_aruco/include/arucofidmarkers.h | 15 +- ftnoir_tracker_aruco/include/board.h | 168 +++++++ ftnoir_tracker_aruco/include/boarddetector.h | 139 ++++++ ftnoir_tracker_aruco/include/cvdrawingutils.h | 21 +- ftnoir_tracker_aruco/include/exports.h | 4 +- ftnoir_tracker_aruco/include/markerdetector.h | 16 +- ftnoir_tracker_hydra/ftnoir_tracker_hydra.h | 19 +- ftnoir_tracker_rift/ftnoir_tracker_rift.h | 33 +- 61 files changed, 3289 insertions(+), 2876 deletions(-) delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/resource.h delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.h delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.spec delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_dll.h delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_main.c delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in delete mode 100644 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h delete mode 120000 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c delete mode 120000 facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h create mode 100755 facetracknoir/clientfiles/make-csv.pl create mode 100644 facetracknoir/clientfiles/very-important-source-code/README-CREDIT.txt create mode 100644 facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.am create mode 100644 facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.in create mode 100644 facetracknoir/clientfiles/very-important-source-code/ft_tester/fttester.rc.in create mode 100644 facetracknoir/clientfiles/very-important-source-code/ft_tester/main.cpp create mode 100644 facetracknoir/clientfiles/very-important-source-code/ft_tester/resource.h create mode 100644 facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.h create mode 100644 facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.spec create mode 100644 facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_dll.h create mode 100644 facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_main.c create mode 100644 facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.c create mode 100644 facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.h create mode 100644 facetracknoir/clientfiles/very-important-source-code/tester/Makefile.am create mode 100644 facetracknoir/clientfiles/very-important-source-code/tester/Makefile.in create mode 100644 facetracknoir/clientfiles/very-important-source-code/tester/main.cpp create mode 100644 facetracknoir/clientfiles/very-important-source-code/tester/npifc.c create mode 100644 facetracknoir/clientfiles/very-important-source-code/tester/npifc.h create mode 100644 facetracknoir/clientfiles/very-important-source-code/tester/npview.rc.in create mode 100644 facetracknoir/clientfiles/very-important-source-code/tester/resource.h create mode 120000 facetracknoir/clientfiles/very-important-source-code/tester/rest.c create mode 120000 facetracknoir/clientfiles/very-important-source-code/tester/rest.h create mode 100644 facetracknoir/pose.hpp delete mode 100644 facetracknoir/tracker_types.h create mode 100644 freetrackclient/build-msvc.sh create mode 100644 ftnoir_tracker_aruco/include/board.h create mode 100644 ftnoir_tracker_aruco/include/boarddetector.h diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt b/facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt deleted file mode 100644 index 82214139..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/README-CREDIT.txt +++ /dev/null @@ -1,6 +0,0 @@ -The contents of the directory written by one and only, uglyDwarf. - -Obtained at epoch time 1412397452 from the mithril-mine's shaft, where -the elite dwarves reside. - -For the latest happenings, visit <https://code.google.com/p/linux-track/> diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am deleted file mode 100644 index 02747edb..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -noinst_SCRIPTS = -if WINE_PLUGIN - noinst_SCRIPTS += ftc.exe.so -endif #WINE_PLUGIN - -if DARWIN - LDFLAGS += -Wl,-no_arch_warnings -else - LDFLAGS += -Wl,--no-warn-search-mismatch -endif - -CC = winegcc - -CXX = wineg++ - -SUFFIXES = .o .cpp .c .rc - -.cpp.o : - $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< - -.c.o : - $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< - -.rc.o : - wrc -o $@ $(RCFLAGS) $< - -CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ -CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ -RCFLAGS = -I @srcdir@ -#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ -vpath %.h @srcdir@/../.. -vpath %.h @top_builddir@ -vpath %.c @srcdir@ -vpath %.c @srcdir@/../.. - -ftc.exe.so : main.o fttester.o - wineg++ -g -o $@ -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ - -fttester.o : fttester.rc resource.h config.h - -main.o : main.cpp - -clean-local: clean-local-check -.PHONY: clean-local-check -clean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -distclean-local: distclean-local-check -.PHONY: distclean-local-check -distclean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -EXTRA_DIST = resource.h fttester.rc main.cpp - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in deleted file mode 100644 index d1fff34d..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/Makefile.in +++ /dev/null @@ -1,491 +0,0 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@WINE_PLUGIN_TRUE@am__append_1 = ftc.exe.so -@DARWIN_TRUE@am__append_2 = -Wl,-no_arch_warnings -@DARWIN_FALSE@am__append_3 = -Wl,--no-warn-search-mismatch -subdir = src/wine_bridge/ft_tester -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(srcdir)/fttester.rc.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = fttester.rc -CONFIG_CLEAN_VPATH_FILES = -SCRIPTS = $(noinst_SCRIPTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -depcomp = -am__depfiles_maybe = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BISON = @BISON@ -CC = winegcc -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = wineg++ -CXXCPP = @CXXCPP@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ $(am__append_2) $(am__append_3) -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIB32DIR = @LIB32DIR@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJC = @OBJC@ -OBJCFLAGS = @OBJCFLAGS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OPENCV_CFLAGS = @OPENCV_CFLAGS@ -OPENCV_LIBS = @OPENCV_LIBS@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -QMAKE_PATH = @QMAKE_PATH@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -WINE64_LIBS = @WINE64_LIBS@ -WINE_LIBS = @WINE_LIBS@ -XPL_CPPFLAGS = @XPL_CPPFLAGS@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -ac_ct_OBJC = @ac_ct_OBJC@ -am__leading_dot = @am__leading_dot@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -with_makensis = @with_makensis@ -with_wine64 = @with_wine64@ -noinst_SCRIPTS = $(am__append_1) -SUFFIXES = .o .cpp .c .rc -CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ -CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ -RCFLAGS = -I @srcdir@ -EXTRA_DIST = resource.h fttester.rc main.cpp -all: all-am - -.SUFFIXES: -.SUFFIXES: .o .cpp .c .rc -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/ft_tester/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/ft_tester/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -fttester.rc: $(top_builddir)/config.status $(srcdir)/fttester.rc.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(SCRIPTS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-local mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-local - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - clean-local cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distclean-local distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ - uninstall-am - - -.cpp.o : - $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< - -.c.o : - $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< - -.rc.o : - wrc -o $@ $(RCFLAGS) $< -#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ -vpath %.h @srcdir@/../.. -vpath %.h @top_builddir@ -vpath %.c @srcdir@ -vpath %.c @srcdir@/../.. - -ftc.exe.so : main.o fttester.o - wineg++ -g -o $@ -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ - -fttester.o : fttester.rc resource.h config.h - -main.o : main.cpp - -clean-local: clean-local-check -.PHONY: clean-local-check -clean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -distclean-local: distclean-local-check -.PHONY: distclean-local-check -distclean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in deleted file mode 100644 index 332f3c73..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/fttester.rc.in +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by ResEdit 1.5.9 -// Copyright (C) 2006-2011 -// http://www.resedit.net - -#include <windows.h> -#include <commctrl.h> -#include <richedit.h> -#include "resource.h" - -#ifdef HAVE_CONFIG_H - #include "../../../config.h" -#endif - - - - -// -// Dialog resources -// -//LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -IDD_DIALOG1 DIALOGEX 0, 0, 333, 183 -STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU -CAPTION "FreeTrack client test utility v@PACKAGE_VERSION@" -FONT 8, "Ms Shell Dlg", 400, 0, 1 -{ - DEFPUSHBUTTON "Quit", IDQUIT, 262, 153, 50, 14 - PUSHBUTTON "Start", IDC_START, 199, 153, 50, 14 - EDITTEXT IDC_YAW, 38, 15, 48, 14, ES_AUTOHSCROLL - RTEXT "Yaw", IDC_STATIC, 12, 17, 21, 14, SS_RIGHT - EDITTEXT IDC_PITCH, 38, 38, 48, 14, ES_AUTOHSCROLL - RTEXT "Pitch", IDC_STATIC, 16, 40, 17, 14, SS_RIGHT - EDITTEXT IDC_ROLL, 38, 61, 48, 14, ES_AUTOHSCROLL - RTEXT "Roll", IDC_STATIC, 20, 63, 13, 14, SS_RIGHT - EDITTEXT IDC_X, 38, 84, 48, 14, ES_AUTOHSCROLL - RTEXT "X", IDC_STATIC, 27, 86, 6, 14, SS_RIGHT - EDITTEXT IDC_Y, 38, 107, 48, 14, ES_AUTOHSCROLL - RTEXT "Y", IDC_STATIC, 27, 109, 6, 14, SS_RIGHT - EDITTEXT IDC_Z, 38, 130, 48, 14, ES_AUTOHSCROLL - RTEXT "Z", IDC_STATIC, 27, 132, 6, 14, SS_RIGHT - EDITTEXT IDC_RYAW, 137, 15, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw Yaw", IDC_STATIC, 101, 17, 32, 8, SS_RIGHT - EDITTEXT IDC_RPITCH, 137, 38, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw Pitch", IDC_STATIC, 99, 40, 34, 8, SS_RIGHT - EDITTEXT IDC_RROLL, 137, 61, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw Roll", IDC_STATIC, 103, 63, 30, 8, SS_RIGHT - EDITTEXT IDC_RX, 137, 84, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw X", IDC_STATIC, 111, 86, 22, 8, SS_RIGHT - EDITTEXT IDC_RY, 137, 107, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw Y", IDC_STATIC, 111, 109, 22, 8, SS_RIGHT - EDITTEXT IDC_RZ, 137, 130, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw Z", IDC_STATIC, 111, 132, 22, 8, SS_RIGHT - EDITTEXT IDC_NUM, 264, 15, 48, 14, ES_AUTOHSCROLL - RTEXT "Frame Number", IDC_STATIC, 212, 17, 47, 8, SS_RIGHT - EDITTEXT IDC_RES, 264, 38, 48, 14, ES_AUTOHSCROLL - RTEXT "Camera Resolution", IDC_STATIC, 199, 40, 60, 8, SS_RIGHT - EDITTEXT IDC_PT0, 227, 61, 85, 14, ES_AUTOHSCROLL - RTEXT "Point 1", IDC_STATIC, 199, 63, 23, 8, SS_RIGHT - EDITTEXT IDC_PT1, 227, 84, 85, 14, ES_AUTOHSCROLL - RTEXT "Point 2", IDC_STATIC, 199, 86, 23, 8, SS_RIGHT - EDITTEXT IDC_PT2, 227, 107, 85, 14, ES_AUTOHSCROLL - RTEXT "Point 3", IDC_STATIC, 199, 109, 23, 8, SS_RIGHT - EDITTEXT IDC_PT3, 227, 130, 85, 14, ES_AUTOHSCROLL - RTEXT "Point 4", IDC_STATIC, 199, 132, 23, 8, SS_RIGHT - EDITTEXT IDC_TITLE, 38, 153, 147, 14, ES_AUTOHSCROLL - RTEXT "Title", IDC_STATIC, 19, 155, 14, 8, SS_RIGHT -} - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp deleted file mode 100644 index a737f88f..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/main.cpp +++ /dev/null @@ -1,211 +0,0 @@ -#define WIN32_LEAN_AND_MEAN - -#include <windows.h> -#include <cstdio> -#include <stdint.h> -#include <sstream> -#include <cstdlib> -#include <iomanip> - -#include "resource.h" - -HINSTANCE hInst; -UINT_PTR timer = 0; - -HMODULE ftclient; - -typedef struct -{ - unsigned int dataID; - int res_x; int res_y; - float yaw; // positive yaw to the left - float pitch;// positive pitch up - float roll;// positive roll to the left - float x; - float y; - float z; - // raw pose with no smoothing, sensitivity, response curve etc. - float ryaw; - float rpitch; - float rroll; - float rx; - float ry; - float rz; - // raw points, sorted by Y, origin top left corner - float x0, y0; - float x1, y1; - float x2, y2; - float x3, y3; -}FreeTrackData; - - -typedef bool (WINAPI *importGetData)(FreeTrackData * data); -typedef char *(WINAPI *importGetDllVersion)(void); -typedef void (WINAPI *importReportName)(char *name); -typedef char *(WINAPI *importProvider)(void); - -importGetData getData; -importGetDllVersion getDllVersion; -importReportName reportName; -importProvider provider; - - -char *client_path() -{ - HKEY hkey = 0; - RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Freetrack\\FreetrackClient", 0, - KEY_QUERY_VALUE, &hkey); - if(!hkey){ - printf("Can't open registry key\n"); - return NULL; - } - - BYTE path[1024]; - DWORD buf_len = 1024; - LONG result = RegQueryValueEx(hkey, "Path", NULL, NULL, path, &buf_len); - char *full_path = (char *)malloc(2048); - if(result == ERROR_SUCCESS && buf_len > 0){ - sprintf(full_path, "%s\\FreeTrackClient.dll", path); - } - RegCloseKey(hkey); - return full_path; -} - - -bool start(HWND hwnd) -{ - char *libname = client_path(); - if(libname == NULL){ - printf("Freetrack client not found!\n"); - return false; - } - ftclient = LoadLibrary(libname); - if(ftclient == NULL){ - printf("Couldn't load Freetrack client library '%s'!\n", libname); - return false; - } - printf("Freetrack client library %s loaded.\n", client_path()); - - - getData = (importGetData)GetProcAddress(ftclient, "FTGetData"); - getDllVersion = (importGetDllVersion)GetProcAddress(ftclient, "FTGetDllVersion"); - reportName = (importReportName)GetProcAddress(ftclient, "FTReportName"); - provider = (importProvider)GetProcAddress(ftclient, "FTProvider"); - - if((getData == NULL) || (getDllVersion == NULL) || (reportName == NULL) || (provider == NULL)){ - printf("Couldn't load Freetrack client functions!\n"); - FreeLibrary(ftclient); - return false; - } - - printf("Dll version: %s\n", getDllVersion()); - printf("Provider: %s\n", provider()); - char title[1024]; - GetDlgItemText(hwnd, IDC_TITLE, title, 1020); - reportName(title); - return true; -} - -void reportError(std::string msg) -{ - MessageBoxA(0, "FreeTrack client test", msg.c_str(), 0); -} -VOID CALLBACK TimerProcedure(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) -{ - (void) uMsg; - (void) idEvent; - (void) dwTime; - FreeTrackData d; - getData(&d); - SetDlgItemInt(hwnd, IDC_PITCH, d.pitch, true); - SetDlgItemInt(hwnd, IDC_ROLL, d.roll, true); - SetDlgItemInt(hwnd, IDC_YAW, d.yaw, true); - - SetDlgItemInt(hwnd, IDC_X, d.x, true); - SetDlgItemInt(hwnd, IDC_Y, d.y, true); - SetDlgItemInt(hwnd, IDC_Z, d.z, true); - - SetDlgItemInt(hwnd, IDC_RPITCH, d.rpitch, true); - SetDlgItemInt(hwnd, IDC_RROLL, d.rroll, true); - SetDlgItemInt(hwnd, IDC_RYAW, d.ryaw, true); - - SetDlgItemInt(hwnd, IDC_RX, d.rx, true); - SetDlgItemInt(hwnd, IDC_RY, d.ry, true); - SetDlgItemInt(hwnd, IDC_RZ, d.rz, true); - - std::ostringstream s; - s.str(std::string()); - s<<"("<<std::fixed<<std::setprecision(1)<<d.x0<<"; "<<d.y0<<")"; - SetDlgItemText(hwnd, IDC_PT0, s.str().c_str()); - - s.str(std::string()); - s<<"("<<std::fixed<<std::setprecision(1)<<d.x1<<"; "<<d.y1<<")"; - SetDlgItemText(hwnd, IDC_PT1, s.str().c_str()); - - s.str(std::string()); - s<<"("<<std::fixed<<std::setprecision(1)<<d.x2<<"; "<<d.y2<<")"; - SetDlgItemText(hwnd, IDC_PT2, s.str().c_str()); - - s.str(std::string()); - s<<"("<<std::fixed<<std::setprecision(1)<<d.x3<<"; "<<d.y3<<")"; - SetDlgItemText(hwnd, IDC_PT3, s.str().c_str()); - - s.str(std::string()); - s<<d.res_x<<"x"<<d.res_y; - SetDlgItemText(hwnd, IDC_RES, s.str().c_str()); - SetDlgItemInt(hwnd, IDC_NUM, d.dataID, true); -} - -BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - (void) lParam; - switch(uMsg) - { - case WM_INITDIALOG: - SetDlgItemText(hwndDlg, IDC_TITLE, "Default"); - return TRUE; - - case WM_CLOSE: - EndDialog(hwndDlg, 0); - return TRUE; - - case WM_COMMAND: - switch(LOWORD(wParam)) - { - /* - * TODO: Add more control ID's, when needed. - */ - case IDQUIT: - FreeLibrary(ftclient); - EndDialog(hwndDlg, 0); - return TRUE; - case IDC_START: - start(hwndDlg); -//l int ok; -// int num = GetDlgItemInt(hwndDlg, IDC_APPID, (BOOL*)&ok, false); - if(timer != 0){ - KillTimer(hwndDlg, timer); - timer = 0; - } - timer = SetTimer(hwndDlg, 0, 50, TimerProcedure); - break; - - } - } - - return FALSE; -} - - -int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) -{ - (void) hPrevInstance; - (void) lpCmdLine; - (void) nShowCmd; - hInst = hInstance; - - // The user interface is a modal dialog box - return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DialogProc); -} - - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/resource.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/resource.h deleted file mode 100644 index 8bba17b4..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/ft_tester/resource.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef IDC_STATIC -#define IDC_STATIC (-1) -#endif - -#define IDD_DIALOG1 100 -#define IDQUIT 1002 -#define IDC_YAW 1005 -#define IDC_PITCH 1023 -#define IDC_ROLL 1024 -#define IDC_X 1025 -#define IDC_Y 1026 -#define IDC_Z 1027 -#define IDC_RYAW 1028 -#define IDC_RPITCH 1029 -#define IDC_RROLL 1030 -#define IDC_RX 1031 -#define IDC_RY 1032 -#define IDC_RZ 1033 -#define IDC_NUM 1034 -#define IDC_RES 1035 -#define IDC_PT0 1036 -#define IDC_PT1 1037 -#define IDC_PT2 1038 -#define IDC_PT3 1039 -#define IDC_START 1040 -#define IDC_TITLE 1041 - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.h deleted file mode 100644 index 770e1c71..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.h +++ /dev/null @@ -1,17 +0,0 @@ - -extern int NP_RegisterWindowHandle (HWND hwnd); -extern int NP_UnregisterWindowHandle (void); -extern int NP_RegisterProgramProfileID (unsigned short id); -extern int NP_QueryVersion (unsigned short *version); -extern int NP_RequestData (unsigned short req); -extern int NP_GetSignature (tir_signature_t *sig); -extern int NP_GetData (tir_data_t *data); -extern int NP_GetParameter (void); -extern int NP_SetParameter (void); -extern int NP_StartCursor (void); -extern int NP_StopCursor (void); -extern int NP_ReCenter (void); -extern int NP_StartDataTransmission (void); -extern int NP_StopDataTransmission (void); - - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.spec b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.spec deleted file mode 100644 index 7fe5f1b4..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient.spec +++ /dev/null @@ -1,23 +0,0 @@ -# Generated from NPClient.dll by winedump - -1 stub NPPriv_ClientNotify -2 stub NPPriv_GetLastError -3 stub NPPriv_SetData -4 stub NPPriv_SetLastError -5 stub NPPriv_SetParameter -6 stub NPPriv_SetSignature -7 stub NPPriv_SetVersion -8 stdcall NP_GetData( ptr ) NPCLIENT_NP_GetData -9 stdcall NP_GetParameter( long long) NPCLIENT_NP_GetParameter -10 stdcall NP_GetSignature( ptr ) NPCLIENT_NP_GetSignature -11 stdcall NP_QueryVersion( ptr ) NPCLIENT_NP_QueryVersion -12 stdcall NP_ReCenter() NPCLIENT_NP_ReCenter -13 stdcall NP_RegisterProgramProfileID( long ) NPCLIENT_NP_RegisterProgramProfileID -14 stdcall NP_RegisterWindowHandle( ptr ) NPCLIENT_NP_RegisterWindowHandle -15 stdcall NP_RequestData( long ) NPCLIENT_NP_RequestData -16 stdcall NP_SetParameter( long long ) NPCLIENT_NP_SetParameter -17 stdcall NP_StartCursor() NPCLIENT_NP_StartCursor -18 stdcall NP_StartDataTransmission() NPCLIENT_NP_StartDataTransmission -19 stdcall NP_StopCursor() NPCLIENT_NP_StopCursor -20 stdcall NP_StopDataTransmission() NPCLIENT_NP_StopDataTransmission -21 stdcall NP_UnregisterWindowHandle() NPCLIENT_NP_UnregisterWindowHandle diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_dll.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_dll.h deleted file mode 100644 index b0bab5db..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_dll.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * NPClient.dll - * - * Generated from NPClient.dll by winedump. - * - * DO NOT SEND GENERATED DLLS FOR INCLUSION INTO WINE ! - * - */ -#ifndef __WINE_NPCLIENT_DLL_H -#define __WINE_NPCLIENT_DLL_H - -#include "windef.h" -#include "wine/debug.h" -#include "winbase.h" -#include "winnt.h" - -#pragma pack(1) -typedef struct tir_data{ - short status; - short frame; - unsigned int cksum; - float roll, pitch, yaw; - float tx, ty, tz; - float padding[9]; -} tir_data_t; - -typedef struct tir_signature{ - char DllSignature[200]; - char AppSignature[200]; -} tir_signature_t; -#pragma pack(0) - - -/* __stdcall NPCLIENT_NPPriv_ClientNotify(); */ -/* __stdcall NPCLIENT_NPPriv_GetLastError(); */ -/* __stdcall NPCLIENT_NPPriv_SetData(); */ -/* __stdcall NPCLIENT_NPPriv_SetLastError(); */ -/* __stdcall NPCLIENT_NPPriv_SetParameter(); */ -/* __stdcall NPCLIENT_NPPriv_SetSignature(); */ -/* __stdcall NPCLIENT_NPPriv_SetVersion(); */ -int __stdcall NPCLIENT_NP_GetData(tir_data_t * data); -int __stdcall NPCLIENT_NP_GetParameter(int arg0, int arg1); -int __stdcall NPCLIENT_NP_GetSignature(tir_signature_t * sig); -int __stdcall NPCLIENT_NP_QueryVersion(unsigned short * version); -int __stdcall NPCLIENT_NP_ReCenter(void); -int __stdcall NPCLIENT_NP_RegisterProgramProfileID(unsigned short id); -int __stdcall NPCLIENT_NP_RegisterWindowHandle(HWND hwnd); -int __stdcall NPCLIENT_NP_RequestData(unsigned short req); -int __stdcall NPCLIENT_NP_SetParameter(int arg0, int arg1); -int __stdcall NPCLIENT_NP_StartCursor(void); -int __stdcall NPCLIENT_NP_StartDataTransmission(void); -int __stdcall NPCLIENT_NP_StopCursor(void); -int __stdcall NPCLIENT_NP_StopDataTransmission(void); -int __stdcall NPCLIENT_NP_UnregisterWindowHandle(void); - - - -#endif /* __WINE_NPCLIENT_DLL_H */ diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_main.c b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_main.c deleted file mode 100644 index f892f89e..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/NPClient_main.c +++ /dev/null @@ -1,444 +0,0 @@ -/* - * NPClient.dll - * - * Generated from NPClient.dll by winedump. - * - * DO NOT SUBMIT GENERATED DLLS FOR INCLUSION INTO WINE! - * - */ - -#include <linuxtrack.h> -#include "rest.h" -//#include "config.h" -#define __WINESRC__ - -#include <stdarg.h> -#include <string.h> -#include <stdbool.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include "windef.h" -#include "winbase.h" -#include "NPClient_dll.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(NPClient); - -bool crypted = false; -static unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static int dbg_flag; - -static void dbg_report(const char *msg,...) -{ - static FILE *f = NULL; - if(dbg_flag){ - if(f == NULL){ - f = fopen("NPClient.log", "w"); - } - va_list ap; - va_start(ap,msg); - vfprintf(f, msg, ap); - fflush(f); - va_end(ap); - } -} - - -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); - - switch (fdwReason) - { - case DLL_WINE_PREATTACH: - return TRUE; - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(hinstDLL); - dbg_flag = getDebugFlag('w'); - dbg_report("Attach request\n"); - break; - case DLL_PROCESS_DETACH: - linuxtrack_shutdown(); - break; - } - - return TRUE; -} -/****************************************************************** - * NPPriv_ClientNotify (NPCLIENT.1) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_ClientNotify() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_GetLastError (NPCLIENT.2) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_GetLastError() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_SetData (NPCLIENT.3) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_SetData() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_SetLastError (NPCLIENT.4) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_SetLastError() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_SetParameter (NPCLIENT.5) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_SetParameter() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_SetSignature (NPCLIENT.6) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_SetSignature() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_SetVersion (NPCLIENT.7) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_SetVersion() -{ - /* @stub in .spec */ -} -#endif - -static float limit_num(float min, float val, float max) -{ - if(val < min) return min; - if(val > max) return max; - return val; -} - -static unsigned int cksum(unsigned char buf[], unsigned int size) -{ - if((size == 0) || (buf == NULL)){ - return 0; - } - - int rounds = size >> 2; - int rem = size % 4; - - int c = size; - int a0, a2; -// printf("Orig: "); -//for(a0 = 0; a0 < (int)size; ++a0) -//{ -// printf("%02X", buf[a0]); -//} -//printf("\n"); - while(rounds != 0){ - a0 = *(short int*)buf; - a2 = *(short int*)(buf+2); - buf += 4; - c += a0; - a2 ^= (c << 5); - a2 <<= 11; - c ^= a2; - c += (c >> 11); - --rounds; - } - switch(rem){ - case 3: - a0 = *(short int*)buf; - a2 = *(signed char*)(buf+2); - c += a0; - a2 = (a2 << 2) ^ c; - c ^= (a2 << 16); - a2 = (c >> 11); - break; - case 2: - a2 = *(short int*)buf; - c += a2; - c ^= (c << 11); - a2 = (c >> 17); - break; - case 1: - a2 = *(signed char*)(buf); - c += a2; - c ^= (c << 10); - a2 = (c >> 1); - break; - default: - break; - } - if(rem != 0){ - c+=a2; - } - - c ^= (c << 3); - c += (c >> 5); - c ^= (c << 4); - c += (c >> 17); - c ^= (c << 25); - c += (c >> 6); - - return (unsigned int)c; -} - -static void enhance(unsigned char buf[], unsigned int size, - unsigned char codetable[], unsigned int table_size) -{ - unsigned int table_ptr = 0; - unsigned char var = 0x88; - unsigned char tmp; - if((size <= 0) || (table_size <= 0) || - (buf == NULL) || (codetable == NULL)){ - return; - } - do{ - tmp = buf[--size]; - buf[size] = tmp ^ codetable[table_ptr] ^ var; - var += size + tmp; - ++table_ptr; - if(table_ptr >= table_size){ - table_ptr -= table_size; - } - }while(size != 0); -} - - -/****************************************************************** - * NP_GetData (NPCLIENT.8) - * - * - */ -int __stdcall NPCLIENT_NP_GetData(tir_data_t * data) -{ - float r, p, y, tx, ty, tz; - unsigned int frame; - int res = linuxtrack_get_pose(&y, &p, &r, &tx, &ty, &tz, &frame); - memset((char *)data, 0, sizeof(tir_data_t)); - data->status = (linuxtrack_get_tracking_state() == RUNNING) ? 0 : 1; - data->frame = frame & 0xFFFF; - data->cksum = 0; - data->roll = r / 180.0 * 16383; - data->pitch = -p / 180.0 * 16383; - data->yaw = y / 180.0 * 16383; - data->tx = -limit_num(-16383.0, 15 * tx, 16383); - data->ty = limit_num(-16383.0, 15 * ty, 16383); - data->tz = limit_num(-16383.0, 15 * tz, 16383); - data->cksum = cksum((unsigned char*)data, sizeof(tir_data_t)); - //printf("Cksum: %04X\n", data->cksum); - if(crypted){ - enhance((unsigned char*)data, sizeof(tir_data_t), table, sizeof(table)); - } - return (res >= 0) ? 0: 1; -} -/****************************************************************** - * NP_GetParameter (NPCLIENT.9) - * - * - */ -int __stdcall NPCLIENT_NP_GetParameter(int arg0, int arg1) -{ - dbg_report("GetParameter request: %d %d\n", arg0, arg1); - TRACE("(void): stub\n"); - return (int) 0; -} - -/****************************************************************** - * NP_GetSignature (NPCLIENT.10) - * - * - */ -int __stdcall NPCLIENT_NP_GetSignature(tir_signature_t * sig) -{ - dbg_report("GetSignature request\n"); - if(getSomeSeriousPoetry(sig->DllSignature, sig->AppSignature)){ - printf("Signature result: OK\n"); - return 0; - }else{ - printf("Signature result: NOT OK!\n"); - return 1; - } -} -/****************************************************************** - * NP_QueryVersion (NPCLIENT.11) - * - * - */ -int __stdcall NPCLIENT_NP_QueryVersion(unsigned short * version) -{ - dbg_report("QueryVersion request\n"); - *version=0x0500; - return 0; -} -/****************************************************************** - * NP_ReCenter (NPCLIENT.12) - * - * - */ -int __stdcall NPCLIENT_NP_ReCenter(void) -{ - dbg_report("ReCenter request\n"); - linuxtrack_recenter(); - return 0; -} - -/****************************************************************** - * NP_RegisterProgramProfileID (NPCLIENT.13) - * - * - */ -int __stdcall NPCLIENT_NP_RegisterProgramProfileID(unsigned short id) -{ - dbg_report("RegisterProgramProfileID request: %d\n", id); - game_desc_t gd; - if(game_data_get_desc(id, &gd)){ - printf("Application ID: %d - %s!!!\n", id, gd.name); - if(game_data_get_desc(id, &gd)){ - crypted = gd.encrypted; - if(gd.encrypted){ - printf("Table: %02X %02X %02X %02X %02X %02X %02X %02X\n", table[0],table[1],table[2],table[3],table[4], - table[5], table[6], table[7]); - table[0] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[1] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[2] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[3] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[4] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[5] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[6] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[7] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - } - } - if(linuxtrack_init(gd.name) != 0){ - return 1; - } - }else{ - if(!linuxtrack_init("Default")){ - return 1; - } - } - linuxtrack_suspend(); - return 0; -} -/****************************************************************** - * NP_RegisterWindowHandle (NPCLIENT.14) - * - * - */ -int __stdcall NPCLIENT_NP_RegisterWindowHandle(HWND hwnd) -{ - dbg_report("RegisterWindowHandle request: 0x%X\n", hwnd); - TRACE("((HWND)%p): stub\n",hwnd); - return (int) 0; -} -/****************************************************************** - * NP_RequestData (NPCLIENT.15) - * - * - */ -int __stdcall NPCLIENT_NP_RequestData(unsigned short req) -{ - dbg_report("RequestData request: %d\n", req); - TRACE("((unsigned short)%d): stub\n",req); - return (int) 0; -} -/****************************************************************** - * NP_SetParameter (NPCLIENT.16) - * - * - */ -int __stdcall NPCLIENT_NP_SetParameter(int arg0, int arg1) -{ - dbg_report("SetParameter request: %d %d\n", arg0, arg1); - TRACE("(void): stub\n"); - return (int) 0; -} -/****************************************************************** - * NP_StartCursor (NPCLIENT.17) - * - * - */ -int __stdcall NPCLIENT_NP_StartCursor(void) -{ - dbg_report("StartCursor request\n"); - TRACE("(void): stub\n"); - return (int) 0; -} -/****************************************************************** - * NP_StartDataTransmission (NPCLIENT.18) - * - * - */ -int __stdcall NPCLIENT_NP_StartDataTransmission(void) -{ - dbg_report("StartDataTransmission request\n"); - linuxtrack_wakeup(); - return 0; -} -/****************************************************************** - * NP_StopCursor (NPCLIENT.19) - * - * - */ -int __stdcall NPCLIENT_NP_StopCursor(void) -{ - dbg_report("StopCursor request\n"); - TRACE("(void): stub\n"); - return (int) 0; -} -/****************************************************************** - * NP_StopDataTransmission (NPCLIENT.20) - * - * - */ -int __stdcall NPCLIENT_NP_StopDataTransmission(void) -{ - dbg_report("StopDataTransmission request\n"); - linuxtrack_suspend(); - return 0; -} -/****************************************************************** - * NP_UnregisterWindowHandle (NPCLIENT.21) - * - * - */ -int __stdcall NPCLIENT_NP_UnregisterWindowHandle(void) -{ - dbg_report("UnregisterWindowHandle request\n"); - TRACE("(void): stub\n"); - return (int) 0; -} - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c deleted file mode 100644 index 3197ba37..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.c +++ /dev/null @@ -1,149 +0,0 @@ -#define _GNU_SOURCE -#include <stdio.h> -#include <stdlib.h> -#include <mxml.h> -#include <stdbool.h> -#include <stdint.h> -#include <sys/stat.h> -#include <string.h> -#include <utils.h> - - -//First 5 bytes is MD5 hash of "NaturalPoint" -static uint8_t secret_key[] = {0x0e, 0x9a, 0x63, 0x71, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static uint8_t S[256] = {0}; - -static char *decoded = NULL; - -static mxml_node_t *xml = NULL; -static mxml_node_t *tree = NULL; - -static void ksa(uint8_t key[], size_t len) -{ - unsigned int i, j; - for(i = 0; i < 256; ++i){ - S[i] = i; - } - j = 0; - for(i = 0; i < 256; ++i){ - j = (j + S[i] + key[i % len]) % 256; - uint8_t tmp = S[i]; - S[i] = S[j]; - S[j] = tmp; - } -} - -static uint8_t rc4() -{ - static uint8_t i = 0; - static uint8_t j = 0; - - i += 1; - j += S[i]; - uint8_t tmp = S[i]; - S[i] = S[j]; - S[j] = tmp; - return S[(S[i] + S[j]) % 256]; -} - -static bool decrypt_file(const char *fname, bool from_update) -{ - uint32_t header[5]; - size_t datlen; - ksa(secret_key, 16); - FILE *inp; - struct stat fst; - - if((inp = fopen(fname, "rb")) == NULL){ - printf("Can't open input file '%s'", fname); - return false; - } - - if(fstat(fileno(inp), &fst) != 0){ - fclose(inp); - printf("Cannot stat file '%s'\n", fname); - return false; - } - - if(from_update){ - if(fread(&header, sizeof(uint32_t), 5, inp) != 5){ - fclose(inp); - printf("Can't read the header - file '%s' is less than 20 bytes long?\n", fname); - return false; - } - datlen = header[4]; - }else{ - datlen = fst.st_size; - } - if((decoded = (char *)malloc(datlen+1)) == NULL){ - printf("malloc failed!\n"); - return false; - } - memset(decoded, 0, datlen+1); - size_t i; - size_t len = fread(decoded, 1, datlen, inp); - (void) len; - for(i = 0; i < datlen; ++i) decoded[i] ^= rc4(); - fclose(inp); - - //inp = fopen("tmp.dump", "w"); - //fwrite(decoded, 1, datlen, inp); - //fclose(inp); - - return true; -} - -static bool game_data_init(const char *fname, bool from_update) -{ - static bool initialized = false; - if(initialized){ - return true; - } - if(!decrypt_file(fname, from_update)){ - printf("Error decrypting file!\n"); - return false; - } - xml = mxmlNewXML("1.0"); - tree = mxmlLoadString(xml, decoded, MXML_TEXT_CALLBACK); - return (tree != NULL); -} - -static void game_data_close() -{ - mxmlDelete(tree); - free(decoded); -} - -bool get_game_data(const char *input_fname, const char *output_fname, bool from_update) -{ - FILE *outfile = NULL; - if((outfile = fopen(output_fname, "w")) == NULL){ - ltr_int_log_message("Can't open the output file '%s'!\n", output_fname); - return false; - } - if(!game_data_init(input_fname, from_update)){ - ltr_int_log_message("Can't process the data file '%s'!\n", input_fname); - return false; - } - - mxml_node_t *game; - const char *name; - const char *id; - for(game = mxmlFindElement(tree, tree, "Game", NULL, NULL, MXML_DESCEND); - game != NULL; - game = mxmlFindElement(game, tree, "Game", NULL, NULL, MXML_DESCEND)){ - name = mxmlElementGetAttr(game, "Name"); - id = mxmlElementGetAttr(game, "Id"); - - mxml_node_t *appid = mxmlFindElement(game, game, "ApplicationID", NULL, NULL, MXML_DESCEND); - if(appid == NULL){ - fprintf(outfile, "%s \"%s\"\n", id, name); - }else{ - fprintf(outfile, "%s \"%s\" (%s)\n", id, name, appid->child->value.text.string); - } - } - fclose(outfile); - game_data_close(); - return true; -} - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h deleted file mode 100644 index b71f7a15..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/important-stuff/game_data.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef GAME_DATA__H -#define GAME_DATA__H - -#include <stdbool.h> - -#ifdef __cplusplus -extern "C" { -#endif - -bool get_game_data(const char *input_fname, const char *output_fname, bool from_update); - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am deleted file mode 100644 index e025209a..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.am +++ /dev/null @@ -1,78 +0,0 @@ -noinst_SCRIPTS = -if WINE_PLUGIN - noinst_SCRIPTS += Tester.exe -if WINE64 - noinst_SCRIPTS += Tester64.exe -endif #WINE64 -endif #WINE_PLUGIN - -if DARWIN - LDFLAGS += -Wl,-no_arch_warnings -else - LDFLAGS += -Wl,--no-warn-search-mismatch -endif - -CC = winegcc - -CXX = wineg++ - -SUFFIXES = .o .cpp .c .rc 64.o - -.cpp.o : - $(CXX) -c $(CXXFLAGS) -m32 -o $@ $< - -.c.o : - $(CC) -c $(CFLAGS) -m32 -o $@ $< - -.cpp64.o : - $(CXX) -c $(CXXFLAGS) -o $@ $< - -.c64.o : - $(CC) -c $(CFLAGS) -o $@ $< - -.rc.o : - wrc -o $@ $(RCFLAGS) $< - -CXXFLAGS += -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ -CFLAGS += -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ -RCFLAGS = -I @srcdir@ -#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ -vpath %.h @srcdir@/../.. -vpath %.h @top_builddir@ -vpath %.c @srcdir@ -vpath %.c @srcdir@/../.. - - -Tester64.exe : main64.o rest64.o npifc64.o npview.o - wineg++ -g -o Tester64 -L. $(WINE64_LIBS) $(LDFLAGS) -Wall -Wextra $^ - -Tester.exe : main.o npview.o rest.o npifc.o - wineg++ -g -o Tester -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ - -main.o : main.cpp Makefile - -main64.o : main.cpp Makefile - -npview.o : npview.rc - -rest.o : rest.c rest.h Makefile - -rest64.o : rest.c rest.h Makefile - -npifc.o : npifc.c npifc.h Makefile - -npifc64.o : CFLAGS+="-DFOR_WIN64=1" -npifc64.o : npifc.c npifc.h Makefile - -clean-local: clean-local-check -.PHONY: clean-local-check -clean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -distclean-local: distclean-local-check -.PHONY: distclean-local-check -distclean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -EXTRA_DIST = main.cpp npifc.c npifc.h resource.h rest.c rest.h - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in deleted file mode 100644 index cc49d754..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/Makefile.in +++ /dev/null @@ -1,512 +0,0 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@WINE_PLUGIN_TRUE@am__append_1 = Tester.exe -@WINE64_TRUE@@WINE_PLUGIN_TRUE@am__append_2 = Tester64.exe -@DARWIN_TRUE@am__append_3 = -Wl,-no_arch_warnings -@DARWIN_FALSE@am__append_4 = -Wl,--no-warn-search-mismatch -subdir = src/wine_bridge/tester -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(srcdir)/npview.rc.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = npview.rc -CONFIG_CLEAN_VPATH_FILES = -SCRIPTS = $(noinst_SCRIPTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -depcomp = -am__depfiles_maybe = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BISON = @BISON@ -CC = winegcc -CFLAGS = @CFLAGS@ -g -I../.. -I../../.. -DHAVE_CONFIG_H \ - -I@srcdir@/../.. -I@top_builddir@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = wineg++ -CXXCPP = @CXXCPP@ -CXXFLAGS = @CXXFLAGS@ -g -DHAVE_CONFIG_H -I../../.. -I. \ - -I@srcdir@/../.. -I@top_builddir@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ $(am__append_3) $(am__append_4) -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIB32DIR = @LIB32DIR@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJC = @OBJC@ -OBJCFLAGS = @OBJCFLAGS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OPENCV_CFLAGS = @OPENCV_CFLAGS@ -OPENCV_LIBS = @OPENCV_LIBS@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -QMAKE_PATH = @QMAKE_PATH@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -WINE64_LIBS = @WINE64_LIBS@ -WINE_LIBS = @WINE_LIBS@ -XPL_CPPFLAGS = @XPL_CPPFLAGS@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -ac_ct_OBJC = @ac_ct_OBJC@ -am__leading_dot = @am__leading_dot@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -with_makensis = @with_makensis@ -with_wine64 = @with_wine64@ -noinst_SCRIPTS = $(am__append_1) $(am__append_2) -SUFFIXES = .o .cpp .c .rc 64.o -RCFLAGS = -I @srcdir@ -EXTRA_DIST = main.cpp npifc.c npifc.h resource.h rest.c rest.h -all: all-am - -.SUFFIXES: -.SUFFIXES: .o .cpp .c .rc 64.o -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/tester/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/tester/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -npview.rc: $(top_builddir)/config.status $(srcdir)/npview.rc.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(SCRIPTS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-local mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-local - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - clean-local cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distclean-local distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ - uninstall-am - - -.cpp.o : - $(CXX) -c $(CXXFLAGS) -m32 -o $@ $< - -.c.o : - $(CC) -c $(CFLAGS) -m32 -o $@ $< - -.cpp64.o : - $(CXX) -c $(CXXFLAGS) -o $@ $< - -.c64.o : - $(CC) -c $(CFLAGS) -o $@ $< - -.rc.o : - wrc -o $@ $(RCFLAGS) $< -#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ -vpath %.h @srcdir@/../.. -vpath %.h @top_builddir@ -vpath %.c @srcdir@ -vpath %.c @srcdir@/../.. - -Tester64.exe : main64.o rest64.o npifc64.o npview.o - wineg++ -g -o Tester64 -L. $(WINE64_LIBS) $(LDFLAGS) -Wall -Wextra $^ - -Tester.exe : main.o npview.o rest.o npifc.o - wineg++ -g -o Tester -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ - -main.o : main.cpp Makefile - -main64.o : main.cpp Makefile - -npview.o : npview.rc - -rest.o : rest.c rest.h Makefile - -rest64.o : rest.c rest.h Makefile - -npifc.o : npifc.c npifc.h Makefile - -npifc64.o : CFLAGS+="-DFOR_WIN64=1" -npifc64.o : npifc.c npifc.h Makefile - -clean-local: clean-local-check -.PHONY: clean-local-check -clean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -distclean-local: distclean-local-check -.PHONY: distclean-local-check -distclean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp deleted file mode 100644 index 95ca0d9b..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/main.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#define WIN32_LEAN_AND_MEAN - -#include <windows.h> -#include <stdio.h> -#include <stdint.h> -#include "resource.h" -#include "rest.h" -#include "npifc.h" - -HINSTANCE hInst; -UINT_PTR timer = 0; - -VOID CALLBACK TimerProcedure(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) -{ - (void) uMsg; - (void) idEvent; - (void) dwTime; - tir_data_t td; - npifc_getdata(&td); - SetDlgItemInt(hwnd, IDC_PITCH, td.pitch, true); - SetDlgItemInt(hwnd, IDC_ROLL, td.roll, true); - SetDlgItemInt(hwnd, IDC_YAW, td.yaw, true); - - SetDlgItemInt(hwnd, IDC_X1, td.tx, true); - SetDlgItemInt(hwnd, IDC_Y1, td.ty, true); - SetDlgItemInt(hwnd, IDC_Z1, td.tz, true); - - SetDlgItemInt(hwnd, IDC_X2, td.padding[0], true); - SetDlgItemInt(hwnd, IDC_Y2, td.padding[1], true); - SetDlgItemInt(hwnd, IDC_Z2, td.padding[2], true); - SetDlgItemInt(hwnd, IDC_X3, td.padding[3], true); - SetDlgItemInt(hwnd, IDC_Y3, td.padding[4], true); - SetDlgItemInt(hwnd, IDC_Z3, td.padding[5], true); - SetDlgItemInt(hwnd, IDC_S, td.status, true); - SetDlgItemInt(hwnd, IDC_F, td.frame, true); -} - -BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - (void) lParam; - switch(uMsg) - { - case WM_INITDIALOG: - SetDlgItemInt(hwndDlg, IDC_APPID, 2307, true); - return TRUE; - - case WM_CLOSE: - EndDialog(hwndDlg, 0); - return TRUE; - - case WM_COMMAND: - switch(LOWORD(wParam)) - { - /* - * TODO: Add more control ID's, when needed. - */ - case IDQUIT: - npifc_close(); - EndDialog(hwndDlg, 0); - return TRUE; - case IDSTART: - int ok; - int num = GetDlgItemInt(hwndDlg, IDC_APPID, (BOOL*)&ok, false); - if(!ok){ - num = 2307; - } - game_desc_t gd; - if(timer != 0){ - KillTimer(hwndDlg, timer); - timer = 0; - } - if(game_data_get_desc(num, &gd)){ - printf("Application ID: %d - %s\n", num, gd.name); - if(npifc_init(hwndDlg, num)){ - timer = SetTimer(hwndDlg, 0, 50, TimerProcedure); - } - }else{ - printf("Unknown Application ID: %d\n", num); - } - break; - - } - } - - return FALSE; -} - - -int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) -{ - (void) hPrevInstance; - (void) lpCmdLine; - (void) nShowCmd; - hInst = hInstance; - - // The user interface is a modal dialog box - return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DialogProc); -} - - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c deleted file mode 100644 index b036464e..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.c +++ /dev/null @@ -1,302 +0,0 @@ -#define _GNU_SOURCE -#include <stdio.h> -#include <stdint.h> -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#include "npifc.h" -#include "rest.h" - - -tir_signature_t ts; -HMODULE npclient; -/* -typedef int (*NP_RegisterWindowHandle_t)(HWND hwnd); -typedef int (*NP_UnregisterWindowHandle_t)(void); -typedef int (*NP_RegisterProgramProfileID_t)(unsigned short id); -typedef int (*NP_QueryVersion_t)(unsigned short *version); -typedef int (*NP_RequestData_t)(unsigned short req); -typedef int (*NP_GetSignature_t)(tir_signature_t *sig); -typedef int (*NP_GetData_t)(tir_data_t *data); -typedef int (*NP_GetParameter_t)(void); -typedef int (*NP_SetParameter_t)(void); -typedef int (*NP_StartCursor_t)(void); -typedef int (*NP_StopCursor_t)(void); -typedef int (*NP_ReCenter_t)(void); -typedef int (*NP_StartDataTransmission_t)(void); -typedef int (*NP_StopDataTransmission_t)(void); -*/ -NP_RegisterWindowHandle_t NP_RegisterWindowHandle = NULL; -NP_UnregisterWindowHandle_t NP_UnregisterWindowHandle = NULL; -NP_RegisterProgramProfileID_t NP_RegisterProgramProfileID = NULL; -NP_QueryVersion_t NP_QueryVersion = NULL; -NP_RequestData_t NP_RequestData = NULL; -NP_GetSignature_t NP_GetSignature = NULL; -NP_GetData_t NP_GetData = NULL; -NP_GetParameter_t NP_GetParameter = NULL; -NP_SetParameter_t NP_SetParameter = NULL; -NP_StartCursor_t NP_StartCursor = NULL; -NP_StopCursor_t NP_StopCursor = NULL; -NP_ReCenter_t NP_ReCenter = NULL; -NP_StartDataTransmission_t NP_StartDataTransmission = NULL; -NP_StopDataTransmission_t NP_StopDataTransmission = NULL; - -bool crypted = false; - - - -unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -char *client_path() -{ - HKEY hkey = 0; - RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\NaturalPoint\\NATURALPOINT\\NPClient Location", 0, - KEY_QUERY_VALUE, &hkey); - if(!hkey){ - printf("Can't open registry key\n"); - return NULL; - } - - BYTE path[1024]; - DWORD buf_len = 1024; - LONG result = RegQueryValueEx(hkey, "Path", NULL, NULL, path, &buf_len); - char *full_path = NULL; - int res = -1; - if(result == ERROR_SUCCESS && buf_len > 0){ -#ifdef FOR_WIN64 - res = asprintf(&full_path, "%s/NPClient64.dll", path); -#else - res = asprintf(&full_path, "%s/NPClient.dll", path); -#endif - } - RegCloseKey(hkey); - if(res > 0){ - return full_path; - }else{ - return NULL; - } -} - -bool initialized = false; - -bool npifc_init(HWND wnd, int id) -{ - //table[] = {0xb3, 0x16, 0x36, 0xeb, 0xb9, 0x05, 0x4f, 0xa4}; - game_desc_t gd; - if(game_data_get_desc(id, &gd)){ - crypted = gd.encrypted; - if(gd.encrypted){ - table[0] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[1] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[2] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[3] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[4] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[5] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[6] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[7] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - } - } - printf("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", - table[0], table[1], table[2], table[3], - table[4], table[5], table[6], table[7]); - - char *client = client_path(); - if(client == NULL){ - printf("Couldn't obtain client path!\n"); - return false; - } - npclient = LoadLibrary(client); - if(!npclient){ - printf("Can't load client %s\n", client); - return false; - } - - NP_RegisterWindowHandle = (NP_RegisterWindowHandle_t)GetProcAddress(npclient, "NP_RegisterWindowHandle"); - NP_UnregisterWindowHandle = (NP_UnregisterWindowHandle_t)GetProcAddress(npclient, "NP_UnregisterWindowHandle"); - NP_RegisterProgramProfileID = (NP_RegisterProgramProfileID_t)GetProcAddress(npclient, "NP_RegisterProgramProfileID"); - NP_QueryVersion = (NP_QueryVersion_t)GetProcAddress(npclient, "NP_QueryVersion"); - NP_RequestData = (NP_RequestData_t)GetProcAddress(npclient, "NP_RequestData"); - NP_GetSignature = (NP_GetSignature_t)GetProcAddress(npclient, "NP_GetSignature"); - NP_GetData = (NP_GetData_t)GetProcAddress(npclient, "NP_GetData"); - NP_GetParameter = (NP_GetParameter_t)GetProcAddress(npclient, "NP_GetParameter"); - NP_SetParameter = (NP_SetParameter_t)GetProcAddress(npclient, "NP_SetParameter"); - NP_StartCursor = (NP_StartCursor_t)GetProcAddress(npclient, "NP_StartCursor"); - NP_StopCursor = (NP_StopCursor_t)GetProcAddress(npclient, "NP_StopCursor"); - NP_ReCenter = (NP_ReCenter_t)GetProcAddress(npclient, "NP_ReCenter"); - NP_StartDataTransmission = (NP_StartDataTransmission_t)GetProcAddress(npclient, "NP_StartDataTransmission"); - NP_StopDataTransmission = (NP_StopDataTransmission_t)GetProcAddress(npclient, "NP_StopDataTransmission"); - if((NP_RegisterWindowHandle == NULL) || (NP_UnregisterWindowHandle == NULL) - || (NP_RegisterProgramProfileID == NULL) || (NP_QueryVersion == NULL) || (NP_RequestData == NULL) - || (NP_GetSignature == NULL) || (NP_GetData == NULL) || (NP_GetParameter == NULL) - || (NP_SetParameter == NULL) || (NP_StartCursor == NULL) || (NP_StopCursor == NULL) - || (NP_ReCenter == NULL) || (NP_StartDataTransmission == NULL) || (NP_StopDataTransmission == NULL)){ - printf("Couldn't bind all necessary functions!\n"); - return false; - } - tir_signature_t sig; - int res; - if((res = NP_GetSignature(&sig)) != 0){ - printf("Error retrieving signature! %d\n", res); - return false; - } - printf("Dll Sig:%s\nApp Sig2:%s\n", sig.DllSignature, sig.AppSignature); - NP_RegisterWindowHandle(wnd); - if(NP_RegisterProgramProfileID(id) != 0){ - printf("Couldn't register profile id!\n"); - return false; - } - printf("Program profile registered!\n"); - NP_RequestData(65535); - NP_StopCursor(); - NP_StartDataTransmission(); - initialized = true; - return true; -} - -void npifc_close() -{ - if(initialized){ - NP_StopDataTransmission(); - NP_StartCursor(); - NP_UnregisterWindowHandle(); - } - initialized = false; -} - -void c_encrypt(unsigned char buf[], unsigned int size, - unsigned char code_table[], unsigned int table_size) -{ - unsigned int table_ptr = 0; - unsigned char var = 0x88; - unsigned char tmp; - if((size <= 0) || (table_size <= 0) || - (buf == NULL) || (code_table == NULL)) - return; - do{ - tmp = buf[--size]; - buf[size] = tmp ^ code_table[table_ptr] ^ var; - var += size + tmp; - ++table_ptr; - if(table_ptr >= table_size){ - table_ptr -= table_size; - } - }while(size != 0); -} - - - -void decrypt(unsigned char buf[], unsigned int size, - unsigned char code_table[], unsigned int table_size) -{ - unsigned int table_ptr = 0; - unsigned char var = 0x88; - unsigned char tmp; - if((size <= 0) || (table_size <= 0) || - (buf == NULL) || (code_table == NULL)){ - return; - } - do{ - tmp = buf[--size]; - buf[size] = tmp ^ code_table[table_ptr] ^ var; - var += size + buf[size]; - ++table_ptr; - if(table_ptr >= table_size){ - table_ptr -= table_size; - } - }while(size != 0); -} - -unsigned int cksum(unsigned char buf[], unsigned int size) -{ - if((size == 0) || (buf == NULL)){ - return 0; - } - int rounds = size >> 2; - int rem = size % 4; - - int c = size; - int a0 = 0; - int a2 = 0; - - while(rounds != 0){ - a0 = *(short int*)buf; - a2 = *(short int*)(buf+2); - buf += 4; - c += a0; - a2 ^= (c << 5); - a2 <<= 11; - c ^= a2; - c += (c >> 11); - --rounds; - } - switch(rem){ - case 3: - a0 = *(short int*)buf; - a2 = *(signed char*)(buf+2); - c += a0; - a2 = (a2 << 2) ^ c; - c ^= (a2 << 16); - a2 = (c >> 11); - break; - case 2: - a2 = *(short int*)buf; - c += a2; - c ^= (c << 11); - a2 = (c >> 17); - break; - case 1: - a2 = *(signed char*)(buf); - c += a2; - c ^= (c << 10); - a2 = (c >> 1); - break; - default: - break; - } - if(rem != 0){ - c+=a2; - } - - c ^= (c << 3); - c += (c >> 5); - c ^= (c << 4); - c += (c >> 17); - c ^= (c << 25); - c += (c >> 6); - - return (unsigned int)c; -} - -int decode_frame(tir_data_t *td) -{ - //printf("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", - // table[0], table[1], table[2], table[3], - // table[4], table[5], table[6], table[7]); - unsigned int csum; - decrypt((unsigned char*)td, sizeof(*td), table, sizeof(table)); - csum = td->cksum; - td->cksum = 0; - if(csum != cksum((unsigned char*)td, sizeof(*td))){ - printf("Problem with frame!\n"); - //int a0; - //printf("Dec: "); - //for(a0 = 0; a0 < (int)sizeof(tir_data_t); ++a0) - //{ - // printf("%02X", ((unsigned char *)td)[a0]); - //} - //printf("\n"); - //printf("Cksum: %04X vs computed: %04X\n", csum, cksum((unsigned char*)td, sizeof(*td))); - return -1; - } - //printf("Frame OK!\n"); - return 0; -} - -int npifc_getdata(tir_data_t *data) -{ - int res = NP_GetData(data); - if(crypted){ - decode_frame(data); - } - return res; -} - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h deleted file mode 100644 index d580e16d..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npifc.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef NPIFC__H -#define NPIFC__H - - -#include <stdbool.h> - -#ifdef __cplusplus -extern "C" { -#endif - bool npifc_init(HWND wnd, int id); - void npifc_close(); - -#pragma pack(1) -typedef struct tir_data{ - short status; - short frame; - unsigned int cksum; - float roll, pitch, yaw; - float tx, ty, tz; - float padding[9]; -} tir_data_t; - -typedef struct tir_signature{ - char DllSignature[200]; - char AppSignature[200]; -} tir_signature_t; -#pragma pack(0) - -int npifc_getdata(tir_data_t *data); - -typedef int __stdcall (*NP_RegisterWindowHandle_t)(HWND hwnd); -typedef int __stdcall (*NP_UnregisterWindowHandle_t)(void); -typedef int __stdcall (*NP_RegisterProgramProfileID_t)(unsigned short id); -typedef int __stdcall (*NP_QueryVersion_t)(unsigned short *version); -typedef int __stdcall (*NP_RequestData_t)(unsigned short req); -typedef int __stdcall (*NP_GetSignature_t)(tir_signature_t *sig); -typedef int __stdcall (*NP_GetData_t)(tir_data_t *data); -typedef int __stdcall (*NP_GetParameter_t)(void); -typedef int __stdcall (*NP_SetParameter_t)(void); -typedef int __stdcall (*NP_StartCursor_t)(void); -typedef int __stdcall (*NP_StopCursor_t)(void); -typedef int __stdcall (*NP_ReCenter_t)(void); -typedef int __stdcall (*NP_StartDataTransmission_t)(void); -typedef int __stdcall (*NP_StopDataTransmission_t)(void); - -extern NP_RegisterWindowHandle_t NP_RegisterWindowHandle; -extern NP_UnregisterWindowHandle_t NP_UnregisterWindowHandle; -extern NP_RegisterProgramProfileID_t NP_RegisterProgramProfileID; -extern NP_QueryVersion_t NP_QueryVersion; -extern NP_RequestData_t NP_RequestData; -extern NP_GetSignature_t NP_GetSignature; -extern NP_GetData_t NP_GetData; -extern NP_GetParameter_t NP_GetParameter; -extern NP_SetParameter_t NP_SetParameter; -extern NP_StartCursor_t NP_StartCursor; -extern NP_StopCursor_t NP_StopCursor; -extern NP_ReCenter_t NP_ReCenter; -extern NP_StartDataTransmission_t NP_StartDataTransmission; -extern NP_StopDataTransmission_t NP_StopDataTransmission; - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in deleted file mode 100644 index 231002f1..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/npview.rc.in +++ /dev/null @@ -1,49 +0,0 @@ -// Generated by ResEdit 1.5.9 -// Copyright (C) 2006-2011 -// http://www.resedit.net - -#include <windows.h> -#include <commctrl.h> -#include <richedit.h> -#include "resource.h" - -#ifdef HAVE_CONFIG_H - #include "../../../config.h" -#endif - - - -// -// Dialog resources -// -//LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -IDD_DIALOG1 DIALOGEX 0, 0, 379, 124 -STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU -CAPTION "NPTest v@PACKAGE_VERSION@" -FONT 8, "Ms Shell Dlg", 400, 0, 1 -{ - DEFPUSHBUTTON "Quit", IDQUIT, 262, 102, 50, 14 - DEFPUSHBUTTON "Start", IDSTART, 7, 102, 50, 14 - EDITTEXT IDC_PITCH, 32, 32, 51, 14, ES_AUTOHSCROLL - LTEXT "Pitch", IDC_STATIC, 11, 34, 20, 8, SS_LEFT - LTEXT "Yaw", IDC_STATIC, 11, 59, 20, 8, SS_LEFT - EDITTEXT IDC_YAW, 32, 57, 51, 14, ES_AUTOHSCROLL - LTEXT "Roll", IDC_STATIC, 11, 84, 20, 8, SS_LEFT - EDITTEXT IDC_ROLL, 32, 82, 51, 14, ES_AUTOHSCROLL - LTEXT "X", IDC_STATIC, 101, 35, 6, 8, SS_LEFT - EDITTEXT IDC_X1, 112, 32, 51, 14, ES_AUTOHSCROLL - LTEXT "Y", IDC_STATIC, 101, 60, 6, 8, SS_LEFT - EDITTEXT IDC_Y1, 112, 57, 51, 14, ES_AUTOHSCROLL - LTEXT "Z", IDC_STATIC, 101, 85, 6, 8, SS_LEFT - EDITTEXT IDC_Z1, 112, 82, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_X2, 172, 32, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_Y2, 172, 57, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_Z2, 172, 82, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_X3, 232, 32, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_Y3, 232, 57, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_Z3, 232, 82, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_S, 292, 32, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_F, 292, 57, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_APPID, 32, 12, 51, 12, ES_AUTOHSCROLL - LTEXT "ID", IDC_STATIC, 17, 14, 8, 8, SS_LEFT -} diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h deleted file mode 100644 index 328d9cb7..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/resource.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef IDC_STATIC -#define IDC_STATIC (-1) -#endif - -#define IDD_DIALOG1 100 -#define IDQUIT 1002 -#define IDSTART 1003 -#define IDC_APPID 1016 -#define IDC_PITCH 1017 -#define IDC_YAW 1018 -#define IDC_ROLL 1019 -#define IDC_X1 1020 -#define IDC_X2 1021 -#define IDC_X3 1022 -#define IDC_Y1 1023 -#define IDC_Y2 1024 -#define IDC_Y3 1025 -#define IDC_Z1 1026 -#define IDC_Z2 1027 -#define IDC_Z3 1028 -#define IDC_S 1029 -#define IDC_F 1030 - diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c deleted file mode 120000 index 663c21a9..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.c +++ /dev/null @@ -1 +0,0 @@ -../client/rest.c \ No newline at end of file diff --git a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h b/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h deleted file mode 120000 index 6dca182a..00000000 --- a/facetracknoir/clientfiles/important-source-code-really-important-really-really/tester/rest.h +++ /dev/null @@ -1 +0,0 @@ -../client/rest.h \ No newline at end of file diff --git a/facetracknoir/clientfiles/make-csv.pl b/facetracknoir/clientfiles/make-csv.pl new file mode 100755 index 00000000..ee60364e --- /dev/null +++ b/facetracknoir/clientfiles/make-csv.pl @@ -0,0 +1,72 @@ +#!/usr/bin/env perl + +use strict; +use List::Util qw'reduce'; + +sub get_games_1 { + my @games; + + open my $fd, "<", $ARGV[1] or die "open: $!"; + <$fd>; + + while (defined(my $line = <$fd>)) { + chomp $line; + if ($line !~ /^(\d+)\s+"([^"]+)"(?:\s+\(([0-9A-F]{16})\))?$/) { + warn "Broken line"; + next; + } + push @games, +{ id => $1, name => $2, key => defined $3 ? (sprintf "%04X", $1) . $3 . '00' : undef}; + } + + [@games]; +} + +sub get_games_2 { + open my $fd, "<", $ARGV[0] or die "open: $!"; + <$fd>; + my @games; + while (defined(my $line = <$fd>)) { + chomp $line; + my @line = split/;/, $line; + if (@line != 8) { + warn "Broken line"; + next; + } + my @cols = qw'no name proto since verified by id key'; + push @games, +{ map { $cols[$_] => $line[$_] } 0..$#cols }; + } + [@games]; +} + +sub merge { + my ($new_games, $old_games) = @_; + my $no = (reduce { $a->{no} > $b->{no} ? $a : $b } +{id=>0}, @$old_games)->{no} + 1; + my %game_hash = map { $_->{name} => $_ } @$old_games; + my %ids = map { $_->{id} => 1 } @$old_games; + for my $g (@$new_games) { + if (!exists $game_hash{$g->{name}} && !exists $ids{$g->{id}}) { + $game_hash{$g->{name}} = +{ + no => $no++, + name => $g->{name}, + proto => 'FreeTrack20', + since => (defined $g->{key} ? 'V170' : 'V160'), + verified => '', + by => '', + id => $g->{id}, + key => $g->{key} + }; + } + } + print "No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID\n"; + for (sort { lc($a->{name}) cmp lc($b->{name}) } values %game_hash) { + my $g = {%$_}; + if (!defined $g->{key}) { + $g->{key} = (sprintf "%04X", $g->{no}) . (join"", map { sprintf "%02X", int rand 256 } 0 .. 7) . '00'; + } + my @cols = qw'no name proto since verified by id key'; + print join";", map { $g->{$_} } @cols; + print "\n"; + } +} + +merge(get_games_1(), get_games_2()); diff --git a/facetracknoir/clientfiles/very-important-source-code/README-CREDIT.txt b/facetracknoir/clientfiles/very-important-source-code/README-CREDIT.txt new file mode 100644 index 00000000..82214139 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/README-CREDIT.txt @@ -0,0 +1,6 @@ +The contents of the directory written by one and only, uglyDwarf. + +Obtained at epoch time 1412397452 from the mithril-mine's shaft, where +the elite dwarves reside. + +For the latest happenings, visit <https://code.google.com/p/linux-track/> diff --git a/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.am b/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.am new file mode 100644 index 00000000..02747edb --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.am @@ -0,0 +1,54 @@ +noinst_SCRIPTS = +if WINE_PLUGIN + noinst_SCRIPTS += ftc.exe.so +endif #WINE_PLUGIN + +if DARWIN + LDFLAGS += -Wl,-no_arch_warnings +else + LDFLAGS += -Wl,--no-warn-search-mismatch +endif + +CC = winegcc + +CXX = wineg++ + +SUFFIXES = .o .cpp .c .rc + +.cpp.o : + $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< + +CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ +CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ +RCFLAGS = -I @srcdir@ +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + +ftc.exe.so : main.o fttester.o + wineg++ -g -o $@ -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +fttester.o : fttester.rc resource.h config.h + +main.o : main.cpp + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +EXTRA_DIST = resource.h fttester.rc main.cpp + diff --git a/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.in b/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.in new file mode 100644 index 00000000..d1fff34d --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/Makefile.in @@ -0,0 +1,491 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@WINE_PLUGIN_TRUE@am__append_1 = ftc.exe.so +@DARWIN_TRUE@am__append_2 = -Wl,-no_arch_warnings +@DARWIN_FALSE@am__append_3 = -Wl,--no-warn-search-mismatch +subdir = src/wine_bridge/ft_tester +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/fttester.rc.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = fttester.rc +CONFIG_CLEAN_VPATH_FILES = +SCRIPTS = $(noinst_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON = @BISON@ +CC = winegcc +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = wineg++ +CXXCPP = @CXXCPP@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ $(am__append_2) $(am__append_3) +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIB32DIR = @LIB32DIR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENCV_CFLAGS = @OPENCV_CFLAGS@ +OPENCV_LIBS = @OPENCV_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +QMAKE_PATH = @QMAKE_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WINE64_LIBS = @WINE64_LIBS@ +WINE_LIBS = @WINE_LIBS@ +XPL_CPPFLAGS = @XPL_CPPFLAGS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +with_makensis = @with_makensis@ +with_wine64 = @with_wine64@ +noinst_SCRIPTS = $(am__append_1) +SUFFIXES = .o .cpp .c .rc +CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ +CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ +RCFLAGS = -I @srcdir@ +EXTRA_DIST = resource.h fttester.rc main.cpp +all: all-am + +.SUFFIXES: +.SUFFIXES: .o .cpp .c .rc +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/ft_tester/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/ft_tester/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +fttester.rc: $(top_builddir)/config.status $(srcdir)/fttester.rc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-local + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + clean-local cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distclean-local distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am + + +.cpp.o : + $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + +ftc.exe.so : main.o fttester.o + wineg++ -g -o $@ -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +fttester.o : fttester.rc resource.h config.h + +main.o : main.cpp + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/facetracknoir/clientfiles/very-important-source-code/ft_tester/fttester.rc.in b/facetracknoir/clientfiles/very-important-source-code/ft_tester/fttester.rc.in new file mode 100644 index 00000000..332f3c73 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/fttester.rc.in @@ -0,0 +1,67 @@ +// Generated by ResEdit 1.5.9 +// Copyright (C) 2006-2011 +// http://www.resedit.net + +#include <windows.h> +#include <commctrl.h> +#include <richedit.h> +#include "resource.h" + +#ifdef HAVE_CONFIG_H + #include "../../../config.h" +#endif + + + + +// +// Dialog resources +// +//LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_DIALOG1 DIALOGEX 0, 0, 333, 183 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "FreeTrack client test utility v@PACKAGE_VERSION@" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + DEFPUSHBUTTON "Quit", IDQUIT, 262, 153, 50, 14 + PUSHBUTTON "Start", IDC_START, 199, 153, 50, 14 + EDITTEXT IDC_YAW, 38, 15, 48, 14, ES_AUTOHSCROLL + RTEXT "Yaw", IDC_STATIC, 12, 17, 21, 14, SS_RIGHT + EDITTEXT IDC_PITCH, 38, 38, 48, 14, ES_AUTOHSCROLL + RTEXT "Pitch", IDC_STATIC, 16, 40, 17, 14, SS_RIGHT + EDITTEXT IDC_ROLL, 38, 61, 48, 14, ES_AUTOHSCROLL + RTEXT "Roll", IDC_STATIC, 20, 63, 13, 14, SS_RIGHT + EDITTEXT IDC_X, 38, 84, 48, 14, ES_AUTOHSCROLL + RTEXT "X", IDC_STATIC, 27, 86, 6, 14, SS_RIGHT + EDITTEXT IDC_Y, 38, 107, 48, 14, ES_AUTOHSCROLL + RTEXT "Y", IDC_STATIC, 27, 109, 6, 14, SS_RIGHT + EDITTEXT IDC_Z, 38, 130, 48, 14, ES_AUTOHSCROLL + RTEXT "Z", IDC_STATIC, 27, 132, 6, 14, SS_RIGHT + EDITTEXT IDC_RYAW, 137, 15, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Yaw", IDC_STATIC, 101, 17, 32, 8, SS_RIGHT + EDITTEXT IDC_RPITCH, 137, 38, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Pitch", IDC_STATIC, 99, 40, 34, 8, SS_RIGHT + EDITTEXT IDC_RROLL, 137, 61, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Roll", IDC_STATIC, 103, 63, 30, 8, SS_RIGHT + EDITTEXT IDC_RX, 137, 84, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw X", IDC_STATIC, 111, 86, 22, 8, SS_RIGHT + EDITTEXT IDC_RY, 137, 107, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Y", IDC_STATIC, 111, 109, 22, 8, SS_RIGHT + EDITTEXT IDC_RZ, 137, 130, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Z", IDC_STATIC, 111, 132, 22, 8, SS_RIGHT + EDITTEXT IDC_NUM, 264, 15, 48, 14, ES_AUTOHSCROLL + RTEXT "Frame Number", IDC_STATIC, 212, 17, 47, 8, SS_RIGHT + EDITTEXT IDC_RES, 264, 38, 48, 14, ES_AUTOHSCROLL + RTEXT "Camera Resolution", IDC_STATIC, 199, 40, 60, 8, SS_RIGHT + EDITTEXT IDC_PT0, 227, 61, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 1", IDC_STATIC, 199, 63, 23, 8, SS_RIGHT + EDITTEXT IDC_PT1, 227, 84, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 2", IDC_STATIC, 199, 86, 23, 8, SS_RIGHT + EDITTEXT IDC_PT2, 227, 107, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 3", IDC_STATIC, 199, 109, 23, 8, SS_RIGHT + EDITTEXT IDC_PT3, 227, 130, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 4", IDC_STATIC, 199, 132, 23, 8, SS_RIGHT + EDITTEXT IDC_TITLE, 38, 153, 147, 14, ES_AUTOHSCROLL + RTEXT "Title", IDC_STATIC, 19, 155, 14, 8, SS_RIGHT +} + diff --git a/facetracknoir/clientfiles/very-important-source-code/ft_tester/main.cpp b/facetracknoir/clientfiles/very-important-source-code/ft_tester/main.cpp new file mode 100644 index 00000000..a737f88f --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/main.cpp @@ -0,0 +1,211 @@ +#define WIN32_LEAN_AND_MEAN + +#include <windows.h> +#include <cstdio> +#include <stdint.h> +#include <sstream> +#include <cstdlib> +#include <iomanip> + +#include "resource.h" + +HINSTANCE hInst; +UINT_PTR timer = 0; + +HMODULE ftclient; + +typedef struct +{ + unsigned int dataID; + int res_x; int res_y; + float yaw; // positive yaw to the left + float pitch;// positive pitch up + float roll;// positive roll to the left + float x; + float y; + float z; + // raw pose with no smoothing, sensitivity, response curve etc. + float ryaw; + float rpitch; + float rroll; + float rx; + float ry; + float rz; + // raw points, sorted by Y, origin top left corner + float x0, y0; + float x1, y1; + float x2, y2; + float x3, y3; +}FreeTrackData; + + +typedef bool (WINAPI *importGetData)(FreeTrackData * data); +typedef char *(WINAPI *importGetDllVersion)(void); +typedef void (WINAPI *importReportName)(char *name); +typedef char *(WINAPI *importProvider)(void); + +importGetData getData; +importGetDllVersion getDllVersion; +importReportName reportName; +importProvider provider; + + +char *client_path() +{ + HKEY hkey = 0; + RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Freetrack\\FreetrackClient", 0, + KEY_QUERY_VALUE, &hkey); + if(!hkey){ + printf("Can't open registry key\n"); + return NULL; + } + + BYTE path[1024]; + DWORD buf_len = 1024; + LONG result = RegQueryValueEx(hkey, "Path", NULL, NULL, path, &buf_len); + char *full_path = (char *)malloc(2048); + if(result == ERROR_SUCCESS && buf_len > 0){ + sprintf(full_path, "%s\\FreeTrackClient.dll", path); + } + RegCloseKey(hkey); + return full_path; +} + + +bool start(HWND hwnd) +{ + char *libname = client_path(); + if(libname == NULL){ + printf("Freetrack client not found!\n"); + return false; + } + ftclient = LoadLibrary(libname); + if(ftclient == NULL){ + printf("Couldn't load Freetrack client library '%s'!\n", libname); + return false; + } + printf("Freetrack client library %s loaded.\n", client_path()); + + + getData = (importGetData)GetProcAddress(ftclient, "FTGetData"); + getDllVersion = (importGetDllVersion)GetProcAddress(ftclient, "FTGetDllVersion"); + reportName = (importReportName)GetProcAddress(ftclient, "FTReportName"); + provider = (importProvider)GetProcAddress(ftclient, "FTProvider"); + + if((getData == NULL) || (getDllVersion == NULL) || (reportName == NULL) || (provider == NULL)){ + printf("Couldn't load Freetrack client functions!\n"); + FreeLibrary(ftclient); + return false; + } + + printf("Dll version: %s\n", getDllVersion()); + printf("Provider: %s\n", provider()); + char title[1024]; + GetDlgItemText(hwnd, IDC_TITLE, title, 1020); + reportName(title); + return true; +} + +void reportError(std::string msg) +{ + MessageBoxA(0, "FreeTrack client test", msg.c_str(), 0); +} +VOID CALLBACK TimerProcedure(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +{ + (void) uMsg; + (void) idEvent; + (void) dwTime; + FreeTrackData d; + getData(&d); + SetDlgItemInt(hwnd, IDC_PITCH, d.pitch, true); + SetDlgItemInt(hwnd, IDC_ROLL, d.roll, true); + SetDlgItemInt(hwnd, IDC_YAW, d.yaw, true); + + SetDlgItemInt(hwnd, IDC_X, d.x, true); + SetDlgItemInt(hwnd, IDC_Y, d.y, true); + SetDlgItemInt(hwnd, IDC_Z, d.z, true); + + SetDlgItemInt(hwnd, IDC_RPITCH, d.rpitch, true); + SetDlgItemInt(hwnd, IDC_RROLL, d.rroll, true); + SetDlgItemInt(hwnd, IDC_RYAW, d.ryaw, true); + + SetDlgItemInt(hwnd, IDC_RX, d.rx, true); + SetDlgItemInt(hwnd, IDC_RY, d.ry, true); + SetDlgItemInt(hwnd, IDC_RZ, d.rz, true); + + std::ostringstream s; + s.str(std::string()); + s<<"("<<std::fixed<<std::setprecision(1)<<d.x0<<"; "<<d.y0<<")"; + SetDlgItemText(hwnd, IDC_PT0, s.str().c_str()); + + s.str(std::string()); + s<<"("<<std::fixed<<std::setprecision(1)<<d.x1<<"; "<<d.y1<<")"; + SetDlgItemText(hwnd, IDC_PT1, s.str().c_str()); + + s.str(std::string()); + s<<"("<<std::fixed<<std::setprecision(1)<<d.x2<<"; "<<d.y2<<")"; + SetDlgItemText(hwnd, IDC_PT2, s.str().c_str()); + + s.str(std::string()); + s<<"("<<std::fixed<<std::setprecision(1)<<d.x3<<"; "<<d.y3<<")"; + SetDlgItemText(hwnd, IDC_PT3, s.str().c_str()); + + s.str(std::string()); + s<<d.res_x<<"x"<<d.res_y; + SetDlgItemText(hwnd, IDC_RES, s.str().c_str()); + SetDlgItemInt(hwnd, IDC_NUM, d.dataID, true); +} + +BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + (void) lParam; + switch(uMsg) + { + case WM_INITDIALOG: + SetDlgItemText(hwndDlg, IDC_TITLE, "Default"); + return TRUE; + + case WM_CLOSE: + EndDialog(hwndDlg, 0); + return TRUE; + + case WM_COMMAND: + switch(LOWORD(wParam)) + { + /* + * TODO: Add more control ID's, when needed. + */ + case IDQUIT: + FreeLibrary(ftclient); + EndDialog(hwndDlg, 0); + return TRUE; + case IDC_START: + start(hwndDlg); +//l int ok; +// int num = GetDlgItemInt(hwndDlg, IDC_APPID, (BOOL*)&ok, false); + if(timer != 0){ + KillTimer(hwndDlg, timer); + timer = 0; + } + timer = SetTimer(hwndDlg, 0, 50, TimerProcedure); + break; + + } + } + + return FALSE; +} + + +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) +{ + (void) hPrevInstance; + (void) lpCmdLine; + (void) nShowCmd; + hInst = hInstance; + + // The user interface is a modal dialog box + return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DialogProc); +} + + diff --git a/facetracknoir/clientfiles/very-important-source-code/ft_tester/resource.h b/facetracknoir/clientfiles/very-important-source-code/ft_tester/resource.h new file mode 100644 index 00000000..8bba17b4 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/ft_tester/resource.h @@ -0,0 +1,27 @@ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_DIALOG1 100 +#define IDQUIT 1002 +#define IDC_YAW 1005 +#define IDC_PITCH 1023 +#define IDC_ROLL 1024 +#define IDC_X 1025 +#define IDC_Y 1026 +#define IDC_Z 1027 +#define IDC_RYAW 1028 +#define IDC_RPITCH 1029 +#define IDC_RROLL 1030 +#define IDC_RX 1031 +#define IDC_RY 1032 +#define IDC_RZ 1033 +#define IDC_NUM 1034 +#define IDC_RES 1035 +#define IDC_PT0 1036 +#define IDC_PT1 1037 +#define IDC_PT2 1038 +#define IDC_PT3 1039 +#define IDC_START 1040 +#define IDC_TITLE 1041 + diff --git a/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.h b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.h new file mode 100644 index 00000000..770e1c71 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.h @@ -0,0 +1,17 @@ + +extern int NP_RegisterWindowHandle (HWND hwnd); +extern int NP_UnregisterWindowHandle (void); +extern int NP_RegisterProgramProfileID (unsigned short id); +extern int NP_QueryVersion (unsigned short *version); +extern int NP_RequestData (unsigned short req); +extern int NP_GetSignature (tir_signature_t *sig); +extern int NP_GetData (tir_data_t *data); +extern int NP_GetParameter (void); +extern int NP_SetParameter (void); +extern int NP_StartCursor (void); +extern int NP_StopCursor (void); +extern int NP_ReCenter (void); +extern int NP_StartDataTransmission (void); +extern int NP_StopDataTransmission (void); + + diff --git a/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.spec b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.spec new file mode 100644 index 00000000..7fe5f1b4 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient.spec @@ -0,0 +1,23 @@ +# Generated from NPClient.dll by winedump + +1 stub NPPriv_ClientNotify +2 stub NPPriv_GetLastError +3 stub NPPriv_SetData +4 stub NPPriv_SetLastError +5 stub NPPriv_SetParameter +6 stub NPPriv_SetSignature +7 stub NPPriv_SetVersion +8 stdcall NP_GetData( ptr ) NPCLIENT_NP_GetData +9 stdcall NP_GetParameter( long long) NPCLIENT_NP_GetParameter +10 stdcall NP_GetSignature( ptr ) NPCLIENT_NP_GetSignature +11 stdcall NP_QueryVersion( ptr ) NPCLIENT_NP_QueryVersion +12 stdcall NP_ReCenter() NPCLIENT_NP_ReCenter +13 stdcall NP_RegisterProgramProfileID( long ) NPCLIENT_NP_RegisterProgramProfileID +14 stdcall NP_RegisterWindowHandle( ptr ) NPCLIENT_NP_RegisterWindowHandle +15 stdcall NP_RequestData( long ) NPCLIENT_NP_RequestData +16 stdcall NP_SetParameter( long long ) NPCLIENT_NP_SetParameter +17 stdcall NP_StartCursor() NPCLIENT_NP_StartCursor +18 stdcall NP_StartDataTransmission() NPCLIENT_NP_StartDataTransmission +19 stdcall NP_StopCursor() NPCLIENT_NP_StopCursor +20 stdcall NP_StopDataTransmission() NPCLIENT_NP_StopDataTransmission +21 stdcall NP_UnregisterWindowHandle() NPCLIENT_NP_UnregisterWindowHandle diff --git a/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_dll.h b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_dll.h new file mode 100644 index 00000000..b0bab5db --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_dll.h @@ -0,0 +1,58 @@ +/* + * NPClient.dll + * + * Generated from NPClient.dll by winedump. + * + * DO NOT SEND GENERATED DLLS FOR INCLUSION INTO WINE ! + * + */ +#ifndef __WINE_NPCLIENT_DLL_H +#define __WINE_NPCLIENT_DLL_H + +#include "windef.h" +#include "wine/debug.h" +#include "winbase.h" +#include "winnt.h" + +#pragma pack(1) +typedef struct tir_data{ + short status; + short frame; + unsigned int cksum; + float roll, pitch, yaw; + float tx, ty, tz; + float padding[9]; +} tir_data_t; + +typedef struct tir_signature{ + char DllSignature[200]; + char AppSignature[200]; +} tir_signature_t; +#pragma pack(0) + + +/* __stdcall NPCLIENT_NPPriv_ClientNotify(); */ +/* __stdcall NPCLIENT_NPPriv_GetLastError(); */ +/* __stdcall NPCLIENT_NPPriv_SetData(); */ +/* __stdcall NPCLIENT_NPPriv_SetLastError(); */ +/* __stdcall NPCLIENT_NPPriv_SetParameter(); */ +/* __stdcall NPCLIENT_NPPriv_SetSignature(); */ +/* __stdcall NPCLIENT_NPPriv_SetVersion(); */ +int __stdcall NPCLIENT_NP_GetData(tir_data_t * data); +int __stdcall NPCLIENT_NP_GetParameter(int arg0, int arg1); +int __stdcall NPCLIENT_NP_GetSignature(tir_signature_t * sig); +int __stdcall NPCLIENT_NP_QueryVersion(unsigned short * version); +int __stdcall NPCLIENT_NP_ReCenter(void); +int __stdcall NPCLIENT_NP_RegisterProgramProfileID(unsigned short id); +int __stdcall NPCLIENT_NP_RegisterWindowHandle(HWND hwnd); +int __stdcall NPCLIENT_NP_RequestData(unsigned short req); +int __stdcall NPCLIENT_NP_SetParameter(int arg0, int arg1); +int __stdcall NPCLIENT_NP_StartCursor(void); +int __stdcall NPCLIENT_NP_StartDataTransmission(void); +int __stdcall NPCLIENT_NP_StopCursor(void); +int __stdcall NPCLIENT_NP_StopDataTransmission(void); +int __stdcall NPCLIENT_NP_UnregisterWindowHandle(void); + + + +#endif /* __WINE_NPCLIENT_DLL_H */ diff --git a/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_main.c b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_main.c new file mode 100644 index 00000000..f892f89e --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/NPClient_main.c @@ -0,0 +1,444 @@ +/* + * NPClient.dll + * + * Generated from NPClient.dll by winedump. + * + * DO NOT SUBMIT GENERATED DLLS FOR INCLUSION INTO WINE! + * + */ + +#include <linuxtrack.h> +#include "rest.h" +//#include "config.h" +#define __WINESRC__ + +#include <stdarg.h> +#include <string.h> +#include <stdbool.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include "windef.h" +#include "winbase.h" +#include "NPClient_dll.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(NPClient); + +bool crypted = false; +static unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static int dbg_flag; + +static void dbg_report(const char *msg,...) +{ + static FILE *f = NULL; + if(dbg_flag){ + if(f == NULL){ + f = fopen("NPClient.log", "w"); + } + va_list ap; + va_start(ap,msg); + vfprintf(f, msg, ap); + fflush(f); + va_end(ap); + } +} + + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); + + switch (fdwReason) + { + case DLL_WINE_PREATTACH: + return TRUE; + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + dbg_flag = getDebugFlag('w'); + dbg_report("Attach request\n"); + break; + case DLL_PROCESS_DETACH: + linuxtrack_shutdown(); + break; + } + + return TRUE; +} +/****************************************************************** + * NPPriv_ClientNotify (NPCLIENT.1) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_ClientNotify() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_GetLastError (NPCLIENT.2) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_GetLastError() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetData (NPCLIENT.3) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetData() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetLastError (NPCLIENT.4) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetLastError() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetParameter (NPCLIENT.5) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetParameter() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetSignature (NPCLIENT.6) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetSignature() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetVersion (NPCLIENT.7) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetVersion() +{ + /* @stub in .spec */ +} +#endif + +static float limit_num(float min, float val, float max) +{ + if(val < min) return min; + if(val > max) return max; + return val; +} + +static unsigned int cksum(unsigned char buf[], unsigned int size) +{ + if((size == 0) || (buf == NULL)){ + return 0; + } + + int rounds = size >> 2; + int rem = size % 4; + + int c = size; + int a0, a2; +// printf("Orig: "); +//for(a0 = 0; a0 < (int)size; ++a0) +//{ +// printf("%02X", buf[a0]); +//} +//printf("\n"); + while(rounds != 0){ + a0 = *(short int*)buf; + a2 = *(short int*)(buf+2); + buf += 4; + c += a0; + a2 ^= (c << 5); + a2 <<= 11; + c ^= a2; + c += (c >> 11); + --rounds; + } + switch(rem){ + case 3: + a0 = *(short int*)buf; + a2 = *(signed char*)(buf+2); + c += a0; + a2 = (a2 << 2) ^ c; + c ^= (a2 << 16); + a2 = (c >> 11); + break; + case 2: + a2 = *(short int*)buf; + c += a2; + c ^= (c << 11); + a2 = (c >> 17); + break; + case 1: + a2 = *(signed char*)(buf); + c += a2; + c ^= (c << 10); + a2 = (c >> 1); + break; + default: + break; + } + if(rem != 0){ + c+=a2; + } + + c ^= (c << 3); + c += (c >> 5); + c ^= (c << 4); + c += (c >> 17); + c ^= (c << 25); + c += (c >> 6); + + return (unsigned int)c; +} + +static void enhance(unsigned char buf[], unsigned int size, + unsigned char codetable[], unsigned int table_size) +{ + unsigned int table_ptr = 0; + unsigned char var = 0x88; + unsigned char tmp; + if((size <= 0) || (table_size <= 0) || + (buf == NULL) || (codetable == NULL)){ + return; + } + do{ + tmp = buf[--size]; + buf[size] = tmp ^ codetable[table_ptr] ^ var; + var += size + tmp; + ++table_ptr; + if(table_ptr >= table_size){ + table_ptr -= table_size; + } + }while(size != 0); +} + + +/****************************************************************** + * NP_GetData (NPCLIENT.8) + * + * + */ +int __stdcall NPCLIENT_NP_GetData(tir_data_t * data) +{ + float r, p, y, tx, ty, tz; + unsigned int frame; + int res = linuxtrack_get_pose(&y, &p, &r, &tx, &ty, &tz, &frame); + memset((char *)data, 0, sizeof(tir_data_t)); + data->status = (linuxtrack_get_tracking_state() == RUNNING) ? 0 : 1; + data->frame = frame & 0xFFFF; + data->cksum = 0; + data->roll = r / 180.0 * 16383; + data->pitch = -p / 180.0 * 16383; + data->yaw = y / 180.0 * 16383; + data->tx = -limit_num(-16383.0, 15 * tx, 16383); + data->ty = limit_num(-16383.0, 15 * ty, 16383); + data->tz = limit_num(-16383.0, 15 * tz, 16383); + data->cksum = cksum((unsigned char*)data, sizeof(tir_data_t)); + //printf("Cksum: %04X\n", data->cksum); + if(crypted){ + enhance((unsigned char*)data, sizeof(tir_data_t), table, sizeof(table)); + } + return (res >= 0) ? 0: 1; +} +/****************************************************************** + * NP_GetParameter (NPCLIENT.9) + * + * + */ +int __stdcall NPCLIENT_NP_GetParameter(int arg0, int arg1) +{ + dbg_report("GetParameter request: %d %d\n", arg0, arg1); + TRACE("(void): stub\n"); + return (int) 0; +} + +/****************************************************************** + * NP_GetSignature (NPCLIENT.10) + * + * + */ +int __stdcall NPCLIENT_NP_GetSignature(tir_signature_t * sig) +{ + dbg_report("GetSignature request\n"); + if(getSomeSeriousPoetry(sig->DllSignature, sig->AppSignature)){ + printf("Signature result: OK\n"); + return 0; + }else{ + printf("Signature result: NOT OK!\n"); + return 1; + } +} +/****************************************************************** + * NP_QueryVersion (NPCLIENT.11) + * + * + */ +int __stdcall NPCLIENT_NP_QueryVersion(unsigned short * version) +{ + dbg_report("QueryVersion request\n"); + *version=0x0500; + return 0; +} +/****************************************************************** + * NP_ReCenter (NPCLIENT.12) + * + * + */ +int __stdcall NPCLIENT_NP_ReCenter(void) +{ + dbg_report("ReCenter request\n"); + linuxtrack_recenter(); + return 0; +} + +/****************************************************************** + * NP_RegisterProgramProfileID (NPCLIENT.13) + * + * + */ +int __stdcall NPCLIENT_NP_RegisterProgramProfileID(unsigned short id) +{ + dbg_report("RegisterProgramProfileID request: %d\n", id); + game_desc_t gd; + if(game_data_get_desc(id, &gd)){ + printf("Application ID: %d - %s!!!\n", id, gd.name); + if(game_data_get_desc(id, &gd)){ + crypted = gd.encrypted; + if(gd.encrypted){ + printf("Table: %02X %02X %02X %02X %02X %02X %02X %02X\n", table[0],table[1],table[2],table[3],table[4], + table[5], table[6], table[7]); + table[0] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[1] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[2] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[3] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[4] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[5] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[6] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[7] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + } + } + if(linuxtrack_init(gd.name) != 0){ + return 1; + } + }else{ + if(!linuxtrack_init("Default")){ + return 1; + } + } + linuxtrack_suspend(); + return 0; +} +/****************************************************************** + * NP_RegisterWindowHandle (NPCLIENT.14) + * + * + */ +int __stdcall NPCLIENT_NP_RegisterWindowHandle(HWND hwnd) +{ + dbg_report("RegisterWindowHandle request: 0x%X\n", hwnd); + TRACE("((HWND)%p): stub\n",hwnd); + return (int) 0; +} +/****************************************************************** + * NP_RequestData (NPCLIENT.15) + * + * + */ +int __stdcall NPCLIENT_NP_RequestData(unsigned short req) +{ + dbg_report("RequestData request: %d\n", req); + TRACE("((unsigned short)%d): stub\n",req); + return (int) 0; +} +/****************************************************************** + * NP_SetParameter (NPCLIENT.16) + * + * + */ +int __stdcall NPCLIENT_NP_SetParameter(int arg0, int arg1) +{ + dbg_report("SetParameter request: %d %d\n", arg0, arg1); + TRACE("(void): stub\n"); + return (int) 0; +} +/****************************************************************** + * NP_StartCursor (NPCLIENT.17) + * + * + */ +int __stdcall NPCLIENT_NP_StartCursor(void) +{ + dbg_report("StartCursor request\n"); + TRACE("(void): stub\n"); + return (int) 0; +} +/****************************************************************** + * NP_StartDataTransmission (NPCLIENT.18) + * + * + */ +int __stdcall NPCLIENT_NP_StartDataTransmission(void) +{ + dbg_report("StartDataTransmission request\n"); + linuxtrack_wakeup(); + return 0; +} +/****************************************************************** + * NP_StopCursor (NPCLIENT.19) + * + * + */ +int __stdcall NPCLIENT_NP_StopCursor(void) +{ + dbg_report("StopCursor request\n"); + TRACE("(void): stub\n"); + return (int) 0; +} +/****************************************************************** + * NP_StopDataTransmission (NPCLIENT.20) + * + * + */ +int __stdcall NPCLIENT_NP_StopDataTransmission(void) +{ + dbg_report("StopDataTransmission request\n"); + linuxtrack_suspend(); + return 0; +} +/****************************************************************** + * NP_UnregisterWindowHandle (NPCLIENT.21) + * + * + */ +int __stdcall NPCLIENT_NP_UnregisterWindowHandle(void) +{ + dbg_report("UnregisterWindowHandle request\n"); + TRACE("(void): stub\n"); + return (int) 0; +} + diff --git a/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.c b/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.c new file mode 100644 index 00000000..f80a7d44 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.c @@ -0,0 +1,150 @@ +#define _GNU_SOURCE +#include <stdio.h> +#include <stdlib.h> +#include <mxml.h> +#include <stdbool.h> +#include <stdint.h> +#include <sys/stat.h> +#include <string.h> + +//First 5 bytes is MD5 hash of "NaturalPoint" +static uint8_t secret_key[] = {0x0e, 0x9a, 0x63, 0x71, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static uint8_t S[256] = {0}; + +static char *decoded = NULL; + +static mxml_node_t *xml = NULL; +static mxml_node_t *tree = NULL; + +static void ksa(uint8_t key[], size_t len) +{ + unsigned int i, j; + for(i = 0; i < 256; ++i){ + S[i] = i; + } + j = 0; + for(i = 0; i < 256; ++i){ + j = (j + S[i] + key[i % len]) % 256; + uint8_t tmp = S[i]; + S[i] = S[j]; + S[j] = tmp; + } +} + +static uint8_t rc4() +{ + static uint8_t i = 0; + static uint8_t j = 0; + + i += 1; + j += S[i]; + uint8_t tmp = S[i]; + S[i] = S[j]; + S[j] = tmp; + return S[(S[i] + S[j]) % 256]; +} + +static bool decrypt_file(const char *fname, bool from_update) +{ + uint32_t header[5]; + size_t datlen; + ksa(secret_key, 16); + FILE *inp; + struct stat fst; + + if((inp = fopen(fname, "rb")) == NULL){ + printf("Can't open input file '%s'", fname); + return false; + } + + if(fstat(fileno(inp), &fst) != 0){ + fclose(inp); + printf("Cannot stat file '%s'\n", fname); + return false; + } + + if(from_update){ + if(fread(&header, sizeof(uint32_t), 5, inp) != 5){ + fclose(inp); + printf("Can't read the header - file '%s' is less than 20 bytes long?\n", fname); + return false; + } + datlen = header[4]; + }else{ + datlen = fst.st_size; + } + if((decoded = (char *)malloc(datlen+1)) == NULL){ + printf("malloc failed!\n"); + return false; + } + memset(decoded, 0, datlen+1); + size_t i; + size_t len = fread(decoded, 1, datlen, inp); + (void) len; + for(i = 0; i < datlen; ++i) decoded[i] ^= rc4(); + fclose(inp); + + //inp = fopen("tmp.dump", "w"); + //fwrite(decoded, 1, datlen, inp); + //fclose(inp); + + return true; +} + +static bool game_data_init(const char *fname, bool from_update) +{ + static bool initialized = false; + if(initialized){ + return true; + } + if(!decrypt_file(fname, from_update)){ + printf("Error decrypting file!\n"); + return false; + } + xml = mxmlNewXML("1.0"); + tree = mxmlLoadString(xml, decoded, MXML_TEXT_CALLBACK); + return (tree != NULL); +} + +static void game_data_close() +{ + mxmlDelete(tree); + free(decoded); +} + +#define ltr_int_log_message(...) fprintf(stderr, __VA_ARGS__) + +bool get_game_data(const char *input_fname, const char *output_fname, bool from_update) +{ + FILE *outfile = NULL; + if((outfile = (output_fname ? fopen(output_fname, "w") : stdout)) == NULL){ + ltr_int_log_message("Can't open the output file '%s'!\n", output_fname); + return false; + } + if(!game_data_init(input_fname, from_update)){ + ltr_int_log_message("Can't process the data file '%s'!\n", input_fname); + return false; + } + + mxml_node_t *game; + const char *name; + const char *id; + for(game = mxmlFindElement(tree, tree, "Game", NULL, NULL, MXML_DESCEND); + game != NULL; + game = mxmlFindElement(game, tree, "Game", NULL, NULL, MXML_DESCEND)){ + name = mxmlElementGetAttr(game, "Name"); + id = mxmlElementGetAttr(game, "Id"); + + mxml_node_t *appid = mxmlFindElement(game, game, "ApplicationID", NULL, NULL, MXML_DESCEND); + if(appid == NULL){ + fprintf(outfile, "%s \"%s\"\n", id, name); + }else{ + fprintf(outfile, "%s \"%s\" (%s)\n", id, name, appid->child->value.text.string); + } + } + fclose(outfile); + game_data_close(); + return true; +} + +int main(int argc, char** argv) { return argc > 1 && get_game_data(argv[1], NULL, false); } diff --git a/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.h b/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.h new file mode 100644 index 00000000..b71f7a15 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/important-stuff/game_data.h @@ -0,0 +1,17 @@ +#ifndef GAME_DATA__H +#define GAME_DATA__H + +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + +bool get_game_data(const char *input_fname, const char *output_fname, bool from_update); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.am b/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.am new file mode 100644 index 00000000..e025209a --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.am @@ -0,0 +1,78 @@ +noinst_SCRIPTS = +if WINE_PLUGIN + noinst_SCRIPTS += Tester.exe +if WINE64 + noinst_SCRIPTS += Tester64.exe +endif #WINE64 +endif #WINE_PLUGIN + +if DARWIN + LDFLAGS += -Wl,-no_arch_warnings +else + LDFLAGS += -Wl,--no-warn-search-mismatch +endif + +CC = winegcc + +CXX = wineg++ + +SUFFIXES = .o .cpp .c .rc 64.o + +.cpp.o : + $(CXX) -c $(CXXFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS) -m32 -o $@ $< + +.cpp64.o : + $(CXX) -c $(CXXFLAGS) -o $@ $< + +.c64.o : + $(CC) -c $(CFLAGS) -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< + +CXXFLAGS += -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ +CFLAGS += -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ +RCFLAGS = -I @srcdir@ +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + + +Tester64.exe : main64.o rest64.o npifc64.o npview.o + wineg++ -g -o Tester64 -L. $(WINE64_LIBS) $(LDFLAGS) -Wall -Wextra $^ + +Tester.exe : main.o npview.o rest.o npifc.o + wineg++ -g -o Tester -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +main.o : main.cpp Makefile + +main64.o : main.cpp Makefile + +npview.o : npview.rc + +rest.o : rest.c rest.h Makefile + +rest64.o : rest.c rest.h Makefile + +npifc.o : npifc.c npifc.h Makefile + +npifc64.o : CFLAGS+="-DFOR_WIN64=1" +npifc64.o : npifc.c npifc.h Makefile + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +EXTRA_DIST = main.cpp npifc.c npifc.h resource.h rest.c rest.h + diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.in b/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.in new file mode 100644 index 00000000..cc49d754 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/Makefile.in @@ -0,0 +1,512 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@WINE_PLUGIN_TRUE@am__append_1 = Tester.exe +@WINE64_TRUE@@WINE_PLUGIN_TRUE@am__append_2 = Tester64.exe +@DARWIN_TRUE@am__append_3 = -Wl,-no_arch_warnings +@DARWIN_FALSE@am__append_4 = -Wl,--no-warn-search-mismatch +subdir = src/wine_bridge/tester +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/npview.rc.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = npview.rc +CONFIG_CLEAN_VPATH_FILES = +SCRIPTS = $(noinst_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON = @BISON@ +CC = winegcc +CFLAGS = @CFLAGS@ -g -I../.. -I../../.. -DHAVE_CONFIG_H \ + -I@srcdir@/../.. -I@top_builddir@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = wineg++ +CXXCPP = @CXXCPP@ +CXXFLAGS = @CXXFLAGS@ -g -DHAVE_CONFIG_H -I../../.. -I. \ + -I@srcdir@/../.. -I@top_builddir@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ $(am__append_3) $(am__append_4) +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIB32DIR = @LIB32DIR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENCV_CFLAGS = @OPENCV_CFLAGS@ +OPENCV_LIBS = @OPENCV_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +QMAKE_PATH = @QMAKE_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WINE64_LIBS = @WINE64_LIBS@ +WINE_LIBS = @WINE_LIBS@ +XPL_CPPFLAGS = @XPL_CPPFLAGS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +with_makensis = @with_makensis@ +with_wine64 = @with_wine64@ +noinst_SCRIPTS = $(am__append_1) $(am__append_2) +SUFFIXES = .o .cpp .c .rc 64.o +RCFLAGS = -I @srcdir@ +EXTRA_DIST = main.cpp npifc.c npifc.h resource.h rest.c rest.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .o .cpp .c .rc 64.o +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/tester/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/tester/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +npview.rc: $(top_builddir)/config.status $(srcdir)/npview.rc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-local + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + clean-local cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distclean-local distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am + + +.cpp.o : + $(CXX) -c $(CXXFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS) -m32 -o $@ $< + +.cpp64.o : + $(CXX) -c $(CXXFLAGS) -o $@ $< + +.c64.o : + $(CC) -c $(CFLAGS) -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + +Tester64.exe : main64.o rest64.o npifc64.o npview.o + wineg++ -g -o Tester64 -L. $(WINE64_LIBS) $(LDFLAGS) -Wall -Wextra $^ + +Tester.exe : main.o npview.o rest.o npifc.o + wineg++ -g -o Tester -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +main.o : main.cpp Makefile + +main64.o : main.cpp Makefile + +npview.o : npview.rc + +rest.o : rest.c rest.h Makefile + +rest64.o : rest.c rest.h Makefile + +npifc.o : npifc.c npifc.h Makefile + +npifc64.o : CFLAGS+="-DFOR_WIN64=1" +npifc64.o : npifc.c npifc.h Makefile + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/main.cpp b/facetracknoir/clientfiles/very-important-source-code/tester/main.cpp new file mode 100644 index 00000000..95ca0d9b --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/main.cpp @@ -0,0 +1,100 @@ +#define WIN32_LEAN_AND_MEAN + +#include <windows.h> +#include <stdio.h> +#include <stdint.h> +#include "resource.h" +#include "rest.h" +#include "npifc.h" + +HINSTANCE hInst; +UINT_PTR timer = 0; + +VOID CALLBACK TimerProcedure(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +{ + (void) uMsg; + (void) idEvent; + (void) dwTime; + tir_data_t td; + npifc_getdata(&td); + SetDlgItemInt(hwnd, IDC_PITCH, td.pitch, true); + SetDlgItemInt(hwnd, IDC_ROLL, td.roll, true); + SetDlgItemInt(hwnd, IDC_YAW, td.yaw, true); + + SetDlgItemInt(hwnd, IDC_X1, td.tx, true); + SetDlgItemInt(hwnd, IDC_Y1, td.ty, true); + SetDlgItemInt(hwnd, IDC_Z1, td.tz, true); + + SetDlgItemInt(hwnd, IDC_X2, td.padding[0], true); + SetDlgItemInt(hwnd, IDC_Y2, td.padding[1], true); + SetDlgItemInt(hwnd, IDC_Z2, td.padding[2], true); + SetDlgItemInt(hwnd, IDC_X3, td.padding[3], true); + SetDlgItemInt(hwnd, IDC_Y3, td.padding[4], true); + SetDlgItemInt(hwnd, IDC_Z3, td.padding[5], true); + SetDlgItemInt(hwnd, IDC_S, td.status, true); + SetDlgItemInt(hwnd, IDC_F, td.frame, true); +} + +BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + (void) lParam; + switch(uMsg) + { + case WM_INITDIALOG: + SetDlgItemInt(hwndDlg, IDC_APPID, 2307, true); + return TRUE; + + case WM_CLOSE: + EndDialog(hwndDlg, 0); + return TRUE; + + case WM_COMMAND: + switch(LOWORD(wParam)) + { + /* + * TODO: Add more control ID's, when needed. + */ + case IDQUIT: + npifc_close(); + EndDialog(hwndDlg, 0); + return TRUE; + case IDSTART: + int ok; + int num = GetDlgItemInt(hwndDlg, IDC_APPID, (BOOL*)&ok, false); + if(!ok){ + num = 2307; + } + game_desc_t gd; + if(timer != 0){ + KillTimer(hwndDlg, timer); + timer = 0; + } + if(game_data_get_desc(num, &gd)){ + printf("Application ID: %d - %s\n", num, gd.name); + if(npifc_init(hwndDlg, num)){ + timer = SetTimer(hwndDlg, 0, 50, TimerProcedure); + } + }else{ + printf("Unknown Application ID: %d\n", num); + } + break; + + } + } + + return FALSE; +} + + +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) +{ + (void) hPrevInstance; + (void) lpCmdLine; + (void) nShowCmd; + hInst = hInstance; + + // The user interface is a modal dialog box + return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DialogProc); +} + + diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/npifc.c b/facetracknoir/clientfiles/very-important-source-code/tester/npifc.c new file mode 100644 index 00000000..b036464e --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/npifc.c @@ -0,0 +1,302 @@ +#define _GNU_SOURCE +#include <stdio.h> +#include <stdint.h> +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include "npifc.h" +#include "rest.h" + + +tir_signature_t ts; +HMODULE npclient; +/* +typedef int (*NP_RegisterWindowHandle_t)(HWND hwnd); +typedef int (*NP_UnregisterWindowHandle_t)(void); +typedef int (*NP_RegisterProgramProfileID_t)(unsigned short id); +typedef int (*NP_QueryVersion_t)(unsigned short *version); +typedef int (*NP_RequestData_t)(unsigned short req); +typedef int (*NP_GetSignature_t)(tir_signature_t *sig); +typedef int (*NP_GetData_t)(tir_data_t *data); +typedef int (*NP_GetParameter_t)(void); +typedef int (*NP_SetParameter_t)(void); +typedef int (*NP_StartCursor_t)(void); +typedef int (*NP_StopCursor_t)(void); +typedef int (*NP_ReCenter_t)(void); +typedef int (*NP_StartDataTransmission_t)(void); +typedef int (*NP_StopDataTransmission_t)(void); +*/ +NP_RegisterWindowHandle_t NP_RegisterWindowHandle = NULL; +NP_UnregisterWindowHandle_t NP_UnregisterWindowHandle = NULL; +NP_RegisterProgramProfileID_t NP_RegisterProgramProfileID = NULL; +NP_QueryVersion_t NP_QueryVersion = NULL; +NP_RequestData_t NP_RequestData = NULL; +NP_GetSignature_t NP_GetSignature = NULL; +NP_GetData_t NP_GetData = NULL; +NP_GetParameter_t NP_GetParameter = NULL; +NP_SetParameter_t NP_SetParameter = NULL; +NP_StartCursor_t NP_StartCursor = NULL; +NP_StopCursor_t NP_StopCursor = NULL; +NP_ReCenter_t NP_ReCenter = NULL; +NP_StartDataTransmission_t NP_StartDataTransmission = NULL; +NP_StopDataTransmission_t NP_StopDataTransmission = NULL; + +bool crypted = false; + + + +unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +char *client_path() +{ + HKEY hkey = 0; + RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\NaturalPoint\\NATURALPOINT\\NPClient Location", 0, + KEY_QUERY_VALUE, &hkey); + if(!hkey){ + printf("Can't open registry key\n"); + return NULL; + } + + BYTE path[1024]; + DWORD buf_len = 1024; + LONG result = RegQueryValueEx(hkey, "Path", NULL, NULL, path, &buf_len); + char *full_path = NULL; + int res = -1; + if(result == ERROR_SUCCESS && buf_len > 0){ +#ifdef FOR_WIN64 + res = asprintf(&full_path, "%s/NPClient64.dll", path); +#else + res = asprintf(&full_path, "%s/NPClient.dll", path); +#endif + } + RegCloseKey(hkey); + if(res > 0){ + return full_path; + }else{ + return NULL; + } +} + +bool initialized = false; + +bool npifc_init(HWND wnd, int id) +{ + //table[] = {0xb3, 0x16, 0x36, 0xeb, 0xb9, 0x05, 0x4f, 0xa4}; + game_desc_t gd; + if(game_data_get_desc(id, &gd)){ + crypted = gd.encrypted; + if(gd.encrypted){ + table[0] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[1] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[2] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[3] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[4] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[5] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[6] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[7] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + } + } + printf("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + table[0], table[1], table[2], table[3], + table[4], table[5], table[6], table[7]); + + char *client = client_path(); + if(client == NULL){ + printf("Couldn't obtain client path!\n"); + return false; + } + npclient = LoadLibrary(client); + if(!npclient){ + printf("Can't load client %s\n", client); + return false; + } + + NP_RegisterWindowHandle = (NP_RegisterWindowHandle_t)GetProcAddress(npclient, "NP_RegisterWindowHandle"); + NP_UnregisterWindowHandle = (NP_UnregisterWindowHandle_t)GetProcAddress(npclient, "NP_UnregisterWindowHandle"); + NP_RegisterProgramProfileID = (NP_RegisterProgramProfileID_t)GetProcAddress(npclient, "NP_RegisterProgramProfileID"); + NP_QueryVersion = (NP_QueryVersion_t)GetProcAddress(npclient, "NP_QueryVersion"); + NP_RequestData = (NP_RequestData_t)GetProcAddress(npclient, "NP_RequestData"); + NP_GetSignature = (NP_GetSignature_t)GetProcAddress(npclient, "NP_GetSignature"); + NP_GetData = (NP_GetData_t)GetProcAddress(npclient, "NP_GetData"); + NP_GetParameter = (NP_GetParameter_t)GetProcAddress(npclient, "NP_GetParameter"); + NP_SetParameter = (NP_SetParameter_t)GetProcAddress(npclient, "NP_SetParameter"); + NP_StartCursor = (NP_StartCursor_t)GetProcAddress(npclient, "NP_StartCursor"); + NP_StopCursor = (NP_StopCursor_t)GetProcAddress(npclient, "NP_StopCursor"); + NP_ReCenter = (NP_ReCenter_t)GetProcAddress(npclient, "NP_ReCenter"); + NP_StartDataTransmission = (NP_StartDataTransmission_t)GetProcAddress(npclient, "NP_StartDataTransmission"); + NP_StopDataTransmission = (NP_StopDataTransmission_t)GetProcAddress(npclient, "NP_StopDataTransmission"); + if((NP_RegisterWindowHandle == NULL) || (NP_UnregisterWindowHandle == NULL) + || (NP_RegisterProgramProfileID == NULL) || (NP_QueryVersion == NULL) || (NP_RequestData == NULL) + || (NP_GetSignature == NULL) || (NP_GetData == NULL) || (NP_GetParameter == NULL) + || (NP_SetParameter == NULL) || (NP_StartCursor == NULL) || (NP_StopCursor == NULL) + || (NP_ReCenter == NULL) || (NP_StartDataTransmission == NULL) || (NP_StopDataTransmission == NULL)){ + printf("Couldn't bind all necessary functions!\n"); + return false; + } + tir_signature_t sig; + int res; + if((res = NP_GetSignature(&sig)) != 0){ + printf("Error retrieving signature! %d\n", res); + return false; + } + printf("Dll Sig:%s\nApp Sig2:%s\n", sig.DllSignature, sig.AppSignature); + NP_RegisterWindowHandle(wnd); + if(NP_RegisterProgramProfileID(id) != 0){ + printf("Couldn't register profile id!\n"); + return false; + } + printf("Program profile registered!\n"); + NP_RequestData(65535); + NP_StopCursor(); + NP_StartDataTransmission(); + initialized = true; + return true; +} + +void npifc_close() +{ + if(initialized){ + NP_StopDataTransmission(); + NP_StartCursor(); + NP_UnregisterWindowHandle(); + } + initialized = false; +} + +void c_encrypt(unsigned char buf[], unsigned int size, + unsigned char code_table[], unsigned int table_size) +{ + unsigned int table_ptr = 0; + unsigned char var = 0x88; + unsigned char tmp; + if((size <= 0) || (table_size <= 0) || + (buf == NULL) || (code_table == NULL)) + return; + do{ + tmp = buf[--size]; + buf[size] = tmp ^ code_table[table_ptr] ^ var; + var += size + tmp; + ++table_ptr; + if(table_ptr >= table_size){ + table_ptr -= table_size; + } + }while(size != 0); +} + + + +void decrypt(unsigned char buf[], unsigned int size, + unsigned char code_table[], unsigned int table_size) +{ + unsigned int table_ptr = 0; + unsigned char var = 0x88; + unsigned char tmp; + if((size <= 0) || (table_size <= 0) || + (buf == NULL) || (code_table == NULL)){ + return; + } + do{ + tmp = buf[--size]; + buf[size] = tmp ^ code_table[table_ptr] ^ var; + var += size + buf[size]; + ++table_ptr; + if(table_ptr >= table_size){ + table_ptr -= table_size; + } + }while(size != 0); +} + +unsigned int cksum(unsigned char buf[], unsigned int size) +{ + if((size == 0) || (buf == NULL)){ + return 0; + } + int rounds = size >> 2; + int rem = size % 4; + + int c = size; + int a0 = 0; + int a2 = 0; + + while(rounds != 0){ + a0 = *(short int*)buf; + a2 = *(short int*)(buf+2); + buf += 4; + c += a0; + a2 ^= (c << 5); + a2 <<= 11; + c ^= a2; + c += (c >> 11); + --rounds; + } + switch(rem){ + case 3: + a0 = *(short int*)buf; + a2 = *(signed char*)(buf+2); + c += a0; + a2 = (a2 << 2) ^ c; + c ^= (a2 << 16); + a2 = (c >> 11); + break; + case 2: + a2 = *(short int*)buf; + c += a2; + c ^= (c << 11); + a2 = (c >> 17); + break; + case 1: + a2 = *(signed char*)(buf); + c += a2; + c ^= (c << 10); + a2 = (c >> 1); + break; + default: + break; + } + if(rem != 0){ + c+=a2; + } + + c ^= (c << 3); + c += (c >> 5); + c ^= (c << 4); + c += (c >> 17); + c ^= (c << 25); + c += (c >> 6); + + return (unsigned int)c; +} + +int decode_frame(tir_data_t *td) +{ + //printf("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + // table[0], table[1], table[2], table[3], + // table[4], table[5], table[6], table[7]); + unsigned int csum; + decrypt((unsigned char*)td, sizeof(*td), table, sizeof(table)); + csum = td->cksum; + td->cksum = 0; + if(csum != cksum((unsigned char*)td, sizeof(*td))){ + printf("Problem with frame!\n"); + //int a0; + //printf("Dec: "); + //for(a0 = 0; a0 < (int)sizeof(tir_data_t); ++a0) + //{ + // printf("%02X", ((unsigned char *)td)[a0]); + //} + //printf("\n"); + //printf("Cksum: %04X vs computed: %04X\n", csum, cksum((unsigned char*)td, sizeof(*td))); + return -1; + } + //printf("Frame OK!\n"); + return 0; +} + +int npifc_getdata(tir_data_t *data) +{ + int res = NP_GetData(data); + if(crypted){ + decode_frame(data); + } + return res; +} + diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/npifc.h b/facetracknoir/clientfiles/very-important-source-code/tester/npifc.h new file mode 100644 index 00000000..d580e16d --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/npifc.h @@ -0,0 +1,66 @@ +#ifndef NPIFC__H +#define NPIFC__H + + +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + bool npifc_init(HWND wnd, int id); + void npifc_close(); + +#pragma pack(1) +typedef struct tir_data{ + short status; + short frame; + unsigned int cksum; + float roll, pitch, yaw; + float tx, ty, tz; + float padding[9]; +} tir_data_t; + +typedef struct tir_signature{ + char DllSignature[200]; + char AppSignature[200]; +} tir_signature_t; +#pragma pack(0) + +int npifc_getdata(tir_data_t *data); + +typedef int __stdcall (*NP_RegisterWindowHandle_t)(HWND hwnd); +typedef int __stdcall (*NP_UnregisterWindowHandle_t)(void); +typedef int __stdcall (*NP_RegisterProgramProfileID_t)(unsigned short id); +typedef int __stdcall (*NP_QueryVersion_t)(unsigned short *version); +typedef int __stdcall (*NP_RequestData_t)(unsigned short req); +typedef int __stdcall (*NP_GetSignature_t)(tir_signature_t *sig); +typedef int __stdcall (*NP_GetData_t)(tir_data_t *data); +typedef int __stdcall (*NP_GetParameter_t)(void); +typedef int __stdcall (*NP_SetParameter_t)(void); +typedef int __stdcall (*NP_StartCursor_t)(void); +typedef int __stdcall (*NP_StopCursor_t)(void); +typedef int __stdcall (*NP_ReCenter_t)(void); +typedef int __stdcall (*NP_StartDataTransmission_t)(void); +typedef int __stdcall (*NP_StopDataTransmission_t)(void); + +extern NP_RegisterWindowHandle_t NP_RegisterWindowHandle; +extern NP_UnregisterWindowHandle_t NP_UnregisterWindowHandle; +extern NP_RegisterProgramProfileID_t NP_RegisterProgramProfileID; +extern NP_QueryVersion_t NP_QueryVersion; +extern NP_RequestData_t NP_RequestData; +extern NP_GetSignature_t NP_GetSignature; +extern NP_GetData_t NP_GetData; +extern NP_GetParameter_t NP_GetParameter; +extern NP_SetParameter_t NP_SetParameter; +extern NP_StartCursor_t NP_StartCursor; +extern NP_StopCursor_t NP_StopCursor; +extern NP_ReCenter_t NP_ReCenter; +extern NP_StartDataTransmission_t NP_StartDataTransmission; +extern NP_StopDataTransmission_t NP_StopDataTransmission; + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/npview.rc.in b/facetracknoir/clientfiles/very-important-source-code/tester/npview.rc.in new file mode 100644 index 00000000..231002f1 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/npview.rc.in @@ -0,0 +1,49 @@ +// Generated by ResEdit 1.5.9 +// Copyright (C) 2006-2011 +// http://www.resedit.net + +#include <windows.h> +#include <commctrl.h> +#include <richedit.h> +#include "resource.h" + +#ifdef HAVE_CONFIG_H + #include "../../../config.h" +#endif + + + +// +// Dialog resources +// +//LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_DIALOG1 DIALOGEX 0, 0, 379, 124 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "NPTest v@PACKAGE_VERSION@" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + DEFPUSHBUTTON "Quit", IDQUIT, 262, 102, 50, 14 + DEFPUSHBUTTON "Start", IDSTART, 7, 102, 50, 14 + EDITTEXT IDC_PITCH, 32, 32, 51, 14, ES_AUTOHSCROLL + LTEXT "Pitch", IDC_STATIC, 11, 34, 20, 8, SS_LEFT + LTEXT "Yaw", IDC_STATIC, 11, 59, 20, 8, SS_LEFT + EDITTEXT IDC_YAW, 32, 57, 51, 14, ES_AUTOHSCROLL + LTEXT "Roll", IDC_STATIC, 11, 84, 20, 8, SS_LEFT + EDITTEXT IDC_ROLL, 32, 82, 51, 14, ES_AUTOHSCROLL + LTEXT "X", IDC_STATIC, 101, 35, 6, 8, SS_LEFT + EDITTEXT IDC_X1, 112, 32, 51, 14, ES_AUTOHSCROLL + LTEXT "Y", IDC_STATIC, 101, 60, 6, 8, SS_LEFT + EDITTEXT IDC_Y1, 112, 57, 51, 14, ES_AUTOHSCROLL + LTEXT "Z", IDC_STATIC, 101, 85, 6, 8, SS_LEFT + EDITTEXT IDC_Z1, 112, 82, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_X2, 172, 32, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Y2, 172, 57, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Z2, 172, 82, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_X3, 232, 32, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Y3, 232, 57, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Z3, 232, 82, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_S, 292, 32, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_F, 292, 57, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_APPID, 32, 12, 51, 12, ES_AUTOHSCROLL + LTEXT "ID", IDC_STATIC, 17, 14, 8, 8, SS_LEFT +} diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/resource.h b/facetracknoir/clientfiles/very-important-source-code/tester/resource.h new file mode 100644 index 00000000..328d9cb7 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/resource.h @@ -0,0 +1,23 @@ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_DIALOG1 100 +#define IDQUIT 1002 +#define IDSTART 1003 +#define IDC_APPID 1016 +#define IDC_PITCH 1017 +#define IDC_YAW 1018 +#define IDC_ROLL 1019 +#define IDC_X1 1020 +#define IDC_X2 1021 +#define IDC_X3 1022 +#define IDC_Y1 1023 +#define IDC_Y2 1024 +#define IDC_Y3 1025 +#define IDC_Z1 1026 +#define IDC_Z2 1027 +#define IDC_Z3 1028 +#define IDC_S 1029 +#define IDC_F 1030 + diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/rest.c b/facetracknoir/clientfiles/very-important-source-code/tester/rest.c new file mode 120000 index 00000000..663c21a9 --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/rest.c @@ -0,0 +1 @@ +../client/rest.c \ No newline at end of file diff --git a/facetracknoir/clientfiles/very-important-source-code/tester/rest.h b/facetracknoir/clientfiles/very-important-source-code/tester/rest.h new file mode 120000 index 00000000..6dca182a --- /dev/null +++ b/facetracknoir/clientfiles/very-important-source-code/tester/rest.h @@ -0,0 +1 @@ +../client/rest.h \ No newline at end of file diff --git a/facetracknoir/plugin-qt-api.hpp b/facetracknoir/plugin-qt-api.hpp index 0e2e3c32..1697d8e7 100644 --- a/facetracknoir/plugin-qt-api.hpp +++ b/facetracknoir/plugin-qt-api.hpp @@ -56,7 +56,6 @@ struct ITracker virtual ~ITracker() = 0; virtual void StartTracker( QFrame* frame ) = 0; virtual void GetHeadPoseData(double *data) = 0; - virtual int preferredHz() { return 200; } }; inline ITracker::~ITracker() {} diff --git a/facetracknoir/pose.hpp b/facetracknoir/pose.hpp new file mode 100644 index 00000000..ec9faaa3 --- /dev/null +++ b/facetracknoir/pose.hpp @@ -0,0 +1,66 @@ +#pragma once + +#include <utility> +#include <algorithm> +#include "./quat.hpp" +#include "./plugin-api.hpp" + +class Pose { +private: + static constexpr double pi = 3.141592653; + static constexpr double d2r = pi/180.0; + static constexpr double r2d = 180./pi; + + double axes[6]; +public: + Pose() : axes {0,0,0, 0,0,0 } {} + + inline operator double*() { return axes; } + inline operator const double*() const { return axes; } + + inline double& operator()(int i) { return axes[i]; } + inline double operator()(int i) const { return axes[i]; } + + Quat quat() const + { + return Quat(axes[Yaw]*d2r, axes[Pitch]*d2r, axes[Roll]*d2r); + } + + static Pose fromQuat(const Quat& q) + { + Pose ret; + q.to_euler_degrees(ret(Yaw), ret(Pitch), ret(Roll)); + return ret; + } + + Pose operator-(const Pose& B) const + { + const Quat q = (quat() * B.quat().inv()); + Pose ret = fromQuat(q); + for (int i = TX; i < Yaw; i++) + ret(i) = B(i); + return ret; + } + + Pose operator+(const Pose& B) const + { + const Quat q = (quat() * B.quat().inv()); + Pose ret = fromQuat(q); + for (int i = TX; i < Yaw; i++) + ret(i) = B(i); + return ret; + } + + Pose operator|(const Pose& replacement) const + { + Pose ret = *this; + for (int i = 0; i < 6; i++) + { + static constexpr double eps = 1e-5; + // NB replace zero-valued elements with argument's + if (std::abs(ret(i)) < eps) + ret(i) = replacement(i); + } + return ret; + } +}; diff --git a/facetracknoir/quat.hpp b/facetracknoir/quat.hpp index 1e268963..6d777b28 100644 --- a/facetracknoir/quat.hpp +++ b/facetracknoir/quat.hpp @@ -14,7 +14,7 @@ private: static constexpr double r2d = 180./pi; double a,b,c,d; // quaternion coefficients public: - Quat() : a(1.0),b(0.0),c(0.0),d(0.0) {} + Quat() : a(1.),b(0.),c(0.),d(0.) {} Quat(double yaw, double pitch, double roll) { from_euler_rads(yaw, pitch, roll); } Quat(double a, double b, double c, double d) : a(a),b(b),c(c),d(d) {} @@ -27,12 +27,12 @@ public: void from_euler_rads(double yaw, double pitch, double roll) { - double sin_phi = sin(roll/2.0); - double cos_phi = cos(roll/2.0); - double sin_the = sin(pitch/2.0); - double cos_the = cos(pitch/2.0); - double sin_psi = sin(yaw/2.0); - double cos_psi = cos(yaw/2.0); + const double sin_phi = sin(roll/2.); + const double cos_phi = cos(roll/2.); + const double sin_the = sin(pitch/2.); + const double cos_the = cos(pitch/2.); + const double sin_psi = sin(yaw/2.); + const double cos_psi = cos(yaw/2.); a = cos_phi*cos_the*cos_psi + sin_phi*sin_the*sin_psi; b = sin_phi*cos_the*cos_psi - cos_phi*sin_the*sin_psi; @@ -42,9 +42,9 @@ public: void to_euler_rads(double& yaw, double& pitch, double& roll) const { - roll = atan2(2.0*(a*b + c*d), 1.0 - 2.0*(b*b + c*c)); - pitch = asin(2.0*(a*c - b*d)); - yaw = atan2(2.0*(a*d + b*c), 1.0 - 2.0*(c*c + d*d)); + roll = atan2(2.*(a*b + c*d), 1. - 2.*(b*b + c*c)); + pitch = asin(2.*(a*c - b*d)); + yaw = atan2(2.*(a*d + b*c), 1. - 2.*(c*c + d*d)); } void to_euler_degrees(double& yaw, double& pitch, double& roll) const @@ -59,8 +59,8 @@ public: { const Quat& A = *this; return Quat(A.a*B.a - A.b*B.b - A.c*B.c - A.d*B.d, // quaternion multiplication - A.a*B.b + A.b*B.a + A.c*B.d - A.d*B.c, - A.a*B.c - A.b*B.d + A.c*B.a + A.d*B.b, - A.a*B.d + A.b*B.c - A.c*B.b + A.d*B.a); + A.a*B.b + A.b*B.a + A.c*B.d - A.d*B.c, + A.a*B.c - A.b*B.d + A.c*B.a + A.d*B.b, + A.a*B.d + A.b*B.c - A.c*B.b + A.d*B.a); } }; diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 0c2d289f..e1f86294 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -12,8 +12,7 @@ * originally written by Wim Vriend. */ -#include "tracker.h" -#include "facetracknoir.h" +#include "./tracker.h" #include <opencv2/core/core.hpp> #include <cmath> #include <algorithm> @@ -49,9 +48,10 @@ void Tracker::get_curve(double pos, double& out, Mapping& axis) { static void t_compensate(double* input, double* output, bool rz) { - const auto H = input[Yaw] * M_PI / -180; - const auto P = input[Pitch] * M_PI / -180; - const auto B = input[Roll] * M_PI / 180; + static constexpr double pi = 3.141592653; + const auto H = input[Yaw] * pi / -180; + const auto P = input[Pitch] * pi / -180; + const auto B = input[Roll] * pi / 180; const auto cosH = cos(H); const auto sinH = sin(H); @@ -83,15 +83,10 @@ static void t_compensate(double* input, double* output, bool rz) } void Tracker::run() { - T6DOF pose_offset, unstopped_pose; + Pose pose_offset, unstopped_pose; double newpose[6] = {0}; - int sleep_ms = 15; - - if (Libraries->pTracker) - sleep_ms = std::min(sleep_ms, 1000 / Libraries->pTracker->preferredHz()); - - qDebug() << "tracker Hz:" << 1000 / sleep_ms; + const int sleep_ms = 3; #if defined(_WIN32) (void) timeBeginPeriod(1); @@ -104,9 +99,7 @@ void Tracker::run() { if (should_quit) break; - if (Libraries->pTracker) { - Libraries->pTracker->GetHeadPoseData(newpose); - } + Libraries->pTracker->GetHeadPoseData(newpose); { QMutexLocker foo(&mtx); @@ -130,15 +123,12 @@ void Tracker::run() { if (enabledp) unstopped_pose = raw_6dof; - { + if (Libraries->pFilter) + Libraries->pFilter->FilterHeadPoseData(unstopped_pose, output_pose); + else + output_pose = unstopped_pose; - if (Libraries->pFilter) - Libraries->pFilter->FilterHeadPoseData(unstopped_pose, output_pose); - else - output_pose = unstopped_pose; - - output_pose = output_pose - pose_offset; - } + output_pose = output_pose - pose_offset; for (int i = 0; i < 6; i++) get_curve(output_pose(i), output_pose(i), m(i)); @@ -147,9 +137,7 @@ void Tracker::run() { if (s.tcomp_p) t_compensate(output_pose, output_pose, s.tcomp_tz); - if (Libraries->pProtocol) { - Libraries->pProtocol->sendHeadposeToGame(output_pose); - } + Libraries->pProtocol->sendHeadposeToGame(output_pose); } const long q = std::max(0L, sleep_ms * 1000L - std::max(0L, t.elapsed())); diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index 3d9a3858..8a4ecb1f 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -10,14 +10,15 @@ #include <QPainterPath> #include <QDebug> #include <QMutex> -#include "plugin-support.h" -#include "mappings.hpp" +#include "./plugin-support.h" +#include "./mappings.hpp" +#include "./pose.hpp" #include <vector> #include <atomic> #include <qfunctionconfigurator/functionconfig.h> -#include "tracker_types.h" +#include "./quat.hpp" #include "facetracknoir/main-settings.hpp" #include "facetracknoir/options.h" #include "facetracknoir/timer.hpp" @@ -30,7 +31,7 @@ private: // XXX can be const-cast when functionconfig const-correct -sh 20141004 Mappings& m; Timer t; - T6DOF output_pose, raw_6dof; + Pose output_pose, raw_6dof; std::atomic<bool> centerp; std::atomic<bool> enabledp; std::atomic<bool> should_quit; diff --git a/facetracknoir/tracker_types.h b/facetracknoir/tracker_types.h deleted file mode 100644 index 02aacdcf..00000000 --- a/facetracknoir/tracker_types.h +++ /dev/null @@ -1,66 +0,0 @@ -#pragma once - -#include <utility> -#include <algorithm> -#include "./quat.hpp" -#include "./plugin-api.hpp" - -struct T6DOF { -private: - static constexpr double pi = 3.141592653; - static constexpr double d2r = pi/180.0; - static constexpr double r2d = 180./pi; - - double axes[6]; -public: - T6DOF() : axes {0,0,0, 0,0,0 } {} - - inline operator double*() { return axes; } - inline operator const double*() const { return axes; } - - inline double& operator()(int i) { return axes[i]; } - inline double operator()(int i) const { return axes[i]; } - - Quat quat() const - { - return Quat(axes[Yaw]*d2r, axes[Pitch]*d2r, axes[Roll]*d2r); - } - - static T6DOF fromQuat(const Quat& q) - { - T6DOF ret; - q.to_euler_rads(ret(Yaw), ret(Pitch), ret(Roll)); - return ret; - } - - T6DOF operator-(const T6DOF& B) const - { - const Quat q = (quat() * B.quat().inv()); - T6DOF ret = fromQuat(q); - for (int i = TX; i < Yaw; i++) - ret(i) = B(i); - return ret; - } - - T6DOF operator+(const T6DOF& B) const - { - const Quat q = (quat() * B.quat().inv()); - T6DOF ret = fromQuat(q); - for (int i = TX; i < Yaw; i++) - ret(i) = B(i); - return ret; - } - - T6DOF operator|(const T6DOF& replacement) const - { - T6DOF ret = *this; - for (int i = 0; i < 6; i++) - { - static constexpr double eps = 1e-5; - // NB replace zero-valued elements with argument's - if (std::abs(ret(i)) < eps) - ret(i) = replacement(i); - } - return ret; - } -}; diff --git a/freetrackclient/build-msvc.sh b/freetrackclient/build-msvc.sh new file mode 100644 index 00000000..4fd303a0 --- /dev/null +++ b/freetrackclient/build-msvc.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +export PATH="/bin:/usr/bin:$PATH" + +case "$(uname -s 2>/dev/null)" in +*CYG*|*MING*|'') wrap= ;; +*) wrap=wine ;; +esac + +c_src=".\\freetrackclient.c" +c_bin="..\\facetracknoir\\clientfiles\\freetrackclient.dll" +opt_link="-nologo -LTCG -SAFESEH:NO -OPT:REF,ICF" +opt_cl=" +-nologo -arch:SSE2 -fp:fast -EHc -EH- -GL -GR- -GS- -Gw -LD -MT -O1 +-Ob2 -Og -Oi -Ot -Oy -QIfist -volatile:iso -Ze -Fe\"${c_bin}\" +" + +MSVC="VS140COMNTOOLS" + +test -z "$MSVC" && { + echo "uh-oh, no MSVC" >&2 + exit 1 +} + +sep="\&" + +cd "$(dirname "$0")" + +$wrap cmd.exe /C $(echo " + del /F /Q $c_bin $sep + call %${MSVC}%/vsvars32.bat 2>nul >nul $sep + cl $opt_cl $c_src -link $opt_link + " | tr '\n' ' ') diff --git a/freetrackclient/freetrackclient.c b/freetrackclient/freetrackclient.c index 200242b9..4bc39d67 100644 --- a/freetrackclient/freetrackclient.c +++ b/freetrackclient/freetrackclient.c @@ -18,6 +18,10 @@ * * created by the FreeTrack developers. * */ +#ifndef _MSC_VER +# warning "expect misnamed symbols" +#endif + #pragma GCC diagnostic ignored "-Wvariadic-macros" #pragma GCC diagnostic ignored "-Wunused-parameter" diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index a1e15721..1787ef2b 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -5,16 +5,15 @@ * copyright notice and this permission notice appear in all copies. */ +#include <vector> +#include <cstdio> +#include <cmath> +#include <QMutexLocker> +#include "./include/markerdetector.h" #include "ftnoir_tracker_aruco.h" -#include "ui_aruco-trackercontrols.h" #include "facetracknoir/plugin-api.hpp" -#include <QMutexLocker> -#include "include/markerdetector.h" #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> -#include <vector> -#include <cstdio> -#include <cmath> #if defined(_WIN32) # undef NOMINMAX diff --git a/ftnoir_tracker_aruco/include/aruco.h b/ftnoir_tracker_aruco/include/aruco.h index 8ea583a8..569b95fb 100644 --- a/ftnoir_tracker_aruco/include/aruco.h +++ b/ftnoir_tracker_aruco/include/aruco.h @@ -26,12 +26,12 @@ The views and conclusions contained in the software and documentation are those authors and should not be interpreted as representing official policies, either expressed or implied, of Rafael Muñoz Salinas. - - + + \mainpage ArUco: Augmented Reality library from the University of Cordoba -ArUco is a minimal C++ library for detection of Augmented Reality markers based on OpenCv exclusively. +ArUco is a minimal C++ library for detection of Augmented Reality markers based on OpenCv exclusively. It is an educational project to show student how to detect augmented reality markers and it is provided under BSD license. @@ -54,11 +54,11 @@ Aruco allows the possibility to employ board. Boards are markers composed by an The library comes with five applications that will help you to learn how to use the library: - aruco_create_marker: which creates marker and saves it in a jpg file you can print. - - aruco_simple : simple test aplication that detects the markers in a image + - aruco_simple : simple test aplication that detects the markers in a image - aruco_test: this is the main application for detection. It reads images either from the camera of from a video and detect markers. Additionally, if you provide the intrinsics of the camera(obtained by OpenCv calibration) and the size of the marker in meters, the library calculates the marker intrinsics so that you can easily create your AR applications. - aruco_test_gl: shows how to use the library AR applications using OpenGL for rendering - aruco_create_board: application that helps you to create a board - - aruco_simple_board: simple test aplication that detects a board of markers in a image + - aruco_simple_board: simple test aplication that detects a board of markers in a image - aruco_test_board: application that detects boards - aruco_test_board_gl: application that detects boards and uses OpenGL to draw @@ -66,7 +66,7 @@ The library comes with five applications that will help you to learn how to use The ArUco library contents are divided in two main directories. The src directory, which contains the library itself. And the utils directory which contains the applications. -The library main classes are: +The library main classes are: - aruco::CameraParameters: represent the information of the camera that captures the images. Here you must set the calibration info. - aruco::Marker: which represent a marker detected in the image - aruco::MarkerDetector: that is in charge of deteting the markers in a image Detection is done by simple calling the member funcion ArMarkerDetector::detect(). Additionally, the classes contain members to create the required matrices for rendering using OpenGL. See aruco_test_gl for details @@ -101,33 +101,34 @@ The library has been compiled using MinGW and codeblocks. Below I describe the b -# Download the source code and compile it using cmake and codeblocks. Note: install the library in C:\ if you want it to be easily detected by cmake afterwards - step 4) aruco -# Download and decompress. - -# Open cmake gui application and set the path to the main library directory and also set a path where the project is going to be built. + -# Open cmake gui application and set the path to the main library directory and also set a path where the project is going to be built. -# Generate the codeblock project. -# Open the project with codeblock and compile then, install. The programs will be probably generated into the bin directory OpenGL: by default, the mingw version installed has not the glut library. So, the opengl programs are not compiled. If you want to compile with OpenGL support, you must install glut, or prefereably freeglut. -Thus, - - Download the library (http://www.martinpayne.me.uk/software/development/GLUT/freeglut-MinGW.zip) for mingw. - - Decompress in a directory X. +Thus, + - Download the library (http://www.martinpayne.me.uk/software/development/GLUT/freeglut-MinGW.zip) for mingw. + - Decompress in a directory X. - Then, rerun cmake setting the variable GLU_PATH to that directory (>cmake .. -DGLUT_PATH="C:\X") - Finally, recompile and test. Indeed, you should move the freeglut.dll to the directory with the binaries or to any other place in the PATH. CONCLUSION: Move to Linux, things are simpler :P - -\section Testing + +\section Testing For testing the applications, the library provides videos and the corresponding camera parameters of these videos. Into the directories you will find information on how to run the examples. - + \section Final Notes - REQUIREMENTS: OpenCv >= 2.1.0. and OpenGL for (aruco_test_gl and aruco_test_board_gl) - CONTACT: Rafael Munoz-Salinas: rmsalinas@uco.es - This libary is free software and come with no guaratee! - + */ #include "markerdetector.h" +#include "boarddetector.h" #include "cvdrawingutils.h" diff --git a/ftnoir_tracker_aruco/include/arucofidmarkers.h b/ftnoir_tracker_aruco/include/arucofidmarkers.h index 15eb8e4c..7dad4672 100644 --- a/ftnoir_tracker_aruco/include/arucofidmarkers.h +++ b/ftnoir_tracker_aruco/include/arucofidmarkers.h @@ -31,6 +31,7 @@ or implied, of Rafael Muñoz Salinas. #include <opencv2/core/core.hpp> #include "exports.h" #include "marker.h" +#include "board.h" namespace aruco { class ARUCO_EXPORTS FiducidalMarkers { @@ -79,7 +80,7 @@ public: * @param gridSize grid layout (numer of sqaures in x and Y) * @param MarkerSize size of markers sides in pixels * @param MarkerDistance distance between the markers - * @param TInfo output + * @param TInfo output * @param excludedIds set of ids excluded from the board */ static cv::Mat createBoardImage( cv::Size gridSize,int MarkerSize,int MarkerDistance, BoardConfiguration& TInfo ,vector<int> *excludedIds=NULL ) throw (cv::Exception); @@ -88,24 +89,24 @@ public: /**Creates a printable image of a board in chessboard_like manner * @param gridSize grid layout (numer of sqaures in x and Y) * @param MarkerSize size of markers sides in pixels - * @param TInfo output + * @param TInfo output * @param setDataCentered indicates if the center is set at the center of the board. Otherwise it is the left-upper corner - * + * */ static cv::Mat createBoardImage_ChessBoard( cv::Size gridSize,int MarkerSize, BoardConfiguration& TInfo ,bool setDataCentered=true ,vector<int> *excludedIds=NULL) throw (cv::Exception); - /**Creates a printable image of a board in a frame fashion + /**Creates a printable image of a board in a frame fashion * @param gridSize grid layout (numer of sqaures in x and Y) * @param MarkerSize size of markers sides in pixels * @param MarkerDistance distance between the markers - * @param TInfo output + * @param TInfo output * @param setDataCentered indicates if the center is set at the center of the board. Otherwise it is the left-upper corner - * + * */ static cv::Mat createBoardImage_Frame( cv::Size gridSize,int MarkerSize,int MarkerDistance, BoardConfiguration& TInfo ,bool setDataCentered=true,vector<int> *excludedIds=NULL ) throw (cv::Exception); private: - + static vector<int> getListOfValidMarkersIds_random(int nMarkers,vector<int> *excluded) throw (cv::Exception); static cv::Mat rotate(const cv::Mat & in); static int hammDistMarker(cv::Mat bits); diff --git a/ftnoir_tracker_aruco/include/board.h b/ftnoir_tracker_aruco/include/board.h new file mode 100644 index 00000000..c1d79292 --- /dev/null +++ b/ftnoir_tracker_aruco/include/board.h @@ -0,0 +1,168 @@ +/***************************** +Copyright 2011 Rafael Muñoz Salinas. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are +permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of + conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list + of conditions and the following disclaimer in the documentation and/or other materials + provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those of the +authors and should not be interpreted as representing official policies, either expressed +or implied, of Rafael Muñoz Salinas. +********************************/ +#ifndef _Aruco_board_h +#define _Aruco_board_h +#include <opencv2/opencv.hpp> +#include <string> +#include <vector> +#include "exports.h" +#include "marker.h" +using namespace std; +namespace aruco { +/** + * 3d representation of a marker + */ +struct ARUCO_EXPORTS MarkerInfo:public vector<cv::Point3f> { + MarkerInfo() {} + MarkerInfo(int _id) {id=_id; } + MarkerInfo(const MarkerInfo&MI): vector<cv::Point3f>(MI){id=MI.id; } + MarkerInfo & operator=(const MarkerInfo&MI){ + vector<cv::Point3f> ::operator=(MI); + id=MI.id; + return *this; + } + int id;//maker id +}; + +/**\brief This class defines a board with several markers. + * A Board contains several markers so that they are more robustly detected. + * + * In general, a board is a set of markers. So BoardConfiguration is only a list + * of the id of the markers along with the position of their corners. + * + * The position of the corners can be specified either in pixels (in a non-specific size) or in meters. + * The first is the typical case in which you generate the image of board and the print it. Since you do not know in advance the real + * size of the markers, their corners are specified in pixels, and then, the translation to meters can be made once you know the real size. + * + * On the other hand, you may want to have the information of your boards in meters. The BoardConfiguration allows you to do so. + * + * The point is in the mInfoType variable. It can be either PIX or METERS according to your needs. + * +*/ + + +class ARUCO_EXPORTS BoardConfiguration: public vector<MarkerInfo> +{ + friend class Board; +public: + enum MarkerInfoType {NONE=-1,PIX=0,METERS=1};//indicates if the data in MakersInfo is expressed in meters or in pixels so as to do conversion internally + //variable indicates if the data in MakersInfo is expressed in meters or in pixels so as to do conversion internally + int mInfoType; + /** + */ + BoardConfiguration(); + + /** + */ + BoardConfiguration(const BoardConfiguration &T); + + /** + */ + BoardConfiguration & operator=(const BoardConfiguration &T); + /**Saves the board info to a file + */ + void saveToFile(string sfile)throw (cv::Exception); + /**Reads board info from a file + */ + void readFromFile(string sfile)throw (cv::Exception); + /**Indicates if the corners are expressed in meters + */ + bool isExpressedInMeters()const { + return mInfoType==METERS; + } + /**Indicates if the corners are expressed in meters + */ + bool isExpressedInPixels()const { + return mInfoType==PIX; + } + /**Returns the index of the marker with id indicated, if is in the list + */ + int getIndexOfMarkerId(int id)const; + /**Returns the Info of the marker with id specified. If not in the set, throws exception + */ + const MarkerInfo& getMarkerInfo(int id)const throw (cv::Exception); + /**Set in the list passed the set of the ids + */ + void getIdList(vector<int> &ids,bool append=true)const; +private: + /**Saves the board info to a file + */ + void saveToFile(cv::FileStorage &fs)throw (cv::Exception); + /**Reads board info from a file + */ + void readFromFile(cv::FileStorage &fs)throw (cv::Exception); +}; + +/** +*/ +class ARUCO_EXPORTS Board:public vector<Marker> +{ + +public: + BoardConfiguration conf; + //matrices of rotation and translation respect to the camera + cv::Mat Rvec,Tvec; + /** + */ + Board() + { + Rvec.create(3,1,CV_32FC1); + Tvec.create(3,1,CV_32FC1); + for (int i=0;i<3;i++) + Tvec.at<float>(i,0)=Rvec.at<float>(i,0)=-999999; + } + + /**Given the extrinsic camera parameters returns the GL_MODELVIEW matrix for opengl. + * Setting this matrix, the reference corrdinate system will be set in this board + */ + void glGetModelViewMatrix(double modelview_matrix[16])throw(cv::Exception); + + /** + * Returns position vector and orientation quaternion for an Ogre scene node or entity. + * Use: + * ... + * Ogre::Vector3 ogrePos (position[0], position[1], position[2]); + * Ogre::Quaternion ogreOrient (orientation[0], orientation[1], orientation[2], orientation[3]); + * mySceneNode->setPosition( ogrePos ); + * mySceneNode->setOrientation( ogreOrient ); + * ... + */ + void OgreGetPoseParameters( double position[3], double orientation[4] )throw(cv::Exception); + + + /**Save this from a file + */ + void saveToFile(string filePath)throw(cv::Exception); + /**Read this from a file + */ + void readFromFile(string filePath)throw(cv::Exception); + +}; +} + +#endif diff --git a/ftnoir_tracker_aruco/include/boarddetector.h b/ftnoir_tracker_aruco/include/boarddetector.h new file mode 100644 index 00000000..a0ee2361 --- /dev/null +++ b/ftnoir_tracker_aruco/include/boarddetector.h @@ -0,0 +1,139 @@ +/***************************** +Copyright 2011 Rafael Muñoz Salinas. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are +permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of + conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list + of conditions and the following disclaimer in the documentation and/or other materials + provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those of the +authors and should not be interpreted as representing official policies, either expressed +or implied, of Rafael Muñoz Salinas. +********************************/ +#ifndef _Aruco_BoardDetector_H +#define _Aruco_BoardDetector_H +#include <opencv2/opencv.hpp> +#include "exports.h" +#include "board.h" +#include "cameraparameters.h" +#include "markerdetector.h" +using namespace std; + +namespace aruco +{ + +/**\brief This class detects AR boards + * Version 1.2 + * There are two modes for board detection. + * First, the old way. (You first detect markers with MarkerDetector and then call to detect in this class. + * + * Second: New mode, marker detection is included in the class + * \code + + CameraParameters CP; + CP.readFromFile(path_cp) + BoardConfiguration BC; + BC.readFromFile(path_bc); + BoardDetector BD; + BD.setParams(BC,CP); //or only BD.setParams(BC) + //capture image + cv::Mat im; + capture_image(im); + + float prob=BD.detect(im); + if (prob>0.3) + CvDrawingUtils::draw3DAxis(im,BD.getDetectedBoard(),CP); + + \endcode + * +*/ +class ARUCO_EXPORTS BoardDetector +{ +public: + /** See discussion in @see enableRotateXAxis. + * Do not change unless you know what you are doing + */ + BoardDetector(bool setYPerperdicular=true); + + + /** + * Use if you plan to let this class to perform marker detection too + */ + void setParams(const BoardConfiguration &bc,const CameraParameters &cp, float markerSizeMeters=-1); + void setParams(const BoardConfiguration &bc); + /** + * Detect markers, and then, look for the board indicated in setParams() + * @return value indicating the likelihood of having found the marker + */ + float detect(const cv::Mat &im)throw (cv::Exception); + /**Returns a reference to the board detected + */ + Board & getDetectedBoard(){return _boardDetected;} + /**Returns a reference to the internal marker detector + */ + MarkerDetector &getMarkerDetector(){return _mdetector;} + /**Returns the vector of markers detected + */ + vector<Marker> &getDetectedMarkers(){return _vmarkers;} + + + //ALTERNATIVE DETECTION METHOD, BASED ON MARKERS PREVIOUSLY DETECTED + + /** Given the markers detected, determines if there is the board passed + * @param detectedMarkers result provided by aruco::ArMarkerDetector + * @param BConf the board you want to see if is present + * @param Bdetected output information of the detected board + * @param camMatrix camera matrix with intrinsics + * @param distCoeff camera distorsion coeff + * @param camMatrix intrinsic camera information. + * @param distCoeff camera distorsion coefficient. If set Mat() if is assumed no camera distorion + * @param markerSizeMeters size of the marker sides expressed in meters + * @return value indicating the likelihood of having found the marker + */ + float detect(const vector<Marker> &detectedMarkers,const BoardConfiguration &BConf, Board &Bdetected, cv::Mat camMatrix=cv::Mat(),cv::Mat distCoeff=cv::Mat(), float markerSizeMeters=-1 )throw (cv::Exception); + float detect(const vector<Marker> &detectedMarkers,const BoardConfiguration &BConf, Board &Bdetected,const CameraParameters &cp, float markerSizeMeters=-1 )throw (cv::Exception); + + + /** + * By default, the Y axis is set to point up. However this is not the default + * operation mode of opencv, which produces the Z axis pointing up instead. + * So, to achieve this change, we have to rotate the X axis. + */ + void setYPerperdicular(bool enable){_setYPerperdicular=enable;} + + + + +private: + void rotateXAxis(cv::Mat &rotation); + bool _setYPerperdicular; + + //-- Functionality to detect markers inside + bool _areParamsSet; + BoardConfiguration _bconf; + Board _boardDetected; + float _markerSize; + CameraParameters _camParams; + MarkerDetector _mdetector;//internal markerdetector + vector<Marker> _vmarkers;//markers detected in the call to : float detect(const cv::Mat &im); + +}; + +}; +#endif + diff --git a/ftnoir_tracker_aruco/include/cvdrawingutils.h b/ftnoir_tracker_aruco/include/cvdrawingutils.h index 24bfe630..ff67242f 100644 --- a/ftnoir_tracker_aruco/include/cvdrawingutils.h +++ b/ftnoir_tracker_aruco/include/cvdrawingutils.h @@ -33,13 +33,20 @@ namespace aruco { /**\brief A set of functions to draw in opencv images */ - class ARUCO_EXPORTS CvDrawingUtils - { - public: - static void draw3dAxis(cv::Mat &Image,Marker &m,const CameraParameters &CP); - static void draw3dCube(cv::Mat &Image,Marker &m,const CameraParameters &CP); - }; -} + class ARUCO_EXPORTS CvDrawingUtils + { + public: + + static void draw3dAxis(cv::Mat &Image,Marker &m,const CameraParameters &CP); + + static void draw3dCube(cv::Mat &Image,Marker &m,const CameraParameters &CP); + + static void draw3dAxis(cv::Mat &Image,Board &m,const CameraParameters &CP); + + static void draw3dCube(cv::Mat &Image,Board &m,const CameraParameters &CP); + + }; +}; #endif diff --git a/ftnoir_tracker_aruco/include/exports.h b/ftnoir_tracker_aruco/include/exports.h index 044a1367..aaeb94e4 100644 --- a/ftnoir_tracker_aruco/include/exports.h +++ b/ftnoir_tracker_aruco/include/exports.h @@ -37,9 +37,9 @@ or implied, of Rafael Muñoz Salinas. #if (defined WIN32 || defined _WIN32 || defined WINCE) && defined DSO_EXPORTS - #define ARUCO_EXPORTS __declspec(dllexport) __attribute__((visibility ("default"))) + #define ARUCO_EXPORTS __declspec(dllexport) #else - #define ARUCO_EXPORTS __attribute__((visibility ("default"))) + #define ARUCO_EXPORTS __attribute__ ((visibility ("default"))) #endif diff --git a/ftnoir_tracker_aruco/include/markerdetector.h b/ftnoir_tracker_aruco/include/markerdetector.h index a4656527..6f489c34 100644 --- a/ftnoir_tracker_aruco/include/markerdetector.h +++ b/ftnoir_tracker_aruco/include/markerdetector.h @@ -52,13 +52,11 @@ class ARUCO_EXPORTS MarkerDetector contour=M.contour; idx=M.idx; } - MarkerCandidate operator=(const MarkerCandidate &M){ - if (this == &M) - return *this; + MarkerCandidate & operator=(const MarkerCandidate &M){ (*(Marker*)this)=(*(Marker*)&M); contour=M.contour; idx=M.idx; - return M; + return *this; } vector<cv::Point> contour;//all the points of its contour @@ -69,11 +67,11 @@ public: /** * See */ - MarkerDetector() {} + MarkerDetector(); /** */ - ~MarkerDetector() {} + ~MarkerDetector(); /**Detects the markers in the image passed * @@ -353,5 +351,9 @@ private: void draw(cv::Mat out,const std::vector<Marker> &markers ); }; -} + + + + +}; #endif diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h index 1e4c6683..672efa28 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h @@ -13,11 +13,10 @@ struct settings { class Hydra_Tracker : public ITracker { public: - Hydra_Tracker(); + Hydra_Tracker(); ~Hydra_Tracker(); void StartTracker(QFrame *) override; void GetHeadPoseData(double *data) override; - int preferredHz() override { return 250; } volatile bool should_quit; private: settings s; @@ -28,23 +27,23 @@ class TrackerControls: public QWidget, public ITrackerDialog { Q_OBJECT public: - explicit TrackerControls(); + explicit TrackerControls(); void registerTracker(ITracker *) {} void unRegisterTracker() {} private: settings s; - Ui::UIHydraControls ui; + Ui::UIHydraControls ui; private slots: - void doOK(); - void doCancel(); + void doOK(); + void doCancel(); }; class FTNoIR_TrackerDll : public Metadata { public: - void getFullName(QString *strToBeFilled); - void getShortName(QString *strToBeFilled); - void getDescription(QString *strToBeFilled); - void getIcon(QIcon *icon); + void getFullName(QString *strToBeFilled); + void getShortName(QString *strToBeFilled); + void getDescription(QString *strToBeFilled); + void getIcon(QIcon *icon); }; diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index eb21f7bc..158229a6 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -25,15 +25,14 @@ struct settings { class Rift_Tracker : public ITracker { public: - Rift_Tracker(); + Rift_Tracker(); ~Rift_Tracker() override; void StartTracker(QFrame *) override; void GetHeadPoseData(double *data) override; - int preferredHz() override { return 250; } volatile bool should_quit; protected: - void run(); // qthread override run method + void run(); // qthread override run method private: double old_yaw; @@ -45,32 +44,32 @@ class TrackerControls: public QWidget, public ITrackerDialog { Q_OBJECT public: - explicit TrackerControls(); + explicit TrackerControls(); void registerTracker(ITracker *) {} - void unRegisterTracker() {} + void unRegisterTracker() {} private: - Ui::UIRiftControls ui; + Ui::UIRiftControls ui; settings s; private slots: - void doOK(); - void doCancel(); + void doOK(); + void doCancel(); }; class FTNoIR_TrackerDll : public Metadata { public: - FTNoIR_TrackerDll(); - ~FTNoIR_TrackerDll(); - void getFullName(QString *strToBeFilled); - void getShortName(QString *strToBeFilled); - void getDescription(QString *strToBeFilled); - void getIcon(QIcon *icon); + FTNoIR_TrackerDll(); + ~FTNoIR_TrackerDll(); + void getFullName(QString *strToBeFilled); + void getShortName(QString *strToBeFilled); + void getDescription(QString *strToBeFilled); + void getIcon(QIcon *icon); private: - QString trackerFullName; // Trackers' name and description - QString trackerShortName; - QString trackerDescription; + QString trackerFullName; // Trackers' name and description + QString trackerShortName; + QString trackerDescription; }; -- cgit v1.2.3 From f78f4b73325a9df11c80bc191f735650006bd635 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 5 Oct 2014 20:25:40 +0200 Subject: retab only --- qfunctionconfigurator/functionconfig.cpp | 108 +++++++++++++++---------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index f39562c1..7c4aaaab 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -35,51 +35,51 @@ float Map::getValue(float x) { QMutexLocker foo(&_mutex); int x2 = (int) (std::min<float>(std::max<float>(x, -360), 360) * MEMOIZE_PRECISION); float ret = getValueInternal(x2); - last_input_value.setX(x); - last_input_value.setY(ret); - return ret; + last_input_value.setX(x); + last_input_value.setY(ret); + return ret; } bool Map::getLastPoint(QPointF& point ) { QMutexLocker foo(&_mutex); - point = last_input_value; - return activep; + point = last_input_value; + return activep; } float Map::getValueInternal(int x) { float sign = x < 0 ? -1 : 1; - x = x < 0 ? -x : x; + x = x < 0 ? -x : x; float ret; int sz = data.size(); - if (sz == 0) - ret = 0; - else if (x < 0) - ret = 0; - else if (x < sz && x >= 0) - ret = data[x]; - else - ret = data[sz - 1]; - return ret * sign; + if (sz == 0) + ret = 0; + else if (x < 0) + ret = 0; + else if (x < sz && x >= 0) + ret = data[x]; + else + ret = data[sz - 1]; + return ret * sign; } static __inline QPointF ensureInBounds(QList<QPointF> points, int i) { - int siz = points.size(); - if (siz == 0 || i < 0) - return QPointF(0, 0); - if (siz > i) - return points[i]; - return points[siz - 1]; + int siz = points.size(); + if (siz == 0 || i < 0) + return QPointF(0, 0); + if (siz > i) + return points[i]; + return points[siz - 1]; } static bool sortFn(const QPointF& one, const QPointF& two) { - return one.x() < two.x(); + return one.x() < two.x(); } void Map::reload() { - if (input.size()) - qStableSort(input.begin(), input.end(), sortFn); + if (input.size()) + qStableSort(input.begin(), input.end(), sortFn); - if (input.size()) { + if (input.size()) { data = std::vector<float>(MEMOIZE_PRECISION * input[input.size() - 1].x()); const int sz = data.size(); @@ -87,7 +87,7 @@ void Map::reload() { for (int i = 0; i < sz; i++) data[i] = -1; - for (int k = 0; k < input[0].x() * MEMOIZE_PRECISION; k++) { + for (int k = 0; k < input[0].x() * MEMOIZE_PRECISION; k++) { if (k < sz) data[k] = input[0].y() * k / (input[0].x() * MEMOIZE_PRECISION); } @@ -120,7 +120,7 @@ void Map::reload() { if (x >= 0 && x < sz) data[x] = y; } - } + } float last = 0; for (int i = 0; i < sz; i++) @@ -129,7 +129,7 @@ void Map::reload() { data[i] = last; last = data[i]; } - } + } } void Map::removePoint(int i) { @@ -143,8 +143,8 @@ void Map::removePoint(int i) { void Map::addPoint(QPointF pt) { QMutexLocker foo(&_mutex); - input.append(pt); - reload(); + input.append(pt); + reload(); } void Map::movePoint(int idx, QPointF pt) { @@ -159,42 +159,42 @@ void Map::movePoint(int idx, QPointF pt) { const QList<QPointF> Map::getPoints() { QMutexLocker foo(&_mutex); // NB can't pass by reference - return input; + return input; } void Map::loadSettings(QSettings& settings, const QString& title) { QMutexLocker foo(&_mutex); QPointF newPoint; - QList<QPointF> points; - settings.beginGroup(QString("Curves-%1").arg(title)); - + QList<QPointF> points; + settings.beginGroup(QString("Curves-%1").arg(title)); + int max = settings.value("point-count", 0).toInt(); - for (int i = 0; i < max; i++) { - newPoint = QPointF(settings.value(QString("point-%1-x").arg(i), 0).toFloat(), - settings.value(QString("point-%1-y").arg(i), 0).toFloat()); - if (newPoint.x() > max_x) { - newPoint.setX(max_x); - } - if (newPoint.y() > max_y) { - newPoint.setY(max_y); - } - points.append(newPoint); - } + for (int i = 0; i < max; i++) { + newPoint = QPointF(settings.value(QString("point-%1-x").arg(i), 0).toFloat(), + settings.value(QString("point-%1-y").arg(i), 0).toFloat()); + if (newPoint.x() > max_x) { + newPoint.setX(max_x); + } + if (newPoint.y() > max_y) { + newPoint.setY(max_y); + } + points.append(newPoint); + } settings.endGroup(); - input = points; - reload(); + input = points; + reload(); } void Map::saveSettings(QSettings& settings, const QString& title) { QMutexLocker foo(&_mutex); - settings.beginGroup(QString("Curves-%1").arg(title)); - int max = input.size(); - settings.setValue("point-count", max); - for (int i = 0; i < max; i++) { - settings.setValue(QString("point-%1-x").arg(i), input[i].x()); - settings.setValue(QString("point-%1-y").arg(i), input[i].y()); + settings.beginGroup(QString("Curves-%1").arg(title)); + int max = input.size(); + settings.setValue("point-count", max); + for (int i = 0; i < max; i++) { + settings.setValue(QString("point-%1-x").arg(i), input[i].x()); + settings.setValue(QString("point-%1-y").arg(i), input[i].y()); } for (int i = max; true; i++) @@ -205,5 +205,5 @@ void Map::saveSettings(QSettings& settings, const QString& title) { settings.remove(x); settings.remove(QString("point-%1-y").arg(i)); } - settings.endGroup(); + settings.endGroup(); } -- cgit v1.2.3 From 921853c7443060d21e18909ba806a859f8af86a5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 5 Oct 2014 20:37:09 +0200 Subject: mapping was set to nonsense when exceeded spline bounds --- qfunctionconfigurator/functionconfig.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index 7c4aaaab..99b6d871 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -14,8 +14,9 @@ #include <QtAlgorithms> #include <QtAlgorithms> #include <QSettings> -#include <cmath> #include <QPixmap> +#include <cmath> +#include <algorithm> void Map::setTrackingActive(bool blnActive) { @@ -48,18 +49,14 @@ bool Map::getLastPoint(QPointF& point ) { float Map::getValueInternal(int x) { float sign = x < 0 ? -1 : 1; - x = x < 0 ? -x : x; + x = fabs(x); float ret; int sz = data.size(); - if (sz == 0) - ret = 0; - else if (x < 0) - ret = 0; - else if (x < sz && x >= 0) - ret = data[x]; - else - ret = data[sz - 1]; - return ret * sign; + if (sz == 0) + ret = 0; + else + ret = std::max(std::min(x, sz-1), 0); + return ret * sign; } static __inline QPointF ensureInBounds(QList<QPointF> points, int i) { -- cgit v1.2.3 From 1e10164eb7b66988e0404890239af7b7c1543395 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 5 Oct 2014 20:37:32 +0200 Subject: whitespace only --- qfunctionconfigurator/functionconfig.cpp | 72 ++++++++++++++++---------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index 99b6d871..69522da9 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -36,15 +36,15 @@ float Map::getValue(float x) { QMutexLocker foo(&_mutex); int x2 = (int) (std::min<float>(std::max<float>(x, -360), 360) * MEMOIZE_PRECISION); float ret = getValueInternal(x2); - last_input_value.setX(x); - last_input_value.setY(ret); - return ret; + last_input_value.setX(x); + last_input_value.setY(ret); + return ret; } bool Map::getLastPoint(QPointF& point ) { QMutexLocker foo(&_mutex); - point = last_input_value; - return activep; + point = last_input_value; + return activep; } float Map::getValueInternal(int x) { @@ -73,12 +73,13 @@ static bool sortFn(const QPointF& one, const QPointF& two) { } void Map::reload() { - if (input.size()) - qStableSort(input.begin(), input.end(), sortFn); + if (input.size()) + qStableSort(input.begin(), input.end(), sortFn); - if (input.size()) { + if (input.size()) + { data = std::vector<float>(MEMOIZE_PRECISION * input[input.size() - 1].x()); - + const int sz = data.size(); for (int i = 0; i < sz; i++) @@ -117,7 +118,7 @@ void Map::reload() { if (x >= 0 && x < sz) data[x] = y; } - } + } float last = 0; for (int i = 0; i < sz; i++) @@ -126,7 +127,7 @@ void Map::reload() { data[i] = last; last = data[i]; } - } + } } void Map::removePoint(int i) { @@ -156,42 +157,43 @@ void Map::movePoint(int idx, QPointF pt) { const QList<QPointF> Map::getPoints() { QMutexLocker foo(&_mutex); // NB can't pass by reference - return input; + return input; } void Map::loadSettings(QSettings& settings, const QString& title) { QMutexLocker foo(&_mutex); QPointF newPoint; + QList<QPointF> points; + settings.beginGroup(QString("Curves-%1").arg(title)); - QList<QPointF> points; - settings.beginGroup(QString("Curves-%1").arg(title)); - int max = settings.value("point-count", 0).toInt(); - for (int i = 0; i < max; i++) { - newPoint = QPointF(settings.value(QString("point-%1-x").arg(i), 0).toFloat(), - settings.value(QString("point-%1-y").arg(i), 0).toFloat()); - if (newPoint.x() > max_x) { - newPoint.setX(max_x); - } - if (newPoint.y() > max_y) { - newPoint.setY(max_y); - } - points.append(newPoint); - } + for (int i = 0; i < max; i++) { + newPoint = QPointF(settings.value(QString("point-%1-x").arg(i), 0).toFloat(), + settings.value(QString("point-%1-y").arg(i), 0).toFloat()); + if (newPoint.x() > max_x) { + newPoint.setX(max_x); + } + if (newPoint.y() > max_y) { + newPoint.setY(max_y); + } + points.append(newPoint); + } + settings.endGroup(); - input = points; - reload(); + input = points; + reload(); } void Map::saveSettings(QSettings& settings, const QString& title) { QMutexLocker foo(&_mutex); - settings.beginGroup(QString("Curves-%1").arg(title)); - int max = input.size(); - settings.setValue("point-count", max); - for (int i = 0; i < max; i++) { - settings.setValue(QString("point-%1-x").arg(i), input[i].x()); - settings.setValue(QString("point-%1-y").arg(i), input[i].y()); + settings.beginGroup(QString("Curves-%1").arg(title)); + int max = input.size(); + settings.setValue("point-count", max); + + for (int i = 0; i < max; i++) { + settings.setValue(QString("point-%1-x").arg(i), input[i].x()); + settings.setValue(QString("point-%1-y").arg(i), input[i].y()); } for (int i = max; true; i++) @@ -202,5 +204,5 @@ void Map::saveSettings(QSettings& settings, const QString& title) { settings.remove(x); settings.remove(QString("point-%1-y").arg(i)); } - settings.endGroup(); + settings.endGroup(); } -- cgit v1.2.3 From 7581608afa596e3ab64fa312361fccf5cc409450 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 5 Oct 2014 20:47:32 +0200 Subject: cleanup some useless logic --- qfunctionconfigurator/functionconfig.cpp | 4 ++-- qfunctionconfigurator/functionconfig.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index 69522da9..6db3b55f 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -34,7 +34,7 @@ Map::Map() : float Map::getValue(float x) { QMutexLocker foo(&_mutex); - int x2 = (int) (std::min<float>(std::max<float>(x, -360), 360) * MEMOIZE_PRECISION); + int x2 = x * (double) MEMOIZE_PRECISION; float ret = getValueInternal(x2); last_input_value.setX(x); last_input_value.setY(ret); @@ -55,7 +55,7 @@ float Map::getValueInternal(int x) { if (sz == 0) ret = 0; else - ret = std::max(std::min(x, sz-1), 0); + ret = data[std::max(std::min(x, sz-1), 0)]; return ret * sign; } diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h index ccfd1ba3..7d21fd63 100644 --- a/qfunctionconfigurator/functionconfig.h +++ b/qfunctionconfigurator/functionconfig.h @@ -17,10 +17,10 @@ #include "../facetracknoir/plugin-api.hpp" #include "../facetracknoir/qcopyable-mutex.hpp" -#define MEMOIZE_PRECISION 100 class OPENTRACK_EXPORT Map { private: + static constexpr long MEMOIZE_PRECISION = 25; void reload(); float getValueInternal(int x); -- cgit v1.2.3 From 2b3cb1d774812ea0a1a1dae1edfc9b5717095ce3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 5 Oct 2014 20:58:54 +0200 Subject: allow for 180 pitch --- facetracknoir/ftnoir_curves.ui | 138 ----------------------------------------- facetracknoir/mappings.hpp | 2 +- 2 files changed, 1 insertion(+), 139 deletions(-) diff --git a/facetracknoir/ftnoir_curves.ui b/facetracknoir/ftnoir_curves.ui index 7d6671aa..07e7b6ca 100644 --- a/facetracknoir/ftnoir_curves.ui +++ b/facetracknoir/ftnoir_curves.ui @@ -54,15 +54,6 @@ <height>260</height> </rect> </property> - <property name="maxInputEGU" stdset="0"> - <number>180</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>180</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>5</number> - </property> <property name="colorBezier" stdset="0"> <color> <red>255</red> @@ -100,15 +91,6 @@ <height>260</height> </rect> </property> - <property name="maxInputEGU" stdset="0"> - <number>180</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>180</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>5</number> - </property> <property name="colorBezier" stdset="0"> <color> <red>255</red> @@ -138,18 +120,6 @@ <height>260</height> </rect> </property> - <property name="maxInputEGU" stdset="0"> - <number>90</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>90</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>10</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>2</number> - </property> <property name="colorBezier" stdset="0"> <color> <red>0</red> @@ -187,18 +157,6 @@ <height>260</height> </rect> </property> - <property name="maxInputEGU" stdset="0"> - <number>90</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>90</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>10</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>2</number> - </property> <property name="colorBezier" stdset="0"> <color> <red>0</red> @@ -228,18 +186,6 @@ <height>260</height> </rect> </property> - <property name="maxInputEGU" stdset="0"> - <number>180</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>180</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>5</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>1</number> - </property> <property name="colorBezier" stdset="0"> <color> <red>0</red> @@ -277,18 +223,6 @@ <height>260</height> </rect> </property> - <property name="maxInputEGU" stdset="0"> - <number>180</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>180</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>5</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>1</number> - </property> <property name="colorBezier" stdset="0"> <color> <red>0</red> @@ -318,18 +252,6 @@ <height>260</height> </rect> </property> - <property name="maxInputEGU" stdset="0"> - <number>100</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>100</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>28</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>2</number> - </property> <property name="colorBezier" stdset="0"> <color> <red>255</red> @@ -367,18 +289,6 @@ <height>260</height> </rect> </property> - <property name="maxInputEGU" stdset="0"> - <number>100</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>100</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>28</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>2</number> - </property> <property name="colorBezier" stdset="0"> <color> <red>255</red> @@ -408,18 +318,6 @@ <height>260</height> </rect> </property> - <property name="maxInputEGU" stdset="0"> - <number>100</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>100</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>28</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>2</number> - </property> <property name="colorBezier" stdset="0"> <color> <red>255</red> @@ -457,18 +355,6 @@ <height>260</height> </rect> </property> - <property name="maxInputEGU" stdset="0"> - <number>100</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>100</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>28</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>2</number> - </property> <property name="colorBezier" stdset="0"> <color> <red>255</red> @@ -498,18 +384,6 @@ <height>260</height> </rect> </property> - <property name="maxInputEGU" stdset="0"> - <number>100</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>100</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>28</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>2</number> - </property> <property name="colorBezier" stdset="0"> <color> <red>0</red> @@ -547,18 +421,6 @@ <height>260</height> </rect> </property> - <property name="maxInputEGU" stdset="0"> - <number>100</number> - </property> - <property name="maxOutputEGU" stdset="0"> - <number>100</number> - </property> - <property name="pixPerEGU_Input" stdset="0"> - <number>28</number> - </property> - <property name="pixPerEGU_Output" stdset="0"> - <number>2</number> - </property> <property name="colorBezier" stdset="0"> <color> <red>0</red> diff --git a/facetracknoir/mappings.hpp b/facetracknoir/mappings.hpp index 4dae7a90..a3e53450 100644 --- a/facetracknoir/mappings.hpp +++ b/facetracknoir/mappings.hpp @@ -44,7 +44,7 @@ public: Mapping("ty","ty_alt", 100, 100, 100, 100, *opts[TY]), Mapping("tz","tz_alt", 100, 100, 100, 100, *opts[TZ]), Mapping("rx", "rx_alt", 180, 180, 180, 180, *opts[Yaw]), - Mapping("ry", "ry_alt", 90, 90, 90, 90, *opts[Pitch]), + Mapping("ry", "ry_alt", 180, 180, 180, 180, *opts[Pitch]), Mapping("rz", "rz_alt", 180, 180, 180, 180, *opts[Roll]) } {} -- cgit v1.2.3 From 613baa7e9473ced982ac7933f4007349d41d79d7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 5 Oct 2014 21:02:29 +0200 Subject: fix typo --- facetracknoir/pose.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/facetracknoir/pose.hpp b/facetracknoir/pose.hpp index ec9faaa3..d925c0a8 100644 --- a/facetracknoir/pose.hpp +++ b/facetracknoir/pose.hpp @@ -44,7 +44,7 @@ public: Pose operator+(const Pose& B) const { - const Quat q = (quat() * B.quat().inv()); + const Quat q = quat() * B.quat(); Pose ret = fromQuat(q); for (int i = TX; i < Yaw; i++) ret(i) = B(i); @@ -56,7 +56,7 @@ public: Pose ret = *this; for (int i = 0; i < 6; i++) { - static constexpr double eps = 1e-5; + static constexpr double eps = 1e-3; // NB replace zero-valued elements with argument's if (std::abs(ret(i)) < eps) ret(i) = replacement(i); -- cgit v1.2.3 From 1956932bbf0f26c2bdbf89abfe44cc3e00ff7e7a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 5 Oct 2014 21:37:57 +0200 Subject: tracker: cleanup --- facetracknoir/tracker.cpp | 89 ++++++++++++++++++++++++----------------------- facetracknoir/tracker.h | 1 + 2 files changed, 46 insertions(+), 44 deletions(-) diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index e1f86294..504cd003 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -46,7 +46,7 @@ void Tracker::get_curve(double pos, double& out, Mapping& axis) { out += axis.opts.zero; } -static void t_compensate(double* input, double* output, bool rz) +void Tracker::t_compensate(const double* input, double* output, bool rz) { static constexpr double pi = 3.141592653; const auto H = input[Yaw] * pi / -180; @@ -72,14 +72,14 @@ static void t_compensate(double* input, double* output, bool rz) cosH * cosP, }; - cv::Mat rmat(3, 3, CV_64F, foo); - const cv::Mat tvec(3, 1, CV_64F, input); - cv::Mat ret = rmat * tvec; + const cv::Matx33d rmat(foo); + const cv::Vec3d tvec(input); + const cv::Vec3d ret = rmat * tvec; const int max = !rz ? 3 : 2; for (int i = 0; i < max; i++) - output[i] = ret.at<double>(i); + output[i] = ret(i); } void Tracker::run() { @@ -92,58 +92,59 @@ void Tracker::run() { (void) timeBeginPeriod(1); #endif - for (;;) + while (!should_quit) { t.start(); - if (should_quit) - break; - Libraries->pTracker->GetHeadPoseData(newpose); + Pose final_raw, final_mapped; + + for (int i = 0; i < 6; i++) { - QMutexLocker foo(&mtx); + auto& axis = m(i); + int k = axis.opts.src; + if (k < 0 || k >= 6) + continue; + // not really raw, after axis remap -sh + final_raw(i) = newpose[k]; + } + + if (centerp) { + centerp = false; + pose_offset = final_raw; + } + + { + if (enabledp) + unstopped_pose = final_raw; + + if (Libraries->pFilter) + Libraries->pFilter->FilterHeadPoseData(unstopped_pose, final_mapped); + else + final_mapped = unstopped_pose; + + final_mapped = final_mapped - pose_offset; for (int i = 0; i < 6; i++) - { - auto& axis = m(i); - int k = axis.opts.src; - if (k < 0 || k >= 6) - continue; - // not really raw, after axis remap -sh - raw_6dof(i) = newpose[k]; - } - - if (centerp) { - centerp = false; - pose_offset = raw_6dof; - } - - { - if (enabledp) - unstopped_pose = raw_6dof; - - if (Libraries->pFilter) - Libraries->pFilter->FilterHeadPoseData(unstopped_pose, output_pose); - else - output_pose = unstopped_pose; - - output_pose = output_pose - pose_offset; - - for (int i = 0; i < 6; i++) - get_curve(output_pose(i), output_pose(i), m(i)); - } - - if (s.tcomp_p) - t_compensate(output_pose, output_pose, s.tcomp_tz); - - Libraries->pProtocol->sendHeadposeToGame(output_pose); + get_curve(final_mapped(i), final_mapped(i), m(i)); } - const long q = std::max(0L, sleep_ms * 1000L - std::max(0L, t.elapsed())); + if (s.tcomp_p) + t_compensate(final_mapped, final_mapped, s.tcomp_tz); + + Libraries->pProtocol->sendHeadposeToGame(final_mapped); + + { + QMutexLocker foo(&mtx); + output_pose = final_mapped; + raw_6dof = final_raw; + } + const long q = 1000L * std::max(0L, sleep_ms - t.elapsed_ms()); usleep(q); } + #if defined(_WIN32) (void) timeEndPeriod(1); #endif diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index 8a4ecb1f..5f9639b2 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -37,6 +37,7 @@ private: std::atomic<bool> should_quit; static void get_curve(double pos, double& out, Mapping& axis); + static void t_compensate(const double* input, double* output, bool rz); protected: void run() override; public: -- cgit v1.2.3 From 2cdc070555e717c99a287b90d8b9ffbf9e69b6cd Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 5 Oct 2014 21:38:08 +0200 Subject: nix cmath --- qfunctionconfigurator/functionconfig.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index 6db3b55f..4c52b6eb 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -15,7 +15,6 @@ #include <QtAlgorithms> #include <QSettings> #include <QPixmap> -#include <cmath> #include <algorithm> void Map::setTrackingActive(bool blnActive) @@ -49,7 +48,7 @@ bool Map::getLastPoint(QPointF& point ) { float Map::getValueInternal(int x) { float sign = x < 0 ? -1 : 1; - x = fabs(x); + x = std::abs((double) x); float ret; int sz = data.size(); if (sz == 0) -- cgit v1.2.3 From 42f13fed362891c5ca8f4d6f7ed070cbd09dd846 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 5 Oct 2014 21:38:43 +0200 Subject: nix market pitch, aruco credit doesn't fit anymore sadly --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 249 +++++++++++--------------- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 34 +--- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 4 +- 3 files changed, 117 insertions(+), 170 deletions(-) diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index e5654bd5..240ef5f8 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>636</width> - <height>368</height> + <width>560</width> + <height>214</height> </rect> </property> <property name="sizePolicy"> @@ -22,16 +22,17 @@ <property name="windowTitle"> <string>Tracker settings</string> </property> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="0" column="0" rowspan="2" colspan="2"> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string/> - </property> - <property name="flat"> - <bool>true</bool> + <layout class="QGridLayout" name="gridLayout"> + <item row="1" column="1"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> </property> - <layout class="QGridLayout" name="gridLayout"> + </widget> + </item> + <item row="0" column="0"> + <widget class="QFrame" name="frame"> + <layout class="QGridLayout" name="gridLayout_3"> <item row="0" column="0"> <widget class="QLabel" name="label"> <property name="text"> @@ -41,6 +42,12 @@ </item> <item row="0" column="1"> <widget class="QDoubleSpinBox" name="cameraFOV"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="locale"> <locale language="English" country="UnitedStates"/> </property> @@ -64,6 +71,12 @@ </item> <item row="1" column="1"> <widget class="QComboBox" name="cameraFPS"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <item> <property name="text"> <string notr="true">Default</string> @@ -99,7 +112,14 @@ </widget> </item> <item row="2" column="1"> - <widget class="QComboBox" name="cameraName"/> + <widget class="QComboBox" name="cameraName"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> </item> <item row="3" column="0"> <widget class="QLabel" name="label_4"> @@ -110,6 +130,12 @@ </item> <item row="3" column="1"> <widget class="QComboBox" name="resolution"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <item> <property name="text"> <string>640x480</string> @@ -146,154 +172,93 @@ </property> </widget> </item> - <item row="5" column="0"> - <widget class="QLabel" name="label_9"> + </layout> + </widget> + </item> + <item row="0" column="1"> + <widget class="QFrame" name="frame_2"> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="1" column="0"> + <widget class="QLabel" name="label_5"> <property name="text"> - <string>Marker pitch</string> + <string>Head X</string> </property> </widget> </item> - <item row="5" column="1"> - <widget class="QDoubleSpinBox" name="marker_pitch"> + <item row="2" column="1"> + <widget class="QDoubleSpinBox" name="cy"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="minimum"> - <double>-180.000000000000000</double> + <double>-10000.000000000000000</double> </property> <property name="maximum"> - <double>180.000000000000000</double> + <double>10000.000000000000000</double> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QDoubleSpinBox" name="cx"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimum"> + <double>-10000.000000000000000</double> + </property> + <property name="maximum"> + <double>10000.000000000000000</double> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QDoubleSpinBox" name="cz"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimum"> + <double>-10000.000000000000000</double> + </property> + <property name="maximum"> + <double>10000.000000000000000</double> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Head Z </string> </property> </widget> </item> - <item row="6" column="1"> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>Head center</string> + <item row="2" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Head Y</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QPushButton" name="btn_calibrate"> + <property name="text"> + <string>Calibrate</string> </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="4" column="1"> - <widget class="QPushButton" name="btn_calibrate"> - <property name="text"> - <string>Calibrate</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>TX</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QDoubleSpinBox" name="cy"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimum"> - <double>-10000.000000000000000</double> - </property> - <property name="maximum"> - <double>10000.000000000000000</double> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QDoubleSpinBox" name="cx"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimum"> - <double>-10000.000000000000000</double> - </property> - <property name="maximum"> - <double>10000.000000000000000</double> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QDoubleSpinBox" name="cz"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimum"> - <double>-10000.000000000000000</double> - </property> - <property name="maximum"> - <double>10000.000000000000000</double> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>TZ</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>TY</string> - </property> - </widget> - </item> - </layout> </widget> </item> </layout> </widget> </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_6"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string><html><head/><body><p>The ARUCO Library has been developed by the Ava group of the Univeristy of Cordoba, Spain</p><p>Rafael Muñoz Salinas &lt;<a href="mailto:rmsalinas@uco.es"><span style=" text-decoration: underline; color:#0057ae;">rmsalinas@uco.es</span></a>&gt;</p><p>&lt;<a href="https://github.com/rmsalinas/aruco"><span style=" text-decoration: underline; color:#0057ae;">https://github.com/rmsalinas/aruco</span></a>&gt;</p></body></html></string> - </property> - <property name="textFormat"> - <enum>Qt::RichText</enum> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - <property name="margin"> - <number>4</number> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - <property name="textInteractionFlags"> - <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> </layout> </widget> - <tabstops> - <tabstop>buttonBox</tabstop> - </tabstops> <resources/> <connections/> <designerdata> diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 1787ef2b..31aa2372 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -198,7 +198,6 @@ void Tracker::run() int cur_fps = 0; int last_fps = 0; cv::Point2f last_centroid; - bool first = true; while (!stop) { @@ -284,23 +283,19 @@ void Tracker::run() const auto& m = markers.at(0); const float size = 40; - const double p = s.marker_pitch; - const double sq = sin(p * HT_PI / 180); - const double cq = cos(p * HT_PI / 180); - cv::Mat obj_points(4,3,CV_32FC1); obj_points.at<float>(1,0)=-size + s.headpos_x; - obj_points.at<float>(1,1)=-size * cq + s.headpos_y; - obj_points.at<float>(1,2)=-size * sq + s.headpos_z; + obj_points.at<float>(1,1)=-size + s.headpos_y; + obj_points.at<float>(1,2)=-size + s.headpos_z; obj_points.at<float>(2,0)=size + s.headpos_x; - obj_points.at<float>(2,1)=-size * cq + s.headpos_y; - obj_points.at<float>(2,2)=-size * sq + s.headpos_z; + obj_points.at<float>(2,1)=-size + s.headpos_y; + obj_points.at<float>(2,2)=-size + s.headpos_z; obj_points.at<float>(3,0)=size + s.headpos_x; - obj_points.at<float>(3,1)=size * cq + s.headpos_y; - obj_points.at<float>(3,2)=size * sq + s.headpos_z; + obj_points.at<float>(3,1)=size + s.headpos_y; + obj_points.at<float>(3,2)=size + s.headpos_z; obj_points.at<float>(0,0)=-size + s.headpos_x; - obj_points.at<float>(0,1)=size * cq + s.headpos_y; - obj_points.at<float>(0,2)=size * sq + s.headpos_z; + obj_points.at<float>(0,1)=size + s.headpos_y; + obj_points.at<float>(0,2)=size + s.headpos_z; last_roi = cv::Rect(65535, 65535, 0, 0); @@ -325,8 +320,7 @@ void Tracker::run() last_roi.height = std::min<int>(grayscale.rows - last_roi.y, last_roi.height); } - cv::solvePnP(obj_points, m, intrinsics, dist_coeffs, rvec, tvec, !first, cv::ITERATIVE); - first = false; + cv::solvePnP(obj_points, m, intrinsics, dist_coeffs, rvec, tvec, false, cv::ITERATIVE); cv::Mat rotation_matrix = cv::Mat::zeros(3, 3, CV_64FC1); cv::Mat junk1(3, 3, CV_64FC1), junk2(3, 3, CV_64FC1); cv::Rodrigues(rvec, rotation_matrix); @@ -334,12 +328,6 @@ void Tracker::run() { cv::Vec3d euler = cv::RQDecomp3x3(rotation_matrix, junk1, junk2); - if (fabs(euler[0]) + fabs(s.marker_pitch) > 60) - { - first = true; - qDebug() << "reset levmarq due to pitch breakage"; - } - QMutexLocker lck(&mtx); for (int i = 0; i < 3; i++) @@ -366,10 +354,7 @@ void Tracker::run() last_centroid = repr2[0]; } else - { last_roi = cv::Rect(65535, 65535, 0, 0); - first = true; - } if (frame.rows > 0) videoWidget->update_image(frame); @@ -454,7 +439,6 @@ TrackerControls::TrackerControls() tie_setting(s.headpos_y, ui.cy); tie_setting(s.headpos_z, ui.cz); tie_setting(s.red_only, ui.red_only); - tie_setting(s.marker_pitch, ui.marker_pitch); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); connect(ui.btn_calibrate, SIGNAL(clicked()), this, SLOT(toggleCalibrate())); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 9ac57417..c53a49a4 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -28,7 +28,6 @@ struct settings { value<double> fov, headpos_x, headpos_y, headpos_z; value<int> camera_index, force_fps, resolution; value<bool> red_only; - value<double> marker_pitch; settings() : b(bundle("aruco-tracker")), fov(b, "field-of-view", 56), @@ -38,8 +37,7 @@ struct settings { camera_index(b, "camera-index", 0), force_fps(b, "force-fps", 0), resolution(b, "force-resolution", 0), - red_only(b, "red-only", false), - marker_pitch(b, "marker-pitch", 0) + red_only(b, "red-only", false) {} }; -- cgit v1.2.3 From e8f28d843af7b181593e58eaaea16816699b8d76 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 11 Oct 2014 20:26:34 +0200 Subject: cleanup includes --- facetracknoir/tracker.h | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index 5f9639b2..d65e1cf1 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -1,27 +1,19 @@ -#ifndef __TRACKER_H__ -#define __TRACKER_H__ +#pragma once -#include <QThread> -#include <QMessageBox> -#include <QLineEdit> -#include <QPoint> -#include <QWaitCondition> -#include <QList> -#include <QPainterPath> -#include <QDebug> -#include <QMutex> +#include <atomic> +#include <vector> + +#include "./timer.hpp" #include "./plugin-support.h" #include "./mappings.hpp" #include "./pose.hpp" -#include <vector> -#include <atomic> +#include "../qfunctionconfigurator/functionconfig.h" +#include "./main-settings.hpp" +#include "./options.h" -#include <qfunctionconfigurator/functionconfig.h> -#include "./quat.hpp" -#include "facetracknoir/main-settings.hpp" -#include "facetracknoir/options.h" -#include "facetracknoir/timer.hpp" +#include <QMutex> +#include <QThread> class Tracker : protected QThread { Q_OBJECT @@ -46,7 +38,6 @@ public: void get_raw_and_mapped_poses(double* mapped, double* raw) const; void start() { QThread::start(); } - void center() { centerp.store(true); } void toggle_enabled() { enabledp.store(!enabledp.load()); } + void center() { centerp.store(!centerp.load()); } }; -#endif -- cgit v1.2.3 From 3f6e60abec9285e803b0e2b380e3fea490b6e392 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 11 Oct 2014 20:26:54 +0200 Subject: time.h -> ctime --- facetracknoir/timer.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/facetracknoir/timer.hpp b/facetracknoir/timer.hpp index 8eb6b943..35ccd4cc 100644 --- a/facetracknoir/timer.hpp +++ b/facetracknoir/timer.hpp @@ -1,5 +1,5 @@ #pragma once -#include <time.h> +#include <ctime> #if defined (_WIN32) # include <windows.h> static inline void opentrack_clock_gettime(int, struct timespec* ts) -- cgit v1.2.3 From 8f0578cca48ab6757b0ddb6a876cbc90fa1d82b7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 11 Oct 2014 20:38:12 +0200 Subject: Avoid floating point division by zero Maybe-fixes-issue: #79 --- ftnoir_tracker_pt/camera.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftnoir_tracker_pt/camera.cpp b/ftnoir_tracker_pt/camera.cpp index 861c83cc..7c2c09ce 100644 --- a/ftnoir_tracker_pt/camera.cpp +++ b/ftnoir_tracker_pt/camera.cpp @@ -137,7 +137,7 @@ bool Camera::get_frame(float dt, cv::Mat* frame) if (new_frame) { dt_mean = dt_smoothing_const * dt_mean + (1.0 - dt_smoothing_const) * dt_valid; - cam_info.fps = 1.0 / dt_mean; + cam_info.fps = dt_mean > 1e-3 ? 1.0 / dt_mean : 0; dt_valid = 0; } return new_frame; -- cgit v1.2.3 From a7fe9ca724986de10e5391512cf9064f5516f940 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sat, 11 Oct 2014 20:38:19 +0200 Subject: less crapola --- ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index e64c4ca7..8b77b681 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -50,18 +50,14 @@ void Tracker::reset_command(Command command) void Tracker::run() { - qDebug()<< "pt: thread started"; - #ifdef PT_PERF_LOG QFile log_file(QCoreApplication::applicationDirPath() + "/PointTrackerPerformance.txt"); if (!log_file.open(QIODevice::WriteOnly | QIODevice::Text)) return; QTextStream log_stream(&log_file); #endif time.start(); - while(1) + while((commands & ABORT) == 0) { - if (commands & ABORT) break; - commands = 0; apply_inner(); const double dt = time.start() * 1e-9; const bool new_frame = camera.get_frame(dt, &frame); -- cgit v1.2.3 From f50ef9ca768f676c38fb7f24c15d38e2f72126fb Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 12 Oct 2014 00:29:05 +0200 Subject: simplify, rename infix operator --- facetracknoir/pose.hpp | 30 ++++-------------------------- facetracknoir/tracker.cpp | 26 +++++++++++++------------- 2 files changed, 17 insertions(+), 39 deletions(-) diff --git a/facetracknoir/pose.hpp b/facetracknoir/pose.hpp index d925c0a8..41e984f5 100644 --- a/facetracknoir/pose.hpp +++ b/facetracknoir/pose.hpp @@ -33,34 +33,12 @@ public: return ret; } - Pose operator-(const Pose& B) const + Pose operator&(const Pose& B) const { - const Quat q = (quat() * B.quat().inv()); + const Quat q = quat() * B.quat().inv(); Pose ret = fromQuat(q); - for (int i = TX; i < Yaw; i++) - ret(i) = B(i); - return ret; - } - - Pose operator+(const Pose& B) const - { - const Quat q = quat() * B.quat(); - Pose ret = fromQuat(q); - for (int i = TX; i < Yaw; i++) - ret(i) = B(i); - return ret; - } - - Pose operator|(const Pose& replacement) const - { - Pose ret = *this; - for (int i = 0; i < 6; i++) - { - static constexpr double eps = 1e-3; - // NB replace zero-valued elements with argument's - if (std::abs(ret(i)) < eps) - ret(i) = replacement(i); - } + for (int i = TX; i < TX + 3; i++) + ret(i) = axes[i] - B.axes[i]; return ret; } }; diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 504cd003..4a80c722 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -98,7 +98,7 @@ void Tracker::run() { Libraries->pTracker->GetHeadPoseData(newpose); - Pose final_raw, final_mapped; + Pose final_raw, filtered; for (int i = 0; i < 6; i++) { @@ -110,34 +110,34 @@ void Tracker::run() { final_raw(i) = newpose[k]; } - if (centerp) { - centerp = false; - pose_offset = final_raw; - } - { if (enabledp) unstopped_pose = final_raw; if (Libraries->pFilter) - Libraries->pFilter->FilterHeadPoseData(unstopped_pose, final_mapped); + Libraries->pFilter->FilterHeadPoseData(unstopped_pose, filtered); else - final_mapped = unstopped_pose; + filtered = unstopped_pose; + + if (centerp) { + centerp = false; + pose_offset = filtered; + } - final_mapped = final_mapped - pose_offset; + filtered = filtered & pose_offset; for (int i = 0; i < 6; i++) - get_curve(final_mapped(i), final_mapped(i), m(i)); + get_curve(filtered(i), filtered(i), m(i)); } if (s.tcomp_p) - t_compensate(final_mapped, final_mapped, s.tcomp_tz); + t_compensate(filtered, filtered, s.tcomp_tz); - Libraries->pProtocol->sendHeadposeToGame(final_mapped); + Libraries->pProtocol->sendHeadposeToGame(filtered); { QMutexLocker foo(&mtx); - output_pose = final_mapped; + output_pose = filtered; raw_6dof = final_raw; } -- cgit v1.2.3 From 88f985ca34275fc1cc014c5b8fa618ca95233db7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 12 Oct 2014 00:30:13 +0200 Subject: spline editor needs discard changes on cancel --- facetracknoir/curve-config.cpp | 15 ++-- facetracknoir/curve-config.h | 5 +- facetracknoir/facetracknoir.cpp | 8 +- facetracknoir/facetracknoir.h | 2 +- facetracknoir/facetracknoir.ui | 12 --- facetracknoir/mappings.hpp | 9 +++ qfunctionconfigurator/functionconfig.cpp | 97 ++++++++++++++----------- qfunctionconfigurator/functionconfig.h | 12 ++- qfunctionconfigurator/qfunctionconfigurator.cpp | 71 ++++++++++-------- qfunctionconfigurator/qfunctionconfigurator.h | 16 +--- 10 files changed, 128 insertions(+), 119 deletions(-) diff --git a/facetracknoir/curve-config.cpp b/facetracknoir/curve-config.cpp index 886e40fa..57cea7a4 100644 --- a/facetracknoir/curve-config.cpp +++ b/facetracknoir/curve-config.cpp @@ -1,7 +1,8 @@ #include "./facetracknoir.h" #include "./curve-config.h" #include "./main-settings.hpp" -CurveConfigurationDialog::CurveConfigurationDialog(Mappings& m, main_settings& s, QWidget *parent) : QWidget(parent, Qt::Dialog), +MapWidget::MapWidget(Mappings& m, main_settings& s, QWidget *parent) : + QWidget(parent, Qt::Dialog), m(m) { ui.setupUi( this ); @@ -82,16 +83,12 @@ CurveConfigurationDialog::CurveConfigurationDialog(Mappings& m, main_settings& s tie_setting(s.a_z.src, ui.src_z); } -void CurveConfigurationDialog::doOK() { - save(); +void MapWidget::doOK() { + m.save_mappings(); this->close(); } -void CurveConfigurationDialog::doCancel() { - m.load_mappings(); +void MapWidget::doCancel() { + m.invalidate_unsaved(); this->close(); } - -void CurveConfigurationDialog::save() { - m.save_mappings(); -} diff --git a/facetracknoir/curve-config.h b/facetracknoir/curve-config.h index 67a588e2..d485c4ff 100644 --- a/facetracknoir/curve-config.h +++ b/facetracknoir/curve-config.h @@ -3,15 +3,14 @@ #include "./mappings.hpp" #include "ui_ftnoir_curves.h" -class CurveConfigurationDialog: public QWidget +class MapWidget: public QWidget { Q_OBJECT public: - CurveConfigurationDialog(Mappings &m, main_settings &s, QWidget *parent ); + MapWidget(Mappings &m, main_settings &s, QWidget *parent ); private: Ui::UICCurveConfigurationDialog ui; Mappings& m; - void save(); private slots: void doOK(); void doCancel(); diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index af76f09b..f689cb5f 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -91,7 +91,7 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : QMainWindow(parent), pProtocolDialog(nullptr), pFilterDialog(nullptr), shortcuts_widget(nullptr), - mapping_widget(new CurveConfigurationDialog(pose, s, this)), + mapping_widget(nullptr), kbd_quit(QKeySequence("Ctrl+Q"), this), looping(0), video_frame_layout(new QVBoxLayout()), @@ -444,8 +444,10 @@ void FaceTrackNoIR::showKeyboardShortcuts() { shortcuts_widget->raise(); } void FaceTrackNoIR::showCurveConfiguration() { - if (!mapping_widget) - mapping_widget = new CurveConfigurationDialog(pose, s, this); + if (mapping_widget) + delete mapping_widget; + + mapping_widget = new MapWidget(pose, s, this); mapping_widget->show(); mapping_widget->raise(); diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 09f96147..d4c3a369 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -100,7 +100,7 @@ private: IFilterDialog* pFilterDialog; QWidget *shortcuts_widget; - CurveConfigurationDialog* mapping_widget; + MapWidget* mapping_widget; void createIconGroupBox(); void loadSettings(); diff --git a/facetracknoir/facetracknoir.ui b/facetracknoir/facetracknoir.ui index 1d769f0d..41c6abc9 100644 --- a/facetracknoir/facetracknoir.ui +++ b/facetracknoir/facetracknoir.ui @@ -435,12 +435,6 @@ </property> <item row="0" column="0"> <widget class="QPushButton" name="btnEditCurves"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="text"> <string>Mapping</string> </property> @@ -458,12 +452,6 @@ </item> <item row="1" column="0"> <widget class="QPushButton" name="btnShortcuts"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="text"> <string>Keys</string> </property> diff --git a/facetracknoir/mappings.hpp b/facetracknoir/mappings.hpp index a3e53450..5953ed1e 100644 --- a/facetracknoir/mappings.hpp +++ b/facetracknoir/mappings.hpp @@ -76,4 +76,13 @@ public: axes[i].curveAlt.saveSettings(iniFile, axes[i].name2); } } + + void invalidate_unsaved() + { + for (int i = 0; i < 6; i++) + { + axes[i].curve.invalidate_unsaved_settings(); + axes[i].curveAlt.invalidate_unsaved_settings(); + } + } }; diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index 4c52b6eb..0d37156e 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -24,7 +24,6 @@ void Map::setTrackingActive(bool blnActive) Map::Map() : _mutex(QMutex::Recursive), - data(0), activep(false), max_x(0), max_y(0) @@ -48,13 +47,13 @@ bool Map::getLastPoint(QPointF& point ) { float Map::getValueInternal(int x) { float sign = x < 0 ? -1 : 1; - x = std::abs((double) x); + x = std::abs(x); float ret; - int sz = data.size(); + int sz = cur.data.size(); if (sz == 0) ret = 0; else - ret = data[std::max(std::min(x, sz-1), 0)]; + ret = cur.data[std::max(std::min(x, sz-1), 0)]; return ret * sign; } @@ -72,91 +71,99 @@ static bool sortFn(const QPointF& one, const QPointF& two) { } void Map::reload() { - if (input.size()) - qStableSort(input.begin(), input.end(), sortFn); - - if (input.size()) + if (cur.input.size()) { + auto& input = cur.input; + auto& data = cur.data; + + qStableSort(input.begin(), input.end(), sortFn); data = std::vector<float>(MEMOIZE_PRECISION * input[input.size() - 1].x()); - + const int sz = data.size(); - + for (int i = 0; i < sz; i++) - data[i] = -1; - - for (int k = 0; k < input[0].x() * MEMOIZE_PRECISION; k++) { + data[i] = -1; + + for (int k = 0; k < input[0].x() * MEMOIZE_PRECISION; k++) { if (k < sz) data[k] = input[0].y() * k / (input[0].x() * MEMOIZE_PRECISION); } - - for (int i = 0; i < sz; i++) { + + for (int i = 0; i < sz; i++) { QPointF p0 = ensureInBounds(input, i - 1); QPointF p1 = ensureInBounds(input, i); QPointF p2 = ensureInBounds(input, i + 1); QPointF p3 = ensureInBounds(input, i + 2); - + int end = std::min<int>(sz, p2.x() * MEMOIZE_PRECISION); int start = p1.x() * MEMOIZE_PRECISION; - + for (int j = start; j < end; j++) { double t = (j - start) / (double) (end - start); double t2 = t*t; double t3 = t*t*t; - + int x = .5 * ((2. * p1.x()) + (-p0.x() + p2.x()) * t + (2. * p0.x() - 5. * p1.x() + 4. * p2.x() - p3.x()) * t2 + (-p0.x() + 3. * p1.x() - 3. * p2.x() + p3.x()) * t3) * MEMOIZE_PRECISION; - + float y = .5 * ((2. * p1.y()) + - (-p0.y() + p2.y()) * t + - (2. * p0.y() - 5. * p1.y() + 4. * p2.y() - p3.y()) * t2 + - (-p0.y() + 3. * p1.y() - 3. * p2.y() + p3.y()) * t3); - + (-p0.y() + p2.y()) * t + + (2. * p0.y() - 5. * p1.y() + 4. * p2.y() - p3.y()) * t2 + + (-p0.y() + 3. * p1.y() - 3. * p2.y() + p3.y()) * t3); + if (x >= 0 && x < sz) data[x] = y; } - } - - float last = 0; - for (int i = 0; i < sz; i++) - { - if (data[i] <= 0) - data[i] = last; - last = data[i]; - } + } + + float last = 0; + for (int i = 0; i < sz; i++) + { + if (data[i] <= 0) + data[i] = last; + last = data[i]; + } } + else + cur.data.clear(); } void Map::removePoint(int i) { QMutexLocker foo(&_mutex); - if (i >= 0 && i < input.size()) + if (i >= 0 && i < cur.input.size()) { - input.removeAt(i); + cur.input.removeAt(i); reload(); } } void Map::addPoint(QPointF pt) { QMutexLocker foo(&_mutex); - input.append(pt); + cur.input.append(pt); reload(); } void Map::movePoint(int idx, QPointF pt) { QMutexLocker foo(&_mutex); - if (idx >= 0 && idx < input.size()) + if (idx >= 0 && idx < cur.input.size()) { - input[idx] = pt; + cur.input[idx] = pt; reload(); } } const QList<QPointF> Map::getPoints() { QMutexLocker foo(&_mutex); - // NB can't pass by reference - return input; + return cur.input; +} + +void Map::invalidate_unsaved_settings() +{ + cur = saved; + reload(); } void Map::loadSettings(QSettings& settings, const QString& title) { @@ -180,19 +187,20 @@ void Map::loadSettings(QSettings& settings, const QString& title) { } settings.endGroup(); - input = points; + cur.input = points; reload(); + saved = cur; } void Map::saveSettings(QSettings& settings, const QString& title) { QMutexLocker foo(&_mutex); settings.beginGroup(QString("Curves-%1").arg(title)); - int max = input.size(); + int max = cur.input.size(); settings.setValue("point-count", max); for (int i = 0; i < max; i++) { - settings.setValue(QString("point-%1-x").arg(i), input[i].x()); - settings.setValue(QString("point-%1-y").arg(i), input[i].y()); + settings.setValue(QString("point-%1-x").arg(i), cur.input[i].x()); + settings.setValue(QString("point-%1-y").arg(i), cur.input[i].y()); } for (int i = max; true; i++) @@ -203,5 +211,8 @@ void Map::saveSettings(QSettings& settings, const QString& title) { settings.remove(x); settings.remove(QString("point-%1-y").arg(i)); } + + saved = cur; + settings.endGroup(); } diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h index 7d21fd63..e24f54cf 100644 --- a/qfunctionconfigurator/functionconfig.h +++ b/qfunctionconfigurator/functionconfig.h @@ -20,17 +20,22 @@ class OPENTRACK_EXPORT Map { private: + struct State { + QList<QPointF> input; + std::vector<float> data; + }; + static constexpr long MEMOIZE_PRECISION = 25; void reload(); float getValueInternal(int x); MyMutex _mutex; - QList<QPointF> input; - std::vector<float> data; QPointF last_input_value; volatile bool activep; int max_x; int max_y; + + State cur, saved; public: int maxInput() const { return max_x; } int maxOutput() const { return max_y; } @@ -46,7 +51,7 @@ public: void removePoint(int i); void removeAllPoints() { QMutexLocker foo(&_mutex); - input.clear(); + cur.input.clear(); reload(); } @@ -62,6 +67,7 @@ public: void saveSettings(QSettings& settings, const QString& title); void loadSettings(QSettings& settings, const QString& title); + void invalidate_unsaved_settings(); void setTrackingActive(bool blnActive); }; diff --git a/qfunctionconfigurator/qfunctionconfigurator.cpp b/qfunctionconfigurator/qfunctionconfigurator.cpp index 57d1500a..b15f308e 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.cpp +++ b/qfunctionconfigurator/qfunctionconfigurator.cpp @@ -10,20 +10,11 @@ #include "qfunctionconfigurator/qfunctionconfigurator.h" #include <QPainter> #include <QPaintEvent> -#include <QPainterPathStroker> -#include <QPainterPath> -#include <QBrush> -#include <QFileDialog> #include <QPen> -#include <QMessageBox> -#include <QImage> #include <QPixmap> #include <QTimer> -#include <QtDebug> #include <cmath> -#include <QTabWidget> -#include <QTabBar> -#include <QFontMetrics> +#include <algorithm> static const int pointSize = 5; @@ -57,8 +48,7 @@ void QFunctionConfigurator::drawBackground() QPainter painter(&_background); painter.fillRect(rect(), QColor::fromRgb(204, 204, 204)); - painter.setRenderHint(QPainter::Antialiasing); - + QColor bg_color(112, 154, 209); painter.fillRect(pixel_bounds, bg_color); @@ -140,8 +130,6 @@ void QFunctionConfigurator::drawFunction() _function = QPixmap(_background); QPainter painter(&_function); - - painter.save(); painter.setRenderHint(QPainter::Antialiasing, true); QList<QPointF> points = _config->getPoints(); @@ -164,13 +152,11 @@ void QFunctionConfigurator::drawFunction() drawLine(&painter, prev, cur, pen); prev = cur; } - painter.restore(); } void QFunctionConfigurator::paintEvent(QPaintEvent *e) { QPainter p(this); - p.setRenderHint(QPainter::Antialiasing); if (_background.isNull()) drawBackground(); @@ -179,6 +165,7 @@ void QFunctionConfigurator::paintEvent(QPaintEvent *e) _draw_function = false; drawFunction(); } + p.drawPixmap(e->rect(), _function); if (_config) { @@ -246,10 +233,9 @@ void QFunctionConfigurator::mousePressEvent(QMouseEvent *e) moving_control_point_idx = -1; if (_config) { for (int i = 0; i < points.size(); i++) { - if ( point_within_pixel(points[i], e->pos() ) ) { + if (point_within_pixel(points[i], e->pos())) { bTouchingPoint = true; moving_control_point_idx = i; - timer.restart(); break; } } @@ -263,7 +249,7 @@ void QFunctionConfigurator::mousePressEvent(QMouseEvent *e) if (_config) { int found_pt = -1; for (int i = 0; i < points.size(); i++) { - if ( point_within_pixel(points[i], e->pos() ) ) { + if (point_within_pixel(points[i], e->pos())) { found_pt = i; break; } @@ -284,21 +270,31 @@ void QFunctionConfigurator::mouseMoveEvent(QMouseEvent *e) if (!_config) return; - static constexpr int min_refresh_delay = 25; + static constexpr int min_refresh_delay = 12; if (timer.isValid() && timer.elapsed() < min_refresh_delay) return; - static constexpr int refresh_delay = 50; + static constexpr int refresh_delay = 17; QList<QPointF> points = _config->getPoints(); - if (moving_control_point_idx >= 0 && moving_control_point_idx < points.size()) { + if (moving_control_point_idx != -1 && moving_control_point_idx < points.size()) { setCursor(Qt::ClosedHandCursor); - - if (timer.isValid() && timer.elapsed() > refresh_delay) + + bool overlap = false; + + QPointF new_pt = pixel_coord_to_point(e->pos()); + + if (moving_control_point_idx + 1 < points.size()) + overlap |= new_pt.x() > points[moving_control_point_idx+1].x(); + if (moving_control_point_idx != 0) + overlap |= new_pt.x() < points[moving_control_point_idx-1].x(); + + if (overlap) + moving_control_point_idx = -1; + else if (timer.isValid() && timer.elapsed() > refresh_delay) { timer.restart(); - QPointF new_pt = pixel_coord_to_point(e->pos()); points[moving_control_point_idx] = new_pt; _config->movePoint(moving_control_point_idx, new_pt); _draw_function = true; @@ -326,11 +322,9 @@ void QFunctionConfigurator::mouseReleaseEvent(QMouseEvent *e) { if (!_config) return; - - QList<QPointF> points = _config->getPoints(); if (e->button() == Qt::LeftButton) { - timer.invalidate(); + QList<QPointF> points = _config->getPoints(); if (moving_control_point_idx >= 0 && moving_control_point_idx < points.size()) { if (_config) { _config->movePoint(moving_control_point_idx, pixel_coord_to_point(e->pos())); @@ -338,10 +332,27 @@ void QFunctionConfigurator::mouseReleaseEvent(QMouseEvent *e) } setCursor(Qt::ArrowCursor); moving_control_point_idx = -1; + + _draw_function = true; + update(); } +} +void QFunctionConfigurator::update_range() +{ + if (!_config) + return; + + const double w = width(), h = height(); + const double mwl = 40, mhl = 20; + const double mwr = 15, mhr = 35; + + pixel_bounds = QRectF(mwl, mhl, (w - mwl - mwr), (h - mhl - mhr)); + c = QPointF(pixel_bounds.width() / _config->maxInput(), pixel_bounds.height() / _config->maxOutput()); _draw_function = true; - update(); + + _background = QPixmap(); + _function = QPixmap(); } bool QFunctionConfigurator::point_within_pixel(const QPointF &pt, const QPointF &pixel) @@ -382,5 +393,5 @@ QPointF QFunctionConfigurator::point_to_pixel(const QPointF& point) void QFunctionConfigurator::resizeEvent(QResizeEvent *) { update_range(); - repaint(); + update(); } diff --git a/qfunctionconfigurator/qfunctionconfigurator.h b/qfunctionconfigurator/qfunctionconfigurator.h index e35d0bc3..25d8f8bc 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.h +++ b/qfunctionconfigurator/qfunctionconfigurator.h @@ -46,21 +46,7 @@ private: protected: virtual void resizeEvent(QResizeEvent *); private: - void update_range() { - if (!_config) - return; - - const double w = width(), h = height(); - const double mwl = 40, mhl = 20; - const double mwr = 15, mhr = 35; - - pixel_bounds = QRectF(mwl, mhl, (w - mwl - mwr), (h - mhl - mhr)); - c = QPointF(pixel_bounds.width() / _config->maxInput(), pixel_bounds.height() / _config->maxOutput()); - _draw_function = true; - - _background = QPixmap(); - _function = QPixmap(); - } + void update_range(); QPointF pixel_coord_to_point (const QPointF& point); QPointF point_to_pixel (const QPointF& point); -- cgit v1.2.3 From a4262fce4a33053438fb94d32331aa27d44056c2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 12 Oct 2014 16:07:38 +0200 Subject: comments only --- facetracknoir/gain-control.hpp | 5 ++++- facetracknoir/plugin-support.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/facetracknoir/gain-control.hpp b/facetracknoir/gain-control.hpp index 5958e945..081d4b6f 100644 --- a/facetracknoir/gain-control.hpp +++ b/facetracknoir/gain-control.hpp @@ -1,5 +1,7 @@ #pragma once +/* still WIP, not usable yet! -sh 20141012 */ + #include <algorithm> #undef NDEBUG #include <cassert> @@ -163,7 +165,7 @@ public: if (history_timer.elapsed_ms() > GAIN_HISTORY_EVERY_MS) { - const double cov = get_covariance(frame, last_frame); + //const double cov = get_covariance(frame, last_frame); history_timer.start(); last_frame = frame.clone(); @@ -174,6 +176,7 @@ public: if (debug_timer.elapsed_ms() > 1000) { const double mu = mean(frame); + // XXX move to HSL/HSV color space for it to work! -sh 20141012 const double var = get_variance(frame, mu); debug_timer.start(); diff --git a/facetracknoir/plugin-support.h b/facetracknoir/plugin-support.h index c3914cfb..b539d152 100644 --- a/facetracknoir/plugin-support.h +++ b/facetracknoir/plugin-support.h @@ -45,7 +45,7 @@ private: }; -// TODO it can die if running tracker state separated into class -sh 20141004 +// XXX TODO it can die if running tracker state separated into class -sh 20141004 class IDynamicLibraryProvider { public: virtual DynamicLibrary* current_tracker1() = 0; -- cgit v1.2.3 From e63b05db86c6b3a9c9967578a0b811ded5daecc3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 12 Oct 2014 16:07:54 +0200 Subject: copyright in header only --- qfunctionconfigurator/functionconfig.cpp | 8 -------- qfunctionconfigurator/qfunctionconfigurator.cpp | 9 --------- qfunctionconfigurator/qfunctionconfigurator.h | 7 +++++-- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index 0d37156e..a4d03ed8 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -1,11 +1,3 @@ -/* Copyright (c) 2012, 2013 Stanisław 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 <QMutexLocker> #include <QCoreApplication> #include <QPointF> diff --git a/qfunctionconfigurator/qfunctionconfigurator.cpp b/qfunctionconfigurator/qfunctionconfigurator.cpp index b15f308e..94a31be5 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.cpp +++ b/qfunctionconfigurator/qfunctionconfigurator.cpp @@ -1,12 +1,3 @@ -/* Copyright (c) 2011-2014 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. - */ - -// Adapted to FaceTrackNoIR by Wim Vriend. - #include "qfunctionconfigurator/qfunctionconfigurator.h" #include <QPainter> #include <QPaintEvent> diff --git a/qfunctionconfigurator/qfunctionconfigurator.h b/qfunctionconfigurator/qfunctionconfigurator.h index 25d8f8bc..229d9977 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.h +++ b/qfunctionconfigurator/qfunctionconfigurator.h @@ -1,9 +1,12 @@ /* Copyright (c) 2011-2014 Stanislaw Halik <sthalik@misaki.pl> - * Adapted to FaceTrackNoIR by Wim Vriend. + * * 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. */ + +// Adapted to FaceTrackNoIR by Wim Vriend. + #pragma once #include <QWidget> @@ -44,7 +47,7 @@ private: void drawLine(QPainter *painter, const QPointF &start, const QPointF &end, QPen& pen); bool point_within_pixel(const QPointF& pt, const QPointF& pixel); protected: - virtual void resizeEvent(QResizeEvent *); + void resizeEvent(QResizeEvent *) override; private: void update_range(); -- cgit v1.2.3 From 1a75017a4c7d11b997c604359600d92e7df108b3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 12 Oct 2014 16:08:09 +0200 Subject: explicit virtual override --- ftnoir_posewidget/glwidget.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ftnoir_posewidget/glwidget.h b/ftnoir_posewidget/glwidget.h index eef238ec..91536336 100644 --- a/ftnoir_posewidget/glwidget.h +++ b/ftnoir_posewidget/glwidget.h @@ -56,8 +56,7 @@ public: ~GLWidget(); void rotateBy(double xAngle, double yAngle, double zAngle); protected: - void paintEvent ( QPaintEvent * event ); - + void paintEvent ( QPaintEvent * event ) override; private: Point project(const Vec3f& point) { Point rect; -- cgit v1.2.3 From a63156fc2cddccf03c2e2959df50a2bcc0585f2a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 12 Oct 2014 16:08:53 +0200 Subject: fixup! comments only --- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 5 +++-- ftnoir_tracker_rift/ftnoir_tracker_rift.h | 5 ----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index 4198a4b8..68a520ad 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -7,8 +7,7 @@ using namespace OVR; -Rift_Tracker::Rift_Tracker() : - should_quit(false), old_yaw(0), hmd(nullptr) +Rift_Tracker::Rift_Tracker() : old_yaw(0), hmd(nullptr) { } @@ -28,6 +27,8 @@ void Rift_Tracker::StartTracker(QFrame*) } else { + // XXX need change ITracker et al api to allow for failure reporting + // this qmessagebox doesn't give any relevant details either -sh 20141012 QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); } } diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index 158229a6..b862555c 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -27,13 +27,8 @@ class Rift_Tracker : public ITracker public: Rift_Tracker(); ~Rift_Tracker() override; - void StartTracker(QFrame *) override; void GetHeadPoseData(double *data) override; - volatile bool should_quit; -protected: - void run(); // qthread override run method - private: double old_yaw; ovrHmd hmd; -- cgit v1.2.3 From 2de1c44a994fb72142ef020546efcd22ac8c6a83 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 12 Oct 2014 16:10:23 +0200 Subject: aruco cleanup, experimental contrast fix --- ftnoir_tracker_aruco/ar_video_widget.cpp | 12 ++ ftnoir_tracker_aruco/ar_video_widget.h | 22 +-- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 91 ++++++------ ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 198 ++++++++++++++++---------- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 30 ++-- ftnoir_tracker_aruco/trans_calib.cpp | 4 +- ftnoir_tracker_aruco/trans_calib.h | 2 +- 7 files changed, 209 insertions(+), 150 deletions(-) diff --git a/ftnoir_tracker_aruco/ar_video_widget.cpp b/ftnoir_tracker_aruco/ar_video_widget.cpp index 9a089213..61a611ea 100644 --- a/ftnoir_tracker_aruco/ar_video_widget.cpp +++ b/ftnoir_tracker_aruco/ar_video_widget.cpp @@ -40,3 +40,15 @@ void ArucoVideoWidget::update_and_repaint() texture = qframe2; update(); } + +void ArucoVideoWidget::paintEvent(QPaintEvent* e) +{ + QMutexLocker foo(&mtx); + QPainter(this).drawImage(e->rect(), texture); +} + +ArucoVideoWidget::ArucoVideoWidget(QWidget* parent): QWidget(parent) +{ + connect(&timer, SIGNAL(timeout()), this, SLOT(update_and_repaint())); + timer.start(60); +} \ No newline at end of file diff --git a/ftnoir_tracker_aruco/ar_video_widget.h b/ftnoir_tracker_aruco/ar_video_widget.h index e2cf4d9f..820ba7d0 100644 --- a/ftnoir_tracker_aruco/ar_video_widget.h +++ b/ftnoir_tracker_aruco/ar_video_widget.h @@ -22,26 +22,18 @@ class ArucoVideoWidget : public QWidget { Q_OBJECT - -public: - ArucoVideoWidget(QWidget *parent) : QWidget(parent) { - connect(&timer, SIGNAL(timeout()), this, SLOT(update_and_repaint())); - timer.start(60); - } - void update_image(const cv::Mat& frame); -protected slots: - void paintEvent( QPaintEvent* e ) { - QMutexLocker foo(&mtx); - QPainter painter(this); - painter.drawImage(e->rect(), texture); - } - void update_and_repaint(); - + private: QMutex mtx; QImage texture; QTimer timer; cv::Mat _frame; +private slots: + void update_and_repaint(); +public: + ArucoVideoWidget(QWidget *parent); + void update_image(const cv::Mat& frame); + void paintEvent( QPaintEvent*) override; }; #endif // VIDEOWIDGET_H diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 240ef5f8..1898d15b 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -9,7 +9,7 @@ <rect> <x>0</x> <y>0</y> - <width>560</width> + <width>562</width> <height>214</height> </rect> </property> @@ -40,35 +40,6 @@ </property> </widget> </item> - <item row="0" column="1"> - <widget class="QDoubleSpinBox" name="cameraFOV"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="minimum"> - <double>35.000000000000000</double> - </property> - <property name="maximum"> - <double>180.000000000000000</double> - </property> - <property name="value"> - <double>52.000000000000000</double> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Frames per second</string> - </property> - </widget> - </item> <item row="1" column="1"> <widget class="QComboBox" name="cameraFPS"> <property name="sizePolicy"> @@ -104,10 +75,39 @@ </item> </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_3"> + <item row="3" column="0"> + <widget class="QLabel" name="label_4"> <property name="text"> - <string>Camera name</string> + <string>Resolution</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QDoubleSpinBox" name="cameraFOV"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="minimum"> + <double>35.000000000000000</double> + </property> + <property name="maximum"> + <double>180.000000000000000</double> + </property> + <property name="value"> + <double>52.000000000000000</double> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Frames per second</string> </property> </widget> </item> @@ -121,10 +121,10 @@ </property> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_4"> + <item row="2" column="0"> + <widget class="QLabel" name="label_3"> <property name="text"> - <string>Resolution</string> + <string>Camera name</string> </property> </widget> </item> @@ -159,16 +159,25 @@ </widget> </item> <item row="4" column="0"> - <widget class="QLabel" name="label_10"> + <widget class="QLabel" name="label_6"> <property name="text"> - <string>Red channel only</string> + <string>Sun glare removal</string> </property> </widget> </item> <item row="4" column="1"> - <widget class="QCheckBox" name="red_only"> - <property name="text"> - <string>Mileage may vary</string> + <widget class="QSlider" name="desaturate_slider"> + <property name="maximum"> + <number>100</number> + </property> + <property name="singleStep"> + <number>10</number> + </property> + <property name="pageStep"> + <number>20</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> </widget> </item> diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 31aa2372..0974f0f0 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -8,6 +8,7 @@ #include <vector> #include <cstdio> #include <cmath> +#include <algorithm> #include <QMutexLocker> #include "./include/markerdetector.h" #include "ftnoir_tracker_aruco.h" @@ -135,7 +136,7 @@ void Tracker::StartTracker(QFrame* videoframe) #define HT_PI 3.1415926535 -void Tracker::getRT(cv::Matx33f& r_, cv::Vec3f& t_) +void Tracker::getRT(cv::Matx33d& r_, cv::Vec3d& t_) { QMutexLocker l(&mtx); @@ -183,10 +184,6 @@ void Tracker::run() cv::Rect last_roi(65535, 65535, 0, 0); - cv::Mat color, color_, grayscale, rvec, tvec; - - const double stateful_coeff = 0.88; - if (!camera.isOpened()) { fprintf(stderr, "aruco tracker: can't open camera\n"); @@ -201,19 +198,46 @@ void Tracker::run() while (!stop) { - if (!camera.read(color_)) + cv::Mat color; + if (!camera.read(color)) continue; auto tm = cv::getTickCount(); - color_.copyTo(color); - if (s.red_only) + + const double c = s.desaturate * 16. / 100.; + + if (std::abs(c) > 1e-3) { - cv::Mat channel[3]; - cv::split(color, channel); - grayscale = channel[2]; - } else - cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); - - gain.tick(camera, grayscale); + const int w=color.cols, h=color.rows; + + cv::Mat hsv; + cv::cvtColor(color, hsv, cv::COLOR_BGR2HSV); + vector<cv::Mat> channels; + cv::split(hsv, channels); + cv::Mat sat = channels[1]; + cv::Mat val = channels[2]; + + struct ops { + static double sig(double x) + { + double x_ = -6 + x * 2 * 6; + return 1./(1.+exp(-x_)); + } + }; + + for (int i = 0; i < h; i++) + for (int j = 0; j < w; j++) + { + const double sat_ij = sat.at<unsigned char>(i, j)/255.; + val.at<unsigned char>(i, j) *= std::max(0., 1. - c*ops::sig(sat_ij)); + } + + channels[1] = sat; + channels[2] = val; + cv::merge(channels, hsv); + cv::cvtColor(hsv, color, cv::COLOR_HSV2BGR); + } + cv::Mat grayscale; + cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); const int scale = frame.cols > 480 ? 2 : 1; detector.setThresholdParams(scale > 1 ? 11 : 7, 4); @@ -232,27 +256,33 @@ void Tracker::run() const double size_min = 0.04; const double size_max = 0.38; - - if (last_roi.width > 0 && - (detector.detect(grayscale(last_roi), markers, cv::Mat(), cv::Mat(), -1, false), - markers.size() == 1 && markers[0].size() == 4)) + + bool roi_valid = false; + + if (last_roi.width > 0 && last_roi.height) { detector.setMinMaxSize(std::max(0.01, size_min * grayscale.cols / last_roi.width), std::min(1.0, size_max * grayscale.cols / last_roi.width)); - auto& m = markers.at(0); - for (int i = 0; i < 4; i++) + if (detector.detect(grayscale(last_roi), markers, cv::Mat(), cv::Mat(), -1, false), + markers.size() == 1 && markers[0].size() == 4) { - auto& p = m.at(i); - p.x += last_roi.x; - p.y += last_roi.y; + auto& m = markers.at(0); + for (int i = 0; i < 4; i++) + { + auto& p = m.at(i); + p.x += last_roi.x; + p.y += last_roi.y; + } + roi_valid = true; } } - else + + if (!roi_valid) { detector.setMinMaxSize(size_min, size_max); detector.detect(grayscale, markers, cv::Mat(), cv::Mat(), -1, false); } - + if (markers.size() == 1 && markers[0].size() == 4) { const auto& m = markers.at(0); for (int i = 0; i < 4; i++) @@ -275,70 +305,89 @@ void Tracker::run() frame = color.clone(); ::sprintf(buf, "Hz: %d", last_fps); - cv::putText(frame, buf, cv::Point(10, 32), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(0, 255, 0), scale); + cv::putText(frame, buf, cv::Point(10, 32), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(0, 255, 0), 1); ::sprintf(buf, "Jiffies: %ld", (long) (10000 * (time - tm) / freq)); - cv::putText(frame, buf, cv::Point(10, 54), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(80, 255, 0), scale); + cv::putText(frame, buf, cv::Point(10, 54), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(80, 255, 0), 1); if (markers.size() == 1 && markers[0].size() == 4) { const auto& m = markers.at(0); const float size = 40; cv::Mat obj_points(4,3,CV_32FC1); - obj_points.at<float>(1,0)=-size + s.headpos_x; - obj_points.at<float>(1,1)=-size + s.headpos_y; - obj_points.at<float>(1,2)=-size + s.headpos_z; - obj_points.at<float>(2,0)=size + s.headpos_x; - obj_points.at<float>(2,1)=-size + s.headpos_y; - obj_points.at<float>(2,2)=-size + s.headpos_z; - obj_points.at<float>(3,0)=size + s.headpos_x; - obj_points.at<float>(3,1)=size + s.headpos_y; - obj_points.at<float>(3,2)=size + s.headpos_z; - obj_points.at<float>(0,0)=-size + s.headpos_x; - obj_points.at<float>(0,1)=size + s.headpos_y; - obj_points.at<float>(0,2)=size + s.headpos_z; - - last_roi = cv::Rect(65535, 65535, 0, 0); - + const int x1=1, x2=2, x3=3, x4=0; + obj_points.at<float>(x1,0)=-size + s.headpos_x; + obj_points.at<float>(x1,1)=-size + s.headpos_y; + obj_points.at<float>(x1,2)= 0 + s.headpos_z; + + obj_points.at<float>(x2,0)=size + s.headpos_x; + obj_points.at<float>(x2,1)=-size + s.headpos_y; + obj_points.at<float>(x2,2)= 0 + s.headpos_z; + + obj_points.at<float>(x3,0)=size + s.headpos_x; + obj_points.at<float>(x3,1)=size + s.headpos_y; + obj_points.at<float>(x3,2)= 0 + s.headpos_z; + + obj_points.at<float>(x4,0)= -size + s.headpos_x; + obj_points.at<float>(x4,1)= size + s.headpos_y; + obj_points.at<float>(x4,2)= 0 + s.headpos_z; + + cv::Vec3d rvec, tvec; + + cv::solvePnP(obj_points, m, intrinsics, dist_coeffs, rvec, tvec, false, cv::ITERATIVE); + + std::vector<cv::Point2f> roi_projection(4); + cv::Mat roi_points = obj_points * c_search_window; + cv::projectPoints(roi_points, rvec, tvec, intrinsics, dist_coeffs, roi_projection); + + last_roi = cv::Rect(color.cols-1, color.rows-1, 0, 0); + for (int i = 0; i < 4; i++) { - auto foo = m.at(i); - last_roi.x = std::min<int>(foo.x, last_roi.x); - last_roi.y = std::min<int>(foo.y, last_roi.y); - last_roi.width = std::max<int>(foo.x, last_roi.width); - last_roi.height = std::max<int>(foo.y, last_roi.height); - } - { - last_roi.width -= last_roi.x; - last_roi.height -= last_roi.y; - last_roi.x -= last_roi.width * stateful_coeff; - last_roi.y -= last_roi.height * stateful_coeff; - last_roi.width *= stateful_coeff * 3; - last_roi.height *= stateful_coeff * 3; - last_roi.x = std::max<int>(0, last_roi.x); - last_roi.y = std::max<int>(0, last_roi.y); - last_roi.width = std::min<int>(grayscale.cols - last_roi.x, last_roi.width); - last_roi.height = std::min<int>(grayscale.rows - last_roi.y, last_roi.height); + auto proj = roi_projection[i]; + int min_x = std::min<int>(proj.x, last_roi.x), + min_y = std::min<int>(proj.y, last_roi.y); + + int max_x = std::max<int>(proj.x, last_roi.width), + max_y = std::max<int>(proj.y, last_roi.height); + + last_roi.x = min_x; + last_roi.y = min_y; + + last_roi.width = max_x; + last_roi.height = max_y; } - - cv::solvePnP(obj_points, m, intrinsics, dist_coeffs, rvec, tvec, false, cv::ITERATIVE); - cv::Mat rotation_matrix = cv::Mat::zeros(3, 3, CV_64FC1); - cv::Mat junk1(3, 3, CV_64FC1), junk2(3, 3, CV_64FC1); - cv::Rodrigues(rvec, rotation_matrix); + + if (last_roi.x < 0) + last_roi.x = 0; + if (last_roi.y < 0) + last_roi.y = 0; + + if (last_roi.width+1 > color.cols) + last_roi.width = color.cols-1; + + if (last_roi.height+1 > color.rows) + last_roi.height = color.rows-1; + + last_roi.width -= last_roi.x; + last_roi.height -= last_roi.y; + + auto rmat = cv::Matx33d::zeros(); + cv::Matx33d m_r(3, 3, CV_64FC1), m_q(3, 3, CV_64FC1); + cv::Rodrigues(rvec, rmat); { - cv::Vec3d euler = cv::RQDecomp3x3(rotation_matrix, junk1, junk2); + cv::Vec3d euler = cv::RQDecomp3x3(rmat, m_r, m_q); QMutexLocker lck(&mtx); for (int i = 0; i < 3; i++) - pose[i] = tvec.at<double>(i); - + pose[i] = tvec(i); pose[Yaw] = euler[1]; pose[Pitch] = -euler[0]; pose[Roll] = euler[2]; - rotation_matrix.convertTo(r, CV_32FC1); - tvec.convertTo(t, CV_32FC1); + r = rmat; + t = tvec; } std::vector<cv::Point2f> repr2; @@ -350,6 +399,9 @@ void Tracker::run() auto s = cv::Scalar(255, 0, 255); cv::circle(frame, repr2.at(0), 4, s, -1); } + + if (roi_valid) + cv::rectangle(frame, last_roi, cv::Scalar(255, 0, 255), 1); last_centroid = repr2[0]; } @@ -438,7 +490,7 @@ TrackerControls::TrackerControls() tie_setting(s.headpos_x, ui.cx); tie_setting(s.headpos_y, ui.cy); tie_setting(s.headpos_z, ui.cz); - tie_setting(s.red_only, ui.red_only); + tie_setting(s.desaturate, ui.desaturate_slider); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); connect(ui.btn_calibrate, SIGNAL(clicked()), this, SLOT(toggleCalibrate())); @@ -467,8 +519,8 @@ void TrackerControls::update_tracker_calibration() { if (calib_timer.isActive() && tracker) { - cv::Matx33f r; - cv::Vec3f t; + cv::Matx33d r; + cv::Vec3d t; tracker->getRT(r, t); calibrator.update(r, t); auto pos = calibrator.get_estimate() * .1; diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index c53a49a4..03fff844 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -5,8 +5,7 @@ * copyright notice and this permission notice appear in all copies. */ -#ifndef FTNOIR_TRACKER_HT_H -#define FTNOIR_TRACKER_HT_H +#pragma once #include "ui_aruco-trackercontrols.h" #include "ar_video_widget.h" @@ -19,7 +18,9 @@ #include "facetracknoir/options.h" #include "ftnoir_tracker_aruco/trans_calib.h" #include "facetracknoir/plugin-api.hpp" -#include "facetracknoir/gain-control.hpp" + +#include <opencv2/core/core.hpp> +#include <opencv2/highgui/highgui.hpp> using namespace options; @@ -27,7 +28,7 @@ struct settings { pbundle b; value<double> fov, headpos_x, headpos_y, headpos_z; value<int> camera_index, force_fps, resolution; - value<bool> red_only; + value<int> desaturate; settings() : b(bundle("aruco-tracker")), fov(b, "field-of-view", 56), @@ -37,13 +38,14 @@ struct settings { camera_index(b, "camera-index", 0), force_fps(b, "force-fps", 0), resolution(b, "force-resolution", 0), - red_only(b, "red-only", false) + desaturate(b, "desaturate", 0) {} }; class Tracker : protected QThread, public ITracker { Q_OBJECT + static constexpr double c_search_window = 2.9; public: Tracker(); ~Tracker() override; @@ -51,7 +53,7 @@ public: void GetHeadPoseData(double *data); void run(); void reload() { s.b->reload(); } - void getRT(cv::Matx33f& r, cv::Vec3f& t); + void getRT(cv::Matx33d &r, cv::Vec3d &t); private: QMutex mtx; volatile bool stop; @@ -61,9 +63,8 @@ private: double pose[6]; cv::Mat frame; cv::VideoCapture camera; - cv::Matx33f r; - cv::Vec3f t; - Gain gain; + cv::Matx33d r; + cv::Vec3d t; }; class TrackerControls : public QWidget, public ITrackerDialog @@ -71,12 +72,8 @@ class TrackerControls : public QWidget, public ITrackerDialog Q_OBJECT public: TrackerControls(); - void registerTracker(ITracker * x) { - tracker = dynamic_cast<Tracker*>(x); - } - void unRegisterTracker() { - tracker = nullptr; - } + void registerTracker(ITracker * x) { tracker = dynamic_cast<Tracker*>(x); } + void unRegisterTracker() { tracker = nullptr; } private: Ui::Form ui; Tracker* tracker; @@ -90,6 +87,3 @@ private slots: void cleanupCalib(); void update_tracker_calibration(); }; - -#endif - diff --git a/ftnoir_tracker_aruco/trans_calib.cpp b/ftnoir_tracker_aruco/trans_calib.cpp index b1f956b4..369de449 100644 --- a/ftnoir_tracker_aruco/trans_calib.cpp +++ b/ftnoir_tracker_aruco/trans_calib.cpp @@ -21,9 +21,9 @@ void TranslationCalibrator::reset() y = Vec6f(0,0,0, 0,0,0); } -void TranslationCalibrator::update(const Matx33f& R_CM_k, const Vec3f& t_CM_k) +void TranslationCalibrator::update(const Matx33d& R_CM_k, const Vec3d& t_CM_k) { - Matx<float, 6,3> H_k_T = Matx<float, 6,3>::zeros(); + Matx<double, 6,3> H_k_T = Matx<double, 6,3>::zeros(); for (int i=0; i<3; ++i) { for (int j=0; j<3; ++j) { H_k_T(i,j) = R_CM_k(j,i); diff --git a/ftnoir_tracker_aruco/trans_calib.h b/ftnoir_tracker_aruco/trans_calib.h index c2c02b38..5a2d7c0f 100644 --- a/ftnoir_tracker_aruco/trans_calib.h +++ b/ftnoir_tracker_aruco/trans_calib.h @@ -26,7 +26,7 @@ public: void reset(); // update the current estimate - void update(const cv::Matx33f& R_CM_k, const cv::Vec3f& t_CM_k); + void update(const cv::Matx33d& R_CM_k, const cv::Vec3d& t_CM_k); // get the current estimate for t_MH cv::Vec3f get_estimate(); -- cgit v1.2.3 From a24ef3d12230f739fefea85c14a7587aeb43b4d2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Sun, 12 Oct 2014 16:10:41 +0200 Subject: opt: cleanup some nonsense --- facetracknoir/options.h | 151 +++++++++++++++++++++++------------------------- 1 file changed, 71 insertions(+), 80 deletions(-) diff --git a/facetracknoir/options.h b/facetracknoir/options.h index 291ac071..37377b55 100644 --- a/facetracknoir/options.h +++ b/facetracknoir/options.h @@ -28,10 +28,10 @@ #include <QDebug> namespace options { - template<typename T> + template<typename t> // don't elide usages of the function, qvariant default implicit // conversion results in nonsensical runtime behavior -sh - inline T qcruft_to_t (const QVariant& t); + inline t qcruft_to_t (const QVariant& datum); template<> inline int qcruft_to_t<int>(const QVariant& t) @@ -84,6 +84,7 @@ namespace options { conf.endGroup(); } static constexpr const char* org = "opentrack"; + void save() { QSettings s(ini_pathname(), QSettings::IniFormat); s.beginGroup(name); @@ -91,9 +92,9 @@ namespace options { s.setValue(k, map[k]); s.endGroup(); } - template<typename T> - T get(const QString& k) { - return qcruft_to_t<T>(map.value(k)); + template<typename t> + t get(const QString& k) { + return qcruft_to_t<t>(map.value(k)); } void put(const QString& s, const QVariant& d) { @@ -105,7 +106,8 @@ namespace options { } }; - class impl_bundle { + class impl_bundle : public QObject { + Q_OBJECT private: QMutex mtx; const QString group_name; @@ -114,7 +116,8 @@ namespace options { impl_bundle(const impl_bundle&) = delete; impl_bundle& operator=(const impl_bundle&) = delete; bool modified; - long priv_cookie; + signals: + void changed(); public: impl_bundle(const QString& group_name) : mtx(QMutex::Recursive), @@ -128,18 +131,20 @@ namespace options { QMutexLocker l(&mtx); saved = group(group_name); transient = saved; - priv_cookie++; } - void store(const QString& name, const QVariant& datum) + void store_kv(const QString& name, const QVariant& datum) { QMutexLocker l(&mtx); - if (!transient.contains(name) || datum != transient.get<QVariant>(name)) + auto old = transient.get<QVariant>(name); + if (!transient.contains(name) || datum != old) { if (!modified) - qDebug() << "bundle" << group_name << "modified due to" << name << transient.get<QVariant>(name) << datum << "->" << datum; + qDebug() << "bundle" << group_name << + "modified due to" << name << + transient.get<QVariant>(name) << + old << "->" << datum; modified = true; transient.put(name, datum); - priv_cookie++; } } bool contains(const QString& name) @@ -147,10 +152,10 @@ namespace options { QMutexLocker l(&mtx); return transient.contains(name); } - template<typename T> - T get(const QString& name) { + template<typename t> + t get(const QString& name) { QMutexLocker l(&mtx); - return transient.get<T>(name); + return transient.get<t>(name); } void save() { @@ -158,100 +163,85 @@ namespace options { modified = false; saved = transient; transient.save(); + emit changed(); } void revert() { QMutexLocker l(&mtx); modified = false; transient = saved; - priv_cookie++; + emit changed(); } bool modifiedp() { QMutexLocker l(&mtx); return modified; } - long cookie() const { - return priv_cookie; - } }; using pbundle = std::shared_ptr<impl_bundle>; class base_value : public QObject { Q_OBJECT +#define DEFINE_SLOT(t) void setValue(t datum) { store(datum); } +#define DEFINE_SIGNAL(t) void valueChanged(t); public: - base_value(pbundle b, const QString& name) : b(b), self_name(name), cookie_snap(0) {} - virtual QVariant operator=(const QVariant& datum) = 0; - template<typename T> - QVariant operator=(const T& datum) - { - return this->operator =(qVariantFromValue<T>(datum)); - } - protected: - pbundle b; - QString self_name; - template<typename T> - QVariant store(const T& datum) - { - b->store(self_name, qVariantFromValue<T>(datum)); - emit valueChanged(datum); - return datum; - } - void maybe_lazy_change() - { - long cookie = b->cookie(); - if (cookie_snap != cookie) - { - cookie_snap = cookie; - this->operator=(b->get<QVariant>(self_name)); - } - } - private: - long cookie_snap; + base_value(pbundle b, const QString& name) : b(b), self_name(name) {} public slots: -#define DEFINE_SLOT(t) void setValue(t datum) { this->operator=(qVariantFromValue(datum)); } DEFINE_SLOT(double) DEFINE_SLOT(int) DEFINE_SLOT(QString) DEFINE_SLOT(bool) signals: -#define DEFINE_SIGNAL(t) void valueChanged(t); - DEFINE_SIGNAL(double) - DEFINE_SIGNAL(int) - DEFINE_SIGNAL(QString) - DEFINE_SIGNAL(bool) + DEFINE_SIGNAL(double); + DEFINE_SIGNAL(int); + DEFINE_SIGNAL(bool); + DEFINE_SIGNAL(QString); + // Qt5 moc really insists on that one -sh 20141012 + DEFINE_SIGNAL(QVariant); + protected: + pbundle b; + QString self_name; + + template<typename t> + void store(const t& datum) + { + b->store_kv(self_name, datum); + emit valueChanged(static_cast<t>(datum)); + } }; - template<typename T> + template<typename t> class value : public base_value { public: - QVariant operator=(const QVariant& datum) { - return store(qcruft_to_t<T>(datum)); + t operator=(const t& datum) + { + store(qVariantFromValue<t>(datum)); + return datum; } - static constexpr const Qt::ConnectionType QT_CONNTYPE = Qt::UniqueConnection; - static constexpr const Qt::ConnectionType OPT_CONNTYPE = Qt::UniqueConnection; - value(pbundle b, const QString& name, T def) : base_value(b, name) + static constexpr const Qt::ConnectionType DIRECT_CONNTYPE = Qt::DirectConnection; + static constexpr const Qt::ConnectionType SAFE_CONNTYPE = Qt::AutoConnection; + value(pbundle b, const QString& name, t def) : base_value(b, name) { if (!b->contains(name) || b->get<QVariant>(name).type() == QVariant::Invalid) - this->operator=(qVariantFromValue<T>(def)); + *this = def; } - operator T() + operator t() { - maybe_lazy_change(); - return b->get<T>(self_name); + return b->get<t>(self_name); } }; - template<typename T, typename Q> - inline void tie_setting(value<T>&, Q*); + template<typename t, typename q> + inline void tie_setting(value<t>&, q*); template<> inline void tie_setting(value<int>& v, QComboBox* cb) { cb->setCurrentIndex(v); - base_value::connect(cb, SIGNAL(currentIndexChanged(int)), &v, SLOT(setValue(int)), v.QT_CONNTYPE); - base_value::connect(&v, SIGNAL(valueChanged(int)), cb, SLOT(setCurrentIndex(int)), v.OPT_CONNTYPE); + v = cb->currentIndex(); + base_value::connect(cb, SIGNAL(currentIndexChanged(int)), &v, SLOT(setValue(int)), v.DIRECT_CONNTYPE); + base_value::connect(&v, SIGNAL(valueChanged(int)), cb, SLOT(setCurrentIndex(int)), v.SAFE_CONNTYPE); } template<> @@ -259,55 +249,56 @@ namespace options { { cb->setCurrentText(v); v = cb->currentText(); - base_value::connect(cb, SIGNAL(currentTextChanged(QString)), &v, SLOT(setValue(QString)), v.QT_CONNTYPE); - base_value::connect(&v, SIGNAL(valueChanged(QString)), cb, SLOT(setCurrentText(QString)), v.OPT_CONNTYPE); + base_value::connect(cb, SIGNAL(currentTextChanged(QString)), &v, SLOT(setValue(QString)), v.DIRECT_CONNTYPE); + base_value::connect(&v, SIGNAL(valueChanged(QString)), cb, SLOT(setCurrentText(QString)), v.SAFE_CONNTYPE); } template<> inline void tie_setting(value<bool>& v, QCheckBox* cb) { cb->setChecked(v); - base_value::connect(cb, SIGNAL(toggled(bool)), &v, SLOT(setValue(bool)), v.QT_CONNTYPE); - base_value::connect(&v, SIGNAL(valueChanged(bool)), cb, SLOT(setChecked(bool)), v.OPT_CONNTYPE); + base_value::connect(cb, SIGNAL(toggled(bool)), &v, SLOT(setValue(bool)), v.DIRECT_CONNTYPE); + base_value::connect(&v, SIGNAL(valueChanged(bool)), cb, SLOT(setChecked(bool)), v.SAFE_CONNTYPE); } template<> inline void tie_setting(value<double>& v, QDoubleSpinBox* dsb) { dsb->setValue(v); - base_value::connect(dsb, SIGNAL(valueChanged(double)), &v, SLOT(setValue(double)), v.QT_CONNTYPE); - base_value::connect(&v, SIGNAL(valueChanged(double)), dsb, SLOT(setValue(double)), v.OPT_CONNTYPE); + base_value::connect(dsb, SIGNAL(valueChanged(double)), &v, SLOT(setValue(double)), v.DIRECT_CONNTYPE); + base_value::connect(&v, SIGNAL(valueChanged(double)), dsb, SLOT(setValue(double)), v.SAFE_CONNTYPE); } template<> inline void tie_setting(value<int>& v, QSpinBox* sb) { sb->setValue(v); - base_value::connect(sb, SIGNAL(valueChanged(int)), &v, SLOT(setValue(int)), v.QT_CONNTYPE); - base_value::connect(&v, SIGNAL(valueChanged(int)), sb, SLOT(setValue(int)), v.OPT_CONNTYPE); + base_value::connect(sb, SIGNAL(valueChanged(int)), &v, SLOT(setValue(int)), v.DIRECT_CONNTYPE); + base_value::connect(&v, SIGNAL(valueChanged(int)), sb, SLOT(setValue(int)), v.SAFE_CONNTYPE); } template<> inline void tie_setting(value<int>& v, QSlider* sl) { sl->setValue(v); - base_value::connect(sl, SIGNAL(valueChanged(int)), &v, SLOT(setValue(int)), v.QT_CONNTYPE); - base_value::connect(&v, SIGNAL(valueChanged(int)), sl, SLOT(setValue(int)), v.OPT_CONNTYPE); + v = sl->value(); + base_value::connect(sl, SIGNAL(valueChanged(int)), &v, SLOT(setValue(int)), v.DIRECT_CONNTYPE); + base_value::connect(&v, SIGNAL(valueChanged(int)), sl, SLOT(setValue(int)), v.SAFE_CONNTYPE); } template<> inline void tie_setting(value<QString>& v, QLineEdit* le) { le->setText(v); - base_value::connect(le, SIGNAL(textChanged(QString)), &v, SLOT(setValue(QString)), v.QT_CONNTYPE); - base_value::connect(&v, SIGNAL(valueChanged(QString)),le, SLOT(setText(QString)), v.OPT_CONNTYPE); + base_value::connect(le, SIGNAL(textChanged(QString)), &v, SLOT(setValue(QString)), v.DIRECT_CONNTYPE); + base_value::connect(&v, SIGNAL(valueChanged(QString)),le, SLOT(setText(QString)), v.SAFE_CONNTYPE); } template<> inline void tie_setting(value<QString>& v, QLabel* lb) { lb->setText(v); - base_value::connect(&v, SIGNAL(valueChanged(QString)), lb, SLOT(setText(QString)), v.OPT_CONNTYPE); + base_value::connect(&v, SIGNAL(valueChanged(QString)), lb, SLOT(setText(QString)), v.SAFE_CONNTYPE); } inline pbundle bundle(const QString& group) { -- cgit v1.2.3 From d478332561caf3d35f6615b6246f6ad4cdaac89f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 14 Oct 2014 14:05:05 +0200 Subject: use layout for whole main window fixes too small widgets inside of it --- facetracknoir/facetracknoir.ui | 2147 ++++++++++++++++++++-------------------- 1 file changed, 1048 insertions(+), 1099 deletions(-) diff --git a/facetracknoir/facetracknoir.ui b/facetracknoir/facetracknoir.ui index 41c6abc9..32aea889 100644 --- a/facetracknoir/facetracknoir.ui +++ b/facetracknoir/facetracknoir.ui @@ -12,7 +12,7 @@ </rect> </property> <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -27,1137 +27,1086 @@ </string> </property> <widget class="QWidget" name="centralWidget"> - <widget class="QGroupBox" name="video_feed"> - <property name="geometry"> - <rect> - <x>10</x> - <y>225</y> - <width>655</width> - <height>505</height> - </rect> - </property> - <property name="title"> - <string>Video preview</string> - </property> - <layout class="QFormLayout"> - <property name="horizontalSpacing"> - <number>0</number> - </property> - <property name="verticalSpacing"> - <number>0</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item row="0" column="0"> - <widget class="QFrame" name="video_frame"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <layout class="QGridLayout" name="gridLayout_11"> + <item row="0" column="0"> + <widget class="QGroupBox" name="octopus"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Tracking preview</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <property name="leftMargin"> + <number>0</number> </property> - <property name="minimumSize"> - <size> - <width>640</width> - <height>480</height> - </size> + <property name="topMargin"> + <number>0</number> </property> - <property name="maximumSize"> - <size> - <width>640</width> - <height>480</height> - </size> + <property name="rightMargin"> + <number>0</number> </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="spacing"> - <number>0</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QLabel" name="video_frame_label"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>640</width> - <height>480</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>640</width> - <height>480</height> - </size> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QGroupBox" name="controls"> - <property name="geometry"> - <rect> - <x>675</x> - <y>225</y> - <width>271</width> - <height>505</height> - </rect> - </property> - <property name="title"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Connected game</string> + <property name="bottomMargin"> + <number>0</number> </property> - <layout class="QGridLayout" name="gridLayout_9"> - <property name="topMargin"> - <number>6</number> - </property> - <property name="bottomMargin"> - <number>6</number> - </property> - <property name="verticalSpacing"> - <number>3</number> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="game_name"> - <property name="text"> - <string>Not connected</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupProfile"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="spacing"> + <number>0</number> </property> - <property name="title"> - <string>Profile</string> + <item row="0" column="0"> + <widget class="GLWidget" name="pose_display" native="true"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>120</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="1" colspan="2"> + <widget class="QGroupBox" name="headpose"> + <property name="title"> + <string/> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>10</number> </property> - <layout class="QGridLayout" name="gridLayout_7"> - <property name="topMargin"> - <number>6</number> - </property> - <property name="bottomMargin"> - <number>6</number> - </property> - <property name="verticalSpacing"> - <number>3</number> - </property> - <item row="1" column="1"> - <widget class="QPushButton" name="btnSave"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Save</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QPushButton" name="btnLoad"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Load</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QComboBox" name="iconcomboProfile"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maxVisibleItems"> - <number>10</number> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QPushButton" name="btnSaveAs"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Save As ...</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupTrackerSource"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="leftMargin"> + <number>0</number> </property> - <property name="title"> - <string>Tracker</string> + <property name="topMargin"> + <number>0</number> </property> - <layout class="QGridLayout" name="gridLayout"> - <property name="topMargin"> - <number>6</number> - </property> - <property name="bottomMargin"> - <number>6</number> - </property> - <property name="verticalSpacing"> - <number>3</number> - </property> - <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboTrackerSource"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QPushButton" name="btnShowEngineControls"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Settings</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupFilter"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="rightMargin"> + <number>0</number> </property> - <property name="title"> - <string>Filter</string> + <property name="bottomMargin"> + <number>0</number> </property> - <layout class="QGridLayout" name="gridLayout_3"> - <property name="topMargin"> - <number>6</number> - </property> - <property name="bottomMargin"> - <number>6</number> - </property> - <property name="verticalSpacing"> - <number>3</number> - </property> - <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboFilter"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QPushButton" name="btnShowFilterControls"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Settings</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupGameProtocol"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <item> + <widget class="QGroupBox" name="box_raw_headpose"> + <property name="title"> + <string notr="true">Raw pose</string> + </property> + <layout class="QGridLayout" name="gridLayout_8"> + <item row="1" column="1"> + <widget class="QLCDNumber" name="lcdNumY"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="digitCount"> + <number>3</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLCDNumber" name="lcdNumRotX"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="digitCount"> + <number>3</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="lblRotY_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>pitch</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="lblX_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>TX</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLCDNumber" name="lcdNumZ"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="digitCount"> + <number>3</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLCDNumber" name="lcdNumX"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="digitCount"> + <number>3</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="lblZ_3"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="text"> + <string>TZ</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lblY_3"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="text"> + <string>TY</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLCDNumber" name="lcdNumRotY"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="digitCount"> + <number>3</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="lblRotX_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>yaw</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="lblRotZ_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>roll</string> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLCDNumber" name="lcdNumRotZ"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="digitCount"> + <number>3</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="box_mapped_headpose"> + <property name="title"> + <string notr="true">Game data</string> + </property> + <layout class="QGridLayout" name="gridLayout_10"> + <item row="0" column="0"> + <widget class="QLabel" name="lblX_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TX</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLCDNumber" name="lcdNumOutputPosX"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>3</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLCDNumber" name="lcdNumOutputPosY"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>3</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="lblRotY_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>pitch</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLCDNumber" name="lcdNumOutputRotY"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>3</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="lblZ_2"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TZ</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLCDNumber" name="lcdNumOutputRotX"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>3</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lblY_2"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TY</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="lblRotX_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>yaw</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLCDNumber" name="lcdNumOutputPosZ"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>3</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="lblRotZ_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>roll</string> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLCDNumber" name="lcdNumOutputRotZ"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>3</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Flat</enum> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="0" colspan="2"> + <widget class="QGroupBox" name="video_feed"> + <property name="title"> + <string>Video preview</string> + </property> + <layout class="QFormLayout"> + <property name="horizontalSpacing"> + <number>0</number> </property> - <property name="title"> - <string>Protocol</string> + <property name="verticalSpacing"> + <number>0</number> </property> - <layout class="QGridLayout" name="gridLayout_4"> - <property name="topMargin"> - <number>6</number> - </property> - <property name="bottomMargin"> - <number>6</number> - </property> - <property name="verticalSpacing"> - <number>3</number> - </property> - <item row="0" column="1"> - <widget class="QPushButton" name="btnShowServerControls"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Settings</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboProtocol"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupWindows"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="leftMargin"> + <number>0</number> </property> - <property name="title"> - <string>Settings</string> + <property name="topMargin"> + <number>0</number> </property> - <layout class="QGridLayout" name="gridLayout_6"> - <property name="topMargin"> - <number>6</number> - </property> - <property name="bottomMargin"> - <number>6</number> - </property> - <property name="verticalSpacing"> - <number>3</number> - </property> - <item row="0" column="0"> - <widget class="QPushButton" name="btnEditCurves"> - <property name="text"> - <string>Mapping</string> - </property> - <property name="icon"> - <iconset resource="main-facetracknoir.qrc"> - <normaloff>:/uielements/curves.png</normaloff>:/uielements/curves.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>91</width> - <height>20</height> - </size> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QPushButton" name="btnShortcuts"> - <property name="text"> - <string>Keys</string> - </property> - <property name="icon"> - <iconset resource="main-facetracknoir.qrc"> - <normaloff>:/uielements/tools.png</normaloff>:/uielements/tools.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>98</width> - <height>24</height> - </size> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupStartStop"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="rightMargin"> + <number>0</number> </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> + <property name="bottomMargin"> + <number>0</number> </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> + <item row="0" column="0"> + <widget class="QFrame" name="video_frame"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>640</width> + <height>480</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>640</width> + <height>480</height> + </size> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="video_frame_label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>640</width> + <height>480</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>640</width> + <height>480</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="2"> + <widget class="QGroupBox" name="controls"> + <property name="title"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>3</number> </property> - <property name="title"> - <string notr="true">Controls</string> + <property name="leftMargin"> + <number>0</number> </property> - <layout class="QGridLayout" name="gridLayout_5"> - <property name="topMargin"> - <number>6</number> - </property> - <property name="bottomMargin"> - <number>6</number> - </property> - <property name="verticalSpacing"> - <number>3</number> - </property> - <item row="0" column="1"> - <widget class="QPushButton" name="btnStopTracker"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Stop</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QPushButton" name="btnStartTracker"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Start</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QGroupBox" name="headpose"> - <property name="geometry"> - <rect> - <x>185</x> - <y>10</y> - <width>761</width> - <height>211</height> - </rect> - </property> - <property name="title"> - <string/> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="spacing"> - <number>10</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QGroupBox" name="box_raw_headpose"> - <property name="title"> - <string notr="true">Raw pose</string> + <property name="topMargin"> + <number>0</number> </property> - <layout class="QGridLayout" name="gridLayout_8"> - <item row="1" column="1"> - <widget class="QLCDNumber" name="lcdNumY"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="digitCount"> - <number>3</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLCDNumber" name="lcdNumRotX"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="digitCount"> - <number>3</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="lblRotY_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>pitch</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="lblX_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>TX</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLCDNumber" name="lcdNumZ"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="digitCount"> - <number>3</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLCDNumber" name="lcdNumX"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="digitCount"> - <number>3</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="lblZ_3"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="text"> - <string>TZ</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="lblY_3"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="text"> - <string>TY</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLCDNumber" name="lcdNumRotY"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="digitCount"> - <number>3</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="lblRotX_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>yaw</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="lblRotZ_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>roll</string> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLCDNumber" name="lcdNumRotZ"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="digitCount"> - <number>3</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="box_mapped_headpose"> - <property name="title"> - <string notr="true">Game data</string> + <property name="rightMargin"> + <number>0</number> </property> - <layout class="QGridLayout" name="gridLayout_10"> - <item row="0" column="0"> - <widget class="QLabel" name="lblX_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="font"> - <font> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>TX</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLCDNumber" name="lcdNumOutputPosX"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Connected game</string> + </property> + <layout class="QGridLayout" name="gridLayout_9"> + <property name="topMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="verticalSpacing"> <number>3</number> </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLCDNumber" name="lcdNumOutputPosY"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> + <item row="0" column="0"> + <widget class="QLabel" name="game_name"> + <property name="text"> + <string>Not connected</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupProfile"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Profile</string> + </property> + <layout class="QGridLayout" name="gridLayout_7"> + <property name="topMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="verticalSpacing"> <number>3</number> </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="lblRotY_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="font"> - <font> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>pitch</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLCDNumber" name="lcdNumOutputRotY"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> + <item row="1" column="1"> + <widget class="QPushButton" name="btnSave"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Save</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QPushButton" name="btnLoad"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Load</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QComboBox" name="iconcomboProfile"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxVisibleItems"> + <number>10</number> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QPushButton" name="btnSaveAs"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Save As ...</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupTrackerSource"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Tracker</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="topMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="verticalSpacing"> <number>3</number> </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="lblZ_2"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="font"> - <font> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>TZ</string> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLCDNumber" name="lcdNumOutputRotX"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> + <item row="0" column="0"> + <widget class="QComboBox" name="iconcomboTrackerSource"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="btnShowEngineControls"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Settings</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupFilter"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Filter</string> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <property name="topMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="verticalSpacing"> <number>3</number> </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="lblY_2"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="font"> - <font> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>TY</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="lblRotX_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="font"> - <font> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>yaw</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLCDNumber" name="lcdNumOutputPosZ"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> + <item row="0" column="0"> + <widget class="QComboBox" name="iconcomboFilter"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="btnShowFilterControls"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Settings</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupGameProtocol"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Protocol</string> + </property> + <layout class="QGridLayout" name="gridLayout_4"> + <property name="topMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="verticalSpacing"> <number>3</number> </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="lblRotZ_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="font"> - <font> - <stylestrategy>NoAntialias</stylestrategy> - <kerning>false</kerning> - </font> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>roll</string> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLCDNumber" name="lcdNumOutputRotZ"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> + <item row="0" column="1"> + <widget class="QPushButton" name="btnShowServerControls"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Settings</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QComboBox" name="iconcomboProtocol"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupWindows"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Settings</string> + </property> + <layout class="QGridLayout" name="gridLayout_6"> + <property name="topMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="verticalSpacing"> <number>3</number> </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> + <item row="0" column="0"> + <widget class="QPushButton" name="btnEditCurves"> + <property name="text"> + <string>Mapping</string> + </property> + <property name="icon"> + <iconset resource="main-facetracknoir.qrc"> + <normaloff>:/uielements/curves.png</normaloff>:/uielements/curves.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>91</width> + <height>20</height> + </size> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QPushButton" name="btnShortcuts"> + <property name="text"> + <string>Keys</string> + </property> + <property name="icon"> + <iconset resource="main-facetracknoir.qrc"> + <normaloff>:/uielements/tools.png</normaloff>:/uielements/tools.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>98</width> + <height>24</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupStartStop"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>65536</width> + <height>65536</height> + </size> + </property> + <property name="title"> + <string notr="true">Controls</string> + </property> + <layout class="QGridLayout" name="gridLayout_5"> + <property name="topMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <property name="verticalSpacing"> + <number>3</number> </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QGroupBox" name="octopus"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>166</width> - <height>211</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Tracking preview</string> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <property name="spacing"> - <number>0</number> - </property> - <item row="0" column="0"> - <widget class="GLWidget" name="pose_display" native="true"/> - </item> - </layout> - </widget> + <item row="0" column="1"> + <widget class="QPushButton" name="btnStopTracker"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Stop</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QPushButton" name="btnStartTracker"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Start</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </item> + </layout> </widget> </widget> <customwidgets> -- cgit v1.2.3 From ffa06a093c0ca6a1024db9b013fe52d87bb2553f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 14 Oct 2014 14:05:48 +0200 Subject: fix several instances of same group not refreshing --- facetracknoir/options.h | 144 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 95 insertions(+), 49 deletions(-) diff --git a/facetracknoir/options.h b/facetracknoir/options.h index 37377b55..b4b1f0f7 100644 --- a/facetracknoir/options.h +++ b/facetracknoir/options.h @@ -8,9 +8,11 @@ #pragma once #include <memory> +#include <tuple> +#include <map> + #include <QObject> #include <QSettings> -#include <QMap> #include <QString> #include <QVariant> #include <QMutex> @@ -25,9 +27,14 @@ #include <QLabel> #include <QCoreApplication> +#include <cinttypes> + #include <QDebug> namespace options { + template<typename k, typename v> + using map = std::map<k, v>; + template<typename t> // don't elide usages of the function, qvariant default implicit // conversion results in nonsensical runtime behavior -sh @@ -66,7 +73,7 @@ namespace options { // snapshot of qsettings group at given time class group { private: - QMap<QString, QVariant> map; + map<QString, QVariant> map; QString name; static const QString ini_pathname() { @@ -85,39 +92,42 @@ namespace options { } static constexpr const char* org = "opentrack"; - void save() { + void save() + { QSettings s(ini_pathname(), QSettings::IniFormat); s.beginGroup(name); - for (auto& k : map.keys()) - s.setValue(k, map[k]); + for (auto& i : map) + s.setValue(i.first, map[i.first]); s.endGroup(); } + template<typename t> - t get(const QString& k) { - return qcruft_to_t<t>(map.value(k)); + t get(const QString& k) + { + return qcruft_to_t<t>(map[k]); } + void put(const QString& s, const QVariant& d) { map[s] = d; } + bool contains(const QString& s) { - return map.contains(s); + return map.count(s) != 0; } }; class impl_bundle : public QObject { Q_OBJECT - private: + protected: QMutex mtx; const QString group_name; group saved; group transient; + bool modified; impl_bundle(const impl_bundle&) = delete; impl_bundle& operator=(const impl_bundle&) = delete; - bool modified; - signals: - void changed(); public: impl_bundle(const QString& group_name) : mtx(QMutex::Recursive), @@ -127,25 +137,32 @@ namespace options { modified(false) { } + + QString name() { return group_name; } + void reload() { QMutexLocker l(&mtx); saved = group(group_name); transient = saved; + modified = false; } - void store_kv(const QString& name, const QVariant& datum) + + bool store_kv(const QString& name, const QVariant& datum) { QMutexLocker l(&mtx); + auto old = transient.get<QVariant>(name); if (!transient.contains(name) || datum != old) { if (!modified) - qDebug() << "bundle" << group_name << - "modified due to" << name << - transient.get<QVariant>(name) << - old << "->" << datum; + qDebug() << "bundle" << (intptr_t)static_cast<void*>(this) << + "modified as per" << name << old << "->" << datum; + modified = true; transient.put(name, datum); + return true; } + return false; } bool contains(const QString& name) { @@ -153,7 +170,8 @@ namespace options { return transient.contains(name); } template<typename t> - t get(const QString& name) { + t get(const QString& name) + { QMutexLocker l(&mtx); return transient.get<t>(name); } @@ -163,14 +181,6 @@ namespace options { modified = false; saved = transient; transient.save(); - emit changed(); - } - void revert() - { - QMutexLocker l(&mtx); - modified = false; - transient = saved; - emit changed(); } bool modifiedp() { @@ -178,15 +188,64 @@ namespace options { return modified; } }; - - using pbundle = std::shared_ptr<impl_bundle>; + + class opt_bundle; + using pbundle = std::shared_ptr<opt_bundle>; + + namespace { + using tt = std::tuple<int, pbundle>; + + QMutex implsgl_mtx(QMutex::Recursive); + map<QString, tt> implsgl_bundles; + } + + class opt_bundle : public impl_bundle + { + public: + opt_bundle() : impl_bundle("i-have-no-name") {} + opt_bundle(const QString& group_name) : impl_bundle(group_name) {} + + ~opt_bundle() + { + QMutexLocker l(&implsgl_mtx); + + if (--std::get<0>(implsgl_bundles[this->group_name]) == 0) + implsgl_bundles.erase(this->group_name); + } + }; + + inline pbundle bundle(const QString& group) { + QMutexLocker l(&implsgl_mtx); + + if (implsgl_bundles.count(group) != 0) + return std::get<1>(implsgl_bundles[group]); + + auto shr = std::make_shared<opt_bundle>(group); + implsgl_bundles[group] = tt(1,shr); + return shr; + } class base_value : public QObject { Q_OBJECT #define DEFINE_SLOT(t) void setValue(t datum) { store(datum); } -#define DEFINE_SIGNAL(t) void valueChanged(t); +#define DEFINE_SIGNAL(t) void valueChanged(const t&) public: - base_value(pbundle b, const QString& name) : b(b), self_name(name) {} + base_value(pbundle b, const QString& name) : b(b), self_name(name), reentrancy_count(0) {} + protected: + pbundle b; + QString self_name; + + template<typename t> + void store(const t& datum) + { + reentrancy_count++; + if (b->store_kv(self_name, datum)) + if (reentrancy_count == 0) + emit valueChanged(datum); + reentrancy_count--; + } + private: + volatile char reentrancy_count; public slots: DEFINE_SLOT(double) DEFINE_SLOT(int) @@ -197,34 +256,25 @@ namespace options { DEFINE_SIGNAL(int); DEFINE_SIGNAL(bool); DEFINE_SIGNAL(QString); - // Qt5 moc really insists on that one -sh 20141012 - DEFINE_SIGNAL(QVariant); - protected: - pbundle b; - QString self_name; - - template<typename t> - void store(const t& datum) - { - b->store_kv(self_name, datum); - emit valueChanged(static_cast<t>(datum)); - } }; template<typename t> class value : public base_value { public: - t operator=(const t& datum) + t operator=(const t datum) { - store(qVariantFromValue<t>(datum)); + store(datum); return datum; } static constexpr const Qt::ConnectionType DIRECT_CONNTYPE = Qt::DirectConnection; - static constexpr const Qt::ConnectionType SAFE_CONNTYPE = Qt::AutoConnection; + static constexpr const Qt::ConnectionType SAFE_CONNTYPE = Qt::BlockingQueuedConnection; value(pbundle b, const QString& name, t def) : base_value(b, name) { if (!b->contains(name) || b->get<QVariant>(name).type() == QVariant::Invalid) + { + qDebug() << "new option" << *(t*)this; *this = def; + } } operator t() { @@ -300,8 +350,4 @@ namespace options { lb->setText(v); base_value::connect(&v, SIGNAL(valueChanged(QString)), lb, SLOT(setText(QString)), v.SAFE_CONNTYPE); } - - inline pbundle bundle(const QString& group) { - return std::make_shared<impl_bundle>(group); - } } -- cgit v1.2.3 From 1fdd53b6f652419f0f63c6846660f80ec672853a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 14 Oct 2014 14:06:14 +0200 Subject: update options api --- facetracknoir/shortcuts.cpp | 2 +- ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp | 2 +- ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp | 2 +- ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp | 2 +- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp | 2 +- ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp | 2 +- ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp | 2 +- ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp | 2 +- ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp | 2 +- ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp | 2 +- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 2 +- ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp | 2 +- ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp | 2 +- ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp | 2 +- ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp | 2 +- ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/facetracknoir/shortcuts.cpp b/facetracknoir/shortcuts.cpp index 758617ca..94c46376 100644 --- a/facetracknoir/shortcuts.cpp +++ b/facetracknoir/shortcuts.cpp @@ -40,7 +40,7 @@ void KeyboardShortcutDialog::doOK() { } void KeyboardShortcutDialog::doCancel() { - mainApp->b->revert(); + mainApp->s.b->reload(); close(); } diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp index 965cb3ea..1520ad6e 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp @@ -43,7 +43,7 @@ void FilterControls::doCancel() { void FilterControls::discard() { - s.b->revert(); + s.b->reload(); } void FilterControls::save() { diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp index a32875b9..b6bde553 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp @@ -33,7 +33,7 @@ void FilterControls::doOK() { } void FilterControls::doCancel() { - s.b->revert(); + s.b->reload(); this->close(); } diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp index 1aa67b43..0074a64a 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp @@ -59,7 +59,7 @@ void FGControls::doOK() { } void FGControls::doCancel() { - s.b->revert(); + s.b->reload(); this->close(); } diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp index d2af714f..ceabeabf 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp @@ -42,7 +42,7 @@ void FSUIPCControls::doOK() { } void FSUIPCControls::doCancel() { - s.b->revert(); + s.b->reload(); close(); } diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp index 654f6c18..9db3211c 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp @@ -59,7 +59,7 @@ void FTControls::doOK() { } void FTControls::doCancel() { - s.b->revert(); + s.b->reload(); this->close(); } diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp index cab5b4ba..8af12ad7 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp @@ -52,7 +52,7 @@ void FTNControls::doOK() { // Cancel clicked on server-dialog // void FTNControls::doCancel() { - s.b->revert(); + s.b->reload(); this->close(); } diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp index 4b12a4f0..efac958c 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp @@ -59,7 +59,7 @@ void MOUSEControls::doOK() { } void MOUSEControls::doCancel() { - s.b->revert(); + s.b->reload(); this->close(); } diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp index cd8c21f9..c3d64e9d 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp @@ -44,7 +44,7 @@ void SCControls::doOK() { } void SCControls::doCancel() { - s.b->revert(); + s.b->reload(); close(); } diff --git a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp index 5a0cade4..6d6a951e 100644 --- a/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp +++ b/ftnoir_tracker_freepie-udp/ftnoir_tracker_freepie-udp_dialog.cpp @@ -17,7 +17,7 @@ void TrackerDialog::doOK() { } void TrackerDialog::doCancel() { - s.b->revert(); + s.b->reload(); this->close(); } diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 05eb116c..a1cb33a5 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -267,6 +267,6 @@ void TrackerControls::doOK() void TrackerControls::doCancel() { - s.b->revert(); + s.b->reload(); this->close(); } diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp index dbd9981f..c81ddce7 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp @@ -17,7 +17,7 @@ void TrackerControls::doOK() { } void TrackerControls::doCancel() { - s.b->revert(); + s.b->reload(); close(); } diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp index 4ddbcb0c..84e02fb0 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp @@ -49,7 +49,7 @@ void TrackerControls::doOK() { } void TrackerControls::doCancel() { - s.b->revert(); + s.b->reload(); this->close(); } diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp index 3af7b560..981cbea0 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp @@ -230,7 +230,7 @@ void TrackerDialog::doApply() void TrackerDialog::doCancel() { - s.b->revert(); + s.b->reload(); close(); } diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp index a66eb83b..38c7457e 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp @@ -21,7 +21,7 @@ void TrackerControls::doOK() { } void TrackerControls::doCancel() { - s.b->revert(); + s.b->reload(); close(); } diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp index b0f40ee9..062b1899 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp @@ -18,7 +18,7 @@ void TrackerControls::doOK() { } void TrackerControls::doCancel() { - s.b->revert(); + s.b->reload(); this->close(); } -- cgit v1.2.3 From 8aff21e4e73aa2517dc433da12202fd8c6052783 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 14 Oct 2014 19:19:13 +0200 Subject: merely nits --- facetracknoir/options.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/facetracknoir/options.h b/facetracknoir/options.h index b4b1f0f7..27d7eed7 100644 --- a/facetracknoir/options.h +++ b/facetracknoir/options.h @@ -97,7 +97,7 @@ namespace options { QSettings s(ini_pathname(), QSettings::IniFormat); s.beginGroup(name); for (auto& i : map) - s.setValue(i.first, map[i.first]); + s.setValue(i.first, i.second); s.endGroup(); } @@ -210,7 +210,10 @@ namespace options { QMutexLocker l(&implsgl_mtx); if (--std::get<0>(implsgl_bundles[this->group_name]) == 0) + { + qDebug() << "bundle" << this->group_name << "not used anymore"; implsgl_bundles.erase(this->group_name); + } } }; -- cgit v1.2.3 From 7254de89f65817de879c2f04f53ec598b283cbab Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 14 Oct 2014 19:46:49 +0200 Subject: nix debug printf --- facetracknoir/options.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/facetracknoir/options.h b/facetracknoir/options.h index 27d7eed7..de445e69 100644 --- a/facetracknoir/options.h +++ b/facetracknoir/options.h @@ -274,10 +274,7 @@ namespace options { value(pbundle b, const QString& name, t def) : base_value(b, name) { if (!b->contains(name) || b->get<QVariant>(name).type() == QVariant::Invalid) - { - qDebug() << "new option" << *(t*)this; *this = def; - } } operator t() { -- cgit v1.2.3 From 345b4bf257b805ea1d2903b921e95e4be20eded5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 14 Oct 2014 19:47:28 +0200 Subject: octopii width, srs business so you don't hafta --- facetracknoir/facetracknoir.ui | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/facetracknoir/facetracknoir.ui b/facetracknoir/facetracknoir.ui index 32aea889..ad968030 100644 --- a/facetracknoir/facetracknoir.ui +++ b/facetracknoir/facetracknoir.ui @@ -40,26 +40,11 @@ <string>Tracking preview</string> </property> <layout class="QGridLayout" name="gridLayout_2"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <property name="spacing"> - <number>0</number> - </property> <item row="0" column="0"> <widget class="GLWidget" name="pose_display" native="true"> <property name="minimumSize"> <size> - <width>0</width> + <width>90</width> <height>120</height> </size> </property> -- cgit v1.2.3 From e79d33c5eeecf12d6777fe2d5619f1e5d6c782c2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 14 Oct 2014 20:55:19 +0200 Subject: nix crash on exit, add more stl, less qt --- facetracknoir/options.h | 131 ++++++++++++++++++++++++++++++------------------ 1 file changed, 83 insertions(+), 48 deletions(-) diff --git a/facetracknoir/options.h b/facetracknoir/options.h index de445e69..b55d2bf0 100644 --- a/facetracknoir/options.h +++ b/facetracknoir/options.h @@ -10,6 +10,7 @@ #include <memory> #include <tuple> #include <map> +#include <string> #include <QObject> #include <QSettings> @@ -34,6 +35,7 @@ namespace options { template<typename k, typename v> using map = std::map<k, v>; + using std::string; template<typename t> // don't elide usages of the function, qvariant default implicit @@ -73,8 +75,8 @@ namespace options { // snapshot of qsettings group at given time class group { private: - map<QString, QVariant> map; - QString name; + map<string, QVariant> map; + string name; static const QString ini_pathname() { QSettings settings(group::org); @@ -82,12 +84,17 @@ namespace options { QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); } public: - group(const QString& name) : name(name) + group(const string& name) : name(name) { QSettings conf(ini_pathname(), QSettings::IniFormat); - conf.beginGroup(name); - for (auto& k : conf.childKeys()) - map[k] = conf.value(k); + auto q_name = QString::fromStdString(name); + conf.beginGroup(q_name); + for (auto& k_ : conf.childKeys()) + { + auto tmp = k_.toUtf8(); + string k(tmp); + map[k] = conf.value(k_); + } conf.endGroup(); } static constexpr const char* org = "opentrack"; @@ -95,24 +102,28 @@ namespace options { void save() { QSettings s(ini_pathname(), QSettings::IniFormat); - s.beginGroup(name); + auto q_name = QString::fromStdString(name); + s.beginGroup(q_name); for (auto& i : map) - s.setValue(i.first, i.second); + { + auto k = QString::fromStdString(i.first); + s.setValue(k, i.second); + } s.endGroup(); } template<typename t> - t get(const QString& k) + t get(const string& k) { return qcruft_to_t<t>(map[k]); } - void put(const QString& s, const QVariant& d) + void put(const string& s, const QVariant& d) { map[s] = d; } - bool contains(const QString& s) + bool contains(const string& s) { return map.count(s) != 0; } @@ -122,14 +133,14 @@ namespace options { Q_OBJECT protected: QMutex mtx; - const QString group_name; + const string group_name; group saved; group transient; bool modified; impl_bundle(const impl_bundle&) = delete; impl_bundle& operator=(const impl_bundle&) = delete; public: - impl_bundle(const QString& group_name) : + impl_bundle(const string& group_name) : mtx(QMutex::Recursive), group_name(group_name), saved(group_name), @@ -138,7 +149,7 @@ namespace options { { } - QString name() { return group_name; } + string name() { return group_name; } void reload() { QMutexLocker l(&mtx); @@ -147,30 +158,26 @@ namespace options { modified = false; } - bool store_kv(const QString& name, const QVariant& datum) + bool store_kv(const string& name, const QVariant& datum) { QMutexLocker l(&mtx); auto old = transient.get<QVariant>(name); if (!transient.contains(name) || datum != old) { - if (!modified) - qDebug() << "bundle" << (intptr_t)static_cast<void*>(this) << - "modified as per" << name << old << "->" << datum; - modified = true; transient.put(name, datum); return true; } return false; } - bool contains(const QString& name) + bool contains(const string& name) { QMutexLocker l(&mtx); return transient.contains(name); } template<typename t> - t get(const QString& name) + t get(const string& name) { QMutexLocker l(&mtx); return transient.get<t>(name); @@ -190,53 +197,72 @@ namespace options { }; class opt_bundle; - using pbundle = std::shared_ptr<opt_bundle>; - namespace { - using tt = std::tuple<int, pbundle>; + namespace + { + template<typename k, typename v, typename cnt = int> + struct opt_singleton + { + public: + using pbundle = std::shared_ptr<v>; + using tt = std::tuple<cnt, pbundle>; + private: + QMutex implsgl_mtx; + map<k, tt> implsgl_data; + public: + opt_singleton() : implsgl_mtx(QMutex::Recursive) {} + + pbundle bundle(const k& key) + { + QMutexLocker l(&implsgl_mtx); + + if (implsgl_data.count(key) != 0) + return std::get<1>(implsgl_data[key]); + + auto shr = std::make_shared<v>(key); + implsgl_data[key] = tt(cnt(1), shr); + return shr; + } + + void bundle_decf(const k& key) + { + QMutexLocker l(&implsgl_mtx); + + if (--std::get<0>(implsgl_data[key]) == 0) + implsgl_data.erase(key); + } + + ~opt_singleton() { implsgl_data.clear(); } + }; - QMutex implsgl_mtx(QMutex::Recursive); - map<QString, tt> implsgl_bundles; + using pbundle = std::shared_ptr<opt_bundle>; + using t_fact = opt_singleton<string, opt_bundle>; + static t_fact* opt_factory = new t_fact; } + + static inline t_fact::pbundle bundle(const string name) { return opt_factory->bundle(name); } class opt_bundle : public impl_bundle { public: opt_bundle() : impl_bundle("i-have-no-name") {} - opt_bundle(const QString& group_name) : impl_bundle(group_name) {} + opt_bundle(const string& group_name) : impl_bundle(group_name) {} ~opt_bundle() { - QMutexLocker l(&implsgl_mtx); - - if (--std::get<0>(implsgl_bundles[this->group_name]) == 0) - { - qDebug() << "bundle" << this->group_name << "not used anymore"; - implsgl_bundles.erase(this->group_name); - } + opt_factory->bundle_decf(this->group_name); } }; - - inline pbundle bundle(const QString& group) { - QMutexLocker l(&implsgl_mtx); - - if (implsgl_bundles.count(group) != 0) - return std::get<1>(implsgl_bundles[group]); - - auto shr = std::make_shared<opt_bundle>(group); - implsgl_bundles[group] = tt(1,shr); - return shr; - } class base_value : public QObject { Q_OBJECT #define DEFINE_SLOT(t) void setValue(t datum) { store(datum); } #define DEFINE_SIGNAL(t) void valueChanged(const t&) public: - base_value(pbundle b, const QString& name) : b(b), self_name(name), reentrancy_count(0) {} + base_value(pbundle b, const string& name) : b(b), self_name(name), reentrancy_count(0) {} protected: pbundle b; - QString self_name; + string self_name; template<typename t> void store(const t& datum) @@ -260,6 +286,12 @@ namespace options { DEFINE_SIGNAL(bool); DEFINE_SIGNAL(QString); }; + + static inline string string_from_qstring(const QString& datum) + { + auto tmp = datum.toUtf8(); + return string(tmp.constData()); + } template<typename t> class value : public base_value { @@ -271,11 +303,14 @@ namespace options { } static constexpr const Qt::ConnectionType DIRECT_CONNTYPE = Qt::DirectConnection; static constexpr const Qt::ConnectionType SAFE_CONNTYPE = Qt::BlockingQueuedConnection; - value(pbundle b, const QString& name, t def) : base_value(b, name) + value(pbundle b, const string& name, t def) : base_value(b, name) { if (!b->contains(name) || b->get<QVariant>(name).type() == QVariant::Invalid) *this = def; } + value(pbundle b, const QString& name, t def) : value(b, string_from_qstring(name), def) {} + value(pbundle b, const char* name, t def) : value(b, string(name), def) {} + operator t() { return b->get<t>(self_name); -- cgit v1.2.3 From 26e9257cc97e7496912254c945943bdc69d14007 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 14 Oct 2014 22:21:16 +0200 Subject: fix calibration dialog in aruco/pt --- facetracknoir/options.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/facetracknoir/options.h b/facetracknoir/options.h index b55d2bf0..ffabd756 100644 --- a/facetracknoir/options.h +++ b/facetracknoir/options.h @@ -269,7 +269,7 @@ namespace options { { reentrancy_count++; if (b->store_kv(self_name, datum)) - if (reentrancy_count == 0) + if (reentrancy_count <= 3) emit valueChanged(datum); reentrancy_count--; } @@ -302,7 +302,7 @@ namespace options { return datum; } static constexpr const Qt::ConnectionType DIRECT_CONNTYPE = Qt::DirectConnection; - static constexpr const Qt::ConnectionType SAFE_CONNTYPE = Qt::BlockingQueuedConnection; + static constexpr const Qt::ConnectionType SAFE_CONNTYPE = Qt::UniqueConnection; value(pbundle b, const string& name, t def) : base_value(b, name) { if (!b->contains(name) || b->get<QVariant>(name).type() == QVariant::Invalid) -- cgit v1.2.3 From 4c1b69ee6c4297d9e1b3ef2f68e3602f0479c702 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 14 Oct 2014 22:43:50 +0200 Subject: drop EZCA mode, pitch already up to 180 --- ftnoir_protocol_ft/ftnoir_ftcontrols.ui | 91 +++++++----------------- ftnoir_protocol_ft/ftnoir_protocol_ft.cpp | 2 +- ftnoir_protocol_ft/ftnoir_protocol_ft.h | 5 +- ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp | 1 - 4 files changed, 28 insertions(+), 71 deletions(-) diff --git a/ftnoir_protocol_ft/ftnoir_ftcontrols.ui b/ftnoir_protocol_ft/ftnoir_ftcontrols.ui index 172d0f8d..5356d2e5 100644 --- a/ftnoir_protocol_ft/ftnoir_ftcontrols.ui +++ b/ftnoir_protocol_ft/ftnoir_ftcontrols.ui @@ -12,8 +12,8 @@ <rect> <x>0</x> <y>0</y> - <width>520</width> - <height>449</height> + <width>422</width> + <height>305</height> </rect> </property> <property name="sizePolicy"> @@ -42,16 +42,16 @@ <bool>false</bool> </property> <layout class="QGridLayout" name="gridLayout_2"> - <item row="1" column="0"> - <widget class="QGroupBox" name="groupBox_2"> + <item row="0" column="0"> + <widget class="QGroupBox" name="groupBox"> <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="title"> - <string>TrackIR.exe</string> + <string>TIRViews</string> </property> <property name="alignment"> <set>Qt::AlignJustify|Qt::AlignTop</set> @@ -59,55 +59,27 @@ <property name="flat"> <bool>false</bool> </property> - <layout class="QFormLayout" name="formLayout_3"> + <layout class="QFormLayout" name="formLayout_2"> <item row="0" column="0"> - <widget class="QCheckBox" name="chkStartDummy"> + <widget class="QCheckBox" name="chkTIRViews"> <property name="layoutDirection"> <enum>Qt::RightToLeft</enum> </property> <property name="text"> - <string>EZCA mode</string> + <string>Memory hacks</string> </property> </widget> </item> <item row="0" column="1"> - <widget class="QLabel" name="label"> + <widget class="QLabel" name="label_2"> <property name="text"> - <string>Can enable for 180° pitch range (not shown in UI) rather than regular 90°</string> + <string>Only for very old and buggy old games such as CFS3.</string> </property> - <property name="wordWrap"> - <bool>true</bool> + <property name="scaledContents"> + <bool>false</bool> </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="2" column="0"> - <widget class="QGroupBox" name="groupBox_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Select interface</string> - </property> - <property name="alignment"> - <set>Qt::AlignJustify|Qt::AlignTop</set> - </property> - <property name="flat"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="0" column="0"> - <widget class="QComboBox" name="cbxSelectInterface"/> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>Disable one of the protocols if game is confused by presence of both at the same time.</string> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> </property> <property name="wordWrap"> <bool>true</bool> @@ -117,7 +89,7 @@ </layout> </widget> </item> - <item row="3" column="0"> + <item row="2" column="0"> <widget class="QGroupBox" name="groupBox_4"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> @@ -155,23 +127,23 @@ </layout> </widget> </item> - <item row="4" column="0"> + <item row="3" column="0"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="standardButtons"> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> </property> </widget> </item> - <item row="0" column="0"> - <widget class="QGroupBox" name="groupBox"> + <item row="1" column="0"> + <widget class="QGroupBox" name="groupBox_3"> <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="title"> - <string>TIRViews</string> + <string>Select interface</string> </property> <property name="alignment"> <set>Qt::AlignJustify|Qt::AlignTop</set> @@ -179,27 +151,14 @@ <property name="flat"> <bool>false</bool> </property> - <layout class="QFormLayout" name="formLayout_2"> + <layout class="QGridLayout" name="gridLayout_3"> <item row="0" column="0"> - <widget class="QCheckBox" name="chkTIRViews"> - <property name="layoutDirection"> - <enum>Qt::RightToLeft</enum> - </property> - <property name="text"> - <string>Memory hacks</string> - </property> - </widget> + <widget class="QComboBox" name="cbxSelectInterface"/> </item> <item row="0" column="1"> - <widget class="QLabel" name="label_2"> + <widget class="QLabel" name="label_8"> <property name="text"> - <string>Only for very old and buggy old games such as CFS3.</string> - </property> - <property name="scaledContents"> - <bool>false</bool> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + <string>Disable one of the protocols if game is confused by presence of both at the same time.</string> </property> <property name="wordWrap"> <bool>true</bool> diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp index 107735e2..ae23be3c 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp @@ -50,7 +50,7 @@ FTNoIR_Protocol::~FTNoIR_Protocol() void FTNoIR_Protocol::sendHeadposeToGame(const double* headpose) { float yaw = getRadsFromDegrees(headpose[Yaw]); - float pitch = getRadsFromDegrees(headpose[Pitch]) * (s.useDummyExe ? 2.0 : 1.0); + float pitch = getRadsFromDegrees(headpose[Pitch]); float roll = getRadsFromDegrees(headpose[Roll]); float tx = headpose[TX] * 10.f; float ty = headpose[TY] * 10.f; diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h index 5b45e41a..5a9e5cdd 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h @@ -44,12 +44,11 @@ using namespace options; struct settings { pbundle b; value<int> intUsedInterface; - value<bool> useTIRViews, useDummyExe; + value<bool> useTIRViews; settings() : b(bundle("proto-freetrack")), intUsedInterface(b, "used-interfaces", 0), - useTIRViews(b, "use-memory-hacks", false), - useDummyExe(b, "ezca-mode", false) + useTIRViews(b, "use-memory-hacks", false) {} }; diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp index 9db3211c..3e440607 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp @@ -34,7 +34,6 @@ FTControls::FTControls() connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); connect(ui.bntLocateNPClient, SIGNAL(clicked()), this, SLOT(selectDLL())); - tie_setting(s.useDummyExe, ui.chkStartDummy); tie_setting(s.useTIRViews, ui.chkTIRViews); ui.cbxSelectInterface->addItem("Enable both"); -- cgit v1.2.3 From 2e79bf5e7c232aa8e09ea410083fce87330bbe3c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 14 Oct 2014 22:57:34 +0200 Subject: drop guard, only relevant in direct/blockingqueued --- facetracknoir/options.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/facetracknoir/options.h b/facetracknoir/options.h index ffabd756..7833ea41 100644 --- a/facetracknoir/options.h +++ b/facetracknoir/options.h @@ -259,7 +259,7 @@ namespace options { #define DEFINE_SLOT(t) void setValue(t datum) { store(datum); } #define DEFINE_SIGNAL(t) void valueChanged(const t&) public: - base_value(pbundle b, const string& name) : b(b), self_name(name), reentrancy_count(0) {} + base_value(pbundle b, const string& name) : b(b), self_name(name) {} protected: pbundle b; string self_name; @@ -267,14 +267,9 @@ namespace options { template<typename t> void store(const t& datum) { - reentrancy_count++; if (b->store_kv(self_name, datum)) - if (reentrancy_count <= 3) - emit valueChanged(datum); - reentrancy_count--; + emit valueChanged(datum); } - private: - volatile char reentrancy_count; public slots: DEFINE_SLOT(double) DEFINE_SLOT(int) -- cgit v1.2.3 From 14f59d9fe5f1926a8562efc8a51a785365bc0131 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 14 Oct 2014 23:02:15 +0200 Subject: aruco: fix fixating on the prev marker location --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 117 +++++++++++--------------- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 79 +++++++---------- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 6 +- 3 files changed, 78 insertions(+), 124 deletions(-) diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 1898d15b..099dec02 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -10,7 +10,7 @@ <x>0</x> <y>0</y> <width>562</width> - <height>214</height> + <height>178</height> </rect> </property> <property name="sizePolicy"> @@ -33,6 +33,42 @@ <item row="0" column="0"> <widget class="QFrame" name="frame"> <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="1"> + <widget class="QDoubleSpinBox" name="cameraFOV"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="minimum"> + <double>35.000000000000000</double> + </property> + <property name="maximum"> + <double>180.000000000000000</double> + </property> + <property name="value"> + <double>52.000000000000000</double> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Frames per second</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Resolution</string> + </property> + </widget> + </item> <item row="0" column="0"> <widget class="QLabel" name="label"> <property name="text"> @@ -75,59 +111,6 @@ </item> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Resolution</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QDoubleSpinBox" name="cameraFOV"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="minimum"> - <double>35.000000000000000</double> - </property> - <property name="maximum"> - <double>180.000000000000000</double> - </property> - <property name="value"> - <double>52.000000000000000</double> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Frames per second</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QComboBox" name="cameraName"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Camera name</string> - </property> - </widget> - </item> <item row="3" column="1"> <widget class="QComboBox" name="resolution"> <property name="sizePolicy"> @@ -158,26 +141,20 @@ </item> </widget> </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_6"> + <item row="2" column="0"> + <widget class="QLabel" name="label_3"> <property name="text"> - <string>Sun glare removal</string> + <string>Camera name</string> </property> </widget> </item> - <item row="4" column="1"> - <widget class="QSlider" name="desaturate_slider"> - <property name="maximum"> - <number>100</number> - </property> - <property name="singleStep"> - <number>10</number> - </property> - <property name="pageStep"> - <number>20</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + <item row="2" column="1"> + <widget class="QComboBox" name="cameraName"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> </widget> </item> diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 0974f0f0..fd8a8ce1 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -194,7 +194,6 @@ void Tracker::run() auto last_time = cv::getTickCount(); int cur_fps = 0; int last_fps = 0; - cv::Point2f last_centroid; while (!stop) { @@ -203,42 +202,9 @@ void Tracker::run() continue; auto tm = cv::getTickCount(); - const double c = s.desaturate * 16. / 100.; - - if (std::abs(c) > 1e-3) - { - const int w=color.cols, h=color.rows; - - cv::Mat hsv; - cv::cvtColor(color, hsv, cv::COLOR_BGR2HSV); - vector<cv::Mat> channels; - cv::split(hsv, channels); - cv::Mat sat = channels[1]; - cv::Mat val = channels[2]; - - struct ops { - static double sig(double x) - { - double x_ = -6 + x * 2 * 6; - return 1./(1.+exp(-x_)); - } - }; - - for (int i = 0; i < h; i++) - for (int j = 0; j < w; j++) - { - const double sat_ij = sat.at<unsigned char>(i, j)/255.; - val.at<unsigned char>(i, j) *= std::max(0., 1. - c*ops::sig(sat_ij)); - } - - channels[1] = sat; - channels[2] = val; - cv::merge(channels, hsv); - cv::cvtColor(hsv, color, cv::COLOR_HSV2BGR); - } cv::Mat grayscale; cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); - + const int scale = frame.cols > 480 ? 2 : 1; detector.setThresholdParams(scale > 1 ? 11 : 7, 4); @@ -333,9 +299,35 @@ void Tracker::run() cv::Vec3d rvec, tvec; - cv::solvePnP(obj_points, m, intrinsics, dist_coeffs, rvec, tvec, false, cv::ITERATIVE); + cv::solvePnP(obj_points, m, intrinsics, dist_coeffs, rvec, tvec, false, cv::P3P); std::vector<cv::Point2f> roi_projection(4); + + { + std::vector<cv::Point2f> repr2; + std::vector<cv::Point3f> centroid; + centroid.push_back(cv::Point3f(0, 0, 0)); + cv::projectPoints(centroid, rvec, tvec, intrinsics, dist_coeffs, repr2); + + { + auto s = cv::Scalar(255, 0, 255); + cv::circle(frame, repr2.at(0), 4, s, -1); + } + } + + for (int i = 0; i < 4; i++) + { + obj_points.at<float>(i, 0) -= s.headpos_x; + obj_points.at<float>(i, 1) -= s.headpos_y; + obj_points.at<float>(i, 2) -= s.headpos_z; + } + + { + cv::Mat rvec_, tvec_; + cv::solvePnP(obj_points, m, intrinsics, dist_coeffs, rvec_, tvec_, false, cv::P3P); + tvec = tvec_; + } + cv::Mat roi_points = obj_points * c_search_window; cv::projectPoints(roi_points, rvec, tvec, intrinsics, dist_coeffs, roi_projection); @@ -389,21 +381,9 @@ void Tracker::run() r = rmat; t = tvec; } - - std::vector<cv::Point2f> repr2; - std::vector<cv::Point3f> centroid; - centroid.push_back(cv::Point3f(0, 0, 0)); - cv::projectPoints(centroid, rvec, tvec, intrinsics, dist_coeffs, repr2); - - { - auto s = cv::Scalar(255, 0, 255); - cv::circle(frame, repr2.at(0), 4, s, -1); - } if (roi_valid) cv::rectangle(frame, last_roi, cv::Scalar(255, 0, 255), 1); - - last_centroid = repr2[0]; } else last_roi = cv::Rect(65535, 65535, 0, 0); @@ -490,7 +470,6 @@ TrackerControls::TrackerControls() tie_setting(s.headpos_x, ui.cx); tie_setting(s.headpos_y, ui.cy); tie_setting(s.headpos_z, ui.cz); - tie_setting(s.desaturate, ui.desaturate_slider); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); connect(ui.btn_calibrate, SIGNAL(clicked()), this, SLOT(toggleCalibrate())); @@ -540,6 +519,6 @@ void TrackerControls::doOK() void TrackerControls::doCancel() { - s.b->revert(); + s.b->reload(); this->close(); } diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 03fff844..3d37dacd 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -28,7 +28,6 @@ struct settings { pbundle b; value<double> fov, headpos_x, headpos_y, headpos_z; value<int> camera_index, force_fps, resolution; - value<int> desaturate; settings() : b(bundle("aruco-tracker")), fov(b, "field-of-view", 56), @@ -37,15 +36,14 @@ struct settings { headpos_z(b, "headpos-z", 0), camera_index(b, "camera-index", 0), force_fps(b, "force-fps", 0), - resolution(b, "force-resolution", 0), - desaturate(b, "desaturate", 0) + resolution(b, "force-resolution", 0) {} }; class Tracker : protected QThread, public ITracker { Q_OBJECT - static constexpr double c_search_window = 2.9; + static constexpr double c_search_window = 2.2; public: Tracker(); ~Tracker() override; -- cgit v1.2.3 From 585ab39e477faac19df0ec8ae4595905a9d671c3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik <sthalik@misaki.pl> Date: Tue, 14 Oct 2014 23:09:38 +0200 Subject: fix-build --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 0974f0f0..5d7508c4 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -540,6 +540,6 @@ void TrackerControls::doOK() void TrackerControls::doCancel() { - s.b->revert(); + s.b->reload(); this->close(); } -- cgit v1.2.3