SlideShare ist ein Scribd-Unternehmen logo
1 von 8
Downloaden Sie, um offline zu lesen
4/28/2008
1
Frequency domain filtering 
fundamentals
Spring 2008 ELEN 4304/5365 DIP 1
by Gleb V. Tcheslavski: gleb@ee.lamar.edu
http://ee.lamar.edu/gleb/dip/index.htm
Preliminaries 
For a digital image f(x,y) the basic filtering equation is
{ }1
{ }1
( , ) ( , ) ( , )g x y H u v F u v−
= ℑ
Where H(u,v) and F(u,v) are DFTs of the image and of the filter.
Their product is defined by array (element-by-element)
multiplication. Specifications of H(u,v) are simplified considerably
when using functions symmetric about their centers This requires
Spring 2008 ELEN 4304/5365 DIP 2
when using functions symmetric about their centers. This requires
that F(u,v) is also centered, which is accomplished by multiplying
the input image by (-1)x+y before computing its transform.
4/28/2008
2
Simple filters
Considering the following image with centered (and scaled) DFT
Spring 2008 ELEN 4304/5365 DIP 3
Simple filters
One of the simplest filters would be H(u,v) having 0 at the center
and 1 elsewhere. Such filter will reject the DC (constant) term and
l thi l h dleave everything else unchanged.
Since the DC term
represents an average
intensity, setting it to zero
results in reduction of
average intensity to zero.
Spring 2008 ELEN 4304/5365 DIP 4
Therefore, the resulting
image appears darker.
Actually, aero average
implies negative intensities.
4/28/2008
3
Simple filters
Low frequencies in the transform are related to slowly varying
intensity components of image. High frequencies are caused by
sharp transitions in intensity (edges, noise).
Therefore, LPF will blur an image reducing details (and noise).
HPF will enhance sharp details but cause reduction in contrast
since it eliminates DC component. Adding a small constant to a
HPF d t ff t h i ti b t t li i ti
Spring 2008 ELEN 4304/5365 DIP 5
HPF does not affect sharpening properties but prevents elimination
of DC term and, thus, preserves contrast.
Simple filters
a=0.85
Spring 2008 ELEN 4304/5365 DIP 6
4/28/2008
4
Zero‐padding 
Periodicity implied by DFT 
leads to a “wraparound” 
error: data from adjacent 
periods aliases leading to 
incorrect results of 
convolution.
To avoid “wraparounds”, 
convolved functions must 
be zero padded
Spring 2008 ELEN 4304/5365 DIP 7Correct result
be zero‐padded.
More on zero‐padding
Sample image Blurred without padding Blurred with padding
Spring 2008 ELEN 4304/5365 DIP 8
p g p g p g
Blurred images are not uniform: top white edges are blurred but 
side edges are not (without zero‐padding). The zero‐padding leads 
to an expected result.
4/28/2008
5
More on zero‐padding
Image 
Image 
Spring 2008 ELEN 4304/5365 DIP 9
No padding With padding
Due to periodicity implicit while using DFT, a spatial filter passing
through the top edge of the image encompasses a part of the image
and also a part of the bottom of the periodic image right above it.
Padding helps to avoid this…
Zero‐padding and ringing
Considering an ideal LPF
and its spatial representation
obtained via multiplication
by (-1)u and IDFT, we
notice that zero-padding
will lead to discontinuities.
If we compete DFT of zero-
padded filter (to obtain its
f h t i ti )
Spring 2008 ELEN 4304/5365 DIP 10
frequency characteristic),
ringing (Gibbs?) will occur.
Ideal – infinite sinc –
truncation – ringing!
4/28/2008
6
Appearance of ringing
Results of filtering
with ILPF… Notice
ringing
We cannot use ideal filters AND zero-padding at the same time!
ringing
appearance.
Spring 2008 ELEN 4304/5365 DIP 11
We cannot use ideal filters AND zero padding at the same time!
One approach would be to zero-pad images and then create filters
(of the same zero-padded size) in frequency domain. However, this
will produce (insignificant though) wraparounds since the filter
won’t be zero-padded.
On phase angle
Since DFT of an image is a complex array, say
( , ) ( , ) ( , )F u v R u v jI u v= +
The filtered image would be
{ }1
( , ) ( , ) ( , ) ( , ) ( , )g x y H u v R u v jH u v I u v−
= ℑ +
We are interested in filters
affecting the real and
imaginary parts equally –
Spring 2008 ELEN 4304/5365 DIP 12
ag a y pa ts equa y
zero-phase-shift filters.
Even small changes in the
phase angle may have
drastic effect!
Phase multiplied by 0.5 Phase multiplied by 0.25
4/28/2008
7
Summary of steps
1. For the input image f(x,y) of size MxN, form the zero-padded
image fp(x,y) of size PxQ (typically P = 2M, Q = 2N), where
2 1 2 1P M Q N≥ ≥2 1; 2 1P M Q N≥ − ≥ −
2. Obtain fc(x,y) multiplying fp(x,y) by (-1)x+y to center its transform;
3. Compute the DFT of the fc(x,y);
4. Generate a real, symmetric filter function H(u,v) of size PxQ with
center at coordinates (P/2, Q/2);
5. Form the product G(u,v) = H(u,v) F(u,v) via array multiplication;
6 Ob i h d i
Spring 2008 ELEN 4304/5365 DIP 13
6. Obtain the processed image
7. Finally, extract g(x,y) – the MxN region from the top left quadrant
of gp(x,y).
{ }( )( )1
( , ) ( , ) 1
x y
pg x y real G u v
+−
⎡ ⎤= ℑ −⎣ ⎦
Summary of steps
The original image
– zero-padded –
scaled by (-1)x+y –scaled by ( 1)
DFT – DFT of LPF
– DFT of filtering
result – IDFT –
extracted filtered
image.
Spring 2008 ELEN 4304/5365 DIP 14
4/28/2008
8
Spatial vs. Frequency domains
The link between filtering in spatial and in frequency domains is the
convolution theorem...
( ) ( )h H⇔( , ) ( , )h x y H u v⇔
However, DFT implements a circular convolution.
Considering
next the image
and its spectrum
Spring 2008 ELEN 4304/5365 DIP 15
(magnitude of
its DFT) of size
600 x 600
Spatial vs. Frequency domains
We attempt to use a 3x3
Sobel mask…
Therefore, we need to
zero-pad both the image
and the mask to size of
602 x 602 (keeping the
mask at the center to
preserve symmetry) to
avoid wraparounds.
h fil f
Spring 2008 ELEN 4304/5365 DIP 16
The filter I n frequency
domain…
Results of frequency-
domain filtering and
spatial filtering are same.

