HoviTron Video Pipeline
Parameters.h
1/* The copyright in this software is being made available under the BSD
2* License, included below. This software may be subject to other third party
3* and contributor rights, including patent rights, and no such rights are
4* granted under this license.
5*
6* Copyright (c) 2010-2018, ITU/ISO/IEC
7* All rights reserved.
8*
9* Redistribution and use in source and binary forms, with or without
10* modification, are permitted provided that the following conditions are met:
11*
12* * Redistributions of source code must retain the above copyright notice,
13* this list of conditions and the following disclaimer.
14* * Redistributions in binary form must reproduce the above copyright notice,
15* this list of conditions and the following disclaimer in the documentation
16* and/or other materials provided with the distribution.
17* * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
18* be used to endorse or promote products derived from this software without
19* specific prior written permission.
20*
21* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31* THE POSSIBILITY OF SUCH DAMAGE.
32*/
33
34/*
35Original authors:
36
37Universite Libre de Bruxelles, Brussels, Belgium:
38 Sarah Fachada, Sarah.Fernandes.Pinto.Fachada@ulb.ac.be
39 Daniele Bonatto, Daniele.Bonatto@ulb.ac.be
40 Arnaud Schenkel, arnaud.schenkel@ulb.ac.be
41
42Koninklijke Philips N.V., Eindhoven, The Netherlands:
43 Bart Kroon, bart.kroon@philips.com
44 Bart Sonneveldt, bart.sonneveldt@philips.com
45*/
46
47#ifndef _PARAMETERS_HPP_
48#define _PARAMETERS_HPP_
49
50#include "JsonParser.h"
51#include <opencv2/core.hpp>
52
58namespace rvs
59{
63 namespace ProjectionType {
64 auto const perspective = "Perspective";
65 auto const equirectangular = "Equirectangular";
66 }
67
68 enum class ColorFormat {
69 YUV420,
70 YUV400
71 };
72
74 class Parameters {
75 public:
79 static Parameters readFrom(json::Node parameters);
80
82 json::Node const& getRoot() const;
83
85 std::string const& getProjectionType() const;
86
88 cv::Vec3f getRotation() const;
89
91 void setRotation(cv::Vec3f);
92
94 cv::Matx33f getRotationMatrix() const;
95
97 cv::Vec3f getPosition() const;
98
100 void setPosition(cv::Vec3f);
101
106 cv::Vec2f getDepthRange() const;
107
109 bool hasInvalidDepth() const;
110
112 cv::Size getPaddedSize() const;
113
115 cv::Size getSize() const;
116
121 cv::Rect getCropRegion() const;
122
124 int getColorBitDepth() const;
125
127 int getDepthBitDepth() const;
128
130 ColorFormat getColorFormat() const;
131
133 ColorFormat getDepthColorFormat() const;
134
136 cv::Vec2f getHorRange() const;
137
139 cv::Vec2f getVerRange() const;
140
142 bool isFullHorRange() const;
143
145 cv::Vec2f getFocal() const;
146
150 cv::Vec2f getPrinciplePoint() const;
151
153 void printTo(std::ostream& stream) const;
154
156 void setNewResolution(int w, int h);
157
158 void setFov(float fovV, float fovH);
159 void setFov(cv::Vec4f & fov);
160
161 private:
163
164 void setProjectionFrom(json::Node root);
165 void setPositionFrom(json::Node root);
166 void setRotationFrom(json::Node root);
167 void setDepthRangeFrom(json::Node root);
168 void setHasInvalidDepth(json::Node root);
169 void setResolutionFrom(json::Node root);
170
171 void setBitDepthColorFrom(json::Node root);
172 void setBitDepthDepthFrom(json::Node root);
173 void setColorFormatFrom(json::Node root);
174 void setDepthColorFormatFrom(json::Node root);
175 void setHorRangeFrom(json::Node root);
176 void setVerRangeFrom(json::Node root);
177 void setCropRegionFrom(json::Node root);
178 void setFocalFrom(json::Node root);
179 void setPrinciplePointFrom(json::Node root);
180
182 static void validateUnused(json::Node root);
183
184 json::Node m_root;
185 std::string m_projectionType;
186 cv::Vec3f m_position;
187 cv::Vec3f m_rotation;
188 cv::Vec2f m_depthRange;
189 bool m_hasInvalidDepth;
190 cv::Size m_resolution;
191 int m_bitDepthColor;
192 int m_bitDepthDepth;
193 ColorFormat m_colorFormat;
194 ColorFormat m_depthColorFormat;
195 cv::Vec2f m_horRange;
196 cv::Vec2f m_verRange;
197 bool m_isFullHorRange;
198 cv::Rect m_cropRegion;
199 cv::Vec2f m_focal;
200 cv::Vec2f m_principlePoint;
201 };
202}
203
204#endif
cv::Rect getCropRegion() const
Definition: Parameters.cpp:143
void setRotation(cv::Vec3f)
Definition: Parameters.cpp:101
int getColorBitDepth() const
Definition: Parameters.cpp:148
void setNewResolution(int w, int h)
Definition: Parameters.cpp:374
ColorFormat getColorFormat() const
Definition: Parameters.cpp:158
std::string const & getProjectionType() const
Definition: Parameters.cpp:91
cv::Size getSize() const
Definition: Parameters.cpp:138
bool hasInvalidDepth() const
Definition: Parameters.cpp:128
cv::Vec3f getRotation() const
Definition: Parameters.cpp:96
static Parameters readFrom(json::Node parameters)
Definition: Parameters.cpp:62
cv::Vec2f getDepthRange() const
Definition: Parameters.cpp:123
void printTo(std::ostream &stream) const
Definition: Parameters.cpp:197
cv::Vec2f getPrinciplePoint() const
Definition: Parameters.cpp:191
cv::Vec2f getHorRange() const
Definition: Parameters.cpp:168
cv::Vec2f getVerRange() const
Definition: Parameters.cpp:174
json::Node const & getRoot() const
Definition: Parameters.cpp:86
void setPosition(cv::Vec3f)
Definition: Parameters.cpp:118
cv::Size getPaddedSize() const
Definition: Parameters.cpp:133
cv::Matx33f getRotationMatrix() const
Definition: Parameters.cpp:106
cv::Vec3f getPosition() const
Definition: Parameters.cpp:113
ColorFormat getDepthColorFormat() const
Definition: Parameters.cpp:163
int getDepthBitDepth() const
Definition: Parameters.cpp:153
cv::Vec2f getFocal() const
Definition: Parameters.cpp:185
bool isFullHorRange() const
Definition: Parameters.cpp:180