Depth of field simulations
One of the things that seems to confuse a lot of photographers, is something called “depth of field”. In this essay, I shall try to show by mathematical simulation how depth of field behave when subjected to variations in sensor size and other parameters.
Ansel Adams wrote in his landmark book, The Camera (1980):
We can achieve critical focus for only one plane in front of the camera, and all objects in this plane will be sharp. In addition, there will be an area just in front of and behind this plane that will appear reasonably sharp (according to the standards of sharpness required for the particular photograph and the degree of enlargement of the negative). This total region of adequate focus represents the depth of field.
As Ansel Adams points out, only one single plane will be in perfect focus. But because humans do not have perfect eyesight, and because lenses and sensors do not have infinite resolution, there is a region surrounding the point in perfect focus that most viewers will deem to be in focus. An old rule of thumb says the region of acceptable sharpness extends from 1/3 in front of perfect focus plane to 2/3 behind it. However, this rule of thumb is only strictly true at 1/3 of the hyperfocal distance. In the macro region, the perfect focus plane is in the middle of the region of acceptable sharpness, and when the lens focused at the hyperfocal distance; then region of acceptable sharpness extends from 1/2 the focusing distance to infinity.
Most of the confusion surrounding the term DOF in photographic circles stems from a failure to understand what DOF is, and is not.
DOF is not an objective, intrinsic or inherent property of a film negative or a digital image file. DOF is mainly determined by magnification. A postcard sized and poster sized print of the same negative or file will show different DOF if both are viewed from the same distance. The smaller print will appear to have a greater DOF. DOF is a property of an photographic image that depends upon, and varies with, the context of presentation, including such things as the physical size of the printed image, the distance of the observer relative to the printed image, and even the visual acuity of the observer. The DOF numbers one can find in manufacturers DOF-tables or engraved upon lenses are not universal and ubiquitous. They are just guidelines for what the DOF will be like, based upon assumptions about the how the DOF in an average print will be perceived when it is viewed by an average observer from an average distance.
In 1840, German mathematician Carl Friedrich Gauss published a book named Dioptrische Untersuchungen that described optics in mathematical terms.
The formula below is derived from Gauss' work, and shows how to calculate the DOF for any focal length, aperture subject distance and sensor size. It is taken from Allen R. Greenleaf: Photographic Optics, MacMillan, New York, 1950, pp. 25-27. (Notation: f is the focal length, d is the subject distance, CoC is the circle of confusion (discussed below), and N is the aperture expressed as an f-number.)
This simple model of an optical system assumes that singular points are infinitely small, that all lenses are perfect and symmetrical, that diffraction and airy disks do not exist, and that cross-talk, sensor pixel pitch, bayer interpolation and film grain does not interfere with resolution. In real photography this is not true, but model is a close enough approximation to reality to allow us to simulate the behaviour of an optical system with some confidence.
For digital sensors, it should be noted that this model assumes that the CoC is larger than the sampling limit according to the Nyquist theorem (i.e. larger than twice the photosite pitch) . This constraint is, however, satisfied for all modern digital cameras with a pixel count of 6 Mpx or more.
As can be easily seen, the DOF formula is a hyperbolic function that converges towards zero in the macro region. To be precise, it is zero when the subject distance (d) is equal to the focal length (f). It converges towards infinity as the distance (d) increases. The value of the distance d when the function becomes infinity is known as the hyperfocal distance (H), and can be computed as follows:
H = f2/(CoC x N)
The reason DOF is not infinitesimal thin, is that human observers to not have infinitely sharp eyesight. “Blur” that is smaller than what can be perceived by an human observer is perceived as “sharp”. DOF, in other words, is the region around the perfectly sharp plane containing blur that is so small that it can not be detected by a human observer.
German lens manufacturer Carl Zeiss had this to say about this blur in their newsletter Camera Lens News No. 1 (1997):
A certain amount of blur is supposed to be tolerable. According to international standards the degree of blur tolerable is defined as 1/1000th of the camera format diagonal, as the normally satisfactory value. With 35 mm format and its 43 mm diagonal only 1/1500th is deemed tolerable, resulting in 43 mm/1500 ≈ 0.030 mm = 30 µm of blur.
(The numbers 43 mm and 1/1500 used in the quoted text is approximate. The diagonal of 35 mm film is 43.27 mm. To actually get 30 µm of blur, 1/1442 – not 1/5000 – is the fraction to use.)
The tolerable amount of blur blur projected onto the film or sensor plane is often referred to as the Circle of Confusion or CoC. Understanding the CoC is essential to understand how DOF works. As Zeiss explaims, the CoC for any film or digital format can be computed by dividing the length of the diagonal of the negative or the camera's digital sensor with a number. In this article, I will refer to this number as the z-number in honour of Zeiss.
CoC = D / z-number
z-number = D / CoC
In the quote above, Zeiss says that the CoC for 35 mm film should be 30 µm, i.e. that the CoC should be set equal to 1/1442th of the diagonal, which gives a CoC equal to 30 µm for a 43.27 mm diagonal capture.
The CoC of 30 µm, in turn, is based upon assumptions about what constitutes an “average” print and viewer. To cut a long story short: From experiments, Zeiss knows that a person of average eyesight in good light from an viewing distance equal to 30 cm is capable of resolving 5 lines per millimeter or 200 µm. If this detail exists on a a print with a 300 mm diagonal (i.e. about 16.7 cm x 25 cm) that is enlarged from a negative with 43 mm diagonal (i.e. a ≈ 7x enlargement) the detail measures 200 µm/7 ≈ 29 µm on the image sensor or negative. In the quoted portion from Camera Lens Use, this number is just rounded up to become 30 µm.
If we set the z-number equal to 1442, we find that CoC for FX/FF/135-format film (43.27 mm diagonal) is 30 µm, that the CoC for a DX-format digital sensor (28.4 mm diagonal) is 20 µm, and that the CoC for a 1/1.8" type digital sensor (8.9 mm diagonal) it is 6 µm.
Below are five simulations derived from the gaussian model of optics discussed above. The idea behind the simulations is to demonstrate how depth of field (DOF) changes when we vary various parameters that, according to the model, impacts on DOF. Aperture (f/2.0), print size (16.7 cm x 25 cm) and viewing distance (30 cm) is kept constant in all five plots, while other parameters are changed as noted.
- Sensor size (crop factor).
- Focal length.
- Distance to subject.
DOF vs. sensor size
In our first simulation, we shall simulate how sensor size impacts upon DOF. The focal length, aperture distance to subject are all kept constant. What vary, from 10 mm to 45 mm, is the sensor diagonal. This actually simulating starting with a small crop of a negative, and using bigger and bigger portions of it. Or moving the same lens from a camera with a small large digital sensor to a camera with a larger digital sensor.
As indicated by figure 1, there is a strict linear relation between sensor diagonal size and DOF. I.e. having a larger sensor also results in a larger DOF.
Some people that both use digital compact cameras (small sensor) and DSLRs (larger sensor) protest when I show them this figure. They know well that digital compacts have huge DOF, and DSLRs have much more shallow DOF – which is the opposite of what this figure shows. It is true that digtal compact cameras have huge DOF, but that is because they come with lenses with very short focal lengths. How focal length impacts on DOF is the subject of the next simulation.
DOF with constant FOV
The situation most people is interested in with respect to sensor size is what happens to DOF when we change from a DSLR with one size sensor to another, but also change the lens to one with a different focal length to keep the field of view (FOV) constant.
This is done in figure 2. The focal length is at all times kept is equal the sensor diagonal (this translates into a so-called “normal” lens). Aperture is kept constant at f/2.0 and distance to scene is also constant at 1 meter.
Figure 2 below clearly shows that given the same field of view, and distance to scene, the wider focal length that must be used with a small sensor size (f=10 mm) will result in a deeper DOF than a lens that must be used with a large diagonal sensor (f=45 mm).
This figure also shows why compact digital cameras, have such a huge DOF. You see the DOF of a compact camera with a sensor with a 10 mm diagonal at the left edge of a graph, and a DSLR with a FX sensor with a 43.3 mm diagonal near rge right edge of the graph.
DOF with constant magnification
[To be added.]
For more about DOF, see these articles:
- Bob Atkins: Depth of Field and the Small-Sensor Digital Cameras
- Canon Europe: Tools: Canon depth-of-field calculator
- Don Fleming: DOFMaster Depth of Field Calculator
- Norman Koren: Depth of field and diffraction
- Sean McHugh: Tutorials: Depth of Field
- H.H. Nasse (Zeiss.com): Depth of field and bokeh (pdf)
- Paul van Walree: Bokeh
- Paul van Walree: Depth of field
- Warren Yong: f/Calc