page_title: Difference of Gaussians
section_title: Details and applications
hierarchical_section_title: Difference of Gaussians / Details and applications
caption_attribution_description: English: Flowers before Difference of Gaussians filter application
context_page_description: In imaging science, difference of Gaussians 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. 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.
context_section_description: 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.
  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. 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.
caption: Example before difference of Gaussians
exif: {"Image ImageDescription": "", "Image Make": "SONY", "Image Model": "DSC-W7", "Image Orientation": "Horizontal (normal)", "Image XResolution": "72", "Image YResolution": "72", "Image ResolutionUnit": "Pixels/Inch", "Image DateTime": "2008:06:09 03:43:55", "Image YCbCrPositioning": "Co-sited", "Image ExifOffset": "256", "Image PrintIM": "[80, 114, 105, 110, 116, 73, 77, 0, 48, 51, 48, 48, 0, 0, 2, 0, 2, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0]", "Thumbnail Compression": "JPEG (old-style)", "Thumbnail Make": "SONY", "Thumbnail Model": "DSC-W7", "Thumbnail Orientation": "Horizontal (normal)", "Thumbnail XResolution": "72", "Thumbnail YResolution": "72", "Thumbnail ResolutionUnit": "Pixels/Inch", "Thumbnail JPEGInterchangeFormat": "2452", "Thumbnail JPEGInterchangeFormatLength": "9675", "EXIF ExposureTime": "1/400", "EXIF FNumber": "14/5", "EXIF ExposureProgram": "Program Creative", "EXIF ISOSpeedRatings": "100", "EXIF ExifVersion": "0220", "EXIF DateTimeOriginal": "2006:09:10 14:02:54", "EXIF DateTimeDigitized": "2006:09:10 14:02:54", "EXIF ComponentsConfiguration": "YCbCr", "EXIF CompressedBitsPerPixel": "8", "EXIF ExposureBiasValue": "3/10", "EXIF MaxApertureValue": "3", "EXIF MeteringMode": "Spot", "EXIF LightSource": "Unknown", "EXIF Flash": "Flash fired, compulsory flash mode, return light detected", "EXIF FocalLength": "79/10", "EXIF FlashPixVersion": "0100", "EXIF ColorSpace": "sRGB", "EXIF ExifImageWidth": "800", "EXIF ExifImageLength": "755", "Interoperability InteroperabilityIndex": "R98", "Interoperability InteroperabilityVersion": "[48, 49, 48, 48]", "EXIF InteroperabilityOffset": "2278", "EXIF FileSource": "Digital Camera", "EXIF SceneType": "Directly Photographed", "EXIF CustomRendered": "Normal", "EXIF ExposureMode": "Manual Exposure", "EXIF WhiteBalance": "Auto", "EXIF SceneCaptureType": "Standard", "EXIF Contrast": "Normal", "EXIF Saturation": "Normal", "EXIF Sharpness": "Normal"}