MSCEqF
1.0
Multi State Constraint Equivariant Filter for visual inertial navigation
Toggle main menu visibility
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 Apache License, Version 2.0
7
// (the "License"); you may not use this file except in compliance with the
8
// License. You may obtain a copy of the License at
9
//
10
// http://www.apache.org/licenses/LICENSE-2.0
11
//
12
// Unless required by applicable law or agreed to in writing, software
13
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
// License for the specific language governing permissions and limitations
16
// under the License.
17
//
18
// You can contact the authors at <alessandro.fornasier@ieee.org>
19
20
#ifndef TRACKER_HPP
21
#define TRACKER_HPP
22
23
#include <atomic>
24
25
#include "sensors/sensor_data.hpp"
26
#include "types/fptypes.hpp"
27
#include "vision/camera.hpp"
28
#include "vision/features.hpp"
29
#include "vision/track.hpp"
30
31
namespace
msceqf
32
{
38
class
Tracker
39
{
40
public
:
41
using
Keypoints
= std::vector<cv::KeyPoint>;
42
using
TimedFeatures
= std::pair<fp, Features>;
43
50
Tracker
(
const
TrackerOptions
& opts,
const
Vector4& intrinsics);
51
58
void
processCamera
(
Camera
&
cam
);
59
65
const
TimedFeatures
&
currentFeatures
()
const
;
66
72
const
PinholeCameraUniquePtr&
cam
()
const
;
73
74
private
:
84
void
track(
Camera
&
cam
);
85
100
void
detect(std::vector<cv::Mat>& pyramids, cv::Mat& mask,
Features
& features);
101
108
void
matchKLT(std::vector<uchar>& mask);
109
116
void
ransac(std::vector<uchar>& mask);
117
127
void
extractCellKeypoints(
const
uint& idx,
const
cv::Mat& cell,
const
cv::Mat& mask,
Keypoints
& cell_kpts);
128
137
void
maskGivenFeatures(cv::Mat& mask,
const
FeaturesCoordinates& points);
138
139
TrackerOptions
opts_;
140
141
PinholeCameraUniquePtr cam_;
142
cv::Ptr<cv::Feature2D> detector_;
143
144
std::map<uint, std::atomic<uint>> max_kpts_per_cell_;
145
uint id_;
146
147
cv::Mat feature_mask_;
148
149
std::vector<cv::Mat> previous_pyramids_;
150
TimedFeatures
previous_features_;
151
152
std::vector<cv::Mat> current_pyramids_;
153
TimedFeatures
current_features_;
154
155
cv::Size win_;
156
157
static
constexpr
std::array<uint, 4> ratio_ = {10, 6, 3, 1};
158
};
159
160
}
// namespace msceqf
161
162
#endif
// TRACKER_HPP
msceqf::Tracker::Keypoints
std::vector< cv::KeyPoint > Keypoints
A vector of features keypoints.
Definition
tracker.hpp:41
msceqf::Tracker::TimedFeatures
std::pair< fp, Features > TimedFeatures
Set of features associated with a time.
Definition
tracker.hpp:42
msceqf::Tracker::currentFeatures
const TimedFeatures & currentFeatures() const
Get the current detected/tracked features.
msceqf::Tracker::cam
const PinholeCameraUniquePtr & cam() const
Get the camera pointer.
msceqf::Tracker::processCamera
void processCamera(Camera &cam)
This method process the input camera measurement. If first pre-process the camera image,...
msceqf::Tracker::Tracker
Tracker(const TrackerOptions &opts, const Vector4 &intrinsics)
Tracker constructor.
msceqf::Camera
Definition
sensor_data.hpp:86
msceqf::Features
(Cache friendly) Features struct. Define a set of features detected/tracked.
Definition
features.hpp:38
msceqf::TrackerOptions
Definition
msceqf_options.hpp:188
include
vision
tracker.hpp
Generated by
1.17.0