filtering
DESCRIPTION
Basis beeldverwerking (8D040) d r. Andrea Fuster Prof.dr . Bart ter Haar Romeny dr. Anna Vilanova Prof.dr.ir . Marcel Breeuwer. Filtering. Contents. Sharpening Spatial Filters 1 st order derivatives 2 nd order derivatives Laplacian Gaussian derivatives - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/1.jpg)
Basis beeldverwerking (8D040)
dr. Andrea FusterProf.dr. Bart ter Haar Romenydr. Anna VilanovaProf.dr.ir. Marcel Breeuwer
Filtering
![Page 2: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/2.jpg)
Contents
• Sharpening Spatial Filters• 1st order derivatives• 2nd order derivatives• Laplacian • Gaussian derivatives• Laplacian of Gaussian (LoG)• Unsharp masking
2
![Page 3: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/3.jpg)
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
![Page 4: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/4.jpg)
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
![Page 5: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/5.jpg)
1st order derivatives
5
![Page 6: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/6.jpg)
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
![Page 7: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/7.jpg)
2nd order derivatives
7
![Page 8: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/8.jpg)
Image Derivatives
• 1st order
• 2nd order
8
1-1
1 1-2
![Page 9: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/9.jpg)
9
1st order2nd order
Zero crossing, locating edges
![Page 10: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/10.jpg)
• 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
![Page 11: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/11.jpg)
11
2nd order
Zero crossing, locating edges
1st order
![Page 12: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/12.jpg)
Filters related to first derivatives
• Recall: Prewitt filter, Sober filter (lecture 2 – 01/05)
12
![Page 13: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/13.jpg)
Laplacian – second derivative
• Enhances edges• Definition
13
![Page 14: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/14.jpg)
Laplacian
14
Adding diagonal derivationOpposite sign for second order derivative
![Page 15: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/15.jpg)
Laplacian
• Note: Laplacian filtering results in + and – pixel values
• Scale for image display • So: take absolute value or positive values
15
![Page 16: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/16.jpg)
Line Detector
16
*
Laplacian Positive values Laplacian(figure
10.5 book)
![Page 17: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/17.jpg)
Image sharpening - example
17
4-connected Laplacian8-connected LaplacianEnhanced + Laplacian x5Enhanced + Laplacian x6Enhanced + Laplacian x8Better sharpening with 8-connected Laplacian(see figure 3.38 (d)-(e) book)
C=+1 or -1
![Page 18: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/18.jpg)
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
![Page 19: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/19.jpg)
Laplacian in the Fourier domain
• Spatial
• Fourier domain
19
![Page 20: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/20.jpg)
Blur first, take derivative later
• Smoothing is a good idea to avoid enhancement of noise. Common smoothing kernel is a Gaussian.
2 2
22x y
G e
Scale of blurring
![Page 21: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/21.jpg)
Gaussian Derivative
• Taking the derivative after blurring gives image g
*( )g D G f
2 2
22x y
G e
![Page 22: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/22.jpg)
Gaussian Derivative
• We can build a single kernel for both convolutions
( * )g D G f 2 2
222*
x y
xxD G e
2 2
222*
x y
yyD G e
Use the associative property of the convolution
![Page 23: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/23.jpg)
Laplacian of Gaussian (LoG)
23
LoG a.k.a. Mexican Hat
![Page 24: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/24.jpg)
LoG applied to building
24
![Page 25: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/25.jpg)
Sharpening with LoG
25sharpening with LoG sharpening
with Laplacian
![Page 26: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/26.jpg)
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
![Page 27: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/27.jpg)
• Let denote the blurred image• Obtain the mask
• Add weighted portion of mask to original image
27
![Page 28: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/28.jpg)
• If• Unsharp masking
• If• Highboost filtering
28
input blurred unsharp mask u.m. result h.f. result
(see also figure 3.40 book)
![Page 29: Filtering](https://reader035.vdocuments.us/reader035/viewer/2022062813/56816460550346895dd63b52/html5/thumbnails/29.jpg)
Unsharp masking
• Simple and often used sharpening method• Poor result in the presence of noise – LoG performs
better in this case
29