Sunday, July 26, 2020

A Credit Card based Generalised Focus Model

Those that follow my blog know that I tend to bias my posts towards the technical side; in other words, my artistry as a photographer is still a 'work in progress'.

In particular I'm always trying to get the best out of Magic Lantern and CHDK Lua scripting.

One area I've thought about a lot is focusing and, in particular, 'landscape deep focus' photography; where the depth of field exceeds that of a single image, leading to focus bracketing.

In previous posts I have spoken about single image, landscape captures, where one will be focusing beyond the hyperfocal in order to ensure the required infinity blur and maximise the near depth of field (DoF).

If this is your objective, then focusing is pretty simple.

If, however, you wish to focus bracket, then you face the challenge of trying to calculate where to focus your next shot. For example, the following chart shows how the point of focus changes radically over the scene; compared to macro focus bracketing, where the near and far DoFs are existentially the same and very small:


However, there are a few assumptions buried in the above that begin to create problems as we creep towards the macro end, ie less, say, than H/5 or H/7.

That is, that the hyperfocal and the DoF equations are all measured from the lens front principal plane: which we don't know.

In fact things are worse than this, as we also don't know the lens design and make use of a Thin Lens model, which, away from the macro end, is 'good enough' for calculating the DoFs of a single image capture. 

However, the above lens model fails as we approach the macro end. This is easy to test with manufacturers' or measured data. That is, the maximum magnification at the minimum focus distance can not be calculated with the standard Thin Lens model.

Try it ;-)

The only distance we know for sure is that from the sensor to the object distance, for example Magic Lantern and CHDK Lua tell us this distance; or we can measure it.

As discussed in a one of my previous posts, http://photography.grayheron.net/2019/05/splitting-things-apart.html a better approach is to adopt a split lens model of the thin lens, but pragmatically assume a symmetrical design, ie ignore pupillary magnification.

We can then use the above model to estimate the lens 'thickness' (t) at any particular focal length and use this to match the true magnification, ie:


Where M is the magnification, X the (sensor to object) focus distance and F the focal length.

As an example, let's take the EOSM 11-22mm lens. The stated maximum magnification, at 22mm, is 0.3 and the minimum (sensor-2-object) focus distance is 150mm, which leads to an estimate of the lens thickness of 26mm.

Knowing the lens thickness means we can then calculate the object distance u.

Using the split lens model, and setting q = x - t, we can show that the distance from the front principal to the object, ie u, is:

This distance, of course, is now referenced to the front principal plane, as is the hyperfocal and all the DoF equations.

So all is now well with the World :-)

But what about the thickness (t) at 11mm? Or some other focal length where the manufacturer doesn't tell us the value of M. What if you don't trust the manufacturer's published data?

In order to measure the lens thickness, at any focal length, I have created a simple process based on a very accurate fiducial marker that we all carry in our pocket: namely a credit card.

The international width of a credit card is 85.6mm. The process to calculate the lens thickness of an 11-22mm zoom lens is simple and requires no images to be captured:
  • Place the credit card in front of the camera and try and get the CC parallel to the sensor.
  • Use the camera's grid, say the 3x3 grid, and position the camera so the CC's width touches the 1/3 grid points:
  • Ensure the camera can focus on the card, ie you are not less than the minimum focus distance, and measure the distance between the card and the sensor's plane, ie using the mark that is usually on the camera or estimating the sensor's position. In this case the distance was 325mm.
  • Finally the lens thickness can be estimated from the equation for t above, by noting M = W/(85.6n), where W is the sensor's width in mm, ie 22.3mm for our APS-C cropped EOSM sensor, X is the measured distance, n is 3, ie if you used the full sensor width for your measurement n would be 1, and F the focal length you are measuring for. 
At 22mm this gives us a lens thickness estimate of 25.7mm, which tallies almost exactly with the Canon-based data, ie 26mm.

If we now carry out the same procedure at 11mm, we measure an X of 205mm, giving a lens thickness of 55.3mm at this focal length.

We now have everything we need to ensure the best estimate of the distance from the lens front principal to the object, based on knowing the sensor to object distance and making a very simple measurement. Thus all the optical calculations, focus, H and the DoFs, are all based on the same zero: the split lens front principal plane.

In future posts I'll will show how the above gets used in my Lua scripts, to carry out focus bracketing.

Finally, as usual, I welcome feedback on this post.



No comments:

Post a Comment