0% found this document useful (0 votes)
6 views

Filtering in the Frequency Domain

The document discusses filtering techniques in the frequency domain, emphasizing the relationship between frequency components and image intensity changes. It outlines the steps for filtering, including obtaining the Fourier transform, applying filter functions, and computing the inverse transform to process images. Various types of filters, such as lowpass, highpass, and selective filters, are described along with their applications in image smoothing and sharpening.

Uploaded by

Fatma Newagy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Filtering in the Frequency Domain

The document discusses filtering techniques in the frequency domain, emphasizing the relationship between frequency components and image intensity changes. It outlines the steps for filtering, including obtaining the Fourier transform, applying filter functions, and computing the inverse transform to process images. Various types of filters, such as lowpass, highpass, and selective filters, are described along with their applications in image smoothing and sharpening.

Uploaded by

Fatma Newagy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

ECE359 SIGNAL PROCESSING FOR

MULTIMEDIA
FILTERING IN THE FREQUENCY DOMAIN

Prof. Fatma Newagy


Prof. of Communications Engineering
[email protected]
The Basic Filtering in the Frequency Domain

➢ Frequency is directly related to spatial rates of change


➢ The slowest varying frequency component is proportional to the
average intensity of an image
➢ Low frequencies correspond to the slowly varying intensity
components of an image
➢ The higher frequencies correspond to faster and faster intensity
changes in the image

Filtering techniques in the frequency domain are based on modifying the


Fourier transform to achieve a specific objective and then computing the
inverse DFT to get us back to the image domain
The Basic Filtering in the Frequency Domain
The Basic Filtering in the Frequency Domain

► Modifying the Fourier transform of an image


► Computing the inverse transform to obtain the processed
result
g ( x, y ) = −1{H (u, v) F (u, v)}

F (u , v) is the DFT of the input image


H (u, v) is a filter function.
The Basic Filtering in the Frequency Domain
► In a filter H(u,v) that is 0 at the center of the transform
and 1 elsewhere, what’s the output image?

This filter would reject the dc term and “pass” (i.e., leave unchanged) all other terms.
Note that the dc term is responsible for the average intensity of an image, so setting it to
zero will reduce the average intensity of the output image to zero. Figure 4.30 shows the
image became much darker.
The Basic Filtering in the Frequency Domain
The Basic Filtering in the Frequency Domain

Note:
At (b) the blurring is not
uniform; the top white
edge is blurred, but the
side white edges are not.
Zero-Phase-Shift Filters
−1
g ( x, y) =  {H (u, v) F (u, v)}
F (u, v) = R(u, v) + jI (u, v)
g ( x, y) = −1
 H (u, v)R(u, v) + jH (u, v)I (u, v)
Filters affect the real and imaginary parts equally,
and thus no effect on the phase.
These filters are called zero-phase-shift filters
Examples: Nonzero-Phase-Shift Filters

Even small
Phasechanges
angle is in the phase angle can ishave
Phase angle
dramaticmultiplied
(usually by undesirable) effects on the
multiplied by filtered
output 0.5 0.25
Summary:
Steps for Filtering in the Frequency Domain
1. Given an input image f(x,y) of size MxN, obtain the
padding parameters P and Q. Typically, P = 2M and Q = 2N.

2. Form a padded image, fp(x,y) of size PxQ by


appending the necessary number of zeros to f(x,y)

3. Multiply fp(x,y) by (-1)x+y to center its transform

4. Compute the DFT, F(u,v) of the image from step 3

5. Generate a real, symmetric filter function*, H(u,v), of


size PxQ with center at coordinates (P/2, Q/2)
*generate from a given spatial filter, we pad the spatial filter, multiply the expadded
array by (-1)x+y, and compute the DFT of the result to obtain a centered H(u,v).
Summary:
Steps for Filtering in the Frequency Domain
6. Form the product G(u,v) = H(u,v)F(u,v) using array
multiplication

7. Obtain the processed image

 
g p ( x, y) = real −1 G(u, v) (−1) x + y

8. Obtain the final processed result, g(x,y), by extracting


the MxN region from the top, left quadrant of gp(x,y)
An Example:
Steps for Filtering in the Frequency Domain
Correspondence Between Filtering in the Spatial
and Frequency Domains (1)

Let H(u) denote the 1-D frequency domain Gaussian filter


-u 2 /2 2
H (u ) = Ae

The corresponding filter in the spatial domain


h( x) = 2 Ae −2 2 2 x 2

