Difference of Gaussians: Finding Edges by Subtracting Blurs
Difference of Gaussians (DoG) finds features by subtracting a heavily blurred image from a lightly blurred one, isolating details at a specific scale. It's used for fast blob and edge detection.
WHY IT EXISTS Computer vision systems need to identify interesting features like edges and blobs to understand an image. A major challenge is doing this efficiently and at different scales. We need a method to isolate features of a particular size, filtering out both fine-grained noise and large, uniform regions.
THE MENTAL MODEL Think of DoG as finding what's "in focus" at a specific level of detail. You take an image and create two blurred copies: one is slightly blurry, and the other is very blurry. When you subtract the very blurry image from the slightly blurry one, the large, smooth areas and the finest noise cancel out. What remains are the mid-sized details—the edges and blobs that were present in the first blur but erased by the second.
HOW IT WORKS The algorithm works by convolving the original image with two different Gaussian kernels. A Gaussian kernel is a function that blurs an image, and its width (standard deviation, or sigma) controls the amount of blur. One kernel has a smaller sigma for less blur, and the other has a larger sigma for more blur. This produces two blurred images. The final step is to subtract the more-blurred image from the less-blurred one. The resulting image is a band-pass filtered version of the original, highlighting spatial information between the two blur levels.
WHEN TO USE IT Use DoG for feature and blob detection when computational speed is a priority. It's a cornerstone of the Scale-Invariant Feature Transform (SIFT) algorithm for finding stable keypoints. It serves as a fast and effective approximation of the more computationally expensive Laplacian of Gaussian (LoG) operator, which is also used for blob detection.
WHEN NOT TO USE IT DoG is an approximation, not a perfect band-pass filter. If you require high mathematical precision for frequency filtering, DoG may not be suitable. If computational cost is not a constraint, using the Laplacian of Gaussian operator directly might yield slightly more accurate blob detection. The effectiveness of DoG is highly dependent on the two sigma values you choose.
ONE CANONICAL EXAMPLE Imagine a grayscale photo of a person. To find the edges of their facial features, you could apply DoG. Create one version with a light blur and a second with a heavy blur. Subtracting the second from the first would make the smooth skin of the cheeks and forehead disappear (turn to gray/black), while the lines defining the eyes, nose, and mouth would stand out as bright or dark contours.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.