DOF Calculator

Zerene Stacker includes a unique macro/micro depth-of-field calculator that combines both diffraction blur and classic circle-of-confusion.

Following is an interactive browser based version of the calculator:

Sensor width (mm) mm
Subject width (mm) mm
Magnification
Lens aperture
Pupil ratio
Effective aperture F-number at sensor
Sensor width (pixels) pixels
Pixel Width mm
CoC width (pixels) pixels
CoC width (mm) mm
DOF (classic) mm
DOF (wave optics) mm
Step overlap fraction of DOF
Step size (suggested) mm


   

The cells are:

The calculator is typically used in one of the following ways:

  1. Specify magnification and lens aperture, and use the calculated wave optics DOF as step size.
    This simple method will avoid focus-banding, no matter how good your camera's sensor is, or how far you zoom in to actual pixels.

  2. Specify magnification, lens aperture, and CoC width (mm), and use the recommended step size.
    This method will calculate DOF two ways (classic and wave optics), and compare the results.

  3. Specify magnification, lens aperture, sensor size and pixel count, and CoC width (pixels), and use the recommended step size.
    This method will calculate DOF two ways, with a more meaningful CoC, and compare the results.

  4. Specify numerical aperture of a microscope objective, and use the calculated wave optics DOF as step size.
    This will calculate wave optics DOF, and compare with classic DOF if magnification and sensor specs are available.


Inside Zerene Stacker, the calculator looks like this:

Here are some examples:

Magnification = 1, nominal lens aperture f/16 giving effective f/32, calculates diffraction limited wave optics DOF = 2.253 mm. (This reproduces an entry in Table 2-A at https://zerenesystems.com/cms/stacker/docs/tables/macromicrodof .)

Same as previous, but adding CoC width = 0.030 mm (classic for fullframe format), calculates also classic DOF = 1.92 mm and reports that “Aperture is near optimum” because the wave optics and classic DOF values are similar.

Same as previous, adding sensor specifications for Nikon Z7, changing the lens setting to “Effective F-number” 32 because that's the way modern Nikons work, and specifying CoC = 3 pixels so as to be sharp when pixel-peeping, calculates CoC = 0.01304 mm and classic DOF = 0.83456 mm, and reports that “Aperture is limited by diffraction, consider a wider aperture”.

Same as previous, but opening lens aperture to effective f/11, calculates classic DOF = 0.28688, wave optics DOF = 0.26606, and now reports “Aperture is near optimum”. (This reproduces an entry in bold font in Table 2-B at https://zerenesystems.com/cms/stacker/docs/tables/macromicrodof .)

Same as previous, but reducing magnification to 0.05 at lens aperture f/4, calculates classic DOF = 41.728 and wave optics DOF = 14.08, and notes that “Resolution is limited by sensor, consider a narrower aperture”.

Nikon Z7 sensor specs, but using a microscope objective at 20X NA 0.42, calculates effective aperture 23.81, classic DOF = 0.0015524, wave optics DOF = 0.0029737, and notes that “Resolution is limited by diffraction, consider a wider aperture”.

No sensor specs, just NA 0.25 (typical for an inexpensive 10X microscope objective), calculates wave optics DOF = 0.0086603. (This reproduces an entry in table 2-C at https://zerenesystems.com/cms/stacker/docs/tables/macromicrodof .)

The theory behind this calculator is discussed and developed incrementally at https://www.photomacrography.net/forum/viewtopic.php?t=19756 . (Note that the discussion extends over 3 long pages.) Supporting documentation is provided in https://www.photomacrography.net/forum/viewtopic.php?t=23751 and the associated materials.

Very briefly, the wave optics calculation is done by using the diffraction limited criterion of 1/4-lambda wavefront error. That allows the MTF curve to sag a little bit at worst defocus, but does not change the cutoff frequency. The classic calculation uses standard geometric optics, starting with a specified diameter for the allowed circle of confusion (CoC). The calculator then recommends the larger of the two resulting DOF values, on the rationale that if you specified an acceptable CoC then you must be willing to accept at least that much blur, and if the specified aperture allows a larger step size due to diffraction, then you should use that larger value.

The two calculations end up producing almost the same number when CoC = 0.0011 * effective F-number. Through no coincidence at all, 0.0011 * effective F-number also corresponds to the size of the Airy disk at that aperture. In other words, the wave optics calculation is “just like” running the classic calculation, with a CoC that is automatically matched to the size of the diffraction blur.