290 likes | 447 Views
Basis beeldverwerking (8D040) d r. Andrea Fuster dr . Anna Vilanova Prof.dr.ir . Marcel Breeuwer. Filtering. Contents. Sharpening Spatial Filters 1 st order derivatives 2 nd order derivatives Laplacian Gaussian derivatives Laplacian of Gaussian ( LoG ) Unsharp masking.
E N D
Basis beeldverwerking (8D040) dr. Andrea Fusterdr. Anna VilanovaProf.dr.ir. Marcel Breeuwer Filtering
Contents • Sharpening Spatial Filters • 1st order derivatives • 2nd order derivatives • Laplacian • Gaussian derivatives • Laplacian of Gaussian (LoG) • Unsharp masking
Sharpening spatial filters Image derivatives (1st and 2nd order) Define derivatives in terms of differences for the discrete domain How to define such differences?
1st order derivatives • Some requirements (1st order): • Zero in areas of constant intensity • Nonzero at beginning of intensity step or ramp • Nonzero along ramps
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
Image Derivatives -1 1 1 -2 1 1st order 2nd order
1st order 2nd order Zero crossing, locating edges
Edges are ramp-like 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
1st order 2nd order Zero crossing, locating edges
Filters related to first derivatives Recall: Prewitt filter, Sober filter (lecture 2 – 14/05/13)
Laplacian – second derivative Enhances edges Definition
Laplacian Opposite sign for second order derivative Adding diagonal derivation
Laplacian Note: Laplacian filtering results in + and – pixel values Scale for image display - eqs. (2.6-10, 2.6-11) Or: take absolute value or positive values
Line Detector * Positive values Laplacian (figure 10.5 book) scaled Laplacian
Image sharpening - example C=+1 or -1 Enhanced + Laplacian x8 8-connected Laplacian Enhanced + Laplacian x5 Enhanced + Laplacian x6 4-connected Laplacian Better sharpening with 8-connected Laplacian (see figure 3.38 (d)-(e) book)
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)
Laplacian in the Fourier domain Spatial Fourier domain
Blur first, take derivative later • Smoothing is a good idea to avoid enhancement of noise. Common smoothing kernel is a Gaussian. Scale of blurring
Gaussian Derivative • Taking the derivative after blurring gives image g
Gaussian Derivative • We can build a single kernel for both convolutions Use the associative property of the convolution
Laplacian of Gaussian (LoG) LoG a.k.a. Mexican Hat
Sharpening with LoG sharpening with Laplacian sharpening with LoG
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
Let denote the blurred image Obtain the mask Add weighted portion of mask to original image
(see also figure 3.40 book) input blurred unsharp mask u.m. result h.f. result • If • Unsharp masking • If • Highboost filtering
Unsharp masking Simple and often used sharpening method Poor result in the presence of noise – LoG performs better in this case