From a55ae207560f385ed2b56b452fe56f1e2ecac38a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 7 Apr 2013 01:01:06 +0200 Subject: Better RANSAC params --- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 35 +- ftnoir_tracker_ht/ftnoir_tracker_ht.h | 15 +- ftnoir_tracker_ht/ht-trackercontrols.ui | 591 ++++++++++++++++++++++++++++++++ ftnoir_tracker_ht/trackercontrols.ui | 578 ------------------------------- 4 files changed, 627 insertions(+), 592 deletions(-) create mode 100644 ftnoir_tracker_ht/ht-trackercontrols.ui delete mode 100644 ftnoir_tracker_ht/trackercontrols.ui diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 5db70115..c5e860ee 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -3,7 +3,7 @@ #include "headtracker-ftnoir.h" #include "ftnoir_tracker_ht.h" #include "ftnoir_tracker_ht_dll.h" -#include "ui_trackercontrols.h" +#include "ui_ht-trackercontrols.h" #include "facetracknoir/global-settings.h" #include @@ -13,6 +13,15 @@ #include #endif +// delicious copypasta +static void open_settings_dialog(int idx, void* parent) { +#if defined(_WIN32) || defined(__WIN32) + qDebug() << "opening settings"; + if (idx == 0) + idx = 1; +#endif +} + // delicious copypasta static QList get_camera_names(void) { QList ret; @@ -102,19 +111,19 @@ static void load_settings(ht_config_t* config, Tracker* tracker) config->pyrlk_win_size_w = config->pyrlk_win_size_h = 21; config->max_keypoints = 100; config->keypoint_quality = 7; - config->keypoint_distance = 1; - config->keypoint_3distance = 5.5; + config->keypoint_distance = 1.5; + config->keypoint_3distance = 5.0; //config->force_width = 640; //config->force_height = 480; config->force_fps = iniFile.value("fps", 0).toInt(); config->camera_index = iniFile.value("camera-index", -1).toInt(); config->ransac_num_iters = 100; - config->ransac_max_reprojection_error = 4.05; - config->ransac_max_inlier_error = 4.09; + config->ransac_max_reprojection_error = 3.75; + config->ransac_max_inlier_error = 3.8; config->ransac_max_mean_error = 4; config->ransac_abs_max_mean_error = 10; config->debug = 0; - config->ransac_min_features = 0.87; + config->ransac_min_features = 0.85; int res = iniFile.value("resolution", 0).toInt(); if (res < 0 || res >= (int)(sizeof(*resolution_choices) / sizeof(resolution_tuple))) res = 0; @@ -296,9 +305,20 @@ extern "C" FTNOIR_TRACKER_BASE_EXPORT void* CALLING_CONVENTION GetDialog( ) return (ITrackerDialog*) new TrackerControls; } +void TrackerControls::cameraSettings() { + open_settings_dialog(ui.cameraName->currentIndex(), +#if defined(_WIN32) + (HANDLE) winId() +#else + NULL +#endif + ); +} + TrackerControls::TrackerControls() { 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))); @@ -310,6 +330,7 @@ TrackerControls::TrackerControls() 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.buttonSettings, SIGNAL(clicked()), this, SLOT(cameraSettings())); loadSettings(); settingsDirty = false; } @@ -339,7 +360,7 @@ void TrackerControls::loadSettings() QSettings iniFile( currentFile, QSettings::IniFormat ); iniFile.beginGroup( "HT-Tracker" ); ui.cameraName->setCurrentIndex(iniFile.value("camera-index", -1).toInt() + 1); - ui.cameraFOV->setValue(iniFile.value("fov", 69).toFloat()); + ui.cameraFOV->setValue(iniFile.value("fov", 52).toFloat()); int fps; switch (iniFile.value("fps", 0).toInt()) { diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h index f5d0c271..5a17e4af 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013 Stanisław Halik +/* Copyright (c) 2013 Stanislaw Halik * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -11,7 +11,7 @@ #include "stdafx.h" #include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "headtracker-ftnoir.h" -#include "ui_trackercontrols.h" +#include "ui_ht-trackercontrols.h" #include "video_widget.h" #include "compat/compat.h" #include @@ -59,8 +59,8 @@ public: void showEvent ( QShowEvent * event ); void Initialize(QWidget *parent); - void registerTracker(ITracker *tracker) {}; - void unRegisterTracker() {}; + void registerTracker(ITracker *tracker) {} + void unRegisterTracker() {} private: Ui::Form ui; @@ -71,9 +71,10 @@ private: private slots: void doOK(); void doCancel(); - void settingChanged() { settingsDirty = true; }; - void settingChanged(int) { settingsDirty = true; }; - void settingChanged(double) { settingsDirty = true; }; + void settingChanged() { settingsDirty = true; } + void settingChanged(int) { settingsDirty = true; } + void settingChanged(double) { settingsDirty = true; } + void cameraSettings(); }; #endif diff --git a/ftnoir_tracker_ht/ht-trackercontrols.ui b/ftnoir_tracker_ht/ht-trackercontrols.ui new file mode 100644 index 00000000..968b7dc7 --- /dev/null +++ b/ftnoir_tracker_ht/ht-trackercontrols.ui @@ -0,0 +1,591 @@ + + + Form + + + Qt::NonModal + + + + 0 + 0 + 724 + 160 + + + + + 0 + 0 + + + + + 750 + 160 + + + + 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 + + + + + 30 + + + + + 60 + + + + + 120 + + + + + + + 10 + 70 + 133 + 16 + + + + Camera name + + + + + + 220 + 130 + 75 + 23 + + + + OK + + + + + + 300 + 130 + 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 + + + + + 320x240 + + + + + 320x200 + + + + + Default (not recommended!) + + + + + + + 500 + 10 + 221 + 141 + + + + Bashed coordinates + + + true + + + false + + + + + 10 + 20 + 61 + 22 + + + + true + + + QAbstractSpinBox::NoButtons + + + 5 + + + -99.000000000000000 + + + + + + 80 + 20 + 61 + 22 + + + + true + + + QAbstractSpinBox::NoButtons + + + 5 + + + -99.000000000000000 + + + + + + 150 + 20 + 61 + 22 + + + + true + + + QAbstractSpinBox::NoButtons + + + 5 + + + -99.000000000000000 + + + + + + 150 + 50 + 61 + 22 + + + + true + + + QAbstractSpinBox::NoButtons + + + 5 + + + -99.000000000000000 + + + + + + 10 + 50 + 61 + 22 + + + + true + + + QAbstractSpinBox::NoButtons + + + 5 + + + -99.000000000000000 + + + + + + 80 + 50 + 61 + 22 + + + + true + + + QAbstractSpinBox::NoButtons + + + 5 + + + -99.000000000000000 + + + + + + 150 + 80 + 61 + 22 + + + + true + + + QAbstractSpinBox::NoButtons + + + 5 + + + -99.000000000000000 + + + + + + 10 + 80 + 61 + 22 + + + + true + + + QAbstractSpinBox::NoButtons + + + 5 + + + -99.000000000000000 + + + + + + 80 + 80 + 61 + 22 + + + + true + + + QAbstractSpinBox::NoButtons + + + 5 + + + -99.000000000000000 + + + + + + 150 + 110 + 61 + 22 + + + + true + + + QAbstractSpinBox::NoButtons + + + 5 + + + -99.000000000000000 + + + + + + 80 + 110 + 61 + 22 + + + + true + + + QAbstractSpinBox::NoButtons + + + 5 + + + -99.000000000000000 + + + + + + 10 + 110 + 61 + 22 + + + + true + + + QAbstractSpinBox::NoButtons + + + 5 + + + -99.000000000000000 + + + + + + + 10 + 130 + 101 + 23 + + + + Camera settings + + + + + + diff --git a/ftnoir_tracker_ht/trackercontrols.ui b/ftnoir_tracker_ht/trackercontrols.ui deleted file mode 100644 index 2f4b1915..00000000 --- a/ftnoir_tracker_ht/trackercontrols.ui +++ /dev/null @@ -1,578 +0,0 @@ - - - Form - - - Qt::NonModal - - - - 0 - 0 - 724 - 160 - - - - - 0 - 0 - - - - - 750 - 160 - - - - HT tracker settings - - - - - 10 - 10 - 141 - 16 - - - - Horizontal FOV - - - - - - 130 - 10 - 251 - 22 - - - - - - - 35.000000000000000 - - - 180.000000000000000 - - - 69.000000000000000 - - - - - - 10 - 40 - 137 - 16 - - - - Frames per second - - - - - - 130 - 40 - 251 - 22 - - - - - Default - - - - - 30 - - - - - 60 - - - - - 120 - - - - - - - 10 - 70 - 133 - 16 - - - - Camera name - - - - - - 220 - 130 - 75 - 23 - - - - OK - - - - - - 300 - 130 - 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 - - - - - 320x240 - - - - - 320x200 - - - - - Default (not recommended!) - - - - - - - 500 - 10 - 221 - 141 - - - - Bashed coordinates - - - true - - - false - - - - - 10 - 20 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 80 - 20 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 150 - 20 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 150 - 50 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 10 - 50 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 80 - 50 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 150 - 80 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 10 - 80 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 80 - 80 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 150 - 110 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 80 - 110 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 10 - 110 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - - -- cgit v1.2.3