summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cv/translation-calibrator.cpp9
-rw-r--r--cv/translation-calibrator.hpp2
-rw-r--r--tracker-pt/ftnoir_tracker_pt_dialog.cpp25
3 files changed, 25 insertions, 11 deletions
diff --git a/cv/translation-calibrator.cpp b/cv/translation-calibrator.cpp
index cdd573bc..fb150bf9 100644
--- a/cv/translation-calibrator.cpp
+++ b/cv/translation-calibrator.cpp
@@ -54,12 +54,10 @@ void TranslationCalibrator::update(const cv::Matx33d& R_CM_k, const cv::Vec3d& t
y += H_k_T * t_CM_k;
}
-std::tuple<cv::Vec3f, unsigned> TranslationCalibrator::get_estimate()
+std::tuple<cv::Vec3f, cv::Vec3i> TranslationCalibrator::get_estimate()
{
cv::Vec6f x = P.inv() * y;
- qDebug() << "calibrator:" << nsamples << "samples total";
-
unsigned values[3] {};
vec* in[] { &used_yaw_poses, &used_pitch_poses, &used_roll_poses };
@@ -71,12 +69,13 @@ std::tuple<cv::Vec3f, unsigned> TranslationCalibrator::get_estimate()
values[k]++;
}
- qDebug() << "samples"
+ qDebug() << "samples total" << nsamples
<< "yaw" << values[0]
<< "pitch" << values[1]
<< "roll" << values[2];
- return std::make_tuple(cv::Vec3f(-x[0], -x[1], -x[2]), nsamples);
+ return std::make_tuple(cv::Vec3f(-x[0], -x[1], -x[2]),
+ cv::Vec3i(values[0], values[1], values[2]));
}
bool TranslationCalibrator::check_bucket(const cv::Matx33d& R_CM_k)
diff --git a/cv/translation-calibrator.hpp b/cv/translation-calibrator.hpp
index ae2ed844..d908496a 100644
--- a/cv/translation-calibrator.hpp
+++ b/cv/translation-calibrator.hpp
@@ -29,7 +29,7 @@ public:
void update(const cv::Matx33d& R_CM_k, const cv::Vec3d& t_CM_k);
// get the current estimate for t_MH
- std::tuple<cv::Vec3f, unsigned> get_estimate();
+ std::tuple<cv::Vec3f, cv::Vec3i> get_estimate();
private:
bool check_bucket(const cv::Matx33d& R_CM_k);
diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.cpp b/tracker-pt/ftnoir_tracker_pt_dialog.cpp
index c2079c27..ee80fe6f 100644
--- a/tracker-pt/ftnoir_tracker_pt_dialog.cpp
+++ b/tracker-pt/ftnoir_tracker_pt_dialog.cpp
@@ -104,16 +104,31 @@ void TrackerDialog_PT::startstop_trans_calib(bool start)
qDebug() << "pt: stopping translation calibration";
{
cv::Vec3f tmp;
- unsigned nsamples;
+ cv::Vec3i 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);
+ static constexpr unsigned min_yaw_samples = 15;
+ static constexpr unsigned min_pitch_samples = 15;
+ static constexpr unsigned min_samples = min_yaw_samples+min_pitch_samples;
+
+ // Don't bother counting roll samples. Roll calibration is hard enough
+ // that it's a hidden unsupported feature anyway.
+
+ const QString sample_feedback = progn(
+ if (nsamples[0] < min_yaw_samples)
+ return tr("%1 yaw samples. Yaw more to %2 samples for stable calibration.")
+ .arg(nsamples[0]).arg(min_yaw_samples);
+ if (nsamples[1] < min_pitch_samples)
+ return tr("%1 pitch samples. Pitch more to %2 samples for stable calibration.")
+ .arg(nsamples[1]).arg(min_pitch_samples);
+
+ const unsigned nsamples_total = nsamples[0] + nsamples[1];
+
+ return tr("%1 samples. Over %2, good!").arg(nsamples_total).arg(min_samples);
+ );
ui.sample_count_display->setText(sample_feedback);
}