FOUND
Loading...
Searching...
No Matches
camera.hpp
1#ifndef SRC_COMMON_SPATIAL_CAMERA_HPP_
2#define SRC_COMMON_SPATIAL_CAMERA_HPP_
3
4#include "common/spatial/attitude-utils.hpp"
5
6#include "common/style.hpp"
7
8namespace found {
9
13
22class Camera {
23 public:
27 Camera(const Camera &) = default;
28
44
58 xResolution / (decimal) 2.0, yResolution / (decimal) 2.0,
60
61 // Projection of vectors into image and space
62
74 Vec2 SpatialToCamera(const Vec3 &) const;
75
88 Vec3 CameraToSpatial(const Vec2 &) const;
89
97 bool InSensor(const Vec2 &vector) const;
98
99 // Accessor Methods to Camera Parameters
100
106 int XResolution() const { return xResolution; }
107
113 int YResolution() const { return yResolution; }
114
120 decimal FocalLength() const { return focalLength; }
121
127 decimal PixelSize() const { return pixelSize; }
128
135 decimal Fov() const;
136
137 // Mutator Method for Cameras
138
144 void SetFocalLength(decimal focalLength) { this->focalLength = focalLength; }
145
146 private:
147 // TODO: distortion
149 decimal focalLength;
151 decimal pixelSize;
153 decimal xCenter;
155 decimal yCenter;
160};
161
165
176decimal FovToFocalLength(decimal xFov, decimal xResolution);
177
189decimal FocalLengthToFov(decimal focalLength, decimal xResolution, decimal pixelSize);
190
191} // namespace found
192
193#endif // SRC_COMMON_SPATIAL_CAMERA_HPP_
A Camera is a mutable object that represents a Camera.
Definition camera.hpp:22
bool InSensor(const Vec2 &vector) const
Evaluates whether a vector can be seen in the camera.
Definition camera.cpp:42
decimal yCenter
The y center (pixels)
Definition camera.hpp:155
int XResolution() const
Returns the X resolution of this camera.
Definition camera.hpp:106
int yResolution
The y resolution (pixels)
Definition camera.hpp:159
decimal PixelSize() const
Returns the pixel size of this camera.
Definition camera.hpp:127
int xResolution
The x resolution (pixels)
Definition camera.hpp:157
Camera(decimal focalLength, decimal pixelSize, int xResolution, int yResolution)
Creates a Camera object off of ideal Camera parameters.
Definition camera.hpp:56
Camera(const Camera &)=default
Copy Constructor for Camera.
decimal Fov() const
Provides the Field of View (FOV) of this Camera.
Definition camera.cpp:50
decimal xCenter
The x center (pixels)
Definition camera.hpp:153
decimal pixelSize
The pixel size (m)
Definition camera.hpp:151
decimal FocalLength() const
Returns the focal length of this camera.
Definition camera.hpp:120
Vec3 CameraToSpatial(const Vec2 &) const
Gives a point in 3d space that could correspond to the given vector, using the same coordinate system...
Definition camera.cpp:27
int YResolution() const
Returns the Y resolution of this camera.
Definition camera.hpp:113
Camera(decimal focalLength, decimal pixelSize, decimal xCenter, decimal yCenter, int xResolution, int yResolution)
Creates a Camera object off of real Camera parameters.
Definition camera.hpp:38
Vec2 SpatialToCamera(const Vec3 &) const
Converts from a 3D point in space to a 2D point on the camera sensor.
Definition camera.cpp:14
decimal focalLength
The focal length (m)
Definition camera.hpp:149
void SetFocalLength(decimal focalLength)
Sets the focal length of this.
Definition camera.hpp:144
A Vec3 is a mutable object that represents a 3D Vector.
Definition attitude-utils.hpp:98
A Vec2 is an immutable object that represents a 2D Vector.
Definition attitude-utils.hpp:22