digital image processing week v
DESCRIPTION
Frequency Domain Processing. Digital Image Processing Week V. Thurdsak LEAUHATONG. Background: Fourier Series . Fourier series:. Any periodic signals can be viewed as weighted sum of sinusoidal signals with different frequencies. Frequency Domain: view frequency as an - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/1.jpg)
Digital Image Processing Week V
Thurdsak LEAUHATONG
Frequency Domain Processing
![Page 2: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/2.jpg)
Background: Fourier Series
Any periodic signals can beviewed as weighted sumof sinusoidal signals with different frequencies
Fourier series:
Frequency Domain: view frequency as an independent variable
![Page 3: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/3.jpg)
Fourier Tr. and Frequency Domain
Time, spatial Domain Signals
Frequency Domain Signals
Fourier Tr.
Inv Fourier Tr.
1-D, Continuous case
dxexfuF uxj 2)()(Fourier Tr.:
dueuFxf uxj 2)()(Inv. Fourier Tr.:
2 cos 2 sin 2j uxe ux j ux
![Page 4: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/4.jpg)
Example of 1-D Fourier Transforms
Notice that the longerthe time domain signal,The shorter its Fouriertransform
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
![Page 5: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/5.jpg)
Fourier Tr. and Frequency Domain (cont.)
1-D, Discrete case
1
0
/2)(1)(M
x
MuxjexfM
uF Fourier Tr.:
Inv. Fourier Tr.:
1
0
/2)()(M
u
MuxjeuFxf
u = 0,…,M-1
x = 0,…,M-1
F(u) can be written as)()()( ujeuFuF or)()()( ujIuRuF
22 )()()( uIuRuF
where
)()(tan)( 1
uRuIu
![Page 6: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/6.jpg)
Relation Between Dx and Du For a signal f(x) with M points, let spatial resolution Dx be space between samples in f(x) and let frequency resolution Du be space between frequencies components in F(u), we have
xMu
DD
1
Example: for a signal f(x) with sampling period 0.5 sec, 100 point, we will get frequency resolution equal to
Hz02.05.0100
1
Du
This means that in F(u) we can distinguish 2 frequencies that are apart by 0.02 Hertz or more.
![Page 7: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/7.jpg)
2-Dimensional Discrete Fourier Transform
1
0
1
0
)//(2),(1),(M
x
N
y
NvyMuxjeyxfMN
vuF
2-D IDFT
1
0
1
0
)//(2),(),(M
u
N
v
NvyMuxjevuFyxf
2-D DFT
u = frequency in x direction, u = 0 ,…, M-1v = frequency in y direction, v = 0 ,…, N-1
x = 0 ,…, M-1y = 0 ,…, N-1
For an image of size MxN pixels
![Page 8: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/8.jpg)
F(u,v) can be written as),(),(),( vujevuFvuF or),(),(),( vujIvuRvuF
22 ),(),(),( vuIvuRvuF
where
),(),(tan),( 1
vuRvuIvu
2-Dimensional Discrete Fourier Transform (cont.)
For the purpose of viewing, we usually display only theMagnitude part of F(u,v)
![Page 9: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/9.jpg)
2-D DFT Properties
![Page 10: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/10.jpg)
2-D DFT Properties (cont.)
![Page 11: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/11.jpg)
2-D DFT Properties (cont.)
![Page 12: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/12.jpg)
2-D DFT Properties (cont.)
![Page 13: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/13.jpg)
Relation Between Spatial and Frequency Resolutions
xMu
DD
1yN
vD
D1
whereDx = spatial resolution in x directionDy = spatial resolution in y direction
Du = frequency resolution in x directionDv = frequency resolution in y directionN,M = image width and height
Dx and Dy are pixel width and height. )
![Page 14: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/14.jpg)
How to Perform 2-D DFT by Using 1-D DFT
f(x,y)
1-D DFT
by row F(u,y)1-D DFT
by column
F(u,v)
![Page 15: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/15.jpg)
How to Perform 2-D DFT by Using 1-D DFT (cont.)
f(x,y)
1-D DFT
by rowF(x,v)
1-D DFTby column
F(u,v)
Alternative method
![Page 16: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/16.jpg)
1-D DFT
0 N 2N-N
DFT repeats itself every N points (Period = N) but we usually display it for n = 0 ,…, N-1
We display only in this range
1
0
/2)(1)(M
x
MuxjexfM
uF From DFT:
![Page 17: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/17.jpg)
Conventional Display for 1-D DFT
0 N-1Time Domain Signal
DFTf(x)
)(uF
0 N-1
Low frequencyarea
High frequencyarea
The graph F(u) is not easy to understand !
![Page 18: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/18.jpg)
)(uF
0-N/2 N/2-1
)(uF
0 N-1
Conventional Display for DFT : FFT Shift
FFT Shift: Shift center of thegraph F(u) to 0 to get betterDisplay which is easier to understand.
High frequency area
Low frequency area
![Page 19: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/19.jpg)
2-D DFT
For an image of size NxM pixels, its 2-D DFT repeats itself every N points in x-direction and every M points in y-direction.
We display only in this range
1
0
1
0
)//(2),(1),(M
x
N
y
NvyMuxjeyxfMN
vuF
0 N 2N-N
0
M
2M
-M
2-D DFT:g(x,y)
![Page 20: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/20.jpg)
Conventional Display for 2-D DFT
High frequency area
Low frequency area
F(u,v) has low frequency areasat corners of the image while highfrequency areas are at the centerof the image which is inconvenientto interpret.
![Page 21: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/21.jpg)
2-D FFT Shift : Better Display of 2-D DFT
2D FFTSHIFT
2-D FFT Shift is a MATLAB function: Shift the zero frequency of F(u,v) to the center of an image.
High frequency area Low frequency area
![Page 22: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/22.jpg)
Original displayof 2D DFT
0 N 2N-N
0
M
2M
-M
Display of 2D DFTAfter FFT Shift
2-D FFT Shift (cont.) : How it works
![Page 23: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/23.jpg)
Example of 2-D DFT
Notice that the longer the time domain signal,The shorter its Fourier transform
![Page 24: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/24.jpg)
Example of 2-D DFT
Notice that direction of an object in spatial image andIts Fourier transform are orthogonal to each other.
![Page 25: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/25.jpg)
Example of 2-D DFT
Original image
2D DFT
2D FFT Shift
F=fft2(f);S=abs(F); imshow(S,[ ]);
Fc=fftshift(F);Sc=abs(Fc); imshow(Sc,[ ]);
![Page 26: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/26.jpg)
Example of 2-D DFT
Original image
2D DFT
2D FFT Shift
F=fft2(f);S=abs(F); imshow(S,[ ]);
Fc=fftshift(F);Sc=abs(Fc); imshow(Sc,[ ]);
![Page 27: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/27.jpg)
Basic Concept of Filtering in the Frequency Domain
From Fourier Transform Property:
),(),(),(),(),(),( vuGvuHvuFyxhyxfyxg
We cam perform filtering process by using
Multiplication in the frequency domainis easier than convolution in the spatialDomain.
![Page 28: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/28.jpg)
Filtering in the Frequency Domain with FFT shift
f(x,y)
2D FFT
FFT shift
F(u,v)
FFT shift
2D IFFTX
H(u,v)(User defined)
G(u,v)
g(x,y)
In this case, F(u,v) and H(u,v) must have the same size andhave the zero frequency at the center.
![Page 29: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/29.jpg)
0 20 40 60 80 100 1200
0.5
1
0 20 40 60 80 100 1200
0.5
1
0 20 40 60 80 100 1200
20
40
Multiplication in Freq. Domain = Circular Convolution
f(x) DFT F(u)G(u) = F(u)H(u)
h(x) DFT H(u)g(x)IDFT
Multiplication of DFTs of 2 signalsis equivalent toperform circular convolutionin the spatial domain.
f(x)
h(x)
g(x)
“Wrap around” effect
![Page 30: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/30.jpg)
H(u,v)GaussianLowpassFilter
Original image
Filtered image (obtained using circular convolution)
Incorrect areas at image rims
Multiplication in Freq. Domain = Circular Convolution
![Page 31: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/31.jpg)
Linear Convolution by using Circular Convolution and Zero Padding
f(x) DFT F(u)G(u) = F(u)H(u)
h(x) DFT H(u)
g(x)
IDFTZero padding
Zero padding
Concatenation
0 50 100 150 200 2500
0.5
1
0 50 100 150 200 2500
0.5
1
0 50 100 150 200 2500
20
40
Padding zerosBefore DFT
Keep only this part
![Page 32: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/32.jpg)
Linear Convolution by using Circular Convolution and Zero Padding
![Page 33: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/33.jpg)
Filtering in the Frequency Domain : Example
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Highpass Filter
Lowpass Filter
![Page 34: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/34.jpg)
Filter Masks and Their Fourier Transforms
![Page 35: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/35.jpg)
Ideal Lowpass Filter
0
0
),( 0),( 1
),(DvuDDvuD
vuH
where D(u,v) = Distance from (u,v) to the center of the mask.
Ideal LPF Filter Transfer function
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
![Page 36: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/36.jpg)
Examples of Ideal Lowpass Filters
The smaller D0, the more high frequency components are removed.
![Page 37: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/37.jpg)
Results of Ideal Lowpass Filters
Ringing effect can be obviously seen!
![Page 38: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/38.jpg)
How ringing effect happens
Ideal Lowpass Filter with D0 = 5
-200
20
-20
0
20
0
0.2
0.4
0.6
0.8
1
Surface Plot
Abrupt change in the amplitude
0
0
),( 0),( 1
),(DvuDDvuD
vuH
![Page 39: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/39.jpg)
How ringing effect happens (cont.)
-200
20
-20
0
20
0
5
10
15
x 10-3
Spatial Response of Ideal Lowpass Filter with D0 = 5
Surface Plot
Ripples that cause ringing effect
![Page 40: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/40.jpg)
Butterworth Lowpass Filter
NDvuDvuH 2
0/),(11),(
Transfer function
Where D0 = Cut off frequency, N = filter order.
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
![Page 41: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/41.jpg)
Results of Butterworth Lowpass Filters
There is less ringing effect compared to those of ideal lowpassfilters!
![Page 42: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/42.jpg)
Gaussian Lowpass Filter
20
2 2/),(),( DvuDevuH Transfer function
Where D0 = spread factor.
Note: the Gaussian filter is the only filter that has no ripple and hence no ringing effect.
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
![Page 43: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/43.jpg)
Results of Gaussian Lowpass Filters
No ringing effect!
![Page 44: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/44.jpg)
Application of Gaussian Lowpass Filters
The GLPF can be used to remove jagged edges and “repair” broken characters.
Better LookingOriginal image
![Page 45: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/45.jpg)
Highpass Filters
Hhp = 1 - Hlp
![Page 46: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/46.jpg)
Ideal Highpass Filters
0
0
),( 1),( 0
),(DvuDDvuD
vuH
where D(u,v) = Distance from (u,v) to the center of the mask.
Ideal LPF Filter Transfer function
![Page 47: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/47.jpg)
Butterworth Highpass Filters
NvuDDvuH 2
0 ),(/11),(
Transfer function
Where D0 = Cut off frequency, N = filter order.
![Page 48: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/48.jpg)
Gaussian Highpass Filters
20
2 2/),(1),( DvuDevuH Transfer function
Where D0 = spread factor.
![Page 49: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/49.jpg)
Laplacian Filter in the Frequency Domain
)()( uFjudxxfd nn
n
From Fourier Tr. Property:
Then for Laplacian operator
),(222
2
2
22 vuFvu
yf
xff
Surface plot
222 vu
We get
Image of –(u2+v2)
![Page 50: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/50.jpg)
Sharpening Filtering in the Frequency Domain
),(),(),( yxfyxfyxf lphp
),(),(),( yxfyxAfyxf lphb
Spatial Domain
Frequency Domain Filter
),(),(),()1(),( yxfyxfyxfAyxf lphb
),(),()1(),( yxfyxfAyxf hphb
),(1),( vuHvuH lphp
),()1(),( vuHAvuH hphb
![Page 51: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/51.jpg)
High Frequency Emphasis Filtering),(),( vubHavuH hphfe
Original Butterworthhighpass filteredimage
High freq. emphasisfiltered image
AfterHistEq.
a = 0.5, b = 2
![Page 52: Digital Image Processing Week V](https://reader035.vdocuments.us/reader035/viewer/2022062811/56816180550346895dd110c0/html5/thumbnails/52.jpg)
Correlation Application: Object Detection