summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-03-28 11:08:09 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-03-28 13:52:37 +0200
commit72f8b70f05e532224cb95a7501676d0211902f72 (patch)
tree716e3c5129c3e0af0d4f885204c9627a5d41f55e /tracker-pt
parent219d4f0ee556d1f4304447f9d0c2b34f3762b4f8 (diff)
tracker/pt: show calibration sample count in UI
Diffstat (limited to 'tracker-pt')
-rw-r--r--tracker-pt/FTNoIR_PT_Controls.ui75
-rw-r--r--tracker-pt/ftnoir_tracker_pt_dialog.cpp32
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 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_11">
- <item row="0" column="0">
- <widget class="QLabel" name="label_61">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>x:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QSpinBox" name="tx_spin">
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="ty_spin">
<property name="suffix">
<string> mm</string>
</property>
@@ -994,8 +981,8 @@
</property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_62">
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_66">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -1003,12 +990,12 @@
</sizepolicy>
</property>
<property name="text">
- <string>y:</string>
+ <string>z:</string>
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QSpinBox" name="ty_spin">
+ <item row="2" column="1">
+ <widget class="QSpinBox" name="tz_spin">
<property name="suffix">
<string> mm</string>
</property>
@@ -1020,8 +1007,8 @@
</property>
</widget>
</item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_66">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_61">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -1029,12 +1016,12 @@
</sizepolicy>
</property>
<property name="text">
- <string>z:</string>
+ <string>x:</string>
</property>
</widget>
</item>
- <item row="2" column="1">
- <widget class="QSpinBox" name="tz_spin">
+ <item row="0" column="1">
+ <widget class="QSpinBox" name="tx_spin">
<property name="suffix">
<string> mm</string>
</property>
@@ -1046,6 +1033,19 @@
</property>
</widget>
</item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_62">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>y:</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
@@ -1061,9 +1061,32 @@
<item>
<widget class="QLabel" name="label_59">
<property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/opentrack/opentrack/wiki/model-calibration-for-PT-and-Aruco-trackers&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Instructions on the opentrack wiki&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ <string>Use only yaw and pitch while calibrating.
+Don't roll or change position.</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
</property>
<property name="openExternalLinks">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="sample_count_display">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="wordWrap">
<bool>true</bool>
</property>
</widget>
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();
}
-