KudanCV
KudanCameraParameters Class Reference

#include <KudanCV.h>

Public Member Functions

 KudanCameraParameters ()
 
 KudanCameraParameters (float focalLengthX, float focalLengthY, float principalPointX, float principalPointY, float width, float height)
 
void setIntrinsics (float focalLengthX, float focalLengthY, float principalPointX, float principalPointY)
 
void setSize (int width, int height)
 
void guessIntrinsics ()
 
KudanMatrix3 getMatrix ()
 
KudanMatrix4 getProjectionMatrix (float near, float far)
 
void getFocalLength (float &focalX, float &focalY)
 
void getPrincipalPoint (float &principalX, float &principalY)
 
void getSize (int &width, int &height)
 
bool isValid ()
 
int width ()
 
int height ()
 

Static Public Attributes

static const int maxImageSize = 1 << 30
 This is to stop obviously wrong camera parameters being passed in.
 

Detailed Description

Represents the intrinsic calibration parameters of a pin-hole camera. This encodes the focal length (x and y separate) and principal point, as well as the image size. If the intrinsics are not known, this class can be used to guess them for a camera of a given size. This is used to specify the parameters of a camera for the tracker.

Constructor & Destructor Documentation

◆ KudanCameraParameters() [1/2]

KudanCameraParameters::KudanCameraParameters ( )

Default constructor sets everything to zero. Should not be available to user!

◆ KudanCameraParameters() [2/2]

KudanCameraParameters::KudanCameraParameters ( float  focalLengthX,
float  focalLengthY,
float  principalPointX,
float  principalPointY,
float  width,
float  height 
)

Create an instance using known camera parameters.

Parameters
focalLengthX,focalLengthYThe focal length of the camera in pixels
principalPointX,principalPointYThe principal point of the camera in pixels
width,heightThe size of the images created by this camera
Exceptions
KudanExceptionis thrown if the parameters are invalid, including: the image size is zero, negative, or too large in any dimension; if the principal point is outside the image; and if the focal length is zero or negative.

Member Function Documentation

◆ getFocalLength()

void KudanCameraParameters::getFocalLength ( float &  focalX,
float &  focalY 
)

Access the intrinsic parameters of the camera. This returns the focal length in the X and Y directions

Parameters
[out]focalX,focalYFocal length in pixels

◆ getMatrix()

KudanMatrix3 KudanCameraParameters::getMatrix ( )

Get the 3x3 camera calibration matrix. The data are stored in column major order.

Returns
a KudanMatrix3 representing the 3x3 instinsic camera matrix

◆ getPrincipalPoint()

void KudanCameraParameters::getPrincipalPoint ( float &  principalX,
float &  principalY 
)

Access the intrinsic parameters of the camera. This returns the principal point in pixel units.

Parameters
[out]principalX,principalYPrincipal point in pixels

◆ getProjectionMatrix()

KudanMatrix4 KudanCameraParameters::getProjectionMatrix ( float  near,
float  far 
)

Get the 4x4 OpenGL-style projection matrix

Parameters
nearRendering frustum near clip plane
farRendering frustum far clip plane
Returns
a KudanMatrix representing the 4x4 OpenGL proejction matrix

◆ getSize()

void KudanCameraParameters::getSize ( int &  width,
int &  height 
)

Access the intrinsic parameters of the camera. This returns the size in pixels of the image that is expected from the camera

Parameters
[out]width,heightImage size for this camera

◆ guessIntrinsics()

void KudanCameraParameters::guessIntrinsics ( )

Assuming the width and height have been set, this guesses appropriate values for the intrinsics. If the image size corresponds to a certain set of common devices, the pre-calibrated parameters are used. Otherwise, appropriate approximations are used given the image size. This will throw a KudanException if the parameters are not valid

Exceptions
KudanExceptionis thrown if the parameters are not valid

◆ height()

int KudanCameraParameters::height ( )

Access the intrinsic parameters of the camera. This returns the height in pixels of the image that is expected from the camera

Returns
The height of the expected camera image

◆ isValid()

bool KudanCameraParameters::isValid ( )

Utility function to check that valid values are set. This is only needed because there is a defaut constructor!

Returns
A boolean indicating whether this camera is valid

◆ setIntrinsics()

void KudanCameraParameters::setIntrinsics ( float  focalLengthX,
float  focalLengthY,
float  principalPointX,
float  principalPointY 
)

(Re)set the intrinsic parameters (does not change the image size)

Parameters
focalLengthX,focalLengthYThe focal length of the camera in pixels
principalPointX,principalPointYThe principal point of the camera in pixels
Exceptions
KudanExceptionis thrown if the parameters are not valid

◆ setSize()

void KudanCameraParameters::setSize ( int  width,
int  height 
)

(Re)set the intrinsic size (does not change the intrinsic parameters)

Parameters
width,heightThe size of the images created by this camera
Exceptions
KudanExceptionis thrown if the parameters are not valid

◆ width()

int KudanCameraParameters::width ( )

Access the intrinsic parameters of the camera. This returns the width in pixels of the image that is expected from the camera

Returns
The width of the expected camera image

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