From afbec6a10b1e718fed134f61295e92f1e94770d4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 24 Aug 2013 22:33:52 +0200 Subject: Workaround camera frame-retrieval badness --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 152c1e32..6fff39d3 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #if defined(_WIN32) || defined(__WIN32) #include @@ -185,12 +186,19 @@ void Tracker::run() aruco::MarkerDetector detector; detector.setDesiredSpeed(3); detector.setThresholdParams(11, 5); - cv::Mat color, grayscale, rvec, tvec; + cv::Mat color, color_, grayscale, rvec, tvec; + + if (!camera.isOpened()) + { + fprintf(stderr, "aruco tracker: can't open camera\n"); + return; + } while (!stop) { - if (!camera.read(color)) - break; + if (!camera.read(color_)) + continue; + color_.copyTo(color); cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); const float focal_length_w = 0.5 * grayscale.cols / tan(0.5 * fov * HT_PI / 180); const float focal_length_h = 0.5 * grayscale.rows / tan(0.5 * fov * grayscale.rows / grayscale.cols * HT_PI / 180.0); -- cgit v1.2.3 From 611f781ea5a9f2260f3fa305cc2274bca48ec60d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 14 Sep 2013 15:35:21 +0200 Subject: Downcase settings directory. Only affects Linux --- facetracknoir/facetracknoir.cpp | 28 +++++++++++----------- facetracknoir/tracker.cpp | 2 +- facetracknoir/tracker.h | 2 +- ftnoir_filter_accela/ftnoir_filter_accela.cpp | 2 +- .../ftnoir_filter_accela_dialog.cpp | 4 ++-- ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp | 2 +- ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp | 4 ++-- ftnoir_protocol_fg/ftnoir_protocol_fg.cpp | 2 +- ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp | 4 ++-- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp | 2 +- .../ftnoir_protocol_fsuipc_dialog.cpp | 4 ++-- ftnoir_protocol_ft/ftnoir_protocol_ft.cpp | 2 +- ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp | 4 ++-- ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp | 2 +- ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp | 4 ++-- ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp | 2 +- .../ftnoir_protocol_mouse_dialog.cpp | 4 ++-- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 6 ++--- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 6 ++--- ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp | 2 +- .../ftnoir_tracker_hydra_dialog.cpp | 4 ++-- ftnoir_tracker_pt/ftnoir_tracker_pt_settings.cpp | 8 +++---- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 2 +- ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp | 4 ++-- ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp | 2 +- .../ftnoir_tracker_faceapi_dialog.cpp | 4 ++-- ftnoir_tracker_udp/ftnoir_tracker_udp.cpp | 2 +- ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp | 4 ++-- qfunctionconfigurator/functionconfig.cpp | 2 +- 29 files changed, 60 insertions(+), 60 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index fe8ce36b..e834b6be 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -347,7 +347,7 @@ void FaceTrackNoIR::open() { QString fileName = dialog.getOpenFileName( this, tr("Select one FTNoir settings file"), - QCoreApplication::applicationDirPath() + "/Settings/", + QCoreApplication::applicationDirPath() + "/settings/", tr("Settings file (*.ini);;All Files (*)"), NULL); @@ -368,7 +368,7 @@ void FaceTrackNoIR::save() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "Tracking" ); @@ -422,14 +422,14 @@ void FaceTrackNoIR::saveAs() // Get the current filename of the INI-file. // QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString oldFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString oldFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); // // Get the new filename of the INI-file. // QString fileName = QFileDialog::getSaveFileName(this, tr("Save file"), oldFile, -// QCoreApplication::applicationDirPath() + "/Settings", +// QCoreApplication::applicationDirPath() + "/settings", tr("Settings file (*.ini);;All Files (*)")); if (!fileName.isEmpty()) { @@ -472,7 +472,7 @@ void FaceTrackNoIR::loadSettings() { qDebug() << "loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); qDebug() << "Config file now" << currentFile; QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) @@ -614,7 +614,7 @@ void FaceTrackNoIR::startTracker( ) { } QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) for (int i = 0; i < 6; i++) @@ -1077,7 +1077,7 @@ void FaceTrackNoIR::profileSelected(int index) // Read the current INI-file setting, to get the folder in which it's located... // QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QFileInfo pathInfo ( currentFile ); // @@ -1096,7 +1096,7 @@ void FaceTrackNoIR::filterSelected(int index) //QSettings settings("opentrack"); // Registry settings (in HK_USER) - //QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + //QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); //QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) ui.btnShowFilterControls->setEnabled ( true ); @@ -1194,7 +1194,7 @@ void FaceTrackNoIR::bindKeyboardShortcuts() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "KB_Shortcuts" ); int idxCenter = iniFile.value("Key_index_Center", 0).toInt(); @@ -1255,7 +1255,7 @@ void KeyboardShortcutDialog::loadSettings() { qDebug() << "loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) qDebug() << "loadSettings says: iniFile = " << currentFile; @@ -1283,7 +1283,7 @@ void KeyboardShortcutDialog::save() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "KB_Shortcuts" ); @@ -1318,7 +1318,7 @@ QWidget( parent , f) mainApp = ftnoir; // Preserve a pointer to FTNoIR QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QFunctionConfigurator* configs[6] = { ui.txconfig, @@ -1424,7 +1424,7 @@ void CurveConfigurationDialog::loadSettings() { qDebug() << "loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) qDebug() << "loadSettings says: iniFile = " << currentFile; @@ -1490,7 +1490,7 @@ void CurveConfigurationDialog::save() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); ui.rxconfig->saveSettings(currentFile); ui.ryconfig->saveSettings(currentFile); diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 47daa697..cdf28d40 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -193,7 +193,7 @@ void Tracker::loadSettings() { qDebug() << "Tracker::loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup("Tracking"); diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index eeb18dad..0476eec4 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -83,7 +83,7 @@ public: zero(0) { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); curve.loadSettings(iniFile); curveAlt.loadSettings(iniFile); diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index 0b3d6518..2c0765e8 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -26,7 +26,7 @@ FTNoIR_Filter::~FTNoIR_Filter() void FTNoIR_Filter::loadSettings() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "Accela" ); diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp index 3e74ad81..0e3660d6 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp @@ -133,7 +133,7 @@ void FilterControls::doCancel() { void FilterControls::loadSettings() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) qDebug() << "FTNoIR_Filter::loadSettings2 says: iniFile = " << currentFile; @@ -156,7 +156,7 @@ void FilterControls::loadSettings() { void FilterControls::save() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) qDebug() << "FTNoIR_Filter::save() says: iniFile = " << currentFile; diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp index b127c665..bb9fd4c9 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp @@ -64,7 +64,7 @@ void FTNoIR_Filter::loadSettings() { qDebug() << "FTNoIR_Filter::loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) qDebug() << "FTNoIR_Filter::loadSettings says: iniFile = " << currentFile; diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp index 91777213..f4b8aad2 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp @@ -143,7 +143,7 @@ void FilterControls::loadSettings() { qDebug() << "FilterControls::loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) qDebug() << "FilterControls::loadSettings says: iniFile = " << currentFile; @@ -166,7 +166,7 @@ void FilterControls::loadSettings() { void FilterControls::save() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) double smooth_min, smooth_max, smooth_expt; diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp index d80791ce..dc76d193 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp @@ -61,7 +61,7 @@ FTNoIR_Protocol::~FTNoIR_Protocol() void FTNoIR_Protocol::loadSettings() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "FG" ); diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp index 2acd3f9c..b670bdd3 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp @@ -134,7 +134,7 @@ void FGControls::loadSettings() { // qDebug() << "loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) // qDebug() << "loadSettings says: iniFile = " << currentFile; @@ -160,7 +160,7 @@ void FGControls::loadSettings() { void FGControls::save() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "FG" ); diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp index ba053e11..df25e9ed 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp @@ -75,7 +75,7 @@ double local_x; void FTNoIR_Protocol::loadSettings() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "FSUIPC" ); diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp index 90ed22b2..985915b4 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp @@ -121,7 +121,7 @@ void FSUIPCControls::loadSettings() { qDebug() << "loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) qDebug() << "loadSettings says: iniFile = " << currentFile; @@ -142,7 +142,7 @@ void FSUIPCControls::save() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "FSUIPC" ); diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp index 597f2a5f..b72adb22 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp @@ -73,7 +73,7 @@ FTNoIR_Protocol::~FTNoIR_Protocol() void FTNoIR_Protocol::loadSettings() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "FT" ); diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp index 810bef50..eb2d0e76 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp @@ -147,7 +147,7 @@ void FTControls::loadSettings() { qDebug() << "loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) qDebug() << "loadSettings says: iniFile = " << currentFile; @@ -170,7 +170,7 @@ void FTControls::loadSettings() { void FTControls::save() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "FT" ); diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp index 32d11c37..d29c80c9 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.cpp @@ -51,7 +51,7 @@ FTNoIR_Protocol::~FTNoIR_Protocol() void FTNoIR_Protocol::loadSettings() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "FTN" ); diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp index c902d6f8..0b61fd48 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp @@ -128,7 +128,7 @@ void FTNControls::loadSettings() { // qDebug() << "loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) // qDebug() << "loadSettings says: iniFile = " << currentFile; @@ -151,7 +151,7 @@ void FTNControls::loadSettings() { void FTNControls::save() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "FTN" ); diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp index 6b013d74..8601bdfd 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp @@ -46,7 +46,7 @@ FTNoIR_Protocol::~FTNoIR_Protocol() void FTNoIR_Protocol::loadSettings() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "Mouse" ); diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp index 1e03a022..c8d62a58 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp @@ -134,7 +134,7 @@ void MOUSEControls::loadSettings() { qDebug() << "loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) qDebug() << "loadSettings says: iniFile = " << currentFile; @@ -155,7 +155,7 @@ void MOUSEControls::save() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "Mouse" ); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 6fff39d3..dcd91994 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -101,7 +101,7 @@ static resolution_tuple resolution_choices[] = { void Tracker::load_settings() { QSettings settings("opentrack"); - QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); iniFile.beginGroup( "aruco-Tracker" ); @@ -396,7 +396,7 @@ void TrackerControls::loadSettings() names.prepend("Any available"); ui.cameraName->addItems(names); QSettings settings("opentrack"); - QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); iniFile.beginGroup( "aruco-Tracker" ); ui.cameraName->setCurrentIndex(iniFile.value("camera-index", -1).toInt() + 1); @@ -440,7 +440,7 @@ void TrackerControls::loadSettings() void TrackerControls::save() { QSettings settings("opentrack"); - QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); iniFile.beginGroup( "aruco-Tracker" ); diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index b755010c..45c62f55 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -91,7 +91,7 @@ static resolution_tuple resolution_choices[] = { static void load_settings(ht_config_t* config, Tracker* tracker) { QSettings settings("opentrack"); - QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); iniFile.beginGroup( "HT-Tracker" ); @@ -318,7 +318,7 @@ void TrackerControls::loadSettings() names.prepend("Any available"); ui.cameraName->addItems(names); QSettings settings("opentrack"); - QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); iniFile.beginGroup( "HT-Tracker" ); ui.cameraName->setCurrentIndex(iniFile.value("camera-index", -1).toInt() + 1); @@ -362,7 +362,7 @@ void TrackerControls::loadSettings() void TrackerControls::save() { QSettings settings("opentrack"); - QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); iniFile.beginGroup( "HT-Tracker" ); diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp index 3789c7bf..81307cd6 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp @@ -124,7 +124,7 @@ void Hydra_Tracker::loadSettings() { qDebug() << "FTNoIR_Tracker::loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) qDebug() << "FTNoIR_Tracker::loadSettings says: iniFile = " << currentFile; diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp index 77d4963b..913f8070 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp @@ -127,7 +127,7 @@ void TrackerControls::loadSettings() { // qDebug() << "loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) // qDebug() << "loadSettings says: iniFile = " << currentFile; @@ -151,7 +151,7 @@ void TrackerControls::loadSettings() { void TrackerControls::save() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "Hydra" ); diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.cpp index b0249813..787a5265 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.cpp @@ -15,7 +15,7 @@ void TrackerSettings::load_ini() qDebug("TrackerSettings::load_ini()"); QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup( "PointTracker" ); @@ -58,7 +58,7 @@ void TrackerSettings::save_ini() const qDebug("TrackerSettings::save_ini()"); QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "PointTracker" ); @@ -102,7 +102,7 @@ void TrackerDialogSettings::load_ini() qDebug("TrackerDialogSettings::load_ini()"); QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup( "PointTrackerDialog" ); @@ -128,7 +128,7 @@ void TrackerDialogSettings::save_ini() const qDebug("TrackerDialogSettings::save_ini()"); QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "PointTrackerDialog" ); diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index eb05d5f9..f5e1f5fa 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -142,7 +142,7 @@ void Rift_Tracker::loadSettings() { qDebug() << "FTNoIR_Tracker::loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) qDebug() << "FTNoIR_Tracker::loadSettings says: iniFile = " << currentFile; diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp index 0b644723..26fbbc9f 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp @@ -127,7 +127,7 @@ void TrackerControls::loadSettings() { // qDebug() << "loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) // qDebug() << "loadSettings says: iniFile = " << currentFile; @@ -152,7 +152,7 @@ void TrackerControls::loadSettings() { void TrackerControls::save() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "Rift" ); diff --git a/ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp b/ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp index 06c8b206..71e9c558 100644 --- a/ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp +++ b/ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp @@ -138,7 +138,7 @@ void FTNoIR_Tracker::loadSettings() { qDebug() << "FTNoIR_Tracker::loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) qDebug() << "FTNoIR_Tracker::loadSettings says: iniFile = " << currentFile; diff --git a/ftnoir_tracker_sm/ftnoir_tracker_faceapi_dialog.cpp b/ftnoir_tracker_sm/ftnoir_tracker_faceapi_dialog.cpp index 332a619e..8c3cd922 100644 --- a/ftnoir_tracker_sm/ftnoir_tracker_faceapi_dialog.cpp +++ b/ftnoir_tracker_sm/ftnoir_tracker_faceapi_dialog.cpp @@ -149,7 +149,7 @@ void TrackerControls::loadSettings() { // qDebug() << "loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) // qDebug() << "loadSettings says: iniFile = " << currentFile; @@ -176,7 +176,7 @@ void TrackerControls::save() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "SMTracker" ); diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp index 1364ee1c..e71d13bb 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp @@ -141,7 +141,7 @@ void FTNoIR_Tracker::loadSettings() { qDebug() << "FTNoIR_Tracker::loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) qDebug() << "FTNoIR_Tracker::loadSettings says: iniFile = " << currentFile; diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp index 5c0d7b1c..55bb6c97 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp @@ -127,7 +127,7 @@ void TrackerControls::loadSettings() { // qDebug() << "loadSettings says: Starting "; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) // qDebug() << "loadSettings says: iniFile = " << currentFile; @@ -152,7 +152,7 @@ void TrackerControls::loadSettings() { void TrackerControls::save() { QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) iniFile.beginGroup ( "FTNClient" ); diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index e0807859..af350143 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -33,7 +33,7 @@ FunctionConfig::FunctionConfig(QString title, int intMaxInput, int intMaxOutput) _max_Input = intMaxInput; // Added WVR 20120805 _max_Output = intMaxOutput; QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); loadSettings(iniFile); reload(); -- cgit v1.2.3 From ec1c2b16379d657db92c90e25b9e01393267b596 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 14 Sep 2013 18:51:32 +0200 Subject: Clean up preprocessor mingw-isms No functional changes. --- compat/compat.cpp | 2 +- compat/compat.h | 6 +++--- facetracknoir/facetracknoir.cpp | 17 ++++++++--------- facetracknoir/facetracknoir.h | 4 ++-- facetracknoir/global-settings.cpp | 6 +++--- facetracknoir/global-settings.h | 6 +++--- facetracknoir/global-shortcuts.cpp | 2 +- facetracknoir/shortcuts.cpp | 2 +- facetracknoir/shortcuts.h | 4 ++-- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 ++-- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 6 +++--- 11 files changed, 29 insertions(+), 30 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/compat/compat.cpp b/compat/compat.cpp index 8eedc845..d8aac9bc 100644 --- a/compat/compat.cpp +++ b/compat/compat.cpp @@ -7,7 +7,7 @@ #define IN_FTNOIR_COMPAT #include "compat.h" -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) PortableLockedShm::PortableLockedShm(const char* shmName, const char* mutexName, int mapSize) { diff --git a/compat/compat.h b/compat/compat.h index 7692b38a..6a95f167 100644 --- a/compat/compat.h +++ b/compat/compat.h @@ -6,7 +6,7 @@ */ #pragma once -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) #include #else #include @@ -19,7 +19,7 @@ #include #endif -#if defined(IN_FTNOIR_COMPAT) && (defined(_WIN32) || defined(__WIN32)) +#if defined(IN_FTNOIR_COMPAT) && defined(_WIN32) # define COMPAT_EXPORT __declspec(dllexport) #else # define COMPAT_EXPORT @@ -33,7 +33,7 @@ public: void unlock(); void* mem; private: -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) HANDLE hMutex, hMapFile; #else int fd, size; diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 85607329..6ff1759b 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -27,14 +27,14 @@ #include #include -#if defined(__WIN32) || defined(_WIN32) +#if defined(_WIN32) # include # include #endif #if defined(__APPLE__) # define SONAME "dylib" -#elif defined(_WIN32) || defined(__WIN32) +#elif defined(_WIN32) # define SONAME "dll" #else # define SONAME "so" @@ -86,7 +86,7 @@ static void fill_combobox(const QString& filter, QList& list, Q // Setup the Main Dialog // FaceTrackNoIR::FaceTrackNoIR(QWidget *parent, Qt::WFlags flags) : - #if defined(__WIN32) || defined(_WIN32) + #if defined(_WIN32) keybindingWorker(NULL), #else keyCenter(0), @@ -544,7 +544,7 @@ void FaceTrackNoIR::startTracker( ) { return; } -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) keybindingWorker = new KeybindingWorker(*this, keyCenter); keybindingWorker->start(); #endif @@ -657,7 +657,7 @@ void FaceTrackNoIR::startTracker( ) { /** stop tracking the face **/ void FaceTrackNoIR::stopTracker( ) { ui.game_name->setText("Not connected"); -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) if (keybindingWorker) { keybindingWorker->should_quit = true; @@ -958,7 +958,7 @@ void FaceTrackNoIR::bindKeyboardShortcuts() iniFile.beginGroup ( "KB_Shortcuts" ); int idxCenter = iniFile.value("Key_index_Center", 0).toInt(); -#if !defined(_WIN32) && !defined(__WIN32) +#if !defined(_WIN32) if (keyCenter) { delete keyCenter; keyCenter = NULL; @@ -979,7 +979,6 @@ void FaceTrackNoIR::bindKeyboardShortcuts() connect(keyCenter, SIGNAL(activated()), this, SLOT(shortcutRecentered())); } } - #else keyCenter.keycode = 0; keyCenter.shift = keyCenter.alt = keyCenter.ctrl = 0; @@ -993,7 +992,7 @@ void FaceTrackNoIR::bindKeyboardShortcuts() if (tracker) /* running already */ { -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) if (keybindingWorker) { keybindingWorker->should_quit = true; @@ -1011,7 +1010,7 @@ void FaceTrackNoIR::shortcutRecentered() { if (tracker) { -#if defined(__WIN32) || defined(_WIN32) +#if defined(_WIN32) MessageBeep(MB_OK); #else QApplication::beep(); diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 763b5dad..8f83a851 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -44,7 +44,7 @@ #include #include #include -#if !defined(_WIN32) && !defined(__WIN32) +#if !defined(_WIN32) # include #else # include @@ -97,7 +97,7 @@ public: return *pose.axes[idx]; } -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) Key keyCenter; KeybindingWorker* keybindingWorker; #else diff --git a/facetracknoir/global-settings.cpp b/facetracknoir/global-settings.cpp index f605b591..4a655171 100644 --- a/facetracknoir/global-settings.cpp +++ b/facetracknoir/global-settings.cpp @@ -1,6 +1,6 @@ #include "global-settings.h" -#if !(defined(__WIN32) || defined(_WIN32)) +#if !(defined(_WIN32)) # include #endif @@ -92,7 +92,7 @@ DynamicLibrary::DynamicLibrary(const QString& filename) { this->filename = filename; QString fullPath = QCoreApplication::applicationDirPath() + "/" + this->filename; -#if defined(__WIN32) || defined(_WIN32) +#if defined(_WIN32) handle = new QLibrary(fullPath); Dialog = (SETTINGS_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetDialog" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); Constructor = (NULLARY_DYNAMIC_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetConstructor" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION); @@ -128,7 +128,7 @@ DynamicLibrary::DynamicLibrary(const QString& filename) DynamicLibrary::~DynamicLibrary() { -#if defined(__WIN32) || defined(_WIN32) +#if defined(_WIN32) handle->unload(); #else if (handle) diff --git a/facetracknoir/global-settings.h b/facetracknoir/global-settings.h index 29a8da62..b2a54e20 100644 --- a/facetracknoir/global-settings.h +++ b/facetracknoir/global-settings.h @@ -1,6 +1,6 @@ #pragma once -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) # define CALLING_CONVENTION_SUFFIX_VOID_FUNCTION "@0" # ifdef _MSC_VER # define MAYBE_STDCALL_UNDERSCORE "_" @@ -21,7 +21,7 @@ #include "ftnoir_filter_base/ftnoir_filter_base.h" #include "ftnoir_protocol_base/ftnoir_protocol_base.h" -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) # define CALLING_CONVENTION __stdcall #else # define CALLING_CONVENTION @@ -57,7 +57,7 @@ public: METADATA_FUNCTION Metadata; QString filename; private: -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) QLibrary* handle; #else void* handle; diff --git a/facetracknoir/global-shortcuts.cpp b/facetracknoir/global-shortcuts.cpp index 286200c0..8666333c 100644 --- a/facetracknoir/global-shortcuts.cpp +++ b/facetracknoir/global-shortcuts.cpp @@ -1,6 +1,6 @@ #include "facetracknoir/facetracknoir.h" -#if defined(__WIN32) || defined(_WIN32) +#if defined(_WIN32) #include #include #include diff --git a/facetracknoir/shortcuts.cpp b/facetracknoir/shortcuts.cpp index cf4b81f8..cdb2c3b7 100644 --- a/facetracknoir/shortcuts.cpp +++ b/facetracknoir/shortcuts.cpp @@ -125,7 +125,7 @@ void KeyboardShortcutDialog::save() { settingsDirty = false; } -#if defined(__WIN32) || defined(_WIN32) +#if defined(_WIN32) #include KeybindingWorkerImpl::~KeybindingWorkerImpl() { diff --git a/facetracknoir/shortcuts.h b/facetracknoir/shortcuts.h index 15256b6c..685c78b6 100644 --- a/facetracknoir/shortcuts.h +++ b/facetracknoir/shortcuts.h @@ -34,7 +34,7 @@ private slots: extern QList global_key_sequences; -#if defined(__WIN32) || defined(_WIN32) +#if defined(_WIN32) extern QList global_windows_key_sequences; # undef DIRECTINPUT_VERSION # define DIRECTINPUT_VERSION 0x0800 @@ -60,7 +60,7 @@ typedef unsigned char BYTE; struct Key { int foo; }; #endif -#if defined(__WIN32) || defined(_WIN32) +#if defined(_WIN32) class KeybindingWorkerImpl { private: LPDIRECTINPUT8 din; diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index dcd91994..3f5960ef 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -17,7 +17,7 @@ #include #include -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) #include #else #include @@ -26,7 +26,7 @@ // delicious copypasta static QList get_camera_names(void) { QList ret; -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) // Create the System Device Enumerator. HRESULT hr; ICreateDevEnum *pSysDevEnum = NULL; diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 45c62f55..9be50efa 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -7,7 +7,7 @@ #include "facetracknoir/global-settings.h" #include -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) #include #else #include @@ -16,7 +16,7 @@ // delicious copypasta static QList get_camera_names(void) { QList ret; -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) // Create the System Device Enumerator. HRESULT hr; ICreateDevEnum *pSysDevEnum = NULL; @@ -175,7 +175,7 @@ void Tracker::StartTracker(QFrame* videoframe) shm->pause = shm->terminate = shm->running = false; shm->timer = 0; subprocess.setWorkingDirectory(QCoreApplication::applicationDirPath() + "/tracker-ht"); -#if defined(_WIN32) || defined(__WIN32) +#if defined(_WIN32) subprocess.start("\"" + QCoreApplication::applicationDirPath() + "/tracker-ht/headtracker-ftnoir" + "\""); #else subprocess.start(QCoreApplication::applicationDirPath() + "/tracker-ht/headtracker-ftnoir"); -- cgit v1.2.3 From c4afb886739079135d881ec2edaf8d63b6ed6dfd Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 14 Sep 2013 19:39:41 +0200 Subject: Handle hotplug camera indices --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 3f5960ef..e40c92d2 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -79,7 +79,7 @@ static QList get_camera_names(void) { if (access(buf, R_OK | W_OK) == 0) { ret.append(buf); } else { - break; + continue; } } #endif diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 9be50efa..2ca5a3de 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -69,7 +69,7 @@ static QList get_camera_names(void) { if (access(buf, R_OK | W_OK) == 0) { ret.append(buf); } else { - break; + continue; } } #endif -- cgit v1.2.3 From 747dcf7cfbc2498312bdcdbd89eb741493dfb44b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 15 Sep 2013 16:02:20 +0200 Subject: Make every tracker/protocol/filter dialog modal This is since changing the tracker/protocol/filter from a combobox will cause a use-after-free and a nasty crash. --- .../ftnoir_accela_filtercontrols.ui | 2 +- ftnoir_filter_ewma2/ftnoir_ewma_filtercontrols.ui | 8 +- ftnoir_protocol_fg/ftnoir_fgcontrols.ui | 7 +- ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui | 5 +- ftnoir_protocol_ft/ftnoir_ftcontrols.ui | 6 + ftnoir_protocol_ftn/ftnoir_ftncontrols.ui | 7 +- ftnoir_protocol_mouse/ftnoir_mousecontrols.ui | 5 +- ftnoir_protocol_sc/ftnoir_sccontrols.ui | 3 + ftnoir_protocol_vjoy/ftnoir_vjoy_controls.ui | 5 +- ftnoir_protocol_wine/ftnoir_winecontrols.ui | 3 + ftnoir_tracker_aruco/aruco-trackercontrols.ui | 9 +- ftnoir_tracker_ht/ht-trackercontrols.ui | 2 +- .../ftnoir_hydra_clientcontrols.ui | 353 +++++++++------------ ftnoir_tracker_sm/ftnoir_sm_controls.ui | 7 +- ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui | 7 +- 15 files changed, 207 insertions(+), 222 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui index 305b1b1d..24b296ea 100644 --- a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui +++ b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui @@ -3,7 +3,7 @@ AccelaUICFilterControls - Qt::NonModal + Qt::ApplicationModal diff --git a/ftnoir_filter_ewma2/ftnoir_ewma_filtercontrols.ui b/ftnoir_filter_ewma2/ftnoir_ewma_filtercontrols.ui index 0f31bcd3..8a0e485a 100644 --- a/ftnoir_filter_ewma2/ftnoir_ewma_filtercontrols.ui +++ b/ftnoir_filter_ewma2/ftnoir_ewma_filtercontrols.ui @@ -2,11 +2,14 @@ UICFilterControls + + Qt::ApplicationModal + 0 0 - 371 + 374 380 @@ -21,6 +24,9 @@ + + images/facetracknoir.png + images/facetracknoir.png diff --git a/ftnoir_protocol_fg/ftnoir_fgcontrols.ui b/ftnoir_protocol_fg/ftnoir_fgcontrols.ui index 116f830b..51b5693c 100644 --- a/ftnoir_protocol_fg/ftnoir_fgcontrols.ui +++ b/ftnoir_protocol_fg/ftnoir_fgcontrols.ui @@ -2,12 +2,15 @@ UICFGControls + + Qt::ApplicationModal + 0 0 - 411 - 194 + 486 + 210 diff --git a/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui b/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui index d02297f3..9ccfa119 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui +++ b/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui @@ -2,12 +2,15 @@ UICFSUIPCControls + + Qt::ApplicationModal + 0 0 541 - 127 + 139 diff --git a/ftnoir_protocol_ft/ftnoir_ftcontrols.ui b/ftnoir_protocol_ft/ftnoir_ftcontrols.ui index fc5abbcf..a2216314 100644 --- a/ftnoir_protocol_ft/ftnoir_ftcontrols.ui +++ b/ftnoir_protocol_ft/ftnoir_ftcontrols.ui @@ -2,6 +2,12 @@ UICFTControls + + Qt::ApplicationModal + + + true + 0 diff --git a/ftnoir_protocol_ftn/ftnoir_ftncontrols.ui b/ftnoir_protocol_ftn/ftnoir_ftncontrols.ui index d8efec61..15bc5531 100644 --- a/ftnoir_protocol_ftn/ftnoir_ftncontrols.ui +++ b/ftnoir_protocol_ftn/ftnoir_ftncontrols.ui @@ -2,12 +2,15 @@ UICFTNControls + + Qt::ApplicationModal + 0 0 411 - 156 + 162 @@ -15,7 +18,7 @@ - images/FaceTrackNoIR.pngimages/facetracknoir.png + images/FaceTrackNoIR.pngimages/FaceTrackNoIR.png Qt::LeftToRight diff --git a/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui b/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui index 8794e9cd..ee15ded2 100644 --- a/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui +++ b/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui @@ -2,12 +2,15 @@ UICMOUSEControls + + Qt::ApplicationModal + 0 0 250 - 99 + 112 diff --git a/ftnoir_protocol_sc/ftnoir_sccontrols.ui b/ftnoir_protocol_sc/ftnoir_sccontrols.ui index a0cbf393..be42072c 100644 --- a/ftnoir_protocol_sc/ftnoir_sccontrols.ui +++ b/ftnoir_protocol_sc/ftnoir_sccontrols.ui @@ -2,6 +2,9 @@ UICSCControls + + Qt::ApplicationModal + 0 diff --git a/ftnoir_protocol_vjoy/ftnoir_vjoy_controls.ui b/ftnoir_protocol_vjoy/ftnoir_vjoy_controls.ui index 1a244410..94b229fb 100644 --- a/ftnoir_protocol_vjoy/ftnoir_vjoy_controls.ui +++ b/ftnoir_protocol_vjoy/ftnoir_vjoy_controls.ui @@ -2,12 +2,15 @@ UICVJoyControls + + Qt::ApplicationModal + 0 0 228 - 64 + 69 diff --git a/ftnoir_protocol_wine/ftnoir_winecontrols.ui b/ftnoir_protocol_wine/ftnoir_winecontrols.ui index 71e99d88..c5e19f2c 100644 --- a/ftnoir_protocol_wine/ftnoir_winecontrols.ui +++ b/ftnoir_protocol_wine/ftnoir_winecontrols.ui @@ -2,6 +2,9 @@ UICFTControls + + Qt::ApplicationModal + 0 diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 3ad9fa40..4fe97e51 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -3,7 +3,7 @@ Form - Qt::NonModal + Qt::ApplicationModal @@ -464,15 +464,18 @@ Rafael Muñoz Salinas <rmsalinas@uco.es> - 370 + 327 200 - 181 + 255 20 https://github.com/rmsalinas/aruco + + Qt::AlignCenter + true diff --git a/ftnoir_tracker_ht/ht-trackercontrols.ui b/ftnoir_tracker_ht/ht-trackercontrols.ui index fbe7a41a..6153637a 100644 --- a/ftnoir_tracker_ht/ht-trackercontrols.ui +++ b/ftnoir_tracker_ht/ht-trackercontrols.ui @@ -3,7 +3,7 @@ Form - Qt::NonModal + Qt::ApplicationModal diff --git a/ftnoir_tracker_hydra/ftnoir_hydra_clientcontrols.ui b/ftnoir_tracker_hydra/ftnoir_hydra_clientcontrols.ui index 0cee05f0..94d22cb5 100644 --- a/ftnoir_tracker_hydra/ftnoir_hydra_clientcontrols.ui +++ b/ftnoir_tracker_hydra/ftnoir_hydra_clientcontrols.ui @@ -2,12 +2,15 @@ UIHydraControls + + Qt::ApplicationModal + 0 0 411 - 142 + 145 @@ -45,210 +48,150 @@ - - - - - - - - - - - - Pitch: - - - - - - - - - 20 - 16777215 - - - - Qt::LeftToRight - - - - - - - - - - - - - - Yaw: - - - - - - - - - - 20 - 16777215 - - - - Qt::LeftToRight - - - - - - - - - - - - - Roll: - - - - - - - - - 20 - 16777215 - - - - Qt::LeftToRight - - - - - - - - - - - - - - - - - - - - - - - - - - - - - X: - - - - - - - - - 20 - 16777215 - - - - Qt::LeftToRight - - - - - - - - - - - - - - Y: - - - - - - - - - - 20 - 16777215 - - - - Qt::LeftToRight - - - - - - - - - - - - - Z: - - - - - - - - - 20 - 16777215 - - - - Qt::LeftToRight - - - - - - - - - - - - - - - - - - - - - - - + + + + Pitch: + + + + + + + + 20 + 16777215 + + + + Qt::LeftToRight + + + + + + + + + + + + + Yaw: + + + + + + + + 20 + 16777215 + + + + Qt::LeftToRight + + + + + + + + + + Roll: + + + + + + + + 20 + 16777215 + + + + Qt::LeftToRight + + + + + + + + + + X: + + + + + + + + 20 + 16777215 + + + + Qt::LeftToRight + + + + + + + + + + + + + Y: + + + + + + + + 20 + 16777215 + + + + Qt::LeftToRight + + + + + + + + + + Z: + + + + + + + + 20 + 16777215 + + + + Qt::LeftToRight + + + + + + diff --git a/ftnoir_tracker_sm/ftnoir_sm_controls.ui b/ftnoir_tracker_sm/ftnoir_sm_controls.ui index 06ebc9ca..7d69059b 100644 --- a/ftnoir_tracker_sm/ftnoir_sm_controls.ui +++ b/ftnoir_tracker_sm/ftnoir_sm_controls.ui @@ -2,11 +2,14 @@ UICSMClientControls + + Qt::ApplicationModal + 0 0 - 388 + 399 313 @@ -109,7 +112,7 @@ 10 20 55 - 110 + 122 diff --git a/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui b/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui index 5883e317..842ccb81 100644 --- a/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui +++ b/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui @@ -2,12 +2,15 @@ UICFTNClientControls + + Qt::ApplicationModal + 0 0 411 - 210 + 222 @@ -75,7 +78,7 @@ 10 20 143 - 60 + 64 -- cgit v1.2.3 From fc906d93916d04c81ae712e52045ed56c2788adc Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 15 Sep 2013 20:00:57 +0200 Subject: Simplify tracker API No need to have a separate finalization function, can just as well sleep in the destructor. --- FTNoIR_Tracker_PT/ftnoir_tracker_pt.h | 1 - facetracknoir/global-settings.cpp | 7 ------- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 ++ ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 7 ------- ftnoir_tracker_base/ftnoir_tracker_base.h | 2 -- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 4 ++++ ftnoir_tracker_ht/ftnoir_tracker_ht.h | 10 ---------- ftnoir_tracker_udp/ftnoir_tracker_udp.cpp | 2 ++ ftnoir_tracker_udp/ftnoir_tracker_udp.h | 5 ----- 9 files changed, 8 insertions(+), 32 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h index 867378d1..7dcfc8bb 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h @@ -46,7 +46,6 @@ public: virtual void Initialize(QFrame *videoframe); #ifdef OPENTRACK_API virtual void StartTracker(QFrame* parent_window); - virtual void WaitForExit() {} virtual bool GiveHeadPoseData(double* data); #else virtual void StartTracker(HWND parent_window); diff --git a/facetracknoir/global-settings.cpp b/facetracknoir/global-settings.cpp index 4a655171..aa334463 100644 --- a/facetracknoir/global-settings.cpp +++ b/facetracknoir/global-settings.cpp @@ -8,13 +8,6 @@ SelectedLibraries* Libraries = NULL; SelectedLibraries::~SelectedLibraries() { - if (pTracker) { - pTracker->WaitForExit(); - } - if (pSecondTracker) { - pSecondTracker->WaitForExit(); - } - if (pTracker) { delete pTracker; pTracker = NULL; diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index e40c92d2..b781f390 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -137,6 +137,8 @@ Tracker::Tracker() Tracker::~Tracker() { + stop = true; + wait(); if (layout) delete layout; if (videoWidget) diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 7f21f020..98aba2cf 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -27,13 +27,6 @@ public: void StartTracker(QFrame* frame); bool GiveHeadPoseData(double *data); bool enableTX, enableTY, enableTZ, enableRX, enableRY, enableRZ; - bool NeedsTimeToFinish() { - return true; - } - void WaitForExit() { - stop = true; - wait(); - } void run(); private: QMutex mtx; diff --git a/ftnoir_tracker_base/ftnoir_tracker_base.h b/ftnoir_tracker_base/ftnoir_tracker_base.h index 39db6bb6..b84ce05d 100644 --- a/ftnoir_tracker_base/ftnoir_tracker_base.h +++ b/ftnoir_tracker_base/ftnoir_tracker_base.h @@ -51,8 +51,6 @@ struct ITracker virtual ~ITracker() {} virtual void StartTracker( QFrame* frame ) = 0; virtual bool GiveHeadPoseData(double *data) = 0; - - virtual void WaitForExit() = 0; virtual void NotifyCenter() {} }; diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 2ca5a3de..27817a0c 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -149,6 +149,10 @@ Tracker::Tracker() : lck_shm(HT_SHM_NAME, HT_MUTEX_NAME, sizeof(ht_shm_t)), fres Tracker::~Tracker() { + if (shm) { + shm->terminate = true; + subprocess.waitForFinished(5000); + } subprocess.kill(); if (shm) shm->terminate = true; diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h index fcdea140..5b8eb508 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h @@ -27,16 +27,6 @@ public: bool GiveHeadPoseData(double *data); bool enableTX, enableTY, enableTZ, enableRX, enableRY, enableRZ; ht_shm_t* shm; - bool NeedsTimeToFinish() { - return true; - } - void WaitForExit() { - if (shm) { - shm->terminate = true; - subprocess.waitForFinished(5000); - } - subprocess.kill(); - } private: QTimer timer; PortableLockedShm lck_shm; diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp index e71d13bb..d67fb636 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp @@ -45,6 +45,8 @@ FTNoIR_Tracker::FTNoIR_Tracker() FTNoIR_Tracker::~FTNoIR_Tracker() { + should_quit = true; + wait(); if (inSocket) { inSocket->close(); delete inSocket; diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.h b/ftnoir_tracker_udp/ftnoir_tracker_udp.h index 76fcacf2..e5ea7ff3 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.h +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.h @@ -19,11 +19,6 @@ public: bool GiveHeadPoseData(double *data); void loadSettings(); volatile bool should_quit; - void WaitForExit() { - should_quit = true; - wait(); - } - protected: void run(); // qthread override run method -- cgit v1.2.3 From f3aa3b391bb5159801029770d139c1cc0bfc9df5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 19 Sep 2013 10:59:31 +0200 Subject: misc: fix API boilerplate, encoding --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 1 - ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h | 3 +-- ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h | 3 +-- ftnoir_tracker_hydra/ftnoir_tracker_hydra.h | 2 -- ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp | 5 ----- ftnoir_tracker_sm/ftnoir_tracker_sm.h | 2 -- 6 files changed, 2 insertions(+), 14 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index b781f390..781bf711 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -299,7 +299,6 @@ bool Tracker::GiveHeadPoseData(double *data) class TrackerDll : public Metadata { // ITrackerDll interface - void Initialize() {} void getFullName(QString *strToBeFilled); void getShortName(QString *strToBeFilled); void getDescription(QString *strToBeFilled); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h index 1e53f802..ffdc5262 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco_dll.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013 Stanis³aw Halik +/* Copyright (c) 2013 StanisÅ‚aw 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 @@ -12,7 +12,6 @@ class TrackerDll : public Metadata { // ITrackerDll interface - void Initialize() {} void getFullName(QString *strToBeFilled); void getShortName(QString *strToBeFilled); void getDescription(QString *strToBeFilled); diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h b/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h index 1e53f802..ffdc5262 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht_dll.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013 Stanis³aw Halik +/* Copyright (c) 2013 StanisÅ‚aw 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 @@ -12,7 +12,6 @@ class TrackerDll : public Metadata { // ITrackerDll interface - void Initialize() {} void getFullName(QString *strToBeFilled); void getShortName(QString *strToBeFilled); void getDescription(QString *strToBeFilled); diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h index 3f7bf0a8..82a72f56 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h @@ -74,8 +74,6 @@ public: FTNoIR_TrackerDll(); ~FTNoIR_TrackerDll(); - void Initialize(); - void getFullName(QString *strToBeFilled); void getShortName(QString *strToBeFilled); void getDescription(QString *strToBeFilled); diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp index 4f5d8b10..64eaaa42 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp @@ -15,11 +15,6 @@ FTNoIR_TrackerDll::~FTNoIR_TrackerDll() } -void FTNoIR_TrackerDll::Initialize() -{ - return; -} - void FTNoIR_TrackerDll::getFullName(QString *strToBeFilled) { *strToBeFilled = trackerFullName; diff --git a/ftnoir_tracker_sm/ftnoir_tracker_sm.h b/ftnoir_tracker_sm/ftnoir_tracker_sm.h index 6c76b149..44a5627a 100644 --- a/ftnoir_tracker_sm/ftnoir_tracker_sm.h +++ b/ftnoir_tracker_sm/ftnoir_tracker_sm.h @@ -142,8 +142,6 @@ public: FTNoIR_TrackerDll(); ~FTNoIR_TrackerDll(); - void Initialize(); - void getFullName(QString *strToBeFilled); void getShortName(QString *strToBeFilled); void getDescription(QString *strToBeFilled); -- cgit v1.2.3 From e74cad83f41e759a37a56c623dafe2d05a692129 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 9 Oct 2013 00:33:17 +0200 Subject: blur before segmenting to win big (2x perf) Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 781bf711..8025e956 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -188,7 +188,7 @@ void Tracker::run() aruco::MarkerDetector detector; detector.setDesiredSpeed(3); detector.setThresholdParams(11, 5); - cv::Mat color, color_, grayscale, rvec, tvec; + cv::Mat color, color_, grayscale, grayscale2, rvec, tvec; if (!camera.isOpened()) { @@ -201,7 +201,12 @@ void Tracker::run() if (!camera.read(color_)) continue; color_.copyTo(color); - cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); + cv::cvtColor(color, grayscale2, cv::COLOR_BGR2GRAY); + const int kernel = grayscale2.cols > 480 ? 7 : 5; + int kernel2 = kernel * grayscale2.rows / grayscale2.cols; + if ((kernel2 % 2) == 0) + kernel2++; + cv::GaussianBlur(grayscale2, grayscale, cv::Size(kernel, kernel2), 0, 0); const float focal_length_w = 0.5 * grayscale.cols / tan(0.5 * fov * HT_PI / 180); const float focal_length_h = 0.5 * grayscale.rows / tan(0.5 * fov * grayscale.rows / grayscale.cols * HT_PI / 180.0); cv::Mat intrinsics = cv::Mat::eye(3, 3, CV_32FC1); -- cgit v1.2.3 From 864910a1fb753629d2852a91ffae4ebba374358c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 15 Oct 2013 08:52:25 +0200 Subject: fix trackers for qt5 Assorted changes: - make filenames unique, since automoc made a boo-boo - adjust include paths, "QtGui" -> "" - use std::shared_ptr in c++11 mode (thanks Patrick!) - make class names unique, automoc sucks, but saves typing - add a dummy class in one file since moronic automoc thinks every target contains Q_OBJECTS!!! --- FTNoIR_Tracker_PT/boost-compat.h | 3 +- FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp | 6 +- FTNoIR_Tracker_PT/ftnoir_tracker_pt.h | 9 +- FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h | 2 +- FTNoIR_Tracker_PT/pt_video_widget.cpp | 52 ++++++++ FTNoIR_Tracker_PT/pt_video_widget.h | 64 ++++++++++ FTNoIR_Tracker_PT/video_widget.cpp | 145 ----------------------- FTNoIR_Tracker_PT/video_widget.h | 95 --------------- compat/qt-bug-appeasement.cpp | 1 + facetracknoir/qt-moc.h | 10 ++ ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp | 1 + ftnoir_tracker_aruco/ar_video_widget.cpp | 30 +++++ ftnoir_tracker_aruco/ar_video_widget.h | 39 ++++++ ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 5 +- ftnoir_tracker_aruco/video_widget.cpp | 30 ----- ftnoir_tracker_aruco/video_widget.h | 39 ------ ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 2 +- ftnoir_tracker_ht/ftnoir_tracker_ht.h | 4 +- ftnoir_tracker_ht/ht_video_widget.cpp | 30 +++++ ftnoir_tracker_ht/ht_video_widget.h | 39 ++++++ ftnoir_tracker_ht/video_widget.cpp | 30 ----- ftnoir_tracker_ht/video_widget.h | 39 ------ 23 files changed, 280 insertions(+), 397 deletions(-) create mode 100644 FTNoIR_Tracker_PT/pt_video_widget.cpp create mode 100644 FTNoIR_Tracker_PT/pt_video_widget.h delete mode 100644 FTNoIR_Tracker_PT/video_widget.cpp delete mode 100644 FTNoIR_Tracker_PT/video_widget.h create mode 100644 compat/qt-bug-appeasement.cpp create mode 100644 facetracknoir/qt-moc.h create mode 100644 ftnoir_tracker_aruco/ar_video_widget.cpp create mode 100644 ftnoir_tracker_aruco/ar_video_widget.h delete mode 100644 ftnoir_tracker_aruco/video_widget.cpp delete mode 100644 ftnoir_tracker_aruco/video_widget.h create mode 100644 ftnoir_tracker_ht/ht_video_widget.cpp create mode 100644 ftnoir_tracker_ht/ht_video_widget.h delete mode 100644 ftnoir_tracker_ht/video_widget.cpp delete mode 100644 ftnoir_tracker_ht/video_widget.h (limited to 'ftnoir_tracker_aruco') diff --git a/FTNoIR_Tracker_PT/boost-compat.h b/FTNoIR_Tracker_PT/boost-compat.h index aea5e1a2..b5be237a 100644 --- a/FTNoIR_Tracker_PT/boost-compat.h +++ b/FTNoIR_Tracker_PT/boost-compat.h @@ -1,6 +1,5 @@ #pragma once #include -#define shared_ptr auto_ptr namespace boost { - using std::auto_ptr; + using std::shared_ptr; }; diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp index d4741101..745d98e9 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp @@ -12,10 +12,6 @@ #include #include -#ifdef OPENTRACK_API -# define VideoWidget VideoWidget2 -#endif - using namespace std; using namespace cv; using namespace boost; @@ -192,7 +188,7 @@ void Tracker::update_show_video_widget() { const int VIDEO_FRAME_WIDTH = 252; const int VIDEO_FRAME_HEIGHT = 189; - video_widget = new VideoWidget(video_frame, this); + video_widget = new PTVideoWidget(video_frame, this); QHBoxLayout* video_layout = new QHBoxLayout(); 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 7dcfc8bb..2430f5f0 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h @@ -11,15 +11,13 @@ #ifdef OPENTRACK_API # include "ftnoir_tracker_base/ftnoir_tracker_base.h" # include "facetracknoir/global-settings.h" -#else -# include "..\ftnoir_tracker_base\ftnoir_tracker_base.h" #endif #include "ftnoir_tracker_pt_settings.h" #include "frame_observer.h" #include "camera.h" #include "point_extractor.h" #include "point_tracker.h" -#include "video_widget.h" +#include "pt_video_widget.h" #include "timer.h" #include @@ -82,7 +80,6 @@ protected: // --- tracking chain --- #ifdef OPENTRACK_API -#define VideoWidget VideoWidget2 CVCamera camera; #else VICamera camera; @@ -101,7 +98,9 @@ protected: void update_show_video_widget(); bool show_video_widget; - VideoWidget* video_widget; +#ifdef OPENTRACK_API + PTVideoWidget* video_widget; +#endif QFrame* video_frame; // --- misc --- diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h index 14df7ede..3e1af50a 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h @@ -16,7 +16,7 @@ #include "ftnoir_tracker_pt_settings.h" #include "ftnoir_tracker_pt.h" #include "trans_calib.h" -#include "video_widget.h" +#include "pt_video_widget.h" #include "ui_FTNoIR_PT_Controls.h" #include diff --git a/FTNoIR_Tracker_PT/pt_video_widget.cpp b/FTNoIR_Tracker_PT/pt_video_widget.cpp new file mode 100644 index 00000000..03c42fc7 --- /dev/null +++ b/FTNoIR_Tracker_PT/pt_video_widget.cpp @@ -0,0 +1,52 @@ +/* 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 +#include + +using namespace cv; +using namespace std; + +void PTVideoWidget::update_image(const cv::Mat& frame) +{ + QMutexLocker foo(&mtx); + 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 int pos = 3 * (y*frame.cols + x); + data[y * pitch + x * 3 + 0] = frame.data[pos + 2]; + data[y * pitch + x * 3 + 1] = frame.data[pos + 1]; + data[y * pitch + x * 3 + 2] = frame.data[pos + 0]; + } + qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); + pixmap = QPixmap::fromImage(qframe); +} + +// ---------------------------------------------------------------------------- +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); +} diff --git a/FTNoIR_Tracker_PT/pt_video_widget.h b/FTNoIR_Tracker_PT/pt_video_widget.h new file mode 100644 index 00000000..e67e6d57 --- /dev/null +++ b/FTNoIR_Tracker_PT/pt_video_widget.h @@ -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. + */ + +#pragma once + +#include "frame_observer.h" +#include +#include +#include +#include +#ifndef OPENTRACK_API +# include +# include +#else +# include "FTNoIR_Tracker_PT/boost-compat.h" +# if defined(_WIN32) +# include +# endif +#endif +#include +#include +#include + +class PTVideoWidget : public QWidget, public FrameObserver +{ + Q_OBJECT + +public: + PTVideoWidget(QWidget *parent, FrameProvider* provider) : QWidget(parent), /* to avoid linker errors */ FrameObserver(provider) { + connect(&timer, SIGNAL(timeout()), this, SLOT(update())); + timer.start(45); + } + 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.drawPixmap(e->rect(), pixmap, e->rect()); + } +private: + QMutex mtx; + QPixmap pixmap; + QTimer timer; +}; + +// ---------------------------------------------------------------------------- +// 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/video_widget.cpp b/FTNoIR_Tracker_PT/video_widget.cpp deleted file mode 100644 index 0d31620f..00000000 --- a/FTNoIR_Tracker_PT/video_widget.cpp +++ /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. - * - * 20130312, WVR: Add 7 lines to resizeGL after resize_frame. This should lower CPU-load. - */ - -#include "video_widget.h" - -#include -#include - -using namespace cv; -using namespace std; -#ifndef OPENTRACK_API -using namespace boost; -#endif -#ifndef OPENTRACK_API -// ---------------------------------------------------------------------------- -void VideoWidget::initializeGL() -{ - glClearColor(0.0, 0.0, 0.0, 0.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -} - -void VideoWidget::resizeGL(int w, int h) -{ - // setup 1 to 1 projection - glViewport(0, 0, w, h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, w, 0, h, -1, 1); - resize_frame(); - glDisable(GL_DEPTH_TEST); - glBegin(GL_QUADS); - glVertex2f(0,0); - glVertex2f(1,0); - glVertex2f(1,1); - glVertex2f(0,1); - glEnd(); -} - -void VideoWidget::paintGL() -{ - glClear(GL_COLOR_BUFFER_BIT); - if (!resized_qframe.isNull()) - { - glDrawPixels(resized_qframe.width(), resized_qframe.height(), GL_RGBA, GL_UNSIGNED_BYTE, resized_qframe.bits()); - - const int crosshair_radius = 10; - const int crosshair_thickness = 1; - - if (points) - { - glColor3f(1.0, 0.0, 0.0); - glLineWidth(crosshair_thickness); - int x,y; - for (vector::iterator iter = points->begin(); - iter != points->end(); - ++iter) - { - x = (*iter)[0] * resized_qframe.width() + resized_qframe.width()/2.0 + 0.5; - y = (*iter)[1] * resized_qframe.width() + resized_qframe.height()/2.0 + 0.5; - - glBegin(GL_LINES); - glVertex2i(x-crosshair_radius, y); - glVertex2i(x+crosshair_radius, y); - glEnd(); - glBegin(GL_LINES); - glVertex2i(x, y-crosshair_radius); - glVertex2i(x, y+crosshair_radius); - glEnd(); - } - } - } - glFlush(); -} - - -void VideoWidget::resize_frame() -{ - if (!qframe.isNull()) - resized_qframe = qframe.scaled(this->size(), Qt::KeepAspectRatio); -} - - -void VideoWidget::update_frame_and_points() -{ - if (!get_frame_and_points(frame, points)) return; - - // convert to QImage - if (frame.channels() == 3) - qframe = QImage((const unsigned char*)(frame.data), frame.cols, frame.rows, frame.step, QImage::Format_RGB888).rgbSwapped(); - else if (frame.channels() == 1) - qframe = QImage((const unsigned char*)(frame.data), frame.cols, frame.rows, frame.step, QImage::Format_Indexed8); - qframe = QGLWidget::convertToGLFormat(qframe); - - resize_frame(); - updateGL(); -} - -#else -void VideoWidget2::update_image(const cv::Mat& frame) -{ - QMutexLocker foo(&mtx); - 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 int pos = 3 * (y*frame.cols + x); - data[y * pitch + x * 3 + 0] = frame.data[pos + 2]; - data[y * pitch + x * 3 + 1] = frame.data[pos + 1]; - data[y * pitch + x * 3 + 2] = frame.data[pos + 0]; - } - qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); - pixmap = QPixmap::fromImage(qframe); -} -#endif - -// ---------------------------------------------------------------------------- -VideoWidgetDialog::VideoWidgetDialog(QWidget *parent, FrameProvider* provider) - : QDialog(parent), - video_widget(NULL) -{ - const int VIDEO_FRAME_WIDTH = 640; - const int VIDEO_FRAME_HEIGHT = 480; - -#ifdef OPENTRACK_API - video_widget = new VideoWidget2(this, provider); -#else - video_widget = new VideoWidget(this, provider); -#endif - - 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); -} diff --git a/FTNoIR_Tracker_PT/video_widget.h b/FTNoIR_Tracker_PT/video_widget.h deleted file mode 100644 index 3164dacc..00000000 --- a/FTNoIR_Tracker_PT/video_widget.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 VIDEOWIDGET_H -#define VIDEOWIDGET_H - -#include "frame_observer.h" - -#include -#include -#include -#ifndef OPENTRACK_API -# include -# include -#else -# include "FTNoIR_Tracker_PT/boost-compat.h" -# if defined(_WIN32) -# include -# endif -#endif -#include -#include -#include - -#ifndef OPENTRACK_API -// ---------------------------------------------------------------------------- -// OpenGL based widget to display an OpenCV image with some points on top -class VideoWidget : public QGLWidget, public FrameObserver -{ - Q_OBJECT - -public: - VideoWidget(QWidget *parent, FrameProvider* provider) : QGLWidget(parent), FrameObserver(provider) {} - - virtual void initializeGL(); - virtual void resizeGL(int w, int h); - virtual void paintGL(); - - void update_frame_and_points(); - -private: - void resize_frame(); - - cv::Mat frame; - QImage qframe; - QImage resized_qframe; - - boost::shared_ptr< std::vector > points; -}; -#else -/* Qt moc likes to skip over preprocessor directives -sh */ -class VideoWidget2 : public QWidget, public FrameObserver -{ - Q_OBJECT - -public: - VideoWidget2(QWidget *parent, FrameProvider* provider) : QWidget(parent), /* to avoid linker errors */ FrameObserver(provider) { - connect(&timer, SIGNAL(timeout()), this, SLOT(update())); - timer.start(45); - } - 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.drawPixmap(e->rect(), pixmap, e->rect()); - } -private: - QMutex mtx; - QPixmap pixmap; - QTimer timer; -}; -#endif - -// ---------------------------------------------------------------------------- -// A VideoWidget embedded in a dialog frame -class VideoWidgetDialog : public QDialog -{ - Q_OBJECT -public: - VideoWidgetDialog(QWidget *parent, FrameProvider* provider); - virtual ~VideoWidgetDialog() {} - - VideoWidget2* get_video_widget() { return video_widget; } - -private: - VideoWidget2* video_widget; -}; - -#endif // VIDEOWIDGET_H diff --git a/compat/qt-bug-appeasement.cpp b/compat/qt-bug-appeasement.cpp new file mode 100644 index 00000000..9a86ac0a --- /dev/null +++ b/compat/qt-bug-appeasement.cpp @@ -0,0 +1 @@ +#include "facetracknoir/qt-moc.h" diff --git a/facetracknoir/qt-moc.h b/facetracknoir/qt-moc.h new file mode 100644 index 00000000..467370f9 --- /dev/null +++ b/facetracknoir/qt-moc.h @@ -0,0 +1,10 @@ +#include + +// this file exists only such that cmake qt automoc is appeased + +class AutomocMe { + Q_OBJECT +private: + virtual void foo() = 0; + AutomocMe() = delete; +}; diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp index f479ce76..cefc9bf8 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp @@ -26,6 +26,7 @@ * It is based on the (Linux) example made by Melchior FRANZ. * ********************************************************************************/ #include "ftnoir_protocol_fg.h" +#include #include #include "facetracknoir/global-settings.h" diff --git a/ftnoir_tracker_aruco/ar_video_widget.cpp b/ftnoir_tracker_aruco/ar_video_widget.cpp new file mode 100644 index 00000000..6a4572a0 --- /dev/null +++ b/ftnoir_tracker_aruco/ar_video_widget.cpp @@ -0,0 +1,30 @@ +/* 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 "ar_video_widget.h" + +#include + +using namespace std; + +void ArucoVideoWidget::update_image(unsigned char *frame, int width, int height) +{ + QMutexLocker foo(&mtx); + QImage qframe = QImage(width, height, QImage::Format_RGB888); + uchar* data = qframe.bits(); + const int pitch = qframe.bytesPerLine(); + for (int y = 0; y < height; y++) + for (int x = 0; x < width; x++) + { + const int pos = 3 * (y*width + x); + data[y * pitch + x * 3 + 0] = frame[pos + 2]; + data[y * pitch + x * 3 + 1] = frame[pos + 1]; + data[y * pitch + x * 3 + 2] = frame[pos + 0]; + } + qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); + pixmap = QPixmap::fromImage(qframe); +} diff --git a/ftnoir_tracker_aruco/ar_video_widget.h b/ftnoir_tracker_aruco/ar_video_widget.h new file mode 100644 index 00000000..dd0c16ac --- /dev/null +++ b/ftnoir_tracker_aruco/ar_video_widget.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 VIDEOWIDGET_H +#define VIDEOWIDGET_H + +#include +#include +#include +#include +#include +#include +#include + +// ---------------------------------------------------------------------------- +class ArucoVideoWidget : public QWidget +{ + Q_OBJECT + +public: + ArucoVideoWidget(QWidget *parent) : QWidget(parent), mtx() { + } + void update_image(unsigned char* frame, int width, int height); +protected slots: + void paintEvent( QPaintEvent* e ) { + QMutexLocker foo(&mtx); + QPainter painter(this); + painter.drawPixmap(e->rect(), pixmap, e->rect()); + } +private: + QMutex mtx; + QPixmap pixmap; +}; + +#endif // VIDEOWIDGET_H diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 8025e956..c735b479 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -148,7 +148,7 @@ Tracker::~Tracker() void Tracker::StartTracker(QFrame* videoframe) { videoframe->show(); - videoWidget = new VideoWidget(videoframe); + videoWidget = new ArucoVideoWidget(videoframe); QHBoxLayout* layout = new QHBoxLayout(); layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(videoWidget); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 98aba2cf..ddbdd179 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -10,12 +10,13 @@ #include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "ui_aruco-trackercontrols.h" -#include "video_widget.h" +#include "ar_video_widget.h" #include #include #include #include #include +#include #include class Tracker : public QThread, public ITracker @@ -31,7 +32,7 @@ public: private: QMutex mtx; QTimer timer; - VideoWidget* videoWidget; + ArucoVideoWidget* videoWidget; QHBoxLayout* layout; volatile bool fresh, stop; float fov; diff --git a/ftnoir_tracker_aruco/video_widget.cpp b/ftnoir_tracker_aruco/video_widget.cpp deleted file mode 100644 index 84cba6a3..00000000 --- a/ftnoir_tracker_aruco/video_widget.cpp +++ /dev/null @@ -1,30 +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 "video_widget.h" - -#include - -using namespace std; - -void VideoWidget::update_image(unsigned char *frame, int width, int height) -{ - QMutexLocker foo(&mtx); - QImage qframe = QImage(width, height, QImage::Format_RGB888); - uchar* data = qframe.bits(); - const int pitch = qframe.bytesPerLine(); - for (int y = 0; y < height; y++) - for (int x = 0; x < width; x++) - { - const int pos = 3 * (y*width + x); - data[y * pitch + x * 3 + 0] = frame[pos + 2]; - data[y * pitch + x * 3 + 1] = frame[pos + 1]; - data[y * pitch + x * 3 + 2] = frame[pos + 0]; - } - qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); - pixmap = QPixmap::fromImage(qframe); -} diff --git a/ftnoir_tracker_aruco/video_widget.h b/ftnoir_tracker_aruco/video_widget.h deleted file mode 100644 index 87b6278a..00000000 --- a/ftnoir_tracker_aruco/video_widget.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 VIDEOWIDGET_H -#define VIDEOWIDGET_H - -#include -#include -#include -#include -#include -#include -#include - -// ---------------------------------------------------------------------------- -class VideoWidget : public QWidget -{ - Q_OBJECT - -public: - VideoWidget(QWidget *parent) : QWidget(parent), mtx() { - } - void update_image(unsigned char* frame, int width, int height); -protected slots: - void paintEvent( QPaintEvent* e ) { - QMutexLocker foo(&mtx); - QPainter painter(this); - painter.drawPixmap(e->rect(), pixmap, e->rect()); - } -private: - QMutex mtx; - QPixmap pixmap; -}; - -#endif // VIDEOWIDGET_H diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 27817a0c..b4fd03f6 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -165,7 +165,7 @@ Tracker::~Tracker() void Tracker::StartTracker(QFrame* videoframe) { videoframe->show(); - videoWidget = new VideoWidget(videoframe); + videoWidget = new HTVideoWidget(videoframe); QHBoxLayout* layout = new QHBoxLayout(); layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(videoWidget); diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h index 5b8eb508..96607411 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h @@ -12,7 +12,7 @@ #include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "headtracker-ftnoir.h" #include "ui_ht-trackercontrols.h" -#include "video_widget.h" +#include "ht_video_widget.h" #include "compat/compat.h" #include #include @@ -31,7 +31,7 @@ private: QTimer timer; PortableLockedShm lck_shm; QProcess subprocess; - VideoWidget* videoWidget; + HTVideoWidget* videoWidget; QHBoxLayout* layout; volatile bool fresh; private slots: diff --git a/ftnoir_tracker_ht/ht_video_widget.cpp b/ftnoir_tracker_ht/ht_video_widget.cpp new file mode 100644 index 00000000..4d7d66a2 --- /dev/null +++ b/ftnoir_tracker_ht/ht_video_widget.cpp @@ -0,0 +1,30 @@ +/* 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 "ht_video_widget.h" + +#include + +using namespace std; + +void HTVideoWidget::update_image(unsigned char *frame, int width, int height) +{ + QMutexLocker foo(&mtx); + QImage qframe = QImage(width, height, QImage::Format_RGB888); + uchar* data = qframe.bits(); + const int pitch = qframe.bytesPerLine(); + for (int y = 0; y < height; y++) + for (int x = 0; x < width; x++) + { + const int pos = 3 * (y*width + x); + data[y * pitch + x * 3 + 0] = frame[pos + 2]; + data[y * pitch + x * 3 + 1] = frame[pos + 1]; + data[y * pitch + x * 3 + 2] = frame[pos + 0]; + } + qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); + pixmap = QPixmap::fromImage(qframe); +} diff --git a/ftnoir_tracker_ht/ht_video_widget.h b/ftnoir_tracker_ht/ht_video_widget.h new file mode 100644 index 00000000..b1182d8b --- /dev/null +++ b/ftnoir_tracker_ht/ht_video_widget.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 VIDEOWIDGET_H +#define VIDEOWIDGET_H + +#include +#include +#include +#include +#include +#include +#include + +// ---------------------------------------------------------------------------- +class HTVideoWidget : public QWidget +{ + Q_OBJECT + +public: + HTVideoWidget(QWidget *parent) : QWidget(parent), mtx() { + } + void update_image(unsigned char* frame, int width, int height); +protected slots: + void paintEvent( QPaintEvent* e ) { + QMutexLocker foo(&mtx); + QPainter painter(this); + painter.drawPixmap(e->rect(), pixmap, e->rect()); + } +private: + QMutex mtx; + QPixmap pixmap; +}; + +#endif // VIDEOWIDGET_H diff --git a/ftnoir_tracker_ht/video_widget.cpp b/ftnoir_tracker_ht/video_widget.cpp deleted file mode 100644 index 84cba6a3..00000000 --- a/ftnoir_tracker_ht/video_widget.cpp +++ /dev/null @@ -1,30 +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 "video_widget.h" - -#include - -using namespace std; - -void VideoWidget::update_image(unsigned char *frame, int width, int height) -{ - QMutexLocker foo(&mtx); - QImage qframe = QImage(width, height, QImage::Format_RGB888); - uchar* data = qframe.bits(); - const int pitch = qframe.bytesPerLine(); - for (int y = 0; y < height; y++) - for (int x = 0; x < width; x++) - { - const int pos = 3 * (y*width + x); - data[y * pitch + x * 3 + 0] = frame[pos + 2]; - data[y * pitch + x * 3 + 1] = frame[pos + 1]; - data[y * pitch + x * 3 + 2] = frame[pos + 0]; - } - qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); - pixmap = QPixmap::fromImage(qframe); -} diff --git a/ftnoir_tracker_ht/video_widget.h b/ftnoir_tracker_ht/video_widget.h deleted file mode 100644 index 87b6278a..00000000 --- a/ftnoir_tracker_ht/video_widget.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 VIDEOWIDGET_H -#define VIDEOWIDGET_H - -#include -#include -#include -#include -#include -#include -#include - -// ---------------------------------------------------------------------------- -class VideoWidget : public QWidget -{ - Q_OBJECT - -public: - VideoWidget(QWidget *parent) : QWidget(parent), mtx() { - } - void update_image(unsigned char* frame, int width, int height); -protected slots: - void paintEvent( QPaintEvent* e ) { - QMutexLocker foo(&mtx); - QPainter painter(this); - painter.drawPixmap(e->rect(), pixmap, e->rect()); - } -private: - QMutex mtx; - QPixmap pixmap; -}; - -#endif // VIDEOWIDGET_H -- cgit v1.2.3 From 4157874768594164e1d5b366e5a9cb9bc931e761 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 16 Oct 2013 23:29:16 +0200 Subject: pass -Wall -Wextra -pedantic --- ftnoir_csv/csv.cpp | 2 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 2 +- ftnoir_tracker_aruco/include/markerdetector.h | 5 ++++- ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp | 8 ++++---- 4 files changed, 10 insertions(+), 7 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_csv/csv.cpp b/ftnoir_csv/csv.cpp index 4753e8df..4e76e844 100644 --- a/ftnoir_csv/csv.cpp +++ b/ftnoir_csv/csv.cpp @@ -137,7 +137,7 @@ void CSV::getGameData( const int id, unsigned char* table, QString& gamename) if (gameLine.count() > 6) { if (gameLine.at(6).compare( gameID, Qt::CaseInsensitive ) == 0) { QByteArray id = gameLine.at(7).toLatin1(); - int tmp[8]; + unsigned int tmp[8]; int fuzz[3]; if (gameLine.at(3) == QString("V160")) { diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index ddbdd179..0f811f5d 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -57,7 +57,7 @@ public: void showEvent ( QShowEvent * event ); void Initialize(QWidget *parent); - void registerTracker(ITracker *tracker) {} + void registerTracker(ITracker *) {} void unRegisterTracker() {} private: diff --git a/ftnoir_tracker_aruco/include/markerdetector.h b/ftnoir_tracker_aruco/include/markerdetector.h index 35369cea..68aa7f8a 100644 --- a/ftnoir_tracker_aruco/include/markerdetector.h +++ b/ftnoir_tracker_aruco/include/markerdetector.h @@ -52,10 +52,13 @@ class ARUCO_EXPORTS MarkerDetector contour=M.contour; idx=M.idx; } - MarkerCandidate & operator=(const MarkerCandidate &M){ + MarkerCandidate operator=(const MarkerCandidate &M){ + if (this == &M) + return *this; (*(Marker*)this)=(*(Marker*)&M); contour=M.contour; idx=M.idx; + return M; } vector contour;//all the points of its contour diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp index 64eaaa42..db6f658c 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dll.cpp @@ -18,22 +18,22 @@ FTNoIR_TrackerDll::~FTNoIR_TrackerDll() void FTNoIR_TrackerDll::getFullName(QString *strToBeFilled) { *strToBeFilled = trackerFullName; -}; +} void FTNoIR_TrackerDll::getShortName(QString *strToBeFilled) { *strToBeFilled = trackerShortName; -}; +} void FTNoIR_TrackerDll::getDescription(QString *strToBeFilled) { *strToBeFilled = trackerDescription; -}; +} void FTNoIR_TrackerDll::getIcon(QIcon *icon) { *icon = QIcon(":/images/facetracknoir.png"); -}; +} //////////////////////////////////////////////////////////////////////////////// // Factory function that creates instances if the Tracker object. -- cgit v1.2.3 From a8a8cfac5f1be7e0cbfadcc2def8aaa0e8d9d9a0 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 16 Oct 2013 23:44:58 +0200 Subject: all except 3rdparty-maintained stuff pass -Wall -Wextra -pedantic Signed-off-by: Stanislaw Halik --- FTNoIR_Tracker_PT/boost-compat.h | 2 +- ftnoir_csv/csv.cpp | 4 ++-- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 ++-- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 4 ++-- ftnoir_tracker_aruco/include/boarddetector.h | 2 +- ftnoir_tracker_aruco/include/cvdrawingutils.h | 2 +- ftnoir_tracker_aruco/include/markerdetector.h | 6 +----- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 4 ++-- ftnoir_tracker_ht/ftnoir_tracker_ht.h | 6 +++--- ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp | 5 +---- ftnoir_tracker_hydra/ftnoir_tracker_hydra.h | 8 ++++---- ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp | 2 +- ftnoir_tracker_udp/ftnoir_tracker_udp.cpp | 2 +- ftnoir_tracker_udp/ftnoir_tracker_udp.h | 8 ++++---- ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp | 2 +- x-plane-plugin/plugin.c | 20 +++++++++++++------- 16 files changed, 40 insertions(+), 41 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/FTNoIR_Tracker_PT/boost-compat.h b/FTNoIR_Tracker_PT/boost-compat.h index b5be237a..612f2c4d 100644 --- a/FTNoIR_Tracker_PT/boost-compat.h +++ b/FTNoIR_Tracker_PT/boost-compat.h @@ -2,4 +2,4 @@ #include namespace boost { using std::shared_ptr; -}; +} diff --git a/ftnoir_csv/csv.cpp b/ftnoir_csv/csv.cpp index 4e76e844..ebdf50bb 100644 --- a/ftnoir_csv/csv.cpp +++ b/ftnoir_csv/csv.cpp @@ -138,7 +138,7 @@ void CSV::getGameData( const int id, unsigned char* table, QString& gamename) if (gameLine.at(6).compare( gameID, Qt::CaseInsensitive ) == 0) { QByteArray id = gameLine.at(7).toLatin1(); unsigned int tmp[8]; - int fuzz[3]; + unsigned int fuzz[3]; if (gameLine.at(3) == QString("V160")) { qDebug() << "no table"; @@ -155,7 +155,7 @@ void CSV::getGameData( const int id, unsigned char* table, QString& gamename) tmp + 6, tmp + 5, tmp + 4, - fuzz + 1) != 11 || ((fuzz[2] << 8) | fuzz[0]) != gameLine.at(0).toInt()) + fuzz + 1) != 11 || (int) ((fuzz[2] << 8) | fuzz[0]) != gameLine.at(0).toInt()) { qDebug() << "scanf failed" << fuzz[0] << fuzz[1] << fuzz[2]; } diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index c735b479..a221c2ff 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -385,11 +385,11 @@ TrackerControls::~TrackerControls() { } -void TrackerControls::showEvent(QShowEvent *event) +void TrackerControls::showEvent(QShowEvent *) { } -void TrackerControls::Initialize(QWidget* parent) +void TrackerControls::Initialize(QWidget*) { loadSettings(); show(); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 0f811f5d..260ca41e 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -54,9 +54,9 @@ public: explicit TrackerControls(); virtual ~TrackerControls(); - void showEvent ( QShowEvent * event ); + void showEvent (QShowEvent *); - void Initialize(QWidget *parent); + void Initialize(QWidget *); void registerTracker(ITracker *) {} void unRegisterTracker() {} diff --git a/ftnoir_tracker_aruco/include/boarddetector.h b/ftnoir_tracker_aruco/include/boarddetector.h index a0ee2361..4770b5c9 100644 --- a/ftnoir_tracker_aruco/include/boarddetector.h +++ b/ftnoir_tracker_aruco/include/boarddetector.h @@ -134,6 +134,6 @@ private: }; -}; +} #endif diff --git a/ftnoir_tracker_aruco/include/cvdrawingutils.h b/ftnoir_tracker_aruco/include/cvdrawingutils.h index ff67242f..38e9986e 100644 --- a/ftnoir_tracker_aruco/include/cvdrawingutils.h +++ b/ftnoir_tracker_aruco/include/cvdrawingutils.h @@ -46,7 +46,7 @@ namespace aruco static void draw3dCube(cv::Mat &Image,Board &m,const CameraParameters &CP); }; -}; +} #endif diff --git a/ftnoir_tracker_aruco/include/markerdetector.h b/ftnoir_tracker_aruco/include/markerdetector.h index 68aa7f8a..4d6e7b90 100644 --- a/ftnoir_tracker_aruco/include/markerdetector.h +++ b/ftnoir_tracker_aruco/include/markerdetector.h @@ -353,9 +353,5 @@ private: void draw(cv::Mat out,const std::vector &markers ); }; - - - - -}; +} #endif diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index b4fd03f6..14cd3942 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -305,11 +305,11 @@ TrackerControls::~TrackerControls() { } -void TrackerControls::showEvent(QShowEvent *event) +void TrackerControls::showEvent(QShowEvent *) { } -void TrackerControls::Initialize(QWidget* parent) +void TrackerControls::Initialize(QWidget*) { loadSettings(); show(); diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h index 96607411..aae4e6d6 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h @@ -46,10 +46,10 @@ public: explicit TrackerControls(); virtual ~TrackerControls(); - void showEvent ( QShowEvent * event ); + void showEvent (QShowEvent *); - void Initialize(QWidget *parent); - void registerTracker(ITracker *tracker) {} + void Initialize(QWidget *); + void registerTracker(ITracker *) {} void unRegisterTracker() {} private: diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp index 7333fbc4..86ca8888 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp @@ -48,7 +48,7 @@ void controller_manager_setup_callback( sixenseUtils::ControllerManager::setup_s } }*/ -void Hydra_Tracker::StartTracker(QFrame* videoFrame) +void Hydra_Tracker::StartTracker(QFrame*) { //QMessageBox::warning(0,"FaceTrackNoIR Notification", "Tracking loading settings...",QMessageBox::Ok,QMessageBox::NoButton); loadSettings(); @@ -78,9 +78,6 @@ bool Hydra_Tracker::GiveHeadPoseData(double *data) //Rotation quat = Rotation(acd.controllers[0].rot_quat[1],acd.controllers[0].rot_quat[2],acd.controllers[0].rot_quat[3],acd.controllers[0].rot_quat[0]); sixenseMath::Matrix4 mat = sixenseMath::Matrix4(acd.controllers[0].rot_mat);// sixenseMath::Quat(acd.controllers[0].rot_quat[1],acd.controllers[0].rot_quat[2],acd.controllers[0].rot_quat[3],acd.controllers[0].rot_quat[0]); - double yaw = 0.0f; - double pitch = 0.0f; - double roll = 0.0f; float ypr[3]; mat.getEulerAngles().fill(ypr); diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h index 82a72f56..19f2a685 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h @@ -11,7 +11,7 @@ public: Hydra_Tracker(); ~Hydra_Tracker(); - void StartTracker( QFrame *videoframe ); + void StartTracker(QFrame *); bool GiveHeadPoseData(double *data); void loadSettings(); volatile bool should_quit; @@ -44,11 +44,11 @@ public: explicit TrackerControls(); ~TrackerControls(); - void showEvent ( QShowEvent * event ); + void showEvent (QShowEvent *); void Initialize(QWidget *parent); - void registerTracker(ITracker *tracker) {}; - void unRegisterTracker() {}; + void registerTracker(ITracker *) {} + void unRegisterTracker() {} private: Ui::UIHydraControls ui; diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp index 913f8070..165f8573 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp @@ -81,7 +81,7 @@ void TrackerControls::doOK() { } // override show event -void TrackerControls::showEvent ( QShowEvent * event ) { +void TrackerControls::showEvent ( QShowEvent * ) { loadSettings(); } diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp index d67fb636..1539707e 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp @@ -88,7 +88,7 @@ quint16 senderPort; } } -void FTNoIR_Tracker::StartTracker(QFrame* videoFrame) +void FTNoIR_Tracker::StartTracker(QFrame*) { loadSettings(); // diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.h b/ftnoir_tracker_udp/ftnoir_tracker_udp.h index e5ea7ff3..d158630b 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.h +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.h @@ -15,7 +15,7 @@ public: FTNoIR_Tracker(); ~FTNoIR_Tracker(); - void StartTracker( QFrame *videoframe ); + void StartTracker(QFrame *); bool GiveHeadPoseData(double *data); void loadSettings(); volatile bool should_quit; @@ -49,11 +49,11 @@ public: explicit TrackerControls(); ~TrackerControls(); - void showEvent ( QShowEvent * event ); + void showEvent (QShowEvent *); void Initialize(QWidget *parent); - void registerTracker(ITracker *tracker) {}; - void unRegisterTracker() {}; + void registerTracker(ITracker *) {} + void unRegisterTracker() {} private: Ui::UICFTNClientControls ui; diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp index 55bb6c97..e17d5c32 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp @@ -81,7 +81,7 @@ void TrackerControls::doOK() { } // override show event -void TrackerControls::showEvent ( QShowEvent * event ) { +void TrackerControls::showEvent ( QShowEvent * ) { loadSettings(); } diff --git a/x-plane-plugin/plugin.c b/x-plane-plugin/plugin.c index 67dab7ad..38e1e7bf 100644 --- a/x-plane-plugin/plugin.c +++ b/x-plane-plugin/plugin.c @@ -40,7 +40,13 @@ static WineSHM* shm_posix = NULL; static void *view_x, *view_y, *view_z, *view_heading, *view_pitch; static float offset_x, offset_y, offset_z; -PortableLockedShm* PortableLockedShm_init(const char *shmName, const char *mutexName, int mapSize) +#ifdef __GNUC__ +# define OT_UNUSED(varname) varname __attribute__((__unused__)) +#else +# define OT_UNUSED(varname) varname +#endif + +PortableLockedShm* PortableLockedShm_init(const char *shmName, const char *OT_UNUSED(mutexName), int mapSize) { PortableLockedShm* self = malloc(sizeof(PortableLockedShm)); char shm_filename[NAME_MAX]; @@ -83,9 +89,9 @@ static void reinit_offset() { } int write_head_position( - XPLMDrawingPhase inPhase, - int inIsBefore, - void * inRefcon) + XPLMDrawingPhase OT_UNUSED(inPhase), + int OT_UNUSED(inIsBefore), + void * OT_UNUSED(inRefcon)) { if (lck_posix != NULL && shm_posix != NULL) { PortableLockedShm_lock(lck_posix); @@ -140,9 +146,9 @@ PLUGIN_API void XPluginDisable ( void ) { } PLUGIN_API void XPluginReceiveMessage( - XPLMPluginID inFromWho, - int inMessage, - void * inParam) + XPLMPluginID OT_UNUSED(inFromWho), + int OT_UNUSED(inMessage), + void * OT_UNUSED(inParam)) { if (inMessage == XPLM_MSG_AIRPORT_LOADED) reinit_offset(); -- cgit v1.2.3 From 136151e9499ac8f2f7ec1a169a973d65b15820bb Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 19 Oct 2013 15:43:21 +0200 Subject: untested unbreakage Signed-off-by: Stanislaw Halik --- FTNoIR_Tracker_PT/ftnoir_tracker_pt.h | 2 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 2 +- ftnoir_tracker_base/ftnoir_tracker_base.h | 2 +- ftnoir_tracker_ht/ftnoir_tracker_ht.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h index 2430f5f0..e00ab1df 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h @@ -38,7 +38,7 @@ class Tracker : public ITracker, QThread, public FrameProvider { public: Tracker(); - ~Tracker(); + virtual ~Tracker() override; // --- ITracker interface --- virtual void Initialize(QFrame *videoframe); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 260ca41e..ec4c6c9d 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -24,7 +24,7 @@ class Tracker : public QThread, public ITracker Q_OBJECT public: Tracker(); - ~Tracker(); + virtual ~Tracker() override; void StartTracker(QFrame* frame); bool GiveHeadPoseData(double *data); bool enableTX, enableTY, enableTZ, enableRX, enableRY, enableRZ; diff --git a/ftnoir_tracker_base/ftnoir_tracker_base.h b/ftnoir_tracker_base/ftnoir_tracker_base.h index e9e11b61..66304bd7 100644 --- a/ftnoir_tracker_base/ftnoir_tracker_base.h +++ b/ftnoir_tracker_base/ftnoir_tracker_base.h @@ -41,7 +41,7 @@ // Instances are obtained via factory function. struct ITracker { - virtual ~ITracker() {} + virtual ~ITracker() = 0; virtual void StartTracker( QFrame* frame ) = 0; virtual bool GiveHeadPoseData(double *data) = 0; }; diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h index aae4e6d6..20648c51 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h @@ -22,7 +22,7 @@ class Tracker : public QObject, public ITracker Q_OBJECT public: Tracker(); - ~Tracker(); + virtual ~Tracker() override; void StartTracker(QFrame* frame); bool GiveHeadPoseData(double *data); bool enableTX, enableTY, enableTZ, enableRX, enableRY, enableRZ; -- cgit v1.2.3 From 7153a0b4daa30cef7d6e721e7b2edc511a1adf71 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 19 Oct 2013 15:55:52 +0200 Subject: unbreak build Signed-off-by: Stanislaw Halik Reported-by: mm0zct --- CMakeLists.txt | 5 ++++- FTNoIR_Tracker_PT/ftnoir_tracker_pt.h | 2 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 2 +- ftnoir_tracker_ht/ftnoir_tracker_ht.h | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/CMakeLists.txt b/CMakeLists.txt index adf692af..f875665f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,9 @@ project(opentrack) cmake_minimum_required(VERSION 2.8) -cmake_policy(SET CMP0020 NEW) + +if(NOT CMAKE_VERSION LESS "2.10.0") + cmake_policy(SET CMP0020 NEW) +endif() set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/cmake/") SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h index e00ab1df..64f282b6 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h @@ -38,7 +38,7 @@ class Tracker : public ITracker, QThread, public FrameProvider { public: Tracker(); - virtual ~Tracker() override; + virtual ~Tracker(); // --- ITracker interface --- virtual void Initialize(QFrame *videoframe); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index ec4c6c9d..815ca91c 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -24,7 +24,7 @@ class Tracker : public QThread, public ITracker Q_OBJECT public: Tracker(); - virtual ~Tracker() override; + virtual ~Tracker(); void StartTracker(QFrame* frame); bool GiveHeadPoseData(double *data); bool enableTX, enableTY, enableTZ, enableRX, enableRY, enableRZ; diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h index 20648c51..bde4ca67 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h @@ -22,7 +22,7 @@ class Tracker : public QObject, public ITracker Q_OBJECT public: Tracker(); - virtual ~Tracker() override; + virtual ~Tracker(); void StartTracker(QFrame* frame); bool GiveHeadPoseData(double *data); bool enableTX, enableTY, enableTZ, enableRX, enableRY, enableRZ; -- cgit v1.2.3 From d7d733131d62777481c9a72fee9005dd58cf0c74 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 22 Oct 2013 02:33:11 +0200 Subject: Optimize widget redraw Signed-off-by: Stanislaw Halik --- FTNoIR_Tracker_PT/pt_video_widget.cpp | 35 ++++++++++++++++++++------------ FTNoIR_Tracker_PT/pt_video_widget.h | 4 +++- ftnoir_tracker_aruco/ar_video_widget.cpp | 26 ++++++++++++++++++------ ftnoir_tracker_aruco/ar_video_widget.h | 10 ++++++++- 4 files changed, 54 insertions(+), 21 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/FTNoIR_Tracker_PT/pt_video_widget.cpp b/FTNoIR_Tracker_PT/pt_video_widget.cpp index 03c42fc7..35a2c42b 100644 --- a/FTNoIR_Tracker_PT/pt_video_widget.cpp +++ b/FTNoIR_Tracker_PT/pt_video_widget.cpp @@ -18,19 +18,7 @@ using namespace std; void PTVideoWidget::update_image(const cv::Mat& frame) { QMutexLocker foo(&mtx); - 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 int pos = 3 * (y*frame.cols + x); - data[y * pitch + x * 3 + 0] = frame.data[pos + 2]; - data[y * pitch + x * 3 + 1] = frame.data[pos + 1]; - data[y * pitch + x * 3 + 2] = frame.data[pos + 0]; - } - qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); - pixmap = QPixmap::fromImage(qframe); + _frame = frame; } // ---------------------------------------------------------------------------- @@ -50,3 +38,24 @@ VideoWidgetDialog::VideoWidgetDialog(QWidget *parent, FrameProvider* provider) setLayout(layout); resize(VIDEO_FRAME_WIDTH, VIDEO_FRAME_HEIGHT); } + +void PTVideoWidget::update_and_repaint() +{ + QMutexLocker foo(&mtx); + if (_frame.empty()) + return; + 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 int pos = 3 * (y*_frame.cols + x); + data[y * pitch + x * 3 + 0] = _frame.data[pos + 2]; + data[y * pitch + x * 3 + 1] = _frame.data[pos + 1]; + data[y * pitch + x * 3 + 2] = _frame.data[pos + 0]; + } + qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); + pixmap = QPixmap::fromImage(qframe); + update(); +} diff --git a/FTNoIR_Tracker_PT/pt_video_widget.h b/FTNoIR_Tracker_PT/pt_video_widget.h index e67e6d57..f5663e47 100644 --- a/FTNoIR_Tracker_PT/pt_video_widget.h +++ b/FTNoIR_Tracker_PT/pt_video_widget.h @@ -31,7 +31,7 @@ class PTVideoWidget : public QWidget, public FrameObserver public: PTVideoWidget(QWidget *parent, FrameProvider* provider) : QWidget(parent), /* to avoid linker errors */ FrameObserver(provider) { - connect(&timer, SIGNAL(timeout()), this, SLOT(update())); + connect(&timer, SIGNAL(timeout()), this, SLOT(update_and_repaint())); timer.start(45); } void update_image(const cv::Mat &frame); @@ -42,10 +42,12 @@ protected slots: QPainter painter(this); painter.drawPixmap(e->rect(), pixmap, e->rect()); } + void update_and_repaint(); private: QMutex mtx; QPixmap pixmap; QTimer timer; + cv::Mat _frame; }; // ---------------------------------------------------------------------------- diff --git a/ftnoir_tracker_aruco/ar_video_widget.cpp b/ftnoir_tracker_aruco/ar_video_widget.cpp index 6a4572a0..b727679b 100644 --- a/ftnoir_tracker_aruco/ar_video_widget.cpp +++ b/ftnoir_tracker_aruco/ar_video_widget.cpp @@ -14,17 +14,31 @@ using namespace std; void ArucoVideoWidget::update_image(unsigned char *frame, int width, int height) { QMutexLocker foo(&mtx); + memcpy(fb, frame, width * height * 3); + this->width = width; + this->height = height; +} + +void ArucoVideoWidget::update_and_repaint() +{ + QMutexLocker foo(&mtx); + if (width*height <= 0) + return; QImage qframe = QImage(width, height, QImage::Format_RGB888); uchar* data = qframe.bits(); const int pitch = qframe.bytesPerLine(); for (int y = 0; y < height; y++) + { + const int part = y*width; for (int x = 0; x < width; x++) { - const int pos = 3 * (y*width + x); - data[y * pitch + x * 3 + 0] = frame[pos + 2]; - data[y * pitch + x * 3 + 1] = frame[pos + 1]; - data[y * pitch + x * 3 + 2] = frame[pos + 0]; + const int pos = 3 * (part + x); + data[y * pitch + x * 3 + 0] = fb[pos + 2]; + data[y * pitch + x * 3 + 1] = fb[pos + 1]; + data[y * pitch + x * 3 + 2] = fb[pos + 0]; } - qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); - pixmap = QPixmap::fromImage(qframe); + } + auto qframe2 = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); + pixmap = QPixmap::fromImage(qframe2); + update(); } diff --git a/ftnoir_tracker_aruco/ar_video_widget.h b/ftnoir_tracker_aruco/ar_video_widget.h index dd0c16ac..3a1574cd 100644 --- a/ftnoir_tracker_aruco/ar_video_widget.h +++ b/ftnoir_tracker_aruco/ar_video_widget.h @@ -15,6 +15,7 @@ #include #include #include +#include // ---------------------------------------------------------------------------- class ArucoVideoWidget : public QWidget @@ -22,7 +23,9 @@ class ArucoVideoWidget : public QWidget Q_OBJECT public: - ArucoVideoWidget(QWidget *parent) : QWidget(parent), mtx() { + ArucoVideoWidget(QWidget *parent) : QWidget(parent), width(0), height(0), fb{0} { + connect(&timer, SIGNAL(timeout()), this, SLOT(update_and_repaint())); + timer.start(60); } void update_image(unsigned char* frame, int width, int height); protected slots: @@ -31,9 +34,14 @@ protected slots: QPainter painter(this); painter.drawPixmap(e->rect(), pixmap, e->rect()); } + void update_and_repaint(); + private: QMutex mtx; QPixmap pixmap; + QTimer timer; + char fb[2048*2048*3]; + int width,height; }; #endif // VIDEOWIDGET_H -- cgit v1.2.3 From 6fa9e7bb7810f89b0bcc376c940b0c74ac91fdf3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 22 Oct 2013 02:45:26 +0200 Subject: aruco: remove dead/broken code Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 13 +------------ ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 6 +----- 2 files changed, 2 insertions(+), 17 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index a221c2ff..099c1f85 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -127,7 +127,6 @@ void Tracker::load_settings() Tracker::Tracker() { - fresh = false; stop = false; videoWidget = NULL; layout = NULL; @@ -158,20 +157,11 @@ void Tracker::StartTracker(QFrame* videoframe) videoWidget->show(); this->layout = layout; load_settings(); - connect(&timer, SIGNAL(timeout()), this, SLOT(paint_widget())); - timer.start(50); start(); for (int i = 0; i < 6; i++) pose[i] = 0; } -void Tracker::paint_widget() { - if (fresh) { - fresh = false; - videoWidget->update(); - } -} - #define HT_PI 3.1415926535 void Tracker::run() @@ -232,10 +222,9 @@ void Tracker::run() frame = color; - if (frame.rows > 0 && !fresh) + if (frame.rows > 0) { videoWidget->update_image(frame.data, frame.cols, frame.rows); - fresh = true; } if (markers.size() == 1 && markers[0].size() == 4) { diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 815ca91c..8d532b4c 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -12,7 +12,6 @@ #include "ui_aruco-trackercontrols.h" #include "ar_video_widget.h" #include -#include #include #include #include @@ -31,10 +30,9 @@ public: void run(); private: QMutex mtx; - QTimer timer; ArucoVideoWidget* videoWidget; QHBoxLayout* layout; - volatile bool fresh, stop; + volatile bool stop; float fov; int camera_index; float dc[5]; @@ -42,8 +40,6 @@ private: void load_settings(); double pose[6]; cv::Mat frame; -private slots: - void paint_widget(); }; // Widget that has controls for FTNoIR protocol client-settings. -- cgit v1.2.3 From 1ad91f92226facb3306003f19407f45b727c3973 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 22 Oct 2013 02:51:19 +0200 Subject: hopefully fix msvc2010 build Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ar_video_widget.h | 2 +- ftnoir_tracker_ht/ht_video_widget.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ar_video_widget.h b/ftnoir_tracker_aruco/ar_video_widget.h index 3a1574cd..d16cb017 100644 --- a/ftnoir_tracker_aruco/ar_video_widget.h +++ b/ftnoir_tracker_aruco/ar_video_widget.h @@ -23,7 +23,7 @@ class ArucoVideoWidget : public QWidget Q_OBJECT public: - ArucoVideoWidget(QWidget *parent) : QWidget(parent), width(0), height(0), fb{0} { + ArucoVideoWidget(QWidget *parent) : QWidget(parent), width(0), height(0), fb() { connect(&timer, SIGNAL(timeout()), this, SLOT(update_and_repaint())); timer.start(60); } diff --git a/ftnoir_tracker_ht/ht_video_widget.h b/ftnoir_tracker_ht/ht_video_widget.h index 78000afa..33f21226 100644 --- a/ftnoir_tracker_ht/ht_video_widget.h +++ b/ftnoir_tracker_ht/ht_video_widget.h @@ -23,7 +23,7 @@ class HTVideoWidget : public QWidget Q_OBJECT public: - HTVideoWidget(QWidget *parent) : QWidget(parent), width(0), height(0), fb{0} { + HTVideoWidget(QWidget *parent) : QWidget(parent), width(0), height(0), fb() { connect(&timer, SIGNAL(timeout()), this, SLOT(update_and_repaint())); timer.start(60); } -- cgit v1.2.3 From a524644f99ab28c5e98bca0fa2210dfd3fa124ef Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 23 Oct 2013 16:25:47 +0200 Subject: small optimization Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 099c1f85..4daffe5e 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -193,7 +193,7 @@ void Tracker::run() color_.copyTo(color); cv::cvtColor(color, grayscale2, cv::COLOR_BGR2GRAY); const int kernel = grayscale2.cols > 480 ? 7 : 5; - int kernel2 = kernel * grayscale2.rows / grayscale2.cols; + int kernel2 = kernel * grayscale2.rows / grayscale2.cols - 1; if ((kernel2 % 2) == 0) kernel2++; cv::GaussianBlur(grayscale2, grayscale, cv::Size(kernel, kernel2), 0, 0); -- cgit v1.2.3 From 2323153f0eba6c1079ce91669468cc44c157a484 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 24 Oct 2013 15:37:38 +0200 Subject: aruco-ui: add layout Signed-off-by: Stanislaw Halik --- .../ftnoir_accela_filtercontrols.ui | 108 +-- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 795 +++++++++------------ ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 6 +- 3 files changed, 414 insertions(+), 495 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui index 098213ef..324acdf9 100644 --- a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui +++ b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui @@ -9,8 +9,8 @@ 0 0 - 459 - 207 + 347 + 268 @@ -27,8 +27,8 @@ - 459 - 207 + 6667 + 6666 @@ -48,13 +48,25 @@ + + QFormLayout::ExpandingFieldsGrow + + + 4 + + + 4 + + + 6 + true - + 0 0 @@ -241,45 +253,6 @@ background:none; - - - - - 0 - 0 - - - - - 8 - - - - QFrame::NoFrame - - - <html><head/><body><p align="justify">Accela filter by StanisÅ‚aw Halik<br/>With kind help from Donovan Baarda</p><p align="right">2012-2013</p></body></html> - - - Qt::RichText - - - false - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - true - - - 0 - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - @@ -556,7 +529,52 @@ background:none; - + + + + + 0 + 0 + + + + + 7 + + + + QFrame::NoFrame + + + <html><head/><body><p align="justify">Accela by <a href="https://github.com/sthalik"><span style=" text-decoration: underline; color:#0057ae;">StanisÅ‚aw Halik</span></a><br/>Help from <a href="https://github.com/dbaarda"><span style=" text-decoration: underline; color:#0057ae;">Donovan Baarda</span></a></p><p align="justify">2012-2013</p></body></html> + + + Qt::RichText + + + false + + + Qt::AlignCenter + + + true + + + 0 + + + 0 + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 4fe97e51..c007e93b 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -9,8 +9,8 @@ 0 0 - 593 - 280 + 704 + 273 @@ -21,465 +21,364 @@ - 750 - 280 + 6666 + 6666 HT tracker settings - - - - 10 - 10 - 141 - 16 - - - - Horizontal FOV - - - - - - 130 - 10 - 251 - 22 - - - - - - - 35.000000000000000 - - - 180.000000000000000 - - - 52.000000000000000 - - - - - - 10 - 40 - 137 - 16 - - - - Frames per second - - - - - - 130 - 40 - 251 - 22 - - - - - Default - + + + -1 + + + + + Distortion coefficients + + - - - 30 - + + + + + 0 + 0 + + + + true + + + QAbstractSpinBox::NoButtons + + + 11 + + + -1000.000000000000000 + + + 1000.000000000000000 + + + 0.000000000000000 + + - - - 60 - + + + + + 0 + 0 + + + + true + + + QAbstractSpinBox::NoButtons + + + 11 + + + -1000.000000000000000 + + + 1000.000000000000000 + + + 0.000000000000000 + + - - - 120 - + + + + + 0 + 0 + + + + true + + + QAbstractSpinBox::NoButtons + + + 11 + + + -1000.000000000000000 + + + 1000.000000000000000 + + + 0.000000000000000 + + - - - - - 10 - 70 - 133 - 16 - - - - Camera name - - - - - - 430 - 250 - 75 - 23 - - - - OK - - - - - - 510 - 250 - 75 - 23 - - - - Cancel - - - - - - 390 - 10 - 101 - 81 - - - - Enable axes - - - - - 10 - 20 - 70 - 17 - - - - RX - - - - - - 10 - 40 - 70 - 17 - - - - RY - - - - - - 10 - 60 - 70 - 17 - - - - RZ - - - - - - 60 - 20 - 70 - 17 - - - - TX - - - - - - 60 - 40 - 70 - 17 - - - - TY - - - - - - 60 - 60 - 70 - 17 - - - - TZ - - - - - - - 130 - 70 - 251 - 22 - - - - - - - 10 - 100 - 128 - 16 - - - - Resolution - - - - - - 130 - 100 - 251 - 22 - - - - - 640x480 - + + + + + 0 + 0 + + + + true + + + QAbstractSpinBox::NoButtons + + + 11 + + + -1000.000000000000000 + + + 1000.000000000000000 + + + 0.000000000000000 + + - - - 320x240 - + + + + + 0 + 0 + + + + true + + + QAbstractSpinBox::NoButtons + + + 11 + + + -1000.000000000000000 + + + 1000.000000000000000 + + + 0.000000000000000 + + - - - 320x200 - + + + + + 0 + 0 + + + + <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> + + + Qt::RichText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + 4 + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + - - - Default (not recommended!) - + + + + + Default + + + + + 30 + + + + + 60 + + + + + 120 + + + - - - - - 130 - 130 - 171 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 24 - - - -1000.000000000000000 - - - 1000.000000000000000 - - - 0.000000000000000 - - - - - - 10 - 130 - 111 - 16 - - - - Distortion coefficients - - - - - - 130 - 160 - 171 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 24 - - - -1000.000000000000000 - - - 1000.000000000000000 - - - 0.000000000000000 - - - - - - 130 - 190 - 171 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 24 - - - -1000.000000000000000 - - - 1000.000000000000000 - - - 0.000000000000000 - - - - - - 130 - 220 - 171 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 24 - - - -1000.000000000000000 - - - 1000.000000000000000 - - - 0.000000000000000 - - - - - - 130 - 250 - 171 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 24 - - - -1000.000000000000000 - - - 1000.000000000000000 - - - 0.000000000000000 - - - - - - 325 - 133 - 253 - 60 - - - - The ARUCO Library has been developed by -the Ava group of the Univeristy of Cordoba(Spain) -Contact to -Rafael Muñoz Salinas <rmsalinas@uco.es> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - 327 - 200 - 255 - 20 - - - - https://github.com/rmsalinas/aruco - - - Qt::AlignCenter - - - true - - + + + + Camera name + + + + + + + + + + + + + 35.000000000000000 + + + 180.000000000000000 + + + 52.000000000000000 + + + + + + + Frames per second + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + Horizontal FOV + + + + + + + Resolution + + + + + + + + 640x480 + + + + + 320x240 + + + + + 320x200 + + + + + Default (not recommended!) + + + + + + + + Enable axes + + + + -1 + + + 6 + + + 0 + + + 6 + + + 0 + + + + + RX + + + + + + + TX + + + + + + + RY + + + + + + + TY + + + + + + + RZ + + + + + + + TZ + + + + + + + diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 4daffe5e..25273f35 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -363,9 +363,11 @@ TrackerControls::TrackerControls() connect(ui.tx, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); connect(ui.ty, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); connect(ui.tz, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(doCancel())); - connect(ui.buttonOK, SIGNAL(clicked()), this, SLOT(doOK())); + //connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(doCancel())); + //connect(ui.buttonOK, SIGNAL(clicked()), this, SLOT(doOK())); //connect(ui.buttonSettings, SIGNAL(clicked()), this, SLOT(cameraSettings())); + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); + connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); loadSettings(); settingsDirty = false; } -- cgit v1.2.3 From 1a51dff438a5a5ec14b3d31ab081f818c422266f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 25 Oct 2013 14:09:11 +0200 Subject: remove kludgy compensation Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 25273f35..43ffc717 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -254,7 +254,7 @@ void Tracker::run() cv::Rodrigues(rvec, rotation_matrix); cv::Vec3d foo = cv::RQDecomp3x3(rotation_matrix, junk1, junk2); - + QMutexLocker lck(&mtx); for (int i = 0; i < 3; i++) @@ -264,8 +264,8 @@ void Tracker::run() pose[Pitch] = -foo[0]; pose[Roll] = foo[2]; - pose[Yaw] -= atan(pose[TX] / pose[TZ]) * 180 / HT_PI; - pose[Pitch] -= atan(pose[TY] / pose[TZ]) * 180 / HT_PI; + //pose[Yaw] -= atan(pose[TX] / pose[TZ]) * 180 / HT_PI; + //pose[Pitch] -= atan(pose[TY] / pose[TZ]) * 180 / HT_PI; } } } -- cgit v1.2.3 From 6d08b08d1e3ed9e020ea165b50a9bef1488eb1c4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 25 Oct 2013 23:37:28 +0200 Subject: aruco: show FPS and spacing Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 30 ++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 43ffc717..ad4643d0 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -185,6 +185,12 @@ void Tracker::run() fprintf(stderr, "aruco tracker: can't open camera\n"); return; } + + auto freq = cv::getTickFrequency(); + auto last_time = cv::getTickCount(); + auto prev_time = last_time; + int fps = 0; + int last_fps = 0; while (!stop) { @@ -204,7 +210,7 @@ void Tracker::run() intrinsics.at (1, 1) = focal_length_h; intrinsics.at (0, 2) = grayscale.cols/2; intrinsics.at (1, 2) = grayscale.rows/2; - + cv::Mat dist_coeffs = cv::Mat::zeros(5, 1, CV_32FC1); for (int i = 0; i < 5; i++) @@ -219,9 +225,27 @@ void Tracker::run() for (int i = 0; i < 4; i++) cv::line(color, m[i], m[(i+1)%4], cv::Scalar(0, 0, 255), 4); } - + + auto time = cv::getTickCount(); + + if ((long) (time / freq) != (long) (last_time / freq)) + { + last_fps = fps; + fps = 0; + last_time = time; + } + + fps++; + + char buf[128]; + + std::sprintf(buf, "Hz: %ld", last_fps); + cv::putText(frame, buf, cv::Point(10, 30), cv::FONT_HERSHEY_PLAIN, 2.0, cv::Scalar(0, 255, 0), 2); + std::sprintf(buf, "Delay: %ld ms", (long) (1000 * (time - prev_time) / freq)); + cv::putText(frame, buf, cv::Point(10, 50), cv::FONT_HERSHEY_PLAIN, 2.0, cv::Scalar(0, 255, 0), 2); + prev_time = time; + frame = color; - if (frame.rows > 0) { videoWidget->update_image(frame.data, frame.cols, frame.rows); -- cgit v1.2.3 From a430e297d011295131a24419fda4a9b28f22c539 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 25 Oct 2013 23:53:00 +0200 Subject: aruco: show reprojection Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index ad4643d0..2bb3ad77 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -191,6 +191,7 @@ void Tracker::run() auto prev_time = last_time; int fps = 0; int last_fps = 0; + std::vector reprojection; while (!stop) { @@ -223,7 +224,16 @@ void Tracker::run() if (markers.size() == 1 && markers[0].size() == 4) { const aruco::Marker& m = markers.at(0); for (int i = 0; i < 4; i++) - cv::line(color, m[i], m[(i+1)%4], cv::Scalar(0, 0, 255), 4); + cv::line(color, m[i], m[(i+1)%4], cv::Scalar(0, 0, 255), 3); + } + + for (int i = 0; i < reprojection.size(); i++) + { + cv::circle(frame, + reprojection[i], + 6, + cv::Scalar(0, 255, 128), + 3); } auto time = cv::getTickCount(); @@ -287,7 +297,11 @@ void Tracker::run() pose[Yaw] = foo[1]; pose[Pitch] = -foo[0]; pose[Roll] = foo[2]; - + + reprojection.clear(); + reprojection.resize(4); + cv::projectPoints(obj_points, rvec, tvec, intrinsics, dist_coeffs, reprojection); + //pose[Yaw] -= atan(pose[TX] / pose[TZ]) * 180 / HT_PI; //pose[Pitch] -= atan(pose[TY] / pose[TZ]) * 180 / HT_PI; } -- cgit v1.2.3 From 9195c580050947c845ff29f79a3854acfe41b387 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 25 Oct 2013 23:58:34 +0200 Subject: aruco: show reprojection error Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 2bb3ad77..5de62176 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -191,6 +191,7 @@ void Tracker::run() auto prev_time = last_time; int fps = 0; int last_fps = 0; + double error = 0; std::vector reprojection; while (!stop) @@ -250,9 +251,11 @@ void Tracker::run() char buf[128]; std::sprintf(buf, "Hz: %ld", last_fps); - cv::putText(frame, buf, cv::Point(10, 30), cv::FONT_HERSHEY_PLAIN, 2.0, cv::Scalar(0, 255, 0), 2); + cv::putText(frame, buf, cv::Point(10, 32), cv::FONT_HERSHEY_PLAIN, 2.0, cv::Scalar(0, 255, 0), 2); std::sprintf(buf, "Delay: %ld ms", (long) (1000 * (time - prev_time) / freq)); - cv::putText(frame, buf, cv::Point(10, 50), cv::FONT_HERSHEY_PLAIN, 2.0, cv::Scalar(0, 255, 0), 2); + cv::putText(frame, buf, cv::Point(10, 54), cv::FONT_HERSHEY_PLAIN, 2.0, cv::Scalar(80, 255, 0), 2); + std::sprintf(buf, "Error: %f px", error); + cv::putText(frame, buf, cv::Point(10, 76), cv::FONT_HERSHEY_PLAIN, 2.0, cv::Scalar(80, 255, 0), 2); prev_time = time; frame = color; @@ -302,6 +305,14 @@ void Tracker::run() reprojection.resize(4); cv::projectPoints(obj_points, rvec, tvec, intrinsics, dist_coeffs, reprojection); + error = 0; + for (int i = 0; i < 4; i++) + { + double x = reprojection[i].x - m[i].x; + double y = reprojection[i].y - m[i].y; + error += std::sqrt(x * x + y * y); + } + //pose[Yaw] -= atan(pose[TX] / pose[TZ]) * 180 / HT_PI; //pose[Pitch] -= atan(pose[TY] / pose[TZ]) * 180 / HT_PI; } -- cgit v1.2.3 From 4c0ecfa917bc0a26c29a6b33ad998e1711966107 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 26 Oct 2013 00:04:05 +0200 Subject: ar: gauss kernel 7 -> 5 (callgrind) Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 5de62176..ecfec7d3 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -200,7 +200,7 @@ void Tracker::run() continue; color_.copyTo(color); cv::cvtColor(color, grayscale2, cv::COLOR_BGR2GRAY); - const int kernel = grayscale2.cols > 480 ? 7 : 5; + const int kernel = grayscale2.cols > 480 ? 5 : 3; int kernel2 = kernel * grayscale2.rows / grayscale2.cols - 1; if ((kernel2 % 2) == 0) kernel2++; -- cgit v1.2.3 From 518a33b62dba0f068c34aef3dc52070e0867019a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 26 Oct 2013 01:37:47 +0200 Subject: ar: use pre-computed gaussian kernel for 20% speed increase Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index ecfec7d3..b532ac9c 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -193,18 +193,20 @@ void Tracker::run() int last_fps = 0; double error = 0; std::vector reprojection; - + auto kernel = cv::createGaussianFilter(CV_8U, cv::Size(5, 5), 0); while (!stop) { if (!camera.read(color_)) continue; color_.copyTo(color); cv::cvtColor(color, grayscale2, cv::COLOR_BGR2GRAY); - const int kernel = grayscale2.cols > 480 ? 5 : 3; - int kernel2 = kernel * grayscale2.rows / grayscale2.cols - 1; - if ((kernel2 % 2) == 0) - kernel2++; - cv::GaussianBlur(grayscale2, grayscale, cv::Size(kernel, kernel2), 0, 0); + if (grayscale.empty()) + grayscale = grayscale2.clone(); + + kernel->apply(grayscale2, grayscale); + + const int scale = frame.cols > 480 ? 2 : 1; + const float focal_length_w = 0.5 * grayscale.cols / tan(0.5 * fov * HT_PI / 180); const float focal_length_h = 0.5 * grayscale.rows / tan(0.5 * fov * grayscale.rows / grayscale.cols * HT_PI / 180.0); cv::Mat intrinsics = cv::Mat::eye(3, 3, CV_32FC1); @@ -225,7 +227,7 @@ void Tracker::run() if (markers.size() == 1 && markers[0].size() == 4) { const aruco::Marker& m = markers.at(0); for (int i = 0; i < 4; i++) - cv::line(color, m[i], m[(i+1)%4], cv::Scalar(0, 0, 255), 3); + cv::line(color, m[i], m[(i+1)%4], cv::Scalar(0, 0, 255), scale); } for (int i = 0; i < reprojection.size(); i++) @@ -251,11 +253,11 @@ void Tracker::run() char buf[128]; std::sprintf(buf, "Hz: %ld", last_fps); - cv::putText(frame, buf, cv::Point(10, 32), cv::FONT_HERSHEY_PLAIN, 2.0, cv::Scalar(0, 255, 0), 2); + cv::putText(frame, buf, cv::Point(10, 32), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(0, 255, 0), scale); std::sprintf(buf, "Delay: %ld ms", (long) (1000 * (time - prev_time) / freq)); - cv::putText(frame, buf, cv::Point(10, 54), cv::FONT_HERSHEY_PLAIN, 2.0, cv::Scalar(80, 255, 0), 2); + cv::putText(frame, buf, cv::Point(10, 54), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(80, 255, 0), scale); std::sprintf(buf, "Error: %f px", error); - cv::putText(frame, buf, cv::Point(10, 76), cv::FONT_HERSHEY_PLAIN, 2.0, cv::Scalar(80, 255, 0), 2); + cv::putText(frame, buf, cv::Point(10, 76), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(80, 255, 0), scale); prev_time = time; frame = color; -- cgit v1.2.3 From a2a32cda8e2ed8931a04a20d7422a45538c6c8b3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 26 Oct 2013 23:02:42 +0200 Subject: implement head centroid for aruco Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 217 ++++++++------------------ ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 84 ++++++---- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 2 +- 3 files changed, 124 insertions(+), 179 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index c007e93b..76d750af 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -32,154 +32,7 @@ -1 - - - - Distortion coefficients - - - - - - - - 0 - 0 - - - - true - - - QAbstractSpinBox::NoButtons - - - 11 - - - -1000.000000000000000 - - - 1000.000000000000000 - - - 0.000000000000000 - - - - - - - - 0 - 0 - - - - true - - - QAbstractSpinBox::NoButtons - - - 11 - - - -1000.000000000000000 - - - 1000.000000000000000 - - - 0.000000000000000 - - - - - - - - 0 - 0 - - - - true - - - QAbstractSpinBox::NoButtons - - - 11 - - - -1000.000000000000000 - - - 1000.000000000000000 - - - 0.000000000000000 - - - - - - - - 0 - 0 - - - - true - - - QAbstractSpinBox::NoButtons - - - 11 - - - -1000.000000000000000 - - - 1000.000000000000000 - - - 0.000000000000000 - - - - - - - - 0 - 0 - - - - true - - - QAbstractSpinBox::NoButtons - - - 11 - - - -1000.000000000000000 - - - 1000.000000000000000 - - - 0.000000000000000 - - - - + @@ -267,7 +120,7 @@ - + QDialogButtonBox::Cancel|QDialogButtonBox::Ok @@ -378,6 +231,72 @@ + + + + Head centroid position + + + Qt::AlignCenter + + + + Qt::AlignHCenter|Qt::AlignTop + + + + + TX + + + + + + + -200.000000000000000 + + + 200.000000000000000 + + + + + + + TY + + + + + + + -200.000000000000000 + + + 200.000000000000000 + + + + + + + TZ + + + + + + + -200.000000000000000 + + + 200.000000000000000 + + + + + + diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index b532ac9c..7ad80b46 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -120,8 +120,11 @@ void Tracker::load_settings() enableTX = iniFile.value("enable-tx", true).toBool(); enableTY = iniFile.value("enable-ty", true).toBool(); enableTZ = iniFile.value("enable-tz", true).toBool(); - for (int i = 0; i < 5; i++) - dc[i] = iniFile.value(QString("dc%1").arg(i), 0).toFloat(); + + for (int i = 0; i < 3; i++) + { + headpos[i] = iniFile.value(QString("headpos-%1").arg(i), 0).toDouble(); + } iniFile.endGroup(); } @@ -194,6 +197,7 @@ void Tracker::run() double error = 0; std::vector reprojection; auto kernel = cv::createGaussianFilter(CV_8U, cv::Size(5, 5), 0); + cv::Point2f last_centroid; while (!stop) { if (!camera.read(color_)) @@ -218,7 +222,7 @@ void Tracker::run() cv::Mat dist_coeffs = cv::Mat::zeros(5, 1, CV_32FC1); for (int i = 0; i < 5; i++) - dist_coeffs.at(i) = dc[i]; + dist_coeffs.at(i) = 0; std::vector< aruco::Marker > markers; @@ -239,6 +243,8 @@ void Tracker::run() 3); } + cv::circle(frame, last_centroid, 4, cv::Scalar(0, 0, 0), -1); + auto time = cv::getTickCount(); if ((long) (time / freq) != (long) (last_time / freq)) @@ -271,18 +277,18 @@ void Tracker::run() const float size = 7; cv::Mat obj_points(4,3,CV_32FC1); - obj_points.at(1,0)=-size; - obj_points.at(1,1)=-size; - obj_points.at(1,2)=0; - obj_points.at(2,0)=size; - obj_points.at(2,1)=-size; - obj_points.at(2,2)=0; - obj_points.at(3,0)=size; - obj_points.at(3,1)=size; - obj_points.at(3,2)=0; - obj_points.at(0,0)=-size; - obj_points.at(0,1)=size; - obj_points.at(0,2)=0; + obj_points.at(1,0)=-size + headpos[0]; + obj_points.at(1,1)=-size + headpos[1]; + obj_points.at(1,2)=0 + headpos[2]; + obj_points.at(2,0)=size + headpos[0]; + obj_points.at(2,1)=-size + headpos[1]; + obj_points.at(2,2)=0 + headpos[2]; + obj_points.at(3,0)=size + headpos[0]; + obj_points.at(3,1)=size + headpos[1]; + obj_points.at(3,2)=0 + headpos[2]; + obj_points.at(0,0)=-size + headpos[0]; + obj_points.at(0,1)=size + headpos[1]; + obj_points.at(0,2)=0 + headpos[2]; cv::solvePnP(obj_points, m, intrinsics, dist_coeffs, rvec, tvec, false, cv::ITERATIVE); @@ -315,6 +321,14 @@ void Tracker::run() error += std::sqrt(x * x + y * y); } + reprojection.clear(); + reprojection.resize(1); + std::vector centroid; + centroid.push_back(cv::Point3f(0, 0, 0)); + cv::projectPoints(centroid, rvec, tvec, intrinsics, dist_coeffs, reprojection); + + last_centroid = reprojection[0]; + //pose[Yaw] -= atan(pose[TX] / pose[TZ]) * 180 / HT_PI; //pose[Pitch] -= atan(pose[TY] / pose[TZ]) * 180 / HT_PI; } @@ -414,6 +428,9 @@ TrackerControls::TrackerControls() connect(ui.tx, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); connect(ui.ty, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); connect(ui.tz, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); + connect(ui.cx, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); + connect(ui.cy, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); + connect(ui.cz, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); //connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(doCancel())); //connect(ui.buttonOK, SIGNAL(clicked()), this, SLOT(doOK())); //connect(ui.buttonSettings, SIGNAL(clicked()), this, SLOT(cameraSettings())); @@ -474,13 +491,18 @@ void TrackerControls::loadSettings() ui.ty->setCheckState(iniFile.value("enable-ty", true).toBool() ? Qt::Checked : Qt::Unchecked); ui.tz->setCheckState(iniFile.value("enable-tz", true).toBool() ? Qt::Checked : Qt::Unchecked); ui.resolution->setCurrentIndex(iniFile.value("resolution", 0).toInt()); - - ui.doubleSpinBox->setValue(iniFile.value("dc0").toDouble()); - ui.doubleSpinBox_2->setValue(iniFile.value("dc1").toDouble()); - ui.doubleSpinBox_3->setValue(iniFile.value("dc2").toDouble()); - ui.doubleSpinBox_4->setValue(iniFile.value("dc3").toDouble()); - ui.doubleSpinBox_5->setValue(iniFile.value("dc4").toDouble()); - + + QDoubleSpinBox* headpos[] = { + ui.cx, + ui.cy, + ui.cz + }; + + for (int i = 0; i < 3; i++) + { + headpos[i]->setValue(iniFile.value(QString("headpos-%1").arg(i)).toDouble()); + } + iniFile.endGroup(); settingsDirty = false; } @@ -519,13 +541,17 @@ void TrackerControls::save() iniFile.setValue("enable-ty", ui.ty->checkState() != Qt::Unchecked ? true : false); iniFile.setValue("enable-tz", ui.tz->checkState() != Qt::Unchecked ? true : false); iniFile.setValue("resolution", ui.resolution->currentIndex()); - - iniFile.setValue("dc0", ui.doubleSpinBox->value()); - iniFile.setValue("dc1", ui.doubleSpinBox_2->value()); - iniFile.setValue("dc2", ui.doubleSpinBox_3->value()); - iniFile.setValue("dc3", ui.doubleSpinBox_4->value()); - iniFile.setValue("dc4", ui.doubleSpinBox_5->value()); - + + QDoubleSpinBox* headpos[] = { + ui.cx, + ui.cy, + ui.cz + }; + + for (int i = 0; i < 3; i++) + { + iniFile.setValue(QString("headpos-%1").arg(i), headpos[i]->value()); + } iniFile.endGroup(); settingsDirty = false; } diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 8d532b4c..5d3d4ed6 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -35,11 +35,11 @@ private: volatile bool stop; float fov; int camera_index; - float dc[5]; int force_fps, force_width, force_height; void load_settings(); double pose[6]; cv::Mat frame; + double headpos[3]; }; // Widget that has controls for FTNoIR protocol client-settings. -- cgit v1.2.3 From e5712bbc76b2f970169a7778edd0d8c9e84bae9e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 26 Oct 2013 23:25:39 +0200 Subject: aruco fix reprojection not showing Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 7ad80b46..1a638198 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -243,7 +243,7 @@ void Tracker::run() 3); } - cv::circle(frame, last_centroid, 4, cv::Scalar(0, 0, 0), -1); + cv::circle(frame, last_centroid, 7, cv::Scalar(255, 255, 0), -1); auto time = cv::getTickCount(); @@ -321,13 +321,12 @@ void Tracker::run() error += std::sqrt(x * x + y * y); } - reprojection.clear(); - reprojection.resize(1); + std::vector repr2; std::vector centroid; centroid.push_back(cv::Point3f(0, 0, 0)); - cv::projectPoints(centroid, rvec, tvec, intrinsics, dist_coeffs, reprojection); + cv::projectPoints(centroid, rvec, tvec, intrinsics, dist_coeffs, repr2); - last_centroid = reprojection[0]; + last_centroid = repr2[0]; //pose[Yaw] -= atan(pose[TX] / pose[TZ]) * 180 / HT_PI; //pose[Pitch] -= atan(pose[TY] / pose[TZ]) * 180 / HT_PI; -- cgit v1.2.3 From b327eb866272272f2669cca4ea78c4cb489f7298 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 26 Oct 2013 23:56:59 +0200 Subject: auto-reset camera on settings exit. avoid bugs in cv::videocapture Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 31 +++++++++++++++++++++------ ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 12 ++++++++--- 2 files changed, 34 insertions(+), 9 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 1a638198..d068564d 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #if defined(_WIN32) #include @@ -100,6 +101,7 @@ static resolution_tuple resolution_choices[] = { void Tracker::load_settings() { + QMutexLocker foo(&mtx); QSettings settings("opentrack"); QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); @@ -126,6 +128,8 @@ void Tracker::load_settings() headpos[i] = iniFile.value(QString("headpos-%1").arg(i), 0).toDouble(); } iniFile.endGroup(); + + reset = true; } Tracker::Tracker() @@ -149,6 +153,7 @@ Tracker::~Tracker() void Tracker::StartTracker(QFrame* videoframe) { + reset = false; videoframe->show(); videoWidget = new ArucoVideoWidget(videoframe); QHBoxLayout* layout = new QHBoxLayout(); @@ -169,26 +174,32 @@ void Tracker::StartTracker(QFrame* videoframe) void Tracker::run() { - cv::VideoCapture camera(camera_index); +start: + reset = false; + std::unique_ptr camera(new cv::VideoCapture(camera_index)); if (force_width) - camera.set(CV_CAP_PROP_FRAME_WIDTH, force_width); + camera->set(CV_CAP_PROP_FRAME_WIDTH, force_width); if (force_height) - camera.set(CV_CAP_PROP_FRAME_HEIGHT, force_height); + camera->set(CV_CAP_PROP_FRAME_HEIGHT, force_height); if (force_fps) - camera.set(CV_CAP_PROP_FPS, force_fps); + camera->set(CV_CAP_PROP_FPS, force_fps); aruco::MarkerDetector detector; detector.setDesiredSpeed(3); detector.setThresholdParams(11, 5); cv::Mat color, color_, grayscale, grayscale2, rvec, tvec; - if (!camera.isOpened()) + if (!camera->isOpened()) { fprintf(stderr, "aruco tracker: can't open camera\n"); return; } + while (!stop) + if(camera->read(color_)) + break; + auto freq = cv::getTickFrequency(); auto last_time = cv::getTickCount(); auto prev_time = last_time; @@ -200,7 +211,12 @@ void Tracker::run() cv::Point2f last_centroid; while (!stop) { - if (!camera.read(color_)) + if (reset) + { + camera.reset(nullptr); + goto start; + } + if (!camera->read(color_)) continue; color_.copyTo(color); cv::cvtColor(color, grayscale2, cv::COLOR_BGR2GRAY); @@ -416,6 +432,7 @@ extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDial TrackerControls::TrackerControls() { + tracker = nullptr; ui.setupUi(this); setAttribute(Qt::WA_NativeWindow, true); connect(ui.cameraName, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged(int))); @@ -553,6 +570,8 @@ void TrackerControls::save() } iniFile.endGroup(); settingsDirty = false; + if (tracker) + tracker->load_settings(); } void TrackerControls::doOK() diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 5d3d4ed6..61eec096 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -28,6 +28,7 @@ public: bool GiveHeadPoseData(double *data); bool enableTX, enableTY, enableTZ, enableRX, enableRY, enableRZ; void run(); + void load_settings(); private: QMutex mtx; ArucoVideoWidget* videoWidget; @@ -36,10 +37,10 @@ private: float fov; int camera_index; int force_fps, force_width, force_height; - void load_settings(); double pose[6]; cv::Mat frame; double headpos[3]; + volatile bool reset; }; // Widget that has controls for FTNoIR protocol client-settings. @@ -53,14 +54,19 @@ public: void showEvent (QShowEvent *); void Initialize(QWidget *); - void registerTracker(ITracker *) {} - void unRegisterTracker() {} + void registerTracker(ITracker * x) { + tracker = dynamic_cast(x); + } + void unRegisterTracker() { + tracker = nullptr; + } private: Ui::Form ui; void loadSettings(); void save(); bool settingsDirty; + Tracker* tracker; private slots: void doOK(); -- cgit v1.2.3 From aaed9e3cdc4f3e7bb2a6d9b039d05bf395e1e046 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 27 Oct 2013 03:12:48 +0100 Subject: aruco: detection time in jiffies, better thresholding Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index d068564d..b05e5b98 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -187,7 +187,9 @@ start: aruco::MarkerDetector detector; detector.setDesiredSpeed(3); - detector.setThresholdParams(11, 5); + detector.setMinMaxSize(0.06, 0.4); + detector.setThresholdParams(11, 7); + cv::Mat color, color_, grayscale, grayscale2, rvec, tvec; if (!camera->isOpened()) @@ -203,11 +205,12 @@ start: auto freq = cv::getTickFrequency(); auto last_time = cv::getTickCount(); auto prev_time = last_time; + double last_delay = -1; int fps = 0; int last_fps = 0; double error = 0; std::vector reprojection; - auto kernel = cv::createGaussianFilter(CV_8U, cv::Size(5, 5), 0); + auto kernel = cv::createGaussianFilter(CV_8U, cv::Size(3, 3), 0); cv::Point2f last_centroid; while (!stop) { @@ -218,6 +221,7 @@ start: } if (!camera->read(color_)) continue; + auto tm = cv::getTickCount(); color_.copyTo(color); cv::cvtColor(color, grayscale2, cv::COLOR_BGR2GRAY); if (grayscale.empty()) @@ -276,7 +280,7 @@ start: std::sprintf(buf, "Hz: %ld", last_fps); cv::putText(frame, buf, cv::Point(10, 32), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(0, 255, 0), scale); - std::sprintf(buf, "Delay: %ld ms", (long) (1000 * (time - prev_time) / freq)); + std::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); std::sprintf(buf, "Error: %f px", error); cv::putText(frame, buf, cv::Point(10, 76), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(80, 255, 0), scale); -- cgit v1.2.3 From 494514581de9ec415acc25ac6b03fc42801d79e8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 27 Oct 2013 08:09:06 +0100 Subject: aruco: get rid of blur for idempotence Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index b05e5b98..d5ed9071 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -190,7 +190,7 @@ start: detector.setMinMaxSize(0.06, 0.4); detector.setThresholdParams(11, 7); - cv::Mat color, color_, grayscale, grayscale2, rvec, tvec; + cv::Mat color, color_, grayscale, rvec, tvec; if (!camera->isOpened()) { @@ -210,7 +210,6 @@ start: int last_fps = 0; double error = 0; std::vector reprojection; - auto kernel = cv::createGaussianFilter(CV_8U, cv::Size(3, 3), 0); cv::Point2f last_centroid; while (!stop) { @@ -223,11 +222,7 @@ start: continue; auto tm = cv::getTickCount(); color_.copyTo(color); - cv::cvtColor(color, grayscale2, cv::COLOR_BGR2GRAY); - if (grayscale.empty()) - grayscale = grayscale2.clone(); - - kernel->apply(grayscale2, grayscale); + cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); const int scale = frame.cols > 480 ? 2 : 1; -- cgit v1.2.3 From fea2abeb7040bacdc90964e216e5170faeb8052d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 29 Oct 2013 00:46:12 +0100 Subject: fix build Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index d5ed9071..906e2654 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -19,9 +19,10 @@ #include #if defined(_WIN32) -#include +# define NO_DSHOW_STRSAFE +# include #else -#include +# include #endif // delicious copypasta @@ -273,11 +274,11 @@ start: char buf[128]; - std::sprintf(buf, "Hz: %ld", last_fps); + ::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); - std::sprintf(buf, "Jiffies: %ld", (long) (10000 * (time - tm) / freq)); + ::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); - std::sprintf(buf, "Error: %f px", error); + ::sprintf(buf, "Error: %f px", error); cv::putText(frame, buf, cv::Point(10, 76), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(80, 255, 0), scale); prev_time = time; -- cgit v1.2.3 From 9e145b2b92d0f2d8b76599608746bb377af6bd91 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 3 Nov 2013 16:25:28 +0100 Subject: implement ROI for speed Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 110 +++++++++++++++----------- 1 file changed, 63 insertions(+), 47 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 906e2654..a918d020 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -188,10 +188,13 @@ start: aruco::MarkerDetector detector; detector.setDesiredSpeed(3); - detector.setMinMaxSize(0.06, 0.4); - detector.setThresholdParams(11, 7); + detector.setThresholdParams(11, 6); + + cv::Rect last_roi(65535, 65535, 0, 0); cv::Mat color, color_, grayscale, rvec, tvec; + + const double stateful_coeff = 0.81; if (!camera->isOpened()) { @@ -205,12 +208,8 @@ start: auto freq = cv::getTickFrequency(); auto last_time = cv::getTickCount(); - auto prev_time = last_time; - double last_delay = -1; int fps = 0; int last_fps = 0; - double error = 0; - std::vector reprojection; cv::Point2f last_centroid; while (!stop) { @@ -241,25 +240,32 @@ start: dist_coeffs.at(i) = 0; std::vector< aruco::Marker > markers; - - detector.detect(grayscale, markers, cv::Mat(), cv::Mat(), -1, false); - - if (markers.size() == 1 && markers[0].size() == 4) { - const aruco::Marker& m = markers.at(0); + + if (last_roi.width > 0 && + (detector.detect(grayscale(last_roi), markers, cv::Mat(), cv::Mat(), -1, false), + markers.size() == 1 && markers[0].size() == 4)) + { + detector.setMinMaxSize(std::max(0.2, 0.08 * grayscale.cols / last_roi.width), + std::min(1.0, 0.39 * grayscale.cols / last_roi.width)); + auto& m = markers.at(0); for (int i = 0; i < 4; i++) - cv::line(color, m[i], m[(i+1)%4], cv::Scalar(0, 0, 255), scale); + { + auto& p = m.at(i); + p.x += last_roi.x; + p.y += last_roi.y; + } } - - for (int i = 0; i < reprojection.size(); i++) + else { - cv::circle(frame, - reprojection[i], - 6, - cv::Scalar(0, 255, 128), - 3); + detector.setMinMaxSize(0.09, 0.4); + detector.detect(grayscale, markers, cv::Mat(), cv::Mat(), -1, false); } - cv::circle(frame, last_centroid, 7, cv::Scalar(255, 255, 0), -1); + if (markers.size() == 1 && markers[0].size() == 4) { + const aruco::Marker& m = markers.at(0); + for (int i = 0; i < 4; i++) + cv::line(color, m[i], m[(i+1)%4], cv::Scalar(0, 0, 255), scale, 8); + } auto time = cv::getTickCount(); @@ -278,15 +284,8 @@ start: 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); - ::sprintf(buf, "Error: %f px", error); - cv::putText(frame, buf, cv::Point(10, 76), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(80, 255, 0), scale); - prev_time = time; frame = color; - if (frame.rows > 0) - { - videoWidget->update_image(frame.data, frame.cols, frame.rows); - } if (markers.size() == 1 && markers[0].size() == 4) { const aruco::Marker& m = markers.at(0); @@ -305,6 +304,29 @@ start: obj_points.at(0,0)=-size + headpos[0]; obj_points.at(0,1)=size + headpos[1]; obj_points.at(0,2)=0 + headpos[2]; + + last_roi = cv::Rect(65535, 65535, 0, 0); + + for (int i = 0; i < 4; i++) + { + auto foo = m.at(i); + last_roi.x = std::min(foo.x, last_roi.x); + last_roi.y = std::min(foo.y, last_roi.y); + last_roi.width = std::max(foo.x, last_roi.width); + last_roi.height = std::max(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(0, last_roi.x); + last_roi.y = std::max(0, last_roi.y); + last_roi.width = std::min(grayscale.cols - last_roi.x, last_roi.width); + last_roi.height = std::min(grayscale.rows - last_roi.y, last_roi.height); + } cv::solvePnP(obj_points, m, intrinsics, dist_coeffs, rvec, tvec, false, cv::ITERATIVE); @@ -316,25 +338,15 @@ start: cv::Vec3d foo = cv::RQDecomp3x3(rotation_matrix, junk1, junk2); - QMutexLocker lck(&mtx); - - for (int i = 0; i < 3; i++) - pose[i] = tvec.at(i); - - pose[Yaw] = foo[1]; - pose[Pitch] = -foo[0]; - pose[Roll] = foo[2]; + { + QMutexLocker lck(&mtx); - reprojection.clear(); - reprojection.resize(4); - cv::projectPoints(obj_points, rvec, tvec, intrinsics, dist_coeffs, reprojection); + for (int i = 0; i < 3; i++) + pose[i] = tvec.at(i); - error = 0; - for (int i = 0; i < 4; i++) - { - double x = reprojection[i].x - m[i].x; - double y = reprojection[i].y - m[i].y; - error += std::sqrt(x * x + y * y); + pose[Yaw] = foo[1]; + pose[Pitch] = -foo[0]; + pose[Roll] = foo[2]; } std::vector repr2; @@ -343,10 +355,14 @@ start: cv::projectPoints(centroid, rvec, tvec, intrinsics, dist_coeffs, repr2); last_centroid = repr2[0]; - - //pose[Yaw] -= atan(pose[TX] / pose[TZ]) * 180 / HT_PI; - //pose[Pitch] -= atan(pose[TY] / pose[TZ]) * 180 / HT_PI; } + else + { + last_roi = cv::Rect(65535, 65535, 0, 0); + } + + if (frame.rows > 0) + videoWidget->update_image(frame.data, frame.cols, frame.rows); } } -- cgit v1.2.3 From cc9b496e2de68b983dbc5fde27a1379cc9602a35 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 3 Nov 2013 17:16:46 +0100 Subject: appease -Wreorder Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ar_video_widget.h | 4 ++-- ftnoir_tracker_ht/ht_video_widget.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ar_video_widget.h b/ftnoir_tracker_aruco/ar_video_widget.h index d16cb017..e1c7cff8 100644 --- a/ftnoir_tracker_aruco/ar_video_widget.h +++ b/ftnoir_tracker_aruco/ar_video_widget.h @@ -8,7 +8,7 @@ #ifndef VIDEOWIDGET_H #define VIDEOWIDGET_H -#include +#include #include #include #include @@ -23,7 +23,7 @@ class ArucoVideoWidget : public QWidget Q_OBJECT public: - ArucoVideoWidget(QWidget *parent) : QWidget(parent), width(0), height(0), fb() { + ArucoVideoWidget(QWidget *parent) : QWidget(parent), fb(), width(0), height(0) { connect(&timer, SIGNAL(timeout()), this, SLOT(update_and_repaint())); timer.start(60); } diff --git a/ftnoir_tracker_ht/ht_video_widget.h b/ftnoir_tracker_ht/ht_video_widget.h index 33f21226..3fff395e 100644 --- a/ftnoir_tracker_ht/ht_video_widget.h +++ b/ftnoir_tracker_ht/ht_video_widget.h @@ -23,7 +23,7 @@ class HTVideoWidget : public QWidget Q_OBJECT public: - HTVideoWidget(QWidget *parent) : QWidget(parent), width(0), height(0), fb() { + HTVideoWidget(QWidget *parent) : QWidget(parent), fb(), width(0), height(0) { connect(&timer, SIGNAL(timeout()), this, SLOT(update_and_repaint())); timer.start(60); } -- cgit v1.2.3 From ee82f14d1f2bbdc8fd7c0898e0c47494e4e7362d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 7 Nov 2013 17:21:27 +0100 Subject: fix flicker, hopefully fix pitch Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ar_video_widget.cpp | 24 +++++++++++------------- ftnoir_tracker_aruco/ar_video_widget.h | 8 ++++---- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 6 +++--- 3 files changed, 18 insertions(+), 20 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ar_video_widget.cpp b/ftnoir_tracker_aruco/ar_video_widget.cpp index b727679b..149a19ee 100644 --- a/ftnoir_tracker_aruco/ar_video_widget.cpp +++ b/ftnoir_tracker_aruco/ar_video_widget.cpp @@ -11,31 +11,29 @@ using namespace std; -void ArucoVideoWidget::update_image(unsigned char *frame, int width, int height) +void ArucoVideoWidget::update_image(const cv::Mat& frame) { QMutexLocker foo(&mtx); - memcpy(fb, frame, width * height * 3); - this->width = width; - this->height = height; + _frame = frame; } void ArucoVideoWidget::update_and_repaint() { QMutexLocker foo(&mtx); - if (width*height <= 0) + if (_frame.cols*_frame.rows <= 0) return; - QImage qframe = QImage(width, height, QImage::Format_RGB888); + QImage qframe = QImage(_frame.cols, _frame.rows, QImage::Format_RGB888); uchar* data = qframe.bits(); const int pitch = qframe.bytesPerLine(); - for (int y = 0; y < height; y++) + for (int y = 0; y < _frame.rows; y++) { - const int part = y*width; - for (int x = 0; x < width; x++) + for (int x = 0; x < _frame.cols; x++) { - const int pos = 3 * (part + x); - data[y * pitch + x * 3 + 0] = fb[pos + 2]; - data[y * pitch + x * 3 + 1] = fb[pos + 1]; - data[y * pitch + x * 3 + 2] = fb[pos + 0]; + const auto& elt = _frame.at(y, x); + const CvScalar elt2 = 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]; } } auto qframe2 = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); diff --git a/ftnoir_tracker_aruco/ar_video_widget.h b/ftnoir_tracker_aruco/ar_video_widget.h index e1c7cff8..b95d1873 100644 --- a/ftnoir_tracker_aruco/ar_video_widget.h +++ b/ftnoir_tracker_aruco/ar_video_widget.h @@ -16,6 +16,7 @@ #include #include #include +#include // ---------------------------------------------------------------------------- class ArucoVideoWidget : public QWidget @@ -23,11 +24,11 @@ class ArucoVideoWidget : public QWidget Q_OBJECT public: - ArucoVideoWidget(QWidget *parent) : QWidget(parent), fb(), width(0), height(0) { + ArucoVideoWidget(QWidget *parent) : QWidget(parent) { connect(&timer, SIGNAL(timeout()), this, SLOT(update_and_repaint())); timer.start(60); } - void update_image(unsigned char* frame, int width, int height); + void update_image(const cv::Mat& frame); protected slots: void paintEvent( QPaintEvent* e ) { QMutexLocker foo(&mtx); @@ -40,8 +41,7 @@ private: QMutex mtx; QPixmap pixmap; QTimer timer; - char fb[2048*2048*3]; - int width,height; + cv::Mat _frame; }; #endif // VIDEOWIDGET_H diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index a918d020..e063be62 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -280,12 +280,12 @@ start: char buf[128]; + 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); ::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); - - frame = color; if (markers.size() == 1 && markers[0].size() == 4) { const aruco::Marker& m = markers.at(0); @@ -362,7 +362,7 @@ start: } if (frame.rows > 0) - videoWidget->update_image(frame.data, frame.cols, frame.rows); + videoWidget->update_image(frame); } } -- cgit v1.2.3 From e72d2694f613344022b1e548e5d5564d11833173 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 7 Nov 2013 22:57:11 +0100 Subject: fix build error on ocv 2.4 branch --- FTNoIR_Tracker_PT/pt_video_widget.cpp | 2 +- ftnoir_tracker_aruco/ar_video_widget.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/FTNoIR_Tracker_PT/pt_video_widget.cpp b/FTNoIR_Tracker_PT/pt_video_widget.cpp index 122ab4fd..c73fa780 100644 --- a/FTNoIR_Tracker_PT/pt_video_widget.cpp +++ b/FTNoIR_Tracker_PT/pt_video_widget.cpp @@ -51,7 +51,7 @@ void PTVideoWidget::update_and_repaint() for (int x = 0; x < _frame.cols; x++) { const auto& elt = _frame.at(y, x); - const CvScalar elt2 = elt; + const cv::Scalar elt2 = 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]; diff --git a/ftnoir_tracker_aruco/ar_video_widget.cpp b/ftnoir_tracker_aruco/ar_video_widget.cpp index 149a19ee..b0d78fe2 100644 --- a/ftnoir_tracker_aruco/ar_video_widget.cpp +++ b/ftnoir_tracker_aruco/ar_video_widget.cpp @@ -30,7 +30,7 @@ void ArucoVideoWidget::update_and_repaint() for (int x = 0; x < _frame.cols; x++) { const auto& elt = _frame.at(y, x); - const CvScalar elt2 = elt; + const cv::Scalar elt2 = 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]; -- cgit v1.2.3 From 4ac10163398f1cd402c7f8461ff478aadab5fe8e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 10 Nov 2013 16:05:50 +0100 Subject: aruco: explicitly release camera to aid macosx brain damage Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index e063be62..b1b58dec 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -364,6 +364,10 @@ start: if (frame.rows > 0) videoWidget->update_image(frame); } + + camera->release(); + camera.release(); + camera = nullptr; } bool Tracker::GiveHeadPoseData(double *data) -- cgit v1.2.3 From 30658e31df61825c862dc4b5400f9124dd3b6c2b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 10 Nov 2013 16:20:39 +0100 Subject: fix build Signed-off-by: Stanislaw Halik --- FTNoIR_Tracker_PT/pt_video_widget.cpp | 2 +- ftnoir_tracker_aruco/ar_video_widget.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/FTNoIR_Tracker_PT/pt_video_widget.cpp b/FTNoIR_Tracker_PT/pt_video_widget.cpp index c73fa780..d0fc8d42 100644 --- a/FTNoIR_Tracker_PT/pt_video_widget.cpp +++ b/FTNoIR_Tracker_PT/pt_video_widget.cpp @@ -51,7 +51,7 @@ void PTVideoWidget::update_and_repaint() for (int x = 0; x < _frame.cols; x++) { const auto& elt = _frame.at(y, x); - const cv::Scalar elt2 = elt; + const cv::Scalar elt2 = static_cast(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]; diff --git a/ftnoir_tracker_aruco/ar_video_widget.cpp b/ftnoir_tracker_aruco/ar_video_widget.cpp index b0d78fe2..645ea3a9 100644 --- a/ftnoir_tracker_aruco/ar_video_widget.cpp +++ b/ftnoir_tracker_aruco/ar_video_widget.cpp @@ -30,7 +30,7 @@ void ArucoVideoWidget::update_and_repaint() for (int x = 0; x < _frame.cols; x++) { const auto& elt = _frame.at(y, x); - const cv::Scalar elt2 = elt; + const cv::Scalar elt2 = static_cast(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]; -- cgit v1.2.3 From ffb0893dc2ccf937c8414f4df88426308c822324 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 10 Nov 2013 22:23:59 +0100 Subject: fix possible race Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ar_video_widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ar_video_widget.cpp b/ftnoir_tracker_aruco/ar_video_widget.cpp index 645ea3a9..c452a638 100644 --- a/ftnoir_tracker_aruco/ar_video_widget.cpp +++ b/ftnoir_tracker_aruco/ar_video_widget.cpp @@ -14,7 +14,7 @@ using namespace std; void ArucoVideoWidget::update_image(const cv::Mat& frame) { QMutexLocker foo(&mtx); - _frame = frame; + _frame = frame.clone(); } void ArucoVideoWidget::update_and_repaint() -- cgit v1.2.3 From 5ef8fc93c4aa76d10f70b3406262eb7177c7b106 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 10 Nov 2013 22:24:11 +0100 Subject: hopefully fix aruco Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index b1b58dec..ab27d7c6 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -144,6 +144,7 @@ Tracker::Tracker() Tracker::~Tracker() { + QMutexLocker foo(&mtx); stop = true; wait(); if (layout) @@ -364,10 +365,6 @@ start: if (frame.rows > 0) videoWidget->update_image(frame); } - - camera->release(); - camera.release(); - camera = nullptr; } bool Tracker::GiveHeadPoseData(double *data) -- cgit v1.2.3 From 1388eaa16c8717eb3cc5309bb49aee1c1ab860a1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 10 Nov 2013 22:24:21 +0100 Subject: make qthread protected Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 61eec096..9b9ff19d 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -18,7 +18,7 @@ #include #include -class Tracker : public QThread, public ITracker +class Tracker : protected QThread, public ITracker { Q_OBJECT public: -- cgit v1.2.3 From 3dbd4228b5823b72dd095ceaeada878a2b9a5dac Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 10 Nov 2013 22:49:36 +0100 Subject: hopefully fix macosx aruco freeze now Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index ab27d7c6..a4c521d0 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -135,9 +135,9 @@ void Tracker::load_settings() Tracker::Tracker() { + layout = nullptr; stop = false; videoWidget = NULL; - layout = NULL; enableRX = enableRY = enableRZ = enableTX = enableTY = enableTZ = true; load_settings(); } @@ -147,10 +147,10 @@ Tracker::~Tracker() QMutexLocker foo(&mtx); stop = true; wait(); - if (layout) - delete layout; if (videoWidget) delete videoWidget; + if(layout) + delete layout; } void Tracker::StartTracker(QFrame* videoframe) @@ -165,11 +165,11 @@ void Tracker::StartTracker(QFrame* videoframe) delete videoframe->layout(); videoframe->setLayout(layout); videoWidget->show(); - this->layout = layout; load_settings(); start(); for (int i = 0; i < 6; i++) pose[i] = 0; + this->layout = layout; } #define HT_PI 3.1415926535 -- cgit v1.2.3 From 8c762f5143efe2cc3437ae5b3d8d5159c6593957 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 22 Nov 2013 02:55:16 +0100 Subject: hopefully fix aruco crash on exit Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index a4c521d0..2fdd1014 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -178,14 +178,14 @@ void Tracker::run() { start: reset = false; - std::unique_ptr camera(new cv::VideoCapture(camera_index)); + cv::VideoCapture camera(camera_index); if (force_width) - camera->set(CV_CAP_PROP_FRAME_WIDTH, force_width); + camera.set(CV_CAP_PROP_FRAME_WIDTH, force_width); if (force_height) - camera->set(CV_CAP_PROP_FRAME_HEIGHT, force_height); + camera.set(CV_CAP_PROP_FRAME_HEIGHT, force_height); if (force_fps) - camera->set(CV_CAP_PROP_FPS, force_fps); + camera.set(CV_CAP_PROP_FPS, force_fps); aruco::MarkerDetector detector; detector.setDesiredSpeed(3); @@ -197,14 +197,14 @@ start: const double stateful_coeff = 0.81; - if (!camera->isOpened()) + if (!camera.isOpened()) { fprintf(stderr, "aruco tracker: can't open camera\n"); return; } while (!stop) - if(camera->read(color_)) + if(camera.read(color_)) break; auto freq = cv::getTickFrequency(); @@ -216,10 +216,9 @@ start: { if (reset) { - camera.reset(nullptr); goto start; } - if (!camera->read(color_)) + if (!camera.read(color_)) continue; auto tm = cv::getTickCount(); color_.copyTo(color); -- cgit v1.2.3 From e058bd379f452ba7ecce64625c4438279a668ba4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 23 Nov 2013 15:24:37 +0100 Subject: remove goto, hopefully fix osx Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 13 +++---------- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 1 - 2 files changed, 3 insertions(+), 11 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 2fdd1014..0d93dba5 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -129,8 +129,6 @@ void Tracker::load_settings() headpos[i] = iniFile.value(QString("headpos-%1").arg(i), 0).toDouble(); } iniFile.endGroup(); - - reset = true; } Tracker::Tracker() @@ -144,7 +142,6 @@ Tracker::Tracker() Tracker::~Tracker() { - QMutexLocker foo(&mtx); stop = true; wait(); if (videoWidget) @@ -155,7 +152,6 @@ Tracker::~Tracker() void Tracker::StartTracker(QFrame* videoframe) { - reset = false; videoframe->show(); videoWidget = new ArucoVideoWidget(videoframe); QHBoxLayout* layout = new QHBoxLayout(); @@ -176,8 +172,6 @@ void Tracker::StartTracker(QFrame* videoframe) void Tracker::run() { -start: - reset = false; cv::VideoCapture camera(camera_index); if (force_width) @@ -214,10 +208,6 @@ start: cv::Point2f last_centroid; while (!stop) { - if (reset) - { - goto start; - } if (!camera.read(color_)) continue; auto tm = cv::getTickCount(); @@ -364,6 +354,9 @@ start: if (frame.rows > 0) videoWidget->update_image(frame); } + qDebug() << "releasing camera, brace for impact"; + camera.release(); + qDebug() << "all done!"; } bool Tracker::GiveHeadPoseData(double *data) diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 9b9ff19d..097c91e1 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -40,7 +40,6 @@ private: double pose[6]; cv::Mat frame; double headpos[3]; - volatile bool reset; }; // Widget that has controls for FTNoIR protocol client-settings. -- cgit v1.2.3 From 6cd2332a806013108322776d696fe34429dcd815 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 24 Nov 2013 06:54:00 +0100 Subject: fix osx brain damage by moving camera close to gui thread --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 9 ++++----- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 0d93dba5..41bf0edd 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -148,6 +148,9 @@ Tracker::~Tracker() delete videoWidget; if(layout) delete layout; + qDebug() << "releasing camera, brace for impact"; + camera.release(); + qDebug() << "all done!"; } void Tracker::StartTracker(QFrame* videoframe) @@ -172,8 +175,7 @@ void Tracker::StartTracker(QFrame* videoframe) void Tracker::run() { - cv::VideoCapture camera(camera_index); - + camera = cv::VideoCapture(camera_index); if (force_width) camera.set(CV_CAP_PROP_FRAME_WIDTH, force_width); if (force_height) @@ -354,9 +356,6 @@ void Tracker::run() if (frame.rows > 0) videoWidget->update_image(frame); } - qDebug() << "releasing camera, brace for impact"; - camera.release(); - qDebug() << "all done!"; } bool Tracker::GiveHeadPoseData(double *data) diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 097c91e1..3a2ebeea 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -17,6 +17,7 @@ #include #include #include +#include class Tracker : protected QThread, public ITracker { @@ -40,6 +41,7 @@ private: double pose[6]; cv::Mat frame; double headpos[3]; + cv::VideoCapture camera; }; // Widget that has controls for FTNoIR protocol client-settings. -- cgit v1.2.3 From 58989d52c2c0650611d26ab223ccd43f4891bb41 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 29 Nov 2013 10:07:56 +0100 Subject: Implement Aruco pitch change --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 28 ++++++++++++++++++++++++- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 30 ++++++++++++++++++++++----- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 2 +- 3 files changed, 53 insertions(+), 7 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 76d750af..8cf28057 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -10,7 +10,7 @@ 0 0 704 - 273 + 308 @@ -294,6 +294,32 @@ + + + + Pitch + + + + + + + ° + + + 2 + + + -60.000000000000000 + + + 60.000000000000000 + + + 0.000000000000000 + + + diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 41bf0edd..ddbdadb0 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -128,6 +128,8 @@ void Tracker::load_settings() { headpos[i] = iniFile.value(QString("headpos-%1").arg(i), 0).toDouble(); } + headpitch = iniFile.value("pitch", 0).toDouble(); + iniFile.endGroup(); } @@ -328,17 +330,27 @@ void Tracker::run() cv::Rodrigues(rvec, rotation_matrix); - cv::Vec3d foo = cv::RQDecomp3x3(rotation_matrix, junk1, junk2); - { + const double beta = headpitch * M_PI / 180; + double pitch[] = { + 1, 0, 0, + 0, cos(beta), -sin(beta), + 0, sin(beta), cos(beta) + }; + cv::Mat rot(3, 3, CV_64F, pitch); + tvec = rot * tvec; + rotation_matrix = rot * rotation_matrix; + + cv::Vec3d euler = cv::RQDecomp3x3(rotation_matrix, junk1, junk2); + QMutexLocker lck(&mtx); for (int i = 0; i < 3; i++) pose[i] = tvec.at(i); - pose[Yaw] = foo[1]; - pose[Pitch] = -foo[0]; - pose[Roll] = foo[2]; + pose[Yaw] = euler[1]; + pose[Pitch] = -euler[0]; + pose[Roll] = euler[2]; } std::vector repr2; @@ -346,6 +358,11 @@ void Tracker::run() 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); + } + last_centroid = repr2[0]; } else @@ -527,6 +544,8 @@ void TrackerControls::loadSettings() headpos[i]->setValue(iniFile.value(QString("headpos-%1").arg(i)).toDouble()); } + ui.pitch_deg->setValue(iniFile.value("pitch", 0).toDouble()); + iniFile.endGroup(); settingsDirty = false; } @@ -565,6 +584,7 @@ void TrackerControls::save() iniFile.setValue("enable-ty", ui.ty->checkState() != Qt::Unchecked ? true : false); iniFile.setValue("enable-tz", ui.tz->checkState() != Qt::Unchecked ? true : false); iniFile.setValue("resolution", ui.resolution->currentIndex()); + iniFile.setValue("pitch", ui.pitch_deg->value()); QDoubleSpinBox* headpos[] = { ui.cx, diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 3a2ebeea..1518ba4d 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -40,7 +40,7 @@ private: int force_fps, force_width, force_height; double pose[6]; cv::Mat frame; - double headpos[3]; + double headpos[3], headpitch; cv::VideoCapture camera; }; -- cgit v1.2.3 From c13e38e03b987fa2b46b6edb0ae5c56ba5e4e180 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 29 Nov 2013 10:09:48 +0100 Subject: Fix build --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index ddbdadb0..218f2d30 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -331,7 +331,7 @@ void Tracker::run() cv::Rodrigues(rvec, rotation_matrix); { - const double beta = headpitch * M_PI / 180; + const double beta = headpitch * HT_PI / 180; double pitch[] = { 1, 0, 0, 0, cos(beta), -sin(beta), -- cgit v1.2.3 From d7e7760a822e62d3f03f51c7b853ad27a998346b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 1 Dec 2013 04:55:07 +0100 Subject: fix typo Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 218f2d30..7581b77a 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -338,7 +338,7 @@ void Tracker::run() 0, sin(beta), cos(beta) }; cv::Mat rot(3, 3, CV_64F, pitch); - tvec = rot * tvec; + cv::Mat tvec2 = rot * tvec; rotation_matrix = rot * rotation_matrix; cv::Vec3d euler = cv::RQDecomp3x3(rotation_matrix, junk1, junk2); @@ -346,7 +346,7 @@ void Tracker::run() QMutexLocker lck(&mtx); for (int i = 0; i < 3; i++) - pose[i] = tvec.at(i); + pose[i] = tvec2.at(i); pose[Yaw] = euler[1]; pose[Pitch] = -euler[0]; -- cgit v1.2.3 From 49b2ac5b1c96e47636664439ab260f1ea4239be1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 1 Dec 2013 12:38:59 +0100 Subject: ui: fix tab order Signed-off-by: Stanislaw Halik --- facetracknoir/ftnoir_curves.ui | 23 +- facetracknoir/ftnoir_keyboardshortcuts.ui | 448 ++++++++++----------- .../ftnoir_accela_filtercontrols.ui | 16 + ftnoir_tracker_aruco/aruco-trackercontrols.ui | 415 ++++++++++--------- 4 files changed, 465 insertions(+), 437 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/facetracknoir/ftnoir_curves.ui b/facetracknoir/ftnoir_curves.ui index 2b843303..213e8f9a 100644 --- a/facetracknoir/ftnoir_curves.ui +++ b/facetracknoir/ftnoir_curves.ui @@ -29,8 +29,8 @@ background-color: #ccc; - - + + background-color: #ccc; @@ -763,7 +763,7 @@ - + QDialogButtonBox::Cancel|QDialogButtonBox::Ok @@ -779,6 +779,23 @@
qfunctionconfigurator.h
+ + pos_rx + pos_ry + pos_rz + pos_tx + pos_ty + pos_tz + checkBox + tz_altp + ty_altp + tabWidget + ry_altp + buttonBox + rz_altp + rx_altp + tx_altp + diff --git a/facetracknoir/ftnoir_keyboardshortcuts.ui b/facetracknoir/ftnoir_keyboardshortcuts.ui index a189b680..565c0e77 100644 --- a/facetracknoir/ftnoir_keyboardshortcuts.ui +++ b/facetracknoir/ftnoir_keyboardshortcuts.ui @@ -29,241 +29,219 @@ false - - - - 120 - 90 - 100 - 23 - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - Cancel - - - - - - 230 - 90 - 100 - 23 - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 100 - 16777215 - - - - OK - - - - - - 5 - 0 - 321 - 75 - - - - - - - - 0 - 0 - - - - Keyboard - - - Qt::AlignCenter - - - false - - - - - - - - 0 - 0 - - - - Center - - - false - - - - - - - - 50 - 16777215 - - - - Shift - - - - - - - - 50 - 16777215 - - - - Ctrl - - - - - - - - 50 - 16777215 - - - - Alt - - - - - - - - 90 - 0 - - - - Select Number - - - QComboBox::InsertAlphabetically - - - - - - - - 0 - 0 - - - - Toggle - - - false - - - - - - - - 50 - 16777215 - - - - Shift - - - - - - - - 50 - 16777215 - - - - Ctrl - - - - - - - - 50 - 16777215 - - - - Alt - - - - - - - - 90 - 0 - - - - Select Number - - - QComboBox::InsertAlphabetically - - - - - + + + + + + 0 + 0 + + + + Keyboard + + + Qt::AlignCenter + + + false + + + + + + + + 0 + 0 + + + + Center + + + false + + + + + + + + 50 + 16777215 + + + + Shift + + + + + + + + 50 + 16777215 + + + + Ctrl + + + + + + + + 50 + 16777215 + + + + Alt + + + + + + + + 90 + 0 + + + + Select Number + + + QComboBox::InsertAlphabetically + + + + + + + + 0 + 0 + + + + Toggle + + + false + + + + + + + + 50 + 16777215 + + + + Shift + + + + + + + + 50 + 16777215 + + + + Ctrl + + + + + + + + 50 + 16777215 + + + + Alt + + + + + + + + 90 + 0 + + + + Select Number + + + QComboBox::InsertAlphabetically + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + Cancel + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + OK + + + +
diff --git a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui index b4b12061..536cf328 100644 --- a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui +++ b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui @@ -715,6 +715,22 @@ background:none;
+ + rotation_alpha + translation_alpha + order_2nd + order_3rd + spinZoom + deadzone + expt + doubleSpinBox + doubleSpinBox_2 + doubleSpinBox_3 + doubleSpinBox_4 + doubleSpinBox_5 + doubleSpinBox_6 + buttonBox + diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 8cf28057..d4b64c23 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -32,205 +32,6 @@ -1 - - - - - 0 - 0 - - - - <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> - - - Qt::RichText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - 4 - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - Default - - - - - 30 - - - - - 60 - - - - - 120 - - - - - - - - Camera name - - - - - - - - - - - - - 35.000000000000000 - - - 180.000000000000000 - - - 52.000000000000000 - - - - - - - Frames per second - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - Horizontal FOV - - - - - - - Resolution - - - - - - - - 640x480 - - - - - 320x240 - - - - - 320x200 - - - - - Default (not recommended!) - - - - - - - - Enable axes - - - - -1 - - - 6 - - - 0 - - - 6 - - - 0 - - - - - RX - - - - - - - TX - - - - - - - RY - - - - - - - TY - - - - - - - RZ - - - - - - - TZ - - - - - - @@ -323,8 +124,224 @@ + + + + Enable axes + + + + -1 + + + 6 + + + 0 + + + 6 + + + 0 + + + + + RX + + + + + + + TX + + + + + + + RY + + + + + + + TY + + + + + + + RZ + + + + + + + TZ + + + + + + + + + + Resolution + + + + + + + + Default + + + + + 30 + + + + + 60 + + + + + 120 + + + + + + + + Frames per second + + + + + + + + 640x480 + + + + + 320x240 + + + + + 320x200 + + + + + Default (not recommended!) + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + 0 + 0 + + + + <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> + + + Qt::RichText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + 4 + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + 35.000000000000000 + + + 180.000000000000000 + + + 52.000000000000000 + + + + + + + Camera name + + + + + + + Horizontal FOV + + + + + cameraFOV + cameraFPS + cameraName + resolution + cx + cy + cz + pitch_deg + rx + ry + rz + tx + ty + tz + buttonBox + -- cgit v1.2.3 From 79119a08157aa954b3b2ecd18c8384b80a03970f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 4 Dec 2013 18:46:27 +0100 Subject: draw images directly, without pixmaps --- FTNoIR_Tracker_PT/pt_video_widget.cpp | 2 +- FTNoIR_Tracker_PT/pt_video_widget.h | 4 ++-- ftnoir_posewidget/glwidget.cpp | 4 ++-- ftnoir_posewidget/glwidget.h | 2 +- ftnoir_tracker_aruco/ar_video_widget.cpp | 2 +- ftnoir_tracker_aruco/ar_video_widget.h | 4 ++-- ftnoir_tracker_ht/ht_video_widget.cpp | 2 +- ftnoir_tracker_ht/ht_video_widget.h | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/FTNoIR_Tracker_PT/pt_video_widget.cpp b/FTNoIR_Tracker_PT/pt_video_widget.cpp index d0fc8d42..5ac002f4 100644 --- a/FTNoIR_Tracker_PT/pt_video_widget.cpp +++ b/FTNoIR_Tracker_PT/pt_video_widget.cpp @@ -57,6 +57,6 @@ void PTVideoWidget::update_and_repaint() data[y * pitch + x * 3 + 2] = elt2.val[0]; } qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); - pixmap = QPixmap::fromImage(qframe); + texture = qframe; update(); } diff --git a/FTNoIR_Tracker_PT/pt_video_widget.h b/FTNoIR_Tracker_PT/pt_video_widget.h index f5663e47..acff43fb 100644 --- a/FTNoIR_Tracker_PT/pt_video_widget.h +++ b/FTNoIR_Tracker_PT/pt_video_widget.h @@ -40,12 +40,12 @@ protected slots: void paintEvent( QPaintEvent* e ) { QMutexLocker foo(&mtx); QPainter painter(this); - painter.drawPixmap(e->rect(), pixmap, e->rect()); + painter.drawImage(e->rect(), texture); } void update_and_repaint(); private: QMutex mtx; - QPixmap pixmap; + QImage texture; QTimer timer; cv::Mat _frame; }; diff --git a/ftnoir_posewidget/glwidget.cpp b/ftnoir_posewidget/glwidget.cpp index 71af8a08..93c98c9c 100644 --- a/ftnoir_posewidget/glwidget.cpp +++ b/ftnoir_posewidget/glwidget.cpp @@ -26,7 +26,7 @@ void GLWidget::paintEvent ( QPaintEvent * event ) { QWidget::paintEvent(event); QPainter p(this); project_quad_texture(); - p.drawPixmap(event->rect(), pixmap, event->rect()); + p.drawImage(event->rect(), texture); } void GLWidget::rotateBy(double xAngle, double yAngle, double zAngle) @@ -226,5 +226,5 @@ void GLWidget::project_quad_texture() { } } } - pixmap = QPixmap::fromImage(texture); + this->texture = texture; } diff --git a/ftnoir_posewidget/glwidget.h b/ftnoir_posewidget/glwidget.h index 0bb693c8..c4b2e09d 100644 --- a/ftnoir_posewidget/glwidget.h +++ b/ftnoir_posewidget/glwidget.h @@ -91,7 +91,7 @@ private: double matrix[9]; QImage front; QImage back; - QPixmap pixmap; + QImage texture; }; #endif diff --git a/ftnoir_tracker_aruco/ar_video_widget.cpp b/ftnoir_tracker_aruco/ar_video_widget.cpp index c452a638..9a089213 100644 --- a/ftnoir_tracker_aruco/ar_video_widget.cpp +++ b/ftnoir_tracker_aruco/ar_video_widget.cpp @@ -37,6 +37,6 @@ void ArucoVideoWidget::update_and_repaint() } } auto qframe2 = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); - pixmap = QPixmap::fromImage(qframe2); + texture = qframe2; update(); } diff --git a/ftnoir_tracker_aruco/ar_video_widget.h b/ftnoir_tracker_aruco/ar_video_widget.h index b95d1873..e2cf4d9f 100644 --- a/ftnoir_tracker_aruco/ar_video_widget.h +++ b/ftnoir_tracker_aruco/ar_video_widget.h @@ -33,13 +33,13 @@ protected slots: void paintEvent( QPaintEvent* e ) { QMutexLocker foo(&mtx); QPainter painter(this); - painter.drawPixmap(e->rect(), pixmap, e->rect()); + painter.drawImage(e->rect(), texture); } void update_and_repaint(); private: QMutex mtx; - QPixmap pixmap; + QImage texture; QTimer timer; cv::Mat _frame; }; diff --git a/ftnoir_tracker_ht/ht_video_widget.cpp b/ftnoir_tracker_ht/ht_video_widget.cpp index 8ccec997..c6d59b34 100644 --- a/ftnoir_tracker_ht/ht_video_widget.cpp +++ b/ftnoir_tracker_ht/ht_video_widget.cpp @@ -39,6 +39,6 @@ void HTVideoWidget::update_and_repaint() } } auto qframe2 = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); - pixmap = QPixmap::fromImage(qframe2); + texture = qframe2; update(); } diff --git a/ftnoir_tracker_ht/ht_video_widget.h b/ftnoir_tracker_ht/ht_video_widget.h index 3fff395e..cbfe6ddc 100644 --- a/ftnoir_tracker_ht/ht_video_widget.h +++ b/ftnoir_tracker_ht/ht_video_widget.h @@ -32,13 +32,13 @@ protected slots: void paintEvent( QPaintEvent* e ) { QMutexLocker foo(&mtx); QPainter painter(this); - painter.drawPixmap(e->rect(), pixmap, e->rect()); + painter.drawImage(e->rect(), texture); } void update_and_repaint(); private: QMutex mtx; - QPixmap pixmap; + QImage texture; QTimer timer; char fb[2048*2048*3]; int width,height; -- cgit v1.2.3 From c298ec1126f1ec8fbf01e5619c5a4b0a30a222c2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 10 Dec 2013 03:52:19 +0100 Subject: remove return value from GiveHeadPoseData --- FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp | 8 +++++--- FTNoIR_Tracker_PT/ftnoir_tracker_pt.h | 2 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 +--- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 2 +- ftnoir_tracker_base/ftnoir_tracker_base.h | 2 +- ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp | 7 ++----- ftnoir_tracker_hatire/ftnoir_tracker_hat.h | 2 +- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 7 +------ ftnoir_tracker_ht/ftnoir_tracker_ht.h | 2 +- ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp | 4 +--- ftnoir_tracker_hydra/ftnoir_tracker_hydra.h | 2 +- ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 10 ++++------ ftnoir_tracker_joystick/ftnoir_tracker_joystick.h | 2 +- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 3 +-- ftnoir_tracker_rift/ftnoir_tracker_rift.h | 2 +- ftnoir_tracker_udp/ftnoir_tracker_udp.cpp | 3 +-- ftnoir_tracker_udp/ftnoir_tracker_udp.h | 2 +- opentrack-api/opentrack.h | 2 +- opentrack-api/trackers.cpp | 5 ++--- 19 files changed, 28 insertions(+), 43 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp index 5cb7bdf3..a6aaa29c 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp @@ -233,12 +233,12 @@ void Tracker::StopTracker(bool exit) #define THeadPoseData double #endif -bool Tracker::GiveHeadPoseData(THeadPoseData *data) +void Tracker::GiveHeadPoseData(THeadPoseData *data) { { QMutexLocker lock(&mutex); - if (!tracking_valid) return false; + if (!tracking_valid) return; FrameTrafo X_CM = point_tracker.get_pose(); FrameTrafo X_MH(Matx33f::eye(), t_MH); @@ -280,7 +280,9 @@ bool Tracker::GiveHeadPoseData(THeadPoseData *data) if (bEnableRoll) data[Roll] = rad2deg * gamma; #endif } - return true; +#ifndef OPENTRACK_API + return true; +#endif } //----------------------------------------------------------------------------- diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h index 64f282b6..5c8d35d2 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h @@ -44,7 +44,7 @@ public: virtual void Initialize(QFrame *videoframe); #ifdef OPENTRACK_API virtual void StartTracker(QFrame* parent_window); - virtual bool GiveHeadPoseData(double* data); + virtual void GiveHeadPoseData(double* data); #else virtual void StartTracker(HWND parent_window); virtual void StopTracker(bool exit); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 7581b77a..11916df5 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -375,7 +375,7 @@ void Tracker::run() } } -bool Tracker::GiveHeadPoseData(double *data) +void Tracker::GiveHeadPoseData(double *data) { QMutexLocker lck(&mtx); @@ -391,8 +391,6 @@ bool Tracker::GiveHeadPoseData(double *data) data[TY] = pose[TY]; if (enableTZ) data[TZ] = pose[TZ]; - - return true; } class TrackerDll : public Metadata diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 1518ba4d..8a480d9f 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -26,7 +26,7 @@ public: Tracker(); virtual ~Tracker(); void StartTracker(QFrame* frame); - bool GiveHeadPoseData(double *data); + void GiveHeadPoseData(double *data); bool enableTX, enableTY, enableTZ, enableRX, enableRY, enableRZ; void run(); void load_settings(); diff --git a/ftnoir_tracker_base/ftnoir_tracker_base.h b/ftnoir_tracker_base/ftnoir_tracker_base.h index 38c24afe..e6e770ed 100644 --- a/ftnoir_tracker_base/ftnoir_tracker_base.h +++ b/ftnoir_tracker_base/ftnoir_tracker_base.h @@ -43,7 +43,7 @@ struct ITracker { virtual ~ITracker() = 0; virtual void StartTracker( QFrame* frame ) = 0; - virtual bool GiveHeadPoseData(double *data) = 0; + virtual void GiveHeadPoseData(double *data) = 0; virtual int preferredHz() { return 66; } }; diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp index b933dd14..bcef6753 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp @@ -323,7 +323,7 @@ void FTNoIR_Tracker::StartTracker(QFrame*) #define THeadPoseData double #endif -bool FTNoIR_Tracker::GiveHeadPoseData(THeadPoseData *data) +void FTNoIR_Tracker::GiveHeadPoseData(THeadPoseData *data) { QMutexLocker lck(&mutex); while (dataRead.length()>=30) { @@ -354,7 +354,7 @@ bool FTNoIR_Tracker::GiveHeadPoseData(THeadPoseData *data) if (CptError>50) { emit sendMsgInfo("Can't find HAT frame") ; CptError=0; - return false; + return; } #ifdef OPENTRACK_API data[frame_cnt] = (long) HAT.Code; @@ -425,9 +425,6 @@ bool FTNoIR_Tracker::GiveHeadPoseData(THeadPoseData *data) // For debug //data->x=dataRead.length(); //data->y=CptError; - - return true; - } diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h index a1b4ecda..04c5fb61 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h @@ -29,7 +29,7 @@ public: #ifdef OPENTRACK_API virtual void StartTracker(QFrame*); - virtual bool GiveHeadPoseData(double* data); + virtual void GiveHeadPoseData(double* data); #else void Initialize( QFrame *videoframe ); virtual void StartTracker(HWND parent_window); diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index c08af00b..c3c12005 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -186,10 +186,8 @@ void Tracker::StartTracker(QFrame* videoframe) #endif } -bool Tracker::GiveHeadPoseData(double *data) +void Tracker::GiveHeadPoseData(double *data) { - bool ret = false; - lck_shm.lock(); shm->timer = 0; if (shm->frame.width > 0) @@ -213,7 +211,6 @@ bool Tracker::GiveHeadPoseData(double *data) data[TY] = shm->result.ty; if (enableTZ) data[TZ] = shm->result.tz; - ret = true; if (fabs(data[Yaw]) > 60 || fabs(data[Pitch]) > 50 || fabs(data[Roll]) > 40) { shm->pause = true; @@ -222,8 +219,6 @@ bool Tracker::GiveHeadPoseData(double *data) shm->pause = false; } lck_shm.unlock(); - - return ret; } //----------------------------------------------------------------------------- diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h index c19e2d93..475d5a6c 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h @@ -23,7 +23,7 @@ public: Tracker(); virtual ~Tracker(); void StartTracker(QFrame* frame); - bool GiveHeadPoseData(double *data); + void GiveHeadPoseData(double *data); bool enableTX, enableTY, enableTZ, enableRX, enableRY, enableRZ; ht_shm_t* shm; private: diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp index 86ca8888..11a3e0fb 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp @@ -66,7 +66,7 @@ void Hydra_Tracker::StartTracker(QFrame*) } -bool Hydra_Tracker::GiveHeadPoseData(double *data) +void Hydra_Tracker::GiveHeadPoseData(double *data) { sixenseSetActiveBase(0); @@ -109,8 +109,6 @@ bool Hydra_Tracker::GiveHeadPoseData(double *data) if (bEnableRoll) { data[Roll] = newHeadPose[Roll] * 57.295781f; } - - return true; } diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h index 3daaf239..6e40b710 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h @@ -12,7 +12,7 @@ public: ~Hydra_Tracker(); void StartTracker(QFrame *) virt_override; - bool GiveHeadPoseData(double *data) virt_override; + void GiveHeadPoseData(double *data) virt_override; void loadSettings(); volatile bool should_quit; protected: diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index 66138e90..8f5ac162 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -175,13 +175,13 @@ fail: qDebug() << "joy init failure"; } -bool FTNoIR_Tracker::GiveHeadPoseData(double *data) +void FTNoIR_Tracker::GiveHeadPoseData(double *data) { QMutexLocker foo(&mtx); DIJOYSTATE js = {0}; if( !g_pDI || !g_pJoystick) - return false; + return; auto hr = g_pJoystick->Poll(); if( FAILED( hr )) @@ -190,11 +190,11 @@ bool FTNoIR_Tracker::GiveHeadPoseData(double *data) for (int i = 0; hr == DIERR_INPUTLOST && i < 200; i++) hr = g_pJoystick->Acquire(); if (hr != DI_OK) - return false; + return; } if( FAILED( hr = g_pJoystick->GetDeviceState( sizeof( js ), &js ) ) ) - return false; + return; const LONG values[] = { js.lRx, @@ -232,8 +232,6 @@ bool FTNoIR_Tracker::GiveHeadPoseData(double *data) data[i] = val * limits[i] / (double) (val >= 0 ? max : min); } } - - return true; } void FTNoIR_Tracker::loadSettings() { diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h index cdf4fc7b..809d8c73 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h @@ -42,7 +42,7 @@ public: ~FTNoIR_Tracker(); void StartTracker(QFrame *frame); - bool GiveHeadPoseData(double *data); + void GiveHeadPoseData(double *data); void loadSettings(); LPDIRECTINPUT8 g_pDI; LPDIRECTINPUTDEVICE8 g_pJoystick; diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index 4816cea4..c3b313ca 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -68,7 +68,7 @@ void Rift_Tracker::StartTracker(QFrame*) } -bool Rift_Tracker::GiveHeadPoseData(double *data) +void Rift_Tracker::GiveHeadPoseData(double *data) { if (pSFusion != NULL && pSensor != NULL) { Quatf hmdOrient = pSFusion->GetOrientation(); @@ -113,7 +113,6 @@ bool Rift_Tracker::GiveHeadPoseData(double *data) data[Roll] = newHeadPose[Roll] * 57.295781f; } } - return pSensor != NULL; } diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index 7a4533d3..33e6f5cd 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -15,7 +15,7 @@ public: virtual ~Rift_Tracker() virt_override; void StartTracker(QFrame *) virt_override; - bool GiveHeadPoseData(double *data) virt_override; + void GiveHeadPoseData(double *data) virt_override; void loadSettings(); virtual int preferredHz() virt_override { return 250; } volatile bool should_quit; diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp index 1539707e..d58341a6 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp @@ -110,7 +110,7 @@ void FTNoIR_Tracker::StartTracker(QFrame*) return; } -bool FTNoIR_Tracker::GiveHeadPoseData(double *data) +void FTNoIR_Tracker::GiveHeadPoseData(double *data) { mutex.lock(); if (bEnableX) { @@ -132,7 +132,6 @@ bool FTNoIR_Tracker::GiveHeadPoseData(double *data) data[Roll] = newHeadPose[Roll]; } mutex.unlock(); - return true; } // diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.h b/ftnoir_tracker_udp/ftnoir_tracker_udp.h index d158630b..7b6c5328 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.h +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.h @@ -16,7 +16,7 @@ public: ~FTNoIR_Tracker(); void StartTracker(QFrame *); - bool GiveHeadPoseData(double *data); + void GiveHeadPoseData(double *data); void loadSettings(); volatile bool should_quit; protected: diff --git a/opentrack-api/opentrack.h b/opentrack-api/opentrack.h index 990b6aa4..88ba6cf0 100644 --- a/opentrack-api/opentrack.h +++ b/opentrack-api/opentrack.h @@ -50,7 +50,7 @@ OPENTRACK_EXPORT const char** opentrack_enum_trackers(opentrack self); */ 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 int opentrack_tracker_tick(opentrack_tracker tracker, double* headpose); +OPENTRACK_EXPORT void opentrack_tracker_tick(opentrack_tracker tracker, double* headpose); OPENTRACK_EXPORT void opentrack_finalize_tracker(opentrack_tracker tracker); #ifdef __cplusplus } diff --git a/opentrack-api/trackers.cpp b/opentrack-api/trackers.cpp index 0f698e4c..937f7084 100644 --- a/opentrack-api/trackers.cpp +++ b/opentrack-api/trackers.cpp @@ -29,11 +29,10 @@ void OPENTRACK_EXPORT opentrack_tracker_start(opentrack self, opentrack_tracker return tracker->StartTracker(&self->fake_frame); } -int OPENTRACK_EXPORT opentrack_tracker_tick(opentrack_tracker tracker, double* headpose) +void OPENTRACK_EXPORT opentrack_tracker_tick(opentrack_tracker tracker, double* headpose) { - int ret = tracker->GiveHeadPoseData(headpose); + tracker->GiveHeadPoseData(headpose); QApplication::processEvents(0, 5); - return ret; } } -- cgit v1.2.3 From 3bc46979c76cd13b10ba0215804962f1e3904c5c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 10 Dec 2013 03:54:52 +0100 Subject: s/Give/Get/ --- FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp | 2 +- FTNoIR_Tracker_PT/ftnoir_tracker_pt.h | 4 ++-- facetracknoir/tracker.cpp | 4 ++-- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 2 +- ftnoir_tracker_base/ftnoir_tracker_base.h | 2 +- ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp | 2 +- ftnoir_tracker_hatire/ftnoir_tracker_hat.h | 4 ++-- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 2 +- ftnoir_tracker_ht/ftnoir_tracker_ht.h | 2 +- ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp | 2 +- ftnoir_tracker_hydra/ftnoir_tracker_hydra.h | 2 +- ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 2 +- ftnoir_tracker_joystick/ftnoir_tracker_joystick.h | 2 +- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 2 +- ftnoir_tracker_rift/ftnoir_tracker_rift.h | 2 +- ftnoir_tracker_udp/ftnoir_tracker_udp.cpp | 2 +- ftnoir_tracker_udp/ftnoir_tracker_udp.h | 2 +- opentrack-api/trackers.cpp | 2 +- 19 files changed, 22 insertions(+), 22 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp index a6aaa29c..639053b7 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp @@ -233,7 +233,7 @@ void Tracker::StopTracker(bool exit) #define THeadPoseData double #endif -void Tracker::GiveHeadPoseData(THeadPoseData *data) +void Tracker::GetHeadPoseData(THeadPoseData *data) { { QMutexLocker lock(&mutex); diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h index 5c8d35d2..54edafb2 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h @@ -44,11 +44,11 @@ public: virtual void Initialize(QFrame *videoframe); #ifdef OPENTRACK_API virtual void StartTracker(QFrame* parent_window); - virtual void GiveHeadPoseData(double* data); + virtual void GetHeadPoseData(double* data); #else virtual void StartTracker(HWND parent_window); virtual void StopTracker(bool exit); - virtual bool GiveHeadPoseData(THeadPoseData *data); + virtual bool GetHeadPoseData(THeadPoseData *data); #endif virtual void refreshVideo(); diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index fbf90a66..8f8ad356 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -108,11 +108,11 @@ void Tracker::run() { break; if (Libraries->pSecondTracker) { - Libraries->pSecondTracker->GiveHeadPoseData(newpose); + Libraries->pSecondTracker->GetHeadPoseData(newpose); } if (Libraries->pTracker) { - Libraries->pTracker->GiveHeadPoseData(newpose); + Libraries->pTracker->GetHeadPoseData(newpose); } { diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 11916df5..6d06d4a8 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -375,7 +375,7 @@ void Tracker::run() } } -void Tracker::GiveHeadPoseData(double *data) +void Tracker::GetHeadPoseData(double *data) { QMutexLocker lck(&mtx); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 8a480d9f..be2ad3d7 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -26,7 +26,7 @@ public: Tracker(); virtual ~Tracker(); void StartTracker(QFrame* frame); - void GiveHeadPoseData(double *data); + void GetHeadPoseData(double *data); bool enableTX, enableTY, enableTZ, enableRX, enableRY, enableRZ; void run(); void load_settings(); diff --git a/ftnoir_tracker_base/ftnoir_tracker_base.h b/ftnoir_tracker_base/ftnoir_tracker_base.h index e6e770ed..16f76cf3 100644 --- a/ftnoir_tracker_base/ftnoir_tracker_base.h +++ b/ftnoir_tracker_base/ftnoir_tracker_base.h @@ -43,7 +43,7 @@ struct ITracker { virtual ~ITracker() = 0; virtual void StartTracker( QFrame* frame ) = 0; - virtual void GiveHeadPoseData(double *data) = 0; + virtual void GetHeadPoseData(double *data) = 0; virtual int preferredHz() { return 66; } }; diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp index bcef6753..f902b207 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp @@ -323,7 +323,7 @@ void FTNoIR_Tracker::StartTracker(QFrame*) #define THeadPoseData double #endif -void FTNoIR_Tracker::GiveHeadPoseData(THeadPoseData *data) +void FTNoIR_Tracker::GetHeadPoseData(THeadPoseData *data) { QMutexLocker lck(&mutex); while (dataRead.length()>=30) { diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h index 04c5fb61..ec1125b9 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h @@ -29,12 +29,12 @@ public: #ifdef OPENTRACK_API virtual void StartTracker(QFrame*); - virtual void GiveHeadPoseData(double* data); + virtual void GetHeadPoseData(double* data); #else void Initialize( QFrame *videoframe ); virtual void StartTracker(HWND parent_window); virtual void StopTracker(bool exit); - virtual bool GiveHeadPoseData(THeadPoseData *data); + virtual bool GetHeadPoseData(THeadPoseData *data); #endif void applysettings(const TrackerSettings& settings); void notifyCenter(); diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index c3c12005..00dd9919 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -186,7 +186,7 @@ void Tracker::StartTracker(QFrame* videoframe) #endif } -void Tracker::GiveHeadPoseData(double *data) +void Tracker::GetHeadPoseData(double *data) { lck_shm.lock(); shm->timer = 0; diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h index 475d5a6c..404dbf6e 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h @@ -23,7 +23,7 @@ public: Tracker(); virtual ~Tracker(); void StartTracker(QFrame* frame); - void GiveHeadPoseData(double *data); + void GetHeadPoseData(double *data); bool enableTX, enableTY, enableTZ, enableRX, enableRY, enableRZ; ht_shm_t* shm; private: diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp index 11a3e0fb..31e3f319 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp @@ -66,7 +66,7 @@ void Hydra_Tracker::StartTracker(QFrame*) } -void Hydra_Tracker::GiveHeadPoseData(double *data) +void Hydra_Tracker::GetHeadPoseData(double *data) { sixenseSetActiveBase(0); diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h index 6e40b710..240f0687 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h @@ -12,7 +12,7 @@ public: ~Hydra_Tracker(); void StartTracker(QFrame *) virt_override; - void GiveHeadPoseData(double *data) virt_override; + void GetHeadPoseData(double *data) virt_override; void loadSettings(); volatile bool should_quit; protected: diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index 8f5ac162..5be6b3db 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -175,7 +175,7 @@ fail: qDebug() << "joy init failure"; } -void FTNoIR_Tracker::GiveHeadPoseData(double *data) +void FTNoIR_Tracker::GetHeadPoseData(double *data) { QMutexLocker foo(&mtx); DIJOYSTATE js = {0}; diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h index 809d8c73..9c856d85 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h @@ -42,7 +42,7 @@ public: ~FTNoIR_Tracker(); void StartTracker(QFrame *frame); - void GiveHeadPoseData(double *data); + void GetHeadPoseData(double *data); void loadSettings(); LPDIRECTINPUT8 g_pDI; LPDIRECTINPUTDEVICE8 g_pJoystick; diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index c3b313ca..da44ea0c 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -68,7 +68,7 @@ void Rift_Tracker::StartTracker(QFrame*) } -void Rift_Tracker::GiveHeadPoseData(double *data) +void Rift_Tracker::GetHeadPoseData(double *data) { if (pSFusion != NULL && pSensor != NULL) { Quatf hmdOrient = pSFusion->GetOrientation(); diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index 33e6f5cd..3920c6ad 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -15,7 +15,7 @@ public: virtual ~Rift_Tracker() virt_override; void StartTracker(QFrame *) virt_override; - void GiveHeadPoseData(double *data) virt_override; + void GetHeadPoseData(double *data) virt_override; void loadSettings(); virtual int preferredHz() virt_override { return 250; } volatile bool should_quit; diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp index d58341a6..e70bfdc7 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp @@ -110,7 +110,7 @@ void FTNoIR_Tracker::StartTracker(QFrame*) return; } -void FTNoIR_Tracker::GiveHeadPoseData(double *data) +void FTNoIR_Tracker::GetHeadPoseData(double *data) { mutex.lock(); if (bEnableX) { diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.h b/ftnoir_tracker_udp/ftnoir_tracker_udp.h index 7b6c5328..c7e9decf 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.h +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.h @@ -16,7 +16,7 @@ public: ~FTNoIR_Tracker(); void StartTracker(QFrame *); - void GiveHeadPoseData(double *data); + void GetHeadPoseData(double *data); void loadSettings(); volatile bool should_quit; protected: diff --git a/opentrack-api/trackers.cpp b/opentrack-api/trackers.cpp index 937f7084..5027ec1d 100644 --- a/opentrack-api/trackers.cpp +++ b/opentrack-api/trackers.cpp @@ -31,7 +31,7 @@ void OPENTRACK_EXPORT opentrack_tracker_start(opentrack self, opentrack_tracker void OPENTRACK_EXPORT opentrack_tracker_tick(opentrack_tracker tracker, double* headpose) { - tracker->GiveHeadPoseData(headpose); + tracker->GetHeadPoseData(headpose); QApplication::processEvents(0, 5); } -- cgit v1.2.3 From 982138ba2c308ee66e33bb67eea9d66f708e021e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 14 Dec 2013 15:24:53 +0100 Subject: aruco: adjust coefficients basing on resolution Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 6d06d4a8..d7d55f82 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -187,7 +187,6 @@ void Tracker::run() aruco::MarkerDetector detector; detector.setDesiredSpeed(3); - detector.setThresholdParams(11, 6); cv::Rect last_roi(65535, 65535, 0, 0); @@ -219,6 +218,7 @@ void Tracker::run() cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); const int scale = frame.cols > 480 ? 2 : 1; + detector.setThresholdParams(scale > 1 ? 11 : 7, 7); const float focal_length_w = 0.5 * grayscale.cols / tan(0.5 * fov * HT_PI / 180); const float focal_length_h = 0.5 * grayscale.rows / tan(0.5 * fov * grayscale.rows / grayscale.cols * HT_PI / 180.0); -- cgit v1.2.3 From 03a3088a0e8fd14684044fb2f20072556e55712b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 18 Dec 2013 09:14:58 +0100 Subject: adjust coeffs so that aruco actually works Signed-off-by: Stanislaw Halik --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index d7d55f82..972dd1e1 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -192,7 +192,7 @@ void Tracker::run() cv::Mat color, color_, grayscale, rvec, tvec; - const double stateful_coeff = 0.81; + const double stateful_coeff = 0.86; if (!camera.isOpened()) { @@ -218,7 +218,7 @@ void Tracker::run() cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); const int scale = frame.cols > 480 ? 2 : 1; - detector.setThresholdParams(scale > 1 ? 11 : 7, 7); + detector.setThresholdParams(scale > 1 ? 11 : 7, 4); const float focal_length_w = 0.5 * grayscale.cols / tan(0.5 * fov * HT_PI / 180); const float focal_length_h = 0.5 * grayscale.rows / tan(0.5 * fov * grayscale.rows / grayscale.cols * HT_PI / 180.0); -- cgit v1.2.3 From 61b66d8689005dacf43d0ea42165b695e089fc28 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 26 Dec 2013 01:38:24 +0100 Subject: aruco: use less cpu for idempotent frames --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 972dd1e1..9a50a2b6 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -192,7 +192,7 @@ void Tracker::run() cv::Mat color, color_, grayscale, rvec, tvec; - const double stateful_coeff = 0.86; + const double stateful_coeff = 0.75; if (!camera.isOpened()) { -- cgit v1.2.3 From 10010c9883b05ccac61c34fc993bea9c657b18aa Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 26 Dec 2013 01:43:54 +0100 Subject: more senseless coeff tweaks --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 9a50a2b6..47c83c12 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -192,7 +192,7 @@ void Tracker::run() cv::Mat color, color_, grayscale, rvec, tvec; - const double stateful_coeff = 0.75; + const double stateful_coeff = 0.9; if (!camera.isOpened()) { -- cgit v1.2.3 From 0b376956dc68390f76ce3165a2572b9c902027a6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 28 Dec 2013 05:43:39 +0100 Subject: fix copy-paste marker non-detection --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 47c83c12..9a8c09d5 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -239,7 +239,7 @@ void Tracker::run() (detector.detect(grayscale(last_roi), markers, cv::Mat(), cv::Mat(), -1, false), markers.size() == 1 && markers[0].size() == 4)) { - detector.setMinMaxSize(std::max(0.2, 0.08 * grayscale.cols / last_roi.width), + detector.setMinMaxSize(std::max(0.1, 0.08 * grayscale.cols / last_roi.width), std::min(1.0, 0.39 * grayscale.cols / last_roi.width)); auto& m = markers.at(0); for (int i = 0; i < 4; i++) @@ -251,7 +251,7 @@ void Tracker::run() } else { - detector.setMinMaxSize(0.09, 0.4); + detector.setMinMaxSize(0.08, 0.39); detector.detect(grayscale, markers, cv::Mat(), cv::Mat(), -1, false); } -- cgit v1.2.3 From 810293b5639f9a3df67c343866544c34eda84192 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 28 Dec 2013 05:44:14 +0100 Subject: implement optional aruco frame smoothing ewma scheme --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 310 +++++++++++++++----------- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 53 ++++- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 2 + 3 files changed, 233 insertions(+), 132 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index d4b64c23..340ed0ad 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -10,7 +10,7 @@ 0 0 704 - 308 + 399 @@ -32,7 +32,106 @@ -1 - + + + + Horizontal FOV + + + + + + + Enable axes + + + + -1 + + + 6 + + + 0 + + + 6 + + + 0 + + + + + RX + + + + + + + TX + + + + + + + RY + + + + + + + TY + + + + + + + RZ + + + + + + + TZ + + + + + + + + + + Frames per second + + + + + + + + + + + + + 35.000000000000000 + + + 180.000000000000000 + + + 52.000000000000000 + + + + Head centroid position @@ -124,79 +223,6 @@ - - - - Enable axes - - - - -1 - - - 6 - - - 0 - - - 6 - - - 0 - - - - - RX - - - - - - - TX - - - - - - - RY - - - - - - - TY - - - - - - - RZ - - - - - - - TZ - - - - - - - - - - Resolution - - - @@ -221,48 +247,14 @@ - - + + - Frames per second - - - - - - - - 640x480 - - - - - 320x240 - - - - - 320x200 - - - - - Default (not recommended!) - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok + Resolution - - - - + @@ -293,19 +285,34 @@ - - - - - - - 35.000000000000000 - - - 180.000000000000000 - - - 52.000000000000000 + + + + + 640x480 + + + + + 320x240 + + + + + 320x200 + + + + + Default (not recommended!) + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok @@ -316,10 +323,54 @@ - - + + + + + 0 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + + - Horizontal FOV + Frame EWMA @@ -340,7 +391,6 @@ tx ty tz - buttonBox diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 9a8c09d5..fa83955c 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #if defined(_WIN32) # define NO_DSHOW_STRSAFE @@ -129,12 +129,14 @@ void Tracker::load_settings() headpos[i] = iniFile.value(QString("headpos-%1").arg(i), 0).toDouble(); } headpitch = iniFile.value("pitch", 0).toDouble(); + N_hyst = iniFile.value("ewma", 0).toInt(); iniFile.endGroup(); } Tracker::Tracker() { + N_hyst = 0; layout = nullptr; stop = false; videoWidget = NULL; @@ -192,7 +194,7 @@ void Tracker::run() cv::Mat color, color_, grayscale, rvec, tvec; - const double stateful_coeff = 0.9; + const double stateful_coeff = 0.88; if (!camera.isOpened()) { @@ -209,6 +211,29 @@ void Tracker::run() int fps = 0; int last_fps = 0; cv::Point2f last_centroid; + + bool first_run = true; + + std::vector lasts; + + for (int i = 0; i < N_hyst; i++) + lasts.push_back(cv::Mat()); + + vector weights; + { + const float a = 0.32; + float sum = 0; + float k = 1; + for (int i = 0; i < N_hyst; i++) + { + sum += k; + weights.push_back(k); + k *= 1./(a*N_hyst); + } + for (int i = 0; i < N_hyst; i++) + qDebug() << i << "w" << (weights[i] /= sum); + } + while (!stop) { if (!camera.read(color_)) @@ -217,6 +242,28 @@ void Tracker::run() color_.copyTo(color); cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); + if (first_run) + { + first_run = false; + for (int i = 0; i < N_hyst; i++) + lasts[i] = grayscale; + } + if (N_hyst > 0) + { + cv::Mat hyst(grayscale.rows, grayscale.cols, CV_32F); + hyst.setTo(0); + for (int i = 0; i < N_hyst-1; i++) + lasts[i] = lasts[i+1]; + lasts[N_hyst-1] = grayscale; + for (int i = 0; i < N_hyst; i++) + for (int y = 0; y < grayscale.rows; y++) + for (int x = 0; x < grayscale.cols; x++) + hyst.at(y, x) += (float) lasts[i].at(y, x) * weights[i]; + hyst.convertTo(grayscale, CV_8U); + } + + cv::cvtColor(grayscale, color, cv::COLOR_GRAY2BGR); + const int scale = frame.cols > 480 ? 2 : 1; detector.setThresholdParams(scale > 1 ? 11 : 7, 4); @@ -543,6 +590,7 @@ void TrackerControls::loadSettings() } ui.pitch_deg->setValue(iniFile.value("pitch", 0).toDouble()); + ui.ewma->setCurrentIndex(iniFile.value("ewma", 0).toInt()); iniFile.endGroup(); settingsDirty = false; @@ -583,6 +631,7 @@ void TrackerControls::save() iniFile.setValue("enable-tz", ui.tz->checkState() != Qt::Unchecked ? true : false); iniFile.setValue("resolution", ui.resolution->currentIndex()); iniFile.setValue("pitch", ui.pitch_deg->value()); + iniFile.setValue("ewma", ui.ewma->currentIndex()); QDoubleSpinBox* headpos[] = { ui.cx, diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index be2ad3d7..249c8829 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -42,6 +42,8 @@ private: cv::Mat frame; double headpos[3], headpitch; cv::VideoCapture camera; + int N_hyst; + cv::Mat lasts; }; // Widget that has controls for FTNoIR protocol client-settings. -- cgit v1.2.3 From c4bd08796aa00a8a70cbbb8caec947494a39432c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 28 Dec 2013 05:47:13 +0100 Subject: aruco: decrease ewma alpha for bigger averaging --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index fa83955c..077bb0d9 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -221,7 +221,7 @@ void Tracker::run() vector weights; { - const float a = 0.32; + const float a = 0.25; float sum = 0; float k = 1; for (int i = 0; i < N_hyst; i++) -- cgit v1.2.3 From 5df8a8cc2869b0eab009841a684b6ee0d4ca390e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 28 Dec 2013 05:48:10 +0100 Subject: simplify ewma logic --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 077bb0d9..c24c233f 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -242,14 +242,14 @@ void Tracker::run() color_.copyTo(color); cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); - if (first_run) - { - first_run = false; - for (int i = 0; i < N_hyst; i++) - lasts[i] = grayscale; - } if (N_hyst > 0) { + if (first_run) + { + first_run = false; + for (int i = 0; i < N_hyst; i++) + lasts[i] = grayscale; + } cv::Mat hyst(grayscale.rows, grayscale.cols, CV_32F); hyst.setTo(0); for (int i = 0; i < N_hyst-1; i++) -- cgit v1.2.3 From d65cf74ce47e66dba1c58212e1aadce07a6ca5cf Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 28 Dec 2013 05:48:34 +0100 Subject: remove redundant cast --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index c24c233f..999431a0 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -258,7 +258,7 @@ void Tracker::run() for (int i = 0; i < N_hyst; i++) for (int y = 0; y < grayscale.rows; y++) for (int x = 0; x < grayscale.cols; x++) - hyst.at(y, x) += (float) lasts[i].at(y, x) * weights[i]; + hyst.at(y, x) += lasts[i].at(y, x) * weights[i]; hyst.convertTo(grayscale, CV_8U); } -- cgit v1.2.3 From 8d541f45950cb59fe3463bba3cae0024bb466a31 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 28 Dec 2013 05:51:25 +0100 Subject: don't hardcode min/max size constants --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 999431a0..09ab4f29 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -282,12 +282,15 @@ void Tracker::run() std::vector< aruco::Marker > markers; + const double size_min = 0.08; + const double size_max = 0.39; + if (last_roi.width > 0 && (detector.detect(grayscale(last_roi), markers, cv::Mat(), cv::Mat(), -1, false), markers.size() == 1 && markers[0].size() == 4)) { - detector.setMinMaxSize(std::max(0.1, 0.08 * grayscale.cols / last_roi.width), - std::min(1.0, 0.39 * grayscale.cols / last_roi.width)); + 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++) { @@ -298,7 +301,7 @@ void Tracker::run() } else { - detector.setMinMaxSize(0.08, 0.39); + detector.setMinMaxSize(size_min, size_max); detector.detect(grayscale, markers, cv::Mat(), cv::Mat(), -1, false); } -- cgit v1.2.3 From be1c43cf934cbe4db7a3ad0e857fe1addd4c3329 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 28 Dec 2013 05:51:44 +0100 Subject: change the min/max size constants --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 09ab4f29..c6d45f35 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -282,8 +282,8 @@ void Tracker::run() std::vector< aruco::Marker > markers; - const double size_min = 0.08; - const double size_max = 0.39; + 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), -- cgit v1.2.3 From 232c41ad8b34f054583505f83f3b7aa3ebbba2b7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 28 Dec 2013 06:24:59 +0100 Subject: remove ewma frame support, too little gain --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 109 ++++++++++++-------------- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 49 ------------ ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 2 - 3 files changed, 52 insertions(+), 108 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 340ed0ad..6cc8c29d 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -105,6 +105,45 @@ + + + + + 0 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + @@ -254,6 +293,13 @@ + + + + Frame EWMA + + + @@ -285,30 +331,6 @@ - - - - - 640x480 - - - - - 320x240 - - - - - 320x200 - - - - - Default (not recommended!) - - - - @@ -323,57 +345,30 @@ - - - - - 0 - - - - - 1 - - - - - 2 - - - - - 3 - - + + - 4 + 640x480 - 5 + 320x240 - 6 + 320x200 - 7 + Default (not recommended!) - - - - Frame EWMA - - - diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index c6d45f35..4c900ab4 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -16,7 +16,6 @@ #include #include #include -#include #if defined(_WIN32) # define NO_DSHOW_STRSAFE @@ -129,14 +128,12 @@ void Tracker::load_settings() headpos[i] = iniFile.value(QString("headpos-%1").arg(i), 0).toDouble(); } headpitch = iniFile.value("pitch", 0).toDouble(); - N_hyst = iniFile.value("ewma", 0).toInt(); iniFile.endGroup(); } Tracker::Tracker() { - N_hyst = 0; layout = nullptr; stop = false; videoWidget = NULL; @@ -212,28 +209,6 @@ void Tracker::run() int last_fps = 0; cv::Point2f last_centroid; - bool first_run = true; - - std::vector lasts; - - for (int i = 0; i < N_hyst; i++) - lasts.push_back(cv::Mat()); - - vector weights; - { - const float a = 0.25; - float sum = 0; - float k = 1; - for (int i = 0; i < N_hyst; i++) - { - sum += k; - weights.push_back(k); - k *= 1./(a*N_hyst); - } - for (int i = 0; i < N_hyst; i++) - qDebug() << i << "w" << (weights[i] /= sum); - } - while (!stop) { if (!camera.read(color_)) @@ -242,28 +217,6 @@ void Tracker::run() color_.copyTo(color); cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); - if (N_hyst > 0) - { - if (first_run) - { - first_run = false; - for (int i = 0; i < N_hyst; i++) - lasts[i] = grayscale; - } - cv::Mat hyst(grayscale.rows, grayscale.cols, CV_32F); - hyst.setTo(0); - for (int i = 0; i < N_hyst-1; i++) - lasts[i] = lasts[i+1]; - lasts[N_hyst-1] = grayscale; - for (int i = 0; i < N_hyst; i++) - for (int y = 0; y < grayscale.rows; y++) - for (int x = 0; x < grayscale.cols; x++) - hyst.at(y, x) += lasts[i].at(y, x) * weights[i]; - hyst.convertTo(grayscale, CV_8U); - } - - cv::cvtColor(grayscale, color, cv::COLOR_GRAY2BGR); - const int scale = frame.cols > 480 ? 2 : 1; detector.setThresholdParams(scale > 1 ? 11 : 7, 4); @@ -593,7 +546,6 @@ void TrackerControls::loadSettings() } ui.pitch_deg->setValue(iniFile.value("pitch", 0).toDouble()); - ui.ewma->setCurrentIndex(iniFile.value("ewma", 0).toInt()); iniFile.endGroup(); settingsDirty = false; @@ -634,7 +586,6 @@ void TrackerControls::save() iniFile.setValue("enable-tz", ui.tz->checkState() != Qt::Unchecked ? true : false); iniFile.setValue("resolution", ui.resolution->currentIndex()); iniFile.setValue("pitch", ui.pitch_deg->value()); - iniFile.setValue("ewma", ui.ewma->currentIndex()); QDoubleSpinBox* headpos[] = { ui.cx, diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 249c8829..be2ad3d7 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -42,8 +42,6 @@ private: cv::Mat frame; double headpos[3], headpitch; cv::VideoCapture camera; - int N_hyst; - cv::Mat lasts; }; // Widget that has controls for FTNoIR protocol client-settings. -- cgit v1.2.3 From fa54d5a4f8a0bf73cad7ebdd3895b8a7467868e6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 28 Dec 2013 09:42:07 +0100 Subject: remove smoothing/ewma remnants --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 100 +++++++------------------- 1 file changed, 27 insertions(+), 73 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 6cc8c29d..629d1bbb 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -105,45 +105,6 @@ - - - - - 0 - - - - - 1 - - - - - 2 - - - - - 3 - - - - - 4 - - - - - 5 - - - - - 6 - - - - @@ -151,26 +112,7 @@ - - - - - - - - - - 35.000000000000000 - - - 180.000000000000000 - - - 52.000000000000000 - - - - + Head centroid position @@ -262,6 +204,25 @@ + + + + + + + + + + 35.000000000000000 + + + 180.000000000000000 + + + 52.000000000000000 + + + @@ -293,13 +254,6 @@ - - - - Frame EWMA - - - @@ -338,13 +292,6 @@ - - - - Camera name - - - @@ -369,6 +316,13 @@ + + + + Camera name + + + -- cgit v1.2.3 From fbbe79400ddf7397f2ec09e679ac79e139ebb1d5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 29 Dec 2013 03:35:03 +0100 Subject: aruco: allow for filter only red spectrum --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 204 ++++++++++++++------------ ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 12 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 1 + 3 files changed, 120 insertions(+), 97 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 629d1bbb..710a33e1 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -10,7 +10,7 @@ 0 0 704 - 399 + 339 @@ -112,98 +112,6 @@ - - - - Head centroid position - - - Qt::AlignCenter - - - - Qt::AlignHCenter|Qt::AlignTop - - - - - TX - - - - - - - -200.000000000000000 - - - 200.000000000000000 - - - - - - - TY - - - - - - - -200.000000000000000 - - - 200.000000000000000 - - - - - - - TZ - - - - - - - -200.000000000000000 - - - 200.000000000000000 - - - - - - - Pitch - - - - - - - ° - - - 2 - - - -60.000000000000000 - - - 60.000000000000000 - - - 0.000000000000000 - - - - - - @@ -254,7 +162,7 @@ - + @@ -285,7 +193,7 @@ - + QDialogButtonBox::Cancel|QDialogButtonBox::Ok @@ -323,6 +231,112 @@ + + + + Red channel only + + + + + + + Recommended! + + + + + + + Head centroid position + + + Qt::AlignCenter + + + + Qt::AlignHCenter|Qt::AlignTop + + + + + TX + + + + + + + -200.000000000000000 + + + 200.000000000000000 + + + + + + + TY + + + + + + + -200.000000000000000 + + + 200.000000000000000 + + + + + + + TZ + + + + + + + -200.000000000000000 + + + 200.000000000000000 + + + + + + + Pitch + + + + + + + ° + + + 2 + + + -60.000000000000000 + + + 60.000000000000000 + + + 0.000000000000000 + + + + + + diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 4c900ab4..9408de02 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -128,6 +128,7 @@ void Tracker::load_settings() headpos[i] = iniFile.value(QString("headpos-%1").arg(i), 0).toDouble(); } headpitch = iniFile.value("pitch", 0).toDouble(); + red_only = iniFile.value("red-only", true).toBool(); iniFile.endGroup(); } @@ -215,7 +216,13 @@ void Tracker::run() continue; auto tm = cv::getTickCount(); color_.copyTo(color); - cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); + if (red_only) + { + cv::Mat channel[3]; + cv::split(color, channel); + grayscale = channel[2]; + } else + cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); const int scale = frame.cols > 480 ? 2 : 1; detector.setThresholdParams(scale > 1 ? 11 : 7, 4); @@ -546,7 +553,7 @@ void TrackerControls::loadSettings() } ui.pitch_deg->setValue(iniFile.value("pitch", 0).toDouble()); - + ui.red_only->setChecked(iniFile.value("red-only", true).toBool()); iniFile.endGroup(); settingsDirty = false; } @@ -597,6 +604,7 @@ void TrackerControls::save() { iniFile.setValue(QString("headpos-%1").arg(i), headpos[i]->value()); } + iniFile.setValue("red-only", ui.red_only->isChecked()); iniFile.endGroup(); settingsDirty = false; if (tracker) diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index be2ad3d7..545ad5d0 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -42,6 +42,7 @@ private: cv::Mat frame; double headpos[3], headpitch; cv::VideoCapture camera; + volatile bool red_only; }; // Widget that has controls for FTNoIR protocol client-settings. -- cgit v1.2.3 From d1e0537f704ea67483ccbdf7461e636490aba0cf Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 31 Dec 2013 08:41:16 +0100 Subject: meta: get rid of Initialize(), now RAII --- FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h | 4 - ftnoir_filter_accela/ftnoir_filter_accela.h | 4 +- .../ftnoir_filter_accela_dialog.cpp | 4 - ftnoir_filter_base/ftnoir_filter_base.h | 3 +- ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp | 4 - ftnoir_filter_ewma2/ftnoir_filter_ewma2.h | 5 +- ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp | 21 -- ftnoir_filter_kalman/ftnoir_filter_kalman.h | 9 +- ftnoir_filter_kalman/kalman.cpp | 4 +- ftnoir_protocol_base/ftnoir_protocol_base.h | 3 - ftnoir_protocol_fg/ftnoir_protocol_fg.h | 7 - ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp | 24 -- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h | 3 - .../ftnoir_protocol_fsuipc_dialog.cpp | 29 -- ftnoir_protocol_ft/ftnoir_protocol_ft.h | 3 - ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp | 30 -- ftnoir_protocol_ftn/ftnoir_protocol_ftn.h | 3 - ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp | 24 -- .../ftnoir_protocol_libevdev.h | 4 - .../ftnoir_protocol_libevdev_dialog.cpp | 15 - ftnoir_protocol_sc/ftnoir_protocol_sc.h | 3 - ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp | 30 -- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h | 4 - .../ftnoir_protocol_vjoy_dialog.cpp | 15 - ftnoir_protocol_wine/ftnoir_protocol_wine.h | 3 - ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 309 +++++---------------- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 55 ++-- ftnoir_tracker_base/ftnoir_tracker_base.h | 3 +- ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp | 34 --- ftnoir_tracker_hatire/ftnoir_tracker_hat.h | 7 - .../ftnoir_tracker_hat_dialog.cpp | 18 -- ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h | 4 +- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 5 - ftnoir_tracker_ht/ftnoir_tracker_ht.h | 1 - ftnoir_tracker_hydra/ftnoir_tracker_hydra.h | 1 - .../ftnoir_tracker_hydra_dialog.cpp | 9 - ftnoir_tracker_joystick/ftnoir_tracker_joystick.h | 6 +- .../ftnoir_tracker_joystick_dialog.cpp | 18 -- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 2 - ftnoir_tracker_rift/ftnoir_tracker_rift.h | 1 - ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp | 9 - ftnoir_tracker_udp/ftnoir_tracker_udp.h | 3 - ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp | 23 -- 43 files changed, 118 insertions(+), 648 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h index 18283837..1d30e7e5 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h @@ -20,10 +20,6 @@ class TrackerDll : public ITrackerDll #endif { - // ITrackerDll interface -#ifndef OPENTRACK_API - void Initialize() {} -#endif void getFullName(QString *strToBeFilled); void getShortName(QString *strToBeFilled); void getDescription(QString *strToBeFilled); diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index 2b93f550..1aaa039f 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -37,7 +37,7 @@ class FTNoIR_Filter : public IFilter public: FTNoIR_Filter(); void FilterHeadPoseData(const double* target_camera_position, double *new_camera_position); - void Initialize() { + void reset() { first_run = true; } void receiveSettings() { @@ -64,7 +64,7 @@ class FilterControls: public QWidget, public IFilterDialog Q_OBJECT public: FilterControls(); - void Initialize(QWidget *); + void reset(QWidget *); void registerFilter(IFilter* filter); void unregisterFilter(); private: diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp index cc759bcb..6d1ad384 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp @@ -20,10 +20,6 @@ FilterControls::FilterControls() : tie_setting(s.expt, ui.expt); } -void FilterControls::Initialize(QWidget *) { - show(); -} - void FilterControls::registerFilter(IFilter* filter) { accela_filter = (FTNoIR_Filter*) filter; diff --git a/ftnoir_filter_base/ftnoir_filter_base.h b/ftnoir_filter_base/ftnoir_filter_base.h index 800e5deb..fbb0441d 100644 --- a/ftnoir_filter_base/ftnoir_filter_base.h +++ b/ftnoir_filter_base/ftnoir_filter_base.h @@ -14,7 +14,7 @@ struct IFilter { virtual ~IFilter() = 0; virtual void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position) = 0; - virtual void Initialize() = 0; + virtual void reset() = 0; }; inline IFilter::~IFilter() { } @@ -22,7 +22,6 @@ inline IFilter::~IFilter() { } struct IFilterDialog { virtual ~IFilterDialog() {} - virtual void Initialize(QWidget *parent) = 0; virtual void registerFilter(IFilter* tracker) = 0; virtual void unregisterFilter() = 0; }; diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp index 5f66be96..77596b71 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp @@ -44,10 +44,6 @@ FTNoIR_Filter::FTNoIR_Filter() loadSettings(); // Load the Settings } -FTNoIR_Filter::~FTNoIR_Filter() -{ -} - void FTNoIR_Filter::receiveSettings(double smin, double smax, double sexpt) { QMutexLocker foo(&mutex); diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h index 86e4b65c..7c98b2cb 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h @@ -41,8 +41,7 @@ class FTNoIR_Filter : public IFilter { public: FTNoIR_Filter(); - virtual ~FTNoIR_Filter(); - void Initialize() {} + void reset() {} void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position); @@ -73,9 +72,7 @@ class FilterControls: public QWidget, public IFilterDialog Q_OBJECT public: explicit FilterControls(); - virtual ~FilterControls(); void showEvent (QShowEvent *); - void Initialize(QWidget *parent); void registerFilter(IFilter* flt); void unregisterFilter(); diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp index c304eb0a..eb414340 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp @@ -59,27 +59,6 @@ FilterControls::FilterControls() : loadSettings(); } -// -// Destructor for server-dialog -// -FilterControls::~FilterControls() { - qDebug() << "~FilterControls() says: started"; -} - -// -// Initialize tracker-client-dialog -// -void FilterControls::Initialize(QWidget *parent) { - // - // - // - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - void FilterControls::registerFilter(IFilter* flt) { pFilter = (FTNoIR_Filter*) flt; diff --git a/ftnoir_filter_kalman/ftnoir_filter_kalman.h b/ftnoir_filter_kalman/ftnoir_filter_kalman.h index da6df2b1..9e0d817d 100644 --- a/ftnoir_filter_kalman/ftnoir_filter_kalman.h +++ b/ftnoir_filter_kalman/ftnoir_filter_kalman.h @@ -28,7 +28,7 @@ public: FTNoIR_Filter(); ~FTNoIR_Filter() virt_override { } - void Initialize() virt_override; + void reset() virt_override; void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position) virt_override; cv::KalmanFilter kalman; @@ -68,16 +68,9 @@ public: connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); show(); } - ~FilterControls() {} void showEvent ( QShowEvent * ) virt_override { show(); } - - void Initialize(QWidget *) virt_override { - show(); - raise(); - } - bool settingsDirty; Ui::KalmanUICFilterControls ui; virtual void registerFilter(IFilter*) virt_override {} diff --git a/ftnoir_filter_kalman/kalman.cpp b/ftnoir_filter_kalman/kalman.cpp index 629cfcc8..743eb3d4 100644 --- a/ftnoir_filter_kalman/kalman.cpp +++ b/ftnoir_filter_kalman/kalman.cpp @@ -31,12 +31,12 @@ void kalman_save_settings(FilterControls&) { FTNoIR_Filter::FTNoIR_Filter() { kalman_load_settings(*this); - Initialize(); + reset(); } // the following was written by Donovan Baarda // https://sourceforge.net/p/facetracknoir/discussion/1150909/thread/418615e1/?limit=25#af75/084b -void FTNoIR_Filter::Initialize() { +void FTNoIR_Filter::reset() { const double accel_variance = 1e-3; const double noise_variance = 5e2; kalman.init(12, 6, 0, CV_64F); diff --git a/ftnoir_protocol_base/ftnoir_protocol_base.h b/ftnoir_protocol_base/ftnoir_protocol_base.h index e4ca1977..d2f85ec0 100644 --- a/ftnoir_protocol_base/ftnoir_protocol_base.h +++ b/ftnoir_protocol_base/ftnoir_protocol_base.h @@ -50,9 +50,6 @@ inline IProtocol::~IProtocol() { } struct IProtocolDialog { virtual ~IProtocolDialog() {} - virtual void Initialize(QWidget *parent) = 0; - virtual void showEvent ( QShowEvent * event ) = 0; - virtual void registerProtocol(IProtocol *protocol) = 0; virtual void unRegisterProtocol() = 0; }; diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.h b/ftnoir_protocol_fg/ftnoir_protocol_fg.h index 9a4f304c..0a255d84 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg.h +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.h @@ -35,11 +35,8 @@ #include #include #include -#include #include "facetracknoir/global-settings.h" -#define FT_PROGRAMID "FT_ProgramID" - class FTNoIR_Protocol : public IProtocol { public: @@ -65,10 +62,6 @@ class FGControls: public QWidget, public IProtocolDialog public: explicit FGControls(); - virtual ~FGControls(); - void showEvent ( QShowEvent * event ); - - void Initialize(QWidget *parent); void registerProtocol(IProtocol *protocol) { theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol } diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp index 45123540..cb11ace6 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp @@ -63,25 +63,6 @@ QWidget() loadSettings(); } -// -// Destructor for server-dialog -// -FGControls::~FGControls() { - qDebug() << "~FGControls() says: started"; -} - -// -// Initialize tracker-client-dialog -// -void FGControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - // // OK clicked on server-dialog // @@ -90,11 +71,6 @@ void FGControls::doOK() { this->close(); } -// override show event -void FGControls::showEvent ( QShowEvent * ) { - loadSettings(); -} - // // Cancel clicked on server-dialog // diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h index 87c6a3a4..9f5e3b6f 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h @@ -83,9 +83,6 @@ class FSUIPCControls: public QWidget, public IProtocolDialog public: explicit FSUIPCControls(); - virtual ~FSUIPCControls(); - void showEvent ( QShowEvent * event ); - void Initialize(QWidget *parent); void registerProtocol(IProtocol *protocol) { theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol } diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp index 985915b4..b2f28ba1 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp @@ -48,41 +48,12 @@ QWidget() loadSettings(); } -// -// Destructor for server-dialog -// -FSUIPCControls::~FSUIPCControls() { - qDebug() << "~FSUIPCControls() says: started"; -} - -// -// Initialize tracker-client-dialog -// -void FSUIPCControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - -// -// OK clicked on server-dialog -// void FSUIPCControls::doOK() { save(); this->close(); } -// override show event -void FSUIPCControls::showEvent ( QShowEvent * event ) { - loadSettings(); -} -// -// Cancel clicked on server-dialog -// void FSUIPCControls::doCancel() { // // Ask if changed Settings should be saved diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h index e13d260f..56316ec4 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h @@ -93,9 +93,6 @@ class FTControls: public QWidget, public IProtocolDialog public: explicit FTControls(); - virtual ~FTControls(); - void showEvent ( QShowEvent * event ); - void Initialize(QWidget *parent); void registerProtocol(IProtocol *protocol) { theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol } diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp index df13a6dc..0b29db6e 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp @@ -75,41 +75,11 @@ QWidget() } -// -// Destructor for server-dialog -// -FTControls::~FTControls() { - qDebug() << "~FTControls() says: started"; -} - -// -// Initialize tracker-client-dialog -// -void FTControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - -// -// OK clicked on server-dialog -// void FTControls::doOK() { save(); this->close(); } -// override show event -void FTControls::showEvent ( QShowEvent * event ) { - loadSettings(); -} - -// -// Cancel clicked on server-dialog -// void FTControls::doCancel() { // // Ask if changed Settings should be saved diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h index 9aee73ac..acccc9e7 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h @@ -64,9 +64,6 @@ class FTNControls: public QWidget, public IProtocolDialog public: explicit FTNControls(); - virtual ~FTNControls(); - void showEvent (QShowEvent *); - void Initialize(QWidget *parent); void registerProtocol(IProtocol *) {} void unRegisterProtocol() {} diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp index 3b4e851c..72c30051 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp @@ -56,25 +56,6 @@ QWidget() loadSettings(); } -// -// Destructor for server-dialog -// -FTNControls::~FTNControls() { - qDebug() << "~FTNControls() says: started"; -} - -// -// Initialize tracker-client-dialog -// -void FTNControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - // // OK clicked on server-dialog // @@ -83,11 +64,6 @@ void FTNControls::doOK() { this->close(); } -// override show event -void FTNControls::showEvent ( QShowEvent * ) { - loadSettings(); -} - // // Cancel clicked on server-dialog // diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h index aabd3e51..5df59919 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h @@ -41,10 +41,6 @@ class LibevdevControls: public QWidget, public IProtocolDialog public: explicit LibevdevControls(); - virtual ~LibevdevControls(); - void showEvent ( QShowEvent *) {} - - void Initialize(QWidget *); void registerProtocol(IProtocol *) {} void unRegisterProtocol() {} diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp index 6665a3d2..bb54c354 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp @@ -8,21 +8,6 @@ LibevdevControls::LibevdevControls() : QWidget() connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); } -LibevdevControls::~LibevdevControls() { -} - -// -// Initialize tracker-client-dialog -// -void LibevdevControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - void LibevdevControls::doOK() { save(); this->close(); diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.h b/ftnoir_protocol_sc/ftnoir_protocol_sc.h index e17cabb5..7917c532 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.h +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.h @@ -131,9 +131,6 @@ class SCControls: public QWidget, public IProtocolDialog public: explicit SCControls(); - virtual ~SCControls(); - void showEvent ( QShowEvent * event ); - void Initialize(QWidget *parent); void registerProtocol(IProtocol *protocol) { theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol } diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp index fb822145..eb15ca69 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp @@ -49,41 +49,11 @@ QWidget() loadSettings(); } -// -// Destructor for server-dialog -// -SCControls::~SCControls() { - qDebug() << "~SCControls() says: started"; -} - -// -// Initialize tracker-client-dialog -// -void SCControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - -// -// OK clicked on server-dialog -// void SCControls::doOK() { save(); this->close(); } -// override show event -void SCControls::showEvent ( QShowEvent * event ) { - loadSettings(); -} - -// -// Cancel clicked on server-dialog -// void SCControls::doCancel() { // // Ask if changed Settings should be saved diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h index c4db29e4..873b4e3c 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h @@ -60,10 +60,6 @@ class VJoyControls: public QWidget, public IProtocolDialog public: explicit VJoyControls(); - virtual ~VJoyControls(); - void showEvent ( QShowEvent *) {} - - void Initialize(QWidget *); void registerProtocol(IProtocol *l) {} void unRegisterProtocol() {} diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp index 0009553b..febb7b18 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp @@ -8,21 +8,6 @@ VJoyControls::VJoyControls() : QWidget() connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); } -VJoyControls::~VJoyControls() { -} - -// -// Initialize tracker-client-dialog -// -void VJoyControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - void VJoyControls::doOK() { save(); this->close(); diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.h b/ftnoir_protocol_wine/ftnoir_protocol_wine.h index d7276b8e..e84dbd69 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine.h +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.h @@ -70,10 +70,7 @@ class FTControls: public QWidget, public IProtocolDialog { Q_OBJECT public: - FTControls(); - void showEvent ( QShowEvent * ) {show();} - void Initialize(QWidget *) {show();} void registerProtocol(IProtocol *) {} void unRegisterProtocol() {} diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 9408de02..a0a11ed2 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -99,47 +99,8 @@ static resolution_tuple resolution_choices[] = { { 0, 0 } }; -void Tracker::load_settings() +Tracker::Tracker() : stop(false), layout(nullptr), videoWidget(nullptr) { - QMutexLocker foo(&mtx); - QSettings settings("opentrack"); - QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); - - iniFile.beginGroup( "aruco-Tracker" ); - fov = iniFile.value("fov", 56).toFloat(); - force_fps = iniFile.value("fps", 0).toInt(); - camera_index = iniFile.value("camera-index", -1).toInt(); - int res = iniFile.value("resolution", 0).toInt(); - if (res < 0 || res >= (int)(sizeof(resolution_choices) / sizeof(resolution_tuple))) - res = 0; - resolution_tuple r = resolution_choices[res]; - force_width = r.width; - force_height = r.height; - enableRX = iniFile.value("enable-rx", true).toBool(); - enableRY = iniFile.value("enable-ry", true).toBool(); - enableRZ = iniFile.value("enable-rz", true).toBool(); - enableTX = iniFile.value("enable-tx", true).toBool(); - enableTY = iniFile.value("enable-ty", true).toBool(); - enableTZ = iniFile.value("enable-tz", true).toBool(); - - for (int i = 0; i < 3; i++) - { - headpos[i] = iniFile.value(QString("headpos-%1").arg(i), 0).toDouble(); - } - headpitch = iniFile.value("pitch", 0).toDouble(); - red_only = iniFile.value("red-only", true).toBool(); - - iniFile.endGroup(); -} - -Tracker::Tracker() -{ - layout = nullptr; - stop = false; - videoWidget = NULL; - enableRX = enableRY = enableRZ = enableTX = enableTY = enableTZ = true; - load_settings(); } Tracker::~Tracker() @@ -166,7 +127,6 @@ void Tracker::StartTracker(QFrame* videoframe) delete videoframe->layout(); videoframe->setLayout(layout); videoWidget->show(); - load_settings(); start(); for (int i = 0; i < 6; i++) pose[i] = 0; @@ -177,13 +137,35 @@ void Tracker::StartTracker(QFrame* videoframe) void Tracker::run() { - camera = cv::VideoCapture(camera_index); - if (force_width) - camera.set(CV_CAP_PROP_FRAME_WIDTH, force_width); - if (force_height) - camera.set(CV_CAP_PROP_FRAME_HEIGHT, force_height); - if (force_fps) - camera.set(CV_CAP_PROP_FPS, force_fps); + int res = s.resolution; + if (res < 0 || res >= (int)(sizeof(resolution_choices) / sizeof(resolution_tuple))) + res = 0; + resolution_tuple r = resolution_choices[res]; + int fps; + switch (static_cast(s.force_fps)) + { + default: + case 0: + fps = 0; + break; + case 30: + fps = 1; + break; + case 60: + fps = 2; + break; + case 120: + fps = 3; + break; + } + camera = cv::VideoCapture(s.camera_index); + if (r.width) + { + camera.set(CV_CAP_PROP_FRAME_WIDTH, r.width); + camera.set(CV_CAP_PROP_FRAME_HEIGHT, r.height); + } + if (fps) + camera.set(CV_CAP_PROP_FPS, fps); aruco::MarkerDetector detector; detector.setDesiredSpeed(3); @@ -206,7 +188,7 @@ void Tracker::run() auto freq = cv::getTickFrequency(); auto last_time = cv::getTickCount(); - int fps = 0; + int cur_fps = 0; int last_fps = 0; cv::Point2f last_centroid; @@ -216,7 +198,7 @@ void Tracker::run() continue; auto tm = cv::getTickCount(); color_.copyTo(color); - if (red_only) + if (s.red_only) { cv::Mat channel[3]; cv::split(color, channel); @@ -227,8 +209,8 @@ void Tracker::run() const int scale = frame.cols > 480 ? 2 : 1; detector.setThresholdParams(scale > 1 ? 11 : 7, 4); - const float focal_length_w = 0.5 * grayscale.cols / tan(0.5 * fov * HT_PI / 180); - const float focal_length_h = 0.5 * grayscale.rows / tan(0.5 * fov * grayscale.rows / grayscale.cols * HT_PI / 180.0); + const float focal_length_w = 0.5 * grayscale.cols / tan(0.5 * s.fov * HT_PI / 180); + const float focal_length_h = 0.5 * grayscale.rows / tan(0.5 * s.fov * grayscale.rows / grayscale.cols * HT_PI / 180.0); cv::Mat intrinsics = cv::Mat::eye(3, 3, CV_32FC1); intrinsics.at (0, 0) = focal_length_w; intrinsics.at (1, 1) = focal_length_h; @@ -275,12 +257,12 @@ void Tracker::run() if ((long) (time / freq) != (long) (last_time / freq)) { - last_fps = fps; - fps = 0; + last_fps = cur_fps; + cur_fps = 0; last_time = time; } - fps++; + cur_fps++; char buf[128]; @@ -296,18 +278,18 @@ void Tracker::run() const float size = 7; cv::Mat obj_points(4,3,CV_32FC1); - obj_points.at(1,0)=-size + headpos[0]; - obj_points.at(1,1)=-size + headpos[1]; - obj_points.at(1,2)=0 + headpos[2]; - obj_points.at(2,0)=size + headpos[0]; - obj_points.at(2,1)=-size + headpos[1]; - obj_points.at(2,2)=0 + headpos[2]; - obj_points.at(3,0)=size + headpos[0]; - obj_points.at(3,1)=size + headpos[1]; - obj_points.at(3,2)=0 + headpos[2]; - obj_points.at(0,0)=-size + headpos[0]; - obj_points.at(0,1)=size + headpos[1]; - obj_points.at(0,2)=0 + headpos[2]; + obj_points.at(1,0)=-size + s.headpos_x; + obj_points.at(1,1)=-size + s.headpos_y; + obj_points.at(1,2)=0 + s.headpos_z; + obj_points.at(2,0)=size + s.headpos_x; + obj_points.at(2,1)=-size + s.headpos_y; + obj_points.at(2,2)=0 + s.headpos_z; + obj_points.at(3,0)=size + s.headpos_x; + obj_points.at(3,1)=size + s.headpos_y; + obj_points.at(3,2)=0 + s.headpos_z; + obj_points.at(0,0)=-size + s.headpos_x; + obj_points.at(0,1)=size + s.headpos_y; + obj_points.at(0,2)=0 + s.headpos_z; last_roi = cv::Rect(65535, 65535, 0, 0); @@ -341,22 +323,12 @@ void Tracker::run() cv::Rodrigues(rvec, rotation_matrix); { - const double beta = headpitch * HT_PI / 180; - double pitch[] = { - 1, 0, 0, - 0, cos(beta), -sin(beta), - 0, sin(beta), cos(beta) - }; - cv::Mat rot(3, 3, CV_64F, pitch); - cv::Mat tvec2 = rot * tvec; - rotation_matrix = rot * rotation_matrix; - cv::Vec3d euler = cv::RQDecomp3x3(rotation_matrix, junk1, junk2); QMutexLocker lck(&mtx); for (int i = 0; i < 3; i++) - pose[i] = tvec2.at(i); + pose[i] = tvec.at(i); pose[Yaw] = euler[1]; pose[Pitch] = -euler[0]; @@ -389,17 +361,17 @@ void Tracker::GetHeadPoseData(double *data) { QMutexLocker lck(&mtx); - if (enableRX) + if (s.eyaw) data[Yaw] = pose[Yaw]; - if (enableRY) + if (s.epitch) data[Pitch] = pose[Pitch]; - if (enableRZ) + if (s.eroll) data[Roll] = pose[Roll]; - if (enableTX) + if (s.ex) data[TX] = pose[TX]; - if (enableTY) + if (s.ey) data[TY] = pose[TY]; - if (enableTZ) + if (s.ez) data[TZ] = pose[TZ]; } @@ -468,178 +440,49 @@ TrackerControls::TrackerControls() tracker = nullptr; ui.setupUi(this); setAttribute(Qt::WA_NativeWindow, true); - connect(ui.cameraName, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.cameraFPS, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.cameraFOV, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - connect(ui.rx, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.ry, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.rz, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.tx, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.ty, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.tz, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.cx, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - connect(ui.cy, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - connect(ui.cz, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - //connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(doCancel())); - //connect(ui.buttonOK, SIGNAL(clicked()), this, SLOT(doOK())); - //connect(ui.buttonSettings, SIGNAL(clicked()), this, SLOT(cameraSettings())); + tie_setting(s.camera_index, ui.cameraName); + 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); + tie_setting(s.red_only, ui.red_only); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - loadSettings(); - settingsDirty = false; -} - -TrackerControls::~TrackerControls() -{ -} - -void TrackerControls::showEvent(QShowEvent *) -{ -} - -void TrackerControls::Initialize(QWidget*) -{ - loadSettings(); - show(); -} - -void TrackerControls::loadSettings() -{ - ui.cameraName->clear(); - QList names = get_camera_names(); - names.prepend("Any available"); - ui.cameraName->addItems(names); - QSettings settings("opentrack"); - QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); - iniFile.beginGroup( "aruco-Tracker" ); - ui.cameraName->setCurrentIndex(iniFile.value("camera-index", -1).toInt() + 1); - ui.cameraFOV->setValue(iniFile.value("fov", 56).toFloat()); - int fps; - switch (iniFile.value("fps", 0).toInt()) - { - default: - case 0: - fps = 0; - break; - case 30: - fps = 1; - break; - case 60: - fps = 2; - break; - case 120: - fps = 3; - break; - } - ui.cameraFPS->setCurrentIndex(fps); - ui.rx->setCheckState(iniFile.value("enable-rx", true).toBool() ? Qt::Checked : Qt::Unchecked); - ui.ry->setCheckState(iniFile.value("enable-ry", true).toBool() ? Qt::Checked : Qt::Unchecked); - ui.rz->setCheckState(iniFile.value("enable-rz", true).toBool() ? Qt::Checked : Qt::Unchecked); - ui.tx->setCheckState(iniFile.value("enable-tx", true).toBool() ? Qt::Checked : Qt::Unchecked); - ui.ty->setCheckState(iniFile.value("enable-ty", true).toBool() ? Qt::Checked : Qt::Unchecked); - ui.tz->setCheckState(iniFile.value("enable-tz", true).toBool() ? Qt::Checked : Qt::Unchecked); - ui.resolution->setCurrentIndex(iniFile.value("resolution", 0).toInt()); - - QDoubleSpinBox* headpos[] = { - ui.cx, - ui.cy, - ui.cz - }; - - for (int i = 0; i < 3; i++) - { - headpos[i]->setValue(iniFile.value(QString("headpos-%1").arg(i)).toDouble()); - } - - ui.pitch_deg->setValue(iniFile.value("pitch", 0).toDouble()); - ui.red_only->setChecked(iniFile.value("red-only", true).toBool()); - iniFile.endGroup(); - settingsDirty = false; -} - -void TrackerControls::save() -{ - QSettings settings("opentrack"); - QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); - - iniFile.beginGroup( "aruco-Tracker" ); - iniFile.setValue("fov", ui.cameraFOV->value()); - int fps; - switch (ui.cameraFPS->currentIndex()) - { - case 0: - default: - fps = 0; - break; - case 1: - fps = 30; - break; - case 2: - fps = 60; - break; - case 3: - fps = 120; - break; - } - iniFile.setValue("fps", fps); - iniFile.setValue("camera-index", ui.cameraName->currentIndex() - 1); - iniFile.setValue("enable-rx", ui.rx->checkState() != Qt::Unchecked ? true : false); - iniFile.setValue("enable-ry", ui.ry->checkState() != Qt::Unchecked ? true : false); - iniFile.setValue("enable-rz", ui.rz->checkState() != Qt::Unchecked ? true : false); - iniFile.setValue("enable-tx", ui.tx->checkState() != Qt::Unchecked ? true : false); - iniFile.setValue("enable-ty", ui.ty->checkState() != Qt::Unchecked ? true : false); - iniFile.setValue("enable-tz", ui.tz->checkState() != Qt::Unchecked ? true : false); - iniFile.setValue("resolution", ui.resolution->currentIndex()); - iniFile.setValue("pitch", ui.pitch_deg->value()); - - QDoubleSpinBox* headpos[] = { - ui.cx, - ui.cy, - ui.cz - }; - - for (int i = 0; i < 3; i++) - { - iniFile.setValue(QString("headpos-%1").arg(i), headpos[i]->value()); - } - iniFile.setValue("red-only", ui.red_only->isChecked()); - iniFile.endGroup(); - settingsDirty = false; - if (tracker) - tracker->load_settings(); + ui.cameraName->addItems(get_camera_names()); } void TrackerControls::doOK() { - save(); + s.b->save(); this->close(); } void TrackerControls::doCancel() { - if (settingsDirty) { + if (s.b->modifiedp()) { int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", - QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, - QMessageBox::Discard ); + QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel ); switch (ret) { case QMessageBox::Save: - save(); + s.b->save(); this->close(); break; case QMessageBox::Discard: + s.b->revert(); this->close(); break; case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; + break; } } else { diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 545ad5d0..23598f4d 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -18,6 +18,33 @@ #include #include #include +#include "facetracknoir/options.hpp" +using namespace options; + +struct settings { + pbundle b; + value fov, headpos_x, headpos_y, headpos_z; + value camera_index, force_fps, resolution; + value red_only; + value eyaw, epitch, eroll, ex, ey, ez; + settings() : + b(bundle("aruco-tracker")), + fov(b, "field-of-view", 56), + headpos_x(b, "headpos-x", 0), + headpos_y(b, "headpos-y", 0), + headpos_z(b, "headpos-z", 0), + camera_index(b, "camera-index", 0), + 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) + {} +}; class Tracker : protected QThread, public ITracker { @@ -27,22 +54,16 @@ public: virtual ~Tracker(); void StartTracker(QFrame* frame); void GetHeadPoseData(double *data); - bool enableTX, enableTY, enableTZ, enableRX, enableRY, enableRZ; void run(); - void load_settings(); private: QMutex mtx; - ArucoVideoWidget* videoWidget; - QHBoxLayout* layout; volatile bool stop; - float fov; - int camera_index; - int force_fps, force_width, force_height; + QHBoxLayout* layout; + ArucoVideoWidget* videoWidget; + settings s; double pose[6]; cv::Mat frame; - double headpos[3], headpitch; cv::VideoCapture camera; - volatile bool red_only; }; // Widget that has controls for FTNoIR protocol client-settings. @@ -50,32 +71,20 @@ class TrackerControls : public QWidget, public ITrackerDialog { Q_OBJECT public: - - explicit TrackerControls(); - virtual ~TrackerControls(); - void showEvent (QShowEvent *); - - void Initialize(QWidget *); + TrackerControls(); void registerTracker(ITracker * x) { tracker = dynamic_cast(x); } void unRegisterTracker() { tracker = nullptr; } - private: Ui::Form ui; - void loadSettings(); - void save(); - bool settingsDirty; Tracker* tracker; - + settings s; private slots: void doOK(); void doCancel(); - void settingChanged() { settingsDirty = true; } - void settingChanged(int) { settingsDirty = true; } - void settingChanged(double) { settingsDirty = true; } }; #endif diff --git a/ftnoir_tracker_base/ftnoir_tracker_base.h b/ftnoir_tracker_base/ftnoir_tracker_base.h index 16f76cf3..b8e16e9d 100644 --- a/ftnoir_tracker_base/ftnoir_tracker_base.h +++ b/ftnoir_tracker_base/ftnoir_tracker_base.h @@ -58,8 +58,7 @@ inline ITracker::~ITracker() { } struct ITrackerDialog { virtual ~ITrackerDialog() {} - virtual void Initialize(QWidget *parent) = 0; - virtual void registerTracker(ITracker *tracker) = 0; + virtual void registerTracker(ITracker *tracker) = 0; virtual void unRegisterTracker() = 0; }; diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp index 3547dd6b..6fef2db0 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp @@ -403,7 +403,6 @@ void FTNoIR_Tracker::GetHeadPoseData(THeadPoseData *data) CptError=0; return; } -#ifdef OPENTRACK_API data[frame_cnt] = (long) HAT.Code; struct Fun { @@ -446,39 +445,6 @@ void FTNoIR_Tracker::GetHeadPoseData(THeadPoseData *data) if (settings.InvertZ) data[TZ] = HAT.Trans[Fun::clamp3(settings.ZAxe)]* -1.0f; else data[TZ] = HAT.Trans[Fun::clamp3(settings.ZAxe)]; } -#else - data->frame_number = (long) HAT.Code; - - if (bEnableYaw) { - if (bInvertYaw ) data->yaw = (double) HAT.Rot[iYawAxe] * -1.0f; - else data->yaw = (double) HAT.Rot[iYawAxe]; - } - - if (bEnablePitch) { - if (bInvertPitch)data->pitch = (double) HAT.Rot[iPitchAxe] * -1.0f; - else data->pitch = (double) HAT.Rot[iPitchAxe]; - } - - if (bEnableRoll) { - if (bInvertRoll) data->roll = (double) HAT.Rot[iRollAxe] * -1.0f; - else data->roll = (double) HAT.Rot[iRollAxe]; - } - - if (bEnableX) { - if (bInvertX) data->x = (double) HAT.Trans[iXAxe]* -1.0f; - else data->x = (double) HAT.Trans[iXAxe]; - } - - if (bEnableY) { - if (bInvertY) data->y = (double) HAT.Trans[iYAxe]* -1.0f; - else data->y = (double) HAT.Trans[iYAxe]; - } - - if (bEnableZ) { - if (bInvertZ) data->z = (double) HAT.Trans[iZAxe]* -1.0f; - else data->z = (double) HAT.Trans[iZAxe]; - } -#endif } void FTNoIR_Tracker::applysettings(const TrackerSettings& settings){ diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h index a4243c38..57ead58d 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h @@ -27,15 +27,8 @@ public: FTNoIR_Tracker(); ~FTNoIR_Tracker(); -#ifdef OPENTRACK_API virtual void StartTracker(QFrame*); virtual void GetHeadPoseData(double* data); -#else - void Initialize( QFrame *videoframe ); - virtual void StartTracker(HWND parent_window); - virtual void StopTracker(bool exit); - virtual bool GetHeadPoseData(THeadPoseData *data); -#endif void applysettings(const TrackerSettings& settings); void notifyCenter(); bool notifyZeroed(); diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp index 0ef723c9..2ef75b89 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp @@ -146,24 +146,6 @@ TrackerControls::TrackerControls() : theTracker(NULL), timer(this) connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); } -// -// Destructor for server-dialog -// -TrackerControls::~TrackerControls() { -} - -// -// Initialize tracker-client-dialog -// -void TrackerControls::Initialize(QWidget *parent) { - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - - // // Center asked to ARDUINO // diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h index 82c69e0d..fe16e5e8 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h @@ -21,8 +21,6 @@ class TrackerControls: public QWidget, public ITrackerDialog Q_OBJECT public: explicit TrackerControls(); - virtual ~TrackerControls(); - void Initialize(QWidget *parent) virt_override; void registerTracker(ITracker *tracker) virt_override; void unRegisterTracker() virt_override; private: @@ -30,7 +28,7 @@ private: FTNoIR_Tracker *theTracker; QTime last_time; -public slots: +public slots: void WriteMsgInfo(const QByteArray &MsgInfo); protected slots: diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index e154557e..1773b018 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -275,11 +275,6 @@ TrackerControls::TrackerControls() connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); } -void TrackerControls::Initialize(QWidget*) -{ - show(); -} - void TrackerControls::doOK() { s.b->save(); diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h index f45e54f9..b3c89136 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h @@ -62,7 +62,6 @@ class TrackerControls : public QWidget, public ITrackerDialog Q_OBJECT public: explicit TrackerControls(); - void Initialize(QWidget *); void registerTracker(ITracker *) {} void unRegisterTracker() {} diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h index 16629c3a..8d91dfbb 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h @@ -45,7 +45,6 @@ class TrackerControls: public QWidget, public ITrackerDialog Q_OBJECT public: explicit TrackerControls(); - void Initialize(QWidget *parent); void registerTracker(ITracker *) {} void unRegisterTracker() {} private: diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp index e92180a3..4a2deb9f 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp @@ -18,15 +18,6 @@ QWidget() tie_setting(s.bEnableZ, ui.chkEnableZ); } -void TrackerControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - void TrackerControls::doOK() { s.b->save(); this->close(); diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h index 9c856d85..67291e6f 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h @@ -62,11 +62,7 @@ class TrackerControls: public QWidget, public ITrackerDialog { Q_OBJECT public: - explicit TrackerControls(); - ~TrackerControls(); - void showEvent (QShowEvent *); - - void Initialize(QWidget *parent); + TrackerControls(); void registerTracker(ITracker *foo) { tracker = dynamic_cast(foo); } diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp index af3613d9..42ca8689 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp @@ -50,29 +50,11 @@ fin: loadSettings(); } -// -// Destructor for server-dialog -// -TrackerControls::~TrackerControls() { -} - -void TrackerControls::Initialize(QWidget *parent) { - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - void TrackerControls::doOK() { save(); this->close(); } -void TrackerControls::showEvent ( QShowEvent * ) { - loadSettings(); -} - void TrackerControls::doCancel() { if (settingsDirty) { int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard ); diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index e10db0bf..b548db71 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -26,8 +26,6 @@ Rift_Tracker::~Rift_Tracker() System::Destroy(); } - - void Rift_Tracker::StartTracker(QFrame*) { System::Init(Log::ConfigureDefaultLog(LogMask_All)); diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index 80bf6ffa..b1f96bf2 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -55,7 +55,6 @@ class TrackerControls: public QWidget, public ITrackerDialog public: explicit TrackerControls(); - void Initialize(QWidget *parent); void registerTracker(ITracker *) {} void unRegisterTracker() {} diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp index 5487da92..763ddd11 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp @@ -20,15 +20,6 @@ QWidget() tie_setting(s.useYawSpring, ui.yawSpring); } -void TrackerControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - void TrackerControls::doOK() { s.b->save(); this->close(); diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.h b/ftnoir_tracker_udp/ftnoir_tracker_udp.h index c7e9decf..7157f064 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.h +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.h @@ -49,9 +49,6 @@ public: explicit TrackerControls(); ~TrackerControls(); - void showEvent (QShowEvent *); - - void Initialize(QWidget *parent); void registerTracker(ITracker *) {} void unRegisterTracker() {} diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp index e17d5c32..707abf37 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp @@ -60,34 +60,11 @@ TrackerControls::~TrackerControls() { qDebug() << "~TrackerControls() says: started"; } -// -// Initialize tracker-client-dialog -// -void TrackerControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - -// -// OK clicked on server-dialog -// void TrackerControls::doOK() { save(); this->close(); } -// override show event -void TrackerControls::showEvent ( QShowEvent * ) { - loadSettings(); -} - -// -// Cancel clicked on server-dialog -// void TrackerControls::doCancel() { // // Ask if changed Settings should be saved -- cgit v1.2.3 From f32f731518ffe2a2b3f7463eda6cf01b7e09eab3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 31 Dec 2013 08:43:51 +0100 Subject: resize and cleanup aruco ui --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 256 ++++++++++++-------------- 1 file changed, 122 insertions(+), 134 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 710a33e1..3bf141de 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -9,12 +9,12 @@ 0 0 - 704 - 339 + 630 + 315 - + 0 0 @@ -32,78 +32,8 @@ -1 - - - - Horizontal FOV - - - - - - - Enable axes - - - - -1 - - - 6 - - - 0 - - - 6 - - - 0 - - - - - RX - - - - - - - TX - - - - - - - RY - - - - - - - TY - - - - - - - RZ - - - - - - - TZ - - - - - + + @@ -112,9 +42,6 @@ - - - @@ -131,6 +58,20 @@ + + + + Recommended! + + + + + + + Camera name + + + @@ -155,13 +96,6 @@ - - - - Resolution - - - @@ -193,13 +127,6 @@ - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - @@ -224,39 +151,109 @@ - - + + - Camera name + Red channel only - - + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + - Red channel only + Horizontal FOV - - + + - Recommended! + Resolution - + + + + Enable axes + + + + -1 + + + 6 + + + 0 + + + 6 + + + 0 + + + + + RX + + + + + + + TX + + + + + + + RY + + + + + + + TY + + + + + + + RZ + + + + + + + TZ + + + + + + + - Head centroid position + Head position Qt::AlignCenter - - - Qt::AlignHCenter|Qt::AlignTop - + @@ -266,6 +263,12 @@ + + + 0 + 0 + + -200.000000000000000 @@ -283,6 +286,12 @@ + + + 0 + 0 + + -200.000000000000000 @@ -300,6 +309,12 @@ + + + 0 + 0 + + -200.000000000000000 @@ -308,32 +323,6 @@ - - - - Pitch - - - - - - - ° - - - 2 - - - -60.000000000000000 - - - 60.000000000000000 - - - 0.000000000000000 - - - @@ -347,7 +336,6 @@ cx cy cz - pitch_deg rx ry rz -- cgit v1.2.3 From 77412f01c387ffce47d42bcaad3cf26816591350 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 31 Dec 2013 12:41:12 +0100 Subject: finish rename --- FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h | 2 +- facetracknoir/facetracknoir.h | 2 +- facetracknoir/main-settings.hpp | 2 +- facetracknoir/tracker.h | 2 +- ftnoir_filter_accela/ftnoir_filter_accela.h | 2 +- ftnoir_filter_ewma2/ftnoir_filter_ewma2.h | 2 +- ftnoir_filter_kalman/ftnoir_filter_kalman.h | 2 +- ftnoir_protocol_fg/ftnoir_protocol_fg.h | 2 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 2 +- ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h | 2 +- ftnoir_tracker_ht/ftnoir_tracker_ht.h | 2 +- ftnoir_tracker_hydra/ftnoir_tracker_hydra.h | 2 +- ftnoir_tracker_rift/ftnoir_tracker_rift.h | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h index 8c590db2..a828ea48 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h @@ -11,7 +11,7 @@ #include #include "point_tracker.h" -#include "facetracknoir/options.hpp" +#include "facetracknoir/options.h" using namespace options; struct settings diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index b1279697..53b83754 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -51,7 +51,7 @@ #include "ui_facetracknoir.h" -#include "facetracknoir/options.hpp" +#include "facetracknoir/options.h" using namespace options; #include "facetracknoir/main-settings.hpp" diff --git a/facetracknoir/main-settings.hpp b/facetracknoir/main-settings.hpp index 05c75398..c9b5ff66 100644 --- a/facetracknoir/main-settings.hpp +++ b/facetracknoir/main-settings.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "facetracknoir/options.hpp" +#include "facetracknoir/options.h" using namespace options; struct key_opts { diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h index b671ac7c..404a8f24 100644 --- a/facetracknoir/tracker.h +++ b/facetracknoir/tracker.h @@ -17,7 +17,7 @@ #include #include "tracker_types.h" #include "facetracknoir/main-settings.hpp" -#include "facetracknoir/options.hpp" +#include "facetracknoir/options.h" using namespace options; class FaceTrackNoIR; // pre-define parent-class to avoid circular includes diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index 1aaa039f..e8f077c3 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -10,7 +10,7 @@ #define ACCELA_SECOND_ORDER_ALPHA 100.0 #define ACCELA_THIRD_ORDER_ALPHA 180.0 -#include "facetracknoir/options.hpp" +#include using namespace options; struct settings { diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h index 6e9a7f9a..e50a4284 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h @@ -31,7 +31,7 @@ #include "ui_ftnoir_ewma_filtercontrols.h" #include #include -#include "facetracknoir/options.hpp" +#include "facetracknoir/options.h" using namespace options; struct settings { diff --git a/ftnoir_filter_kalman/ftnoir_filter_kalman.h b/ftnoir_filter_kalman/ftnoir_filter_kalman.h index 8f5bcd8b..25f0a0ad 100644 --- a/ftnoir_filter_kalman/ftnoir_filter_kalman.h +++ b/ftnoir_filter_kalman/ftnoir_filter_kalman.h @@ -21,7 +21,7 @@ #include #include #include -#include "facetracknoir/options.hpp" +#include "facetracknoir/options.h" using namespace options; class FTNOIR_FILTER_BASE_EXPORT FTNoIR_Filter : public IFilter diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.h b/ftnoir_protocol_fg/ftnoir_protocol_fg.h index 13aaeab4..dca1f245 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg.h +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.h @@ -33,7 +33,7 @@ #include #include #include "facetracknoir/global-settings.h" -#include "facetracknoir/options.hpp" +#include "facetracknoir/options.h" using namespace options; struct settings { diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 23598f4d..2ff40c77 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -18,7 +18,7 @@ #include #include #include -#include "facetracknoir/options.hpp" +#include "facetracknoir/options.h" using namespace options; struct settings { diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h index 8739394f..4c0fcb8d 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h @@ -8,7 +8,7 @@ #pragma once #include -#include "facetracknoir/options.hpp" +#include "facetracknoir/options.h" #include using namespace options; diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h index b3c89136..583249dc 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h @@ -15,7 +15,7 @@ #include "ht_video_widget.h" #include "compat/compat.h" #include -#include "facetracknoir/options.hpp" +#include "facetracknoir/options.h" using namespace options; struct settings { diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h index 8d91dfbb..e569efab 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h @@ -5,7 +5,7 @@ #include #include #include "facetracknoir/global-settings.h" -#include "facetracknoir/options.hpp" +#include "facetracknoir/options.h" using namespace options; struct settings { diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index b1f96bf2..dd673308 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -8,7 +8,7 @@ #include "facetracknoir/global-settings.h" #include "OVR.h" #include -#include "facetracknoir/options.hpp" +#include "facetracknoir/options.h" using namespace options; struct settings { -- cgit v1.2.3 From f998dc6ce88d8439e5e6ec9e506bd82255ef71f7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 2 Jan 2014 07:17:45 +0100 Subject: add missing resolution forcing --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index a0a11ed2..651f7dbf 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -441,6 +441,7 @@ TrackerControls::TrackerControls() ui.setupUi(this); setAttribute(Qt::WA_NativeWindow, true); tie_setting(s.camera_index, ui.cameraName); + 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); -- cgit v1.2.3 From fba587185e077cf6ed4b37d213553f87e3b859cb Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 2 Jan 2014 08:07:03 +0100 Subject: fix bad fps copy-paste-o --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 651f7dbf..ff7821fd 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -146,16 +146,16 @@ void Tracker::run() { default: case 0: - fps = 0; + fps = 30; break; - case 30: - fps = 1; + case 1: + fps = 60; break; - case 60: - fps = 2; + case 2: + fps = 120; break; - case 120: - fps = 3; + case 3: + fps = 0; break; } camera = cv::VideoCapture(s.camera_index); -- cgit v1.2.3 From 1a95a291666f82d15fc1fe6e91803d3a71816883 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 2 Jan 2014 16:35:45 +0100 Subject: align offsets with combobox entries --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index ff7821fd..b4f35c6f 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -146,16 +146,16 @@ void Tracker::run() { default: case 0: - fps = 30; + fps = 0; break; case 1: - fps = 60; + fps = 30; break; case 2: - fps = 120; + fps = 60; break; case 3: - fps = 0; + fps = 120; break; } camera = cv::VideoCapture(s.camera_index); -- cgit v1.2.3 From 4bef8ec6aebad1b709efd7393cb9f4a63b28ebf3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 4 Jan 2014 13:44:39 +0100 Subject: allow aruco to run at 180 hz --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 9 +++++++-- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 3bf141de..3f5a1d2a 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -30,7 +30,7 @@ - -1 + 7 @@ -94,6 +94,11 @@ 120 + + + 180 + + @@ -186,7 +191,7 @@ - -1 + 7 6 diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index b4f35c6f..136a983a 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -157,6 +157,9 @@ void Tracker::run() case 3: fps = 120; break; + case 4: + fps = 180; + break; } camera = cv::VideoCapture(s.camera_index); if (r.width) -- cgit v1.2.3 From be2911f415bd63e248476ebf9012fb4573a90dd7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 4 Jan 2014 14:14:34 +0100 Subject: correct focal length equation --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 136a983a..19413e2f 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -212,8 +212,8 @@ void Tracker::run() const int scale = frame.cols > 480 ? 2 : 1; detector.setThresholdParams(scale > 1 ? 11 : 7, 4); - const float focal_length_w = 0.5 * grayscale.cols / tan(0.5 * s.fov * HT_PI / 180); - const float focal_length_h = 0.5 * grayscale.rows / tan(0.5 * s.fov * grayscale.rows / grayscale.cols * HT_PI / 180.0); + const float focal_length_w = 0.5 * grayscale.cols / tan(s.fov * HT_PI / 180); + const float focal_length_h = 0.5 * grayscale.rows / tan(s.fov * grayscale.rows / grayscale.cols * HT_PI / 180.0); cv::Mat intrinsics = cv::Mat::eye(3, 3, CV_32FC1); intrinsics.at (0, 0) = focal_length_w; intrinsics.at (1, 1) = focal_length_h; -- cgit v1.2.3 From ca76154afd3157bfb1d1f65082cb43a12c234547 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 4 Jan 2014 19:40:56 +0100 Subject: allow for changing centroid while software's running --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 ++++ ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 1 + 2 files changed, 5 insertions(+) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 19413e2f..50496ed7 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -465,6 +465,8 @@ TrackerControls::TrackerControls() void TrackerControls::doOK() { s.b->save(); + if (tracker) + tracker->reload(); this->close(); } @@ -480,6 +482,8 @@ void TrackerControls::doCancel() case QMessageBox::Save: s.b->save(); this->close(); + if (tracker) + tracker->reload(); break; case QMessageBox::Discard: s.b->revert(); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 2ff40c77..91a5ae8e 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -55,6 +55,7 @@ public: void StartTracker(QFrame* frame); void GetHeadPoseData(double *data); void run(); + void reload() { s.b->reload(); } private: QMutex mtx; volatile bool stop; -- cgit v1.2.3 From 449625118b3d28baabcdb001595a7dec2f8e3593 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 5 Jan 2014 13:02:52 +0100 Subject: remove settings dialog copypasted all over, losing functionality --- FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp | 25 ++---------------- facetracknoir/curve-config.cpp | 28 ++------------------ facetracknoir/shortcuts.cpp | 27 ++----------------- .../ftnoir_filter_accela_dialog.cpp | 27 ++----------------- ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp | 27 ++----------------- ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp | 23 ++--------------- .../ftnoir_protocol_fsuipc_dialog.cpp | 24 ++--------------- ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp | 30 ++-------------------- ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp | 21 ++------------- .../ftnoir_protocol_mouse_dialog.cpp | 26 ++----------------- ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp | 22 ++-------------- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 26 ++----------------- .../ftnoir_tracker_hat_dialog.cpp | 27 ++----------------- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 25 ++---------------- .../ftnoir_tracker_hydra_dialog.cpp | 26 ++----------------- .../ftnoir_tracker_joystick_dialog.cpp | 27 ++----------------- ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp | 24 ++--------------- ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp | 24 ++--------------- 18 files changed, 36 insertions(+), 423 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp index 06f7b2c6..c103b78c 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp @@ -225,29 +225,8 @@ void TrackerDialog::doApply() void TrackerDialog::doCancel() { - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", - QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard ); - switch (ret) { - case QMessageBox::Save: - save(); - close(); - break; - case QMessageBox::Discard: - s.b->revert(); - close(); - break; - case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; - } - } - else { - close(); - } + s.b->revert(); + close(); } void TrackerDialog::widget_destroyed(QObject* obj) diff --git a/facetracknoir/curve-config.cpp b/facetracknoir/curve-config.cpp index b01c2013..f5ed6aa7 100644 --- a/facetracknoir/curve-config.cpp +++ b/facetracknoir/curve-config.cpp @@ -49,32 +49,8 @@ void CurveConfigurationDialog::doOK() { } void CurveConfigurationDialog::doCancel() { - // - // Ask if changed Settings should be saved - // - if (settingsDirty || mainApp->s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard ); - - switch (ret) { - case QMessageBox::Save: - save(); - this->close(); - break; - case QMessageBox::Discard: - mainApp->s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; - } - } - else { - this->close(); - } + mainApp->b->revert(); + close(); } // diff --git a/facetracknoir/shortcuts.cpp b/facetracknoir/shortcuts.cpp index 2f117ea4..a905be57 100644 --- a/facetracknoir/shortcuts.cpp +++ b/facetracknoir/shortcuts.cpp @@ -42,31 +42,8 @@ void KeyboardShortcutDialog::doOK() { } void KeyboardShortcutDialog::doCancel() { - // - // Ask if changed Settings should be saved - // - if (mainApp->b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - - qDebug() << "doCancel says: answer =" << ret; - - switch (ret) { - case QMessageBox::Save: - mainApp->b->save(); - this->close(); - break; - case QMessageBox::Discard: - mainApp->b->revert(); - close(); - break; - case QMessageBox::Cancel: - default: - break; - } - } - else { - this->close(); - } + mainApp->b->revert(); + close(); } #if defined(_WIN32) diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp index 6d1ad384..56b76a55 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp @@ -36,33 +36,10 @@ void FilterControls::doOK() { } void FilterControls::doCancel() { - if (!s.b->modifiedp()) - { - close(); - return; - } - int ret = - QMessageBox::question( this, - "Settings have changed", - "Do you want to save the settings?", - QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - - switch (ret) { - case QMessageBox::Save: - save(); - this->close(); - break; - case QMessageBox::Discard: - this->discard(); - this->close(); - break; - case QMessageBox::Cancel: - default: - break; - } + discard(); + close(); } - void FilterControls::discard() { s.b->revert(); diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp index 7ab2b09c..395d1058 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp @@ -57,31 +57,8 @@ void FilterControls::doOK() { } void FilterControls::doCancel() { - // - // Ask if changed Settings should be saved - // - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - - qDebug() << "doCancel says: answer =" << ret; - - switch (ret) { - case QMessageBox::Save: - save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - default: - break; - } - } - else { - this->close(); - } + s.b->revert(); + this->close(); } void FilterControls::save() { diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp index 887020c5..1c3e5ef8 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp @@ -59,27 +59,8 @@ void FGControls::doOK() { } void FGControls::doCancel() { - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel ); - switch (ret) { - case QMessageBox::Save: - s.b->save(); - if (theProtocol) - theProtocol->reloadSettings(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - close(); - break; - case QMessageBox::Cancel: - default: - break; - } - } - else { - this->close(); - } + s.b->revert(); + this->close(); } extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp index bae3d5df..d97cff99 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp @@ -42,28 +42,8 @@ void FSUIPCControls::doOK() { } void FSUIPCControls::doCancel() { - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard ); - - qDebug() << "doCancel says: answer =" << ret; - - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - default: - break; - } - } - else { - this->close(); - } + s.b->revert(); + close(); } void FSUIPCControls::getLocationOfDLL() diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp index b414561d..7f070857 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp @@ -69,34 +69,8 @@ void FTControls::doOK() { } void FTControls::doCancel() { - // - // Ask if changed Settings should be saved - // - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - - qDebug() << "doCancel says: answer =" << ret; - - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; - } - } - else { - this->close(); - } + s.b->revert(); + this->close(); } void FTControls::selectDLL() { diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp index ce4b3cb0..37db314f 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp @@ -52,25 +52,8 @@ void FTNControls::doOK() { // Cancel clicked on server-dialog // void FTNControls::doCancel() { - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - default: - break; - } - } - else { - this->close(); - } + s.b->revert(); + this->close(); } extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp index cc62b004..22b7024c 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp @@ -59,30 +59,8 @@ void MOUSEControls::doOK() { } void MOUSEControls::doCancel() { - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - - qDebug() << "doCancel says: answer =" << ret; - - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - if (_proto) - _proto->reload(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - default: - break; - } - } - else { - this->close(); - } + s.b->revert(); + this->close(); } extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp index 6af87285..c7428d77 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp @@ -44,26 +44,8 @@ void SCControls::doOK() { } void SCControls::doCancel() { - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - default: - break; - } - } - else { - this->close(); - } + s.b->revert(); + close(); } extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 50496ed7..2edac4a2 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -472,28 +472,6 @@ void TrackerControls::doOK() void TrackerControls::doCancel() { - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, - "Settings have changed", - "Do you want to save the settings?", - QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel ); - - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - if (tracker) - tracker->reload(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - break; - } - } - else { - this->close(); - } + s.b->revert(); + this->close(); } diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp index 2ef75b89..83548966 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp @@ -238,31 +238,8 @@ void TrackerControls::doOK() { // Cancel clicked on server-dialog // void TrackerControls::doCancel() { - // - // Ask if changed Settings should be saved - // - if (settings.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - switch (ret) { - case QMessageBox::Save: - settings.b->save(); - close(); - break; - case QMessageBox::Discard: - settings.b->revert(); - close(); - break; - case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; - } - } - else { - close(); - } + settings.b->revert(); + close(); } diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 5fced44e..4ce56acc 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -286,27 +286,6 @@ void TrackerControls::doOK() void TrackerControls::doCancel() { - if (!s.b->modifiedp()) - { - close(); - return; - } - int ret = QMessageBox::question ( this, - "Settings have changed", - "Do you want to save the settings?", - QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - default: - case QMessageBox::Cancel: - break; - } + s.b->revert(); + this->close(); } diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp index 4a2deb9f..14be2c37 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp @@ -24,30 +24,8 @@ void TrackerControls::doOK() { } void TrackerControls::doCancel() { - if (!s.b->modifiedp()) - { - close(); - return; - } - int ret = QMessageBox::question (this, - "Settings have changed", - "Do you want to save the settings?", - QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - default: - case QMessageBox::Cancel: - // Cancel was clicked - break; - } + s.b->revert(); + close(); } extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp index a089385f..b0766634 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp @@ -56,31 +56,8 @@ void TrackerControls::doOK() { } void TrackerControls::doCancel() { - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel ); - - switch (ret) { - case QMessageBox::Save: - s.b->save(); - if (tracker) - tracker->reload(); - this->close(); - break; - case QMessageBox::Discard: - s.b->reload(); - this->close(); - break; - case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; - } - } - else { - this->close(); - } + s.b->revert(); + this->close(); } extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp index 763ddd11..ad532100 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp @@ -26,28 +26,8 @@ void TrackerControls::doOK() { } void TrackerControls::doCancel() { - // - // Ask if changed Settings should be saved - // - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - default: - break; - } - } - else { - this->close(); - } + s.b->revert(); + close(); } extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp index 59026288..8d1b99f2 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp @@ -48,28 +48,8 @@ void TrackerControls::doOK() { } void TrackerControls::doCancel() { - if (s.b->modifiedp()) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - switch (ret) { - case QMessageBox::Save: - s.b->save(); - this->close(); - break; - case QMessageBox::Discard: - s.b->revert(); - this->close(); - break; - case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; - } - } - else { - this->close(); - } + s.b->revert(); + this->close(); } extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) -- cgit v1.2.3 From 53b62eb2c7c8ffea2baecbb8e663a3c590604174 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 5 Jan 2014 19:13:30 +0100 Subject: guard against win32 cruft inclusion --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 2edac4a2..70c82c52 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -18,6 +18,7 @@ #include #if defined(_WIN32) +#define NOMINMAX # define NO_DSHOW_STRSAFE # include #else -- cgit v1.2.3 From 5f14d59ba285c72682e99c0fb95310f5920898de Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 6 Jan 2014 15:35:29 +0100 Subject: optimize existing pose when it makes sense --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 70c82c52..9c8cd52b 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -195,6 +195,7 @@ void Tracker::run() int cur_fps = 0; int last_fps = 0; cv::Point2f last_centroid; + bool first = true, pitch_sign = true; while (!stop) { @@ -318,7 +319,9 @@ void Tracker::run() last_roi.height = std::min(grayscale.rows - last_roi.y, last_roi.height); } - cv::solvePnP(obj_points, m, intrinsics, dist_coeffs, rvec, tvec, false, cv::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); @@ -329,6 +332,12 @@ void Tracker::run() { cv::Vec3d euler = cv::RQDecomp3x3(rotation_matrix, junk1, junk2); + if ((euler[0] > 0) != pitch_sign) + { + first = true; + pitch_sign = euler[0] > 0; + } + QMutexLocker lck(&mtx); for (int i = 0; i < 3; i++) @@ -354,6 +363,7 @@ void Tracker::run() else { last_roi = cv::Rect(65535, 65535, 0, 0); + first = true; } if (frame.rows > 0) -- cgit v1.2.3 From 55b133b78752137e05aa1437fbe9db83a7324d85 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 6 Jan 2014 17:47:19 +0100 Subject: aruco: allow for changing marker pitch --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 326 ++++++++++++++------------ ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 21 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 4 +- 3 files changed, 189 insertions(+), 162 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 3f5a1d2a..e699eccc 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -32,158 +32,6 @@ 7 - - - - - - - Frames per second - - - - - - - - - - 35.000000000000000 - - - 180.000000000000000 - - - 52.000000000000000 - - - - - - - Recommended! - - - - - - - Camera name - - - - - - - - Default - - - - - 30 - - - - - 60 - - - - - 120 - - - - - 180 - - - - - - - - - 0 - 0 - - - - <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> - - - Qt::RichText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - 4 - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 640x480 - - - - - 320x240 - - - - - 320x200 - - - - - Default (not recommended!) - - - - - - - - Red channel only - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - Horizontal FOV - - - - - - - Resolution - - - @@ -250,7 +98,7 @@ - + Head position @@ -331,6 +179,175 @@ + + + + + + + + + + 35.000000000000000 + + + 180.000000000000000 + + + 52.000000000000000 + + + + + + + Recommended! + + + + + + + Frames per second + + + + + + + + 0 + 0 + + + + <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> + + + Qt::RichText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + 4 + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + Default + + + + + 30 + + + + + 60 + + + + + 120 + + + + + 180 + + + + + + + + + 640x480 + + + + + 320x240 + + + + + 320x200 + + + + + Default (not recommended!) + + + + + + + + Camera name + + + + + + + Red channel only + + + + + + + Horizontal FOV + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + Resolution + + + + + + + Marker pitch + + + + + + + -180.000000000000000 + + + 180.000000000000000 + + + @@ -338,6 +355,8 @@ cameraFPS cameraName resolution + red_only + marker_pitch cx cy cz @@ -347,6 +366,7 @@ tx ty tz + buttonBox diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 9c8cd52b..776d443a 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -282,19 +282,23 @@ void Tracker::run() const aruco::Marker& m = markers.at(0); const float size = 7; + 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(1,0)=-size + s.headpos_x; - obj_points.at(1,1)=-size + s.headpos_y; - obj_points.at(1,2)=0 + s.headpos_z; + obj_points.at(1,1)=-size * cq + s.headpos_y; + obj_points.at(1,2)=-size * sq + s.headpos_z; obj_points.at(2,0)=size + s.headpos_x; - obj_points.at(2,1)=-size + s.headpos_y; - obj_points.at(2,2)=0 + s.headpos_z; + obj_points.at(2,1)=-size * cq + s.headpos_y; + obj_points.at(2,2)=-size * sq + s.headpos_z; obj_points.at(3,0)=size + s.headpos_x; - obj_points.at(3,1)=size + s.headpos_y; - obj_points.at(3,2)=0 + s.headpos_z; + obj_points.at(3,1)=size * cq + s.headpos_y; + obj_points.at(3,2)=size * sq + s.headpos_z; obj_points.at(0,0)=-size + s.headpos_x; - obj_points.at(0,1)=size + s.headpos_y; - obj_points.at(0,2)=0 + s.headpos_z; + obj_points.at(0,1)=size * cq + s.headpos_y; + obj_points.at(0,2)=size * sq + s.headpos_z; last_roi = cv::Rect(65535, 65535, 0, 0); @@ -468,6 +472,7 @@ 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())); ui.cameraName->addItems(get_camera_names()); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 91a5ae8e..4cab84b5 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -27,6 +27,7 @@ struct settings { value camera_index, force_fps, resolution; value red_only; value eyaw, epitch, eroll, ex, ey, ez; + value marker_pitch; settings() : b(bundle("aruco-tracker")), fov(b, "field-of-view", 56), @@ -42,7 +43,8 @@ struct settings { eroll(b, "enable-r", true), ex(b, "enable-x", true), ey(b, "enable-y", true), - ez(b, "enable-z", true) + ez(b, "enable-z", true), + marker_pitch(b, "marker-pitch", 0) {} }; -- cgit v1.2.3 From 2a7bb33871dee1124dd1956fe14503845e8cee3f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 6 Jan 2014 23:45:43 +0100 Subject: aruco: allow for perfect fisheye correction --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 455 +++++++++++++------------- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 18 +- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 4 +- 3 files changed, 249 insertions(+), 228 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index e699eccc..7dadb58c 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -10,7 +10,7 @@ 0 0 630 - 315 + 326 @@ -32,169 +32,42 @@ 7 - - - - Enable axes - - - - 7 + + + + + + + + Default - - 6 + + + + 30 - - 0 + + + + 60 - - 6 + + + + 120 - - 0 + + + + 180 - - - - RX - - - - - - - TX - - - - - - - RY - - - - - - - TY - - - - - - - RZ - - - - - - - TZ - - - - - - - - - - Head position - - - Qt::AlignCenter - - - - - - TX - - - - - - - - 0 - 0 - - - - -200.000000000000000 - - - 200.000000000000000 - - - - - - - TY - - - - - - - - 0 - 0 - - - - -200.000000000000000 - - - 200.000000000000000 - - - - - - - TZ - - - - - - - - 0 - 0 - - - - -200.000000000000000 - - - 200.000000000000000 - - - - + - - - - - - - - - - 35.000000000000000 - - - 180.000000000000000 - - - 52.000000000000000 + + + + Frames per second @@ -205,14 +78,7 @@ - - - - Frames per second - - - - + @@ -243,33 +109,41 @@ - - - - - Default - - - - - 30 - - - - - 60 - - - - - 120 - - - - - 180 - - + + + + + + + 35.000000000000000 + + + 180.000000000000000 + + + 52.000000000000000 + + + + + + + Camera name + + + + + + + Red channel only + + + + + + + Horizontal FOV + @@ -296,28 +170,7 @@ - - - - Camera name - - - - - - - Red channel only - - - - - - - Horizontal FOV - - - - + QDialogButtonBox::Cancel|QDialogButtonBox::Ok @@ -331,6 +184,16 @@ + + + + -180.000000000000000 + + + 180.000000000000000 + + + @@ -338,13 +201,164 @@ - - - - -180.000000000000000 + + + + Head position - - 180.000000000000000 + + Qt::AlignCenter + + + + + + TY + + + + + + + TX + + + + + + + + 0 + 0 + + + + -200.000000000000000 + + + 200.000000000000000 + + + + + + + TZ + + + + + + + + 0 + 0 + + + + -200.000000000000000 + + + 200.000000000000000 + + + + + + + + 0 + 0 + + + + -200.000000000000000 + + + 200.000000000000000 + + + + + + + + + + Enable axes + + + + 7 + + + 6 + + + 0 + + + 6 + + + 0 + + + + + RX + + + + + + + TX + + + + + + + RY + + + + + + + TY + + + + + + + RZ + + + + + + + TZ + + + + + + + + + + Check if yaw/X interconnect + + + + + + + Fisheye correction @@ -357,6 +371,7 @@ resolution red_only marker_pitch + fisheye_correction cx cy cz diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 776d443a..67c88e3e 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -18,7 +18,8 @@ #include #if defined(_WIN32) -#define NOMINMAX +# undef NOMINMAX +# define NOMINMAX # define NO_DSHOW_STRSAFE # include #else @@ -322,17 +323,13 @@ void Tracker::run() last_roi.width = std::min(grayscale.cols - last_roi.x, last_roi.width); last_roi.height = std::min(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::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); - cv::Rodrigues(rvec, rotation_matrix); - + { cv::Vec3d euler = cv::RQDecomp3x3(rotation_matrix, junk1, junk2); @@ -350,6 +347,12 @@ void Tracker::run() pose[Yaw] = euler[1]; pose[Pitch] = -euler[0]; pose[Roll] = euler[2]; + + if (s.fisheye_correction) + { + pose[Yaw] -= atan(pose[TX] / pose[TZ]) * 180 / HT_PI; + pose[Pitch] -= atan(pose[TY] / pose[TZ]) * 180 / HT_PI; + } } std::vector repr2; @@ -473,6 +476,7 @@ TrackerControls::TrackerControls() tie_setting(s.headpos_z, ui.cz); tie_setting(s.red_only, ui.red_only); tie_setting(s.marker_pitch, ui.marker_pitch); + tie_setting(s.fisheye_correction, ui.fisheye_correction); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); ui.cameraName->addItems(get_camera_names()); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 4cab84b5..e32e304a 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -28,6 +28,7 @@ struct settings { value red_only; value eyaw, epitch, eroll, ex, ey, ez; value marker_pitch; + value fisheye_correction; settings() : b(bundle("aruco-tracker")), fov(b, "field-of-view", 56), @@ -44,7 +45,8 @@ struct settings { ex(b, "enable-x", true), ey(b, "enable-y", true), ez(b, "enable-z", true), - marker_pitch(b, "marker-pitch", 0) + marker_pitch(b, "marker-pitch", 0), + fisheye_correction(b, "fisheye-correction", false) {} }; -- cgit v1.2.3 From f5496ba4712f16244b8ab8dc90253e19ef1ad54f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 6 Jan 2014 23:51:31 +0100 Subject: treat pitch delta +- 60 as breakage, instead of sign change --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 67c88e3e..bb4ca96f 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -196,7 +196,9 @@ void Tracker::run() int cur_fps = 0; int last_fps = 0; cv::Point2f last_centroid; - bool first = true, pitch_sign = true; + const double pitch_eps = 60; + double last_pitch = 0; + bool first = true; while (!stop) { @@ -333,10 +335,11 @@ void Tracker::run() { cv::Vec3d euler = cv::RQDecomp3x3(rotation_matrix, junk1, junk2); - if ((euler[0] > 0) != pitch_sign) + if (fabs(euler[0] - last_pitch) > pitch_eps) { first = true; - pitch_sign = euler[0] > 0; + last_pitch = euler[0]; + qDebug() << "reset levmarq due to pitch breakage"; } QMutexLocker lck(&mtx); -- cgit v1.2.3 From 1f258153f00ed0427a77077775274acd17a9fbe4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 6 Jan 2014 23:52:39 +0100 Subject: resize --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 7dadb58c..59d3f69c 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -9,8 +9,8 @@ 0 0 - 630 - 326 + 615 + 353 -- cgit v1.2.3 From a7ea46dca6e791b1c6785e270b5d6fbe42f449dc Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 7 Jan 2014 07:29:00 +0100 Subject: reduce pitch reset thres to 45 deg --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index bb4ca96f..0719faac 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -196,7 +196,7 @@ void Tracker::run() int cur_fps = 0; int last_fps = 0; cv::Point2f last_centroid; - const double pitch_eps = 60; + const double pitch_eps = 45; double last_pitch = 0; bool first = true; -- cgit v1.2.3 From cc4e7e331ba24b260edc44db8b09de274cd658a7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 7 Jan 2014 09:00:57 +0100 Subject: pose breaks with negative pitch --- FTNoIR_Tracker_PT/point_tracker.cpp | 4 ++-- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/FTNoIR_Tracker_PT/point_tracker.cpp b/FTNoIR_Tracker_PT/point_tracker.cpp index 8b508897..dfefdaf8 100644 --- a/FTNoIR_Tracker_PT/point_tracker.cpp +++ b/FTNoIR_Tracker_PT/point_tracker.cpp @@ -267,8 +267,8 @@ int PointTracker::POSIT(float f) // initial pose = last (predicted) pose Vec3f k; - get_row(X_CM.R, 2, k); - float Z0 = X_CM.t[2]; + 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; diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 0719faac..93b43de7 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -335,7 +335,7 @@ void Tracker::run() { cv::Vec3d euler = cv::RQDecomp3x3(rotation_matrix, junk1, junk2); - if (fabs(euler[0] - last_pitch) > pitch_eps) + if (fabs(euler[0] - last_pitch) > pitch_eps || euler[0] < 0) { first = true; last_pitch = euler[0]; -- cgit v1.2.3 From aaf0dba05d00d3c38eb4fe78a092216a991495fd Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 7 Jan 2014 09:24:48 +0100 Subject: use subpixel corner opt to reduce filter need --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 93b43de7..823c5578 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -282,7 +282,13 @@ void Tracker::run() 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 aruco::Marker& m = markers.at(0); + const aruco::Marker& m = static_cast>(markers.at(0)); + cv::cornerSubPix(grayscale, + m, + cv::Size(5, 5), cv::Size(-1, -1), + cv::TermCriteria(cv::TermCriteria::MAX_ITER | cv::TermCriteria::EPS, + 10, + 1e-2)); const float size = 7; const double p = s.marker_pitch; -- cgit v1.2.3 From a6bb6becb0365f2dc79a24d0e3979d42f1496a21 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 8 Jan 2014 19:40:17 +0100 Subject: remove redundant initialization --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 823c5578..6935dd43 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -226,10 +226,7 @@ void Tracker::run() intrinsics.at (1, 2) = grayscale.rows/2; cv::Mat dist_coeffs = cv::Mat::zeros(5, 1, CV_32FC1); - - for (int i = 0; i < 5; i++) - dist_coeffs.at(i) = 0; - + std::vector< aruco::Marker > markers; const double size_min = 0.04; -- cgit v1.2.3 From b4e666a34081e9bfd22e136ee5413e39b400569b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 9 Jan 2014 07:21:05 +0100 Subject: fix copy-paste mistake --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 6935dd43..db3d695c 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -279,7 +279,7 @@ void Tracker::run() 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 aruco::Marker& m = static_cast>(markers.at(0)); + const auto& m = static_cast>(markers.at(0)); cv::cornerSubPix(grayscale, m, cv::Size(5, 5), cv::Size(-1, -1), -- cgit v1.2.3 From 839d5207517c86885c14bdf018f5599a4ca97a5b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 9 Jan 2014 07:30:28 +0100 Subject: no need for ref here --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index db3d695c..f00c8bfc 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -238,7 +238,7 @@ void Tracker::run() { 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); + auto m = markers.at(0); for (int i = 0; i < 4; i++) { auto& p = m.at(i); @@ -279,7 +279,7 @@ void Tracker::run() 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 = static_cast>(markers.at(0)); + const auto m = static_cast>(markers.at(0)); cv::cornerSubPix(grayscale, m, cv::Size(5, 5), cv::Size(-1, -1), -- cgit v1.2.3 From bffc54d3b7f3fae018db7e371b7ee8f4e3d57f6a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 12 Jan 2014 00:10:25 +0100 Subject: fix aruco ROI bug --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index f00c8bfc..be5d0f32 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -238,7 +238,7 @@ void Tracker::run() { 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); + auto& m = markers.at(0); for (int i = 0; i < 4; i++) { auto& p = m.at(i); @@ -253,7 +253,7 @@ void Tracker::run() } if (markers.size() == 1 && markers[0].size() == 4) { - const aruco::Marker& m = markers.at(0); + const auto& m = markers.at(0); for (int i = 0; i < 4; i++) cv::line(color, m[i], m[(i+1)%4], cv::Scalar(0, 0, 255), scale, 8); } @@ -279,7 +279,7 @@ void Tracker::run() 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 = static_cast>(markers.at(0)); + const auto& m = markers.at(0); cv::cornerSubPix(grayscale, m, cv::Size(5, 5), cv::Size(-1, -1), -- cgit v1.2.3 From 94226df9ba710ee8bf5a28baeebbb5d470796e24 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 12 Jan 2014 01:44:17 +0100 Subject: correct aruco min pitch equation --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index be5d0f32..cbd9f531 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -284,7 +284,7 @@ void Tracker::run() m, cv::Size(5, 5), cv::Size(-1, -1), cv::TermCriteria(cv::TermCriteria::MAX_ITER | cv::TermCriteria::EPS, - 10, + 20, 1e-2)); const float size = 7; @@ -338,7 +338,7 @@ void Tracker::run() { cv::Vec3d euler = cv::RQDecomp3x3(rotation_matrix, junk1, junk2); - if (fabs(euler[0] - last_pitch) > pitch_eps || euler[0] < 0) + if (fabs(euler[0] - last_pitch) > pitch_eps || euler[0] - s.marker_pitch < 0) { first = true; last_pitch = euler[0]; -- cgit v1.2.3 From d471aba741dc9e3c70c919820e36a2613590d723 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 12 Jan 2014 18:23:21 +0100 Subject: correct focal length equation --- FTNoIR_Tracker_PT/point_tracker.cpp | 4 ++-- FTNoIR_Tracker_PT/point_tracker.h | 4 ++-- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/FTNoIR_Tracker_PT/point_tracker.cpp b/FTNoIR_Tracker_PT/point_tracker.cpp index 96d9d972..885b327a 100644 --- a/FTNoIR_Tracker_PT/point_tracker.cpp +++ b/FTNoIR_Tracker_PT/point_tracker.cpp @@ -250,8 +250,8 @@ void PointTracker::POSIT(float fov, int w, int h) const float HT_PI = 3.1415926535; - const float focal_length_w = 0.5 * w / tan(fov * HT_PI / 180); - const float focal_length_h = 0.5 * h / tan(fov * h / w * HT_PI / 180.0); + const float focal_length_w = 0.5 * w / tan(0.5 * fov * HT_PI / 180); + const float focal_length_h = 0.5 * h / tan(0.5 * fov * h / w * HT_PI / 180.0); cv::Mat intrinsics = cv::Mat::eye(3, 3, CV_32FC1); intrinsics.at (0, 0) = focal_length_w; diff --git a/FTNoIR_Tracker_PT/point_tracker.h b/FTNoIR_Tracker_PT/point_tracker.h index 741d5af4..69eb9bba 100644 --- a/FTNoIR_Tracker_PT/point_tracker.h +++ b/FTNoIR_Tracker_PT/point_tracker.h @@ -104,8 +104,8 @@ protected: if (!rvec.empty() && !tvec.empty() && fov > 0) { const float HT_PI = 3.1415926535; - const float focal_length_w = 0.5 * w / tan(fov * HT_PI / 180); - const float focal_length_h = 0.5 * h / tan(fov * h / w * HT_PI / 180.0); + const float focal_length_w = 0.5 * w / tan(0.5 * fov * HT_PI / 180); + const float focal_length_h = 0.5 * h / tan(0.5 * fov * h / w * HT_PI / 180.0); cv::Mat intrinsics = cv::Mat::eye(3, 3, CV_32FC1); intrinsics.at (0, 0) = focal_length_w; diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index cbd9f531..77f794b9 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -217,8 +217,8 @@ void Tracker::run() const int scale = frame.cols > 480 ? 2 : 1; detector.setThresholdParams(scale > 1 ? 11 : 7, 4); - const float focal_length_w = 0.5 * grayscale.cols / tan(s.fov * HT_PI / 180); - const float focal_length_h = 0.5 * grayscale.rows / tan(s.fov * grayscale.rows / grayscale.cols * HT_PI / 180.0); + const float focal_length_w = 0.5 * grayscale.cols / tan(0.5 * s.fov * HT_PI / 180); + const float focal_length_h = 0.5 * grayscale.rows / tan(0.5 * s.fov * grayscale.rows / grayscale.cols * HT_PI / 180.0); cv::Mat intrinsics = cv::Mat::eye(3, 3, CV_32FC1); intrinsics.at (0, 0) = focal_length_w; intrinsics.at (1, 1) = focal_length_h; @@ -286,7 +286,7 @@ void Tracker::run() cv::TermCriteria(cv::TermCriteria::MAX_ITER | cv::TermCriteria::EPS, 20, 1e-2)); - const float size = 7; + const float size = 3.5; const double p = s.marker_pitch; const double sq = sin(p * HT_PI / 180); -- cgit v1.2.3 From c2b5f86e85698068bd92de0e59e4f7b90c04cd60 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 12 Jan 2014 18:50:44 +0100 Subject: remove fisheye correction based on wrong focal length --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 341 ++++++++++++-------------- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 7 - ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 4 +- 3 files changed, 164 insertions(+), 188 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 59d3f69c..03975390 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -10,7 +10,7 @@ 0 0 615 - 353 + 326 @@ -32,176 +32,7 @@ 7 - - - - - - - - Default - - - - - 30 - - - - - 60 - - - - - 120 - - - - - 180 - - - - - - - - Frames per second - - - - - - - Recommended! - - - - - - - - 0 - 0 - - - - <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> - - - Qt::RichText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - 4 - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - 35.000000000000000 - - - 180.000000000000000 - - - 52.000000000000000 - - - - - - - Camera name - - - - - - - Red channel only - - - - - - - Horizontal FOV - - - - - - - - 640x480 - - - - - 320x240 - - - - - 320x200 - - - - - Default (not recommended!) - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - Resolution - - - - - - - -180.000000000000000 - - - 180.000000000000000 - - - - - - - Marker pitch - - - - + Head position @@ -348,17 +179,172 @@ - - + + + + Frames per second + + + + + + + + + + + Default + + + + + 30 + + + + + 60 + + + + + 120 + + + + + 180 + + + + + + - Check if yaw/X interconnect + Recommended! - - + + - Fisheye correction + Camera name + + + + + + + + + + 35.000000000000000 + + + 180.000000000000000 + + + 52.000000000000000 + + + + + + + + 0 + 0 + + + + <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> + + + Qt::RichText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + 4 + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + Red channel only + + + + + + + + 640x480 + + + + + 320x240 + + + + + 320x200 + + + + + Default (not recommended!) + + + + + + + + Horizontal FOV + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + -180.000000000000000 + + + 180.000000000000000 + + + + + + + Resolution + + + + + + + Marker pitch @@ -371,7 +357,6 @@ resolution red_only marker_pitch - fisheye_correction cx cy cz diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 77f794b9..9d484775 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -353,12 +353,6 @@ void Tracker::run() pose[Yaw] = euler[1]; pose[Pitch] = -euler[0]; pose[Roll] = euler[2]; - - if (s.fisheye_correction) - { - pose[Yaw] -= atan(pose[TX] / pose[TZ]) * 180 / HT_PI; - pose[Pitch] -= atan(pose[TY] / pose[TZ]) * 180 / HT_PI; - } } std::vector repr2; @@ -482,7 +476,6 @@ TrackerControls::TrackerControls() tie_setting(s.headpos_z, ui.cz); tie_setting(s.red_only, ui.red_only); tie_setting(s.marker_pitch, ui.marker_pitch); - tie_setting(s.fisheye_correction, ui.fisheye_correction); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); ui.cameraName->addItems(get_camera_names()); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index e32e304a..4cab84b5 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -28,7 +28,6 @@ struct settings { value red_only; value eyaw, epitch, eroll, ex, ey, ez; value marker_pitch; - value fisheye_correction; settings() : b(bundle("aruco-tracker")), fov(b, "field-of-view", 56), @@ -45,8 +44,7 @@ struct settings { ex(b, "enable-x", true), ey(b, "enable-y", true), ez(b, "enable-z", true), - marker_pitch(b, "marker-pitch", 0), - fisheye_correction(b, "fisheye-correction", false) + marker_pitch(b, "marker-pitch", 0) {} }; -- cgit v1.2.3 From b83a47cb32443981ce9998b2015f7d310fb72821 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 12 Jan 2014 19:49:57 +0100 Subject: Revert "correct focal length equation" This reverts commit 4312ef4098a449d38209c4f20ed573e9deb1713c. --- FTNoIR_Tracker_PT/point_tracker.cpp | 4 ++-- FTNoIR_Tracker_PT/point_tracker.h | 4 ++-- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/FTNoIR_Tracker_PT/point_tracker.cpp b/FTNoIR_Tracker_PT/point_tracker.cpp index 885b327a..96d9d972 100644 --- a/FTNoIR_Tracker_PT/point_tracker.cpp +++ b/FTNoIR_Tracker_PT/point_tracker.cpp @@ -250,8 +250,8 @@ void PointTracker::POSIT(float fov, int w, int h) const float HT_PI = 3.1415926535; - const float focal_length_w = 0.5 * w / tan(0.5 * fov * HT_PI / 180); - const float focal_length_h = 0.5 * h / tan(0.5 * fov * h / w * HT_PI / 180.0); + const float focal_length_w = 0.5 * w / tan(fov * HT_PI / 180); + const float focal_length_h = 0.5 * h / tan(fov * h / w * HT_PI / 180.0); cv::Mat intrinsics = cv::Mat::eye(3, 3, CV_32FC1); intrinsics.at (0, 0) = focal_length_w; diff --git a/FTNoIR_Tracker_PT/point_tracker.h b/FTNoIR_Tracker_PT/point_tracker.h index 69eb9bba..741d5af4 100644 --- a/FTNoIR_Tracker_PT/point_tracker.h +++ b/FTNoIR_Tracker_PT/point_tracker.h @@ -104,8 +104,8 @@ protected: if (!rvec.empty() && !tvec.empty() && fov > 0) { const float HT_PI = 3.1415926535; - const float focal_length_w = 0.5 * w / tan(0.5 * fov * HT_PI / 180); - const float focal_length_h = 0.5 * h / tan(0.5 * fov * h / w * HT_PI / 180.0); + const float focal_length_w = 0.5 * w / tan(fov * HT_PI / 180); + const float focal_length_h = 0.5 * h / tan(fov * h / w * HT_PI / 180.0); cv::Mat intrinsics = cv::Mat::eye(3, 3, CV_32FC1); intrinsics.at (0, 0) = focal_length_w; diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 9d484775..fc641ef1 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -217,8 +217,8 @@ void Tracker::run() const int scale = frame.cols > 480 ? 2 : 1; detector.setThresholdParams(scale > 1 ? 11 : 7, 4); - const float focal_length_w = 0.5 * grayscale.cols / tan(0.5 * s.fov * HT_PI / 180); - const float focal_length_h = 0.5 * grayscale.rows / tan(0.5 * s.fov * grayscale.rows / grayscale.cols * HT_PI / 180.0); + const float focal_length_w = 0.5 * grayscale.cols / tan(s.fov * HT_PI / 180); + const float focal_length_h = 0.5 * grayscale.rows / tan(s.fov * grayscale.rows / grayscale.cols * HT_PI / 180.0); cv::Mat intrinsics = cv::Mat::eye(3, 3, CV_32FC1); intrinsics.at (0, 0) = focal_length_w; intrinsics.at (1, 1) = focal_length_h; @@ -286,7 +286,7 @@ void Tracker::run() cv::TermCriteria(cv::TermCriteria::MAX_ITER | cv::TermCriteria::EPS, 20, 1e-2)); - const float size = 3.5; + const float size = 7; const double p = s.marker_pitch; const double sq = sin(p * HT_PI / 180); -- cgit v1.2.3 From fbad3658c9418171f2c2d1013230470926471e1a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 12 Jan 2014 20:24:04 +0100 Subject: fix accidental revert --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index fc641ef1..feb7fb9d 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -217,8 +217,8 @@ void Tracker::run() const int scale = frame.cols > 480 ? 2 : 1; detector.setThresholdParams(scale > 1 ? 11 : 7, 4); - const float focal_length_w = 0.5 * grayscale.cols / tan(s.fov * HT_PI / 180); - const float focal_length_h = 0.5 * grayscale.rows / tan(s.fov * grayscale.rows / grayscale.cols * HT_PI / 180.0); + const float focal_length_w = 0.5 * grayscale.cols / tan(0.5 * s.fov * HT_PI / 180); + const float focal_length_h = 0.5 * grayscale.rows / tan(0.5 * s.fov * grayscale.rows / grayscale.cols * HT_PI / 180.0); cv::Mat intrinsics = cv::Mat::eye(3, 3, CV_32FC1); intrinsics.at (0, 0) = focal_length_w; intrinsics.at (1, 1) = focal_length_h; -- cgit v1.2.3 From 87f57ad0bdf4ad5495dcc6068d3a0853a4c57a18 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 13 Jan 2014 08:24:15 +0100 Subject: aruco: change allowed scale, now that units are in millimeters --- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 12 ++++++------ ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index 03975390..e0794eb9 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -64,10 +64,10 @@ - -200.000000000000000 + -10000.000000000000000 - 200.000000000000000 + 10000.000000000000000 @@ -87,10 +87,10 @@ - -200.000000000000000 + -10000.000000000000000 - 200.000000000000000 + 10000.000000000000000 @@ -103,10 +103,10 @@ - -200.000000000000000 + -10000.000000000000000 - 200.000000000000000 + 10000.000000000000000 diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index feb7fb9d..cb44927a 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -286,7 +286,7 @@ void Tracker::run() cv::TermCriteria(cv::TermCriteria::MAX_ITER | cv::TermCriteria::EPS, 20, 1e-2)); - const float size = 7; + const float size = 40; const double p = s.marker_pitch; const double sq = sin(p * HT_PI / 180); -- cgit v1.2.3 From 17bca6cacbd56f4692927a4571b8e49361b52bca Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 13 Jan 2014 08:43:35 +0100 Subject: rescale aruco to centimeters, like PT does --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index cb44927a..845179f2 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -389,11 +389,11 @@ void Tracker::GetHeadPoseData(double *data) if (s.eroll) data[Roll] = pose[Roll]; if (s.ex) - data[TX] = pose[TX]; + data[TX] = pose[TX] * .1; if (s.ey) - data[TY] = pose[TY]; + data[TY] = pose[TY] * .1; if (s.ez) - data[TZ] = pose[TZ]; + data[TZ] = pose[TZ] * .1; } class TrackerDll : public Metadata -- cgit v1.2.3 From 2a494c722c978b79c2c3e7b423dffee53e4cc3f1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 14 Jan 2014 07:22:38 +0100 Subject: adjust subpix epsilon --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 845179f2..d4489638 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -284,8 +284,8 @@ void Tracker::run() m, cv::Size(5, 5), cv::Size(-1, -1), cv::TermCriteria(cv::TermCriteria::MAX_ITER | cv::TermCriteria::EPS, - 20, - 1e-2)); + 5, + 1e-4)); const float size = 40; const double p = s.marker_pitch; -- cgit v1.2.3 From 7890c4e4f5b8aeefc919fd4dcb8aa8ac35313374 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 14 Jan 2014 07:24:30 +0100 Subject: remove broken half of pitch breakage detection --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index d4489638..99ef3271 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -196,8 +196,6 @@ void Tracker::run() int cur_fps = 0; int last_fps = 0; cv::Point2f last_centroid; - const double pitch_eps = 45; - double last_pitch = 0; bool first = true; while (!stop) @@ -338,10 +336,9 @@ void Tracker::run() { cv::Vec3d euler = cv::RQDecomp3x3(rotation_matrix, junk1, junk2); - if (fabs(euler[0] - last_pitch) > pitch_eps || euler[0] - s.marker_pitch < 0) + if (euler[0] - s.marker_pitch < 0) { first = true; - last_pitch = euler[0]; qDebug() << "reset levmarq due to pitch breakage"; } -- cgit v1.2.3 From 65facfc7c819a5fc14385aedbb2848eb68bac390 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 15 Jan 2014 19:17:51 +0100 Subject: make all tracker/protocol/filter dialogs non-modal --- FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui | 2 +- ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui | 2 +- ftnoir_filter_ewma2/ftnoir_ewma_filtercontrols.ui | 2 +- ftnoir_filter_kalman/ftnoir_kalman_filtercontrols.ui | 2 +- ftnoir_protocol_fg/ftnoir_fgcontrols.ui | 2 +- ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui | 2 +- ftnoir_protocol_ft/ftnoir_ftcontrols.ui | 2 +- ftnoir_protocol_ftn/ftnoir_ftncontrols.ui | 2 +- ftnoir_protocol_libevdev/ftnoir_libevdev_controls.ui | 2 +- ftnoir_protocol_mouse/ftnoir_mousecontrols.ui | 2 +- ftnoir_protocol_sc/ftnoir_sccontrols.ui | 2 +- ftnoir_protocol_vjoy/ftnoir_vjoy_controls.ui | 2 +- ftnoir_protocol_wine/ftnoir_winecontrols.ui | 2 +- ftnoir_tracker_aruco/aruco-trackercontrols.ui | 2 +- ftnoir_tracker_ht/ht-trackercontrols.ui | 2 +- ftnoir_tracker_hydra/ftnoir_hydra_clientcontrols.ui | 2 +- ftnoir_tracker_joystick/ftnoir_tracker_joystick_controls.ui | 2 +- ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui | 2 +- ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui b/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui index bdbed955..0bbec7e1 100644 --- a/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui +++ b/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui @@ -3,7 +3,7 @@ UICPTClientControls - Qt::ApplicationModal + Qt::NonModal diff --git a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui index debd1250..c544263d 100644 --- a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui +++ b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui @@ -3,7 +3,7 @@ AccelaUICFilterControls - Qt::ApplicationModal + Qt::NonModal diff --git a/ftnoir_filter_ewma2/ftnoir_ewma_filtercontrols.ui b/ftnoir_filter_ewma2/ftnoir_ewma_filtercontrols.ui index a1083265..8ee633cc 100644 --- a/ftnoir_filter_ewma2/ftnoir_ewma_filtercontrols.ui +++ b/ftnoir_filter_ewma2/ftnoir_ewma_filtercontrols.ui @@ -3,7 +3,7 @@ UICFilterControls - Qt::ApplicationModal + Qt::NonModal diff --git a/ftnoir_filter_kalman/ftnoir_kalman_filtercontrols.ui b/ftnoir_filter_kalman/ftnoir_kalman_filtercontrols.ui index a9fdec6e..e0c849c9 100644 --- a/ftnoir_filter_kalman/ftnoir_kalman_filtercontrols.ui +++ b/ftnoir_filter_kalman/ftnoir_kalman_filtercontrols.ui @@ -3,7 +3,7 @@ KalmanUICFilterControls - Qt::ApplicationModal + Qt::NonModal diff --git a/ftnoir_protocol_fg/ftnoir_fgcontrols.ui b/ftnoir_protocol_fg/ftnoir_fgcontrols.ui index e351647b..a4092c05 100644 --- a/ftnoir_protocol_fg/ftnoir_fgcontrols.ui +++ b/ftnoir_protocol_fg/ftnoir_fgcontrols.ui @@ -3,7 +3,7 @@ UICFGControls - Qt::ApplicationModal + Qt::NonModal diff --git a/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui b/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui index 1ce77862..6cb066bd 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui +++ b/ftnoir_protocol_fsuipc/ftnoir_fsuipccontrols.ui @@ -3,7 +3,7 @@ UICFSUIPCControls - Qt::ApplicationModal + Qt::NonModal diff --git a/ftnoir_protocol_ft/ftnoir_ftcontrols.ui b/ftnoir_protocol_ft/ftnoir_ftcontrols.ui index bd5980b4..941aaff0 100644 --- a/ftnoir_protocol_ft/ftnoir_ftcontrols.ui +++ b/ftnoir_protocol_ft/ftnoir_ftcontrols.ui @@ -3,7 +3,7 @@ UICFTControls - Qt::ApplicationModal + Qt::NonModal true diff --git a/ftnoir_protocol_ftn/ftnoir_ftncontrols.ui b/ftnoir_protocol_ftn/ftnoir_ftncontrols.ui index 429e7046..48679f3c 100644 --- a/ftnoir_protocol_ftn/ftnoir_ftncontrols.ui +++ b/ftnoir_protocol_ftn/ftnoir_ftncontrols.ui @@ -3,7 +3,7 @@ UICFTNControls - Qt::ApplicationModal + Qt::NonModal diff --git a/ftnoir_protocol_libevdev/ftnoir_libevdev_controls.ui b/ftnoir_protocol_libevdev/ftnoir_libevdev_controls.ui index e85e001e..d2b86445 100644 --- a/ftnoir_protocol_libevdev/ftnoir_libevdev_controls.ui +++ b/ftnoir_protocol_libevdev/ftnoir_libevdev_controls.ui @@ -3,7 +3,7 @@ UICLibevdevControls - Qt::ApplicationModal + Qt::NonModal diff --git a/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui b/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui index 540e4f0d..2705fff7 100644 --- a/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui +++ b/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui @@ -3,7 +3,7 @@ UICMOUSEControls - Qt::ApplicationModal + Qt::NonModal diff --git a/ftnoir_protocol_sc/ftnoir_sccontrols.ui b/ftnoir_protocol_sc/ftnoir_sccontrols.ui index 430b3912..87dc8d86 100644 --- a/ftnoir_protocol_sc/ftnoir_sccontrols.ui +++ b/ftnoir_protocol_sc/ftnoir_sccontrols.ui @@ -3,7 +3,7 @@ UICSCControls - Qt::ApplicationModal + Qt::NonModal diff --git a/ftnoir_protocol_vjoy/ftnoir_vjoy_controls.ui b/ftnoir_protocol_vjoy/ftnoir_vjoy_controls.ui index 94b229fb..2214b887 100644 --- a/ftnoir_protocol_vjoy/ftnoir_vjoy_controls.ui +++ b/ftnoir_protocol_vjoy/ftnoir_vjoy_controls.ui @@ -3,7 +3,7 @@ UICVJoyControls - Qt::ApplicationModal + Qt::NonModal diff --git a/ftnoir_protocol_wine/ftnoir_winecontrols.ui b/ftnoir_protocol_wine/ftnoir_winecontrols.ui index 749feb0f..9356c448 100644 --- a/ftnoir_protocol_wine/ftnoir_winecontrols.ui +++ b/ftnoir_protocol_wine/ftnoir_winecontrols.ui @@ -3,7 +3,7 @@ UICFTControls - Qt::ApplicationModal + Qt::NonModal diff --git a/ftnoir_tracker_aruco/aruco-trackercontrols.ui b/ftnoir_tracker_aruco/aruco-trackercontrols.ui index e0794eb9..1d5a4241 100644 --- a/ftnoir_tracker_aruco/aruco-trackercontrols.ui +++ b/ftnoir_tracker_aruco/aruco-trackercontrols.ui @@ -3,7 +3,7 @@ Form - Qt::ApplicationModal + Qt::NonModal diff --git a/ftnoir_tracker_ht/ht-trackercontrols.ui b/ftnoir_tracker_ht/ht-trackercontrols.ui index 55501ef1..f57022c8 100644 --- a/ftnoir_tracker_ht/ht-trackercontrols.ui +++ b/ftnoir_tracker_ht/ht-trackercontrols.ui @@ -3,7 +3,7 @@ Form - Qt::ApplicationModal + Qt::NonModal diff --git a/ftnoir_tracker_hydra/ftnoir_hydra_clientcontrols.ui b/ftnoir_tracker_hydra/ftnoir_hydra_clientcontrols.ui index 1acbf93f..e5e41bec 100644 --- a/ftnoir_tracker_hydra/ftnoir_hydra_clientcontrols.ui +++ b/ftnoir_tracker_hydra/ftnoir_hydra_clientcontrols.ui @@ -3,7 +3,7 @@ UIHydraControls - Qt::ApplicationModal + Qt::NonModal diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_controls.ui b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_controls.ui index 7522cf31..5d349169 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_controls.ui +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_controls.ui @@ -3,7 +3,7 @@ UIJoystickControls - Qt::ApplicationModal + Qt::NonModal diff --git a/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui b/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui index e868a9c3..a9168239 100644 --- a/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui +++ b/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui @@ -3,7 +3,7 @@ UIRiftControls - Qt::ApplicationModal + Qt::NonModal diff --git a/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui b/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui index fc614477..5c602792 100644 --- a/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui +++ b/ftnoir_tracker_udp/ftnoir_ftnclientcontrols.ui @@ -3,7 +3,7 @@ UICFTNClientControls - Qt::ApplicationModal + Qt::NonModal -- cgit v1.2.3 From eb49b953f7216527cf4a78272f321a73706f0536 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 16 Jan 2014 05:40:27 +0100 Subject: get rid of corner subpix, causes nonsense on certain poses --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 99ef3271..ee20a9c4 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -278,12 +278,6 @@ void Tracker::run() if (markers.size() == 1 && markers[0].size() == 4) { const auto& m = markers.at(0); - cv::cornerSubPix(grayscale, - m, - cv::Size(5, 5), cv::Size(-1, -1), - cv::TermCriteria(cv::TermCriteria::MAX_ITER | cv::TermCriteria::EPS, - 5, - 1e-4)); const float size = 40; const double p = s.marker_pitch; @@ -336,7 +330,7 @@ void Tracker::run() { cv::Vec3d euler = cv::RQDecomp3x3(rotation_matrix, junk1, junk2); - if (euler[0] - s.marker_pitch < 0) + if (fabs(euler[0]) + fabs(s.marker_pitch) > 60) { first = true; qDebug() << "reset levmarq due to pitch breakage"; -- cgit v1.2.3 From de3ab0c3c1aee424a9a04963c976242b03827e17 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 16 Jan 2014 08:24:43 +0100 Subject: remove now-unused useless block --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'ftnoir_tracker_aruco') diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index ee20a9c4..ae7ca0b5 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -187,10 +187,6 @@ void Tracker::run() return; } - while (!stop) - if(camera.read(color_)) - break; - auto freq = cv::getTickFrequency(); auto last_time = cv::getTickCount(); int cur_fps = 0; -- cgit v1.2.3