dft properties: separability

advertisement
DIGITAL IMAGE PROCESSING
Part I: Image Transforms
1-D SIGNAL TRANSFORM
GENERAL FORM
• Scalar form
{ f ( x), 0  x  N  1}
N 1
g (u)  T (u, x) f ( x)
x 0
• Matrix form
g  T f
0  u  N 1
1-D SIGNAL TRANSFORM cont.
REMEMBER THE 1-D DFT!!!
• General form
{ f ( x), 0  x  N  1}
N 1
g (u)  T (u, x) f ( x)
x 0
0  u  N 1
• DFT
N 1
1
g (u )  
x 0 N
ux
 j 2
N
e
f ( x)
1-D INVERSE SIGNAL TRANSFORM
GENERAL FORM
• Scalar form
N 1
f ( x)   I ( x, u ) g (u )
u 0
• Matrix form
1
f T g
1-D INVERSE SIGNAL TRANSFORM cont.
REMEMBER THE 1-D DFT!!!
• General form
{ f ( x), 0  x  N  1}
N 1
f ( x)   I ( x, u ) g (u )
u 0
• DFT
ux
N 1 j 2
N g (u )
e
f ( x)  
x 0
0  u  N 1
1-D UNITARY TRANSFORM
• Matrix form
g  T f
T
1
T
T
SIGNAL RECONSTRUCTION
T
1
T
T
T
N 1

f  T  g  f ( x)   T (u, x) g (u)
u 0
IMAGE TRANSFORMS
• Many times, image processing tasks are best
performed in a domain other than the spatial
domain.
• Key steps:
(1) Transform the image
(2) Carry the task(s) in the transformed domain.
(3) Apply inverse transform to return to the
spatial domain.
2-D (IMAGE) TRANSFORM
GENERAL FORM
N 1 N 1
g (u , v)    T (u , v, x, y ) f ( x, y )
x 0 y 0
N 1N 1
f ( x, y )    I ( x, y, u, v) g (u, v)
u 0 v 0
2-D IMAGE TRANSFORM
SPECIFIC FORMS
• Separable
T (u, v, x, y)  T1 (u, x)T2 (v, y)
• Symmetric
T (u, v, x, y)  T1 (u, x)T1 (v, y)
• Separable and Symmetric
g  T1  f T
T
1
• Separable, Symmetric and Unitary
f
T
 T1
g

T1
ENERGY PRESERVATION
• 1-D
g  f
2
2
• 2-D
M 1 N 1
2
M 1 N 1
  f ( x, y )    g (u , v)
x 0 y 0
u 0 v 0
2
ENERGY COMPACTION
Most of the energy of the original data
concentrated in only a few of the
significant
transform
coefficients;
remaining coefficients are near zero.
Why is Fourier Transform Useful?
• Easier to remove undesirable frequencies.
• 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
noisy signal
frequencies
To remove certain
frequencie s, set their
correspond ing F (u )
coeeficien ts to zero!
remove high
frequencies
reconstructed
signal
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
2-D DISCRETE FOURIER TRANSFORM
M 1N 1
F (u, v)    f ( x, y)e
 j 2 (ux / M vy / N )
x 0 y 0
1 M 1N 1
j 2 (ux / M vy / N )
f ( x, y) 
  F (u, v)e
MN u 0 v 0
Visualizing DFT
• Typically, we visualize F (u, v)
• The dynamic range of F (u, v) is typically
very large
• Apply stretching: D(u, v)  c log[1  F (u, v) ]
( c is constant)
original image
before scaling
after scaling
Amplitude and Log of the Amplitude
Amplitude and Log of the Amplitude
Original and Amplitude
DFT PROPERTIES: SEPARABILITY
Rewrite F (u, v) as follows:
M 1
F (u , v)   e
 j 2ux / M
x 0
N 1
 f ( x, y )e
y 0
If we set:
N 1
G ( x, v )   f ( x, y )e
 j 2vy / N