Weitere ähnliche Inhalte

Was ist angesagt?

Enhancement in frequency domain
Enhancement in frequency domainEnhancement in frequency domain
Enhancement in frequency domain
Ashish Kumar
 

Was ist angesagt? (20)

Spatial domain and filtering
Spatial domain and filteringSpatial domain and filtering
Spatial domain and filtering
 
Basic image processing techniques
Basic image processing techniquesBasic image processing techniques
Basic image processing techniques
 
Lecture 1 for Digital Image Processing (2nd Edition)
Lecture 1 for Digital Image Processing (2nd Edition)Lecture 1 for Digital Image Processing (2nd Edition)
Lecture 1 for Digital Image Processing (2nd Edition)
 
Intensity Transformation
Intensity TransformationIntensity Transformation
Intensity Transformation
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 
Mathematical operations in image processing
Mathematical operations in image processingMathematical operations in image processing
Mathematical operations in image processing
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 
Image processing, Noise, Noise Removal filters
Image processing, Noise, Noise Removal filtersImage processing, Noise, Noise Removal filters
Image processing, Noise, Noise Removal filters
 
Chapter 5 Image Processing: Fourier Transformation
Chapter 5 Image Processing: Fourier TransformationChapter 5 Image Processing: Fourier Transformation
Chapter 5 Image Processing: Fourier Transformation
 
