diff options
-rwxr-xr-x | gui/options-dialog.cpp | 28 | ||||
-rwxr-xr-x | gui/settings.ui | 321 | ||||
-rw-r--r-- | gui/wizard.cpp | 3 | ||||
-rw-r--r-- | gui/wizard.h | 2 | ||||
-rwxr-xr-x | tracker-pt/ftnoir_tracker_pt.cpp | 16 | ||||
-rw-r--r-- | tracker-pt/ftnoir_tracker_pt_settings.h | 8 | ||||
-rw-r--r-- | tracker-pt/point_tracker.h | 4 |
7 files changed, 174 insertions, 208 deletions
diff --git a/gui/options-dialog.cpp b/gui/options-dialog.cpp index d57b9f35..cc85319c 100755 --- a/gui/options-dialog.cpp +++ b/gui/options-dialog.cpp @@ -45,9 +45,9 @@ OptionsDialog::OptionsDialog(main_settings& main, connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); tie_setting(main.tray_enabled, ui.trayp); - + tie_setting(main.center_at_startup, ui.center_at_startup); - + tie_setting(pt.camera_mode, ui.camera_mode); tie_setting(pt.threshold, ui.threshold_slider); @@ -58,36 +58,32 @@ OptionsDialog::OptionsDialog(main_settings& main, tie_setting(pt.t_MH_x, ui.tx_spin); tie_setting(pt.t_MH_y, ui.ty_spin); tie_setting(pt.t_MH_z, ui.tz_spin); - - tie_setting(pt.fov, ui.camera_fov); - + tie_setting(pt.model_used, ui.model_used); - + connect(ui.ewma_slider, SIGNAL(valueChanged(int)), this, SLOT(update_ewma_display(int))); connect(ui.rotation_slider, SIGNAL(valueChanged(int)), this, SLOT(update_rot_display(int))); connect(ui.rot_dz_slider, SIGNAL(valueChanged(int)), this, SLOT(update_rot_dz_display(int))); connect(ui.translation_slider, SIGNAL(valueChanged(int)), this, SLOT(update_trans_display(int))); connect(ui.trans_dz_slider, SIGNAL(valueChanged(int)), this, SLOT(update_trans_dz_display(int))); - + tie_setting(acc.rot_threshold, ui.rotation_slider); tie_setting(acc.trans_threshold, ui.translation_slider); tie_setting(acc.ewma, ui.ewma_slider); tie_setting(acc.rot_deadzone, ui.rot_dz_slider); tie_setting(acc.trans_deadzone, ui.trans_dz_slider); - + update_rot_display(ui.rotation_slider->value()); update_trans_display(ui.translation_slider->value()); update_ewma_display(ui.ewma_slider->value()); update_rot_dz_display(ui.rot_dz_slider->value()); update_trans_dz_display(ui.trans_dz_slider->value()); - - tie_setting(pt.dynamic_pose, ui.dynamic_pose); - tie_setting(pt.init_phase_timeout, ui.init_phase_timeout); + tie_setting(pt.auto_threshold, ui.auto_threshold); - + connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); connect( ui.tcalib_button,SIGNAL(toggled(bool)), this,SLOT(startstop_trans_calib(bool)) ); - + timer.start(100); tie_setting(main.tcomp_p, ui.tcomp_enable); @@ -106,7 +102,7 @@ OptionsDialog::OptionsDialog(main_settings& main, tie_setting(main.a_x.src, ui.src_x); tie_setting(main.a_y.src, ui.src_y); tie_setting(main.a_z.src, ui.src_z); - + tie_setting(main.camera_yaw, ui.camera_yaw); tie_setting(main.camera_pitch, ui.camera_pitch); tie_setting(main.camera_roll, ui.camera_roll); @@ -121,7 +117,7 @@ OptionsDialog::OptionsDialog(main_settings& main, ui.center_text->setText(kopts_to_string(main.key_center)); ui.toggle_text->setText(kopts_to_string(main.key_toggle)); ui.zero_text->setText(kopts_to_string(main.key_zero)); - + ui.start_tracking_text->setText(kopts_to_string(main.key_start_tracking)); ui.stop_tracking_text->setText(kopts_to_string(main.key_stop_tracking)); ui.toggle_tracking_text->setText(kopts_to_string(main.key_toggle_tracking)); @@ -190,7 +186,7 @@ void OptionsDialog::startstop_trans_calib(bool start) ui.tcalib_button->setChecked(false); return; } - + if (start) { qDebug()<<"TrackerDialog:: Starting translation calibration"; diff --git a/gui/settings.ui b/gui/settings.ui index 59c98e96..3f4ca1c6 100755 --- a/gui/settings.ui +++ b/gui/settings.ui @@ -245,29 +245,34 @@ <attribute name="title"> <string>Camera</string> </attribute> - <layout class="QVBoxLayout" name="verticalLayout_10"> + <layout class="QVBoxLayout" name="verticalLayout_5"> <item> <widget class="QGroupBox" name="groupBox_9"> <property name="title"> <string>Device</string> </property> <layout class="QGridLayout" name="gridLayout"> - <item row="2" column="0"> - <widget class="QLabel" name="label_32"> - <property name="text"> - <string>Dynamic pose resolution</string> + <item row="0" column="0"> + <widget class="QLabel" name="label_2511"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>16</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QCheckBox" name="dynamic_pose"> <property name="text"> - <string/> + <string>Mode</string> </property> </widget> </item> <item row="0" column="1"> <widget class="QComboBox" name="camera_mode"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>10</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <item> <property name="text"> <string>640x480, 75 Hz</string> @@ -290,54 +295,6 @@ </item> </widget> </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_2511"> - <property name="text"> - <string>Mode</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="camera_fov"> - <item> - <property name="text"> - <string>56°</string> - </property> - </item> - <item> - <property name="text"> - <string>75°</string> - </property> - </item> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Field of view</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_33"> - <property name="text"> - <string>Dynamic pose timeout</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QSpinBox" name="init_phase_timeout"> - <property name="suffix"> - <string> ms</string> - </property> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>10000</number> - </property> - </widget> - </item> </layout> </widget> </item> @@ -520,6 +477,115 @@ </widget> </item> <item> + <widget class="QGroupBox" name="groupBox_5"> + <property name="title"> + <string>Camera offset</string> + </property> + <layout class="QGridLayout" name="gridLayout_6"> + <item row="2" column="0"> + <widget class="QLabel" name="label_17"> + <property name="text"> + <string><html><head/><body><p>Specify an angle for off-center camera as a basis for which direction is which, avoiding axis interconnect. Also see <a href="https://github.com/opentrack/opentrack/wiki/choosing-camera-offset"><span style=" text-decoration: underline; color:#0000ff;">description on wiki</span></a>.</p></body></html></string> + </property> + <property name="alignment"> + <set>Qt::AlignJustify|Qt::AlignVCenter</set> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="margin"> + <number>2</number> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="3" column="0" alignment="Qt::AlignLeft"> + <widget class="QGroupBox" name="groupBox_3"> + <property name="styleSheet"> + <string notr="true">QGroupBox +{ + border: 0; +}</string> + </property> + <layout class="QGridLayout" name="gridLayout_7"> + <item row="2" column="0"> + <widget class="QLabel" name="label_21"> + <property name="text"> + <string>Roll</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QSpinBox" name="camera_roll"> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="minimum"> + <number>-180</number> + </property> + <property name="maximum"> + <number>180</number> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="camera_yaw"> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="minimum"> + <number>-180</number> + </property> + <property name="maximum"> + <number>180</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_19"> + <property name="text"> + <string>Pitch</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="camera_pitch"> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="minimum"> + <number>-180</number> + </property> + <property name="maximum"> + <number>180</number> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_18"> + <property name="text"> + <string>Yaw</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </item> + <item> <spacer name="verticalSpacer_2"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -559,6 +625,12 @@ </property> <item row="0" column="1"> <widget class="QComboBox" name="model_used"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="sizeAdjustPolicy"> <enum>QComboBox::AdjustToMinimumContentsLength</enum> </property> @@ -733,115 +805,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_5"> - <property name="title"> - <string>Camera offset</string> - </property> - <layout class="QGridLayout" name="gridLayout_6"> - <item row="2" column="0"> - <widget class="QLabel" name="label_17"> - <property name="text"> - <string><html><head/><body><p>Specify an angle for off-center camera as a basis for which direction is which, avoiding axis interconnect. Also see <a href="https://github.com/opentrack/opentrack/wiki/choosing-camera-offset"><span style=" text-decoration: underline; color:#0000ff;">description on wiki</span></a>.</p></body></html></string> - </property> - <property name="alignment"> - <set>Qt::AlignJustify|Qt::AlignVCenter</set> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - <property name="margin"> - <number>2</number> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="3" column="0" alignment="Qt::AlignLeft"> - <widget class="QGroupBox" name="groupBox_3"> - <property name="styleSheet"> - <string notr="true">QGroupBox -{ - border: 0; -}</string> - </property> - <layout class="QGridLayout" name="gridLayout_7"> - <item row="2" column="0"> - <widget class="QLabel" name="label_21"> - <property name="text"> - <string>Roll</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="camera_roll"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>0</height> - </size> - </property> - <property name="minimum"> - <number>-180</number> - </property> - <property name="maximum"> - <number>180</number> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="camera_yaw"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>0</height> - </size> - </property> - <property name="minimum"> - <number>-180</number> - </property> - <property name="maximum"> - <number>180</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_19"> - <property name="text"> - <string>Pitch</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="camera_pitch"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>0</height> - </size> - </property> - <property name="minimum"> - <number>-180</number> - </property> - <property name="maximum"> - <number>180</number> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_18"> - <property name="text"> - <string>Yaw</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - </item> - <item> <spacer name="verticalSpacer_5"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -1747,8 +1710,27 @@ </customwidgets> <tabstops> <tabstop>tabWidget</tabstop> + <tabstop>bind_center</tabstop> + <tabstop>bind_toggle</tabstop> + <tabstop>bind_zero</tabstop> + <tabstop>bind_start</tabstop> + <tabstop>bind_stop</tabstop> + <tabstop>bind_toggle_tracking</tabstop> <tabstop>center_at_startup</tabstop> <tabstop>trayp</tabstop> + <tabstop>camera_mode</tabstop> + <tabstop>auto_threshold</tabstop> + <tabstop>threshold_slider</tabstop> + <tabstop>mindiam_spin</tabstop> + <tabstop>maxdiam_spin</tabstop> + <tabstop>camera_yaw</tabstop> + <tabstop>camera_pitch</tabstop> + <tabstop>camera_roll</tabstop> + <tabstop>model_used</tabstop> + <tabstop>tx_spin</tabstop> + <tabstop>ty_spin</tabstop> + <tabstop>tz_spin</tabstop> + <tabstop>tcalib_button</tabstop> <tabstop>tcomp_enable</tabstop> <tabstop>tcomp_rz</tabstop> <tabstop>src_yaw</tabstop> @@ -1763,6 +1745,11 @@ <tabstop>invert_y</tabstop> <tabstop>src_z</tabstop> <tabstop>invert_z</tabstop> + <tabstop>ewma_slider</tabstop> + <tabstop>rotation_slider</tabstop> + <tabstop>rot_dz_slider</tabstop> + <tabstop>translation_slider</tabstop> + <tabstop>trans_dz_slider</tabstop> </tabstops> <resources> <include location="ui-res.qrc"/> diff --git a/gui/wizard.cpp b/gui/wizard.cpp index 7e394858..4075e695 100644 --- a/gui/wizard.cpp +++ b/gui/wizard.cpp @@ -3,7 +3,7 @@ #include "tracker-pt/ftnoir_tracker_pt_settings.h" #include "filter-accela/ftnoir_filter_accela.h" -Wizard::Wizard() : QWizard(nullptr) +Wizard::Wizard(QWidget* parent) : QWizard(parent) { ui.setupUi(this); connect(this, SIGNAL(accepted()), this, SLOT(set_data())); @@ -66,7 +66,6 @@ void Wizard::set_data() pt.threshold = 31; pt.min_point_size = 1.5; pt.max_point_size = 50; - pt.fov = 1; pt.camera_mode = 0; pt.model_used = m; pt.b->save(); diff --git a/gui/wizard.h b/gui/wizard.h index 9d359172..bb518788 100644 --- a/gui/wizard.h +++ b/gui/wizard.h @@ -12,7 +12,7 @@ class Wizard : public QWizard Q_OBJECT Ui_wizard ui; public: - Wizard(); + Wizard(QWidget* parent = nullptr); enum Model { Cap = 0, ClipRight = 1, ClipLeft = 2 }; enum { ClipRightX = 135, ClipLeftX = -135 }; diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index 8b0075d1..04d5b526 100755 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -58,17 +58,7 @@ void Tracker_PT::reset_command(Command command) bool Tracker_PT::get_focal_length(double& ret) { - int fov_; - switch (s.fov) - { - default: - case 0: - fov_ = 56; - break; - case 1: - fov_ = 75; - break; - } + static constexpr const double fov_ = 75; QMutexLocker l(&camera_mtx); CamInfo info; @@ -135,8 +125,8 @@ void Tracker_PT::run() point_tracker.track(points, PointModel(s), fx, - s.dynamic_pose, - s.init_phase_timeout, + s.model_used == PointModel::Cap, + 500, info.res_x, info.res_y); ever_success = true; diff --git a/tracker-pt/ftnoir_tracker_pt_settings.h b/tracker-pt/ftnoir_tracker_pt_settings.h index d2f19276..72816f98 100644 --- a/tracker-pt/ftnoir_tracker_pt_settings.h +++ b/tracker-pt/ftnoir_tracker_pt_settings.h @@ -18,11 +18,8 @@ struct settings_pt : opts value<double> min_point_size, max_point_size; value<int> t_MH_x, t_MH_y, t_MH_z; - value<int> fov, camera_mode; - value<int> model_used; + value<int> camera_mode, model_used; - value<bool> dynamic_pose; - value<int> init_phase_timeout; value<bool> auto_threshold; settings_pt() : @@ -33,11 +30,8 @@ struct settings_pt : opts t_MH_x(b, "model-centroid-x", 0), t_MH_y(b, "model-centroid-y", 0), t_MH_z(b, "model-centroid-z", 0), - fov(b, "camera-fov", 1), camera_mode(b, "camera-mode", 0), model_used(b, "model-used", 0), - dynamic_pose(b, "dynamic-pose-resolution", true), - init_phase_timeout(b, "init-phase-timeout", 500), auto_threshold(b, "automatic-threshold", false) {} }; diff --git a/tracker-pt/point_tracker.h b/tracker-pt/point_tracker.h index 77c07125..e3ad81b6 100644 --- a/tracker-pt/point_tracker.h +++ b/tracker-pt/point_tracker.h @@ -55,6 +55,8 @@ class PointModel { friend class PointTracker; public: + enum { Cap = 0, ClipRight = 1, ClipLeft = 2 }; + static constexpr int N_POINTS = 3; cv::Vec3d M01; // M01 in model frame @@ -80,8 +82,6 @@ public: void set_model(settings_pt& s) { - enum { Cap = 0, ClipRight = 1, ClipLeft = 2 }; - switch (s.model_used) { default: |