MSCEqF
1.0
Multi State Constraint Equivariant Filter for visual inertial navigation
Toggle main menu visibility
Loading...
Searching...
No Matches
features.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 FEATURES_HPP
21
#define FEATURES_HPP
22
23
#include <opencv2/opencv.hpp>
24
25
#include "types/fptypes.hpp"
26
27
namespace
msceqf
28
{
29
using
FeaturesCoordinates = std::vector<cv::Point2f>;
30
37
struct
Features
38
{
39
using
FeatureIds
= std::vector<uint>;
40
46
inline
bool
empty
() const noexcept {
return
uvs_
.empty(); }
47
53
inline
size_t
size
() const noexcept
54
{
55
assert(
distorted_uvs_
.size() ==
uvs_
.size());
56
assert(
distorted_uvs_
.size() ==
normalized_uvs_
.size());
57
assert(
distorted_uvs_
.size() ==
ids_
.size());
58
return
distorted_uvs_
.size();
59
}
60
67
void
removeInvalid
(std::vector<bool>& invalid)
68
{
69
assert(invalid.size() ==
distorted_uvs_
.size());
70
assert(
distorted_uvs_
.size() ==
uvs_
.size());
71
assert(
distorted_uvs_
.size() ==
normalized_uvs_
.size());
72
assert(
distorted_uvs_
.size() ==
ids_
.size());
73
74
size_t
i = 0;
75
size_t
j = 0;
76
77
while
(i < invalid.size())
78
{
79
if
(!invalid[i])
80
{
81
distorted_uvs_
[j] =
distorted_uvs_
[i];
82
uvs_
[j] =
uvs_
[i];
83
normalized_uvs_
[j] =
normalized_uvs_
[i];
84
ids_
[j] =
ids_
[i];
85
++j;
86
}
87
++i;
88
}
89
90
distorted_uvs_
.resize(j);
91
uvs_
.resize(j);
92
normalized_uvs_
.resize(j);
93
ids_
.resize(j);
94
}
95
96
FeaturesCoordinates
distorted_uvs_
;
97
FeaturesCoordinates
uvs_
;
98
FeaturesCoordinates
normalized_uvs_
;
99
FeatureIds
ids_
;
100
};
101
102
}
// namespace msceqf
103
104
#endif
// FEATURES_HPP
msceqf::Features
(Cache friendly) Features struct. Define a set of features detected/tracked.
Definition
features.hpp:38
msceqf::Features::distorted_uvs_
FeaturesCoordinates distorted_uvs_
Distorted (u, v) coordinates of the features detected/tracked.
Definition
features.hpp:96
msceqf::Features::uvs_
FeaturesCoordinates uvs_
Undistorted (u, v) coordinates of the features detected/tracked.
Definition
features.hpp:97
msceqf::Features::removeInvalid
void removeInvalid(std::vector< bool > &invalid)
Remove invalid features coordinates, normalized feature coordinates and ids given a vector of boolean...
Definition
features.hpp:67
msceqf::Features::ids_
FeatureIds ids_
Id of the features detected/tracked.
Definition
features.hpp:99
msceqf::Features::normalized_uvs_
FeaturesCoordinates normalized_uvs_
Undistorted normalized (u, v) coordinates of features detected/tracked.
Definition
features.hpp:98
msceqf::Features::FeatureIds
std::vector< uint > FeatureIds
Vector of feature ids.
Definition
features.hpp:39
msceqf::Features::empty
bool empty() const noexcept
Check if there valid coordinates in uvs_.
Definition
features.hpp:46
msceqf::Features::size
size_t size() const noexcept
Return the amount of features (size of uvs_).
Definition
features.hpp:53
include
vision
features.hpp
Generated by
1.17.0