-
Notifications
You must be signed in to change notification settings - Fork 12
/
mapper_helpers.hpp
178 lines (150 loc) · 4.6 KB
/
mapper_helpers.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#ifndef SLAM_MAPPER_HELPERS_HPP
#define SLAM_MAPPER_HELPERS_HPP
#include <set>
#include <string>
#include "bow_index.hpp"
#include "../api/slam.hpp"
#include "map_point.hpp"
#include "bundle_adjuster.hpp"
#include "../odometry/util.hpp"
#include "../util/util.hpp"
#include "viewer_data_publisher.hpp"
#include "static_settings.hpp"
class CommandQueue;
namespace slam {
class ViewerDataPublisher;
class LoopCloser;
struct MapperInput;
struct OrbExtractor;
bool makeKeyframeDecision(
const Keyframe ¤tKeyframe,
const Keyframe *previousKeyframe,
const std::vector<tracker::Feature> ¤tTracks,
const odometry::ParametersSlam ¶meters
);
void matchTrackedFeatures(
Keyframe ¤tKeyframe,
MapDB &mapDB,
const StaticSettings &settings
);
/**
* Compute a set of spatially nearby keyframes. This function attempts to improve over
* the "neighbors" concept from ORBSLAM/OpenVSLAM, which considers only visual "neighborness".
* This tends to leave holes in the keyframe sequences, which in some situations (local BA) is
* especially bad for our method that has strong inertial information about successive keyframes.
*
* @param currentKeyframe The keyframe to search around, won't be included in return vector.
* @param minCovisibilities Number of shared map point observations required to include a keyframe from a different "island".
* @param maxKeyframes Return up to this many keyframes, dropping more distant ones.
* @param mapDB
* @param settings
* @param visualize Produce visualizations from this call.
* @return Vector of keyframes, sorted by ascending distance, not including the argument keyframe.
*/
std::vector<KfId> computeAdjacentKeyframes(
const Keyframe ¤tKeyframe,
int minCovisibilities,
int maxKeyframes,
const MapDB &mapDB,
const StaticSettings &settings,
bool visualize = false
);
void matchLocalMapPoints(
Keyframe ¤tKeyframe,
const std::vector<KfId> &adjacentKfIds,
MapDB &mapDB,
const StaticSettings &settings,
ViewerDataPublisher *dataPublisher
);
void createNewMapPoints(
Keyframe ¤tKeyframe,
const std::vector<KfId> &adjacentKfIds,
MapDB &mapDB,
const StaticSettings &settings,
ViewerDataPublisher *dataPublisher
);
void deduplicateMapPoints(
Keyframe ¤tKeyframe,
const std::vector<KfId> &adjacentKfIds,
MapDB &mapDB,
const StaticSettings &settings
);
void cullMapPoints(
Keyframe ¤tKeyframe,
MapDB &mapDB,
const odometry::ParametersSlam ¶meters
);
void cullKeyframes(
const std::vector<KfId> &adjacentKfIds,
MapDB &mapDB,
BowIndex &bowIndex,
const odometry::ParametersSlam ¶meters
);
void checkConsistency(const MapDB &mapDB);
bool checkPositiveDepth(
const Eigen::Vector3d &positionW,
const Eigen::Matrix4d &poseCW
);
bool checkTriangulationAngle(const vecVector3d &raysW, double minAngleDeg);
int getFocalLength(const Keyframe &kf);
bool checkReprojectionError(
const Eigen::Vector3d& pos,
const Keyframe &kf,
const StaticSettings &settings,
KpId kpId,
float relativeReprojectionErrorThreshold
);
void triangulateMapPoint(
MapDB &mapDB,
MapPoint &mapPoint,
const StaticSettings &settings,
TriangulationMethod method = TriangulationMethod::TME
);
void triangulateMapPointFirstLastObs(
MapDB &mapDB,
MapPoint &mapPoint,
const StaticSettings &settings
);
void publishMapForViewer(
ViewerDataPublisher &dataPublisher,
const WorkspaceBA *workspaceBA,
const MapDB &mapDB,
const odometry::ParametersSlam ¶meters
);
Eigen::MatrixXd odometryPriorStrengths(
KfId kfId1,
KfId kfId2,
const odometry::ParametersSlam ¶meters,
const slam::MapDB &mapDB
);
MapDB loadMapDB(
MapId mapId,
BowIndex &bowIndex,
const std::string &loadPath
);
void addKeyframeFrontend(
MapDB &mapDB,
std::unique_ptr<Keyframe> keyframePtr,
bool keyFrameDecision,
const MapperInput &mapperInput,
const StaticSettings &settings,
Eigen::Matrix4d &resultPose,
Slam::Result::PointCloud *resultPointCloud
);
KfId addKeyframeBackend(
MapDB &mapDB,
std::unique_ptr<Keyframe> keyframePtr,
bool keyFrameDecision,
const MapperInput &mapperInput,
const StaticSettings &settings,
WorkspaceBA &workspaceBA,
LoopCloser &loopCloser,
OrbExtractor &orbExtractor,
BowIndex &bowIndex,
CommandQueue *commands,
ViewerDataPublisher *dataPublisher,
Eigen::Matrix4d &resultPose,
Slam::Result::PointCloud *resultPointCloud);
ViewerAtlasMap mapDBtoViewerAtlasMap(const MapDB &mapDB);
} // namespace slam
#endif //SLAM_MAPPER_HELPERS_HPP