![]() |
KudanCV
|
#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. | |
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.
KudanCameraParameters::KudanCameraParameters | ( | ) |
Default constructor sets everything to zero. Should not be available to user!
KudanCameraParameters::KudanCameraParameters | ( | float | focalLengthX, |
float | focalLengthY, | ||
float | principalPointX, | ||
float | principalPointY, | ||
float | width, | ||
float | height | ||
) |
Create an instance using known camera parameters.
focalLengthX,focalLengthY | The focal length of the camera in pixels |
principalPointX,principalPointY | The principal point of the camera in pixels |
width,height | The size of the images created by this camera |
KudanException | is 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. |
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
[out] | focalX,focalY | Focal length in pixels |
KudanMatrix3 KudanCameraParameters::getMatrix | ( | ) |
Get the 3x3 camera calibration matrix. The data are stored in column major order.
void KudanCameraParameters::getPrincipalPoint | ( | float & | principalX, |
float & | principalY | ||
) |
Access the intrinsic parameters of the camera. This returns the principal point in pixel units.
[out] | principalX,principalY | Principal point in pixels |
KudanMatrix4 KudanCameraParameters::getProjectionMatrix | ( | float | near, |
float | far | ||
) |
Get the 4x4 OpenGL-style projection matrix
near | Rendering frustum near clip plane |
far | Rendering frustum far clip plane |
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
[out] | width,height | Image size for this camera |
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
KudanException | is thrown if the parameters are not valid |
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
bool KudanCameraParameters::isValid | ( | ) |
Utility function to check that valid values are set. This is only needed because there is a defaut constructor!
void KudanCameraParameters::setIntrinsics | ( | float | focalLengthX, |
float | focalLengthY, | ||
float | principalPointX, | ||
float | principalPointY | ||
) |
(Re)set the intrinsic parameters (does not change the image size)
focalLengthX,focalLengthY | The focal length of the camera in pixels |
principalPointX,principalPointY | The principal point of the camera in pixels |
KudanException | is thrown if the parameters are not valid |
void KudanCameraParameters::setSize | ( | int | width, |
int | height | ||
) |
(Re)set the intrinsic size (does not change the intrinsic parameters)
width,height | The size of the images created by this camera |
KudanException | is thrown if the parameters are not valid |
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