y 0
Then:
M 1
F (u , v)   e
x 0
 j 2ux / M
G ( x, v )
 j 2vy / N

DFT PROPERTIES: SEPARABILITY
• How can we compute G( x, v) ?
N 1
G ( x, v )   f ( x, y ) e
 j 2vy / N
y 0
 1 N 1
 j 2vy / N 

 N  
 f ( x, y ) e
 N y 0

N  DFT of rows of f ( x. y )
• How can we compute F (u, v) ?
 1 M 1
 j 2ux / M 
F (u, v)  M 

 G( x, v)e
 M x 0

M  DFT of columnsof G( x, v)
DFT PROPERTIES: SEPARABILITY
DFT PROPERTIES: PERIODICITY
The DFT and its inverse are periodic with
period N
F (u, v)  F (u  M , v)
 F (u, v  N )  F (u  M , v  N )
DFT PROPERTIES: SYMMETRY
If
F (u, v) is real, then
F (u , v)  F (u ,v)  F (u, v)  F (u ,v)
*
f ( x, y ) real and even  F (u, v) real and even
f ( x, y ) real and odd  F (u , v) imaginary and odd
DFT PROPERTIES: TRANSLATION
• Translation in spatial domain:
f ( x  x0 , y  y0 )  F (u, v)e
 j 2 (u0 x / M v0 y / N )
• Translation in frequency domain:
f ( x, y)e
j 2 (u0 x / M v0 y / N )
 F (u  u0 , v  v0 )
DFT PROPERTIES: TRANSLATION
Warning: to show a full period, we need to
translate the origin of the transform at u 
(u, v)  ( M / 2, N / 2)
N /2
F (u )
N
F (u  )
2
DFT PROPERTIES: TRANSLATION
To move F (u, v) at ( M / 2, N / 2)
take u 0  M / 2 and v0  N / 2
In that case
j 2 (u0 x / M  v0 y / N )
e
Using
f ( x, y )e
e
j ( x  y )
j 2 (u0 x / M  v0 y / N )
f ( x, y )(1)
( x y)
 (1)
( x y)
 F (u  u0 , v  v0 ) 
 F (u  M / 2, v  n / 2)
DFT PROPERTIES: TRANSLATION
f ( x, y)(1)
( x y)
 F (u  M / 2, v  n / 2)
no translation
after translation
DFT PROPERTIES: ROTATION
rotating f ( x, y) by  rotates F (u, , v) by 
DFT PROPERTIES
ADDITION-MULTIPLICATION
[ f ( x, y)  g ( x, y)]  [ f ( x, y)]  [ g ( x, y)]
[ f ( x, y)  g ( x, y)]  [ f ( x, y)]  [ g ( x, y)]
where [] is the Fourier transform
DFT PROPERTIES: SCALE
[ f ( x, y)  g ( x, y)]  [ f ( x, y)]  [ g ( x, y)]
[ f ( x, y)  g ( x, y)]  [ f ( x, y)]  [ g ( x, y)]
where [] is the Fourier transform
DFT PROPERTIES: AVERAGE
Average value of the image :
1 M 1 N 1
f ( x, y ) 
  f ( x, y )
MN x  0 y  0
M 1 N 1
F (0,0)    f ( x, y ) 
x 0 y 0
1
F (0,0)
f ( x, y ) 
MN
Original Image
Fourier Amplitude Fourier Phase
Magnitude and Phase of DFT
• What is more important?
magnitude
phase
• Hint: use inverse DFT to reconstruct the image
using magnitude or phase only information
Magnitude and Phase of DFT
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
Original Image-Fourier Amplitude
Keep Part of the Amplitude Around the Origin and Reconstruct Original
Image (LOW PASS filtering)
Keep Part of the Amplitude Far from the Origin and Reconstruct
Original Image (HIGH PASS filtering)
Reconstruction from
phase of one image and amplitude of the other
Reconstruction from
phase of one image and amplitude of the other
Download