-
Notifications
You must be signed in to change notification settings - Fork 199
/
NeuralStructure.h
60 lines (42 loc) · 1.33 KB
/
NeuralStructure.h
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
/**
* Copyright (c) 2021 Darius Rückert
* Licensed under the MIT License.
* See LICENSE file for more information.
*/
#pragma once
#include "saiga/core/Core.h"
#include "SceneData.h"
#include "Settings.h"
#include "config.h"
#include <torch/torch.h>
using namespace Saiga;
class PoseModuleImpl : public torch::nn::Module
{
public:
PoseModuleImpl(std::shared_ptr<SceneData> scene);
// Adds only a single pose
PoseModuleImpl(Sophus::SE3d pose);
std::vector<Sophus::SE3d> Download();
void SetPose(int id, Sophus::SE3d pose);
// double: [num_cameras, 8]
torch::Tensor poses_se3;
// double: [num_cameras, 6]
torch::Tensor tangent_poses;
void ApplyTangent();
};
TORCH_MODULE(PoseModule);
class IntrinsicsModuleImpl : public torch::nn::Module
{
public:
IntrinsicsModuleImpl(std::shared_ptr<SceneData> scene);
// Adds only a single intrinsic
IntrinsicsModuleImpl(IntrinsicsPinholef K);
std::vector<Distortionf> DownloadDistortion();
std::vector<IntrinsicsPinholef> DownloadK();
void SetPinholeIntrinsics(int id, IntrinsicsPinholef K, Distortionf dis);
// [num_cameras, num_model_params]
// Pinhole + Distortion: [num_cameras, 5 + 8]
// OCam: [num_cameras, 5 + world2cam_coefficients]
torch::Tensor intrinsics;
};
TORCH_MODULE(IntrinsicsModule);