Depth of Field
Maps local focus across a microscopy image. A uniformly sharp frame lacks the depth-of-field falloff of a real optical capture, while two focus populations split by a sharp spatial boundary indicate a composite assembled from different focal planes.
Technical description
Estimates local focus with the variance of the Laplacian over 32 by 32 windows at a 16-pixel stride, the focus operator that comparative microscopy-autofocus studies rank as reliable, and reads three statistics from the resulting focus map. The coefficient of variation CV = s / mean measures how much focus varies across the frame; a value below 0.25 marks a uniformly sharp image with no depth of field. The bimodality coefficient BC = (g1^2 + 1) / (g2 + 3(n-1)^2 / ((n-2)(n-3))), with g1 the skewness and g2 the excess kurtosis, tests for two focus populations, with BC > 5/9 indicating bimodality. The boundary sharpness, the largest step between adjacent log-focus cells divided by the 5th-to-95th-percentile focus range, localizes whether the two populations meet at a sharp seam, and is trusted only when the range exceeds 0.5 log units.
How it works
Layer 1 (deterministic): tiles the grayscale image into 32 by 32 windows at a 16-pixel stride and takes the variance of the Laplacian in each as the local focus. A focus CV below 0.25 adds 2.0 for a uniformly sharp, depth-of-field-free frame. The bimodality coefficient flags two focus populations (BC > 5/9), and the boundary sharpness flags a sharp spatial seam (largest adjacent log-focus step over the focus range). A bimodal map with a sharp seam adds 2.0, a bimodal map without one adds 1.0, and a sharp seam alone adds 1.5. Contributions are summed and capped at 5.0.
Why this matters
Optical microscopy resolves a thin focal plane and blurs structure away from it, so a genuine single capture shows either a roughly uniform focus map (a thin, flat specimen in focus) or a smooth falloff, never an abrupt focus discontinuity. A fully synthetic micrograph rendered without optics tends to be uniformly sharp across the whole frame, and a composite assembled from different focal planes places regions of clearly different sharpness side by side, joined at a seam that smooth defocus cannot create. Reading these two signatures flags fabrication that the optics of a real instrument would forbid.
Score thresholds
- 0-1
- Focus varies smoothly across the frame, consistent with a single optical capture
- 2-3
- One anomaly: a uniformly sharp frame with no depth of field, or two focus populations without a clear seam
- 4-5
- Two focus populations joined by a sharp spatial boundary, consistent with a composite of different focal planes
Limitations
Z-stack projections and extended-depth-of-focus images intentionally combine focal planes and legitimately show uniform sharpness or multiple focus populations. Thick specimens, phase contrast, and differential interference contrast carry inherent focus effects, and a thin, fully in-focus section genuinely has little focus variation, which the uniform-sharpness cue can read as synthetic. A strong real texture edge coinciding with a focus change can inflate the boundary measure. The 32-pixel window and 16-pixel stride bound the spatial resolution, so a small inserted region is averaged with its surroundings. The thresholds are directional rather than exact.
References
- Pech-Pacheco JL, Cristóbal G, Chamorro-Martínez J, Fernández-Valdivia J. (2000). Diatom autofocusing in brightfield microscopy: a comparative study. Proceedings 15th International Conference on Pattern Recognition (ICPR-2000) 3:314-317
- Pertuz S, Puig D, Garcia MA. (2013). Analysis of focus measure operators for shape-from-focus. Pattern Recognition 46(5):1415-1432
- Hartigan JA, Hartigan PM. (1985). The Dip Test of Unimodality. The Annals of Statistics 13(1):70-84
- Pfister R, Schwarz KA, Janczyk M, Dale R, Freeman JB. (2013). Good things peak in pairs: a note on the bimodality coefficient. Frontiers in Psychology 4:700
- Bahrami K, Kot AC, Li L, Li H. (2015). Blurred Image Splicing Localization by Exposing Blur Type Inconsistency. IEEE Transactions on Information Forensics and Security 10(5):999-1009