diff options
Diffstat (limited to 'tracker-pt/point_tracker.h')
| -rw-r--r-- | tracker-pt/point_tracker.h | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/tracker-pt/point_tracker.h b/tracker-pt/point_tracker.h index 63caf0dd..7492b4eb 100644 --- a/tracker-pt/point_tracker.h +++ b/tracker-pt/point_tracker.h @@ -8,26 +8,24 @@ #pragma once #include "compat/timer.hpp" -#include "ftnoir_tracker_pt_settings.h" -#include "affine.hpp" -#include "numeric.hpp" -#include "camera.h" - -#include <opencv2/core.hpp> -#include <cstddef> -#include <memory> +#include "cv/affine.hpp" +#include "cv/numeric.hpp" +#include "pt-api.hpp" +#include "point-filter.hpp" + #include <vector> #include <array> + #include <QObject> -namespace impl { +namespace pt_impl { // ---------------------------------------------------------------------------- // Describes a 3-point model // nomenclature as in // [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"] -using namespace types; +using namespace numeric_types; struct PointModel final { @@ -42,9 +40,10 @@ struct PointModel final enum Model { Clip, Cap, Custom }; - PointModel(settings_pt& s); - void set_model(settings_pt& s); - void get_d_order(const vec2* points, unsigned* d_order, const vec2& d) const; + explicit PointModel(const pt_settings& s); + void set_model(const pt_settings& s); + + static void get_d_order(const vec2* points, unsigned* d_order, const vec2& d); }; // ---------------------------------------------------------------------------- @@ -58,26 +57,33 @@ public: // track the pose using the set of normalized point coordinates (x pos in range -0.5:0.5) // f : (focal length)/(sensor width) // dt : time since last call - void track(const std::vector<vec2>& projected_points, const PointModel& model, const CamInfo& info, int init_phase_timeout); - Affine pose() { return X_CM; } + void track(const std::vector<vec2>& projected_points, + const PointModel& model, + const pt_camera_info& info, + int init_phase_timeout, + point_filter& filter, + f deadzone_amount); + Affine pose() const { return X_CM; } vec2 project(const vec3& v_M, f focal_length); vec2 project(const vec3& v_M, f focal_length, const Affine& X_CM); + void reset_state(); private: // the points in model order using PointOrder = std::array<vec2, 3>; - PointOrder find_correspondences(const vec2* projected_points, const PointModel &model); - PointOrder find_correspondences_previous(const vec2* points, const PointModel &model, const CamInfo& info); - int POSIT(const PointModel& point_model, const PointOrder& order, f focal_length); // The POSIT algorithm, returns the number of iterations - - Affine X_CM; // trafo from model to camera + static PointOrder find_correspondences(const vec2* projected_points, const PointModel &model); + PointOrder find_correspondences_previous(const vec2* points, const PointModel &model, const pt_camera_info& info); + // The POSIT algorithm, returns the number of iterations + int POSIT(const PointModel& point_model, const PointOrder& order, f focal_length); + Affine X_CM; // transform from model to camera + Affine X_CM_expected; Timer t; - bool init_phase; + bool init_phase = true; }; -} // ns types +} // ns pt_impl -using impl::PointTracker; -using impl::PointModel; +using PointTracker = pt_impl::PointTracker; +using PointModel = pt_impl::PointModel; |
