image processing (rry025)fy.chalmers.se/~romeo/rry025/notes/lec5.pdf · 2009. 7. 3. · a copy of...
TRANSCRIPT
-
IMAGE PROCESSING (RRY025)
THE CONTINUOUS 2D FOURIER TRANSFORM
1
-
INTRODUCTION
• A vital tool in image processing.
Also a prototype of other image transforms, cosine, Wavelet
etc.
• Applications
Image Filtering - Smooth or sharpen images.
Image Restoration - Remove distortions, such as blurring,
image motion
Image Classification - Distinguish different types of images
Image Compression - Can be used but much better trans-
forms available.
2
-
1-D CONTINUOUS FOURIER TRANSFORMS
• Definition
F (ν) =∫ ∞−∞ f(t)exp(−2πiνt)dt
f(t) =∫ ∞−∞ F (ν)exp(+2πiνt)dν
Note forward and inverse transforms not the same, sign dif-
ference in integral.
• Other Definitions
F (ω) =∫ ∞−∞ f(t)exp(−iωt)dt
f(t) =1
2π
∫ ∞−∞ F (ω)exp(+iωt)dω
or
F (ω) =1√2π
∫ ∞−∞ f(t)exp(−iωt)dt
f(t) =1√2π
∫ ∞−∞ F (ω)exp(+iωt)dω
3
-
• FT has real and imaginary parts
F (ν) =∫ ∞−∞ f(t)exp(−2πνit)dt
Real[F (ν)] =∫ ∞−∞ f(t)cos(−2πνt)dt
Imag[F (ν)] =∫ ∞−∞ f(t)sin(−2πνt)dt
• If f(t) is even (f(t) = f(−t)) the imaginary part of trans-form Imag[F (ν)] = 0 because sin(−2πνt) is an odd (anti-symmetric) function.
• Likewise if f(t) is antisymmetric so (f(t) = −f(−t)) the realpart of the transform Real[F (ν)] = 0 because cos(−2πνt)is an even (symmetric) function.
• Define Fourier amplitude =√
Real[F (ν)]2 + Imag[F (ν)]2
and define Fourier Phase = tan−1(Imag[F (ν)]/Real[F (ν)])
4
-
2-D CONTINUOUS FOURIER TRANSFORMS
F (u, v) =∫ ∞−∞
∫ ∞−∞ f(x, y)exp(−2πi(ux + vy))dxdy
f(x, y) =∫ ∞−∞
∫ ∞−∞ F (u, v)exp(+2πi(ux + vy))dudv
• where u,v are spatial frequencies.
• If the image has linear dimensions, e.g. centimetres. the u,vare in units of cycles/cm
• If image has angular dimensions (e.g degrees) then u,v are incycles/degree.
5
-
• From the definition to calculate 2D FT component at particu-lar u,v multiply image f(x,y) by the complex kernel function
exp(−2πi(ux + vy)) and integrate.
• the kernel has constant value on lines in the the u,v domainsuch that ux + vy = constant.
• The Kernel function is therefore like a ’corrugated roof’ withan orientation which depends on u,v and a wavelength ∝1/√
u2 + v2.
6
-
• 2D Fourier Transform has a separable kernel
exp(−2πi(ux + vy)) = exp(−2πiux)exp(−2πivy)
Therefore
F (u, v) =∫ ∞−∞
∫ ∞−∞ f(x, y)exp(−2πi(ux + vy))dxdy
=∫ ∞−∞
[∫ ∞−∞ f(x, y)exp(−2πiux)dx
]
exp(−2πivy)dy
• This property means we can do the FT of any object in twostages. First do a 1D transform of each row
f(x, y) ⇒ f ′(u, y).
Then do a 1D transform of all the columns of f ′(u, y) so
f ′(u, y) ⇒ g(u, v).
7
-
• Some input images are also separable into functions of x andy i.e
f(x, y) = fx(x)fy(y)
.
• In this special case only.
F (u, v) =[∫ ∞−∞ fx(x)exp(−2πiux)dx
] [∫ ∞−∞ fy(y)exp(−2πivy)dy
]
i.e. the FT is the product of the 1D FTs of fx(x) and fy(y)
respectively.
8
-
FOURIER TRANSFORM PROPERTIES
• If f(x, y) is real (as images always are) then
F (u, v) is Hermitian
i.e. F (−u,−v) = F ∗(u, v)where ∗ indicates complex conjugate
• If f(x, y) is also symmetric (i.e. f(−x,−y) = f(x, y) ) then
F (u, v) is entirely real, i,e, the phase of F(u,v) is either 0◦ or180◦.
9
-
FOURIER TRANSFORMS PROPERTIES(cont)
• Inner Product
∫ ∞−∞
∫ ∞−∞ f(x, y)g
∗(x, y)dxdy =∫ ∞−∞
∫ ∞−∞ F (u, v)G
∗(u, v)dudv
if f(x, y) = g(x, y) and F (u, v) = G(u, v) then we obtain
Parsevals’ thereoem.
• Scaling
FT [f(ax, by)] =F (u/a, v/b)
|ab|
• Shifting
FT [f(x − xo, y − yo)] = F (u, v)exp(−2πi(uxo + vyo))
10
-
2D Delta Function Definition
The delta function situated at x = xo, y = yo, called
δ(x − xo, y − yo)is defined in the limit as dx, dy go to zero below
height = 1/ (dx dy)
x
y
dy
FunctionValue
xo
yo
(x-xo, y- yo)δ
Is above function as dx and dy go to zero
it therefore has value infinity at x=xo,y=yoand value zero elsewhere.
The area under the function is 1.
dx
Figure 1:
11
-
SOME IMPORTANT 2D FOURIER TRANSFORMS
Delta Function
FT (δ(x − xo, y − yo) = exp(−2πi(uxo + vyo))
−50
5
−5
0
50
0.5
1
x
Delta function at x=1,y=−2
y
−500
50
−50
0
50−1
0
1
u
Real Part of FT
v −500
50
−50
0
50−1
0
1
u
Imaginary Part of FT
v
Figure 2:
12
-
Two Delta Functions
FT (0.5δ(x−xo, y−yo)+0.5δ(x+xo, y+yo)) = cos(−2π(uxo+vyo))
−50
5
−5
0
50
0.5
1
x
Two Delta functions at x=+/−2,y=0
y
−500
50
−50
0
50−1
0
1
u
Real Part of FT
v −500
50
−50
0
50−1
0
1
uv
Imaginary Part of FT
Figure 3:
13
-
Sampling Function
Defined as
III∆x,∆y(x, y) =m=∞
∑
m=−∞
n=∞∑
n=−∞δ(x − m∆x, y − n∆y)
FT (III∆x,∆y(x, y)) = III∆u,∆u(u, v)
where ∆u = 1/∆x and ∆v = 1/∆y
−20
2
−20
2
0
0.5
1
1.5
x
Sampling Function (Infinite Delta grid sep=1)
y
−20
2
−20
2
0
0.5
1
u
Real Part of FT (Infinite Delta grid Sep =1)
v −20
2
−20
2
0
0.5
1
uv
Img Part of FT
Figure 4:
14
-
Gaussian
FT (exp(−π(x2 + y2)) = exp(−π(u2 + v2))
−20
2
−2
0
20
0.5
1
x
Gaussian Function
y
−20
2
−2
0
20
0.5
1
u
Real Part of FT
v −20
2
−2
0
2−1
0
1
uv
Imaginary Part of FT
Figure 5:
15
-
Circular Top Hat
Consider a function of x,y which is 1 inside r =√
(x2 + y2)
and 0 outside. Its FT is circulary symmetric and depends oly
on the radius in the u,v plane ru,v =√
(u2 + v2) . The FT is
related to a Bessel function of the first kind divided by ru,v.
−50
5
−5
0
50
0.5
1
x
Circular Top Hat Function
y
−50
5
−5
0
5−2
0
2
4
u
Real Part of FT
v −50
5
−5
0
5−1
0
1
uv
Imaginary Part of FT
Figure 6:
16
-
CONVOLUTION
DEFINITION If
g(x, y) = h(x, y) ∗ f(x, y)where ∗ indicates convolution then mathematically g(x, y)
=∫ ∞−∞
∫ ∞−∞ h(x
′, y′)f(x − x′, y − y′)dx′dy′
=∫ ∞−∞
∫ ∞−∞ h(x − x
′, y − y′)f(x′, y′)dx′dy′
17
-
VISUALIZING 2D CONVOLUTION
����
����
����
����
����
����
x’
y’
x’
y’
x’
y’
x’
y’
x
y
For this value of x,y shift of rotated For this value of x,y shift of rotated
second function, result of multiplicationof two functions and integration is 1
second function, result of multiplicatioof two functions and integration is 0
x
y
f(x’,y’) two delta functions
h(x’,y’) 1 inside triangle, 0 outside
f(x’,y’)h(x−x’,y−y’) f(x’,y’)h(x−x’,y−y’)
Figure 7:
18
-
VISUALIZING 2D CONVOLUTION(cont)
����
���� x’
y’
x’
y’
f(x’,y’) two delta functions
h(x’,y’) 1 inside triangle, 0 outside
*
= x
yg(x,y)
Do the operation on the previous sheet for every possible x,y and then build uppoint by point the g(x,y) function. Effect of convolution with delta functions is to make
not rotateda copy of the triangle function centred on each of the deltas. Note in output triangles
Figure 8:
19
-
CONVOLUTION THEOREM
The convolution theorem will be used many times. If g,h and
f functions are related by a convolution (see above) then their
fourier transforms G(u, v), F (u, v) and H(u, v) are related,
viz if
g(x, y) = h(x, y) ∗ f(x, y)
Then
G(u, v) = H(u, v) × F (u, v)
It also follows that if in the spatial domain
g(x, y) = h(x, y) × f(x, y)then in the Fourier domain
G(u, v) = H(u, v) ∗ F (u, v)
20
-
CORRELATION
Exactly like convolution but with NO 180 degree rotation of
second function, before shift multiplication and summation.
DEFINITION If
g1(x, y) = h(x, y) ∗ ∗f(x, y)where ∗∗ indicates cross-correlation then mathematically g1(x, y)
=∫ ∞−∞
∫ ∞−∞ h(x
′, y′)f(x′ − x, y′ − y)dx′dy′
unlike convolution the order matters,
g2(x, y) = f(x, y) ∗ ∗h(x, y)is not the same output function where g2(x, y)
=∫ ∞−∞
∫ ∞−∞ f(x
′, y′)h(x′ − x, y′ − y)dx′dy′
In previous lecture have seen how correlation with various
filters can be used to smooth, sharpen and find gradients of
images. Can also be used to ’recognise’ objects in an image.
Note get ’Autocorrelation’ if wto imput images are teh same.
21
-
CORRELATION THEOREM
Similar to convolution if we Fourier transform an image which
is the correlation of two input images, there is a simple re-
lationship between this FT and the FT of the two original
images.
If
g1(x, y) = h(x, y) ∗ ∗f(x, y)
and we take the FT then
G1(u, v) = H(u, v) × F ∗(u, v)where the star indicates complex conjugate. In the case of
autocorrelation, f =h amd F=H hence the FT of the auto-
correlation of h(x,y) is everywhere real and positive and is
called the ’power spectrum’ of h(x,y).
22