digital image procesing - imperial college londontania/teaching/dip 2014/dft.pdf · digital image...
TRANSCRIPT
Digital Image Procesing
Unitary Transforms
Discrete Fourier Trasform (DFT) in Image Processing
DR TANIA STATHAKI READER (ASSOCIATE PROFFESOR) IN SIGNAL PROCESSING IMPERIAL COLLEGE LONDON
}10 ),({ Nxxf
1
0
)(),()(N
x
xfxuTug
1-D Signal Transforms
10 Nu
fTg
Scalar form
Matrix form
}10 ),({ Nxxf
1
0
)(),()(N
x
xfxuTug
1-D Signal Transforms-Remember the 1-D DFT
General form
DFT
10 Nu
1
0
2
)(1
)(N
x
N
xuj
xfeN
ug
1-D Inverse Signal Transforms-General Form
Scalar form
Matrix form
1
0
)(),()(N
u
uguxIxf
gTf 1
}10 ),({ Nxxf
1-D Inverse Signal Transforms-Remember the 1D DFT
General form
Inverse DFT
1
0
2
)()(N
x
N
xuj
ugexf
10 Nu
1
0
)(),()(N
u
uguxIxf
1-D Unitary Transforms
fTg
Matrix form
T
TT
1
Signal Reconstruction
1
0
)(),()(N
u
T
ugxuTxfgTf
T
TT
1
Why do we use Image Transforms?
Often, image processing tasks are best performed in a
domain other than the spatial domain.
Key steps:
• Transform the image
• Carry the task(s) of interest in the transformed domain.
• Apply inverse transform to return to the spatial domain.
2-D (Image) Transforms-General Form
1
0
1
0
),(),,,(),(N
x
N
y
yxfyxvuTvug
1
0
1
0
),(),,,(),(N
u
N
v
vugvuyxIyxf
2-D (Image) Transforms-Special Cases
Separable
Symmetric
),(),(),,,( 21 yvTxuTyxvuT
),(),(),,,( 11 yvTxuTyxvuT
Separable and Symmetric
Separable, Symmetric and Unitary
TTfTg 11
11 TgTf
T
2-D (Image) Transforms-Special Cases (cont.)
Energy Preservation
1-D
2-D
1
0
1
0
21
0
1
0
2),(),(
M
u
N
v
M
x
N
y
vugyxf
22fg
Energy Compaction
• Most of the energy of the original data is
concentrated in only a few transform
coefficients, which are placed close to the
origin; remaining coefficients have small
values.
• This property facilitate compression of the
original image.
Let’s talk about DFT in images: Why is it useful?
• It is easier for removing undesirable
frequencies.
• It is faster to perform certain operations in
the frequency domain than in the spatial
domain.
• The transform is independent of the signal.
Example: Removing undesirable frequencies
Result after removing high frequencies
frequencies noisy signal Example of
removing a high
frequency using
the transform
domain
How do frequencies show up in an image?
• Low frequencies correspond to slowly
varying information (e.g., continuous
surface).
• High frequencies correspond to quickly
varying information (e.g., edges)
Original Image Low-passed version
2-D Discrete Fourier Transform
1
0
1
0
)//(2),(),(M
x
N
y
NvyMuxjeyxfvuF
1
0
1
0
)//(2),(1
),(M
u
N
v
NvyMuxjevuFMN
yxf
• It is separable, symmetric and unitary
• It results in a sequence of two 1-D DFT
operations (prove this)
Visualizing DFT
• The dynamic range of F(u,v) is typically very large
• Small values are not distinguishable
• We apply a logarithmic transformation to enhance
small values.
original image before transformation after transformation
constant a is ],),(1log[),( cvuFcvuD
Amplitude and Log of the Amplitude
Amplitude and Log of the Amplitude
Original Image and Log of the Amplitude
1
0
/2
1
0
/2
1
0
1
0
/2/2
),(),(
),(),(
),(),(
M
x
Muxj
N
y
Nvyj
M
x
N
y
NvyjMuxj
vxGevuF
eyxfvxG
eyxfevuF
DFT properties: Separability
).( of rows of DFT
),(1
),(),(
1
0
/2
1
0
/2
yxfN
eyxfN
N
eyxfvxG
N
y
Nvyj
N
y
Nvyj
),( of columns of DFT
),(1
),(1
0
/2
vxGM
evxGM
MvuFM
x
Muxj
DFT properties: Separability
DFT properties: Separability
The DFT and its inverse are periodic.
),(),(),(),( NvMuFNvuFvMuFvuF
DFT properties: Separability
odd andimaginary ),( odd and real ),(
even and real ),( even and real ),(
),(),(
integersany , with ),,(),( *
vuFyxf
vuFyxf
vuFvuF
qpqNvpMuFvuF
DFT properties: Conjugate Symmetry
Translation in spatial domain:
Translation in frequency domain:
),(),( 00)//(2 00 vvuuFeyxf
NyvMxuj
)//(200
00),(),(NyvMxuj
evuFyyxxf
DFT properties: Translation
Warning: to show a full period, we need to translate
the origin of the transform at )2/,2/(),( NMvu
)(uF
)2
(N
uF
DFT properties: Translation
)2/,2/()1)(,(
),(),(
Using
)1(
caseIn that
2/ and 2/ replace
)2/,2/(at ),( move To
)(
00)//(2
)()()//(2
00
00
00
nvMuFyxf
vvuuFeyxf
ee
NvMu
NMvuF
yx
NyvMxuj
yxyxjNyvMxuj
DFT properties: Translation
without translation after translation
)2/,2/()1)(,( )( nvMuFyxf yx
DFT properties: Translation
by rotates by rotating ),,(),( vuFyxf
DFT properties: Rotation
transform Fourier the is ][ where
)],([)],([)],(),([
)],([)],([)],(),([
yxgyxfyxgyxf
yxgyxfyxgyxf
DFT properties: Addition and Multiplication
)0,0(1
),(
),()0,0(
),(1
),(
1
0
1
0
1
0
1
0
FMN
yxf
yxfF
yxfMN
yxf
M
x
N
y
M
x
N
y
:image the of value Average
DFT properties: Average value of the signal
Original Image Fourier Amplitude Fourier Phase
Magnitude and Phase of DFT
What is more important?
Hint: use inverse DFT to reconstruct the image using magnitude or phase only information
magnitude phase
Reconstructed image using
magnitude only
(i.e., magnitude determines the
contribution of each component!)
Reconstructed image using
phase only
(i.e., phase determines
which components are present!)
Magnitude and Phase of DFT
Magnitude and Phase of DFT
Low pass filtering using DFT
High pass filtering using DFT
Experiment: Verify the importance of phase in images
Reconstruction from
phase of one image and amplitude of the other
phase of cameraman phase of grasshopper
amplitude of grasshopper amplitude of cameraman
Experiment: Verify the importance of phase in images
Reconstruction from
phase of one image and amplitude of the other
phase of buffalo phase of rocks
amplitude of rocks amplitude of buffalo
DFT of a single edge
• Consider DFT of image with single edge.
• For display, DC component is shifted to the centre.
• Log of magnitude of Fourier Transform is displayed
DFT of a box
DFT of rotated box
DFT computation: Extended image
• DFT computation assumes image repeated
horizontally and vertically.
• Large intensity transition at edges = vertical and
horizontal line in middle of spectrum after shifting.
Windowing
• Can multiply image by windowing function before
DFT to reduce sharp transitions between borders of
repeated images.
• Ideally, causes image to drop off towards ends,
reducing transitions