In this post I’ll introduce a model for understanding in-camera focus bracketing, and discuss how to ‘calibrate’ your camera’s auto focus bracketing, despite the manufacturer’s opaque guidance.

Like many photographers I have a camera with in-built focus bracketing. Also, like many photographers, when I first tried to use the feature in my Canon M6 Mk II, I was initially confused by the manufacturer’s handbook. Which triggered me to investigate how Canon had set up the bracketing.

This in turn led me to realise that all/most camera manufacturers follow the same approach. Namely offer the photographer two main controls to drive the in-built focus bracketing: the step size, usually 1 to 10; and the total number of steps to take.

After looking online, to see what others were saying, I realized that many were falling into the same trap when trying to interpret the step size.

Namely, they were trying to understand the focus bracketing from their eye-brain point of view, ie looking at the bracketing in terms of spatial distances, rather than from the lens point of view.

To emphasis this key point, let’s first remind ourselves what a lens, any lens, ends up doing when we set focus:

In the above
image we see a manual prime lens: in fact my Irix 11mm lens. The key
feature being a depth of field (DoF) scale. Also we see that distances are not
recorded on the lens in a linear fashion, but the DoF scale is. That is, to
manually focus bracket, all we need to do is to rotate the lens by the same DoF amount
indicated by the aperture we are using. Each and every time we focus bracket, irrespective of where we are initially focused.

In a modern electronic lens, and particularly one being driven during auto focus bracketing, the lens rotation is achieved by the camera’s stepper motor (irrespective of the technology or design of the mechanism).

The camera manufacturer knows the lens characteristics and thus can calculate how many steps to drive the lens stepper motor to achieve the required rotation for the selected aperture, focal length and the ‘circle of confusion’, or overlap blur that has been requested (although, as we will see, we are not directly selecting CoC, but using the step size, 1-10).

Each lens will have different total steps to go from the minimum focus distance (MFD) to infinity; and to remove this lens-to-lens complexity, all manufacturers remove this detail and simply give the photographer a relative step range of 1 to 10, which will rotate the lens a certain fraction of the total steps the lens can achieve.

In Canon cameras and lenses that can operate with Magic Lantern or CHDK, one can easily find out the total number of lens steps and thus, via Lua scripting, write scripts to auto focus bracket in the Camera. For those interested in this approach read some of my previous posts and/or look at some of my scripts.

This post, however, is agnostic regarding manufacturer and does not require ML or CHDK.

Before moving on, let’s remind ourselves what a typical depth of field looks like, ie the blur vs distance near and far curves.

By definition the DoF is defined as the distance between a near and far distance, where the optical defocus blur is just acceptable or better. As photographers we usually call this defocus blur the ‘circle of confusion’; and for a full frame format a blur of 30 microns is a typically quoted number.

The value of the CoC being adjusted for other formats according to the crop factor, eg on my Canon M6 MkII the crop factor is 1.6, the blur decreases to 30/1.6, which is 18.75 micron, which usually gets stated as 19 microns.

But note, best practice is to choose a blur that not only reflects your sensor format or crop, but also the viewing distance of a print etc. But for this post, we'll assume a standard value of 30 micron for a full frame.

One useful distance to know is the hyperfocal (H), which is simply the focus distance at which the far depth of field is at ‘infinity’. At this point the near DoF is H/2:

The hyperfocal distance being:

Which, for our purposes in this post, we will simplify by dropping the f term at the end.

Although we are not modelling a macro capture, we are covering a deep focus field, ie in the extreme case the MFD to infinity, and thus we need to recognize where H is referenced from.

Without regurgitating previous posts, the hyperfocal is in fact measured from the entrance pupil of the lens. For those that are interested, here is a reminder of how we can model any lens, using a so-called thick lens representation:

In the above, lower right, we also see how a manual lens depth of field scale is created.

To simplify things we will assume all distances are taken from the entrance pupil, that is we will assume a pupil magnification of unity.

To find the entrance pupil, if your lens is registered, it is a simply matter to look on the PhotonToPhotos website’s Optical Bench Hub. As an example, here is the lens model for my Canon EF-M 11-22mm at 11mm:

From the hub we see the entrance pupil (P) is positioned at about 77mm from the image plane of the camera, ie the hyperfocal is measured from 77mm in front of the image plane of the camera.

In this post we pragmatically use the entrance pupil as our zero for the hyperfocal and all distance measurements (strictly distances are measured from the front principal); as this can be simply estimated in the field by finding the no parallax location.

The next step is to construct a simplified focus bracketing model, ie good enough for pragmatic photographers such as myself.

Also, as we have said above, in this post we are addressing deep focus bracketing, ie not macro focus bracketing. The extreme use case is thus to focus bracket from the minimum point of focus to infinity.