Image restoration and degradation model
Image restoration and degradation modelImage restoration and degradation model
Image restoration and degradation model
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Enhancement in frequency domain
Enhancement in frequency domainEnhancement in frequency domain
Enhancement in frequency domain
 
Image Restoration (Frequency Domain Filters):Basics
Image Restoration (Frequency Domain Filters):BasicsImage Restoration (Frequency Domain Filters):Basics
Image Restoration (Frequency Domain Filters):Basics
 
Image Restoration
Image RestorationImage Restoration
Image Restoration
 
Discrete cosine transform
Discrete cosine transform   Discrete cosine transform
Discrete cosine transform
 
Chapter 1 and 2 gonzalez and woods
Chapter 1 and 2 gonzalez and woodsChapter 1 and 2 gonzalez and woods
Chapter 1 and 2 gonzalez and woods
 
Chapter 6 color image processing
Chapter 6 color image processingChapter 6 color image processing
Chapter 6 color image processing
 
Filtering in frequency domain
Filtering in frequency domainFiltering in frequency domain
Filtering in frequency domain
 
Image Processing Using MATLAB
Image Processing Using MATLABImage Processing Using MATLAB
Image Processing Using MATLAB
 
6.frequency domain image_processing
6.frequency domain image_processing6.frequency domain image_processing
6.frequency domain image_processing
 

Andere mochten auch

Signal transmission and filtering section 3.1
Signal transmission and filtering section 3.1Signal transmission and filtering section 3.1
Signal transmission and filtering section 3.1
nahrain university
 
Frequency Domain Image Enhancement Techniques
Frequency Domain Image Enhancement TechniquesFrequency Domain Image Enhancement Techniques
Frequency Domain Image Enhancement Techniques
Diwaker Pant
 
Signal transmission and filtering section 3.2
Signal transmission and filtering section 3.2Signal transmission and filtering section 3.2
Signal transmission and filtering section 3.2
nahrain university
 
Lecture 8 audio compression
Lecture 8 audio compressionLecture 8 audio compression
Lecture 8 audio compression
Mr SMAK
 

Andere mochten auch (16)

Lecture 10
Lecture 10Lecture 10
Lecture 10
 
08 frequency domain filtering DIP
08 frequency domain filtering DIP08 frequency domain filtering DIP
08 frequency domain filtering DIP
 
Frequency domain methods
Frequency domain methods Frequency domain methods
Frequency domain methods
 
Signal transmission and filtering section 3.1
Signal transmission and filtering section 3.1Signal transmission and filtering section 3.1
Signal transmission and filtering section 3.1
 
Frequency Domain Image Enhancement Techniques
Frequency Domain Image Enhancement TechniquesFrequency Domain Image Enhancement Techniques
Frequency Domain Image Enhancement Techniques
 
Ppt ---image processing
Ppt ---image processingPpt ---image processing
Ppt ---image processing
 
Image Smoothing using Frequency Domain Filters
Image Smoothing using Frequency Domain FiltersImage Smoothing using Frequency Domain Filters
Image Smoothing using Frequency Domain Filters
 
Ajal filters
Ajal filtersAjal filters
Ajal filters
 
Signal transmission and filtering section 3.2
Signal transmission and filtering section 3.2Signal transmission and filtering section 3.2
Signal transmission and filtering section 3.2
 
PA Output Notch Filter Consideration
PA Output Notch Filter ConsiderationPA Output Notch Filter Consideration
PA Output Notch Filter Consideration
 
07 frequency domain DIP
07 frequency domain DIP07 frequency domain DIP
07 frequency domain DIP
 
Digital Image Processing: Image Enhancement in the Frequency Domain
Digital Image Processing: Image Enhancement in the Frequency DomainDigital Image Processing: Image Enhancement in the Frequency Domain
Digital Image Processing: Image Enhancement in the Frequency Domain
 
