summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/point_tracker.h
diff options
context:
space:
mode:
Diffstat (limited to 'tracker-pt/point_tracker.h')
-rw-r--r--tracker-pt/point_tracker.h41
1 files changed, 21 insertions, 20 deletions
diff --git a/tracker-pt/point_tracker.h b/tracker-pt/point_tracker.h
index 5e741c75..7492b4eb 100644
--- a/tracker-pt/point_tracker.h
+++ b/tracker-pt/point_tracker.h
@@ -11,28 +11,25 @@
#include "cv/affine.hpp"
#include "cv/numeric.hpp"
#include "pt-api.hpp"
+#include "point-filter.hpp"
-#include <cstddef>
-#include <memory>
#include <vector>
#include <array>
-#include <opencv2/core.hpp>
-
#include <QObject>
-namespace pt_module {
+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
{
- static constexpr inline unsigned N_POINTS = 3;
+ static constexpr unsigned N_POINTS = 3;
vec3 M01; // M01 in model frame
vec3 M02; // M02 in model frame
@@ -43,10 +40,10 @@ struct PointModel final
enum Model { Clip, Cap, Custom };
- PointModel(const pt_settings& s);
+ explicit PointModel(const pt_settings& s);
void set_model(const pt_settings& s);
- void get_d_order(const vec2* points, unsigned* d_order, const vec2& d) const;
+ static void get_d_order(const vec2* points, unsigned* d_order, const vec2& d);
};
// ----------------------------------------------------------------------------
@@ -60,8 +57,13 @@ 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 pt_camera_info& 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();
@@ -70,19 +72,18 @@ private:
// the points in model order
using PointOrder = std::array<vec2, 3>;
- bool maybe_use_old_point_order(const PointOrder& order, const pt_camera_info& info);
-
- PointOrder find_correspondences(const vec2* projected_points, const PointModel &model);
+ 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);
- int POSIT(const PointModel& point_model, const PointOrder& order, f focal_length); // The POSIT algorithm, returns the number of iterations
+ // 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
- PointOrder prev_order, prev_scaled_order;
+ Affine X_CM; // transform from model to camera
+ Affine X_CM_expected;
Timer t;
- bool init_phase = true, prev_order_valid = false;
+ bool init_phase = true;
};
} // ns pt_impl
-using pt_module::PointTracker;
-using pt_module::PointModel;
+using PointTracker = pt_impl::PointTracker;
+using PointModel = pt_impl::PointModel;