You are on page 1of 8

Filtering in the frequency domain

Frequency based filtering

Lecture 4 ©2005 P-O Östberg, Umeå University Page 1 Lecture 4 ©2005 P-O Östberg, Umeå University Page 2

Basic frequency-based filter types Blurring and sharpening


Notch filter “Blurring” and “sharpening” are semantic inverses
A filter “with a hole (notch) in it”
Low frequency components correspond to slow changes in images
Low-pass filter High frequency components correspond to rapid changes in images
A filter that passes low frequencies and rejects high frequencies
“Blurring” in the frequency domain is achieved using lowpass filters
High-pass filter “Sharpening” in the frequency domain is achieved using highpass filters
A filter that passes high frequencies and rejects low frequencies
In the frequency domain lowpass and highpass filters are inverses
Band-pass filter Hhp(u,v) = 1 – Hlp(u,v)
A filter that passes frequencies within a specified band and rejects others

Band-reject filter
A filter that rejects frequencies within a specified band and passes others

Lecture 4 ©2005 P-O Östberg, Umeå University Page 3 Lecture 4 ©2005 P-O Östberg, Umeå University Page 4

Blurring and sharpening Filter specification distance measure

2 2
⎛ M⎞ ⎛ N⎞
D (u , v) = ⎜ u − ⎟ + ⎜ v − ⎟
⎝ 2 ⎠ ⎝ 2⎠

D(u,v) is a distance measure in the (shifted) Fourier spectrum: it is the distance


from (u,v) to the center of the frequency rectangle (the dc component)

Lecture 4 ©2005 P-O Östberg, Umeå University Page 5 Lecture 4 ©2005 P-O Östberg, Umeå University Page 6

1
Notch filters Notch filters
0 If u = 0, v = 0
H (u , v) = otherwise
1

Notch filters are useful for diagnosing image content as they eliminate the
average gray level frequencies of the image
Can also be used to suppress a localized frequency contribution
(ex. 0 if u = s ± p, v = t ± q)

Lecture 4 ©2005 P-O Östberg, Umeå University Page 7 Lecture 4 ©2005 P-O Östberg, Umeå University Page 8

Ideal lowpass filters Ideal lowpass filters

0 D(u,v) > D0
H (u , v) =
1 D(u,v) <= D0

D0 is the filters cutoff frequency


D(u,v) is a distance measure in the (shifted) Fourier spectrum
Ideal filters causes severe ringing effects

Lecture 4 ©2005 P-O Östberg, Umeå University Page 9 Lecture 4 ©2005 P-O Östberg, Umeå University Page 10

Ideal lowpass filters Ideal filters ringing effects

