<<

Robert Collins Robert Collins CSE486 CSE486 Today’s Topics

Laplacian of Gaussian (LoG) Filter - useful for finding edges Lecture 11: - also useful for finding blobs! LoG and DoG Filters approximation using Difference of Gaussian (DoG)

Robert Collins Robert Collins CSE486 Recall: First Filters CSE486 Second-Derivative Filters

• Sharp changes in gray level of the input • Peaks or valleys of the first-derivative of the image correspond to “peaks or valleys” of input signal, correspond to “zero-crossings” the first-derivative of the input signal. of the second-derivative of the input signal.

F(x) F ’(x) F(x) F(x) F ’(x) F’’(x)

x (1D example) x

O.Camps, PSU O.Camps, PSU

Robert Collins Robert Collins CSE486 Numerical CSE486 Example: Second Derivatives

See also T&V, Appendix A.2 2 2 Ixx=d I(x,y)/dx Taylor expansion [ 1 -2 1 ] I(x,y) 2nd Partial deriv wrt x

add 1 -2

2 2 1 Iyy=d I(x,y)/dy 2nd Partial deriv wrt y

Central difference approx 1 -2 1 to second derivative

1 Robert Collins Robert Collins CSE486 Example: Second Derivatives CSE486 Compare: 1st vs 2nd Derivatives Ixx Iyy Ixx Iyy

Ix Iy

benefit: you get clear localization of the edge, as opposed to the “smear” of high magnitude values across an edge

Robert Collins Robert Collins CSE486 Finding Zero-Crossings CSE486 Edge Detection Summary 1D 2D An alternative approx to finding edges as peaks in y

first deriv is to find zero-crossings in second deriv. F(x) I(x) I(x,y) In 1D, convolve with [1 -2 1] and look for pixels x

where response is (nearly) zero? step edge x Problem: when first deriv is zero, so is second. I.e. |∇I(x,y)| =(I 2(x,y) + I 2(x,y))1/2 > Th the filter [1 -2 1] also produces zero when convolved dI(x) > Th x y deriv dx with regions of constant intensity. tan θ = Ix(x,y)/ Iy(x,y) 1st

So, in 1D, convolve with [1 -2 1] and look for pixels 2 d I(x) = 0 2 2 ∇ I(x,y) =Ix x (x,y) + Iyy (x,y)=0 where response is nearly zero AND magnitude of deriv dx first derivative is “large enough”. Laplacian 2nd

Robert Collins Robert Collins CSE486 Laplacian CSE486 Example: Laplacian

I(x,y) Ixx + Iyy

Laplacian filter ∇2I(x,y)

2 Robert Collins Robert Collins CSE486 Example: Laplacian CSE486 Notes about the Laplacian:

Ixx Iyy • ∇2I(x,y) is a SCALAR – ↑ Can be found using a SINGLE mask – ↓ Orientation information is lost • ∇2I(x,y) is the sum of SECOND-order derivatives – But taking derivatives increases noise – Very noise sensitive! • It is always combined with a smoothing operation:

I(x,y) O(x,y) Smooth Laplacian Ixx+Iyy ∇2I(x,y)

O.Camps, PSU

Robert Collins Robert Collins CSE486 LoG Filter CSE486 1D Gaussian and Derivatives

x2 • First smooth (Gaussian filter), − 2σ 2 • Then, find zero-crossings (Laplacian filter): g(x) = e – O(x,y) = ∇2(I(x,y) * G(x,y))

x2 x2 1 − 2 x − 2 g'(x) = − 2xe 2σ = − e 2σ 2σ 2 σ 2

2 2 x Laplacian of Laplacian of Gaussian (LoG) x 1 − 2 g''(x) = ( − )e 2σ Gaussian-filtered image -filtered image σ 43 σ 2 Do you see the distinction? O.Camps, PSU O.Camps, PSU

Robert Collins Robert Collins CSE486 Second Derivative of a Gaussian CSE486 Effect of LoG Operator

Original LoG-filtered 2 2 x x 1 − 2 g''(x) = ( − )e 2σ σ 43 σ 2

