Image Component Library (ICL)
|
#include <IntrinsicCalibrator.h>
Classes | |
struct | CalibrationData |
struct | Result |
Simple struct for handle result of computation of intrinsics. More... | |
Public Types | |
typedef math::FixedMatrix< double, 1, 2 > | Pos2D |
typedef utils::Array2D< Pos2D > | DetectedGrid |
Public Member Functions | |
IntrinsicCalibrator (unsigned int boardWidth=6, unsigned int boardHeight=9, unsigned int boardCount=8, unsigned int imageWidth=640, unsigned int imageHeight=480) | |
Constructs a new object of this class for computation of intrinc parameters. More... | |
~IntrinsicCalibrator () | |
Destructor. More... | |
Result | calibrate (const math::DynMatrix< icl64f > &impoints, const math::DynMatrix< icl64f > &worldpoints) |
calibrates the camera More... | |
void | saveIntrinsics (const std::string &filename) |
saves computed/current intrinsics to xml-file More... | |
void | loadIntrinsics (const std::string &filename) |
loads intrincs from xml-file More... | |
void | resetData (unsigned int boardWidth, unsigned int boardHeight, unsigned int boardCount, unsigned int imageWidth, unsigned int imageHeight) |
resets data to compute new intrinsics with More... | |
Result | getResult () const |
return the result of computation More... | |
Static Public Member Functions | |
static Result | optimize (const CalibrationData &data) |
computes the calibration for given CalibrationData More... | |
Private Member Functions | |
void | rigid_motion (const math::DynMatrix< icl64f > &X, const math::DynMatrix< icl64f > &om, const math::DynMatrix< icl64f > &T, math::DynMatrix< icl64f > &Y, math::DynMatrix< icl64f > &dYdom, math::DynMatrix< icl64f > &dYdT) |
Computes the rigid motion transformation Y = R*X+T. More... | |
void | project_points2 (const math::DynMatrix< icl64f > &X, const math::DynMatrix< icl64f > &om, const math::DynMatrix< icl64f > &T, const math::DynMatrix< icl64f > &f, const math::DynMatrix< icl64f > &c, const math::DynMatrix< icl64f > &k, const double alpha, math::DynMatrix< icl64f > &xp, math::DynMatrix< icl64f > &dxpdom, math::DynMatrix< icl64f > &dxpdT, math::DynMatrix< icl64f > &dxpdf, math::DynMatrix< icl64f > &dxpdc, math::DynMatrix< icl64f > &dxpdk, math::DynMatrix< icl64f > &dxpdalpha) |
Projects a 3D structure onto the image plane. More... | |
void | comp_distortion_oulu (const math::DynMatrix< icl64f > xd, const math::DynMatrix< icl64f > k, math::DynMatrix< icl64f > &x) |
Compensates for radial and tangential distortion (Model From Oulu university) More... | |
void | compute_homography (const math::DynMatrix< icl64f > &m, const math::DynMatrix< icl64f > &M, math::DynMatrix< icl64f > &H) |
Computes the planar homography between the point coordinates on the plane (M) and the image point coordinates (m). More... | |
void | optimize (const math::DynMatrix< icl64f > &impoints, const math::DynMatrix< icl64f > &worldPoints, double *params) |
Levenberg-Marquardt sparse algorithm optimizes all parameters. More... | |
void | init_intrinsic_param (const math::DynMatrix< icl64f > &x, const math::DynMatrix< icl64f > &X, math::DynMatrix< icl64f > &fc, math::DynMatrix< icl64f > &cc, math::DynMatrix< icl64f > &kc, double &alpha_c) |
Initialization of the intrinsic parameters. More... | |
void | comp_ext_calib (const math::DynMatrix< icl64f > &x_kk, const math::DynMatrix< icl64f > &X_kk, const math::DynMatrix< icl64f > &fc, const math::DynMatrix< icl64f > &cc, const math::DynMatrix< icl64f > &kc, const double alpha_c, const double thresh_cond, math::DynMatrix< icl64f > &omckk, math::DynMatrix< icl64f > &Tckk, math::DynMatrix< icl64f > &Rckk) |
Computes the extrinsic parameters. More... | |
void | normalize_pixel (const math::DynMatrix< icl64f > x_kk, const math::DynMatrix< icl64f > fc, const math::DynMatrix< icl64f > cc, const math::DynMatrix< icl64f > kc, const double alpha_c, math::DynMatrix< icl64f > &xn) |
Computes the normalized coordinates xn given the pixel coordinates x_kk and the intrinsic camera parameters fc, cc and kc. More... | |
void | mean (const math::DynMatrix< icl64f > &x_k, math::DynMatrix< icl64f > &res) |
Computes the mean of each col of x_k. More... | |
void | rodrigues (const math::DynMatrix< icl64f > &in, math::DynMatrix< icl64f > &out, math::DynMatrix< icl64f > &dout) |
Computes the rodrigues transformation and derivative. More... | |
void | compute_extrinsic_init (const math::DynMatrix< icl64f > &x_kk, const math::DynMatrix< icl64f > &X_kk, const math::DynMatrix< icl64f > &fc, const math::DynMatrix< icl64f > &cc, const math::DynMatrix< icl64f > &kc, const double &alpha_c, math::DynMatrix< icl64f > &omckk, math::DynMatrix< icl64f > &Tckk, math::DynMatrix< icl64f > &Rckk) |
Computes extrinsic initial parameters. More... | |
void | compute_extrinsic_refine (const math::DynMatrix< icl64f > &omc_init, const math::DynMatrix< icl64f > &Tc_init, const math::DynMatrix< icl64f > &x_kk, const math::DynMatrix< icl64f > &X_kk, const math::DynMatrix< icl64f > &fc, const math::DynMatrix< icl64f > &cc, const math::DynMatrix< icl64f > &kc, const double alpha_c, const int MaxIter, double thresh_cond, math::DynMatrix< icl64f > &omckk, math::DynMatrix< icl64f > &Tckk, math::DynMatrix< icl64f > &Rckk, math::DynMatrix< icl64f > &JJ) |
optimizes precomputed extrinsic parameters More... | |
Private Attributes | |
Data * | m_data |
Result | m_calres |
struct for handling result of computation More... | |
Additional Inherited Members | |
Protected Member Functions inherited from icl::utils::Uncopyable | |
Uncopyable () | |
Empty base constructor. More... | |
This class implements the image undistortion procedure. It is a reimplementation from the matlab toolbox Pass in data where world and image points corresponds to each other in layout or use the optimze call where world points are generated automatically and layout of image points must be rowwise.
typedef math::FixedMatrix<double,1,2> icl::io::IntrinsicCalibrator::Pos2D |
icl::io::IntrinsicCalibrator::IntrinsicCalibrator | ( | unsigned int | boardWidth = 6 , |
unsigned int | boardHeight = 9 , |
||
unsigned int | boardCount = 8 , |
||
unsigned int | imageWidth = 640 , |
||
unsigned int | imageHeight = 480 |
||
) |
Constructs a new object of this class for computation of intrinc parameters.
boardWidth | the width of the chessboard |
boardHeight | the height of the chessboard |
boardCount | the number of board for computations |
imageWidth | the imagewidth |
imageHeight | the imageheight |
icl::io::IntrinsicCalibrator::~IntrinsicCalibrator | ( | ) |
Destructor.
Result icl::io::IntrinsicCalibrator::calibrate | ( | const math::DynMatrix< icl64f > & | impoints, |
const math::DynMatrix< icl64f > & | worldpoints | ||
) |
calibrates the camera
Since for each image the worldcoordinates are/look exactly the same, just pass the worldcoordinates for the first image. This will be used for all computations.
impoints | image coordinates |
worldpoints | coordinates for the first image, sorting depends on image coordinates |
|
private |
Compensates for radial and tangential distortion (Model From Oulu university)
xd | distorted, normalized image coordinates |
k | distortion coefficients |
x | undistorted, normalized image coordinates |
|
private |
Computes the extrinsic parameters.
x_kk | image coordinates |
X_kk | world coordinates |
fc | focal length |
cc | principal point |
kc | distortion coefficients |
alpha_c | the skew |
thresh_cond | number of iterations for optimization |
omckk | rotation vector |
Tckk | translation vector |
Rckk | rotation matrix |
|
private |
Computes extrinsic initial parameters.
x_kk | image coordinates |
X_kk | world coordinates |
fc | focal length |
cc | principal point |
kc | distortion coefficients |
alpha_c | skew |
omckk | rotation vector |
Tckk | translation vector |
Rckk | rotation matrix |
|
private |
optimizes precomputed extrinsic parameters
|
private |
Computes the planar homography between the point coordinates on the plane (M) and the image point coordinates (m).
m | homogeneous image coordinates |
M | homogeneous world coordinates |
H | Homography matrix |
|
inline |
return the result of computation
|
private |
Initialization of the intrinsic parameters.
x | images coordinate |
X | world coordinates |
fc | focal length |
cc | principal point coordinates |
kc | distortion coefficients |
alpha_c | skew coefficient |
void icl::io::IntrinsicCalibrator::loadIntrinsics | ( | const std::string & | filename | ) |
loads intrincs from xml-file
filename | name of xml-file to load |
|
private |
Computes the mean of each col of x_k.
If x_k is is rowvector the mean of the rowvector is computed.
x_k | Inputmatrix |
res | resultmatrix |
|
private |
Computes the normalized coordinates xn given the pixel coordinates x_kk and the intrinsic camera parameters fc, cc and kc.
x_kk | image coordinates |
fc | focal length |
cc | principal point |
kc | distortion coefficients |
alpha_c | skew |
xn | normalized image coordinates |
|
private |
Levenberg-Marquardt sparse algorithm optimizes all parameters.
impoints | image coordinates |
worldPoints | world coordinates |
params | parameters to be optimized |
|
static |
computes the calibration for given CalibrationData
data | contains detected grids for calibration |
|
private |
Projects a 3D structure onto the image plane.
X | 3D world coordinates |
om | rotation vector |
T | translation vector |
f | focal length |
c | principal point |
k | distortion coefficients |
alpha | skew |
xp | Projected pixel coordinates (2xN matrix for N points) |
dxpdom | Derivative of xp with respect to om |
dxpdT | Derivative of xp with respect to T |
dxpdf | Derivative of xp with respect to f |
dxpdc | Derivative of xp with respect to c |
dxpdk | Derivative of xp with respect to k |
dxpdalpha | Derivative of xp with respect to alpha |
void icl::io::IntrinsicCalibrator::resetData | ( | unsigned int | boardWidth, |
unsigned int | boardHeight, | ||
unsigned int | boardCount, | ||
unsigned int | imageWidth, | ||
unsigned int | imageHeight | ||
) |
resets data to compute new intrinsics with
boardWidth | the new width of the chessboard |
boardHeight | the new height of the chessboard |
boardCount | the new number of board for computations |
imageWidth | the new imagewidth |
imageHeight | the new imageheight |
|
private |
Computes the rigid motion transformation Y = R*X+T.
X | 3D structure in the world coordinates |
om | rotation vector |
T | translation vector |
Y | 3D coordinates of the structure points in the camera frame |
dYdom | Derivative of Y with respect to om |
dYdT | Derivative of Y with respect to T |
|
private |
Computes the rodrigues transformation and derivative.
void icl::io::IntrinsicCalibrator::saveIntrinsics | ( | const std::string & | filename | ) |
saves computed/current intrinsics to xml-file
filename | name of xml-file for saving |
|
private |
struct for handling result of computation
|
private |