diff options
Diffstat (limited to 'tracker-aruco')
-rw-r--r-- | tracker-aruco/ftnoir_tracker_aruco.cpp | 6 | ||||
-rw-r--r-- | tracker-aruco/ftnoir_tracker_aruco.h | 2 | ||||
-rw-r--r-- | tracker-aruco/trans_calib.cpp | 41 | ||||
-rw-r--r-- | tracker-aruco/trans_calib.h | 39 |
4 files changed, 4 insertions, 84 deletions
diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp index ec778624..282a6516 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.cpp +++ b/tracker-aruco/ftnoir_tracker_aruco.cpp @@ -499,9 +499,9 @@ void aruco_dialog::toggleCalibrate() cleanupCalib(); auto pos = calibrator.get_estimate(); - s.headpos_x = pos(0); - s.headpos_y = pos(1); - s.headpos_z = pos(2); + s.headpos_x = -pos(0); + s.headpos_y = -pos(1); + s.headpos_z = -pos(2); } } diff --git a/tracker-aruco/ftnoir_tracker_aruco.h b/tracker-aruco/ftnoir_tracker_aruco.h index e3859636..02b7e0a7 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.h +++ b/tracker-aruco/ftnoir_tracker_aruco.h @@ -9,7 +9,7 @@ #include "ui_aruco-trackercontrols.h" #include "options/options.hpp" -#include "trans_calib.h" +#include "cv/translation-calibrator.hpp" #include "api/plugin-api.hpp" #include "cv/video-widget.hpp" #include "compat/timer.hpp" diff --git a/tracker-aruco/trans_calib.cpp b/tracker-aruco/trans_calib.cpp deleted file mode 100644 index b5148efd..00000000 --- a/tracker-aruco/trans_calib.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - */ - -#include "trans_calib.h" - -TranslationCalibrator::TranslationCalibrator() -{ - reset(); -} - -void TranslationCalibrator::reset() -{ - P = cv::Matx66f::zeros(); - y = cv::Vec6f(0,0,0, 0,0,0); -} - -void TranslationCalibrator::update(const cv::Matx33d& R_CM_k, const cv::Vec3d& t_CM_k) -{ - cv::Matx<double, 6,3> H_k_T = cv::Matx<double, 6,3>::zeros(); - for (int i=0; i<3; ++i) { - for (int j=0; j<3; ++j) { - H_k_T(i,j) = R_CM_k(j,i); - } - } - for (int i=0; i<3; ++i) - { - H_k_T(3+i,i) = 1.0; - } - P += H_k_T * H_k_T.t(); - y += H_k_T * t_CM_k; -} - -cv::Vec3f TranslationCalibrator::get_estimate() -{ - cv::Vec6f x = P.inv() * y; - return cv::Vec3f(x[0], x[1], x[2]); -} diff --git a/tracker-aruco/trans_calib.h b/tracker-aruco/trans_calib.h deleted file mode 100644 index 3d1e56fa..00000000 --- a/tracker-aruco/trans_calib.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - */ - -#ifndef TRANSCALIB_H -#define TRANSCALIB_H - -#include <opencv2/core/core.hpp> - -//----------------------------------------------------------------------------- -// Calibrates the translation from head to model = t_MH -// by recursive least squares / -// kalman filter in information form with identity noise covariance -// measurement equation when head position = t_CH is fixed: -// (R_CM_k , Id)*(-t_MH, t_CH) = t_CM_k - -class TranslationCalibrator -{ -public: - TranslationCalibrator(); - - // reset the calibration process - void reset(); - - // update the current estimate - void update(const cv::Matx33d& R_CM_k, const cv::Vec3d& t_CM_k); - - // get the current estimate for t_MH - cv::Vec3f get_estimate(); - -private: - cv::Matx66f P; // normalized precision matrix = inverse covariance - cv::Vec6f y; // P*(-t_MH, t_CH) -}; - -#endif //TRANSCALIB_H |