UFO 1.0.0
An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
Loading...
Searching...
No Matches
orthogonal_intrinsics.hpp
1
45#ifndef UFO_VISION_CAMERA_ORTHOGONAL_INTRINSICS_HPP
46#define UFO_VISION_CAMERA_ORTHOGONAL_INTRINSICS_HPP
47
48// STL
49#include <cmath>
50#include <cstddef>
51#include <format>
52#include <ostream>
53
54namespace ufo
55{
68 std::size_t rows{};
72 std::size_t cols{};
76 float width{};
80 float height{};
85 float zoom = 1.0f;
86
91 [[nodiscard]] constexpr float aspect() const noexcept
92 {
93 return static_cast<float>(cols) / static_cast<float>(rows);
94 }
95
99 [[nodiscard]] friend bool operator==(OrthogonalIntrinsics const&,
100 OrthogonalIntrinsics const&) noexcept = default;
101};
102
106inline std::ostream& operator<<(std::ostream& os, OrthogonalIntrinsics const& intrinsics)
107{
108 os << "Rows: " << intrinsics.rows << ", Cols: " << intrinsics.cols
109 << "\nWidth: " << intrinsics.width << ", Height: " << intrinsics.height
110 << "\nZoom: " << intrinsics.zoom;
111 return os;
112}
113
117} // namespace ufo
118
119template <>
120struct std::formatter<ufo::OrthogonalIntrinsics> {
121 constexpr auto parse(std::format_parse_context& ctx) const { return ctx.begin(); }
122
123 auto format(ufo::OrthogonalIntrinsics const& intrinsics, std::format_context& ctx) const
124 {
125 return std::format_to(
126 ctx.out(), "Rows: {}, Cols: {}\nWidth: {}, Height: {}\nZoom: {}", intrinsics.rows,
127 intrinsics.cols, intrinsics.width, intrinsics.height, intrinsics.zoom);
128 }
129};
130
131#endif // UFO_VISION_CAMERA_ORTHOGONAL_INTRINSICS_HPP
All vision-related classes and functions.
Definition cloud.hpp:49
Stores the intrinsic parameters of an orthogonal camera.
float height
Viewport height in world-space units (e.g., meters).
std::size_t rows
Image height in pixels.
float width
Viewport width in world-space units (e.g., meters).
constexpr float aspect() const noexcept
Computes the aspect ratio (cols / rows).
friend bool operator==(OrthogonalIntrinsics const &, OrthogonalIntrinsics const &) noexcept=default
Memberwise equality comparison.
std::size_t cols
Image width in pixels.