mimas::camera_calibration::Camera Class Reference
[Camera Calibration]

This class represents a camera, and provides some functions to calibrate it. More...

#include <camera.h>

Collaboration diagram for mimas::camera_calibration::Camera:

Collaboration graph
[legend]
List of all members.

Public Types

typedef boost::numeric::ublas::matrix<
double, boost::numeric::ublas::column_major > 
Matrix
 Matrix definition.
typedef boost::numeric::ublas::vector<
double
Vector
 Vector definition.
typedef boost::numeric::ublas::triangular_matrix<
double, boost::numeric::ublas::upper,
boost::numeric::ublas::column_major > 
TriangularMatrix
 Triangular matrix definition.
typedef boost::numeric::ublas::symmetric_matrix<
double, boost::numeric::ublas::upper,
boost::numeric::ublas::column_major > 
SymmetricMatrix
 Symmetric matrix definition.

Public Member Functions

 Camera () throw (mimasexception)
 Constructor : instanciate ONE class.
 ~Camera ()
 Free the class.
void calibrate (std::vector< Chessboard > &chess) throw (mimasexception)
 Calibrate the camera.
Matrix getIntrinsicsInit () const
 Returns first approximation of the matrix of the intrinsic parameters.
Matrix getIntrinsics () const
 Returns the optimized matrix of the intrinsic parameters.
Vector getDistortion () const
 Returns the distortion.
bool isOptimized () const
 Returns if the optimisation algorithm worked or not.

Static Public Member Functions

static void fcn (int *m, int *, double *x, double *fvec, int *)
 Calculate the projection of the chessboard points according to the given values of the intrinsic matrix and the distortion coefficients, and return an array containing the error between the mesured point and the calculated one.
static void findHomography (const Chessboard &chess, Matrix &homography)
 Find the homography.
static void findHomographies (std::vector< Matrix > &homographies, std::vector< Chessboard > &chess)
 Find all the homographies.
static Matrix initCalibration (std::vector< Matrix > &homographies, std::vector< Chessboard > &chess) throw (mimasexception)
 Find a first approximation of the intrinsic matrix.
static void findExtrinsics (std::vector< Matrix > &extrinsics, std::vector< Matrix > &homographies, Matrix &intrinsics, int nbPictures)
 Find the extrinsic parameters.

Static Public Attributes

static Cameracurrent_cam
 pointer to the current class.

Protected Member Functions

void maxLikelyhood (Matrix &intrinsics, int nbPictures) throw (mimasexception)
 This function applies the Levenberg-Marquardt algorithm to the first approximation of the intrinsic matrix.

Detailed Description

This class represents a camera, and provides some functions to calibrate it.

The class can be used with a float or double template, depending on the precision required in the calculus.

Important : because of a limitation of a FORTRAN library used by the calibration algorithm, it's only possible to instanciate one class Camera at the same time.

Author:
Julien Faucher (faucherj@gmail.com)

Definition at line 57 of file camera.h.


Member Typedef Documentation

typedef boost::numeric::ublas::matrix< double, boost::numeric::ublas::column_major > mimas::camera_calibration::Camera::Matrix

Matrix definition.

Definition at line 61 of file camera.h.

typedef boost::numeric::ublas::vector< double > mimas::camera_calibration::Camera::Vector

Vector definition.

Definition at line 64 of file camera.h.

typedef boost::numeric::ublas::triangular_matrix< double, boost::numeric::ublas::upper, boost::numeric::ublas::column_major > mimas::camera_calibration::Camera::TriangularMatrix

Triangular matrix definition.

Definition at line 68 of file camera.h.

typedef boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper, boost::numeric::ublas::column_major > mimas::camera_calibration::Camera::SymmetricMatrix

Symmetric matrix definition.

Definition at line 72 of file camera.h.


Constructor & Destructor Documentation

mimas::camera_calibration::Camera::Camera (  )  throw (mimasexception)

Constructor : instanciate ONE class.

mimas::camera_calibration::Camera::~Camera (  ) 

Free the class.


Member Function Documentation

