# Distortion Models

Current Documentation
View previous documentation
View legacy documentation
All documentation versions

Deprecated in Current Release

# Description

Geometric calibration uses a projective camera (pinhole) model of a camera. Real cameras do not follow this model. Distortion models describe the mathematical deviation of a camera from the pinhole model.

# Available Models

Geometric calibration in Imatest currently supports two types of radial distortion model: polynomial and polynomial division. Within these two classes of distortion model are additional options that can be chosen.

Radial distortion models are described by a center of distortion$$(x_c, y_c)$$ and a function $$f(r)$$ that converts between distorted and undistorted radii.

$$x’=f(r)\cdot\cos(\theta)+x_c$$

$$y’=f(r)\cdot\sin(\theta)+y_c$$

where

$$r=\sqrt{(x-x_c)^2+(y-y_c)^2}$$

$$\theta=\tan\left(\displaystyle\frac{y-y_c}{x-x_c}\right)$$

The polynomial radial distortion model uses a polynomial to convert between distorted and undistorted radii

$$f(r)=r\cdot\left(1+p_1\cdot r+p_2\cdot r^2+\cdots p_N\cdot r^N\right)=r\cdot\left(1+\sum_{n=1}^N p_n\cdot r^n\right)$$

#### Variants

##### Direction

The model may be used to describe the transform from distorted to undistorted points or from undistorted to distorted points. The choice of direction is related to whichever direction will be used more often (typically distorted to undistorted) and the complexity for computing the inverse.

##### Form

The polynomial radial distortion model may use the even coefficients, the odd coefficients, or all coefficients.

$$\begin{array}{ll}\hline\mathbf{Form}&\mathbf{Equation}\\\hline\mathrm{Even}&f(r)=r+p_1\cdot r^2+p_2\cdot r^4 + \cdots =r\cdot\left(1+\sum_{n=1}^N p_n\cdot r^{2\cdot n-1}\right)\\\mathrm{Odd}&f(r)=r+p_1\cdot r^3 +p_2\cdot r^5+\cdots = r\cdot\left(1+\sum_{n=1}^N p_n\cdot r^{2\cdot n}\right)\\\mathrm{All}&f(r)=r+p_1\cdot r^2 + p_2\cdot r^3+\cdots=r\cdot\left(1+\sum_{n=1}^N p_n\cdot r^n\right)\\\hline\end{array}$$

##### Coefficient Packing

The coefficients to the model may be packed with the exponent or unpacked as described above. A packed coefficients model has the form:

$$\begin{array}{ll}\hline\mathbf{Packing}&\mathbf{Equation}\\\hline\mathrm{Unpacked}&f(r)=r\cdot\left(1+\sum_{n=1}^N p_n\cdot r^{2\cdot n-1}\right)\\\mathrm{Packed}&f(r)=r\cdot\left(1+\sum_{n=1}^N \mathrm{sign}\left(p_n\right)\cdot\left(p_n\cdot r\right)^{2\cdot n-1}\right)\\\hline\end{array}$$

Currently, if a packed model is used, its form must be even.

##### Parameter Count

For all forms of the polynomial radial distortion, the number of parameters used to describe it. More complex (larger distortion) lenses will require a higher parameter count than a low distortion lens.

#### Model Notes

There is not guaranteed to be a closed form inverse to the model, especially for higher parameter models. Model inversion requires a numerical solution.

A polynomial radial distortion model must have at least one parameter.

### Division Polynomial Radial Distortion Model

The division polynomial radial distortion model uses a polynomial to convert between distorted and undistorted radii

$$f(r)=\displaystyle\frac{r}{1+p_1\cdot r+p_2\cdot r^2+\cdots p_N\cdot r^N}=\displaystyle\frac{r}{1+\sum_{n=1}^N p_n\cdot r^n}$$

#### Variants

##### Direction

The model may be used to describe the transform from distorted to undistorted points or from undistorted to distorted points. The choice of direction is related to whichever direction will be used more often (typically distorted to undistorted) and the complexity for computing the inverse.

##### Form

The division polynomial radial distortion model may use the even coefficients, the odd coefficients, or all coefficients.

$$\begin{array}{ll}\hline\mathbf{Form}&\mathbf{Equation}\\\hline\mathrm{Even}&f(r)=\displaystyle\frac{r}{1+\sum_{n=1}^N p_n\cdot r^{2\cdot n}}\\\mathrm{Odd}&f(r)=\displaystyle\frac{r}{1+\sum_{n=1}^N p_n\cdot r^{2\cdot n – 1}}\\\mathrm{All}&f(r)=\displaystyle\frac{r}{1+\sum_{n=1}^N p_n\cdot r^n}\\\hline\end{array}$$

