Monday, April 5, 2021

Depth of field and exploiting your hidden friend

Advanced warning that this post is rather technical, but if you stick with it, you will hopefully increase your knowledge of depth of field, in a pragmatic way.

The title of the post is not that illuminating: who/what is my hidden friend?

The hidden friend in question is the lens pupil magnification, ie the ratio of the exit pupil diameter to the entrance pupil diameter.

This lens property remains hidden from us as most/all manufacturers do not publish the pupil magnification, even on a prime lens. Plus, with modern, non-prime, lens designs, the pupil magnification will vary and is not predictable in a linear way, unless you have a detailed model of the lens groups and how they move relative to each other.

For most/all photographers, lenses can be acceptably understood by asking the following questions:

  • Is the lens symmetric? That is the pupil magnification (p) is unity, with the exit pupil and entrance pupil diameters being the same;
  • Is the design representative of a retrofocus, with p > 1,  or telephoto, with p < 1, lens?

Every photographer can easily answer the above by simply holding their lens up to a light source and looking from the front of the lens, at the entrance pupil, or from the back of the lens, at exit pupil.

What you will see is one of the following views:

In the top image we are looking at a symmetric lens, ie the exit and entrance pupils are the same size, thus giving a pupil magnification of unity (1.0). In the second image we see the exit pupil, on the right, is smaller than the entrance pupil, so the lens is of a telephoto design, with a pupil magnification less than 1. Whereas in the third image we see the exit pupil is larger than the entrance pupil, so the lens must be of a retrofocus design, with a pupil magnification of greater than 1.

Many/most/all wide angle lenses are of a retrofocus design, whereas many/most/all long lenses are of a telephoto design. Lenses that are around 50mm tend to be symmeteric(ish). Prime lenses are fixed at one pupil magnification, whereas zooms will not have a single pupil magnification.

Now we know something about our hidden friend, ie the pupil magnification, let's now see why, for some photography, it may be useful to know the pupil magnification, or at least whether the lens is retrofocus or telephoto.

All of my depth of field and focus insights are pragmatically derived from my 'DOFIS model'. Note I said model, as we will 'never' know the actual lens design, nor do we wish to. 

Remember, all models are wrong, but some are useful.

Here is the DOFIS model as a reminder:

In the DOFIS model we ignore the actual lens design and make use of a split/thick lens representation of our lens, based on knowing the following five parameters:

  1. The focal length
  2. The maximum magnification at a particular focal length
  3. The minimum focus distance at a particular focal length
  4. The focus distance from the sensor
  5. The pupil magnification

The focal length and focus distance are easy to know/measure and we won't discuss these anymore. 

The maximum (image) magnification can simply be taken from the manufacturer's specifications or measured easily. Noting that for a zoom lens the maximum magnification will be stated at the longest focal length. Likewise the minimum focus at the maximum magnification can be taken from the manufacturer's specification or, once again, easily measured.

This leaves our hidden friend: the pupil magnification, which can be measured, but the question is: do we need to know its value?

To answer this we first need to be honest with ourselves. That is, answer the question: why do I need to know the depth of field?

Without listing every type of photography, I think it fair to say there are two extremes when it comes to depth of field considerations. 

There are those that are only interested in capturing a 'slice' of the image as being in focus, with an 'out of focus' background, albeit with the slice in focus potentially made up of multiple images to ensure the subject is addressed, eg as in macro photography. The extreme of this being a single capture, eg a non-macro portrait shot.

At the other extreme are those, such as myself, who are interested in capturing the entire scene in focus, from the nearest point of interest to infinity. Once again, the extremes here being a single image capture at or beyond the hyperfocal, to taking multiple focus brackets to cover the depth of field of the scene of interest.

To get some insight into our hidden friend, the pupil magnification, we can play around with the DOFIS model and rewrite the total depth of field in terms of the image magnification (m) and the pupil magnification (p): the expression being:

Where f is the focal length and c the circle of confusion criterion we are using, and n is the aperture number at infinity.

The usual caveats apply here, ie we are 'only' looking at defocus blur, ie ignoring diffraction blur, and assuming a perfect lens, ie ignoring all other aberrations.

In addition, let's simplify things even more by looking at the ratio of the depth of field ignoring the pupil magnification (assuming a symmetric lens) to using p, ie an asymmetric lens. Namely:

