Algorithm Search⌘K

Techniqueadvanced

Automatic scale selection

Also called Lindeberg scale selection, scale-normalized derivatives.

Pick the scale of a feature at the extremum over scale of a derivative normalized by a power of the scale, so that the chosen scale follows the size of the structure.

Automatic scale selection picks, for each feature of an image, the scale t=σ2t = \sigma^2 at which a normalized derivative of the scale space has a local extremum over scale. Plain derivatives of a smoothed image fall as the scale grows, so their maximum is always at the finest scale. Lindeberg multiplied each derivative of order mm by tmγ/2t^{m\gamma/2}. With this factor, a structure that is ss times larger has its extremum at a scale s2s^2 times larger, so the selected scale follows the size of the structure. The DoG detector, the determinant of Hessian detector, the Harris-Laplace detector and the scale step of SIFT and SURF all use this rule.

In plain words

To measure how big a spot in an image is, look at it through a range of blurs, from weak to strong. A weak blur leaves the spot sharp but small compared to the blur window; a very strong blur washes it out. In between there is one blur that fits the spot best, and there a well chosen response is at its peak. Scale selection computes the response for each blur and keeps the blur where it peaks. The response must be corrected for the blur first, because blur alone makes every response smaller. With the right correction, a spot twice as large peaks at a blur twice as wide, so the chosen size grows with the spot.

When it applies

The setting is the scale space L(x,t)=gt∗fL(\mathbf x, t) = g_t \ast f of an image, where gtg_t is the Gaussian of variance tt. A γ\gamma-normalized derivative of order mm is

∂ξmL=tmγ/2 ∂xmL,that is∂ξ=tγ/2∂x.\partial_{\xi}^{m} L = t^{m\gamma/2} \, \partial_x^{m} L, \qquad \text{that is} \quad \partial_\xi = t^{\gamma/2} \partial_x .

Scale selection applies when the feature is measured by a differential expression DD that is homogeneous: each term is a product of derivatives with the same total order MM. Examples are the Laplacian ∇2L\nabla^2 L (M=2M = 2), the determinant of the Hessian LxxLyy−Lxy2L_{xx} L_{yy} - L_{xy}^2 (M=4M = 4), the gradient magnitude (M=1M = 1) and the Harris measure (M=4M = 4). The normalized measure is tMγ/2Dt^{M\gamma/2} D.

Why it works. Let f′(x)=f(sx)f'(\mathbf x) = f(s\mathbf x) be a copy of ff made smaller by the factor ss. Its scale space is L′(x,t)=L(sx,s2t)L'(\mathbf x, t) = L(s\mathbf x, s^2 t), and each derivative of order mm gets the factor sms^m. So

tMγ/2D′(x,t)=sM(1−γ) (s2t)Mγ/2D(sx,s2t).t^{M\gamma/2} D'(\mathbf x, t) = s^{M(1 - \gamma)} \, (s^2 t)^{M\gamma/2} D(s\mathbf x, s^2 t).

The factor sM(1−γ)s^{M(1-\gamma)} does not depend on tt. So a local extremum over scale at (x0,t0)(\mathbf x_0, t_0) for ff is a local extremum at (x0/s,t0/s2)(\mathbf x_0 / s, t_0 / s^2) for f′f', for every γ\gamma. With γ=1\gamma = 1 the values at the two extrema are also equal, which lets a detector compare the strength of features of different sizes with one threshold.

It does not apply to structures with no size of their own. An ideal step edge or the corner of an infinite wedge looks the same at every magnification, so with γ=1\gamma = 1 its normalized response is constant over scale and there is no extremum.

The template

  1. SELECT-SCALES(f, x, D, M, γ, t_1 < t_2 < ... < t_K)
  2. 1for k ← 1 to K do
  3. 2L_k ← g_{t_k} * f ▷ the scale-space level t_k
  4. 3R_k ← t_k^{M γ / 2} · D(L_k)(x) ▷ the normalized measure at x
  5. 4S ← empty list
  6. 5for k ← 2 to K - 1 do
  7. 6if |R_k| > |R_{k-1}| and |R_k| > |R_{k+1}| then
  8. 7append t_k to S ▷ a characteristic scale of x
  9. 8return S

