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
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#pragma once
#include "config.hpp"
#include "object.hpp"
#include <vector>
namespace VideoStitch {
namespace Ptv {
class Value;
}
namespace Core {
/**
* @brief A stereo rig representation class.
*/
class VS_EXPORT StereoRigDefinition : public Ptv::Object {
public:
/**
* Orientation of the camera in the horizontal plane.
*/
enum Orientation { Portrait, Landscape, Portrait_flipped, Landscape_flipped };
/**
* Geometry of the rig.
*/
enum Geometry { Circular, Polygonal };
~StereoRigDefinition();
/**
* Clones a Rig java-style.
* @return A similar Rig. Ownership is given to the caller.
*/
StereoRigDefinition* clone() const;
/**
* Build from a Ptv::Value.
* @param value Input value.
* @return The parsed Rig, or NULL on error.
*/
static StereoRigDefinition* create(const Ptv::Value& value);
Ptv::Value* serialize() const;
/**
* Comparison operator.
*/
bool operator==(const StereoRigDefinition& other) const;
/**
* Validate that the rig makes sense.
* @param os The sink for error messages.
* @return false of failure.
*/
bool validate(std::ostream& os) const;
/**
* Returns the orientation of the cameras in the horizontal plane.
*/
Orientation getOrientation() const;
/**
* Returns the geometry of the rig.
*/
Geometry getGeometry() const;
/**
* Returns the diameter of the rig.
* @note Only used for circular rigs.
*/
double getDiameter() const;
/**
* Returns the inter-pupillary distance expected.
*/
double getIPD() const;
/**
* Returns the set of inputs for the left eye.
*/
std::vector<int> getLeftInputs() const;
/**
* Returns the set of inputs for the right eye.
*/
std::vector<int> getRightInputs() const;
/**
* Sets the orientation of the cameras in the horizontal plane.
*/
void setOrientation(Orientation);
/**
* Sets the geometry of the rig.
*/
void setGeometry(Geometry);
/**
* Sets the diameter of the rig.
* @note Only used for circular rigs.
*/
void setDiameter(double);
/**
* Sets the expected inter-pupillary distance.
*/
void setIPD(double);
/**
* Sets the left inputs list
*/
void setLeftInputs(const std::vector<int>& left);
/**
* Sets the right inputs list
*/
void setRightInputs(const std::vector<int>& right);
/**
* Auxiliary methods for converting enum values into strings and vice-versa
*/
/**
* Set geometry enum by providing its name as a string
* @param name name of the geomtry
* @param geom geometry to be set if a valid name is provided
* @return Returns true on success, false if the given name is not known or invalid
*/
static bool getGeometryFromName(const std::string& name, Geometry& geom);
/**
* Set orientatn enum by providing its name as a string
* @param name name of the orientation
* @param orient orientation to be set if a valid name is provided
* @return Returns true on success, false if the given name is not known or invalid
*/
static bool getOrientationFromName(const std::string& name, Orientation& orient);
/**
* Get orientation name from its enum value
* @param orient Orientation enum to be converted to string
* @return Returns name for the given orientation enum
*/
static const std::string getOrientationName(const Orientation orient);
/**
* Get geometry name from its enum value
* @param geom Geometry enum to be converted to string
* @return Returns name for the given Geometry enum
*/
static const std::string getGeometryName(const Geometry geom);
protected:
/**
* Build with the mandatory fields. The others take default values.
*/
StereoRigDefinition();
/**
* Disabled, use clone()
*/
StereoRigDefinition(const StereoRigDefinition&) = delete;
/**
* Disabled, use clone()
*/
StereoRigDefinition& operator=(const StereoRigDefinition&) = delete;
private:
class Pimpl;
Pimpl* const pimpl;
};
} // namespace Core
} // namespace VideoStitch