1. Both components are Gaussian and real


2. The functions behave reciprocally
Correspondence Between Filtering in the Spatial
and Frequency Domains (2)
Let H (u ) denote the difference of Gaussian filter
- u 2 /212 - u 2 /2 22
H (u ) = Ae − Be
with A  B and  1   2

The corresponding filter in the spatial domain


−2 212 x 2 −2 2 22 x 2
h( x) = 2 1 Ae − 2 2 Ae

High-pass filter or low-pass filter ?


Correspondence Between Filtering in the Spatial
and Frequency Domains (3)
Correspondence Between Filtering in the Spatial
and Frequency Domains: Example

600x600
Correspondence Between Filtering in the Spatial
and Frequency Domains: Example
Generate H(u,v)

 f ( x, y ) 0  x  599 and 0  y  599


f p ( x, y ) = 
 0 600  x  602 or 600  y  602

h( x, y ) 0  x  2 and 0  y  2
hp ( x, y ) = 
0 3  x  602 or 3  y  602

Here P  A(600) + C (3) − 1 = 602;


Q  B(600) + D(3) − 1 = 602.
Generate H(u,v)

1. Multiply hp ( x, y) by (-1) x+ y to center the frequency domain filter

2. Compute the forward DFT of the result in (1)

3. Set the real part of the resulting DFT to 0 to account for


parasitic real parts

4. Multiply the result by (-1)u +v , which is implicit when h( x, y)


was moved to the center of hp ( x, y ).
Image Smoothing Using Filter Domain Filters: ILPF

Ideal Lowpass Filters (ILPF)


1 if D(u, v)  D0
H (u, v) = 
0 if D(u, v)  D0

D0 is a positive constant and D(u , v) is the distance between a point (u , v)


in the frequency domain and the center of the frequency rectangle
2 1/2
D (u , v ) =  (u − P / 2) + (v − Q / 2) 
2
Image Smoothing Using Filter Domain Filters: ILPF
ILPF Filtering Example
ILPF Filtering
Example
The Spatial Representation of ILPF
Image Smoothing Using Filter Domain Filters: BLPF

Butterworth Lowpass Filters (BLPF) of order n and


with cutoff frequency D0
1
H (u , v) =
1 +  D(u, v) / D0 
2n
The Spatial Representation of BLPF
Image Smoothing Using Filter Domain Filters: GLPF

Gaussian Lowpass Filters (GLPF) in two dimensions is given


− D 2 ( u ,v )/2 2
H (u , v ) = e

By letting  = D0
− D 2 ( u ,v )/2 D02
H (u, v) = e
Image Smoothing Using Filter Domain Filters: GLPF
Examples of smoothing by GLPF (1)
Examples of smoothing by GLPF (2)
An application of lowpass filtering for producing a smoother, softer-looking
result from a sharp original.
For human faces, the typical objective is to reduce the sharpness of fine
skin lines and small blemishes.
Examples of smoothing by GLPF (3)
Image Sharpening Using Frequency Domain
Filters
A highpass filter is obtained from a given lowpass filter
using

H HP (u, v) = 1 − H LP (u, v)

A 2-D ideal highpass filter (IHPL) is defined as


0 if D(u, v)  D0
H (u , v) = 
1 if D(u, v)  D0
Image Sharpening Using Frequency Domain
Filters

A 2-D Butterworth highpass filter (BHPL) is defined as


1
H (u , v) =
1 +  D0 / D(u, v) 
2n

A 2-D Gaussian highpass filter (GHPL) is defined as


− D 2 ( u ,v )/2 D02
H (u , v) = 1 − e
The Spatial Representation of Highpass Filters
Filtering Results by IHPF
Filtering Results by BHPF
Filtering Results by GHPF
Using Highpass Filtering and Threshold for
Image Enhancement

BHPF
(order 4 with a cutoff
frequency 50)
The Laplacian in the Frequency Domain

H (u, v) = −4 2 (u 2 + v 2 )

H (u, v) = −4 2 (u − P / 2) 2 + (v − Q / 2) 2 ) 


= −4 2 D 2 (u, v)
The Laplacian image
 2 f ( x, y ) = −1 H (u, v) F (u, v)

Enhancement is obtained
g ( x, y ) = f ( x, y ) + c 2 f ( x, y ) c = -1
The Laplacian in the Frequency Domain

The enhanced image