##### Coefficient Packing

The coefficients to the model may be packed with the exponent or unpacked as described above. A packed coefficients model has the form:

$$\begin{array}{ll}\hline\mathbf{Packing}&\mathbf{Equation}\\\hline\mathrm{Unpacked}&f(r)=\displaystyle\frac{r}{1+\sum_{n=1}^N p_n\cdot r^{2\cdot n}}\\\mathrm{Packed}&f(r)=\displaystyle\frac{r}{1+\sum_{n=1}^N \mathrm{sign}\left(p_n\right)\cdot\left(p_n\cdot r\right)^{2\cdot n}}\\\hline\end{array}$$

Currently, if a packed model is used, its form must be even.

##### Parameter Count

For all forms of the division polynomial radial distortion, the number of parameters used to describe it. More complex (larger distortion) lenses will require a higher parameter count than a low distortion lens.

#### Model Notes

There is not guaranteed to be a closed form inverse to the model, especially for higher parameter models. Model inversion requires a numerical solution.

A division polynomial radial distortion model must have at least one parameter.

# Future Models

The numeric radial distortion model uses gridded data rather than a functional form to model the distortion.

## Tangential Distortion Models

Tangential distortion models are used to describe cases where the optics and focal plane are not parallel.

Used to model both radial and tangential distortion

$$\begin{array}{l}x_u=x+\underbrace{(x-x_c)\cdot\left(k_1\cdot r^2+k_2\cdot r^4+\cdots\right)}_{\mathrm{radial\ terms}}+\underbrace{\left[p_1\cdot\left(r^2+2\cdot(x-x_c)^2\right)+2\cdot p_2\cdot(x-x_c)\cdot(y-y_c)\right]\cdot\left(1+ p_3\cdot r^2 + p_4\cdot r^4+\cdots\right)}_{\mathrm{tangential\ terms}}\\y_u=y+\underbrace{(y-y_c)\cdot\left(k_1\cdot r^2+k_2\cdot r^4+\cdots\right)}_{\mathrm{radial\ terms}}+\underbrace{\left[2\cdot p_1\cdot(x-x_c)\cdot(y-y_c)+p_2\cdot\left(r^2+2\cdot(y-y_c)^2\right)\right]\cdot\left(1+ p_3\cdot r^2 + p_4\cdot r^4+\cdots\right)}_{\mathrm{tangential\ terms}}\end{array}$$

where $$(x, y)$$ are distorted image points, $$(x_u, y_u)$$ are the corresponding undistorted image points, $$(x_c, y_c)$$ is the center of distortion, $$k_i$$ is the $$i$$th radial distortion coefficient, $$p_j$$ is the $$j$$th tangential distortion coefficient, and $$r=\sqrt{(x-x_c)^2+(y-y_c)^2}$$.

# Distortion Model Fitting Requirements

Distortion model fitting in Geometric Calibration requires an image of a planar checkerboard target. The checkerboard should fill the field-of-view (FOV) or image circle of the device. If the target does not fill the field of view, the distortion model fit will lack fidelity where there is no evidence to support the fit. One exception to the filling the image circle requirement is if the image data will never be used in a rigorous manor (e.g, the outermost 3° of a fisheye).

The size of the checkerboard is driven by the FOV of the camera and the the test distance. The size of the checkers are driven by the resolution of the sensor and the ability to detect saddle points from the checker corners. For low distortion cameras, a few hundred points throughout the image (e.g., a 15×15 checkerboard) is sufficient estimate the distortion. For highly distorted cameras (e.g., fisheye), one thousand or more points (e.g., a 30×30 checkerboard) may be needed to estimate the distortion. For distortion estimation, the image of the checkerboard does not need to be in sharp focus. Blurring is acceptable as long as it does not interfere with the localization of saddle points within a checkerboard image. The location of the saddle points must be determined with sub-pixel accuracy to get a good estimation of the distortion fit.

To ensure good saddle point detection, the image of the chart should not be clipping at the high or low end. This may be achieved with some combination of camera exposure control, lighting adjustment, and chart contrast adjustment.

Geometric calibration does not require that the camera be rotationally aligned with the chart (i.e., perspective is allowed in the evidence images).

# Current Limitations

Distortion modeling from geometric calibration may only be performed on a checkerboard target.

Only the polynomial radial distortion model and division polynomial distortion model (with all described variants) are able to be computed.

A distortion estimation cannot be separated from a full geometric calibration of a camera.