tezvyn:

Laplacian of Gaussian (LoG) for Blob Detection

AI-drafted, machine-checkedSource: Wikipedia: Laplacian of Gaussianadvanced

LoG finds blobs by blurring an image then finding points of maximum curvature, like finding the top of a hill by looking where the slope changes fastest. It's used in medical imaging and astronomy. The footgun: the blur size dictates the blob size you can.

WHY IT EXISTS In computer vision, we often need to find features that are not sharp corners or lines, but rather smooth regions, or 'blobs'. Simple edge detectors fail at this. We need a method that is robust to image noise and can reliably identify these regions, like finding cells in a microscope image or stars in the sky.

THE MENTAL MODEL Think of your image as a 3D landscape where pixel intensity is height. A bright blob is a hill. LoG is a two-step process to find the peaks of these hills. First, you blur the landscape with a Gaussian filter, like a light rain smoothing out tiny rocks, leaving only the main hills. Second, you use the Laplacian operator to find where the curvature is highest—right at the top of each hill. The result highlights the centers of blobs.

HOW IT WORKS LoG combines two operations: a Gaussian blur and the Laplacian operator. The Gaussian blur smooths the image, removing noise and small details. The Laplacian operator is a second-order derivative that measures the 'peakedness' or curvature of the image intensity. Applying it to the blurred image finds areas that are the peak of a blob. In practice, these two steps are combined into a single filter, often called a 'Mexican hat' or 'sombrero' kernel, which you convolve with the image. The locations where the output image crosses zero correspond to the edges of the blobs, and the local extrema (peaks and valleys) mark their centers.

WHEN TO USE IT Use LoG when you need to detect blobs of a roughly known size in a noisy image. It's excellent for tasks like counting circular objects (e.g., cells, particles), finding stars in astronomical photos, or as a general-purpose feature detector. Because it's a second-derivative operator, it is very good at finding the exact center of a blob.

WHEN NOT TO USE IT Do not use LoG if you need to find blobs of many different sizes at once, as a single LoG filter is tuned to a specific scale (blob size). You would need to run it multiple times with different parameters. It is also computationally more expensive than its popular approximation, the Difference of Gaussians (DoG). If performance is critical, DoG is often a better choice.

ONE CANONICAL EXAMPLE To count red blood cells in a micrograph, you first choose a Gaussian 'sigma' (the blur amount) that corresponds to the average radius of a cell. You then convolve the image with the resulting LoG kernel. The output image will show strong responses (e.g., dark spots if cells are bright) at the center of each cell. By finding these local extrema and applying a threshold, you can get an accurate count and location for each cell.

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.