The functions in this section use a so-called pinhole camera model. In this model, a scene view is formed by projecting 3D points into the image plane using a perspective transformation.

s \; m' = A [R|t] M'

or

s \vecthree{u}{v}{1} = \vecthreethree{f*x}{0}{c*x}{0}{f*y}{c*y}{0}{0}{1} \begin{bmatrix} r*{11} & r*{12} & r*{13} & t*1 \ r*{21} & r*{22} & r*{23} & t*2 \ r*{31} & r*{32} & r*{33} & t*3 \end{bmatrix} \begin{bmatrix} X \ Y \ Z \ 1 \end{bmatrix}

where:

```
(X, Y, Z) are the coordinates of a 3D point in the world coordinate space
(u, v) are the coordinates of the projection point in pixels
A is a camera matrix, or a matrix of intrinsic parameters
(cx, cy) is a principal point that is usually at the image center
fx, fy are the focal lengths expressed in pixel units.
```

Thus, if an image from the camera is scaled by a factor, all of these parameters should be scaled (multiplied/divided, respectively) by the same factor. The matrix of intrinsic parameters does not depend on the scene viewed. So, once estimated, it can be re-used as long as the focal length is fixed (in case of zoom lens). The joint rotation-translation matrix [R|t] is called a matrix of extrinsic parameters. It is used to describe the camera motion around a static scene, or vice versa, rigid motion of an object in front of a still camera. That is, [R|t] translates coordinates of a point (X, Y, Z) to a coordinate system, fixed with respect to the camera. The transformation above is equivalent to the following (when z \ne 0 ):

\begin{array}{l} \vecthree{x}{y}{z} = R \vecthree{X}{Y}{Z} + t \ x' = x/z \ y' = y/z \ u = f*x*x' + c*x \ v = f*y*y' + c*y \end{array}

Real lenses usually have some distortion, mostly radial distortion and slight tangential distortion. So, the above model is extended as:

\begin{array}{l} \vecthree{x}{y}{z} = R \vecthree{X}{Y}{Z} + t \ x' = x/z \ y' = y/z \ x'' = x' \frac{1 + k*1 r^2 + k*2 r^4 + k*3 r^6}{1 + k*4 r^2 + k*5 r^4 + k*6 r^6} + 2 p*1 x' y' + p*2(r^2 + 2 x'^2) \ y'' = y' \frac{1 + k*1 r^2 + k*2 r^4 + k*3 r^6}{1 + k*4 r^2 + k*5 r^4 + k*6 r^6} + p*1 (r^2 + 2 y'^2) + 2 p*2 x' y' \ \text{where} \quad r^2 = x'^2 + y'^2 \ u = f*x*x'' + c*x \ v = f*y*y'' + c*y \end{array}

k*1, k*2, k*3, k*4, k*5, and k*6 are radial distortion coefficients. p*1 and p*2 are tangential distortion coefficients. Higher-order coefficients are not considered in OpenCV. Dog Insulin ELISA Kitlink ... (more)