Ideal (frequency domain Spatial representation of


lowpass filter the same filter

Lecture 4 ©2005 P-O Östberg, Umeå University Page 11 Lecture 4 ©2005 P-O Östberg, Umeå University Page 12

2
Butterworth lowpass filters Butterworth lowpass filters

1
H (u , v) = 2n
⎡ D(u , v) ⎤
1+ ⎢ ⎥
⎣ D0 ⎦

D0 is the filters cutoff frequency


D(u,v) is a distance measure in the (shifted) Fourier spectrum
n is the order of the filter and determines the smoothness of the cutoff transition
Higher order (n > 2) Butterworth filters causes (increasing) ringing effects

Lecture 4 ©2005 P-O Östberg, Umeå University Page 13 Lecture 4 ©2005 P-O Östberg, Umeå University Page 14

Butterworth lowpass filters Butterworth lowpass filters

Lecture 4 ©2005 P-O Östberg, Umeå University Page 15 Lecture 4 ©2005 P-O Östberg, Umeå University Page 16

Gaussian lowpass filters Gaussian lowpass filters

D 2 ( u ,v )

2 D0 2
H (u, v) = e

D0 is the filters cutoff frequency (which functions as a measure of the spread of


the Gaussian curve)
D(u,v) is a distance measure in the (shifted) Fourier spectrum
Gaussian filters causes no ringing effects (the inverse Fourier transform of the
filter is also Gaussian)
Lecture 4 ©2005 P-O Östberg, Umeå University Page 17 Lecture 4 ©2005 P-O Östberg, Umeå University Page 18

3
Gaussian lowpass filters Ideal highpass filters

0 D(u,v) <= D0
H (u , v) =
1 D(u,v) > D0

D0 is a predefined nonnegative quantity corresponding to the filters cutoff


frequency
D(u,v) is a distance measure in the (shifted) Fourier spectrum
Ideal filters causes severe ringing effects

Lecture 4 ©2005 P-O Östberg, Umeå University Page 19 Lecture 4 ©2005 P-O Östberg, Umeå University Page 20

Ideal highpass filters Ideal highpass filters

Lecture 4 ©2005 P-O Östberg, Umeå University Page 21 Lecture 4 ©2005 P-O Östberg, Umeå University Page 22

Butterworth highpass filters Butterworth highpass filters

1
H (u , v ) = 2n
⎡ D0 ⎤
1+ ⎢ ⎥
⎣ D(u , v) ⎦

D0 is the filters cutoff frequency


D(u,v) is a distance measure in the (shifted) Fourier spectrum
n is the order of the filter and determines the smoothness of the cutoff transition
Higher order (n > 2) Butterworth filters causes (increasing) ringing effects

Lecture 4 ©2005 P-O Östberg, Umeå University Page 23 Lecture 4 ©2005 P-O Östberg, Umeå University Page 24

4
Butterworth highpass filters Gaussian highpass filters

D 2 ( u ,v )

2 D0 2
H (u , v) = 1 − e

D0 is the filters cutoff frequency (which functions as a measure of the spread of


the Gaussian curve)
D(u,v) is a distance measure in the (shifted) Fourier spectrum
Gaussian filters causes no ringing effects (the inverse Fourier transform of the
filter is also Gaussian)
Lecture 4 ©2005 P-O Östberg, Umeå University Page 25 Lecture 4 ©2005 P-O Östberg, Umeå University Page 26

Gaussian highpass filters Gaussian highpass filters

Lecture 4 ©2005 P-O Östberg, Umeå University Page 27 Lecture 4 ©2005 P-O Östberg, Umeå University Page 28

Highpass filters Highpass filters

Lecture 4 ©2005 P-O Östberg, Umeå University Page 29 Lecture 4 ©2005 P-O Östberg, Umeå University Page 30

5
Laplacian in the frequency domain Laplacian in the frequency domain

[ ]
ℑ ∇ 2 f ( x, y ) = −(u 2 + v 2 ) F (u, v)
⎧⎪⎡ ⎛ ⎛ 2
M⎞ ⎛ N ⎞ ⎞⎤
2 ⎫⎪
⎡⎛ M⎞ ⎛ N⎞ ⎤
2 2 g ( x, y ) = ℑ −1 ⎨⎢1 − ⎜ ⎜ u − ⎟ + ⎜ v − ⎟ ⎟⎥ F (u, v)⎬
⎜ 2 ⎠ ⎟⎠⎥⎦
H (u, v) = − ⎢⎜ u − ⎟ + ⎜ v − ⎟ ⎥ ⎪⎩⎣⎢ ⎝ ⎝ 2 ⎠ ⎝ ⎪⎭
⎢⎣⎝ 2 ⎠ ⎝ 2 ⎠ ⎥⎦

When derived from the spatial domain H(u,v) need to be shifted (as above) As in the spatial domain, image enhancement using Laplace filtering can be
performed by one (frequency domain) operation
Care must be taken to scale the filter H(u,v) to [0,1]

Lecture 4 ©2005 P-O Östberg, Umeå University Page 31 Lecture 4 ©2005 P-O Östberg, Umeå University Page 32

Unsharp masking High-boost filtering


Subtract a blurred version of the image from the image itself Generalization of unsharp masking and Laplace sharpening
Produces a sharper image For A >= 0 (A = 1 reduces to standard Laplace sharpening)

f hp ( x, y ) = f ( x, y ) − f lp ( x, y ) f hb ( x, y ) = Af ( x, y ) − f lp ( x, y ) = ( A − 1) f ( x, y ) − f hp ( x, y )

Unsharp masking can be implemented by a single frequency domain operation High-boost filtering can be expressed as a single filter kernel when using
using the composite filter Laplace for fs

H hp (u , v ) = 1 − H lp (u , v ) H hb (u , v ) = ( A − 1) + H hp (u , v )
with A>= 1

Lecture 4 ©2005 P-O Östberg, Umeå University Page 33 Lecture 4 ©2005 P-O Östberg, Umeå University Page 34

High-frequency emphasis Homomorphic filtering


Accentuates the high frequencies in an image
a & b allows parameterization of the low & high frequency contributions

H hfe (u , v ) = a + bH hp (u , v )

Reduces to high-boost filtering for a = (A – 1) & b = 1


Emphasizes high frequencies for b > 1
Separates illumination & reflectance by processing the natural logarithm of the
image in the frequency domain
Illumination mainly contributes to low frequency components (slow changes)
Reflectance mainly contribute to high frequency components (rapid changes)
The components are separated by a filter in the frequency domain and
processed individually

Lecture 4 ©2005 P-O Östberg, Umeå University Page 35 Lecture 4 ©2005 P-O Östberg, Umeå University Page 36

6
Homomorphic filtering Implementation: Periodicity

F (u , v) = F (u + M , v) = F (u , v + N ) = F (u + M , v + N )

f ( x, y ) = f ( x + M , y ) = f ( x, y + N ) = f ( x + M , y + N )

Both the forward and the inverse Fourier transforms are periodic
This periodicity is inherent from the definition of the discrete Fourier transform
pairs
Failure to account for the periodicity will result in wraparound error
Solution: pad both image & filter (with zeros) before computing the transform

Lecture 4 ©2005 P-O Östberg, Umeå University Page 37 Lecture 4 ©2005 P-O Östberg, Umeå University Page 38

Implementation: Periodicity Implementation: Padding

f ( x, y ) 0 ≤ x ≤ A −1 and 0 ≤ y ≤ B −1
f e ( x, y ) =
0 A≤ x≤ P or B≤ y≤Q
h ( x, y ) 0 ≤ x ≤ C −1 and 0 ≤ y ≤ D −1
he ( x, y ) =
0 C≤x≤P or D≤ y≤Q

P ≥ A + C −1
Q ≥ B + D −1

Lecture 4 ©2005 P-O Östberg, Umeå University Page 39 Lecture 4 ©2005 P-O Östberg, Umeå University Page 40

Implementation: Padding Implementation: Separability

It is possible to compute the 2D Fourier transform as two 1D Fourier transforms


It is also possible to compute the inverse Fourier transform using the forward
Fourier transform
Both these results lend themselves well to hardware implementation

Lecture 4 ©2005 P-O Östberg, Umeå University Page 41 Lecture 4 ©2005 P-O Östberg, Umeå University Page 42

7
The Fast Fourier Transform
The Fast Fourier Transform (FFT) is an algorithm that computes the Fourier
transform in a very efficient manner
The FFT uses successive doubling – computed values from previous iterations
are reused for the following iterations

Images are required to be of size 2m x 2n (fixed by zero-padding)

The FFT reduces the computational complexity of computing the discrete


Fourier transform from O(M2) to O(M log2M)

Lecture 4 ©2005 P-O Östberg, Umeå University Page 43

You might also like