# OpenCV lens distortion model

My understanding is that OpenCV uses a variant of the Brown-Conrady lens distortion to model radial and tangential distortion. The radial displacement, however, is not just an even-order polynomial as in Brown-Conrady but a variant where a low-order polynomial coefficients (k_1,k_2,k_3) are related to the same even-order polynomial but with higher order coefficients (k_4,k_5,k_6) in a fraction (`CALIB_RATIONAL_MODEL` flag in `calibrateCamera` and `stereoCalibrate`). As such, this seems to be a combination of Brown-Conrady and the division model and likely aims at modeling lens distortion of wide-angle lenses more accurately.

Is this correct? Are there any references for the OpenCV lens distortion model variant?

there’s the documentation that states the model: OpenCV: Camera Calibration and 3D Reconstruction

and there’s one huge list of references from anywhere in the docs: OpenCV: Bibliography

but I would have no idea where they got that from.

I have a second edition of Hartley & Zisserman and it doesn’t even mention tangential distortion.

perhaps they got it from MATLAB, or wherever matlab got it from. that link has some references.

this presents a rational model. perhaps that’s the source.

people asked this in 2012 on stack overflow:

Claus, D. and Fitzgibbon, A.W. A Rational Function Lens Distortion Model for General Cameras Computer Vision and Pattern Recognition (June 2005) https://www.robots.ox.ac.uk/~dclaus/publications/

Simultaneous Linear Estimation of Multiple View Geometry and Lens Distortion A. W. Fitzgibbon IEEE Conference on Computer Vision and Pattern Recognition, 2001 https://www.robots.ox.ac.uk/~vgg/publications/papers/fitzgibbon01b.pdf

feel free to augment the docs (if those references are plausible/helpful) and submit a pull request

I’m aware of the bibliography. However, a reference for the actual lens model is missing (unless I overlooked something). Hence my question.

OpenCV does not actually use the rational function model which models lens distortion in terms of conic sections along the three axes in the camera coordinate system. I always wondered why it is even mentioned. My guess is that the confusion stems from the fact that “rational model” as defined by OpenCV is named similarly to “rational function model” as proposed by Claus and Fitzgibbon even though both do not share any similarities (except for the “rational” or “fraction” part).

MATLAB uses the Brown-Conrady lens model which is equivalent to the “rational model” in OpenCV given only three radial distortion coefficients are used. Other than that, they also reference OpenCV (Bradski et al.).

The publication by Fitzgibbon from 2001 introduces what is commonly known as the division model which uses a single coefficient and has a closed-form solution for its inverse. This is not the case for the OpenCV “rational model”.

Looking at the “Learning OpenCV 3” book, (k_4, k_5, k_6) should be set to zero for most use case:

Thanks. I’m also aware of the description from the book. However, it is rather incomplete and also does not provide any references for the lens model. I’m also wondering what are “exotic lenses” and why they require a high-precision calibration (i.e., more accurate than usual)?

The description for `CALIB_RATIONAL_MODEL` says that the flag is not enabled for backwards compatibility reasons which apparently implies the flag should be preferably enabled by the users.