ViSP  2.8.0
vpCalibration Class Reference

#include <vpCalibration.h>

Public Types

enum  vpCalibrationMethodType {
  CALIB_LAGRANGE, CALIB_VIRTUAL_VS, CALIB_VIRTUAL_VS_DIST, CALIB_LAGRANGE_VIRTUAL_VS,
  CALIB_LAGRANGE_VIRTUAL_VS_DIST
}
 

Public Member Functions

int init ()
 
int clearPoint ()
 
int addPoint (double X, double Y, double Z, vpImagePoint &ip)
 
 vpCalibration ()
 
virtual ~vpCalibration ()
 
void operator= (vpCalibration &twinCalibration)
 
double getResidual (void) const
 
double getResidual_dist (void) const
 
unsigned int get_npt () const
 
void computeStdDeviation (double &deviation, double &deviation_dist)
 
int computeCalibration (vpCalibrationMethodType method, vpHomogeneousMatrix &cMo, vpCameraParameters &cam, bool verbose=false)
 
double computeStdDeviation (vpHomogeneousMatrix &cMo, vpCameraParameters &cam)
 
double computeStdDeviation_dist (vpHomogeneousMatrix &cMo, vpCameraParameters &cam)
 
int displayData (vpImage< unsigned char > &I, vpColor color=vpColor::red, unsigned int thickness=1)
 
int displayGrid (vpImage< unsigned char > &I, vpColor color=vpColor::yellow, unsigned int thickness=1)
 
int readData (const char *filename)
 
int writeData (const char *filename)
 

Static Public Member Functions

static void calibrationTsai (std::vector< vpHomogeneousMatrix > &cMo, std::vector< vpHomogeneousMatrix > &rMe, vpHomogeneousMatrix &eMc)
 
static int computeCalibrationMulti (vpCalibrationMethodType method, std::vector< vpCalibration > &table_cal, vpCameraParameters &cam, double &globalReprojectionError, bool verbose=false)
 
static int computeCalibrationTsai (std::vector< vpCalibration > &table_cal, vpHomogeneousMatrix &eMc, vpHomogeneousMatrix &eMc_dist)
 
static double getLambda ()
 
static int readGrid (const char *filename, unsigned int &n, std::list< double > &oX, std::list< double > &oY, std::list< double > &oZ, bool verbose=false)
 
static void setLambda (const double &lambda)
 

Public Attributes

vpHomogeneousMatrix cMo
 
vpHomogeneousMatrix cMo_dist
 
vpCameraParameters cam
 
vpCameraParameters cam_dist
 
vpHomogeneousMatrix rMe
 
vpHomogeneousMatrix eMc
 
vpHomogeneousMatrix eMc_dist
 

Deprecated functions

static void calibrationTsai (unsigned int nbPose, vpHomogeneousMatrix cMo[], vpHomogeneousMatrix rMe[], vpHomogeneousMatrix &eMc)
 
static int computeCalibrationMulti (vpCalibrationMethodType method, unsigned int nbPose, vpCalibration table_cal[], vpCameraParameters &cam, bool verbose=false)
 
static vp_deprecated int computeCalibrationTsai (unsigned int nbPose, vpCalibration table_cal[], vpHomogeneousMatrix &eMc, vpHomogeneousMatrix &eMc_dist)
 
static vp_deprecated int readGrid (const char *filename, unsigned int &n, vpList< double > &oX, vpList< double > &oY, vpList< double > &oZ, bool verbose=false)
 

Detailed Description

Tools for perspective camera calibration.

Definition at line 78 of file vpCalibration.h.

Member Enumeration Documentation

Minimization algorithm use to estimate the camera parameters.

Enumerator
CALIB_LAGRANGE 

Lagrange approach without estimation of the distortion.

CALIB_VIRTUAL_VS 

Virtual visual servoing approach without estimation of the distortion (results are similar to Lowe approach).

CALIB_VIRTUAL_VS_DIST 

Virtual visual servoing approach with estimation of the distortion.

CALIB_LAGRANGE_VIRTUAL_VS 

Lagrange approach first, than virtual visual servoing approach, without estimation of the distortion.

CALIB_LAGRANGE_VIRTUAL_VS_DIST 

Lagrange approach first, than virtual visual servoing approach, with estimation of the distortion.

