Difference of Gaussians

From HandWiki

In imaging science, difference of Gaussians (DoG) is a feature enhancement algorithm that involves the subtraction of one Gaussian blurred version of an original image from another, less blurred version of the original. In the simple case of grayscale images, the blurred images are obtained by convolving the original grayscale images with Gaussian kernels having differing width (standard deviations). Blurring an image using a Gaussian kernel suppresses only high-frequency spatial information. Subtracting one image from the other preserves spatial information that lies between the range of frequencies that are preserved in the two blurred images. Thus, the DoG is a spatial band-pass filter that attenuates frequencies in the original grayscale image that are far from the band center.[1]

Mathematics of difference of Gaussians

Comparison of difference of Gaussian with Mexican hat wavelet

Given an n-dimensional gray-scale image [math]\displaystyle{ I:\mathbb{R}^n\rightarrow\mathbb{R} }[/math] The difference of Gaussians (DoG) of the image [math]\displaystyle{ I }[/math] is the function [math]\displaystyle{ \Gamma_{\sigma_1,\sigma_2}:\mathbb{R}^n\rightarrow\mathbb{R} }[/math] obtained by subtracting the image [math]\displaystyle{ I }[/math] convolved with the Gaussian of standard deviation [math]\displaystyle{ \sigma_2 }[/math] from the image [math]\displaystyle{ I }[/math] convolved with a Gaussian of narrower standard deviation [math]\displaystyle{ \sigma_1 \lt \sigma_2 }[/math]:

[math]\displaystyle{ \Gamma_{\sigma_1,\sigma_2} = I*G_{\sigma_1}-I*G_{\sigma_2}, }[/math]

where [math]\displaystyle{ G_{\sigma} : \mathbb{R}^n\rightarrow\mathbb{R} }[/math] is a Gaussian with standard deviation [math]\displaystyle{ \sigma }[/math]:

[math]\displaystyle{ G_{\sigma}(x) = \frac{1}{(\sigma^2 2\pi)^{n/2}} e^{-\frac{\|x\|^2}{2\sigma^2}}. }[/math]

Equivalently one can write

[math]\displaystyle{ \Gamma_{\sigma_1,\sigma_2} = I*(G_{\sigma_1}-G_{\sigma_2}) }[/math]

which represents an image convolved by the difference of two Gaussians, which approximates a Mexican hat function.

The relation between the difference of Gaussians operator and the Laplacian of the Gaussian operator (the Mexican hat wavelet) is explained in appendix A in Lindeberg (2015).[2]

Details and applications

Example before difference of Gaussians
After difference of Gaussians filtering in black and white

As a feature enhancement algorithm, the difference of Gaussians can be utilized to increase the visibility of edges and other detail present in a digital image. A wide variety of alternative edge sharpening filters operate by enhancing high frequency detail, but because random noise also has a high spatial frequency, many of these sharpening filters tend to enhance noise, which can be an undesirable artifact. The difference of Gaussians algorithm removes high frequency detail that often includes random noise, rendering this approach one of the most suitable for processing images with a high degree of noise. A major drawback to application of the algorithm is an inherent reduction in overall image contrast produced by the operation.[1]

When utilized for image enhancement, the difference of Gaussians algorithm is typically applied when the size ratio of kernel (2) to kernel (1) is 4:1 or 5:1. In the example images to the right, the sizes of the Gaussian kernels employed to smooth the sample image were 10 pixels and 5 pixels.

The algorithm can also be used to obtain an approximation of the Laplacian of Gaussian when the ratio of size 2 to size 1 is roughly equal to 1.6.[3] The Laplacian of Gaussian is useful for detecting edges that appear at various image scales or degrees of image focus. The exact values of sizes of the two kernels that are used to approximate the Laplacian of Gaussian will determine the scale of the difference image, which may appear blurry as a result.

Differences of Gaussians have also been used for blob detection in the scale-invariant feature transform. In fact, the DoG as the difference of two Multivariate normal distribution has always a total null sum and convolving it with a uniform signal generates no response. It approximates well a second derivate of Gaussian (Laplacian of Gaussian) with K~1.6 and the receptive fields of ganglion cells in the retina with K~5. It may easily be used in recursive schemes and is used as an operator in real-time algorithms for blob detection and automatic scale selection.

More information

In its operation, the difference of Gaussians algorithm is believed to mimic how neural processing in the retina of the eye extracts details from images destined for transmission to the brain.[4] [5] [6]

See also

References

  1. 1.0 1.1 "Molecular Expressions Microscopy Primer: Digital Image Processing – Difference of Gaussians Edge Enhancement Algorithm", Olympus America Inc., and Florida State University Michael W. Davidson, Mortimer Abramowitz
  2. Lindeberg, Tony (2015). "Image Matching Using Generalized Scale-Space Interest Points". Journal of Mathematical Imaging and Vision 52: 3–36. doi:10.1007/s10851-014-0541-0. https://doi.org/10.1007/s10851-014-0541-0. 
  3. D. Marr; E. Hildreth (29 February 1980). "Theory of Edge Detection". Proceedings of the Royal Society of London. Series B, Biological Sciences 207 (1167): 215–217. doi:10.1098/rspb.1980.0020. PMID 6102765. Bibcode1980RSPSB.207..187M.  — A difference of Gaussians of any scale is an approximation to the laplacian of the Gaussian (see the entry for difference of Gaussians under Blob detection). However, Marr and Hildreth recommend the ratio of 1.6 because of design considerations balancing bandwidth and sensitivity. The url for this reference may only make the first page and abstract of the article available depending on if you are connecting through an academic institution or not.
  4. C. Enroth-Cugell; J. G. Robson (1966). "The Contrast Sensitivity of Retinal Ganglion Cells of the Cat.". Journal of Physiology 187 (3): 517–23. doi:10.1113/jphysiol.1966.sp008107. PMID 16783910. 
  5. Matthew J. McMahon; Orin S. Packer; Dennis M. Dacey (April 14, 2004). "The Classical Receptive Field Surround of Primate Parasol Ganglion Cells Is Mediated Primarily by a Non-GABAergic Pathway". Journal of Neuroscience 24 (15): 3736–3745. doi:10.1523/JNEUROSCI.5252-03.2004. PMID 15084653. PMC 6729348. http://www.jneurosci.org/content/jneuro/24/15/3736.full.pdf. 
  6. Young, Richard (1987). "The Gaussian derivative model for spatial vision: I. Retinal mechanisms". Spatial Vision 2 (4): 273–293(21). doi:10.1163/156856887X00222. PMID 3154952. 

Further reading