Skip to content

Reference: calibration data explained

John De Witt edited this page Apr 18, 2017 · 5 revisions

Motivation

This page is meant to serve as a reference to one of the common ways calibration data manifests. Terms such as "camera matrix" and "distortion coefficients" can mean different things in different contexts; hopefully this page will help keep things concrete. Please note that units can be in whatever system you like; I try to stick to meters and millimeters (m,mm) for examples. OpenCV uses a calibration model that draws from Brown and Zhang/Tsai work.

camera intrinsic matrix (3x3 matrix)

fx 0 cx
0 fy cy
0 0 1

fx and fy

fx and fy represent the zoom scale of the lens. Each value is actually the product of multiplying the physical focal length of the lens F (e.g. 3 mm) with the number of pixels per system unit (sx,sy e.g. 900 pixels/mm). This means fx and fy are in units of pixels:

fx = F * sx

fy = F * sy

e.g. (3 mm) * (900 pixels/mm) = (2700 pixels) or (mm) * (pixels/mm) = (pixels).

calibrating the raspberry pi v2 camera @ 1080p gave fx and fy2593.2

The spec sheet for the camera states a pixel size of 1.12 µm x 1.12 µm (micrometers). So the edge length for both x and y dimensions is 1.12e-6 m or 0.00000112 m (meters). In our case, sx and sy are in units of pixels per meter but those spec sheet measurements are in units meters per pixel so we need to take the reciprocal of the spec sheet value to get sx = sy = 892857.1 pixels per meter. To verify the focal length spec, we can divide fx by sx or fy by sy in the hopes of getting F.

fx / sx = F

fy / sy = F

e.g. (2593.2 pixels) / (892857.1 pixels per meter) ≈ 0.0029 meters -> 2.9 mm

The spec sheet states that the focal length of the lens is 3.04 mm, so everything seems to check out.

cx and cy

cx and cy represent the coordinates in pixel units of the principal point aka the center of radial distortion model. These values are usually close to the middle of the sensor, or w/2 and h/2 where w and h are equal to the number of pixels in the x and y dimensions.

The spec sheet states 1920 x 1080 pixels, so we would expect a cx1920/2 = 960 and cy1080/2 = 540.

calibrating the raspberry pi v2 camera @ 1080p gave cx987.6 and cy553.2

camera distortion coefficients (1x5 matrix)

OpenCV's distortion model includes radial and tangential components. If the center of the sensor is at (cx,cy), and we are considering an arbitrary point (px,py), then the radial distance from the center r = ((cx-px)^2 + (cy+py)^2)^0.5