Definition at line 84 of file vpCalibration.h.

Constructor & Destructor Documentation

vpCalibration::vpCalibration ( )

Constructor.

Definition at line 73 of file vpCalibration.cpp.

References init().

vpCalibration::~vpCalibration ( )
virtual

Destructor.

Destructor : delete the array of point (freed the memory)

Definition at line 82 of file vpCalibration.cpp.

References clearPoint().

Member Function Documentation

int vpCalibration::addPoint ( double  X,
double  Y,
double  Z,
vpImagePoint ip 
)

Add a new point in the array of points.

Parameters
X,Y,Z: 3D coordinates of a point in the object frame
ip: 2D Coordinates of the point in the camera frame.

Definition at line 135 of file vpCalibration.cpp.

Referenced by readData().

void vpCalibration::calibrationTsai ( std::vector< vpHomogeneousMatrix > &  cMo,
std::vector< vpHomogeneousMatrix > &  rMe,
vpHomogeneousMatrix eMc 
)
static

calibration method of effector-camera from R. Tsai and R. Lorenz [13].

Compute extrinsic camera parameters : the constant transformation from the effector to the camera coordinates (eMc).

Parameters
cMo: vector of homogeneous matrices representing the transformation between the camera and the scene (input)
rMe: vector of homogeneous matrices representing the transformation between the effector (where the camera is fixed) and the reference coordinates (base of the manipulator) (input). Must be the same size as cMo.
eMc: homogeneous matrix representing the transformation between the effector and the camera (output)
Examples:
calibrateTsai.cpp.

Definition at line 1296 of file vpCalibrationTools.cpp.

References vpMatrix::AtA(), vpException::dimensionError, vpHomogeneousMatrix::insert(), vpMatrix::pseudoInverse(), vpRotationMatrix::setIdentity(), vpMath::sinc(), vpColVector::size(), vpColVector::skew(), vpMatrix::stackMatrices(), vpMatrix::sumSquare(), vpRotationMatrix::t(), and vpMatrix::t().

Referenced by computeCalibrationTsai().

void vpCalibration::calibrationTsai ( unsigned int  nbPose,
vpHomogeneousMatrix  cMo[],
vpHomogeneousMatrix  rMe[],
vpHomogeneousMatrix eMc 
)
static
Deprecated:
Calibration method of effector-camera from R. Tsai and R. Lorenz [13].

Compute extrinsic camera parameters : the constant transformation from the effector to the camera coordinates (eMc).

Parameters
nbPose: number of different positions (input)
cMo: table of homogeneous matrices representing the transformation between the camera and the scene (input)
rMe: table of homogeneous matrices representing the transformation between the effector (where the camera is fixed) and the reference coordinates (base of the manipulator) (input)
eMc: homogeneous matrix representing the transformation between the effector and the camera (output)

Definition at line 1090 of file vpCalibrationTools.cpp.

References vpMatrix::AtA(), vpHomogeneousMatrix::extract(), vpHomogeneousMatrix::insert(), vpMatrix::pseudoInverse(), vpRotationMatrix::setIdentity(), vpMath::sinc(), vpColVector::skew(), vpMatrix::stackMatrices(), vpMatrix::sumSquare(), vpRotationMatrix::t(), and vpMatrix::t().

int vpCalibration::clearPoint ( )

Suppress all the point in the array of point.

Delete the array of points.

Definition at line 118 of file vpCalibration.cpp.

Referenced by readData(), and ~vpCalibration().

int vpCalibration::computeCalibration ( vpCalibrationMethodType  method,
vpHomogeneousMatrix cMo,
vpCameraParameters cam,
bool  verbose = false 
)

Compute the calibration according to the desired method using one pose.

Parameters
method: Method that will be used to estimate the parameters.
cMo: the homogeneous matrix that defines the pose.
cam: intrinsic camera parameters.
verbose: set at true if information about the residual at each loop of the algorithm is hoped.
Returns
0 if the calibration computation succeed.

Definition at line 359 of file vpCalibration.cpp.

References CALIB_LAGRANGE, CALIB_LAGRANGE_VIRTUAL_VS, CALIB_LAGRANGE_VIRTUAL_VS_DIST, CALIB_VIRTUAL_VS, CALIB_VIRTUAL_VS_DIST, cam, cam_dist, cMo, cMo_dist, and vpCameraParameters::printParameters().