Resulting in our hidden friend's impact on DoF collapsing down to the following expression, which some will spot as ‘just’ the ratio of the two bellows factors:

We can now begin to see an important attribute of our hidden friend. Namely if we ignore pupil magnification then we will either under or over estimate the depth of field, according to whether we are using a telephoto or retrofocus class lens. 

As the equation may still not be that useful for some, let's look at a 3D graphical representation of the equation over a typical m/p space, eg m = 0 (ie at infinity) to 1 (ie macro), and p = 0.3 (ie telephoto) to 5 (ie highly retrofocus).

Here we see the impact of ignoring our hidden friend, the pupil magnification, ie assuming it is unity. Namely that with a retrofocus (wide angle with a p>1) lens, if we ignore the pupil magnification, we will over estimate the depth of field, with this becoming worse in the macro focus regime (m=1) and can be ignored at infinity focus (m=0). But, on a telephoto lens, ignoring the pupil magnification means that we are under estimating the depth of field.

The impact of ignoring the pupil magnification at the macro end (m=1), can be over 50%, ie for highly asymmetric lenses.

Before discussing this in a little more detail, let's collapse the above 3D plot to a contour plot, ie looking down on to the surface.

We can now clearly see that for symmetric lenses, ie p=1, we can ignore the impact of the pupil magnification: obviously!

On retrofocus lenses at low magnifications, ie less than say, 0.1, we can also ignore the pupil magnification's impact on depth of field. For example at p=5, the impact is ((1+0.1)5)/(0.1+5) = 1.08, ie less than 10%.

For telephoto lenses (p<1), if we do ignore the pupil magnification, the actual depth of field will always be more than we calculated, ie we will always under estimate DoFs on a telephoto lens by ignoring our friend. Thus we are less sensitive to ignoring p, assuming we are still interested in maximising DoF.

For retrofocus, wide angle lenses, the opposite is true. Namely, we will kid ourselves that we have a larger DoF than is the case, if we ignore our friend.

Let's now get to the bottom line: why do I keep calling the pupil magnification our hidden friend?

IMHO we can ignore pupil magnification for any single image capture. Having said this, now we understand the impact of the pupil magnification on our DoF, we can make pragmatic adjustments to our focusing, knowing if we are using a telephoto or retrofocus lens and assuming a particular DoF is important in our shot. 

Where knowing something about our hidden friend helps us, is when we are auto focus stacking with retrofocus lenses, for example using a Magic Lantern or CHDK Lua script to carry out a 'scape' focus bracket sequence. In such a case we don't want to create 'focus gaps': we need to ensure a focus overlap.

In the above, with infinity to the right, we see that the focus at Sn+1 is positioned to create a positive overlap between the last image's far DoF and the current image's near DoF.

We now can conclude with a few observations:

  • Pupil magnification does impact the DoFs of retrofocus and telephoto lenses when the magnification gets above about 0.1ish;
  • If we ignore pupil magnification, we will under or over estimate our DoFs, according to whether the lens is of a telephoto or retrofocus design;
  • The factor your depth of field will be adrift can be estimated from ((1+m)p)/(m+p);
  • For non-macro, deep focus bracketing (see previous posts on M3 Brackets and ML DOFIS scripts), it is useful to know that you can exploit the pupil magnification, without explicitly knowing it. That on a retrofocus lens simply guess/assume a pupil magnification to guarantee you don't create focus gaps in your focus stacks. For example, use a p of 3 or 5. On a telephoto use a p of unity to achieve focus overlap insurance.

In a future post I’ll discuss how I have used the above to create a 'focus insurance' feature in my CHDK M3 Brackets script.

As usual, I welcome any feedback on this post or any of my posts.


For those interested in knowing where the 10% tolerability point exists, ie the DoF accounting for pupil magnification is only adrift from that ignoring it (p=1) by 10%, here are the curves for retrofocus and telephoto lenses:

Note the difference between telephoto and retrofocus.


Here is a more generalised plot showing the DoF % difference in ignoring pupil magnification, in 10% increments:

In the case of a retrofocus lens (top part of the plot), the plot shows that at a magnification of, say, 1, if you ignore the pupil magnification, your DoF estimate will be out, ie over estimated, by 50%, if your lens has a pupil magnification of 3.

No comments:

Post a Comment