From 72f8b70f05e532224cb95a7501676d0211902f72 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 28 Mar 2017 11:08:09 +0200 Subject: tracker/pt: show calibration sample count in UI --- tracker-pt/FTNoIR_PT_Controls.ui | 75 +++++++++++++++++++++------------ tracker-pt/ftnoir_tracker_pt_dialog.cpp | 32 +++++++++----- 2 files changed, 70 insertions(+), 37 deletions(-) diff --git a/tracker-pt/FTNoIR_PT_Controls.ui b/tracker-pt/FTNoIR_PT_Controls.ui index a72ac50d..718c7df9 100644 --- a/tracker-pt/FTNoIR_PT_Controls.ui +++ b/tracker-pt/FTNoIR_PT_Controls.ui @@ -968,21 +968,8 @@ QFrame::Raised - - - - - 0 - 0 - - - - x: - - - - - + + mm @@ -994,8 +981,8 @@ - - + + 0 @@ -1003,12 +990,12 @@ - y: + z: - - + + mm @@ -1020,8 +1007,8 @@ - - + + 0 @@ -1029,12 +1016,12 @@ - z: + x: - - + + mm @@ -1046,6 +1033,19 @@ + + + + + 0 + 0 + + + + y: + + + @@ -1061,9 +1061,32 @@ - <html><head/><body><p><a href="https://github.com/opentrack/opentrack/wiki/model-calibration-for-PT-and-Aruco-trackers"><span style=" text-decoration: underline; color:#0000ff;">Instructions on the opentrack wiki</span></a></p></body></html> + Use only yaw and pitch while calibrating. +Don't roll or change position. + + + Qt::AlignCenter + + + true + false + + + + + + + + 0 + 0 + + + + + + true diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.cpp b/tracker-pt/ftnoir_tracker_pt_dialog.cpp index 6851e3fd..b47dac26 100644 --- a/tracker-pt/ftnoir_tracker_pt_dialog.cpp +++ b/tracker-pt/ftnoir_tracker_pt_dialog.cpp @@ -93,27 +93,38 @@ void TrackerDialog_PT::startstop_trans_calib(bool start) s.t_MH_x = 0; s.t_MH_y = 0; s.t_MH_z = 0; + + ui.sample_count_display->setText(QString()); } else { calib_timer.stop(); qDebug() << "pt: stopping translation calibration"; { - auto tmp = trans_calib.get_estimate(); + cv::Vec3f tmp; + unsigned nsamples; + std::tie(tmp, nsamples) = trans_calib.get_estimate(); s.t_MH_x = int(tmp[0]); s.t_MH_y = int(tmp[1]); s.t_MH_z = int(tmp[2]); + + static constexpr unsigned min_samples = 80; + const QString sample_feedback = nsamples >= min_samples + ? tr("%1 samples. Over %2, good!").arg(nsamples).arg(min_samples) + : tr("%1 samples. Try for at least %2 for a precise calibration.").arg(nsamples).arg(min_samples); + + ui.sample_count_display->setText(sample_feedback); } } ui.tx_spin->setEnabled(!start); ui.ty_spin->setEnabled(!start); ui.tz_spin->setEnabled(!start); ui.tcalib_button->setText(progn( - if (start) - return QStringLiteral("Stop calibration"); - else - return QStringLiteral("Start calibration"); - )); + if (start) + return tr("Stop calibration"); + else + return tr("Start calibration"); + )); } void TrackerDialog_PT::poll_tracker_info_impl() @@ -121,16 +132,16 @@ void TrackerDialog_PT::poll_tracker_info_impl() CamInfo info; if (tracker && tracker->get_cam_info(&info)) { - ui.caminfo_label->setText(QStringLiteral("%1x%2 @ %3 FPS").arg(info.res_x).arg(info.res_y).arg(iround(info.fps))); + ui.caminfo_label->setText(tr("%1x%2 @ %3 FPS").arg(info.res_x).arg(info.res_y).arg(iround(info.fps))); // display point info const int n_points = tracker->get_n_points(); - ui.pointinfo_label->setText((n_points == 3 ? QStringLiteral("%1 OK!") : QStringLiteral("%1 BAD!")).arg(n_points)); + ui.pointinfo_label->setText((n_points == 3 ? tr("%1 OK!") : tr("%1 BAD!")).arg(n_points)); } else { - ui.caminfo_label->setText(QStringLiteral("Tracker offline")); - ui.pointinfo_label->setText(QStringLiteral("")); + ui.caminfo_label->setText(tr("Tracker offline")); + ui.pointinfo_label->setText(QString()); } } @@ -203,4 +214,3 @@ void TrackerDialog_PT::unregister_tracker() poll_tracker_info(); timer.stop(); } - -- cgit v1.2.3