int vpCalibration::computeCalibrationMulti ( vpCalibrationMethodType  method,
std::vector< vpCalibration > &  table_cal,
vpCameraParameters cam,
double &  globalReprojectionError,
bool  verbose = false 
)
static

Compute the multi-images calibration according to the desired method using many poses.

Parameters
method: Method used to estimate the camera parameters.
table_cal: Vector of vpCalibration.
cam: Estimated intrinsic camera parameters.
globalReprojectionError: Global reprojection error or global residual.
verbose: Set at true if information about the residual at each loop of the algorithm is hoped.
Returns
0 if the computation was managed succeed.

Definition at line 452 of file vpCalibration.cpp.

References CALIB_LAGRANGE, CALIB_LAGRANGE_VIRTUAL_VS, CALIB_LAGRANGE_VIRTUAL_VS_DIST, CALIB_VIRTUAL_VS, CALIB_VIRTUAL_VS_DIST, cam, get_npt(), and vpCameraParameters::printParameters().

int vpCalibration::computeCalibrationMulti ( vpCalibrationMethodType  method,
unsigned int  nbPose,
vpCalibration  table_cal[],
vpCameraParameters cam,
bool  verbose = false 
)
static
Deprecated:
This method is deprecated. You should use vpCalibration::computeCalibrationMulti(vpCalibrationMethodType, std::vector<vpCalibration> &, vpCameraParameters &, bool)

Compute the multi-images calibration according to the desired method using many poses.

Parameters
method: Method used to estimate the camera parameters.
nbPose: number of images used to compute multi-images calibration
table_cal: array of vpCalibration.
cam: intrinsic camera parameters.
verbose: set at true if information about the residual at each loop of the algorithm is hoped.
Returns
0 if the computation was managed succeed.

Definition at line 823 of file vpCalibration.cpp.

References CALIB_LAGRANGE, CALIB_LAGRANGE_VIRTUAL_VS, CALIB_LAGRANGE_VIRTUAL_VS_DIST, CALIB_VIRTUAL_VS, CALIB_VIRTUAL_VS_DIST, cam, cam_dist, cMo, cMo_dist, get_npt(), and vpCameraParameters::printParameters().

int vpCalibration::computeCalibrationTsai ( std::vector< vpCalibration > &  table_cal,
vpHomogeneousMatrix eMc,
vpHomogeneousMatrix eMc_dist 
)
static

Compute the multi-image calibration of effector-camera from R. Tsai and R. Lenz [13].

Compute extrinsic camera parameters : the constant transformation from the end-effector to the camera frame ${^e}{\bf M}_c$ considering the camera model with or without distortion.

Parameters
[in]table_cal: Vector of vpCalibration that contains for each index a couple of ${^r}{\bf M}_e$ (world to end-effector) and ${^c}{\bf M}_o$ (camera to object) transformations.
[out]eMc: Estimated pose of the camera in relation to the end-effector considering the camera model without distortion.
[out]eMc_dist: Estimated pose of the camera in relation to the end-effector considering the model with distortion.
Returns
0 if the computation managed, -1 if less than three poses are provides as input.

Definition at line 550 of file vpCalibration.cpp.

References calibrationTsai(), and vpERROR_TRACE.

int vpCalibration::computeCalibrationTsai ( unsigned int  nbPose,
vpCalibration  table_cal[],
vpHomogeneousMatrix eMc,
vpHomogeneousMatrix eMc_dist 
)
static

Compute the multi-image calibration of effector-camera from R. Tsai and R. Lenz [13].

Deprecated:
This method is deprecated. You should use vpCalibration::computeCalibrationTsai(std::vector<vpCalibration> &, vpHomogeneousMatrix &, vpHomogeneousMatrix &)

Compute extrinsic camera parameters : the constant transformation from the effector to the camera coordinates (eMc).

Parameters
nbPose: number of images used to compute multi-images calibration
table_cal: array of vpCalibration. All the vpHomogeneousMatrix cMo and rMe of each vpCalibration have to be initialized.
eMc: output: estimated pose of the camera in relation to the effector (camera support) with the camera model without distortion.
eMc_dist: output: estimated pose of the camera in relation to the effector (camera support) with the model with distortion.
Returns
0 if the computation managed, -1 if less than three poses are provides as input.