2D analog

LoG “Mexican Hat” Band-Pass Filter (suppresses both high and low frequencies) Why? Easier to explain in a moment. O.Camps, PSU

3 Robert Collins Robert Collins CSE486 Zero-Crossings as an Edge Detector CSE486 Zero-Crossings as an Edge Detector Raw zero-crossings (no contrast thresholding) Raw zero-crossings (no contrast thresholding)

LoG sigma = 2, zero-crossing LoG sigma = 4, zero-crossing

Robert Collins Robert Collins CSE486 Zero-Crossings as an Edge Detector CSE486 Note: Closed Contours Raw zero-crossings (no contrast thresholding) You may have noticed that zero-crossings form closed contours. It is easy to see why…

Think of equal-elevation contours on a topo map.

Each is a closed contour. Zero-crossings are contours at elevation = 0 .

remember that in our case, the height map is of a LoG filtered LoG sigma = 8, zero-crossing image - a surface with both positive and negative “elevations”

Robert Collins Robert Collins CSE486 Other uses of LoG: CSE486 Pause to Think for a Moment: Blob Detection

How can an edge finder also be used to find blobs in an image?

Lindeberg: ``Feature detection with automatic scale selection''. International Journal of Computer Vision, vol 30, number 2, pp. 77-- 116, 1998.

4 Robert Collins Robert Collins CSE486 Example: LoG Extrema CSE486 LoG Extrema, Detail maxima

LoG maxima sigma = 2

minima

LoG sigma = 2

Robert Collins Robert Collins CSE486 LoG Blob Finding CSE486 Observe and Generalize

LoG filter extrema locates “blobs” convolve result maxima = dark blobs on light background with LoG minima = light blobs on dark background Scale of blob (size ; radius in pixels) is determined by the sigma parameter of the LoG filter.

maxima LoG sigma = 2 LoG sigma = 10

Robert Collins Robert Collins CSE486 Observe and Generalize CSE486 Observe and Generalize LoG Derivative of Gaussian LoG looks a bit like an eye.

Looks like dark blob Looks like vertical and on light background horizontal step edges

and it responds Recall: Convolution (and cross correlation) with a maximally in the filter can be viewed as comparing a little “picture” of eye region! what you want to find against all local regions in the mage.

5 Robert Collins Robert Collins CSE486 Observe and Generalize CSE486 Efficient Implementation Approximating LoG with DoG Key idea: Cross correlation with a filter can be viewed as comparing a little “picture” of what you want to find LoG can be approximate by a Difference of two against all local regions in the image. Gaussians (DoG) at different scales

Maximum response: Maximum response: dark blob on light background vertical edge; lighter on left 1D example Minimum response: Minimum response: light blob on dark background vertical edge; lighter on right

M.Hebert, CMU

Robert Collins Robert Collins CSE486 Efficient Implementation CSE486 Back to Blob Detection

LoG can be approximate by a Difference of two Gaussians (DoG) at different scales.

Separability of and cascadability of Gaussians applies to the DoG, so we can achieve efficient implementation of the LoG operator.

DoG approx also explains bandpass filtering of LoG Lindeberg: blobs are detected (think about it. Hint: Gaussian is a low-pass filter) as local extrema in space and scale, within the LoG (or DoG) scale-space volume.

Robert Collins Robert Collins CSE486 Other uses of LoG: CSE486 Other uses for LOG: Blob Detection Image Coding • Coarse layer of the Gaussian pyramid predicts the appearance of the next finer layer. • The prediction is not exact, but means that it is not necessary to store all of the next fine scale layer. • Laplacian pyramid stores the difference.

Gesture recognition for the ultimate couch potato

6 Robert Collins CSE486 Other uses for LOG: Image Coding

256x256 128x128 64x64 32x32

takes less bits to store compressed versions of these than to compress the original full-res 256x256 128x128 64x64 greyscale image

The Laplacian Pyramid as a Compact Image Code Burt, P., and Adelson, E. H., IEEE Transactions on Communication, COM-31:532-540 (1983).

7