void mimas::camera_calibration::Camera::maxLikelyhood ( Matrix intrinsics,
int  nbPictures 
) throw (mimasexception) [protected]

This function applies the Levenberg-Marquardt algorithm to the first approximation of the intrinsic matrix.

void mimas::camera_calibration::Camera::calibrate ( std::vector< Chessboard > &  chess  )  throw (mimasexception)

Calibrate the camera.

This is the function one should call to get the calibration parameters.

To calibrate the camera, one should provide four points of the chessboard in the coordinate of the chessboard (the unit is the square), and the coordinates of the same points in the picture of the chessboard taken by the camera (the unit is the pixel).

A minimum of 4 images is required to compute the calibration, but you will need much more to get an accurate result.

Parameters:
chess a vector of Chessboard classes, to know the images of the chessboard points by the camera.

static void mimas::camera_calibration::Camera::fcn ( int m,
int ,
double x,
double fvec,
int  
) [static]

Calculate the projection of the chessboard points according to the given values of the intrinsic matrix and the distortion coefficients, and return an array containing the error between the mesured point and the calculated one.

This function is used by the MINPACK library (in FORTRAN) to minimize the error using the Levenberg-Marquardt algorithm.

Parameters:
m the number of functions ie 4 * nbPictures (there are 4 points per picture)
x an arrray containing the 5 intrinsic parameters and the 2 distortion parameters
fvec an output array, containing the result of each function.

static void mimas::camera_calibration::Camera::findHomography ( const Chessboard chess,
Matrix homography 
) [static]

Find the homography.

This function finds the homography between a set of $nb$ points and $nb$ images.

Parameters:
chess a Chessboard class
homography a 3*3 matrix, must be initialised.

static void mimas::camera_calibration::Camera::findHomographies ( std::vector< Matrix > &  homographies,
std::vector< Chessboard > &  chess 
) [static]

Find all the homographies.

Given 4 points and their images for some pictures, this function calculates all the homographies (one by picture).

static Matrix mimas::camera_calibration::Camera::initCalibration ( std::vector< Matrix > &  homographies,
std::vector< Chessboard > &  chess 
) throw (mimasexception) [static]

Find a first approximation of the intrinsic matrix.

This function returns a first approximation of the intrinsics, in the ideal case where there is no noise in the pictures, and no distortion.

static void mimas::camera_calibration::Camera::findExtrinsics ( std::vector< Matrix > &  extrinsics,
std::vector< Matrix > &  homographies,
Matrix intrinsics,
int  nbPictures 
) [static]

Find the extrinsic parameters.

This functions finds the extrinsic parameters (i.e. the rotation and the translation) between each image of the chessboard and the chessboard itself.

Matrix mimas::camera_calibration::Camera::getIntrinsicsInit (  )  const [inline]

Returns first approximation of the matrix of the intrinsic parameters.

Definition at line 177 of file camera.h.

Matrix mimas::camera_calibration::Camera::getIntrinsics (  )  const [inline]

Returns the optimized matrix of the intrinsic parameters.

Definition at line 180 of file camera.h.

Vector mimas::camera_calibration::Camera::getDistortion (  )  const [inline]

Returns the distortion.

Definition at line 183 of file camera.h.

bool mimas::camera_calibration::Camera::isOptimized (  )  const [inline]

Returns if the optimisation algorithm worked or not.

Definition at line 186 of file camera.h.


Member Data Documentation

Camera* mimas::camera_calibration::Camera::current_cam [static]

pointer to the current class.

So DO NOT instanciate more than one class Camera or the result WILL NOT be correct.

Definition at line 190 of file camera.h.


The documentation for this class was generated from the following file:
[GNU/Linux] [Qt] [Mesa] [STL] [Lapack] [Boost] [Magick++] [Xalan-C and Xerces-C] [doxygen] [graphviz] [FFTW] [popt] [xine] [Gnuplot] [gnu-arch] [gcc] [gstreamer] [autoconf/automake/make] [freshmeat.net] [opensource.org] [sourceforge.net] [MMVL]
mimas 2.1 - Copyright Mon Oct 30 11:31:48 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...