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|
|Effective aperture||F-number at sensor|
|Sensor width (pixels)||pixels|
|CoC width (pixels)||pixels|
|CoC width (mm)||mm|
|DOF (wave optics)||mm|
|Step overlap||fraction of DOF|
|Step size (suggested)||mm|
The cells are:
- Sensor width (mm) – physical dimension of your camera's sensor
- Subject width (mm) – field width at the subject, or can be calculated as sensor width divided by magnification
- Magnification – calculated as sensor width divided by subject width, or can be filled in directly
- Lens aperture – specified as one of the following numbers
- lens F-number – nominal setting for F-number, not corrected for magnification
- effective F-number – effective F-number, typically = lens F-number * (magnification+1), but set directly by some camera systems such as modern Nikons
- NA – numerical aperture on the object side. This number is typically printed on the side of microscope objectives.
- Pupil ratio – exit pupil diameter divided by entrance pupil diameter, defaults to 1
- Effective aperture – working F-number at the sensor, typically calculated from numbers appearing earlier
- Sensor width (pixels) – number of pixels across the entire sensor
- Pixel width – typically calculated as sensor width in mm divided by sensor width in pixels
- CoC width (pixels) – number of pixels spanned by the circle of confusion, typically no more than 3 for sharpest images
- CoC width (mm) – can be specified directly, or calculated as pixel width * CoC width in pixels. The classic value is about 1/1200 of sensor width, so 0.030 mm for fullframe or 0.020 mm for APS-C
Note: CoC is how you specify how much blur you're willing to tolerate. If you want the sharpest possible images, then leave CoC blank and just specify the sharpest aperture for your lens.
- DOF (classic) – depth of field calculated in the classic way from magnification, aperture setting, and CoC width
- DOF (wave optics) – diffraction-limited depth of field, calculated from effective effective and magnification
- Step overlap – fraction of DOF per each step, 0 = no overlap, 1=complete overlap
- Step size (suggested) – maximum of DOF (classic) and DOF (wave optics), adjusted by the step overlap
- [comment field] – compares the classic DOF and wave optics DOF, recommends changes to aperture if appropriate
The calculator is typically used in one of the following ways:
- 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.
- 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.
- 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.
- 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.