FOUND
Loading...
Searching...
No Matches
found::Camera Class Reference

A Camera is a mutable object that represents a Camera. More...

#include <camera.hpp>

Public Member Functions

 Camera (const Camera &)=default
 Copy Constructor for Camera.
 
 Camera (decimal focalLength, decimal pixelSize, decimal xCenter, decimal yCenter, int xResolution, int yResolution)
 Creates a Camera object off of real Camera parameters.
 
 Camera (decimal focalLength, decimal pixelSize, int xResolution, int yResolution)
 Creates a Camera object off of ideal Camera parameters.
 
Vec2 SpatialToCamera (const Vec3 &) const
 Converts from a 3D point in space to a 2D point on the camera sensor.
 
Vec3 CameraToSpatial (const Vec2 &) const
 Gives a point in 3d space that could correspond to the given vector, using the same coordinate system described for SpatialToCamera.
 
bool InSensor (const Vec2 &vector) const
 Evaluates whether a vector can be seen in the camera.
 
int XResolution () const
 Returns the X resolution of this camera.
 
int YResolution () const
 Returns the Y resolution of this camera.
 
decimal FocalLength () const
 Returns the focal length of this camera.
 
decimal PixelSize () const
 Returns the pixel size of this camera.
 
decimal Fov () const
 Provides the Field of View (FOV) of this Camera.
 
void SetFocalLength (decimal focalLength)
 Sets the focal length of this.
 

Private Attributes

decimal focalLength
 The focal length (m)
 
decimal pixelSize
 The pixel size (m)
 
decimal xCenter
 The x center (pixels)
 
decimal yCenter
 The y center (pixels)
 
int xResolution
 The x resolution (pixels)
 
int yResolution
 The y resolution (pixels)
 

Detailed Description

A Camera is a mutable object that represents a Camera.

All camera dimensions are in SI

Note
This object contains enough information to reconstruct a Camera Matrix

Constructor & Destructor Documentation

◆ Camera() [1/3]

found::Camera::Camera ( const Camera )
default

Copy Constructor for Camera.

◆ Camera() [2/3]

found::Camera::Camera ( decimal  focalLength,
decimal  pixelSize,
decimal  xCenter,
decimal  yCenter,
int  xResolution,
int  yResolution 
)
inline

Creates a Camera object off of real Camera parameters.

Parameters
focalLengthThe focal length of the camera
pixelSizeThe physical size of a pixel (in meters)
xCenter,yCenterThe "principal point" of the camera.
xResolutionThe resolution of the camera in the x-direction
yResolutionThe resolution of the camera in the y-direction

◆ Camera() [3/3]

found::Camera::Camera ( decimal  focalLength,
decimal  pixelSize,
int  xResolution,
int  yResolution 
)
inline

Creates a Camera object off of ideal Camera parameters.

Parameters
focalLengthThe focal length of the camera
pixelSizeThe physical size of a pixel (in meters)
xResolutionThe resolution of the camera in the x-direction
yResolutionThe resolution of the camera in the y-direction
Note
In an ideal camera, the x and y centers are just half the resolution, but physical cameras often have a bit of offset.

Member Function Documentation

◆ CameraToSpatial()

Vec3 found::Camera::CameraToSpatial ( const Vec2 vector) const

Gives a point in 3d space that could correspond to the given vector, using the same coordinate system described for SpatialToCamera.

Parameters
vectorThe vector on the camera to convert to a 3D vector
Returns
A vector in 3d space corresponding to the given vector, with x-component equal to 1
Note
Not all vectors returned by this function will necessarily have the same magnitude.
Warning
Other functions rely on the fact that returned vectors are placed one unit away (x-component equal to 1). Don't change this behavior!

◆ FocalLength()

decimal found::Camera::FocalLength ( ) const
inline

Returns the focal length of this camera.

Returns
The focal length of this

◆ Fov()

decimal found::Camera::Fov ( ) const

Provides the Field of View (FOV) of this Camera.

Returns
The FOV of this, in radians

◆ InSensor()

bool found::Camera::InSensor ( const Vec2 vector) const

Evaluates whether a vector can be seen in the camera.

Parameters
vectorThe vector to evaluate
Returns
true iff vector could be seen in this camera

◆ PixelSize()

decimal found::Camera::PixelSize ( ) const
inline

Returns the pixel size of this camera.

Returns
The pixel size of this

◆ SetFocalLength()

void found::Camera::SetFocalLength ( decimal  focalLength)
inline

Sets the focal length of this.

Parameters
focalLengthThe focal length to give this camera

◆ SpatialToCamera()

Vec2 found::Camera::SpatialToCamera ( const Vec3 vector) const

Converts from a 3D point in space to a 2D point on the camera sensor.

Parameters
vectorA 3D vector to convert to a vector on the camera
Returns
The 2D Vector that represents the 3D vector on the camera
Note
Assumes that X is the depth direction and that it points away from the center of the sensor, i.e., any vector (x, 0, 0) will be at (xResolution/2, yResolution/2) on the sensor.

◆ XResolution()

int found::Camera::XResolution ( ) const
inline

Returns the X resolution of this camera.

Returns
the X resolution of this

◆ YResolution()

int found::Camera::YResolution ( ) const
inline

Returns the Y resolution of this camera.

Returns
the Y resolution of this

Member Data Documentation

◆ focalLength

decimal found::Camera::focalLength
private

The focal length (m)

◆ pixelSize

decimal found::Camera::pixelSize
private

The pixel size (m)

◆ xCenter

decimal found::Camera::xCenter
private

The x center (pixels)

◆ xResolution

int found::Camera::xResolution
private

The x resolution (pixels)

◆ yCenter

decimal found::Camera::yCenter
private

The y center (pixels)

◆ yResolution

int found::Camera::yResolution
private

The y resolution (pixels)


The documentation for this class was generated from the following files: