During the 2020 pestilence I've directed most of my scripting efforts to getting the CHDK auto focus bracketing scripts working on my family (S95, G7X, G5X and G1X) of Point & Shoot cameras.
The advantage of using CHDK Lua scripting on a P&S camera is that one is able to access the focus distance 'from the lens', rather than from the sensor plane. Whilst this distance may not be calibrated, it is a reasonable estimate of the front principal plane, from which all optical calculations, eg the hyperfocal distance, are assumed to be made.
In Magic Lantern world, that is using larger, interchangeable lens cameras, things are a little more complicated, as ML Lua 'only' gives you access to the focus distance from the sensor plane.
For non-macro, eg landscape, photography we can 'get away' with using a simple thin lens model, but as soon as you wish to focus close to the focus minimum, the thin lens assumptions become compromised.
This is why I have been playing around with a split thin lens model for focus bracketing in deep focus photography: http://photography.grayheron.net/2020/07/a-credit-card-based-generalised-focus.html
In this post I'm introducing the latest (beta release) version of my Depth Of Field Information (DOFI) script. Specifically written for WA and normal focal length lenses, ie not macro or telephoto.
This particular version has been optimised for Magic Lantern use and uses a pragmatic approach to realise a split thin lens, zoom model; only based on knowing (through the manufacturer's published data or your own measurements) the minimum focus distance (MFD) and the maximum magnification (M) at the MFD.
As a reminder, the split lens model may be visualised as below, where t is the lens thickness at a given focal length.
To keep things pragmatic, the following assumptions are made:
- The lens is assumed symmetric, ie we are ignoring pupil magnification;
- In the case of a zoom lens, the maximum magnification occurs at the longest focal length
- That the MFD remains the same at the widest end as the longest end
As before, we can make use of the following to calculate the lens thickness, t:
Where M is the maximum magnification; X is the MFD; and F is the focal length at M.
We also need an estimate of the maximum magnification (at the MFD) as the lens zooms in length, which we can do by accepting that the MFD remains constant over the zoom and is linear: a reasonable and pragmatic assumption. Thus at the longest length of the zoom (capital letters, ie F & M) and the widest (f & m), the MFD remains the same; giving:
Solving for m we arrive at the following for the maximum magnification at any focal length:
In general the magnification at any distance is:Where u is the focus distance from the front principal. Solving for m, we arrive at the following estimate for the magnification in terms of the focus distance from the sensor plane and substituting (x-t) = w:This allows us to estimate the magnification at x, given the lens thickness, t, and the focal length, f.
Which gives us an estimate for the maximum magnification at any focal length and at any point of focus from the sensor plane. Which in turn gives us the focus extension and finally the position of the front principal in our split lens model from the sensor plane:
We now have everything we need to create a zoom, split thin lens version for DOFI, which I'm calling DOFIS, which you can download from the right.
DOFIS functions the same as DOFI, ie it shows: the optical, diffraction and total blurs; how many focus brackets are needed between where you are focused and the hyperfocal; and whether you have a focus overlap or gap with the previous image, ie by colour change. This post is worth a read in order to understand the basics behind DOFI: https://www.magiclantern.fm/forum/index.php?topic=24762.msg224057#msg224057
For example, in the following screen capture, we see DOFIS is telling us that there are 4 images to focus bracket from the current focus position (45cm) to the hyperfocal. It also shows that the infinity blur at the current focus is 170 microns, that the diffraction blur is 10 microns and the total blur at infinity is 171 microns.
The DOFIS menu looks like this:
On/Off simply toggles the DOFIS LV display on and off.
Lens Model ON or OFF toggles between a simple thin lens model (OFF) and the split lens model (ON).
If the Lens Model is ON, four additional menu items appear. The first allows you to enter the maximum magnification of your lens, ie usually at the longest focal length of a zoom. Adjust the input until the required magnification is shown, ie 0.169 (for 0.17 on my Sigma 12-24).
FL@MaxMag allows you to specify the focal length of the lens at the maximum magnification. In this case 24mm.
MFD@MaxMag allows you to enter the minimum focus distance at the maximum magnification. In this case 280mm from the sensor plane. It also shows the lens thickness on the right.
Toggling through the Additional Info submenu will display the Lens Thickness (LT), the Lens Extension (LE), ie the focus extension relative to infinity focus, the position of the Front Principal (FP) relative to the sensor plane (as shown above) and the Magnification. When viewing these data you can change focus and focal length and see the data update.
All the above may be extracted from the manufacturer's data sheets or you can measure these numbers yourself, eg: http://photography.grayheron.net/2020/07/a-credit-card-based-generalised-focus.html
DOFIS flashes a warning at camera start up, to go to the DOFIS menu to confirm the lens model you are using. You only need to do this once at camera start up.
As a deep focus test of using DOFIS, I used my Sigma 12-24mm, on my 5D3, at a focal length of 24mm.
As DOFIS uses the ML CoC as the overlap blur criterion, I set this to a 'standard FF' 29 microns in this test. The aperture was set at F/10.
I focused on the nearest object, which was near the MFD of the lens and used DOFIS to create a perfect focus bracket set of 9 images, ie near to an infinity blur that DOFIS showed.
The images were ingested into Lightroom, synced with some minor tonal adjustments, exported on a round trip to Helicon Focus for focus stacking, and (colour/tone) finished in LR.
Bottom line: I believe DOFIS represents the 'best' way to achieve deep focus photography, as long as your lens reports focus distance etc.
As usual I welcome feedback and suggestions to improve DOFIS.