Upload
firas-abdel-nour
View
223
Download
0
Embed Size (px)
Citation preview
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
1/19
1/21/20
Chapter 2 :Enhancement
Part 2 : Fourier Transform & Filters
Dr. Hojeij youssef
Digital image processing
1
Chapter 2 : Part 2
Fourierandimage:
Fourier transformFT
AnalogFT :
AnalogFT 1Dcase
AnalogFT 2Dcase
Digital FT:
Digital FT 1Dcase
Digital FT 2Dcase
Propertiesof DFT
DFT applicationsDiscretecosinetransformation(DCT)
Maskandconvolution
Dr. Hojeij youssef2
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
2/19
1/21/20
Fourier and image
Dr. Hojeij youssef3
What is a frequency in an image ? Low frequencies : homogeneous, regions, blurHigh frequency : Edges, sudden change of intensity, noise
High Frequency
Low frequency
Rem: The largest energy of the any picture is located in the low frequencies
Fourier
T, T-1 exist
Good properties in transformdomain : using the transformdomain is a
better way to solve problemsFind bases : exp, sin, cos, wavelets (choose your family of functions)
Dr. Hojeij youssef4
Spatial domain Transformdomain
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
3/19
1/21/20
Fourier
Function function
FT is an easy tool. It was sometimes difficult to compute, calculate the coefficients.Now it s easy with computers.
Gives properties of spectrum: frequencies.
Ex : If large number of low frequencies means smoothed signal, low varying signal.
Dr. Hojeij youssef5
Used to filterSysteminterpretation :spatial domainconvolution
frequency domainmultiplication
FT : analog1D case
Let f(x)be a continuous function of a real variable x. The Fouriertransformisdefinedby:
GivenF(u), f(x)can be obtained using the inverse Fourier transform:
Conditions :
- f(x)continuous & integrable
- F(u)integrable
Dr. Hojeij youssef6
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
4/19
1/21/20
FT analog1D case
If we are concerned with real valued functionsf(x)
Dr. Hojeij youssef7
Fourier or frequency domain
complex
Direct domain
real
-| F(u) |Fourier spectrum (magnitude function)-| F(u)| Power spectrum(spectral density)
-(u)phase angle
-ufrequency
FT : example
Dr. Hojeij youssef8
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
5/19
1/21/20
FT analog 2D case
TheFT caneasilyextendedtoafunction f(x,y)of 2variables:
GivenF(u,v), f(x,y)canbeobtainedusingtheinverseFourier transform:
Dr. Hojeij youssef9
Conditions :-f(x,y)continuous & integrable
-F(u,v)integrable
FT analog 2D Case
If we are concerned with real valued functionsf(x,y)
Dr. Hojeij youssef10
-| F(u,v) |Fourier spectrum (magnitude function)-| F(u,v)| Power spectrum(spectral density)
-(u,v)phase angle
-u,vfrequency variable
Direct domain
real
Fourier or frequency domain
complex
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
6/19
1/21/20
FT 2D Example
Dr. Hojeij youssef11
FT 2D Example
Dr. Hojeij youssef12
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
7/19
1/21/20
FT 2D Example
Dr. Hojeij youssef13
DiscreteFourier transform (DFT)
Let f(x)isdiscretizedintoasequencebytakingN samplesxunitsapart :
If we set f(x)=f(x0+ xx)where x now assumes discrete values :0,1,2,3,,N-1
- This sequence denotes any uniform spaced samples froma correspondingcontinuous
- RememberShannonstheorembeforesamplingasignal. fe>2fmaxDr. Hojeij youssef
14
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
8/19
1/21/20
DFT : 1D case
The DFT is defined by :
Rem:
- the values of u=1,2,,N -1in the DFT correspond to samples of the
continuoustransformsatvalues0, u, 2u,, (N-1)u
- F(u)representsF(uu)
Dr. Hojeij youssef15
DFT : 2D case
TheDFT 2D isdefinedby:
Dr. Hojeij youssef16
Rem:-The sampling is on a 2D grid
- Sampling increments in spatial and frequency domain
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
9/19
1/21/20
DFT : 2D case
Normalizationcoefficient:
Dr. Hojeij youssef17
Properties of DFT
Most 2D DFT proprietiesarestraightforwardextend fromthe1 D DFTproperties
1.Separability:
The2D Fourier transformcanbeperformedasseriesof 1D DFT(complexexponential isseparable)
Rem:performthe1D DFTonyvariable(axis) first F(x,v), andthenperformthe1DDFTonxvariable F(u,v)
Dr. Hojeij youssef18
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
10/19
1/21/20
Properties of DFT
2.Scaling:
Foranyconstantsaandb:
3.Shifting:
Shiftingthefunction f(x,y)resultsinaphaseshift intheFT :
4.Modulation:
The complement of the previous property-multiplying by a complex exponential. iemodulationresultsinashiftof theFT
5.Convolution:
Convolutionof twofunctioncorrespondsto amultiplicationof their FTs
Dr. Hojeij youssef19
)bv,au(Fab
1
)by,ax(f
)v,u(Fe)yy,xx(f)vyux(2j
0000
)vv,uu(F)y,x(fe 00)yvxu(2j 00
)v,u(H)v,u(H)v,u(G
dydx)y,x(f)yy,xx(h)y,x(h)y,x(f)y,x(g ''''''
Properties of DFT
6. Multiplication:
MultiplyingtwofunctioncorrespondstoconvolvingtheirsFts:
7.Rotation:
Usingthepolarcoordinates:
Rotatinganimagef(r,)byanangle rotatestheFT F(u,v)bythesameangle
8. Averagevalue:
Tofindaveragenumberscaleof anMNimage f(x,y)
Dr. Hojeij youssef20
)v,u(H)v,u(F
)y,x(h)y,x(f)y,x(g
sinwv&coswu
sinry&cosrx
),w(F),r(f 00 0
)0,0(FMN
1)y,x(f
MN
1)y,x(f
1M
1M
1N
1N
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
11/19
1/21/20
Properties of DFT
Dr. Hojeij youssef21
Properties of DFT
9.Periodicity:
Moving the zero-frequency component to the center of the array. It is useful forvisualizingaFourier transformwith thezero-frequencycomponent in themiddleof thespectrum.
Dr. Hojeij youssef22
)n,mM(f)n,m(f
)vN,u(F)v,u(F
)nN,m(f)n,m(f
)v,uM(F)v,u(F
)v,u(F)vbN,uaM(F )n,m(f)nbN,maM(f
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
12/19
1/21/20
Examples of DFT
Dr. Hojeij youssef23
Examples of DFT
Dr. Hojeij youssef24
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
13/19
1/21/20
DFT applications
Dr. Hojeij youssef25
Filtering:
Spacefilteringisdonebyconvolution. In thefield spectral (frequency), it isdonebymultiplication(hidingtheimage).
original image Image transformed
Filtered imageImage transformed
Filtered
Spectral filtering
(multiplication)
Filtering Spatial
(convolution)
DFT applications
Dr. Hojeij youssef26
spectral
filtering
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
14/19
1/21/20
DFT applications
Dr. Hojeij youssef27
Information percentage of the image included in the circles (smallest to largest) :90% 95% 98% 99% 99.5% 99.9%
DFT applications
Dr. Hojeij youssef28
High-passfilter : Low-passfilter :
Removes the high frequencies by putting thepixelsawayfromthecentertozero
Removes thebass frequencies by putting thepixels in thecenter to zero
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
15/19
1/21/20
DFT applications
Dr. Hojeij youssef29
De-noisingimage:
Noisy image
Fourier spectrum Filtered image
DFT applications
Dr. Hojeij youssef30
Contrastmodification(Enhancement):
Original image
High-pass filtering
Imageenhanced
Filtered image(High Pass)Original image
Imageenhanced Enhanced +Equalization Histogram
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
16/19
1/21/20
DCT isdefinedby:
DCT(Discrete Cosine transformation)
Dr. Hojeij youssef31
Example DCT
Dr. Hojeij youssef32
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
17/19
1/21/20
Example DCT
Dr. Hojeij youssef33
Example DCT
Dr. Hojeij youssef34
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
18/19
1/21/20
Numerical convolution
Dr. Hojeij youssef35
The discrete convolution is a tool to use filters or linear filter travel
invariants .The general equation of convolution, notedg(x), original function f(x)with a functionh(x)is :
f(x)is the original function and g(x) is the convoluted function (resultof convolution).
In our case, an image is seen as a mathematical function
h(x)is calledconvolution mask, convolution kernel, filter, kernel, ...
k )k(f)kx(h)x(h)x(f)x(g
Numerical convolution
Dr. Hojeij youssef36
In practice, the convolution of a digital image made by a summonsmultiplication
A convolution filter is usually a matrix (image), his size is not always oddand symmetrical
3x3, 5x5, 7x7, ...
Convolution of an image through a filter (kernel) 2D :
u v
'
'
)v,u(filter)vj,ui(I)j,i(I
)j,i(filtre)j,i(I)j,i(I
7/30/2019 DIP Chapter 2 Part2 Dft Dct Conv
19/19
1/21/20
Numerical convolution
Dr. Hojeij youssef37
Kernel
Image
Result of
convolution, I by
the kernel K
Numerical convolution
Dr. Hojeij youssef38
Image
Solution : No miraclesolution1. edges(0)2. Mirror effect : f (-x, y) = f (x, y)
Problem: What to do with theedges of theimage?