Lecture 8 audio compression
Lecture 8 audio compressionLecture 8 audio compression
Lecture 8 audio compression
 
Audio compression
Audio compressionAudio compression
Audio compression
 
filters for noise in image processing
filters for noise in image processingfilters for noise in image processing
filters for noise in image processing
 
Audio compression
Audio compressionAudio compression
Audio compression
 

Ähnlich wie 04 1 - frequency domain filtering fundamentals

Image trnsformations
Image trnsformationsImage trnsformations
Image trnsformations
John Williams
 
Digital Image Processing Module 3 Notess
Digital Image Processing Module 3 NotessDigital Image Processing Module 3 Notess
Digital Image Processing Module 3 Notess
shivubhavv
 
Iisrt zzz bhavyasri vanteddu
Iisrt zzz bhavyasri vantedduIisrt zzz bhavyasri vanteddu
Iisrt zzz bhavyasri vanteddu
IISRT
 
ESTIMATING NOISE PARAMETER & FILTERING (Digital Image Processing)
ESTIMATING NOISE PARAMETER & FILTERING (Digital Image Processing)ESTIMATING NOISE PARAMETER & FILTERING (Digital Image Processing)
ESTIMATING NOISE PARAMETER & FILTERING (Digital Image Processing)
Shajun Nisha
 
FourierTransform detailed power point presentation
FourierTransform detailed power point presentationFourierTransform detailed power point presentation
FourierTransform detailed power point presentation
ssuseracb8ba
 
imageCorrectionLinearDiffusion
imageCorrectionLinearDiffusionimageCorrectionLinearDiffusion
imageCorrectionLinearDiffusion
Kellen Betts
 
Non-Blind Deblurring Using Partial Differential Equation Method
Non-Blind Deblurring Using Partial Differential Equation MethodNon-Blind Deblurring Using Partial Differential Equation Method
Non-Blind Deblurring Using Partial Differential Equation Method
Editor IJCATR
 

Ähnlich wie 04 1 - frequency domain filtering fundamentals (20)

Image trnsformations
Image trnsformationsImage trnsformations
Image trnsformations
 
Lect5 v2
Lect5 v2Lect5 v2
Lect5 v2
 
Frequency Image Processing
Frequency Image ProcessingFrequency Image Processing
Frequency Image Processing
 
DIGITAL IMAGE PROCESSING - Day 4 Image Transform
DIGITAL IMAGE PROCESSING - Day 4 Image TransformDIGITAL IMAGE PROCESSING - Day 4 Image Transform
DIGITAL IMAGE PROCESSING - Day 4 Image Transform
 
Digital Image Processing Module 3 Notess
Digital Image Processing Module 3 NotessDigital Image Processing Module 3 Notess
Digital Image Processing Module 3 Notess
 
Iisrt zzz bhavyasri vanteddu
Iisrt zzz bhavyasri vantedduIisrt zzz bhavyasri vanteddu
Iisrt zzz bhavyasri vanteddu
 
Presentation_Tan
Presentation_TanPresentation_Tan
Presentation_Tan
 
ESTIMATING NOISE PARAMETER & FILTERING (Digital Image Processing)
ESTIMATING NOISE PARAMETER & FILTERING (Digital Image Processing)ESTIMATING NOISE PARAMETER & FILTERING (Digital Image Processing)
ESTIMATING NOISE PARAMETER & FILTERING (Digital Image Processing)
 
FourierTransform detailed power point presentation
FourierTransform detailed power point presentationFourierTransform detailed power point presentation
FourierTransform detailed power point presentation
 
Digital image processing using matlab: filters (detail)
Digital image processing using matlab: filters (detail)Digital image processing using matlab: filters (detail)
Digital image processing using matlab: filters (detail)
 
imageCorrectionLinearDiffusion
imageCorrectionLinearDiffusionimageCorrectionLinearDiffusion
imageCorrectionLinearDiffusion
 
