Monday, October 19, 2020

DOFIS: Now for the macro shooters

If you have been following my DOFIS developments, you will be aware that DOFIS provides Magic Lantern photographers and videographers with the best available, in-camera, information, eg:

  • A lens model that matches the manufacture's or measured information, eg magnification at focus;
  • Feedback on the effective focal length, eg lens breathing;
  • Field of view as the lens changes focus;
  • Diffraction aware depth of field, either relative to the sensor or the point of focus;
  • Focus informed Infinity blur information, so you can infinity focus to a blur criterion;
  • Focus bracketing feedback for manual focus bracketing;
  • Auto focus bracketing, with or without exposure bracketing;
  • The entrance pupil location, ie the pano no-parallax relative to the sensor.

In this post I'm pleased to publish the latest version of DOFIS, which now incorporates information for the macro shooter.

As far as DOFIS is concerned, the macro model gets switched on if the magnification is greater than 0.5, but you can adjust this threshold in the DOFIS menu if you wish, eg to 0.7. Note this is an arbitrary choice, ie there is no hard line between using one DoF model or another.

Once the focus is at a point where the magnification is greater than the threshold, then DOFIS switches from using a depth of field model based on geometric optics, to one that assumes you are diffraction limited. The model I've chosen to use, without proof here,  is one based on a quarter lambda wavefront error, namely: the near and far depths of field, either side of the point of focus, are calculated from:


Where: lambda is the wavelength of interest, ie 0.55 microns here, but would change if you were shooting in the IR bands; N is the aperture at infinity, where m is 0, ie what Canon and ML report as the aperture; m is the magnification at the point of focus; and p is the pupil magnification.

Of course, just using the above does not help that much, as we also need to account for diffraction. In the non-macro zone we 'conveniently' combine the optical and diffraction blurs in quadrature; to estimate the CoC as impacted by diffraction.

The way I've handled depth of field and diffraction in the DOFIS macro model is to provide the user feedback on both the DoF and diffraction, so they can make informed decisions, eg regarding macro focus stacking.

The same diffraction model is used whether DOFIS is in the macro or non-macro zone. Namely, the diffraction blur spot is estimated to be:


Where all the variables are as above. 

Note that the (1+m/p) term is the so-called 'bellows factor' that we use to arrive at the effective aperture number, and in estimating the focus dependent FoV. This tells us why magnification is important in macro photography and not, say, in landscape photography. 

A useful thing to note is the magnification at the hyperfocal is N.C/f. Where C is the circle of confusion and f the focal length. Thus at, say, a focal length of 30mm and an aperture of f/10, with a CoC of 0.03, the magnification will be 10*0.03/30 = 0.01; which we can ignore, and thus the diffraction, if focused from near the hyperfocal to infinity, will simply be: 2.44*0.55*N.

On the other hand, if I was using my Canon 100mm macro at the closest focus, ie a magnification of 1, then the diffraction will be twice that at infinity.

The impact of the diffraction is, of course, to soften the image, ie insult the resolution that we can achieve.

Once again, without proof, I've decided to adopt a model, for the optical resolution, based on the so-called Dawes limit, and adjust that to match the 50% MTF value: see for more info, eg This then gives us a way to estimate the MTF50 lp/mm resolution, ie:


[As an aside, for those that wish to understand the MTF, have a look at ]

Let's now look at how the above runs in DOFIS.

In the above screen capture we see a new menu item called "Diff Feedback". All this does is toggle the diffraction feedback on or off, ie some users may not wish to see this additional information.

Assuming you are a macro shooter and you have switched the diffraction feedback on, you will now be looking at something like this:

Here, in the top right, we see the new diffraction information, here a green box, telling us we are not diffraction limited, based on our current camera settings, ie a 100mm (macro) lens, set to an aperture of f/6.4 and focused at 1.09m. Additionally, DOFIS is telling us that the relative near DoF is 23mm, the far DoF is 23mm, and the diffraction aware DoF is on (+). The S tells us that DOFIS is using a registered split lens model, ie it's as accurate as you can be. 