Definition at line 924 of file vpCalibration.cpp.

References calibrationTsai(), cMo, cMo_dist, rMe, and vpERROR_TRACE.

void vpCalibration::computeStdDeviation ( double &  deviation,
double &  deviation_dist 
)

Compute and return the standard deviation expressed in pixel for pose matrix and camera intrinsic parameters.

Parameters
deviation: the standard deviation computed for the model without distortion.
deviation_dist: the standard deviation computed for the model with distortion.

Definition at line 341 of file vpCalibration.cpp.

References cam_dist, cMo_dist, and computeStdDeviation_dist().

double vpCalibration::computeStdDeviation ( vpHomogeneousMatrix cMo,
vpCameraParameters cam 
)

Compute and return the standard deviation expressed in pixel for pose matrix and camera intrinsic parameters for model without distortion.

Parameters
cMo: the matrix that defines the pose to be tested.
cam: camera intrinsic parameters to be tested.
Returns
the standard deviation by point of the error in pixel .

Definition at line 216 of file vpCalibration.cpp.

References vpCameraParameters::get_px(), vpCameraParameters::get_py(), vpImagePoint::get_u(), vpCameraParameters::get_u0(), vpImagePoint::get_v(), vpCameraParameters::get_v0(), and vpMath::sqr().

double vpCalibration::computeStdDeviation_dist ( vpHomogeneousMatrix cMo,
vpCameraParameters cam 
)

Compute and return the standard deviation expressed in pixel for pose matrix and camera intrinsic parameters with pixel to meter model.

Parameters
cMo: the matrix that defines the pose to be tested.
cam: camera intrinsic parameters to be tested.
Returns
the standard deviation by point of the error in pixel .

Definition at line 271 of file vpCalibration.cpp.

References vpCameraParameters::get_kdu(), vpCameraParameters::get_kud(), vpCameraParameters::get_px(), vpCameraParameters::get_py(), vpImagePoint::get_u(), vpCameraParameters::get_u0(), vpImagePoint::get_v(), vpCameraParameters::get_v0(), and vpMath::sqr().

Referenced by computeStdDeviation().

int vpCalibration::displayData ( vpImage< unsigned char > &  I,
vpColor  color = vpColor::red,
unsigned int  thickness = 1 
)

Display the data of the calibration (center of the tracked dots)

Parameters
I: Image where to display data.
color: Color of the data.
thickness: Thickness of the displayed data.

Definition at line 725 of file vpCalibration.cpp.

References vpDisplay::displayCross().

int vpCalibration::displayGrid ( vpImage< unsigned char > &  I,
vpColor  color = vpColor::yellow,
unsigned int  thickness = 1 
)

Display estimated centers of dots using intrinsic camera parameters with model with distortion and the computed pose.

Parameters
I: Image where to display grid data.
color: Color of the data.
thickness: Thickness of the displayed data.

Definition at line 742 of file vpCalibration.cpp.

References cam_dist, cMo_dist, vpDisplay::displayCross(), vpCameraParameters::get_kud(), vpCameraParameters::get_px(), vpCameraParameters::get_py(), vpCameraParameters::get_u0(), vpCameraParameters::get_v0(), vpImagePoint::set_u(), and vpMath::sqr().

unsigned int vpCalibration::get_npt ( ) const
inline

get the number of points

Definition at line 128 of file vpCalibration.h.

Referenced by computeCalibrationMulti().

static double vpCalibration::getLambda ( )
inlinestatic

set the gain for the virtual visual servoing algorithm

Definition at line 158 of file vpCalibration.h.

double vpCalibration::getResidual ( void  ) const
inline

get the residual in pixels

Definition at line 124 of file vpCalibration.h.

double vpCalibration::getResidual_dist ( void  ) const
inline

get the residual for perspective projection with distortion (in pixels)

Definition at line 126 of file vpCalibration.h.

int vpCalibration::init ( )

Basic initialisation (called by the constructors)

Definition at line 61 of file vpCalibration.cpp.

Referenced by vpCalibration().

void vpCalibration::operator= ( vpCalibration twinCalibration)