Spatial domain filtering.ppt
Spatial domain filtering.pptSpatial domain filtering.ppt
Spatial domain filtering.ppt
 
chapter-2 SPACIAL DOMAIN.pptx
chapter-2 SPACIAL DOMAIN.pptxchapter-2 SPACIAL DOMAIN.pptx
chapter-2 SPACIAL DOMAIN.pptx
 
Filtering an image is to apply a convolution
Filtering an image is to apply a convolutionFiltering an image is to apply a convolution
Filtering an image is to apply a convolution
 
Lecture 2-Filtering.pdf
Lecture 2-Filtering.pdfLecture 2-Filtering.pdf
Lecture 2-Filtering.pdf
 
Non-Blind Deblurring Using Partial Differential Equation Method
Non-Blind Deblurring Using Partial Differential Equation MethodNon-Blind Deblurring Using Partial Differential Equation Method
Non-Blind Deblurring Using Partial Differential Equation Method
 
Online Signal Processing Assignment Help
Online Signal Processing Assignment HelpOnline Signal Processing Assignment Help
Online Signal Processing Assignment Help
 
3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slides3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slides
 
Lecture 11
Lecture 11Lecture 11
Lecture 11
 
13 fourierfiltrationen
13 fourierfiltrationen13 fourierfiltrationen
13 fourierfiltrationen
 

Kürzlich hochgeladen

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Christo Ananth
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Dr.Costas Sachpazis
 

Kürzlich hochgeladen (20)

Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 

