-
Notifications
You must be signed in to change notification settings - Fork 90
/
opensfm.hpp
54 lines (46 loc) · 1.28 KB
/
opensfm.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
#ifndef OPENSFM_H
#define OPENSFM_H
#include <iostream>
#include <string>
#include <fstream>
#include <unordered_map>
#include <torch/torch.h>
#include <nlohmann/json_fwd.hpp>
#include "input_data.hpp"
using json = nlohmann::json;
namespace osfm{
struct Cam{
std::string projectionType = "";
int width = 0;
int height = 0;
double fx = 0;
double fy = 0;
double cx = 0;
double cy = 0;
double k1 = 0;
double k2 = 0;
double p1 = 0;
double p2 = 0;
double k3 = 0;
};
void from_json(const json& j, Cam &c);
struct Shot{
std::vector<float> rotation = {0.0f, 0.0f, 0.0f};
std::vector<float> translation = {0.0f, 0.0f, 0.0f};
std::string camera = "";
};
void from_json(const json& j, Shot &s);
struct Point{
std::vector<float> color;
std::vector<float> coordinates;
};
void from_json(const json& j, Point &p);
struct Reconstruction{
std::unordered_map<std::string, Cam> cameras;
std::unordered_map<std::string, Shot> shots;
std::unordered_map<std::string, Point> points;
};
void from_json(const json& j, Reconstruction &r);
InputData inputDataFromOpenSfM(const std::string &projectRoot);
}
#endif