BE244 Image Enhancement Frequency Domain
BE244 Image Enhancement Frequency Domain
Kio Kim
Sampling
Low-pass and High-pass Filters
1 2
(Opposite of cross-correlation)
Nonlinear filters:
Median filter
Particle filter etc.
3 4
7 8
9 10
11
http://www.ajronline.org/cgi/content/figsonly/190/5/1396
Discrete Fourier Transform
x = 25/512 x=25/128
= 0.05 mm/pixel =0.2 mm/pix
25mm 25mm
K (Matlab does not apply 1/N to the FT)
u = 1/Nx u = 1/Nx
= 1/25 =1/25
= 0.04 mm-1 = 0.04mm-1
Subsampling changes peak height (DC value) of FT (Matlab only) but the rate of zero crossings
is the same for both. 14
Functions are the same, but represented by a different number of frequency points => loss of
high frequency information.
Properties Properties
Translation:
[ ] [ ]
M 1 N 1
F uu0, v v 0=
1
MN
x=0 y=0
f x , y exp j 2
u0 x v0 y
M
N
exp j 2
ux vy
M N 2D Function (Image)
u x v y
f ( x, y ) exp j 2 0 0 F (u u0 , v v0 ) Shifting Property
M N
u0 x v 0 y
f ( x x 0 , y y0 ) F (u, v ) exp j 2
M N
FT of Image
Special Case: for u0 = M/2 exp j 2
u0 x v 0 y
1
x y
Useful for
v0 = N/2 M N centering FT or
x y M N IFT at the origin
f ( x, y ) 1 F u ,v
2 2
M N xy Shifted FT of Image
f x ,y F (u , v ) 1
2 2
15 16
(back of moon blade shown in FT) (Spokes in spatial domain and wrapping (aliasing; Moire pattern) shown.)
Properties Properties
M 1N1
1 ux vy
Separability: F (u, v)
MN
x 0 y 0
f ( x , y ) exp j 2
M N
for u = 0,1,2, ,M-1
v = 0,1,2, ,N-1
M 1 N1
1 j 2ux 1 j 2vy
M
exp
x 0 M N
y 0
f ( x, y ) exp
N
M 1
1 j 2ux
M
F ( x, v) exp
M
1D row FT
x 0
N1
1 j 2vy
where F ( x, v )
N
f ( x, y) exp N
1D column FT
y 0
17 18
http://www.ajronline.org/cgi/content/figsonly/190/5/1396
Properties Properties
1 M 1N1
ux vy Rotation: x r cos u cos polar coordinates
Periodicity: F (u, v)
MN
x 0 y 0
f ( x , y ) exp j 2
M N
for u = u+M
v = v+N y r sin v sin
f ( r , 0 ) F (, 0 )
M 1N1
1 Mx Ny ux vy [ f 1 x , y f 2 x , y ]= [ f 1 x , y ][ f 2 x , y ]
F (u M , v N )
MN
f ( x, y ) exp j 2
M
N
exp j 2
M N
Distributivity: Addition YES!
x 0 y 0
[ f 1 x , y f 2 x , y ] [ f 1 x , y ][ f 2 x , y ] Multiplication NO!
M 1N1
1 ux vy
MN
f ( x , y ) exp j 2
M N
F (u , v )
x 0 y 0
Scaling: af ( x , y ) aF (u , v )
1 u v
f ( ax , by ) F ,
ab a b
Conjugate
F (u , v ) F * ( u , v )
Symmetry:
M 1N1
1 ux vy
Average Value: F (u, v)
MN
x 0 y 0
f ( x , y ) exp j 2
M N
M 1N 1
1
Magnitude F (u, v ) F ( u , v )
for u = v = 0 (origin) F (0,0)
MN
f ( x, y ) The average of f(x,y) is the
Symmetry: x 0 y 0 value at the center of the
19 frequency matrix 20
(Think what zero frequency means---its flat!)
21 22
To perform a convolution, we assume f(x) and g(x) are periodic with a period P ! A B 1 f(x,y); 0 x A-1 & 0 y B-1
The resulting convolution will have the same period (P) and the individual f(x,y) =
periods will not overlap, ie no aliasing 0; AxP or B yQ
f ( x ); 0 x A 1 g ( x ); 0 x B 1
f ( x ) g ( x ) Zero-padded functions
g(x,y); 0 x C-1 & 0 y D-1
0; A x P 1 0; B x P 1
g(x,y) =
0; CxP or DyQ
P1
1
f ( x ) g ( x ) f p g ( x p)
P p 0
for x = 0,1,2, ,P-1
P1 Q 1
1
f ( x , y ) g ( x, y )
PQ p 0
f p, q g ( x p, y q ) for x = 0,1,2, ,P-1
y = 0,1,2, ,Q-1
q 0
Convolution Theorem: f ( x ) g ( x ) F (u)G (u )
f ( x ) g ( x ) F (u) G (u )
Convolution Theorem: f ( x, y) g ( x, y ) F (u, v)G (u, v)
23 f ( x , y ) g ( x , y ) F (u, v ) G (u , v ) 24
Convolution in Fourier Domain Sampling Distortion
x0
Dirac Delta Function, (x): ( x x0 ) dx ( x x0 ) dx 1 Band-limited Functions:
x 0
Sampling is Infinite in spatial domain
simply a Only defined on the frequency interval [-W,W]
convolution with f ( x )( x x 0 ) dx f ( x 0 ) Sifting Property Must be sampled at the Nyquist rate to avoid aliasing: x 1/(2W)
an impulse
function (x - x0)
f() g() - comb filter f(x)*g(x)
f(x) F(u)
x u
-W W
x
a -T T -T a T
27 28
http://upload.wikimedia.org/wikipedia/commons/3/31/Moire_pattern_of_bricks.jpg
Properties
2D Function (Image)
FT of Image
(Or, http://www.youtube.com/watch?v=Dyisg9-Mwjw
to see how sampling can distort what you see.)
29 30
(back of moon blade shown in FT) (Spokes in spatial domain and wrapping (aliasing; Moire pattern) shown.)
Frequency Domain Filters Frequency Domain Filters
Gaussian-based filters
Frequency filter H(u,v) suppresses certain frequency components in an image
u2
Low-pass filters smooth images by suppressing high frequency components (rapidly H (u ) A exp h( x ) 2 A exp 2u 2 2 2
x
changing intensities) 2 2
High-pass filters highlight edges by suppressing low frequency components (near-
constant intensities)
Spatial filters are applied to the image with a 2D convolution. By the convolution Gaussian filters are real in both the frequency
theorem and spatial domains, ie computation is
simpler than other filters
We use Gaussian functions often in
f ( x, y ) h( x , y ) F (u, v ) H (u , v ) where the prime indicates analyzing biological data because it best
that the images are padded appropriately describes the normal distribution of
observations that scientists make during an
PRO: Filtering in the frequency domain is often more intuitive, experiment. Because of this, the properties
Faster if your kernel image is big (O(N 2) vs O(N log N) for FFT) of the Gaussian are more intuitive to us (as Analogous
spatial filters
scientists) than other functions.
CON: Slower if your kernel image is small
Because these two functions form an FT pair,
Decide on the filter characteristics in the frequency domain but perform the filtering their behavior is reciprocal
in the spatial domain
31 32
33 34
G (u , v ) F (u, v ) H (u, v )
1; D(u, v ) D0
Ideal low-pass filter H (u , v ) where Do is a specified cutoff frequency
0; D(u, v ) " D0
37 38
No ringing!
39 40
41 42
High Pass Filters HPF - Spatial Representations
Find the appropriate H(u,v) to suppress low frequency components in F(u,v) and
generate G(u,v) with sharper intensity transitions (edges)
Gaussian
HPF
43 44
Ringing at small
D0
45 46
Gaussian HPF
Gaussian HPF D(u , v ) 2
H (u, v ) 1 exp 2
2 D0
47