#### Transcript 2 nd order derivatives

Basis beeldverwerking (8D040) dr. Andrea Fuster Prof.dr. Bart ter Haar Romeny dr. Anna Vilanova Prof.dr.ir. Marcel Breeuwer Filtering Contents • Sharpening Spatial Filters • • • • • • 1st order derivatives 2nd order derivatives Laplacian Gaussian derivatives Laplacian of Gaussian (LoG) Unsharp masking 2 Sharpening spatial filters • Image derivatives (1st and 2nd order) • Define derivatives in terms of differences for the discrete domain • How to define such differences? 3 1st order derivatives • Some requirements (1st order): • Zero in areas of constant intensity • Nonzero at beginning of intensity step or ramp • Nonzero along ramps 4 1st order derivatives 5 2nd order derivatives • Requirements (2nd order) • Zero in constant areas • Nonzero at beginning and end of intensity step or ramp • Zero along ramps of constant slope 6 2nd order derivatives 7 Image Derivatives • 1st order -1 1 1 -2 • 2nd order 1 8 2nd order 1st order Zero crossing, locating edges 9 • Edges are ramp transitions in intensity • 1st order derivative gives thick edges • 2nd order derivative gives double thin edge with zeros in between • 2nd order derivatives enhance fine detail much better 10 2nd order 1st order Zero crossing, locating edges 11 Filters related to first derivatives • Recall: Prewitt filter, Sober filter (lecture 2 – 01/05) 12 Laplacian – second derivative • Enhances edges • Definition 13 Laplacian Opposite sign for second order derivative Adding diagonal derivation 14 Laplacian • Note: Laplacian filtering results in + and – pixel values • Scale for image display • So: take absolute value or positive values 15 Line Detector * (figure 10.5 book) Laplacian Positive values Laplacian 16 Image sharpening - example C=+1 or -1 x8 8-connected 4-connected Enhanced Enhanced ++ Laplacian Laplacian x5 x6 Better sharpening with 8-connected Laplacian (see figure 3.38 (d)-(e) book) 17 Filtering in frequency domain • Basic steps: − − − − − − image f(x,y) Fourier transform F(u,v) filter H(u,v) H(u,v)F(u,v) inverse Fourier transform filtered image g(x,y) 18 Laplacian in the Fourier domain • Spatial • Fourier domain 19 Blur first, take derivative later • Smoothing is a good idea to avoid enhancement of noise. Common smoothing kernel is a Gaussian. Ge x2 y 2 2 2 Scale of blurring Gaussian Derivative • Taking the derivative after blurring gives image g g D *(G f ) Ge x2 y 2 2 2 Gaussian Derivative • We can build a single kernel for both convolutions Use g the associative ( D * G) fproperty of the convolution Dx * G Dy * G x 2 y 2 e e x2 y 2 2 2 x2 y 2 2 2 Laplacian of Gaussian (LoG) LoG a.k.a. Mexican Hat 23 LoG applied to building 24 Sharpening with LoG sharpening with LoG sharpening with Laplacian 25 Unsharp Masking / Highboost Filtering • Subtraction of unsharp (smoothed) version of image from the original image. • Blur the original image • Subtract the blurred image from the original (results in image called mask) • Add the mask to the original 26 • Let denote the blurred image • Obtain the mask • Add weighted portion of mask to original image 27 • If • Unsharp masking • If • Highboost filtering (see also figure 3.40 book) input blurred unsharp mask u.m. result h.f. result 28 Unsharp masking • Simple and often used sharpening method • Poor result in the presence of noise – LoG performs better in this case 29