Examples of Filters
Frequency domain
Gaussian lowpass filter Gaussian highpass filter Spatial domain
1 Ideal Low Pass Filtering
Low pass filter: Keep frequencies below a certain frequency Low pass filtering causes blurring After DFT, DC components and low frequency components are towards center May specify frequency cutoff as circle c Ideal Low Pass Filtering
Multiply Image Fourier Transform F by some filter matrix m Shape of ILPF
Frequency domain
h(x,y) Spatial domain
4 Ideal low-pass filter (ILPF)
1 D(u,v) D0 H(u,v) 0 D(u,v) D0 D( u , v ) [( u M / 2)2 ( v N / 2) 2 ] 1/ 2
(M/2,N/2): center in frequency domain
D0 is called the cutoff frequency.
5 Ideal Low Pass Filtering
Low pass filtered image is inverse Fourier Transform of product of F and m
Example: Consider the following image and its DFT
Image DFT Ideal Low Pass Filtering
Applying Image after low pass filter inversion to DFT Cutoff D = 15
low pass filter low pass filter Cutoff D = 5 Cutoff D = 30
Note: Sharp filter Cutoff causes ringing FT
ringing and Ideal in frequency blurring domain means non-ideal in spatial domain, vice versa.
8 9 10 Butterworth Lowpass Filters (BLPF)
• Smooth transfer function, 1 no sharp discontinuity, H (u,v) 2n D(u,v) no clear cutoff 1 D frequency. 0
1 2
11 Butterworth Lowpass Filters (BLPF)
n=1 n=2 n=5 n=20 h(x)
1 H (u,v) 2n D(u,v) 1 D0 12 No serious ringing artifacts
13 Top: Original image. Bottom: Image filtered with 5th order Butterworth lowpass filter. Gaussian Lowpass Filters (GLPF) • Smooth transfer function, D2 (u,v) smooth impulse 2 response, no ringing H(u,v) e 2D 0
15 GLPF
Frequency domain
Gaussian lowpass filter Spatial domain
16 No ringing artifacts
17 18 19 Examples of Lowpass Filtering
20 Examples of Lowpass Filtering
Low-pass filter H(u,v)
Original image and its FT Filtered image and its FT
21 Ideal High Pass Filtering
Opposite of low pass filtering: eliminate center (low frequency values), keeping others High pass filtering causes image sharpening If we use circle as cutoff again, size affects results Large cutoff = More information removed
DFT of Image after Resulting image high pass Filtering after inverse DFT High-pass Filters
• Hhp(u,v)=1-Hlp(u,v)
1 D(u,v) D0 • Ideal: H(u,v) 0 D(u,v) D0
2 1 • Butterworth: | H (u,v) | 2n D0 1 D(u,v)
D2 (u,v)/2D2 • Gaussian: H(u,v) 1e 0
23 Ideal High Pass Filtering: Effect of Cutoffs
Low cutoff High pass filtering frequency removes of DFT with filter Only few lowest Cutoff D = 5 frequencies
High cutoff High pass filtering frequency removes of DFT with filter many frequencies, Cutoff D = 30 leaving only edges
Highpass Filtering Example
result Highpass
g
filtering
Processin
e
Imag
l
Original image
Digita
, ,
oods
W
&
z
After
equalisation histogram
Gonzale
m
frequency
fro
n
take
High
s
emphasis result
Image (2002) 26 High-pass Filters
h(x,y)
27 Ideal High-pass Filtering ringing artifacts
28 29 30 Butterworth Filtering
Sharp cutoff leads to ringing To avoid ringing, can use circle with more gentle cutoff slope Butterworth filters have more gentle cutoff slopes Ideal low pass filter
Butterworth low pass n = 2 n = 4 filter
n called order of the filter, controls sharpness of cutoff Butterworth High Pass Filtering
Ideal high pass filter
Butterworth n = 2 n = 4 hig h pass filter Low Pass Butterworth Filtering
Low pass filtering removes high frequencies, blurs image Gentler cutoff eliminates ringing artifact
DFT of Image after low Resulting image pass Butterworth filtering after inverse DFT High Pass Butterworth Filtering
DFT of Image after high Resulting image pass Butterworth filtering after inverse DFT Butterworth High-pass Filtering
35
• It is possible increase the sharpness of an image by boosting the power in the edges, which means boosting the power in the high frequencies. • This is easily done through a linear combination of the original image with the image resulting from a highpass filter.
Top: Original image. Bottom: Image filtered with 3rd order Butterworth sharpening filter, normalized frequency .5, Gp = 1.1, Gs = .8 Gaussian High-pass Filtering
Original image Gaussian filter H(u,v)
Filtered image and its FT
38 Gaussian High-pass Filtering
39 40 41 42 43 5.4 Periodic Noise Reduction by Frequency Domain Filtering • Periodic noise is due to the electrical or electromechanical interference during image acquisition. • Can be estimated through the inspection of the Fourier spectrum of the image. 5.4 Periodic Noise Reduction by Frequency Domain Filtering • Bandreject filters – Remove or attenuate a band of frequencies.
1 if D(u,v) D0 W / 2 H (u,v) 0 if D0 W / 2 D(u,v) D0 W / 2 1 if D(u,v) D0 W / 2
• D0 is the radius. • D(u, v) is the distance from the origin, and • W is the width of the frequency band. Bandpass filter
• Obtained form bandreject filter
Hbp(u,v)=1-Hbr(u,v) • The goal of the bandpass filter is to isolate the noise pattern from the original image, which can help simplify the analysis of noise, reasonably independent of image content. Bandreject Filters Periodic Noise Reduction by Frequency Domain Filtering 2D Fourier Transform Examples: Scaling Stretching image => Spectrum contracts And vice versa 2D Fourier Transform Examples: Periodic Patterns
Repetitive periodic patterns appear as distinct peaks at corresponding positions in spectrum
Enlarging image ( c) causes Spectrum to contract (f) 2D Fourier Transform Examples: Oriented, elongated Structures
Man‐made elongated regular patterns in image => appear dominant in spectrum 2D Fourier Transform Examples: Natural Images
Repetitions in natural scenes => less dominant than man‐ made ones, less obvious in spectra 2D Fourier Transform Examples: Natural Images
Natural scenes with repetitive patterns but no dominant orientation => do not stand out in spectra 2D Fourier Transform Examples: Printed Patterns
Regular diagonal patterns caused by printing => Clearly visible/removable in frequency spectrum. Let’s Look at Some Real Images!
In this image you have a bunch of cells that are all the This image for example looks ordered but I couldn’t same size but there is no order to their arrangement. tell you exactly what that order is. There are enough of them that they are pretty tightly packed in some regions.
After taking a FT of the image it is very apparent This is reflected in the FT image because there is a what sort of order it has and one can determine all circle which represents the average distance they the distances between nearest neighbors just by are from each other but it also shows that there is taking the reciprocal of the distances between a no preferred long range order. dot and the center of the image.
The power of FT is that it allows you to take a seemingly complicated image which has an apparent order that is difficult to determine see and break it up into its component sine waves.
Fourier Transform Images are from: http://www.cs.unm.edu/~brayer/vision/fourier.html 5.4.3 Notch filters • Notch filter rejects (passes) frequencies in predefined neighborhoods about a center frequency.
0 if D1(u,v) D0 or D2 (u,v) D0 H(u,v) 1 otherwise
where 2 2 1/ 2 D1(u,v) (u M / 2u0 ) (v N / 2v0 )
2 2 1/ 2 D2 (u,v) (u M / 2u0 ) (v N / 2 v0 ) 5.4.3 Notch filters • Butterworth notch filter 1 H (u,v) 2 n D0 1 D1(u,v)D2 (u,v) • Gaussian notch filter
1 D (u,v)D (u,v) 1 2 2 2 H (u,v) 1 e D0
• Note that these notch filters will
become highpass when u0=v0=0 Notch filters Example 5.8
Use 1-D Notch pass filter to find the horizontal ripple noise Laplacian in Frequency Domain 2 f (x, y) 2 f (x, y) [ ] (u2 v2)F (u,v) x2 y2
2 2 H1(u,v) (u v )
Frequency Spatial domain 2 2 domain 2 f f f 2 2 Laplacian operator x y
60 61 Subtract Laplacian from the Original Image to Enhance It
enhanced Original Laplacian image image output
Spatial g(x, y) f (x, y) 2 f (x, y) domain
Frequency 2 2 G(u,v) F (u,v) (u v )F (u,v) domain new operator 2 2 H 2(u,v) 1 (u v ) 1 H 1(u,v)
Laplacian
62 f 2 f
f 2 f
63 64 Unsharp Masking, High-boost Filtering
• Unsharp masking: fhp(x,y)=f(x,y)- flp(x,y) One more • H (u,v)=1-H (u,v) parameter to adjust hp lp the enhancement
• High-boost filtering:
fhb(x,y)=Af(x,y)-flp(x,y)
• fhb(x,y)=(A-1)f(x,y)+fhp(x,y)
65• Hhb(u,v)=(A-1)+Hhp(u,v) 66
68
• Wiener filtering incorporates both the degradation function and statistical characteristics of noise into the restoration process • Images and noise are considered as random variables • The objective is to find an estimate ƒ such that the mean square error between them is minimized. • It is assumed that the noise and image are uncorrelated Wiener filtering
• In signal processing, the Wiener filter is a filter proposed by Norbert Wiener during the 1940s and published in 1949.
• Its purpose is to reduce the amount of noise present in a signal by comparison with an estimation of the desired noiseless signal.
• The discrete-time equivalent of Wiener's work was derived independently by Kolmogorov and published in 1941.
• Hence the theory is often called the Wiener-Kolmogorov filtering theory.
• A Wiener filter is not an adaptive filter because the theory behind this filter assumes that the inputs are stationary
An ideal version of the cover of the Joshua Tree album by U2. The same photograph, with some blurring due to All examples used are 256x256 pixels. motion and noise due to poor development
Reconstructed photograph, e.g. f estimate, Random gaussian noise (multiplied here by a through Wiener filtering factor of 100) added into the blurred version of the photo Handling Spectrum Nulls Via High-Freq Cut-off
Limit the restoration to lower frequency components to avoid amplifying noise at spectrum nulls
Wiener Filtering vs. Inverse Filtering
Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 5)
Optimal Edge Detection: Canny
• Assume: – Linear filtering – Additive iid Gaussian noise • Edge detector should have: – Good Detection. Filter responds to edge, not noise. – Good Localization: detected edge near true edge. – Single Response: one per edge. Optimal Edge Detection: Canny (continued)
• Optimal Detector is approximately Derivative of Gaussian. • Detection/Localization trade-off – More smoothing improves detection – And hurts localization. • This is what you might guess from (detect change) + (remove noise) Effect of (Gaussian kernel size)
original Canny with Canny with
The choice of depends on desired behavior • large detects large scale edges • small detects fine features
The Canny edge detector
• original image (Lena) The Canny edge detector
norm of the gradient The Canny edge detector
thresholding The Canny edge detector
thinning (non-maximum suppression) Input image I, value of smoothing parameter sigma, high threshold Th and low threshold Tl.
Non Maxima Suppressed Original Image Edge Map output
Th = 80 Tl = 30 Sigma = 1
Example images and contours used to gather ON-edge and OFF-edge statistics.
Zhou C , Mel B W J Vis 2008;8:4
©2008 by Association for Research in Vision and Ophthalmology
The End