As those that have been following my recent posts know, I’ve been trying to ‘solve’ the problem of focusing with Magic Lantern (ML), be it in an automatic focus bracketing script or in a script that provides manual focus information.

The issue can be ignored if one is focusing away from the ‘macro’ end of a lens, ie towards the hyperfocal and beyond; but as you focus at the near end of a lens, we have a problem between ML and the real world.

The problem being that ML (and Canon) provide us with focus information relative to the sensor plane of the camera. Whereas all the depth of field and hyperfocal equations that we use are referenced from the front principal plane of the lens, which we don’t know and can vary greatly according to the lens design and focal length: even being positioned outside the lens in some cases.

There are techniques to estimate the principal planes, but these are complex and hardly worth doing for ‘normal’ (non-scientific) photography. However, if we limit our attention to landscape-style photography, where we are seeking large depths of field, near to far, with wide angle lenses; then we can make a few pragmatic assumptions and try and ‘resolve’ the ML/Canon focus distance problem.

What we are seeking is a way to convert from the ML sensor-2-object distance to the lens-2-object distance.

To understand the problem, let’s first remind ourselves what the thin lens model looks like; that virtually all depth of field equations are based on. The model looks simple, compared, say, to a modern complex lens, but it is nevertheless powerful.

The thin lens model, which assumes a symmetric lens with unity pupillary magnification, has a single principal plane and all depth of field equations can be derived from the standard, so-called, conjugate equation (after correcting for image inversions, ie using the convention that real is positive), namely:

With a little geometry we can easily show that the distances u and v may be derived as follows:

That is, u and v are derived just from the focal length (f) and the magnification (m).

In the thin lens model, the sensor to object distance x = u + v, and, recognising that the magnification is simply the image size divided by the object size, with a little bit more math, we can show that the magnification (m) is:

It certainly looks like we are on to a winner with the thin lens model, so let’s test it against a real-world lens. In this instance my Sigma 12-24mm DG HSM lens.

Like all manufacturers, Sigma does not provide information on the location of the principal planes, but they do provide the maximum magnification and the minimum focus distance. So let’s use this information to test the thin lens model.

As the Sigma 12-24mm is a zoom, the maximum magnification occurs at the longest focal length of 24mm. Sigma quotes a minimum focus distance of 280mm and the maximum magnification is stated as 0.17.

BTW it is very easy to test the above numbers, or derive your own reference numbers, by focusing at a suitable distance and taking an image of an object of known size, eg a ruler. Then in post you can estimate the magnification.

From the thin lens model we can easily show that x is:

Thus, using the Sigma lens quoted information for its maximum magnitude (0.17) and at its maximum focal length (24), we can calculate what the thin lens model thinks the focus distance is, which should be the minimum focus distance of 280mm.

In fact the thin lens model says we should be focused at 193mm, which clearly is not 280mm.

This flags up the first problem we have, namely the thin lens model is not universally useful over the entire focus range and becomes ‘challenged’ towards the macro end. So we need a better model, which is where the split thin lens model comes in.

In the split thin lens model we create two principal planes by splitting apart the standard thin lens model:

We can then solve for t, the split lens thickness, giving us:

Where M is the magnification at focal length (F) and minimum focus distance (X): either taken from the manufacturer’s specifications or measured yourself.

For a zoom lens we simply measure the magnification at the two focal length extremes and scale in between. For WA zoom lenses a reasonable assumption is to linearly scale.

The final part of the model is to carry out a focus distance adjustment for m, by simply using the thin lens equation, but now corrected by the split lens thickness. This magnification is 'only' used on the image side when bracketing, ie to estimate the lens to object distance.

We now have everything we need.

In the case of a zoom lens, knowing the magnification at the minimum focus distance and focal length extremes, allows us to estimate the split thin lens thickness at any focal length in between.

Once we know this, we can convert from ML sensor-2-object distances (x) to lens-2-object distances, via a simple mapping:

Where t is our lens thickness at focal length f and m is the magnification at that focal length and at focus distance x.

Final reflections: clearly the above approach is only one way of bridging the gap in our lens understanding. Without knowing the details of a lens design, we could guesstimate the relationship between the ML/Canon distances and the lens to object distances; or we could make an assumption that the ML/Canon distance is the same as the lens to object distance.

Assuming that the lens to object distance is the same as the sensor to object distance is OK when you are focusing around and beyond the hyperfocal; however, as your focus moves more towards the macro, then you shouldn’t make that assumption: at least when focus bracketing.

The split thin lens model is clearly not perfect, eg we ignore pupillary magnification; it also likely misses out on many nuances associated with optics, but it is most likely a better approach than ignoring the problem: at least when scripting.

## No comments:

## Post a Comment