From e2582c127addd7a3eaafb8cf8a63a5221c7aac20 Mon Sep 17 00:00:00 2001 From: Stéphane Lenclud Date: Sun, 3 Feb 2019 12:32:16 +0100 Subject: Kinect: Renaming more files. --- tracker-kinect-face/kinect_face_settings.ui | 65 +++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 tracker-kinect-face/kinect_face_settings.ui (limited to 'tracker-kinect-face/kinect_face_settings.ui') diff --git a/tracker-kinect-face/kinect_face_settings.ui b/tracker-kinect-face/kinect_face_settings.ui new file mode 100644 index 00000000..509eb819 --- /dev/null +++ b/tracker-kinect-face/kinect_face_settings.ui @@ -0,0 +1,65 @@ + + + test_ui + + + Qt::NonModal + + + + 0 + 0 + 278 + 58 + + + + Sine wave + + + + ../gui/images/opentrack.png../gui/images/opentrack.png + + + Qt::LeftToRight + + + false + + + + + + + 0 + 0 + + + + Pressing "Abort" will immediately crash the application. + + + + + + + + 0 + 0 + + + + QDialogButtonBox::Abort|QDialogButtonBox::Close + + + + + + + + + startEngineClicked() + stopEngineClicked() + cameraSettingsClicked() + + -- cgit v1.2.3 From 4508be24ef4adc4dac0c40ef316b07da75765b77 Mon Sep 17 00:00:00 2001 From: Stéphane Lenclud Date: Sun, 3 Feb 2019 15:03:57 +0100 Subject: Kinect: Limit actual frame rate to 30Hz. Fixing settings dialog. --- tracker-kinect-face/kinect_face_settings.cpp | 16 +++++++------ tracker-kinect-face/kinect_face_settings.h | 10 ++++---- tracker-kinect-face/kinect_face_settings.ui | 10 ++++---- tracker-kinect-face/kinect_face_tracker.cpp | 35 +++++++++++++++++----------- tracker-kinect-face/kinect_face_tracker.h | 4 +++- tracker-kinect-face/lang/nl_NL.ts | 8 +++---- tracker-kinect-face/lang/ru_RU.ts | 8 +++---- tracker-kinect-face/lang/stub.ts | 8 +++---- tracker-kinect-face/lang/zh_CN.ts | 8 +++---- 9 files changed, 59 insertions(+), 48 deletions(-) (limited to 'tracker-kinect-face/kinect_face_settings.ui') diff --git a/tracker-kinect-face/kinect_face_settings.cpp b/tracker-kinect-face/kinect_face_settings.cpp index 53aada06..238a3da6 100644 --- a/tracker-kinect-face/kinect_face_settings.cpp +++ b/tracker-kinect-face/kinect_face_settings.cpp @@ -17,29 +17,31 @@ #include -test_dialog::test_dialog() +KinectFaceSettings::KinectFaceSettings() { ui.setupUi(this); connect(ui.buttonBox, &QDialogButtonBox::clicked, [this](QAbstractButton* btn) { - if (btn == ui.buttonBox->button(QDialogButtonBox::Abort)) - // NOLINTNEXTLINE - *(volatile int*)nullptr = 0; + if (btn == ui.buttonBox->button(QDialogButtonBox::Abort)) + { + // NOLINTNEXTLINE + //*(volatile int*)nullptr = 0; + } }); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); } -void test_dialog::doOK() +void KinectFaceSettings::doOK() { //s.b->save(); close(); } -void test_dialog::doCancel() +void KinectFaceSettings::doCancel() { close(); } -OPENTRACK_DECLARE_TRACKER(KinectFaceTracker, test_dialog, test_metadata) +OPENTRACK_DECLARE_TRACKER(KinectFaceTracker, KinectFaceSettings, KinectFaceMetadata) diff --git a/tracker-kinect-face/kinect_face_settings.h b/tracker-kinect-face/kinect_face_settings.h index 0f8c170b..647aa754 100644 --- a/tracker-kinect-face/kinect_face_settings.h +++ b/tracker-kinect-face/kinect_face_settings.h @@ -1,16 +1,16 @@ #pragma once -#include "ui_test.h" +#include "ui_kinect_face_settings.h" #include "compat/macros.hpp" #include "api/plugin-api.hpp" -class test_dialog : public ITrackerDialog +class KinectFaceSettings : public ITrackerDialog { Q_OBJECT - Ui::test_ui ui; + Ui::KinectFaceUi ui; public: - test_dialog(); + KinectFaceSettings(); void register_tracker(ITracker *) override {} void unregister_tracker() override {} private slots: @@ -18,7 +18,7 @@ private slots: void doCancel(); }; -class test_metadata : public Metadata +class KinectFaceMetadata : public Metadata { Q_OBJECT diff --git a/tracker-kinect-face/kinect_face_settings.ui b/tracker-kinect-face/kinect_face_settings.ui index 509eb819..a6192d9b 100644 --- a/tracker-kinect-face/kinect_face_settings.ui +++ b/tracker-kinect-face/kinect_face_settings.ui @@ -1,7 +1,7 @@ - test_ui - + KinectFaceUi + Qt::NonModal @@ -14,11 +14,11 @@ - Sine wave + Kinect Face Tracker - ../gui/images/opentrack.png../gui/images/opentrack.png + :/images/kinect.png:/images/kinect.png Qt::LeftToRight @@ -36,7 +36,7 @@ - Pressing "Abort" will immediately crash the application. + Start OpenTrack to check if Kinect Face Tracker is working. diff --git a/tracker-kinect-face/kinect_face_tracker.cpp b/tracker-kinect-face/kinect_face_tracker.cpp index 40571a28..ab568f1e 100644 --- a/tracker-kinect-face/kinect_face_tracker.cpp +++ b/tracker-kinect-face/kinect_face_tracker.cpp @@ -170,25 +170,32 @@ bool KinectFaceTracker::center() void KinectFaceTracker::data(double *data) { const double dt = t.elapsed_seconds(); - t.start(); - - Update(); - - ExtractFaceRotationInDegrees(&iFaceRotationQuaternion, &iFaceRotation.X, &iFaceRotation.Y, &iFaceRotation.Z); - //Check if data is valid - if (IsValidRect(iFaceBox)) + const double KMinDelayInSeconds = 1.0 / 30.0; // Pointless running faster than Kinect hardware itself + if (dt > KMinDelayInSeconds) { - // We have valid tracking retain position and rotation - iLastFacePosition = iFacePosition; - iLastFaceRotation = iFaceRotation; + t.start(); // Reset our timer + //OutputDebugStringA("Updating frame!\n"); + Update(); + ExtractFaceRotationInDegrees(&iFaceRotationQuaternion, &iFaceRotation.X, &iFaceRotation.Y, &iFaceRotation.Z); + //Check if data is valid + if (IsValidRect(iFaceBox)) + { + // We have valid tracking retain position and rotation + iLastFacePosition = iFacePosition; + iLastFaceRotation = iFaceRotation; + } + else + { + //TODO: after like 5s without tracking reset position to zero + //TODO: Instead of hardcoding that delay add it to our settings + } } else { - //TODO: after like 5s without tracking reset position to zero - //TODO: Instead of hardcoding that delay add it to our settings + //OutputDebugStringA("Skipping frame!\n"); } - + // Feed our framework our last valid position and rotation data[0] = (iLastFacePosition.X - iFacePositionCenter.X) * 100; // Convert to centimer to be in a range that suites OpenTrack. data[1] = (iLastFacePosition.Y - iFacePositionCenter.Y) * 100; @@ -344,7 +351,7 @@ void KinectFaceTracker::Update() if (SUCCEEDED(hr)) { hr = pColorFrame->get_RawColorImageFormat(&imageFormat); - } + } if (SUCCEEDED(hr)) { diff --git a/tracker-kinect-face/kinect_face_tracker.h b/tracker-kinect-face/kinect_face_tracker.h index de71f081..9f75507d 100644 --- a/tracker-kinect-face/kinect_face_tracker.h +++ b/tracker-kinect-face/kinect_face_tracker.h @@ -51,7 +51,9 @@ private: }; - +// +// +// class KinectFaceTracker : public ITracker { public: diff --git a/tracker-kinect-face/lang/nl_NL.ts b/tracker-kinect-face/lang/nl_NL.ts index f4fe07d8..a0a737ee 100644 --- a/tracker-kinect-face/lang/nl_NL.ts +++ b/tracker-kinect-face/lang/nl_NL.ts @@ -2,20 +2,20 @@ - test_metadata + KinectFaceMetadata Kinect Face 0.1 - test_ui + KinectFaceUi - Sine wave + Kinect Face Tracker - Pressing "Abort" will immediately crash the application. + Start OpenTrack to check if Kinect Face Tracker is working. diff --git a/tracker-kinect-face/lang/ru_RU.ts b/tracker-kinect-face/lang/ru_RU.ts index d4108ed3..72f91367 100644 --- a/tracker-kinect-face/lang/ru_RU.ts +++ b/tracker-kinect-face/lang/ru_RU.ts @@ -2,20 +2,20 @@ - test_metadata + KinectFaceMetadata Kinect Face 0.1 - test_ui + KinectFaceUi - Sine wave + Kinect Face Tracker - Pressing "Abort" will immediately crash the application. + Start OpenTrack to check if Kinect Face Tracker is working. diff --git a/tracker-kinect-face/lang/stub.ts b/tracker-kinect-face/lang/stub.ts index f82903a3..055ec4e1 100644 --- a/tracker-kinect-face/lang/stub.ts +++ b/tracker-kinect-face/lang/stub.ts @@ -2,20 +2,20 @@ - test_metadata + KinectFaceMetadata Kinect Face 0.1 - test_ui + KinectFaceUi - Sine wave + Kinect Face Tracker - Pressing "Abort" will immediately crash the application. + Start OpenTrack to check if Kinect Face Tracker is working. diff --git a/tracker-kinect-face/lang/zh_CN.ts b/tracker-kinect-face/lang/zh_CN.ts index f82903a3..055ec4e1 100644 --- a/tracker-kinect-face/lang/zh_CN.ts +++ b/tracker-kinect-face/lang/zh_CN.ts @@ -2,20 +2,20 @@ - test_metadata + KinectFaceMetadata Kinect Face 0.1 - test_ui + KinectFaceUi - Sine wave + Kinect Face Tracker - Pressing "Abort" will immediately crash the application. + Start OpenTrack to check if Kinect Face Tracker is working. -- cgit v1.2.3