Upload
cleary
View
78
Download
1
Tags:
Embed Size (px)
DESCRIPTION
Digital Image Processing Chapter 4: Image Enhancement in the Frequency Domain 22 June 2005. 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 Presentation
Citation preview
Digital Image ProcessingChapter 4:
Image Enhancement in the Frequency Domain
22 June 2005
Background: Fourier Series 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
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Fourier Tr. and Frequency Domain 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.:
Fourier Tr. and Frequency Domain (cont.) 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
Example of 1-D Fourier Transforms 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.
Relation Between Relation Between x and x and u u For a signal f(x) with M points, let spatial resolution x be space between samples in f(x) and let frequency resolution u be space between frequencies components in F(u), we have
xMu
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
u
This means that in F(u) we can distinguish 2 frequencies that are apart by 0.02 Hertz or more.
2-Dimensional Discrete Fourier Transform2-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
F(u,v) can be written as),(),(),( vujevuFvuF or),(),(),( vujIvuRvuF
22 ),(),(),( vuIvuRvuF
where
),(),(tan),( 1
vuRvuIvu
2-Dimensional Discrete Fourier Transform (cont.)2-Dimensional Discrete Fourier Transform (cont.)
For the purpose of viewing, we usually display only theMagnitude part of F(u,v)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
2-D DFT Properties2-D DFT Properties
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
2-D DFT Properties (cont.)2-D DFT Properties (cont.)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
2-D DFT Properties (cont.)2-D DFT Properties (cont.)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
2-D DFT Properties (cont.)2-D DFT Properties (cont.)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Computational Advantage of FFT Compared to DFTComputational Advantage of FFT Compared to DFT
Relation Between Spatial and Frequency ResolutionsRelation Between Spatial and Frequency Resolutions
xMu
1yN
v
1
wherex = spatial resolution in x directiony = spatial resolution in y direction
u = frequency resolution in x directionv = frequency resolution in y directionN,M = image width and height
x and y are pixel width and height. )
How to Perform 2-D DFT by Using 1-D DFTHow to Perform 2-D DFT by Using 1-D DFT
f(x,y)
1-D DFT
by row F(u,y)
1-D DFTby column
F(u,v)
How to Perform 2-D DFT by Using 1-D DFT (cont.)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
Periodicity of 1-D DFTPeriodicity of 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:
Conventional Display for 1-D DFTConventional Display for 1-D DFT
0 N-1
Time Domain Signal
DFTf(x)
)(uF
0 N-1
Low frequencyarea
High frequencyarea
The graph F(u) is not easy to understand !
)(uF
0-N/2 N/2-1
)(uF
0 N-1
Conventional Display for DFT : FFT ShiftConventional 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
Periodicity of 2-D DFTPeriodicity of 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)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Conventional Display for 2-D DFTConventional 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.
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
2-D FFT Shift : Better Display of 2-D DFT2-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(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Original displayof 2D DFT
0 N 2N-N
0
M
2M
-M
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Display of 2D DFTAfter FFT Shift
2-D FFT Shift (cont.) : How it works2-D FFT Shift (cont.) : How it works
Example of 2-D DFTExample of 2-D DFT
Notice that the longer the time domain signal,The shorter its Fourier transform
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Example of 2-D DFTExample of 2-D DFT
Notice that direction of an object in spatial image andIts Fourier transform are orthogonal to each other.
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Example of 2-D DFTExample of 2-D DFT
Original image
2D DFT
2D FFT Shift
Example of 2-D DFTExample of 2-D DFT
Original image
2D DFT
2D FFT Shift
Basic Concept of Filtering in the Frequency DomainBasic Concept of Filtering in the Frequency DomainFrom Fourier Transform Property:
),(),(),(),(),(),( vuGvuHvuFyxhyxfyxg
We cam perform filtering process by using
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Multiplication in the frequency domainis easier than convolution in the spatialDomain.
Filtering in the Frequency Domain with FFT shiftFiltering 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.
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 ConvolutionMultiplication 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
H(u,v)GaussianLowpassFilter with D0 = 5
Original image
Filtered image (obtained using circular convolution)
Incorrect areas at image rims
Multiplication in Freq. Domain = Circular ConvolutionMultiplication in Freq. Domain = Circular Convolution
Linear Convolution by using Circular Convolution and Zero Padding 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
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Linear Convolution by using Circular Convolution and Zero Padding Linear Convolution by using Circular Convolution and Zero Padding
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Linear Convolution by using Circular Convolution and Zero Padding Linear Convolution by using Circular Convolution and Zero Padding
Zero padding area in the spatialDomain of the mask image(the ideal lowpass filter)
Filtered image
Only this area is kept.
Filtering in the Frequency Domain : ExampleFiltering in the Frequency Domain : Example
In this example, we set F(0,0) to zerowhich means that the zero frequencycomponent is removed.
Note: Zero frequency = average intensity of an image
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Filtering in the Frequency Domain : ExampleFiltering in the Frequency Domain : Example
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Highpass Filter
Lowpass Filter
Filtering in the Frequency Domain : Example (cont.)Filtering in the Frequency Domain : Example (cont.)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Result of Sharpening Filter
Filter Masks and Their Fourier TransformsFilter Masks and Their Fourier Transforms
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Ideal Lowpass FilterIdeal 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.
Examples of Ideal Lowpass FiltersExamples of Ideal Lowpass Filters
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
The smaller D0, the more high frequency components are removed.
Results of Ideal Lowpass Filters Results of Ideal Lowpass Filters
Ringing effect can be obviously seen!
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
How ringing effect happens 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
How ringing effect happens (cont.) 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
How ringing effect happens (cont.) How ringing effect happens (cont.)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Butterworth Lowpass Filter 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.
Results of Butterworth Lowpass Filters Results of Butterworth Lowpass Filters
There is less ringing effect compared to those of ideal lowpassfilters!
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Spatial Masks of the Butterworth Lowpass Filters Spatial Masks of the Butterworth Lowpass Filters
Some ripples can be seen.(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Gaussian Lowpass Filter 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.
Gaussian Lowpass Filter (cont.) Gaussian Lowpass Filter (cont.)
-200
20
-20
0
20
0.2
0.4
0.6
0.8
1
Gaussian lowpass filter with D0 = 5
-200
20
-20
0
20
0
0.01
0.02
0.03
Spatial respones of the Gaussian lowpass filter with D0 = 5
Gaussian shape
20
2 2/),(),( DvuDevuH
Results of Gaussian Lowpass Filters Results of Gaussian Lowpass Filters
No ringing effect!
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Application of Gaussian Lowpass FiltersApplication of Gaussian Lowpass Filters
The GLPF can be used to remove jagged edges and “repair” broken characters.
Better LookingOriginal image
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Application of Gaussian Lowpass Filters (cont.) Application of Gaussian Lowpass Filters (cont.)
Remove wrinkles
Softer-Looking
Original image
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Application of Gaussian Lowpass Filters (cont.) Application of Gaussian Lowpass Filters (cont.)
Remove artifact lines: this is a simple but crude way to do it!
Filtered imageOriginal image : The gulf of Mexico andFlorida from NOAA satellite. (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Highpass Filters Highpass Filters
Hhp = 1 - Hlp
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Ideal Highpass Filters 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
Butterworth Highpass Filters Butterworth Highpass Filters
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
NvuDDvuH 2
0 ),(/11),(
Transfer function
Where D0 = Cut off frequency, N = filter order.
Gaussian Highpass Filters Gaussian Highpass Filters
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
20
2 2/),(1),( DvuDevuH Transfer function
Where D0 = spread factor.
Gaussian Highpass Filters (cont.) Gaussian Highpass Filters (cont.)
20
2 2/),(1),( DvuDevuH
1020
3040
5060
20
40
600
0.2
0.4
0.6
0.8
1
1020
3040
5060
20
40
60
0
1000
2000
3000
Gaussian highpass filter with D0 = 5
Spatial respones of the Gaussian highpass filter with D0 = 5
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Spatial Responses of Highpass Filters Spatial Responses of Highpass Filters
Ripples
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Results of Ideal Highpass Filters Results of Ideal Highpass Filters
Ringing effect can be obviously seen!
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Results of Butterworth Highpass Filters Results of Butterworth Highpass Filters
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Results of Gaussian Highpass Filters Results of Gaussian Highpass Filters
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Laplacian Filter in the Frequency DomainLaplacian Filter in the Frequency Domain
)()( uFjudx
xfd 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)
Laplacian Filter in the Frequency Domain (cont.)Laplacian Filter in the Frequency Domain (cont.)
Spatial response of –(u2+v2) Cross section
Laplacian mask in Chapter 3
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Sharpening Filtering in the Frequency DomainSharpening 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
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Sharpening Filtering in the Frequency Domain (cont.)Sharpening Filtering in the Frequency Domain (cont.)
p P2
P2 PP 2
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Sharpening Filtering in the Frequency Domain (cont.)Sharpening Filtering in the Frequency Domain (cont.)),(),()1(),( yxfyxfAyxf hphb
Pfhp2f
A = 2 A = 2.7
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
High Frequency Emphasis FilteringHigh Frequency Emphasis Filtering),(),( vubHavuH hphfe
Original Butterworthhighpass filteredimage
High freq. emphasisfiltered image
AfterHistEq.
a = 0.5, b = 2
Homomorphic FilteringHomomorphic FilteringAn image can be expressed as
),(),(),( yxryxiyxf
i(x,y) = illumination componentr(x,y) = reflectance component
We need to suppress effect of illumination that cause image Intensity changed slowly.
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Homomorphic FilteringHomomorphic Filtering
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Homomorphic FilteringHomomorphic Filtering
More details in the room can be seen!
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Correlation Application: Object DetectionCorrelation Application: Object Detection