A detector runs the same test over position and scale at once: it keeps the points where ∣R∣\lvert R \rvert is larger than at all 26 neighbours in the stack of levels, or it finds points in space at each level first and then tests them over scale, as Harris-Laplace does. The levels are usually spaced by a constant factor in σ\sigma, such as 21/32^{1/3}, and a parabola through the three values around the extremum refines the scale.

Classic examples

  • A Gaussian blob and the Laplacian. For f(x)=exp⁡(−∣x∣2/(2t0))f(\mathbf x) = \exp(-\lvert\mathbf x\rvert^2/(2t_0)) the scale space at the center is L=t0/(t0+t)L = t_0/(t_0 + t) and ∇2L=−2t0/(t0+t)2\nabla^2 L = -2t_0/(t_0+t)^2. With γ=1\gamma = 1,
t ∣∇2L∣=2tt0(t0+t)2,t \, \lvert\nabla^2 L\rvert = \frac{2 t t_0}{(t_0 + t)^2},

whose derivative in tt is zero at t=t0t = t_0. The selected scale is the variance of the blob, and the value there is 1/21/2 for every t0t_0.

  • A Gaussian blob and the determinant of the Hessian. At the center Lxx=Lyy=−t0/(t0+t)2L_{xx} = L_{yy} = -t_0/(t_0 + t)^2 and Lxy=0L_{xy} = 0, so t2det⁡H=t02t2/(t0+t)4t^2 \det H = t_0^2 t^2 / (t_0 + t)^4. Its maximum is again at t=t0t = t_0, with the value 1/161/16.
  • An elongated blob. For a blob with the variances aa and bb along its two axes, t2det⁡Ht^2 \det H at the center is t2ab/((a+t)2(b+t)2)t^2 ab / ((a + t)^2 (b + t)^2), which is largest at t=abt = \sqrt{ab}. The normalized Laplacian picks a different scale. For a=1a = 1 and b=4b = 4 the determinant picks t=2t = 2 and the Laplacian t≈1.75t \approx 1.75; for a=1a = 1 and b=9b = 9 they pick t=3t = 3 and t≈2.08t \approx 2.08.
  • A difference of Gaussians. The DoG between the scales tt and k2tk^2 t is close to (k2−1) t∇2L/2(k^2 - 1) \, t \nabla^2 L / 2, a normalized Laplacian times a constant. For the Gaussian blob, the DoG at the center is t0/(t0+t)−t0/(t0+k2t)t_0/(t_0 + t) - t_0/(t_0 + k^2 t), which is largest at t=t0/kt = t_0 / k, where the geometric mean ktk t of the two variances is t0t_0. For t0=4t_0 = 4 and k=21/3k = 2^{1/3} the peak is at t=3.175t = 3.175.
  • A sine wave. For f(x)=sin⁡(ω0x)f(x) = \sin(\omega_0 x) the derivative of order mm has the amplitude ω0me−ω02t/2\omega_0^m e^{-\omega_0^2 t / 2} in scale space. The normalized amplitude tmγ/2ω0me−ω02t/2t^{m\gamma/2} \omega_0^m e^{-\omega_0^2 t/2} is largest at t=mγ/ω02t = m\gamma / \omega_0^2. The selected σ\sigma is proportional to the wavelength 2π/ω02\pi/\omega_0; for ω0=0.5\omega_0 = 0.5 and γ=1\gamma = 1 it is t=4t = 4 for m=1m = 1 and t=8t = 8 for m=2m = 2.
  • A blurred edge. A step edge smoothed with variance t0t_0 has the gradient 1/2π(t0+t)1/\sqrt{2\pi(t_0 + t)} at the edge in scale space. With γ=1\gamma = 1 the normalized gradient grows with tt and has no maximum. With γ=1/2\gamma = 1/2 it is t1/4/2π(t0+t)t^{1/4}/\sqrt{2\pi(t_0 + t)}, which is largest at t=t0t = t_0: the selected scale is the width of the edge. This is why γ=1/2\gamma = 1/2 is the usual choice for edges and γ=1\gamma = 1 for blobs.