04 1 - frequency domain filtering fundamentals

  • 1. 4/28/2008 1 Frequency domain filtering  fundamentals Spring 2008 ELEN 4304/5365 DIP 1 by Gleb V. Tcheslavski: gleb@ee.lamar.edu http://ee.lamar.edu/gleb/dip/index.htm Preliminaries  For a digital image f(x,y) the basic filtering equation is { }1 { }1 ( , ) ( , ) ( , )g x y H u v F u v− = ℑ Where H(u,v) and F(u,v) are DFTs of the image and of the filter. Their product is defined by array (element-by-element) multiplication. Specifications of H(u,v) are simplified considerably when using functions symmetric about their centers This requires Spring 2008 ELEN 4304/5365 DIP 2 when using functions symmetric about their centers. This requires that F(u,v) is also centered, which is accomplished by multiplying the input image by (-1)x+y before computing its transform.
  • 2. 4/28/2008 2 Simple filters Considering the following image with centered (and scaled) DFT Spring 2008 ELEN 4304/5365 DIP 3 Simple filters One of the simplest filters would be H(u,v) having 0 at the center and 1 elsewhere. Such filter will reject the DC (constant) term and l thi l h dleave everything else unchanged. Since the DC term represents an average intensity, setting it to zero results in reduction of average intensity to zero. Spring 2008 ELEN 4304/5365 DIP 4 Therefore, the resulting image appears darker. Actually, aero average implies negative intensities.
  • 3. 4/28/2008 3 Simple filters Low frequencies in the transform are related to slowly varying intensity components of image. High frequencies are caused by sharp transitions in intensity (edges, noise). Therefore, LPF will blur an image reducing details (and noise). HPF will enhance sharp details but cause reduction in contrast since it eliminates DC component. Adding a small constant to a HPF d t ff t h i ti b t t li i ti Spring 2008 ELEN 4304/5365 DIP 5 HPF does not affect sharpening properties but prevents elimination of DC term and, thus, preserves contrast. Simple filters a=0.85 Spring 2008 ELEN 4304/5365 DIP 6
  • 4. 4/28/2008 4 Zero‐padding  Periodicity implied by DFT  leads to a “wraparound”  error: data from adjacent  periods aliases leading to  incorrect results of  convolution. To avoid “wraparounds”,  convolved functions must  be zero padded Spring 2008 ELEN 4304/5365 DIP 7Correct result be zero‐padded. More on zero‐padding Sample image Blurred without padding Blurred with padding Spring 2008 ELEN 4304/5365 DIP 8 p g p g p g Blurred images are not uniform: top white edges are blurred but  side edges are not (without zero‐padding). The zero‐padding leads  to an expected result.
  • 5. 4/28/2008 5 More on zero‐padding Image  Image  Spring 2008 ELEN 4304/5365 DIP 9 No padding With padding Due to periodicity implicit while using DFT, a spatial filter passing through the top edge of the image encompasses a part of the image and also a part of the bottom of the periodic image right above it. Padding helps to avoid this… Zero‐padding and ringing Considering an ideal LPF and its spatial representation obtained via multiplication by (-1)u and IDFT, we notice that zero-padding will lead to discontinuities. If we compete DFT of zero- padded filter (to obtain its f h t i ti ) Spring 2008 ELEN 4304/5365 DIP 10 frequency characteristic), ringing (Gibbs?) will occur. Ideal – infinite sinc – truncation – ringing!
  • 6. 4/28/2008 6 Appearance of ringing Results of filtering with ILPF… Notice ringing We cannot use ideal filters AND zero-padding at the same time! ringing appearance. Spring 2008 ELEN 4304/5365 DIP 11 We cannot use ideal filters AND zero padding at the same time! One approach would be to zero-pad images and then create filters (of the same zero-padded size) in frequency domain. However, this will produce (insignificant though) wraparounds since the filter won’t be zero-padded. On phase angle Since DFT of an image is a complex array, say ( , ) ( , ) ( , )F u v R u v jI u v= + The filtered image would be { }1 ( , ) ( , ) ( , ) ( , ) ( , )g x y H u v R u v jH u v I u v− = ℑ + We are interested in filters affecting the real and imaginary parts equally – Spring 2008 ELEN 4304/5365 DIP 12 ag a y pa ts equa y zero-phase-shift filters. Even small changes in the phase angle may have drastic effect! Phase multiplied by 0.5 Phase multiplied by 0.25
  • 7. 4/28/2008 7 Summary of steps 1. For the input image f(x,y) of size MxN, form the zero-padded image fp(x,y) of size PxQ (typically P = 2M, Q = 2N), where 2 1 2 1P M Q N≥ ≥2 1; 2 1P M Q N≥ − ≥ − 2. Obtain fc(x,y) multiplying fp(x,y) by (-1)x+y to center its transform; 3. Compute the DFT of the fc(x,y); 4. Generate a real, symmetric filter function H(u,v) of size PxQ with center at coordinates (P/2, Q/2); 5. Form the product G(u,v) = H(u,v) F(u,v) via array multiplication; 6 Ob i h d i Spring 2008 ELEN 4304/5365 DIP 13 6. Obtain the processed image 7. Finally, extract g(x,y) – the MxN region from the top left quadrant of gp(x,y). { }( )( )1 ( , ) ( , ) 1 x y pg x y real G u v +− ⎡ ⎤= ℑ −⎣ ⎦ Summary of steps The original image – zero-padded – scaled by (-1)x+y –scaled by ( 1) DFT – DFT of LPF – DFT of filtering result – IDFT – extracted filtered image. Spring 2008 ELEN 4304/5365 DIP 14
  • 8. 4/28/2008 8 Spatial vs. Frequency domains The link between filtering in spatial and in frequency domains is the convolution theorem... ( ) ( )h H⇔( , ) ( , )h x y H u v⇔ However, DFT implements a circular convolution. Considering next the image and its spectrum Spring 2008 ELEN 4304/5365 DIP 15 (magnitude of its DFT) of size 600 x 600 Spatial vs. Frequency domains We attempt to use a 3x3 Sobel mask… Therefore, we need to zero-pad both the image and the mask to size of 602 x 602 (keeping the mask at the center to preserve symmetry) to avoid wraparounds. h fil f Spring 2008 ELEN 4304/5365 DIP 16 The filter I n frequency domain… Results of frequency- domain filtering and spatial filtering are same.