Saturday, August 20, 2022

QDFS: The best focus script for a Canon M3...probably ;-)

I'm pleased to announce that my Quasi Depth of Field Scale (QDFS) script is now fully operational, but is restricted to run on the Canon M3 only. The script can be download from the right.

QDFS was written as a focus and exposure bracketing tool for manual deep focus photogrpahy. It is not a macro focus bracketing tool.

QDFS now has exposure bracketing integrated into its workflow. Exposure bracketing can be achieved in the following ways:

  • With the Canon three exposure based AEB; note if set, the Canon AEB will override the CHDK exposure settings
  • With a QDFS zero-noise bracketing, ie an additional exposure for the shadows, from an ETTR base exposure: with a Tv or ISO value. Typically, a 4Ev value issued, but any value from 1 to 6 Ev can be used 
  • Wind bracketing, where the exposure remains the same, but ISO and/or aperture or shutter speed are adjusted. Wind bracketing can be achieved if you are in AV, Tv or P mode.

The QDFS UI has been tweaked and is now based on a 'dark theme'.

QDFS requires the lens to be registered in the script, eg:

if lens_name() == "EF-M11-22mm f/4-5.6 IS STM" then -- calculate lens thickness from manufacturer's data
        f1 = 11
        f2 = 22
        m1 =,100)
        m2 =,10)
        return true
    elseif lens_name() == "EF-M28mm f/3.5 MACRO IS STM" then
        f1 = 28
        f2 = 28
        m1 =,1)
        m2 =,1)
        return true
    elseif lens_name() == "EF-M55-200mm f/4.5-6.3 IS STM" then
        return false

Here we see that the 11-22mm zoom lens has its focal length extremes registered, and the magnification at those extremes. In the above the magnification at 22mm is 0.3 and 0.13 at 11mm. Magnification can be easily measured or taken from the manufacrururer's datasheet.

Prime lenses are registered in a similar fashion.

The menu now looks like this:

Here we see you can: set the CoC, ie the defocus blur for focus bracketing, 15 microns in this case; select the zero-noise exposure bracketing logic, ie Tv or ISO; the bracket offset, ie 1 to 5 Ev, or with Canon selected, you can bracket using the Canon three AEB functionality; select a delay in seconds, 3s is shown above; and select if you wish to see the console or not, which shows a single line of additional information.

Once running, you can cycle through the various Canon screens by pressing the INFO button, where, for instance, you can change the Canon AEB values. Pressing the MENU button will switch the depth of field bar off, ie during composing.

With CHDK switched on and the QDFS script selected, QDFS is run by pressing the  Canon shutter, when you will see the following screen:

Here we see QDFS telling us it is calibrating, ie working out the lens throw from the minimum focus distance to the 'extended infinity', ie with many lenses you can focus beyond the 'optical infinity'.

Once running the QDFS UI looks like this (note the screen HDMI captures aren’t fully representative of what you see on the M3 screen or EVF):

Here we see that the console option has been switched on, showing the lens count, the Canon lower and upper focus reporting (from the sensor plane) and the focus distance from the front principlal, in terms of the hyperfocal distance.

As mentioned above the lens counter linearly maps to the lens focus ring rotation. In the above we see that the maximum lens rotation occurs at 613 counts, and that we are currently focused at 0, ie we are at the minimum focus distance. The depth of field bar is only showing the far depth of field, ie the near depth of field is less than the minimum focus distance.

We also see on the right a 'data window' that changes according to where we are focused. If we are focused less than H/3, as above, QDFS will provide you an estimate of the number of focus brackets required to cover from the current focus to the hyperfocal.

In the next image we see how the data window changes when we are focused beyond the hyperfocal, ie when we are infinity focusing. Now we see an estimate of the defocus blur at infinity, in this case about 3 microns. We also see in the console area, that QDFS is reporing we are focused at 4x the hyperfocal.

We also see that we are focused at 521 of the 613 potential counts. If we now continue 'focusing', ie rotating the lens, we will soon go 'beyond infinity', which in this case means we have gone beyond the data, ie the Canon reported distances are no longer changing. The UI will now look like this:

The data window now expands and shows additional information: what CoC has been set in microns; the minimum focus distance (mm) from the front principal; the hyperfocal distance from the front principal (mm); and the number of focus brackets required to cover from the minimum focus to the hyperfocal. In the above example the focus is at the maximum rotation of the lens, ie 613 counts.

As an aside, knowing the MFD reported by Canon, ie 150mm in this case, and the QDFS MFD, 95mm in this case, gives us an estimate of the position of the front principal from the sensor plane, ie 150-95 = 55mm.

When an image is taken, QDFS captures the focus position of the last bracket, ie the current bracket until you refocus, and shows you are at the same focus position by turning the depth of field (lower) bar yellow:

If we move focus, the depth of field bar will change colour to indicate if there is a focus gap or not:

To illustrate the  value of QDFS, here is a handheld test image, although there was a bit of wind, that I took at f/8. I set bracketing to ISO +4Ev, focused on the nearest flowers of interest and focus stacked at two locations using QDFS.

I hope the above has been clear and that the lucky owners of a Canon M3, running CHDK, see the value of the QDFS script.

As usual I welcome any feedback on this post or any of my posts.

No comments:

Post a Comment