Finally, in the green box is the lp/mm that DOFIS is estimating at the MTF50 point, based on an adjusted Dawes criterion. Here it is 98 lp/mm on the sensor.

[Note we are assuming a perfect lens, which is impossible to achieve. In real life the lens 'quality' will play an important part in the overall camera-lens quaility, eg resolution achievable, in the final image. Having a great camera and poor lens, or a high quality lens on a 'poor' camera is not a photographic match made in heaven.]

As we are not yet in the macro zone,  DOFIS is telling us that we will will need about 25 focus brackets to get to the hyperfocal, ie #25 is shown.

The criterion used to define being diffraction limited is based on the camera's sensor, and is hard coded in the script by the user, ie between 2-3 sensor pixcels. On my 5D3 I have this set to 15 microns.

Let's now stop down the aperture until we see the diffraction feedback turn red:

In this case we see the diffraction feedback change to red at f/11, focused at 1.09m, thus we know that we are in the sensor defined, diffraction limited zone.

At the moment we are still not in the macro zone, ie magnification greater than 0.5, so let's reduce focus until we are just in the macro zone:

We can see we are in the macro zone as DOFIS has changed from showing a relative DoF display (R) to showing an M. We see the magnification being reported at 0.53, at a focus distance of 34cm from the sensor, and the near and far DoFs, either side of the point of focus are 1.3mm, using the quarter wave model. The lp/mm MTF50 value is estimated 38. 

By now I'm sure some are saying so what? How is all this information helping me capture macro shots?

The key thing is to not worry about the absolute numbers too much: it's a model of reality and, as we know, all models are wrong...but some are useful.

In the end, only the user will be able to 'calibrate' the worth of the DOFIS information, ie by noting the DOFIS numbers and confirming the captures are OK.

For example, in the above we see that the lp/mm (on the sensor) estimated at 38. Of course, what is acceptable will depend on how you process and present the final image, eg Facebook vs a print in a competition. 

To gauge what is an acceptable MTF50 lp/mm, it is useful to remember that people with an average/good eyesight can resolve 5 lp/mm on a print at a 'normal' viewing distance. But of course this is on the final image; we thus need to define this on the sensor. Let's assume we are using a full frame sensor, ie 36x24mm and that our final print is 360x240mm. This gives us a sensor-print enlargement of 10. Thus we should be seeking a sensor lp/mm value of no less than 50, which we had at a focus of 1.09m, ie 98 lp/mm, but when we went into the macro zone, this dropped to 38 lp/mm on the sensor.

We could, of course accept, this, take our image and see if all is OK. If it is we know that a DOFIS reported MTF50 lp/mm value of 38 is OK.

The only way we can change this value, ie increase the MTF50 resolution, is to reduce the aperture, but, of course, at the cost of the depth of field, which is already small.

This is why in the macro zone, where we will likely be diffraction limited, DOFIS provides the user information to inform their capture decisions.

As a final illustration, let's show what things look like at the maximum magnification, ie 1.0.

Here we see we are at a magnification of 1.0, ie we are at the minimum focus distance of the lens, and that, at f/11, we know we have a lot of diffraction, eg about twice that at infinity, and that our MTF50 lp/mm has dropped to 28, ie on the sensor. We also see the depth of field is still small, ie 0.6mm either side of the point of focus.

Let's say we wished to increase the depth of field by stopping the aperture down to, say, f/22:

We now have a depth of field of 2.6mm either side of the point of focus, but at the cost of the diffraction limited resolution failing to 14 lp/mm.

Whether the above is acceptable is totally down to the user and the final image presentation format.

As this as been a rather long post, and rather technical, let me now draw things to a close by saying, DOFIS now supports the macro shooter and provides information that, hopefully, will be useful in capturing macro images, especially those that require focus stacks, ie where you need to ensure you don't have 'focus gaps'.

As usual I welcome feedback on this post and DOFIS.

No comments:

Post a Comment