Tuesday, August 23, 2022

Fine Tuning QDFS

In this short post I'll say a few words on how to 'fine tune' the Canon M3 depth of field scale script, so that the Canon and QDFS reporting of focus distance, from the sensor, is better matched.

To be clear, we're not seeking perfection, afterall the QDFS is 'just' a simple thin lens model of an optically complex lens.

The 'trick' to fine tuning is to simply adjust the minimum focus magnitude, at the two extremes if the lens is a zoom, untill the Canon reporting and QDFS reporting come into closer alignment at a reference distance.

You can only achieve this after downloading the latest version of QDFS, as this now contains the option to display the number of brackets to the hyperfocal, as before; or an estimate of the focus distance from the sensor (lens extension is ignored in this model as it is small relative to the focus distances we are interested in):

As we can see, the focus option under Display has been selected, thus whenever focus is less than the hyperfocal, QDFS will display the focus distance in mm: noting this is an estimate of the distance from the sensor, using the QDFS model, ie not the Canon reporting, which is shown in the bottom console window.

With the above setup, the screen will look something like this at start up:


Here we see that QDFS is reporting (top right) that we are positioned at 150mm from the sensor, which Canon reporting is confirming in the console. Note that Canon lower (L) and upper (U) reporting reflects the granuality of the Canon data. That is Canon is telling us we are focused somewhere between the L and U values (reported in cm, but converted to mm in QDFS). If you focus towards infinity, say, these will change when the new lower value equals the old upper value.

Note: it seems strange that Canon tracks the lens rotation in very fine steps, eg on the 11-22mm lens the resolution is over 600 steps. But the distance reporting resolution is much lower than this.

To fine tune all we need to do is set the lens to each zoom extreme in turn (assuming it is a zoom) and position the focus at a reasonable distance, ie around, say, H/3. Then adjust the focus until the Canon lower distance just changes, eg (note the screen below shows the tuned state at 11mm, ie with the tweaked magnification):

In the above we see that the QDFS focus distance is stated as 631mm and the Canon lower value (which just changed) is 630mm. To achieve that, at the 11mm focal length, I needed to adjust the magnification to 0.17. Repeating the exercise at 22mm resulted in a magnification tweak to 0.32:

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 = fmath.new(17,100) -- adjust the magnitudes as required, ie to fine tune Canon and QDFS focus distance reporting
        m2 = fmath.new(32,100)
        return true

If you have an 11-22mm lens, the above is an irrelevance, as the tuned model is built into QDFS. However, if you wish to refine things or add a new lens, the above explans how to tweak the measured or manufacturer’s magnification to achieve a better (but not perfect) alignment between the Canon and QDFS focus distance reporting. It may appear a messy process, but you only need do it once.

Finally, here's a short video showing the focus reporting in action. Note that focus reporting is only shown up to the hyperfocal (red line). Beyond the hyperfocal QDFS reports an estimate of the infinity defocus blur, in microns (as before); which is a more useful piece of data for setting the infinity focus:

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


No comments:

Post a Comment