No jobs
Core 11 min 3 of 4

Intrinsics: from metres to pixels

K is an affine map applied after the division. Each entry is a fact about a sensor.

What this repairs

Reading $K$ as "the camera matrix" without being able to say which entry changes when you crop, resize, or switch to a different lens.

The pinhole equations produce a position on the image plane in metres, measured from the optical axis. A file on disk stores pixel indices from the top-left corner. The intrinsic matrix is exactly the conversion between those two, and nothing else:

K=[fxscx0fycy001],(uv1)=K(xnyn1),xn=XZ,  yn=YZ.K = \begin{bmatrix} f_x & s & c_x \\ 0 & f_y & c_y \\ 0 & 0 & 1 \end{bmatrix}, \qquad \begin{pmatrix} u \\ v \\ 1 \end{pmatrix} = K \begin{pmatrix} x_n \\ y_n \\ 1 \end{pmatrix}, \qquad x_n = \frac{X}{Z},\; y_n = \frac{Y}{Z}.

Note the order. The division happens first, producing normalised coordinates (xn,yn)(x_n, y_n) ; then KK acts, and it is a plain 2D affine map — scale, shear, translate. Nothing about KK is perspective. It is a units conversion that happens to be written as a matrix.

Entry by entry:

  • fx,fyf_x, f_y — focal length in pixels. This is the physical focal length divided by the physical pixel pitch, which is why " f=520f = 520 " is meaningless without an image size and why the number changes when you resize an image. fxfyf_x \neq f_y means non-square pixels; on modern sensors the ratio is 11 to within a fraction of a percent, and a calibration that returns 1.041.04 is telling you about your calibration, not your sensor.
  • cx,cyc_x, c_y — the principal point, where the optical axis pierces the sensor. Nominally the image centre; in practice off by a few to a few tens of pixels from manufacturing tolerance. It moves when you crop.
  • ss — skew, non-rectangular pixels. Zero. It has been zero for thirty years. Its only use is as a sanity check: if your calibration returns a large skew, one of your other parameters is absorbing an error.

Focal length and field of view

  1. tan(θh2)=W/2fx\tan\left(\frac{\theta_h}{2}\right) = \frac{W/2}{f_x}

    Half the image width subtends half the horizontal field of view, at distance f_x. Both in pixels, so the units cancel.

  2. θh=2arctan ⁣(W2fx)\theta_h = 2\arctan\!\left(\frac{W}{2 f_x}\right)

    The usable form. Note it depends on the image width — a focal length alone never determines a field of view.

  3. fx=W2tan(θh/2)f_x = \frac{W}{2\tan(\theta_h/2)}

    And back, for when a datasheet gives you degrees and your code wants pixels.

Check yourself

You centre-crop a 1920×1080 image to 1280×720. What are the new intrinsics?

Show answer

fxf_x and fyf_y are unchanged — cropping removes pixels, it does not change the angle any remaining pixel subtends. The principal point moves by the crop offset: cx=cx320c_x' = c_x - 320 , cy=cy180c_y' = c_y - 180 . The field of view is smaller, but that is because WW and HH shrank in the formula, not because ff changed.

Euler View - ML Experiment Monitor