-
Notifications
You must be signed in to change notification settings - Fork 89
/
nerfstudio.hpp
50 lines (40 loc) · 1.12 KB
/
nerfstudio.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
#ifndef NERFSTUDIO_H
#define NERFSTUDIO_H
#include <iostream>
#include <string>
#include <fstream>
#include <torch/torch.h>
#include <nlohmann/json_fwd.hpp>
#include "input_data.hpp"
using json = nlohmann::json;
namespace ns{
typedef std::vector<std::vector<float>> Mat4;
struct Frame{
std::string filePath = "";
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;
Mat4 transformMatrix;
};
void to_json(json &j, const Frame &f);
void from_json(const json& j, Frame &f);
struct Transforms{
std::string cameraModel;
std::vector<Frame> frames;
std::string plyFilePath;
};
void to_json(json &j, const Transforms &t);
void from_json(const json& j, Transforms &t);
Transforms readTransforms(const std::string &filename);
torch::Tensor posesFromTransforms(const Transforms &t);
InputData inputDataFromNerfStudio(const std::string &projectRoot);
}
#endif