MSCEqF 1.0
Multi State Constraint Equivariant Filter for visual inertial navigation
Loading...
Searching...
No Matches
tracker.hpp
1// Copyright (C) 2023 Alessandro Fornasier.
2// Control of Networked Systems, University of Klagenfurt, Austria.
3//
4// All rights reserved.
5//
6// This software is licensed under the terms of the BSD-2-Clause-License with
7// no commercial use allowed, the full terms of which are made available
8// in the LICENSE file. No license in patents is granted.
9//
10// You can contact the authors at <alessandro.fornasier@ieee.org>
11
12#ifndef TRACKER_HPP
13#define TRACKER_HPP
14
15#include <atomic>
16
17#include "sensors/sensor_data.hpp"
18#include "types/fptypes.hpp"
19#include "vision/camera.hpp"
20#include "vision/features.hpp"
21#include "vision/track.hpp"
22
23namespace msceqf
24{
31{
32 public:
33 using Keypoints = std::vector<cv::KeyPoint>;
34 using TimedFeatures = std::pair<fp, Features>;
35
42 Tracker(const TrackerOptions& opts, const Vector4& intrinsics);
43
51
58
64 const PinholeCameraUniquePtr& cam() const;
65
66 private:
76 void track(Camera& cam);
77
92 void detect(std::vector<cv::Mat>& pyramids, cv::Mat& mask, Features& features);
93
100 void matchKLT(std::vector<uchar>& mask);
101
108 void ransac(std::vector<uchar>& mask);
109
119 void extractCellKeypoints(const uint& idx, const cv::Mat& cell, const cv::Mat& mask, Keypoints& cell_kpts);
120
129 void maskGivenFeatures(cv::Mat& mask, const FeaturesCoordinates& points);
130
131 TrackerOptions opts_;
132
133 PinholeCameraUniquePtr cam_;
134 cv::Ptr<cv::Feature2D> detector_;
135
136 std::map<uint, std::atomic<uint>> max_kpts_per_cell_;
137 uint id_;
138
139 cv::Mat feature_mask_;
140
141 std::vector<cv::Mat> previous_pyramids_;
142 TimedFeatures previous_features_;
143
144 std::vector<cv::Mat> current_pyramids_;
145 TimedFeatures current_features_;
146
147 cv::Size win_;
148
149 static constexpr std::array<uint, 4> ratio_ = {10, 6, 3, 1};
150};
151
152} // namespace msceqf
153
154#endif // TRACKER_HPP
This class implement the feature tracker module based on Lucas-Kanade optical flow....
Definition tracker.hpp:31
std::vector< cv::KeyPoint > Keypoints
A vector of features keypoints.
Definition tracker.hpp:33
std::pair< fp, Features > TimedFeatures
Set of features associated with a time.
Definition tracker.hpp:34
const TimedFeatures & currentFeatures() const
Get the current detected/tracked features.
const PinholeCameraUniquePtr & cam() const
Get the camera pointer.
void processCamera(Camera &cam)
This method process the input camera measurement. If first pre-process the camera image,...
Tracker(const TrackerOptions &opts, const Vector4 &intrinsics)
Tracker constructor.
Definition sensor_data.hpp:78
(Cache friendly) Features struct. Define a set of features detected/tracked.
Definition features.hpp:30
Definition msceqf_options.hpp:180