diff options
Diffstat (limited to 'ftnoir_tracker_pt')
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 10 | ||||
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt.h | 2 | ||||
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp | 2 | ||||
-rw-r--r-- | ftnoir_tracker_pt/point_tracker.h | 24 |
4 files changed, 20 insertions, 18 deletions
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index f182cacc..a6732ced 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -125,7 +125,7 @@ void Tracker::apply_inner() point_extractor.min_size = s.min_point_size; point_extractor.max_size = s.max_point_size; t_MH = cv::Vec3f(s.t_MH_x, s.t_MH_y, s.t_MH_z); - FrameTrafo X_MH(Matx33f::eye(), t_MH); + Affine X_MH(Matx33f::eye(), t_MH); qDebug()<<"Tracker::apply ends"; } @@ -160,9 +160,11 @@ void Tracker::StopTracker(bool exit) void Tracker::data(THeadPoseData *data) { - FrameTrafo X_CM = point_tracker.pose(); - FrameTrafo X_MH(Matx33f::eye(), t_MH); - FrameTrafo X_GH = X_CM * X_MH; + Affine X_CM = point_tracker.pose(); + + Affine X_MH(Matx33f::eye(), t_MH); + Affine X_GH = X_CM * X_MH; + Matx33f R = X_GH.R; Vec3f t = X_GH.t; diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.h b/ftnoir_tracker_pt/ftnoir_tracker_pt.h index 4161bd48..2f922e17 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.h @@ -44,7 +44,7 @@ public: void apply(settings& s); void apply_inner(); - void pose(FrameTrafo* X_CM) { QMutexLocker lock(&mutex); *X_CM = point_tracker.pose(); } + void pose(Affine* X_CM) { QMutexLocker lock(&mutex); *X_CM = point_tracker.pose(); } int get_n_points() { QMutexLocker lock(&mutex); return point_extractor.get_points().size(); } void get_cam_info(CamInfo* info) { QMutexLocker lock(&mutex); *info = camera.get_info(); } protected: diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp index ee65c81e..2bf8ba75 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp @@ -172,7 +172,7 @@ void TrackerDialog::trans_calib_step() { if (tracker) { - FrameTrafo X_CM; + Affine X_CM; tracker->pose(&X_CM); trans_calib.update(X_CM.R, X_CM.t); cv::Vec3f t_MH = trans_calib.get_estimate(); diff --git a/ftnoir_tracker_pt/point_tracker.h b/ftnoir_tracker_pt/point_tracker.h index be9e83ad..f9e2d9b9 100644 --- a/ftnoir_tracker_pt/point_tracker.h +++ b/ftnoir_tracker_pt/point_tracker.h @@ -18,32 +18,32 @@ // ---------------------------------------------------------------------------- // Affine frame trafo -class FrameTrafo +class Affine { public: - FrameTrafo() : R(cv::Matx33f::eye()), t(0,0,0) {} - FrameTrafo(const cv::Matx33f& R, const cv::Vec3f& t) : R(R),t(t) {} + Affine() : R(cv::Matx33f::eye()), t(0,0,0) {} + Affine(const cv::Matx33f& R, const cv::Vec3f& t) : R(R),t(t) {} cv::Matx33f R; cv::Vec3f t; }; -inline FrameTrafo operator*(const FrameTrafo& X, const FrameTrafo& Y) +inline Affine operator*(const Affine& X, const Affine& Y) { - return FrameTrafo(X.R*Y.R, X.R*Y.t + X.t); + return Affine(X.R*Y.R, X.R*Y.t + X.t); } -inline FrameTrafo operator*(const cv::Matx33f& X, const FrameTrafo& Y) +inline Affine operator*(const cv::Matx33f& X, const Affine& Y) { - return FrameTrafo(X*Y.R, X*Y.t); + return Affine(X*Y.R, X*Y.t); } -inline FrameTrafo operator*(const FrameTrafo& X, const cv::Matx33f& Y) +inline Affine operator*(const Affine& X, const cv::Matx33f& Y) { - return FrameTrafo(X.R*Y, X.t); + return Affine(X.R*Y, X.t); } -inline cv::Vec3f operator*(const FrameTrafo& X, const cv::Vec3f& v) +inline cv::Vec3f operator*(const Affine& X, const cv::Vec3f& v) { return X.R*v + X.t; } @@ -87,7 +87,7 @@ public: // f : (focal length)/(sensor width) // dt : time since last call void track(const std::vector<cv::Vec2f>& projected_points, const PointModel& model); - FrameTrafo pose() const { return X_CM; } + Affine pose() const { return X_CM; } private: // the points in model order typedef struct { cv::Vec2f points[PointModel::N_POINTS]; } PointOrder; @@ -102,7 +102,7 @@ private: PointOrder find_correspondences(const std::vector<cv::Vec2f>& projected_points, const PointModel &model); int POSIT(const PointModel& point_model, const PointOrder& order); // The POSIT algorithm, returns the number of iterations - FrameTrafo X_CM; // trafo from model to camera + Affine X_CM; // trafo from model to camera }; #endif //POINTTRACKER_H |