Pin-Hole Camera

This chapter addresses the problem of describing how light incident on objects is recorded by a digital sensor. This concept is fundamental to image processing because it provides the relationship between image points and their positions in the world. In other words, it makes it possible to determine the locations in space associated with an image pixel or, conversely, to identify the image region that captures a given region in world coordinates.

The most commonly used projection model, known as the Pin-Hole Camera, is based on simple geometric ratios9.1.

Figure 9.1 shows a highly simplified diagram of how an image is formed on the sensor. The observed point $(x_i,y_i,z_i)^{\top}$, expressed in camera coordinates, is projected onto the sensor plane. All these rays pass through the same point: the projection center (pin-hole).

Figure: The pin-hole camera model. A world point expressed in camera coordinates is projected onto the image plane.
Image fig_pinhole

As shown in Figure 9.1, the ratios between the similar triangles formed by the optical rays describe the equation used to project an arbitrary point $(x_i,y_i,z_i)^{\top}$, expressed in camera coordinates (one of the coordinate systems in which we can work), onto the sensor plane:

\begin{displaymath}
\begin{bmatrix}
\tilde{u}_i \\
\tilde{v}_i
\end{bmatrix}=
\frac{f}{z_i}
\begin{bmatrix}
x_i \\
y_i
\end{bmatrix},
\end{displaymath} (9.1)

where $f$ is the focal length, that is, the distance between the pin-hole and the sensor.

Note that the coordinates $(x_i,y_i,z_i)^{\top}$, expressed in the camera coordinate system, follow a different convention from that used for world coordinates. In what follows, this difference will be accounted for by an axis-permutation matrix $\boldsymbol{\Pi}$, keeping the choice of coordinate system separate from the camera's physical rotation. The coordinate $z_i$ therefore represents the point's depth along the camera's optical axis.

Defining

\begin{displaymath}
\tilde{x}_i = \frac{x_i}{z_i},
\qquad
\tilde{y}_i = \frac{y_i}{z_i},
\end{displaymath} (9.2)

the coordinates $(\tilde{x}_i,\tilde{y}_i)$ are called normalized image coordinates. They represent the intersection of the optical ray with the image plane, located at unit distance from the projection center, and are independent of the camera's intrinsic parameters, image resolution, and physical sensor dimensions.

Equation (9.1) can therefore also be written as

\begin{displaymath}
\begin{bmatrix}
\tilde{u}_i \\
\tilde{v}_i
\end{bmatrix}=
f
\begin{bmatrix}
\tilde{x}_i \\
\tilde{y}_i
\end{bmatrix}.
\end{displaymath} (9.3)

Normalized coordinates thus form an intermediate space between the three-dimensional scene geometry and the discrete image coordinates. Many computer vision algorithms, such as pose estimation, triangulation, and epipolar geometry, assume that image points are expressed in this coordinate system.

Sensor coordinates $(\tilde{u}_i,\tilde{v}_i)^{\top}$ are not yet the coordinates of the digital image, but rather “intermediate” coordinates expressed in the sensor's physical units. An additional transformation is therefore required to obtain image coordinates:

\begin{displaymath}
\begin{bmatrix}
u_i \\
v_i
\end{bmatrix}=
\begin{bmatrix}
D...
...v}_i
\end{bmatrix}+
\begin{bmatrix}
u_0 \\
v_0
\end{bmatrix},
\end{displaymath} (9.4)

where the coordinates $(u_0,v_0)$ (principal point) account for the offset between the origin of the coordinates in the stored image and the projection of the optical center onto the sensor.

$D_u$ and $D_v$ are conversion factors between the units of the sensor coordinate system, typically metric units, and those of the image, measured in pixels. For square pixels, the two conversion factors are equal.

When information about $f$, $D_u$, and $D_v$ is unavailable (for example, in the various datasheets), these variables are often combined into two new parameters, $k_u$ and $k_v$: the effective focal lengths measured in pixels, which can be estimated empirically from images, as discussed in the section on calibration.

These variables are defined as

\begin{displaymath}
\begin{array}{l}
k_u = D_u f, \\
k_v = D_v f.
\end{array}\end{displaymath} (9.5)

Using normalized image coordinates, the transformation to pixel coordinates is therefore

\begin{displaymath}
\begin{array}{l}
u_i = k_u \tilde{x}_i + u_0, \\
v_i = k_v \tilde{y}_i + v_0.
\end{array}\end{displaymath} (9.6)

