Robert Collins CSE486
Lecture 11: LoG and DoG Filters Robert Collins CSE486 Today’s Topics
Laplacian of Gaussian (LoG) Filter - useful for finding edges - also useful for finding blobs!
approximation using Difference of Gaussian (DoG) Robert Collins CSE486 Recall: First Derivative Filters
• Sharp changes in gray level of the input image correspond to “peaks or valleys” of the first-derivative of the input signal.
F(x) F ’’(x)
x (1D example)
O.Camps, PSU Robert Collins CSE486 Second-Derivative Filters
• Peaks or valleys of the first-derivative of the input signal, correspond to “zero-crossings” of the second-derivative of the input signal.
F(x) F(x) F ’’(x) F’’’’(x)
x
O.Camps, PSU Robert Collins CSE486 Numerical Derivatives See also T&V, Appendix A.2 Taylor Series expansion
add
Central difference approx 1 -2 1 to second derivative Robert Collins CSE486 Example: Second Derivatives
2 2 Ixx=d I(x,y)/dx [ 1 -2 1 ] I(x,y) 2nd Partial deriv wrt x
1 -2
2 2 1 Iyy=d I(x,y)/dy 2nd Partial deriv wrt y Robert Collins CSE486 Example: Second Derivatives Ixx Iyy
benefit: you get clear localization of the edge, as opposed to the “smear” of high gradient magnitude values across an edge Robert Collins CSE486 Compare: 1st vs 2nd Derivatives Ixx Iyy
Ix Iy Robert Collins CSE486 Finding Zero-Crossings
An alternative approx to finding edges as peaks in first deriv is to find zero-crossings in second deriv. In 1D, convolve with [1 -2 1] and look for pixels where response is (nearly) zero? Problem: when first deriv is zero, so is second. I.e. the filter [1 -2 1] also produces zero when convolved with regions of constant intensity.
So, in 1D, convolve with [1 -2 1] and look for pixels where response is nearly zero AND magnitude of first derivative is “large enough”. Robert Collins CSE486 Edge Detection Summary 1D 2D y
F(x) I(x) I(x,y) I(x,y) x
step edge x
|∇I(x,y)| =(I 2(x,y) + I 2(x,y))1/2 > Th dI(x) > Th x y deriv dx tan θ = Ix(x,y)/ Iy(x,y) 1st
d2I(x) = 0 ∇2I(x,y) =I (x,y) + I (x,y)=0 2 ∇ I(x,y) =Ix x (x,y) + Iyy (x,y)=0 deriv dx
Laplacian 2nd Robert Collins CSE486 Finite Difference Laplacian
Laplacian filter ∇2I(x,y) Robert Collins CSE486 Example: Laplacian
I(x,y) Ixx + Iyy Robert Collins CSE486 Example: Laplacian Ixx Iyy
Ixx+Iyy ∇2I(x,y) Robert Collins CSE486 Notes about the Laplacian:
• ∇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
O.Camps, PSU Robert Collins CSE486 LoG Filter
• First smooth (Gaussian filter), • Then, find zero-crossings (Laplacian filter): – O(x,y) = ∇2(I(x,y) * G(x,y))
Laplacian of Laplacian of Gaussian (LoG) Gaussian-filtered image -filtered image Do you see the distinction? O.Camps, PSU Robert Collins CSE486 1D Gaussian and Derivatives
x2 − g(x) = e 2σ 2
x2 x2 1 − 2 x − 2 g'(x) = − 2xe 2σ = − e 2σ 2σ 2 σ 2
2 2 x x 1 − 2 g''(x) = ( − )e 2σ σ 43 σ 2
O.Camps, PSU Robert Collins CSE486 Second Derivative of a Gaussian
2 2 x x 1 − 2 g''(x) = ( − )e 2σ σ 43 σ 2
2D analog
LoG “Mexican Hat”
O.Camps, PSU Robert Collins CSE486 Effect of LoG Operator
Original LoG-filtered
Band-Pass Filter (suppresses both high and low frequencies) Why? Easier to explain in a moment. Robert Collins CSE486 Zero-Crossings as an Edge Detector Raw zero-crossings (no contrast thresholding)
LoG sigma = 2, zero-crossing Robert Collins CSE486 Zero-Crossings as an Edge Detector Raw zero-crossings (no contrast thresholding)
LoG sigma = 4,