7 #ifndef UTILS_INTRINSIC_PARAMS_H 8 #define UTILS_INTRINSIC_PARAMS_H 11 #include <glm/common.hpp> 12 #include <glm/trigonometric.hpp> 14 #include <Utils/API.h> 15 #include <Utils/SerializableJson.h> 29 float fx{ 0.0f }, fy{ 0.0f };
31 float cx{ 0.0f }, cy{ 0.0f };
35 : fx(t_fx), fy(t_fy), cx(t_cx), cy(t_cy) {}
40 return 2.0f * glm::atan(cx / fx);
45 return 2.0f * glm::atan(cy / fy);
48 virtual void AddToJsonNode(nlohmann::json &node)
const override;
51 virtual bool ReadFromJsonNode(
const nlohmann::json &node)
override;
58 focal_length * glm::tan(0.5f * fovx),
59 focal_length * glm::tan(0.5f * fovy)
66 const auto cx = 0.5f *
static_cast<float>(resolution.x);
67 const auto cy = 0.5f *
static_cast<float>(resolution.y);
68 const auto fx = cx / glm::tan(0.5f * fovx);
69 const auto fy = cy / glm::tan(0.5f * fovy);
77 const auto fx = c.x / glm::tan(0.5f * fovx);
78 const auto fy = c.y / glm::tan(0.5f * fovy);
Holds camera intrinsic projection parameters.
Definition: IntrinsicParams.h:26
float GetFovY() const
Calculates vertical field of view. In radians.
Definition: IntrinsicParams.h:43
IntrinsicParams GetIntrinsicParamsFromDepth(float focal_length, float fovx, float fovy)
Calculates intrinsic projection parameters from projection depth and field of view angles...
Definition: IntrinsicParams.h:74
UTILS_API bool operator==(const IntrinsicParams &p1, const IntrinsicParams &p2)
Compare equality of two parameter structures.
float GetFovX() const
Calculates horizontal field of view. In radians.
Definition: IntrinsicParams.h:38
Abstration of a class that supports serialization to json strings.
Definition: SerializableJson.h:20
glm::vec2 GetPrincipalPoint(float focal_length, float fovx, float fovy)
Returns intrinsic cx, cy parameters for defined projection depth and field of view angles...
Definition: IntrinsicParams.h:55
UTILS_API bool operator!=(const IntrinsicParams &p1, const IntrinsicParams &p2)
Compare unequality of two parameter structures.
General namespace for utilities.
Definition: BulletConversions.h:9
IntrinsicParams GetIntrinsicParamsFromResolution(const glm::uvec2 &resolution, float fovx, float fovy)
Calculates intrinsic projection parameters from resolution and field of view angles.
Definition: IntrinsicParams.h:64