= operator

= operator.

Parameters
twinCalibration: object to be copied

Definition at line 92 of file vpCalibration.cpp.

References cam, cam_dist, cMo, cMo_dist, eMc, eMc_dist, and rMe.

int vpCalibration::readData ( const char *  filename)

Read data from disk : data are organized as follow oX oY oZ u v

Parameters
filename: name of the file

Definition at line 633 of file vpCalibration.cpp.

References addPoint(), clearPoint(), vpImagePoint::set_u(), and vpImagePoint::set_v().

int vpCalibration::readGrid ( const char *  filename,
unsigned int &  n,
std::list< double > &  oX,
std::list< double > &  oY,
std::list< double > &  oZ,
bool  verbose = false 
)
static

Read calibration grid coordinates from disk : data are organized as follow oX oY oZ

Parameters
filename: name of the file
n: number of points in the calibration grid
oX: List of oX coordinates
oY: List of oY coordinates
oZ: List of oZ coordinates
verbose: Additionnal printings if true (number of points on the calibration grid and their respective coordinates in the object frame).
Returns
0 if success, -1 if an error occurs.

Definition at line 677 of file vpCalibration.cpp.

int vpCalibration::readGrid ( const char *  filename,
unsigned int &  n,
vpList< double > &  oX,
vpList< double > &  oY,
vpList< double > &  oZ,
bool  verbose = false 
)
static
Deprecated:
This method is deprecated. You should use vpCalibration::readGrid(const char*,unsigned int &, vpList<double> &, vpList<double> &, vpList<double> &, bool) instead.

Read calibration grid coordinates from disk : data are organized as follow oX oY oZ

Parameters
filename: name of the file
n: number of points in the calibration grid
oX: List of oX coordinates
oY: List of oY coordinates
oZ: List of oZ coordinates
verbose: Additionnal printings if true (number of points on the calibration grid and their respective coordinates in the object frame).
Returns
0 : if success

Definition at line 978 of file vpCalibration.cpp.

References vpList< type >::addRight(), and vpList< type >::front().

static void vpCalibration::setLambda ( const double &  lambda)
inlinestatic

set the gain for the virtual visual servoing algorithm

Definition at line 165 of file vpCalibration.h.

int vpCalibration::writeData ( const char *  filename)

Write data into a file.

data are organized as follow oX oY oZ u v

Parameters
filename: name of the file

Definition at line 589 of file vpCalibration.cpp.

References vpImagePoint::get_u(), and vpImagePoint::get_v().

Member Data Documentation

vpCameraParameters vpCalibration::cam

projection model without distortion

camera intrinsic parameters for perspective

Definition at line 97 of file vpCalibration.h.

Referenced by computeCalibration(), computeCalibrationMulti(), and operator=().

vpCameraParameters vpCalibration::cam_dist

projection model with distortion

camera intrinsic parameters for perspective

Definition at line 99 of file vpCalibration.h.

Referenced by computeCalibration(), computeCalibrationMulti(), computeStdDeviation(), displayGrid(), and operator=().

vpHomogeneousMatrix vpCalibration::cMo

(as a 3x4 matrix [R T])

the pose computed for the model without distortion

Definition at line 92 of file vpCalibration.h.

Referenced by computeCalibration(), computeCalibrationMulti(), computeCalibrationTsai(), and operator=().

vpHomogeneousMatrix vpCalibration::cMo_dist

the pose computed for perspective projection with distortion model (as a 3x4 matrix [R T])

Definition at line 94 of file vpCalibration.h.

Referenced by computeCalibration(), computeCalibrationMulti(), computeCalibrationTsai(), computeStdDeviation(), displayGrid(), and operator=().

vpHomogeneousMatrix vpCalibration::eMc

position of the camera in relation to the effector

Definition at line 104 of file vpCalibration.h.

Referenced by operator=().

vpHomogeneousMatrix vpCalibration::eMc_dist

Definition at line 105 of file vpCalibration.h.

Referenced by operator=().

vpHomogeneousMatrix vpCalibration::rMe

reference coordinates (manipulator base coordinates)

position of the effector in relation to the

Definition at line 102 of file vpCalibration.h.

Referenced by computeCalibrationTsai(), and operator=().