My Project
Loading...
Searching...
No Matches
Public Member Functions | List of all members
found::Camera Class Reference

#include <camera.hpp>

Public Member Functions

 Camera (const Camera &)=default
 
 Camera (decimal focalLength, decimal xCenter, decimal yCenter, int xResolution, int yResolution)
 
 Camera (decimal focalLength, int xResolution, int yResolution)
 
Vec2 SpatialToCamera (const Vec3 &) const
 
Vec3 CameraToSpatial (const Vec2 &) const
 
bool InSensor (const Vec2 &vector) const
 
int XResolution () const
 
int YResolution () const
 
decimal FocalLength () const
 
decimal Fov () const
 
void SetFocalLength (decimal focalLength)
 

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  xCenter,
decimal  yCenter,
int  xResolution,
int  yResolution 
)
inline

Creates a Camera object off of real Camera parameters

Parameters
focalLengthThe focal length of the camera
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,
int  xResolution,
int  yResolution 
)
inline

Creates a Camera object off of ideal Camera parameters

Parameters
focalLengthThe focal length of the camera
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

◆ 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

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