Scale space & DoG

A detector with a fixed window finds a structure only at one size. Blur the image at growing σ\sigma, subtract neighboring blur levels, and look for points that stand out in position and in scale: each keypoint gets its own size. Click anywhere to see how the response of that point changes with σ\sigma.

Image and keypoints maxima minima rejected
Response over scale at the selected point D(σ)D(\sigma) −(k−1) σ2∇2L-(k - 1)\,\sigma^2 \nabla^2 L
Gaussian images LiL_i
DoG images Di=Li−Li+1D_i = L_i - L_{i+1}

Finding the right patch size

To match a keypoint between two images, a descriptor ff has to see the same patch in both. If one image shows the scene larger, the patch has to be larger by the same factor: we look for sizes σ\sigma and σ′\sigma' with

f(I(x,σ))=f(I′(x′,σ′))f\big(I(x, \sigma)\big) = f\big(I'(x', \sigma')\big)

Each image has to be processed independently, so the size can't be negotiated between them. Instead, every point picks the scale at which a response function has an extremum. When the image is scaled by ss, that extremum moves to sσs\sigma, and the patch grows with it. This is what the Harris detector with its fixed window lacks.

Laplacian of Gaussian

A good response function is the Laplacian, the second derivative, of the Gaussian-blurred image L=Gσ∗IL = G_\sigma * I. As a filter, the Laplacian of Gaussian is a blob detector: a bright blob gives a strong negative response, a dark blob a positive one, and it is strongest when the blob fills the center of the kernel. For a disk of radius rr this happens at σ=r/2\sigma = r / \sqrt{2}, which is why the circles in the image have the radius 2 σ\sqrt{2}\,\sigma. The second derivative shrinks with σ2\sigma^2 as the image gets smoother, so it is multiplied by σ2\sigma^2 to compare scales fairly:

σ2∇2L=σ2(∂2L∂x2+∂2L∂y2)\sigma^2 \nabla^2 L = \sigma^2 \left( \frac{\partial^2 L}{\partial x^2} + \frac{\partial^2 L}{\partial y^2} \right)

Keypoints are the local extrema of this function in position–scale space (x,y,σ)(x, y, \sigma).

Difference of Gaussians

The Difference of Gaussians approximates the LoG with blurring and subtraction only:

  1. Blur the image with a Gaussian of σ\sigma.
  2. Blur the image with a Gaussian of kσk\sigma.
  3. Subtract 2 from 1: D(σ)=Gσ∗I−Gkσ∗ID(\sigma) = G_\sigma * I - G_{k\sigma} * I.

Since the blurred image changes with σ\sigma as ∂L/∂σ=σ∇2L\partial L / \partial \sigma = \sigma \nabla^2 L, the difference is

D(σ)≈−(k−1) σ2∇2LD(\sigma) \approx -(k - 1)\, \sigma^2 \nabla^2 L

It is scale-normalized by itself, and the constant factor k−1k - 1 doesn't move the extrema. With this sign, bright blobs are maxima and dark blobs minima; many texts subtract the other way round, which swaps the two but finds the same points. The approximation is a finite difference over [σ,kσ][\sigma, k\sigma], so in the plot DD runs slightly ahead of the LoG curve.

Octaves

The scale space is built with ss intervals per octave, k=21/sk = 2^{1/s}, and s+3s + 3 Gaussian images σ0,kσ0,…,ks+2σ0\sigma_0, k\sigma_0, \dots, k^{s+2}\sigma_0. Each image is blurred from the previous one, since a Gaussian convolved with a Gaussian is another Gaussian: σi2=σi−12+σΔ2\sigma_{i}^2 = \sigma_{i-1}^2 + \sigma_\Delta^2. Once σ\sigma has doubled, the image carries no detail that half as many pixels couldn't hold, so the next octave starts from LsL_s with every other pixel dropped: the blur protects it from aliasing. Every octave takes a quarter of the work of the one before. Neighboring DoG images give s+2s + 2 differences per octave; extrema are searched in the ss middle ones, which have a neighbor above and below. Each pixel is compared with its 26 neighbors: 8 in its own image and 9 each in the images above and below.

Refining and filtering the extrema

Try this