Public Member Functions | Static Public Member Functions | Static Public Attributes
sal3d::LensDistortion::Model Class Reference

A lens distortion model. More...

#include <Common.hpp>

List of all members.

Public Member Functions

 Model ()
 Default constructor, for no distortion.
 Model (const sal3d_lens_distortion &model)
 Constructor from a C sal3d_lens_distortion.
Point2D undistort (const Point2D &p) const
 Undistort a point in pixel coordinates.
ModelType getType () const
 Get the type of the distortion model.
std::vector< float > getCoeffs () const
 Get the coefficients of the distortion model.
const sal3d_lens_distortion & c_lens_distortion () const
 Returns a copy of the internal C model.
float getErrorMean () const
 Return the mean of the error statistic.
float getErrorStdDev () const
 Return the mean of the error statistic.
float getErrorMax () const
 Return the max of the error statistic.

Static Public Member Functions

static Model createTsai (float x, float y, float k)
 Create a Tsai Model out of coefficients.

Static Public Attributes

static const int TsaiNumCoeffs = 3
 Number of coefficients for the Tsai distortion model.
static const int CubicNumCoeffs = 20
 Number of coefficients for the Cubic distortion model.

Detailed Description

A lens distortion model.

The lens distortion model holds the information that makes it possible to undistort the data captured from the camera prior to processing it with sal3d.

Currently the only model fully supported is the Tsai model, which corrects the radial distortion. The module LensCalibration has the functions needed to compute a calibration model out of a sal3d::Frame from a chessboard or dots pattern.

The lens model is then stored in the metric configuration when the metric calibration is performed. From that point on, every time that metric is used, the lens model is also applied, for example when converting a sal3d::RangeMap to a sal3d::COP.


Constructor & Destructor Documentation

sal3d::LensDistortion::Model::Model ( const sal3d_lens_distortion &  model) [inline]

Constructor from a C sal3d_lens_distortion.

Parameters:
[in]modelThe C sal3d_lens_distortion used to create this object.

Member Function Documentation

const sal3d_lens_distortion& sal3d::LensDistortion::Model::c_lens_distortion ( ) const [inline]

Returns a copy of the internal C model.

Returns:
The a copy of the C model struct.

Referenced by sal3d::AngularMetric::calibrate(), and sal3d::Metric::calibrate().

static Model sal3d::LensDistortion::Model::createTsai ( float  x,
float  y,
float  k 
) [inline, static]

Create a Tsai Model out of coefficients.

This function creates a Tsai Model given the three coefficients that define it.

Returns:
The newly created Model.
std::vector<float> sal3d::LensDistortion::Model::getCoeffs ( ) const [inline]

Get the coefficients of the distortion model.

This function returns a vector with the coefficients of the distortion model. Depending on the ModelType, the number of coefficients varies.

Returns:
The coefficients of this Model.

References CubicNumCoeffs, and TsaiNumCoeffs.

Return the max of the error statistic.

Please check the documentation of getErrorMean() for a detailed explanation.

Return the mean of the error statistic.

The methods getErrorMean(), getErrorStdDev() and getErrorMax() return statistical results of the pixel distances between the corrected points and where should they ideally to fit the model perfectly.

Having big statistical measures can be caused both by a distortion not properly correctable by the calibration model, or by a bad adquisition of a calibration pattern. Depending on the resolutions involved, the calibration may require very acurate printing, flatness and focusing of the patterns.

For the case of Tsai model calibrations, the statistic is done over the signed distances between the corrected points and the lines of the pattern.

For the case of Cubic model calibrations, the statistic is done over the absolute distances between the corrected points, and ideal distortion-less points based on the pattern orientation.

Return the mean of the error statistic.

Please check the documentation of getErrorMean() for a detailed explanation.

Get the type of the distortion model.

This function returns the type of this model. Currently, only Tsai and NLPoly3 are available, as defined in ModelType.

Returns:
The ModelType of this Model.

Undistort a point in pixel coordinates.

This function takes a Point2D in pixel coordinates and uses the lens model to undistort it.

Parameters:
[in]pThe point in pixel coordinates.
Returns:
The undistorted point, also in pixel coordinates.

References sal3d::Point2D::c_point_2d().


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