Wednesday, June 14, 2017

Close enough

Now that my focus bar script is up and running, with a focus stacking functionality; I decided to take a deeper look at the math, and, in particular, the effect of ignoring the pupil magnification. That is, the current depth of field equations, like most DoF calculators, assume a symmetrical lens with the exit and entrance pupils being the same, ie a pupil magnification (P) of unity (exit pupil size divided by entrance pupil size).

You can easily check the symmetry of your lens by simply holding it up to the light and looking at the size of the opening from the back and the front: usually best done after closing down the lens down by a couple of stops.

Wide angle lenses tend to be retrofocus, ie P>1; whereas telephoto lens will have P less than unity. Also P will vary with focus length, thus complicating using P with a zoom lens.

Typically the extremes of P vary from 0.1 to 10. Ignoring Ps greater than one will lead to overestimating the depth of field. Whereas ignoring Ps less than one will lead to underestimating the depth of field.

All the literature implies that for most photography, especially landscape, where we tend to focus at a distance, ie relative to the focal length, the pupil magnification can pragmatically be ignored. The only time that P becomes important is in macro photography, ie where we are focusing close to the focal length.

Rather than ‘just’ accept the implied wisdom, I decided to take a look at the impact of P, albeit limited to my normal photography genre of nature or urban landscapes, ie where I will be focusing at a distance.

For those interested, the near and far depth of fields can be calculated from the following (taken from toothwalker.org), where: P is the pupil magnification; v the point of focus; f the focal length; C the lens blur, ie CoC; and D the lens aperture = f/N; N the F-number.

For the case of interest, ie a wide angle, retrofocus lenses, say with Ps in the 1 to, say, 5 region, the impact on the depth of field is to reduce it: but by how much?

To illustrate the impact, let’s assume a hypothetical 12mm asymmetric lens, with a pupil magnification of, say, 5, on a full frame camera set at F/16, and with a blur criterion on 30 microns. For simplicity we will ignore diffraction.

Using the above equations it is easy to show that if we focus at the hyperfocal distance, of about 312mm, the near depth of field, for a unity P value, is 156mm, ie HFD/2. Whereas, if P was, say, 5, the near depth of field will change to about a 160mm (leaving all variables unchanged), ie a ‘loss’ of depth of field of 4mm! If P was 2, then the near depth of field would be just short of 159mm, ie a ‘loss’ of 1mm!

If we focus at less than the hyperfocal, say, at HFD/2 (156mm), then the near and far depth of fields for P = 1 and P = 5, would be 105mm vs 107mm and 300mm vs 294mm. respectively. Once again, hardly significant.

In other words, we are taking about a few % changes and, hence, it does indeed appear safe to ignore P for non-macro photography.

However, things can be better if you adopt best practice when landscape focusing, eg either using infinity-biased focusing or even focus stacking.

Assuming you are using the focus bar, which has a focus stacking feature, use the ‘pink bar feature’ to ensure that, image to image, the depths of field overlap. The ‘only’ loss being the final image’s near depth of field loss, which is only mms as we saw above.

Also, whether you use focus stacking or not, it is important to avoid using a ‘simple’ hyperfocal approach for your farthest image. That is always focus beyond the hyperfocal and, using the focus bar, seek to minimise the infinity blur (which is provided via the focus bar, when focusing beyond the HFD). If this results in an unacceptable near depth of field, then add in one or two near depth of field focus brackets, ie using the focus bar to help you manage the image to image overlap.

Bottom line:

Although far from exhaustive, it is clear, that for non-macro photography (sic), it appears reasonable and pragmatic to assume our lenses are symmetrical, after all the depths of field are there to inform our photography choices, not control them. Also the focus bar illustrates that the ‘fall off’ in the focus field is not a cliff edge, especially for the far field;

The issue is not using the equations, as it would be simple to add the ‘P-factor’ to Lua depth of field scripts in ML, eg in the focus bar script; the complication would be measuring P, and keeping track of it as you varied lenses, especially if you have a zoom lens;

By not (sic) using an HFD approach, and undertaking an infinity-biased focus for your landscapes, ie focusing towards infinity and away from the HFD, you can safely ignore the pupil magnification, and get better depth of field quality at infinity;

If you then find the near depth of field too far away, then the focus bar provides an easy way to capture further near depth of field brackets.