−1
g ( x, y ) =  F (u, v) − H (u, v) F (u, v)
= −1 1 − H (u , v) F (u , v)

 
= −1 1 + 4 2 D 2 (u , v)  F (u, v)
The Laplacian in the Frequency Domain
Unsharp Masking, Highboost Filtering and High-
Frequency-Emphasis Fitering
gmask ( x, y) = f ( x, y) − f LP ( x, y)

f LP ( x, y) = −1  H LP (u, v) F (u, v)

Unsharp masking and highboost filtering


g ( x, y ) = f ( x, y ) + k * g mask ( x, y )

 
g ( x, y ) = −1 1 + k * 1 − H LP (u, v)  F (u, v)
= −1 1 + k * H HP (u, v) F (u, v)
Unsharp Masking, Highboost Filtering and High-
Frequency-Emphasis Fitering

−1
g ( x, y ) =  k
1 + k2 * H HP (u, v)  F (u, v)
k1  0 and k2  0
Gaussian Filter
D0=40

High-Frequency-Emphasis Filtering
Gaussian Filter
K1=0.5, k2=0.75
Homomorphic Filtering
Improving the appearance of an image by simultaneous intensity range
compression and contrast enhancement.
An image can be expressed as the product of its illumination and reflectance
f ( x, y) = i( x, y)r ( x, y)
 f ( x, y) = i( x, y)  r ( x, y) ?

z( x, y) = ln f ( x, y) = ln i( x, y) + ln r ( x, y)

z ( x, y) = ln f ( x, y) = ln i( x, y) + ln r ( x, y)

Z (u, v) = Fi (u, v) + Fr (u, v)


Homomorphic Filtering

S (u, v) = H (u, v) Z (u, v)


= H (u, v) Fi (u, v) + H (u, v) Fr (u, v)
s ( x, y ) = −1 S (u, v)
= −1  H (u , v) Fi (u , v) + H (u , v) Fr (u, v)
= −1  H (u , v) Fi (u , v) + −1 H (u , v) Fr (u, v)
= i '( x, y ) + r '( x, y )

g ( x, y) = es ( x, y ) = ei '( x, y )er '( x, y ) = i0 ( x, y)r0 ( x, y)


Homomorphic Filtering

The illumination component of an image generally is


characterized by slow spatial variations, while the
reflectance component tends to vary abruptly

These characteristics lead to associating the low


frequencies of the Fourier transform of the logarithm of an
image with illumination the high frequencies with
reflectance.
Homomorphic Filtering

H (u, v) = ( H −  L ) 1 − e
− c  D 2 ( u ,v )/ D02 
   +
  L

Attenuate the contribution


made by illumination and
amplify the contribution made
by reflectance
 L = 0.25
H = 2
Homomorphic Filtering
c =1
D0 = 80
Homomorphic Filtering
Selective Filtering

Non-Selective Filters:
operate over the entire frequency rectangle

Selective Filters
operate over some part, not entire frequency rectangle
• bandreject or bandpass: process specific bands
• notch filters: process small regions of the frequency
rectangle
Selective Filtering:
Bandreject and Bandpass Filters

H BP (u, v) = 1 − H BR (u, v)
Selective Filtering:
Bandreject and Bandpass Filters
Selective Filtering:
Notch Filters
Zero-phase-shift filters must be symmetric about the origin.
A notch with center at (u0, v0) must have a corresponding
notch at location (-u0,-v0).

Notch reject filters are constructed as products of highpass


filters whose centers have been translated to the centers of
the notches.
Q
H NR (u , v ) =  H k (u , v ) H − k (u , v )
k =1

where H k (u, v) and H - k (u, v) are highpass filters whose centers are
at (uk , vk ) and (-uk , -vk ), respectively.
Selective Filtering:
Notch Filters
Q
H NR (u , v ) =  H k (u , v ) H − k (u , v )
k =1

where H k (u, v) and H - k (u, v) are highpass filters whose centers are
at (uk , vk ) and (-uk , -vk ), respectively.

A Butterworth notch reject filter of order n


3  1  1 
H NR (u, v) =   2n   2n 
k =1 1 +  D0 k / Dk (u , v )   1 +  D0 k / D− k (u , v )  
  
2 1/2
Dk (u, v) = (u − M / 2 − uk ) + (v − N / 2 − vk ) 
2

2 1/2
D− k (u, v) = (u − M / 2 + uk ) + (v − N / 2 + vk ) 
2
Examples:
Notch Filters
(1)

A Butterworth notch
reject filter D0 =3
and n=4 for all
notch pairs
Examples:
Notch Filters (2)

You might also like