Without proof and using the short form of the hyperfocal, ie ignoring the focal length term, we can use the following focus bracketing model:

In the above we see the simplicity of hyperfocal-based focus bracketing; that is simply repeatedly rotating the lens by the same amount each time, as indicated by the required depth of field, either manually or automatically.

For completeness our integrated model now looks like this:

As a final reminder of why we shouldn’t focus bracket from a distance perspective, here is a view of bracketing down from the hyperfocal, with a 22mm lens set at an aperture of f/8, created with the Focus Simulator on the right, showing the non linear focusing that results if we think in terms of distances, rather than in terms of lens DoF rotations or steps:

All we need to do now is to use the following equation:

Where x is
the distance from the ‘lens’, ie the entrance pupil, to the nearest point of
focus, H is the hyperfocal distance and n is the nth bracket __from__ the
hyperfocal.

Which results in the following two useful forms, noting that B (the number of total brackets captured by the camera when auto focus bracketing) is n+1, ie the number of brackets to get to the hyperfocal plus one at infinity:

- set your lens to the desired focal length, aperture, and to the minimum focus distance
- enable bracketing, set the number of images to capture to a large number, eg 100, and the step size to whatever you wish, say the default 4
- capture the focus bracket set
- note the number of brackets (B) captured.

It is then a simple matter to put the numbers into the equation to estimate the value of the CoC (C) in microns at the selected step size.

As an example, I set my 11-22mm to 22mm, an N of 5.6, and used the manufacturer’s MFD of 150mm (from the image plane), from which I subtracted 77mm, ie the distance from the image plane to the entrance pupil, and used a value of B of 33, ie 33 images were captured.

This gave me
an estimated overlap blur (CoC) of about 9 micron using a step size of 4, which we can compare with the ‘just
acceptable’ CoC of about 19 micron. That is about half and, relative to the sensor pitch, not an unreasonable overlap blur to use.

By repeating the above for all the other step values between 1 and 10, I arrived at the following CoC vs step size plot for focus bracketing on the M6 Mk II:

The above
tells me that if I use a step size of around 7 on the M6 MkII I will be focus bracketing using
an overlap CoC that is ‘just acceptable’, ie around 19 microns. On the other
hand, if I wish to increase the ‘quality’ of the focus bracket set, ie have a
lower overlap blur, I would use a step size of, say, 4, ie around 10 microns.

The other equation above, that estimates the number of brackets (B), can be used by plugging in the values for f, N, C and the focus distance from our lens zero, ie assumed as the entrance pupil, to the nearest point of focus.

Summing up the above we can note that:

- When using the in-camera auto focus bracketing feature, 'think' like the lens, ie in terms of depths of field and lens rotation. Never worry about distances;
- Assume the ‘normal’ CoC value is represented by a step size of 7, ie a CoC focus overlap value of around 19 microns. Note this is based on the Canon M6 Mk II, you may wish to validate this step size for your camera, ie find the step size that generates the normal (30/crop) CoC value;
- To achieve a higher quality focus bracket set, simply use a smaller step size of, say, 4, which will focus bracket at a lower overlap blur. But note that using a smaller step size will create larger bracket sets (use the B formula above to estimate the number of brackets that will likely be required). Plus there is a sensible point below which smaller overlap blurs are not gaining you much, say twice your sensor pitch. Hence, I personally tend to always use a step size of 4, which works for my wide angle, deep focus bracketing.

Although you can focus bracket at any focal length, you should consider limiting your deep focus bracketing to wide angle lenses, the following illustrative plot shows the number of brackets as we vary the overlap blur between 10 and 20 microns, ie the CoC, and the focal length between 11mm and 105mm; at an aperture of f/8 and with a minimum focus distance from the entrance pupil of 80mm:

Thus, as insurance, you may wish to consider taking a manual infinity shot in addition to the auto focus bracket set, ie an image focused by you. I use the following work flow:

- Switch bracketing on (which stays on in the M6 MkII until it is switched off) and set the number of images to, say, 100, and the step size to 4 (in fact I leave mine on 4 all the time, as this is like using an overlap CoC of around 9 microns);
- If your camera has an electronic shutter consider using this for focus bracketing;
- Assuming you are on a tripod, switch off any image stabilisation;
- Manually focus at ‘infinity’, ie use the 10x focus zoom to ensure infinity is captured;
- Press the shutter and take a focus
bracket set, ie at infinity, which will result in a single image;
- Refocus on the nearest point of interest, or simply focus at the MFD;
- Press the shutter to take the main focus bracket set for this image set.

Using the above will ensure you have optimally captured all your focus bracket set, ie a perfect infinity capture and a high quality (overlap) focus bracket set.

As this has been a rather long post, I will stop here and say that, as usual, I welcome any comments on this post or any of my posts.

## No comments:

## Post a Comment