# [Research] Visually understanding DoF with the thin lens model

6 minute read

*Please contact me if there is any inaccurate content in this article.*

I believe the thin lens model is the most straightforward way to understand how the depth of field (DoF) is formed within a camera. We may simplify a complex lens model using the thin lens model for DoF to easily be expressed with several rays hitting the sensor of a camera.

# 1. Thin Lens Model

The figure above explains the thin lens model.
In the figure, consider the left side of the lens as an object space, and the right side as an the inner space of a camera,
in which the focal plane (camera sensor) is located.
Here, $S_1$ is the focal distance (*i.e.*, the distance between the lens and the focused object),
$F$ is the focal length of a lens,
$D$ is the effective aperture (*i.e.*, the diameter of diaphragm of a lens), where
$D=\frac{F}{N}$ ($N$ is f-number of the aperture).
Lastly, $f_1$ is the distance between the lens and the focal plane ($f_1=\frac{fS_1}{S_1-f}$).

When $S_1$ is in focus, the ray started from an object at $x$ creates the circle of confusion (CoC, *a.k.a.* bokeh) in the object space, as well as on the focal plane with the diameter size of $C(x)$ and $c(x)$, respectively.
The relation between $C(x)$ and $c(x)$ is defined as:

$ c(x)=m_1 \cdot m_2 \cdot C(x), \tag{1} $ $ C(x)=D(\frac{|x-S_1|}{x}). \tag{2} $

Here, $m_1$ and $m_2$ are magnification factors, where $m_1=\frac{I_{width}}{S_{width}}$ and $m_2=\frac{f_1}{S_1}=\frac{f}{S_1-f}$. $I_{width}$ and $S_{width}$ represent the width of an image and the camera sensor, respectively.

If we let $m_1=1$ and replace group of camera parameters ($f$, $f_1$, and $N$) as $\alpha$, Eq.1 can be reformulated as:

$ c(x)=\alpha\frac{|x-S_1|}{x}. \tag{3} $

If we draw the thin lens model with Eqs.1,2,3, we can visually check the change of CoC by playing with $x$ and $\alpha=\{S_1, N, F\}$:

# 2. Understanding Depth of Field with the Thin Lens Model

An image with deep DoF contains more sharp regions than an image with shallow DoF. The meaning of deep DoF is that the focus range is wide, whereas the focused range is narrow for shallow DoF. If there are two objects, $a$ and $b$, and let’s say a camera is focused at $b$. We can say DoF became shallow if CoC of $a$ got larger, or the other way around, if we modified the distance between $a$ and $b$ or changed camera parameters.

What are the factors making DoF shallow? If we google it, the answer narrows down to 4 factors.

- when the f-number of the aperture is small,
- when we use a lens with a high focal length,
- when the distance between the focused object and a camera is small,
- when the distance between the focused object and the defocused object is large.

Let’s check if it is really true, using the thin lens graph above.

## 2-1. When the f-number of the aperture is small

Play with aperture ($N$) in the graph. When $N$ gets larger, the diameter of CoC gets smaller. However, when $N$ gets smaller, the diameter of CoC gets larger. In terms of DoF, when $N$ gets larger, DoF becomes deeper, and vice versa.

## 2-2. When we use a lens with a high focal length

Play with the focal length ($F$) in the graph. When focal length is larger, CoC also gets larger. If we look at the graph, there are two factors affecting CoC: $f_1$ and $D$. When $F$ increases, $f_1$, $D$ and CoC get larger (i.e., DoF gets sallower). When $F$ decreases, $f_1$, $D$ and CoC get smaller (i.e., DoF gets deeper).

## 2-3. When the distance between the focused object and a camera is small

If we modify $S_1$ in the graph, we may notice the change of $f_1$. When $S_1$ increases, $f_1$ gets smaller (i.e., DoF gets shallower). When $S_1$ decreases, $f_1$ gets larger (i.e., DoF gets deeper).

## 2-4. When the distance between the focused and defocused objects is large

Play with $x$ in the graph. When $x$ gets further apart from $S_1$, CoC gets larger (i.e., DoF gets shallower). When $x$ gets closer to $S_1$, CoC gets smaller (i.e., DoF gets deeper).