Variations

  • The choice of measure. The Laplacian and the DoG respond to blobs and also along edges; the determinant of the Hessian responds less along edges. Mikolajczyk and Schmid compared several measures for the selection of the characteristic scale and kept the Laplacian for Harris-Laplace.
  • Extrema in position and scale together. SIFT and SURF look for extrema of one measure in the three dimensions (x,y,t)(x, y, t). Harris-Laplace uses one measure in space (the Harris measure) and another over scale (the Laplacian).
  • Affine shape. Harris-affine selects a scale and then adapts an elliptic window, because a single scale cannot fit an elongated structure.
  • Pyramids. Instead of smoothing the full image at every level, a Gaussian pyramid halves the image size at each octave, and the scale of a level is computed from its octave and its index.
  • Other values of γ\gamma. γ\gamma trades how the selected scale depends on the shape of the structure; values below 11 are used for edges and ridges.

Pitfalls

  • The selected scale is proportional to the size, not equal to it. The constant depends on the measure and on the dimension. In 1D, t∣Lxx∣t \lvert L_{xx} \rvert of a Gaussian of variance t0t_0 is tt0/(t0+t)3/2t \sqrt{t_0}/(t_0 + t)^{3/2} at the center, which is largest at t=2t0t = 2t_0, not at t0t_0. On the pixel grid, with the discrete Gaussian kernel, a second difference and t0=4t_0 = 4, the peak is also at t=8t = 8.
  • Scale sampling. With levels spaced by a factor kk in σ\sigma, the true extremum can fall between two levels, and a structure near the first or the last level has no extremum because it has no neighbour on one side. Use a parabola over scale and extend the range by one level on each side.
  • Small scales on the pixel grid. For tt below about 11 the sampled Gaussian smooths less than it should, and derivatives by finite differences are biased. Features at the finest levels are less reliable. A sharp corner or a step edge has no scale of its own, so on the grid its extremum is often at the finest level the detector allows.
  • Many scales at one place. Nested structures, such as a dark spot inside a bright disk, give several extrema over scale at one point. Keep all local extrema, not only the largest one.
  • Neighbouring structures. At coarse scales two nearby blobs merge into one, and the selected scale of each is then pulled by the other.
  • Border effects. At large scales the smoothing kernel reaches past the image border, and the measure near the border depends on the border rule.

Exercises

  1. In DD dimensions, a Gaussian blob of variance t0t_0 has ∇2L=−Dt0D/2/(t0+t)D/2+1\nabla^2 L = -D t_0^{D/2}/(t_0 + t)^{D/2 + 1} at the center. Show that t ∣∇2L∣t\,\lvert\nabla^2 L\rvert is largest at t=2t0/Dt = 2t_0/D, and check the cases D=1D = 1 and D=2D = 2 against the examples on this page.
  2. Repeat the elongated blob example for the normalized Laplacian and show that the maximum solves a polynomial equation in tt. Check the value t≈1.75t \approx 1.75 for a=1a = 1 and b=4b = 4.
  3. Show that the normalized gradient with γ=1\gamma = 1 of an ideal step edge is 1/2π1/\sqrt{2\pi} at every scale.
  4. For the sine wave, find γ\gamma such that the selected σ\sigma for m=2m = 2 is equal to 1/ω01/\omega_0.
  5. Show that the DoG between tt and k2tk^2 t of the Gaussian blob is largest at t=t0/kt = t_0/k.

References

  1. Tony Lindeberg, Feature detection with automatic scale selection, International Journal of Computer Vision 30(2), 79-116, 1998, the sections on gamma-normalized derivatives, the scale invariance of their extrema, and blob detection with the Laplacian and the determinant of the Hessian
  2. Tony Lindeberg, Scale-Space Theory in Computer Vision, Kluwer Academic Publishers, 1994, the chapter on scale selection and blob detection over scale
  3. Krystian Mikolajczyk and Cordelia Schmid, Scale and affine invariant interest point detectors, International Journal of Computer Vision 60(1), 63-86, 2004, Section 2 (the characteristic scale and the comparison of the measures used to select it)
  4. David G. Lowe, Distinctive image features from scale-invariant keypoints, International Journal of Computer Vision 60(2), 91-110, 2004, Section 3 (the DoG as an approximation of the scale-normalized Laplacian)
  5. Tinne Tuytelaars and Krystian Mikolajczyk, Local invariant feature detectors, a survey, Foundations and Trends in Computer Graphics and Vision 3(3), 177-280, 2008, the part on scale invariant detectors

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW3 standard
  • five exercises