## 1. Overview

In this tutorial, we’ll delve into the concept of focal length and its relationship with the camera intrinsic matrix.

Before explaining these concepts, we’ll review the pinhole camera model, the basic model describing the image formation process.

## 2. Pinhole Camera Model

The pinhole camera model provides a simplified representation of how light interacts with a camera to form an image. In this model, the camera is represented as a simple box with a tiny hole on one side and a flat image plane on the other. All rays of light are blocked by the walls of the box except those passing through the tiny hole.

When an object is placed in front of the aperture, rays of light emanating from different points of the object pass through the aperture and form an inverted image on the image plane.

**The following figure represents the operating principle of the pinhole camera:**

Without the box and the pinhole, the flat image panel would be illuminated from all points in a hemisphere. Hence, uniform coloring is projected on the panel and no image can be observed.

**This projection process involves several key factors**:

- objects farther away from the camera appear smaller in the image
- due to the light rays intersecting at a single point (the pinhole), the resulting image on the image plane is inverted
- the size of the aperture and its distance from the image plane determines the field of view of the camera. A larger aperture or a shorter distance results in a wider field of view, capturing more of the scene
- the image size of the distant object is proportional to the distance from the pinhole aperture to the image panel

However, a real pinhole camera cannot work well because a tiny hole cannot gather enough light in a short exposure time. Hence, lenses are used in cameras to accumulate more light.

### 2.1. Camera Parameters

**Let’s now define the fundamental parameters of the pinhole camera model:**

- the
*center of projection*is the point where the pinhole aperture is located - the
*focal length*is the distance between the center of the projection and the image plane - the
*optical axis*is the line perpendicular to the image plane and passing through the center of projection - the
*principal point*is defined as the point of intersection between the optical axis and the image plane

The projection geometry of the pinhole camera and the parameters defined above are represented in the following figure:

We observe two similar triangles, hence we can derive a simple equation that relates the size of the object and its projected image:

(1)

where is the real size of the object, is the size of the object on the image plane, is the focal length and is the distance from the object to the pinhole aperture. The minus sign is because the image is inverted. Hence, it is more customary to ideally swap the pinhole and the image plane, as shown in the following figure:

The image plane is ideally placed in front of the pinhole. A point in space is projected on the image plane by tracing the line passing through the point and the center of projection. The resulting projection of is . In this abstraction, the object appears right side up and the math comes out easier.

## 3. Understanding Focal Length

The focal length determines the field of view and the magnification of the camera. **A longer focal length results in a narrower field of view and magnifies distant objects, while a shorter focal length captures a wider field of view but diminishes the magnification of distant objects**.

The relation between a point in the real space and its projection on the image plane at the pixel location is represented by the following equations:

(2)

(3)

where and are two parameters that handle possible misalignment of the principal point with the center of the image; and are essentially the focal lengths expressed in pixels. **We introduce two new parameters because each pixel on a typical imager is rectangular, hence the pixel lengths in **** and **** are different**. It is worth noting that , , , , , are expressed in units of pixels.

The physical focal length , expressed in units of millimeters, cannot be measured directly. However, the focal lengths and can be measured using a procedure called *camera calibration*.

## 4. Camera Intrinsic Matrix

**Projective transform is the function that maps the points in the space with coordinates **** to its projection **** on the image plane**. It is customary to express such transform using the homogeneous coordinates, hence the equation (2) and (3) can be written in the following matrix form:

(4)

where and are the coordinates of the point in the space and the corresponding projection coordinates:

(5)

and M is a 3×3 matrix called *camera intrinsic matrix:*

(6)

**The camera intrinsic matrix represents the internal parameters of a camera, including the focal length, and it allows to project 3D points in the world onto the 2D image plane.**

**The parameters of the camera intrinsic matrix are estimated by performing the camera calibration procedure**. The latter is typically performed using a set of known geometric patterns (e.g., chessboard patterns) or objects with precisely measured dimensions, allowing for the estimation of the camera parameters through mathematical algorithms, such as Zhang’s method or the Direct Linear Transform (DLT) algorithm.

## 5. Conclusion

In this article, we reviewed the focal length and the camera intrinsic parameters, fundamental properties of cameras. Furthermore, we described the image formation process by illustrating the pinhole camera model.