If the principal point approximately coincides with the image center, $k_u$ and $k_v$ can also be related to half the field of view:

\begin{displaymath}
k_u \simeq \frac{W}{2\tan\alpha_u},
\qquad
k_v \simeq \frac{H}{2\tan\alpha_v},
\end{displaymath} (9.7)

where $W$ and $H$ are the image width and height in pixels, respectively, while $\alpha_u$ and $\alpha_v$ are half the horizontal and vertical fields of view.

For a sensor with square pixels, $k_u$ and $k_v$ tend to have the same value.

Because of the division by $z_i$, Equation (9.1) cannot be directly represented by a linear transformation in Cartesian coordinates. However, it can be rewritten by introducing a scale factor $\lambda$, allowing the projection to be represented as a linear system in homogeneous coordinates. To do this, we use the theory of homogeneous coordinates presented in Section 1.5.

The transformation between normalized image coordinates and pixel coordinates can be represented by the intrinsic parameter matrix

\begin{displaymath}
\mathbf{K} =
\begin{bmatrix}
k_u & k_{\gamma} & u_0 \\
0 & k_v & v_0 \\
0 & 0 & 1
\end{bmatrix},
\end{displaymath} (9.8)

where $k_{\gamma}$ is the skew factor, which accounts for any non-orthogonality between the sensor axes.

If $k_{\gamma}=0$, then

\begin{displaymath}
\begin{bmatrix}
u_i \\
v_i \\
1
\end{bmatrix}=
\mathbf{K}
\begin{bmatrix}
\tilde{x}_i \\
\tilde{y}_i \\
1
\end{bmatrix}.
\end{displaymath} (9.9)

Recalling that

\begin{displaymath}
\tilde{x}_i = \frac{x_i}{z_i},
\qquad
\tilde{y}_i = \frac{y_i}{z_i},
\end{displaymath}

the projection can be written directly in homogeneous coordinates as
\begin{displaymath}
\begin{bmatrix}
\lambda u_i \\
\lambda v_i \\
\lambda
\end...
...
\mathbf{K}
\begin{bmatrix}
x_i \\
y_i \\
z_i
\end{bmatrix},
\end{displaymath} (9.10)

with $\lambda = z_i$.

For this reason, $\lambda$ is normally left implicit, and homogeneous coordinates are used: to obtain the point in non-homogeneous coordinates, simply divide the first two coordinates by the third. Homogeneous coordinates thus make division by the coordinate $z_i$ implicit.

The matrix $\mathbf{K}$ depends only on the camera's internal parameters and is therefore called the intrinsic parameter matrix. In the general case, it is an upper triangular matrix defined by five parameters.

With modern digital sensors, the skew factor $k_{\gamma}$, which accounts for the angle between the sensor axes not being exactly $90^\circ$, can normally be set to zero.

Setting $k_{\gamma}=0$, the inverse of matrix (9.8) can be written as

\begin{displaymath}
\mathbf{K}^{-1} =
\begin{bmatrix}
\dfrac{1}{k_u} & 0 & -\dfr...
...dfrac{1}{k_v} & -\dfrac{v_0}{k_v} \\
0 & 0 & 1
\end{bmatrix}.
\end{displaymath} (9.11)

In particular, the inverse intrinsic matrix transforms an image point into the corresponding normalized image coordinates:

\begin{displaymath}
\begin{bmatrix}
\tilde{x}_i \\
\tilde{y}_i \\
1
\end{bmatr...
...athbf{K}^{-1}
\begin{bmatrix}
u_i \\
v_i \\
1
\end{bmatrix}.
\end{displaymath} (9.12)

Knowing these parameters (see Section 9.5 on calibration) makes it possible to transform a point from camera coordinates to image coordinates or, conversely, to generate the camera-coordinate ray corresponding to an image point. In particular, the vector

\begin{displaymath}
\begin{bmatrix}
\tilde{x}_i \\
\tilde{y}_i \\
1
\end{bmatrix}\end{displaymath} (9.13)

identifies, up to a scale factor, the direction of the optical ray associated with the image point $(u_i,v_i)$.

This model, however, does not account for lens distortion. The pin-hole camera model is valid only when the image coordinates being used refer to distortion-free images.



Footnotes

... ratios9.1
Most models fall within the pin-hole model, understood as a model in which all light rays pass through a single point. However, some models generalize the pin-hole model to catadioptric cameras, such as the Mei model, while others use different models, such as the double sphere.


Subsections
Paolo medici
2026-10-19