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

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

#include <camera.hpp>

Public Member Functions

 Camera (const Camera &)=default
 Copy Constructor for Camera.
 
 Camera (decimal focalLength, int xResolution, int yResolution, decimal xCenter, decimal yCenter, decimal xPixelPitch, decimal yPixelPitch)
 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 CameraToPixelCoordinates (const Vec3 &) const
 Uses the pinhole camera model to map a 3D vector in the camera frame to a 2D point in pixel coordinates (row and column index of image matrix).
 
Vec3 PixelToImageCoordinates (const Vec2 &) const
 Maps a 2D point in pixel coordinates (row and column index of image matrix) to a point on the image plane.
 
bool InSensor (const Vec2 &vector) const
 Evaluates whether a vector can be seen in the camera.
 
const Mat3 & GetCalibrationMatrix () const
 Expose camera calibration matrix (intrinsic matrix)
 
const Mat3 & GetInverseCalibrationMatrix () const
 Expose inverse camera calibration matrix (intrinsic matrix)
 

Private Member Functions

Mat3 initCalibrationMatrix ()
 Computes and initializes the calibration matrix and the inverse calibration matrix from camera parameters.
 

Private Attributes

decimal focalLength_
 The focal length (m)
 
int xResolution_
 The x resolution (pixels)
 
int yResolution_
 The y resolution (pixels)
 
decimal xCenter_
 The x center (pixels)
 
decimal yCenter_
 The y center (pixels)
 
decimal xPixelPitch_
 The x pixel pitch (m)
 
decimal yPixelPitch_
 The y pixel pitch (m)
 
Mat3 calibrationMatrix_
 The camera calibration matrix.
 
Mat3 inverseCalibrationMatrix_
 The inverse camera calibration matrix.
 

Detailed Description

A Camera is a mutable object that represents a pinhole camera.

Precondition
Camera dimensions are in SI
Note
Follows the convention as laid out in Fundamentals of Space OpNav (Christian, 2026)
  • The optical center (hole in pinhole camera model) is located at the origin (0, 0, 0)
  • The x-axis points to the right
  • The y-axis points down
  • The z-axis points along the camera's optical axis (depth)
  • The virtual image plane is located at z = 1
  • The detector plane is located at z = -focalLength

Constructor & Destructor Documentation

◆ Camera() [1/2]

found::Camera::Camera ( decimal  focalLength,
int  xResolution,
int  yResolution,
decimal  xCenter,
decimal  yCenter,
decimal  xPixelPitch,
decimal  yPixelPitch 
)

Creates a Camera object off of real 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
xCenter,yCenterThe "principal point" of the camera.
xPixelPitchThe physical size of a pixel in the x-direction (in meters)
yPixelPitchThe physical size of a pixel in the y-direction (in meters)

◆ Camera() [2/2]

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

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

◆ CameraToPixelCoordinates()

Vec2 found::Camera::CameraToPixelCoordinates ( const Vec3 &  vector) const

Uses the pinhole camera model to map a 3D vector in the camera frame to a 2D point in pixel coordinates (row and column index of image matrix).

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
Any vector (x, 0, 0), x > 0, will be projected onto the principal point of the sensor.

◆ GetCalibrationMatrix()

const Mat3 & found::Camera::GetCalibrationMatrix ( ) const
inline

Expose camera calibration matrix (intrinsic matrix)

Returns
The camera calibration matrix

◆ GetInverseCalibrationMatrix()

const Mat3 & found::Camera::GetInverseCalibrationMatrix ( ) const
inline

Expose inverse camera calibration matrix (intrinsic matrix)

Returns
The inverse camera calibration matrix

◆ initCalibrationMatrix()

Mat3 found::Camera::initCalibrationMatrix ( )
private

Computes and initializes the calibration matrix and the inverse calibration matrix from camera parameters.

Returns
The camera calibration matrix

◆ 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

◆ PixelToImageCoordinates()

Vec3 found::Camera::PixelToImageCoordinates ( const Vec2 &  vector) const

Maps a 2D point in pixel coordinates (row and column index of image matrix) to a point on the image plane.

This is techinally a mapping from a 2D homogenous vector to another 2D homogenous vector, but the returned vector can be interpreted as a 3D vector where the x-componet, optical axis direction, is equal to 1.

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. Assumes that X is the depth direction and that it points normal to the camera sensor in the direction of the scene. Coordinate system: X=out, Y=left, Z=up. This coordinate frame has the distinct advantage that there is an identity rotation into equatorial coordinates when right-ascension, declination, and roll are all zero.
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!

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