-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsfm.cpp
More file actions
41 lines (31 loc) · 899 Bytes
/
sfm.cpp
File metadata and controls
41 lines (31 loc) · 899 Bytes
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
#include "sfm.hpp"
void Sfm::init() {
mapper.setTracker(tracker);
mapper.setMap(map);
sfmgui.setKeyframes(keyframes);
sfmgui.setMap(map);
tracker.setMap(map);
}
void Sfm::execute() {
init();
for (auto& kf : keyframes) {
tracker.detectFeatureAndcomputeDescriptor(kf);
}
tracker.solveMatching(keyframes[0], keyframes[1]);
tracker.calcPosefrom2D2D(keyframes[0], keyframes[1]);
mapper.createMapPoints(keyframes[0], keyframes[1]);
for (int i = 1; i < keyframes.size() - 1; i++) {
tracker.solveMatching(keyframes[i], keyframes[i + 1]);
tracker.calcPosefrom2D3D(keyframes[i], keyframes[i + 1]);
mapper.createMapPoints(keyframes[i], keyframes[i + 1]);
}
sfmgui.execute("window", 640, 480);
}
void Sfm::register_keyframes(std::vector<cv::Mat>& images) {
for (const auto& image : images)
{
KeyFrame keyframe;
keyframe.image = image;
keyframes.push_back(keyframe);
}
}