Download Fourier Transform-Digital Image Processing-Lecture 08 Slides Slides-Electrical and Computer Engineering and more Slides Digital Image Processing in PDF only on Docsity!
Electrical & Computer Engineering Dr. D. J. Jackson Lecture 8-
Computer Vision &
Digital Image Processing
Fourier Transform
Introduction to the Fourier transform
- Let f(x) be a continuous function of a real variable x
- The Fourier transform of f(x), denoted by ℑ { f(x) } is given by:
- where
- Given F(u), f(x) can be obtained by using the inverse Fourier
transform:
∫
+∞
−∞
ℑ{ f ( x )}= F ( u )= f ( x )exp[− j 2 π ux ] dx
j = − 1
∫
+∞
−∞
−
( )exp[ 2 ].
1
F u j ux du
F u f x
π
Electrical & Computer Engineering Dr. D. J. Jackson Lecture 8-
The Fourier transform (continued)
- These two equations, called the Fourier transform pair, exist
if f(x) is continuous and integrable and F(u) is integrable.
- These conditions are almost always satisfied in practice.
- We are concerned with functions f(x) which are real,
however the Fourier transform of a real function is, generally,
complex. So,
- where R(u) and I(u) denote the real and imaginary
components of F(u) respectively.
F ( u )= R ( u )+ jI ( u )
The Fourier transform (continued)
- Expressed in exponential form, F(u) is:
- where
- and
- The magnitude function |F(u)| is called the Fourier
spectrum of f(x)
- and ϕ(u) is the phase angle.
( )
j u
F u F u e
ϕ
2 2 F u = R u + I u
−
( ) tan
1
R u
Iu
ϕ u
Electrical & Computer Engineering Dr. D. J. Jackson Lecture 8-
Fourier transform example
- Consider the following simple function. The Fourier
transform is:
X
A
0 x
f(x)
juX
juX juX juX
j uxX j uX
X
uXe u
A
e e e j u
A
e j u
A
e j u
A
A j uxdx
Fu f x j uxdx
π
π π π
π π
π π
π
π π
π
π
−
− −
− −
+∞
−∞
sin( )
[ ]
[ 1 ]
[ ]
exp[ 2 ]
() ( )exp[ 2 ]
2 0
2
0
Fourier transform example (continued)
function. The Fourier
spectrum is:
- A plot of |F(u)| looks like
the following:
sin( )
() sin( )
uX
uX AX
uX e u
A
F u
juX
π
π
π π
π
−
Electrical & Computer Engineering Dr. D. J. Jackson Lecture 8-
The 2-D Fourier transform
- The Fourier transform can be extended to 2
dimensions:
- and the inverse transform
{ ( , )} ( , ) ( , )exp[ 2 ( )].
∫ ∫
+∞
−∞
ℑ f x y = Fuv = f x y − j π ux + vy dxdy
{ ( , )} ( , ) ( , )exp[ 2 ( )].
1 ∫ ∫
+∞
−∞
− ℑ F uv = f x y = F uv j π ux + vy dudv
The 2-D Fourier transform (continued)
- The 2-D Fourier spectrum is:
- The phase angle is:
- The power spectrum is:
2 2 F uv = R uv + I uv
−
( , ) tan
1
Ru v
Iuv
ϕ uv
2 2
2
R uv I u v
Puv Fuv
Electrical & Computer Engineering Dr. D. J. Jackson Lecture 8-
Example 2-D functions and their spectra
The discrete Fourier transform
- Suppose a continuous function, f(x), is discretized into a
sequence
{f(x 0 ), f(x 0 +Δx), f(x 0 +2Δx), ….., f(x 0 +[N-1]Δx)}
- by taking N samples Δx units apart
- Let x refer to either a continuous or discrete value by saying
- where x assumes the discrete values 0, 1, …, N-1 and
- {f(0),f(1),…,f(N-1)} denotes any N uniformly spaced samples
from a corresponding continuous function
( ) ( ) 0 f x = f x + x Δ x
Electrical & Computer Engineering Dr. D. J. Jackson Lecture 8-
Sampling a continuous function
The discrete Fourier transform pair
- The discrete Fourier transform is given by:
- for u=0, 1, … ,N-
- The discrete inverse Fourier transform is given by:
- for x=0, 1, … ,N-
- The values of u=0, 1, … ,N-1in the discrete case correspond
to samples of the continuous transform at 0, Δu, 2Δu, …, (N-
1)Δu
Δu and Δx are related by Δu=1/(N Δx)
∑
−
=
1
0
( )exp[ 2 / ]
N
x
f x j ux N N
Fu π
∑
−
=
1
0
( ) ( )exp[ 2 / ]
N
u
f x Fu j π ux N
Electrical & Computer Engineering Dr. D. J. Jackson Lecture 8-
Discrete Fourier transform example
- Consider sampling at x 0 =.5, x 1 =.75, x 2 =1.0, and x 3 =1.
- Here Δx=.25 and x ranges from 0 → 3
Discrete Fourier transform example
(continued)
- The four corresponding Fourier transform terms are
- 25
[ 2 3 4 4 ] 4
1
[ ( 0 ) ( 1 ) ( 2 ) ( 3 )] 4
1
()exp[ 0 ] 4
1 ( 0 )
3
0
=
= + + +
= + + +
=
f f f f
F fx x
[ 2 ] 4
1
[ 2 3 4 4 ] 4
1
()exp[ 2 / 4 ] 4
1 ( 1 )
0 / 2 3 / 2
3
0
j
e e e e
F fx j
j j j
x
= − +
= + + +
= −
− − −
=
π π π
π
[ 1 0 ] 4
1 F ( 2 )= − + j [ 2 ] 4
1 F ( 3 )=− + j
Electrical & Computer Engineering Dr. D. J. Jackson Lecture 8-
Discrete Fourier transform example
(continued)
• The Fourier spectrum is then
F ( 0 ) = 3. 25
( 1 ) [( 2 / 4 ) ( 1 / 4 ) ] 5 4
2 2 1 / 2
F = + =
( 2 ) [( 1 / 4 ) ( 0 / 4 ) ] 1 4
2 2 1 / 2
F = + =
( 3 ) [( 2 / 4 ) ( 1 / 4 ) ] 5 4
2 2 1 / 2
F = + =
Properties of the 2-D Fourier transform
• The dynamic range of the Fourier spectra is
generally higher than can be displayed
• A common technique is to display the function
• where c is a scaling factor and the logarithm
function performs a “compression” of the data
• c is usually chosen to scale the data into the range
of the display device, [0-255] typically ([1-256] for
256 gray-level MATLAB image)
D ( u , v )= c log [ 1 + F ( u , v )]
Electrical & Computer Engineering Dr. D. J. Jackson Lecture 8-
Translation
- The translation properties of the Fourier transform pair are
- and
- where the double arrow indicates a correspondence
between a function and its Fourier transform (or vice versa)
- Multiplying f(x,y) by the exponential and taking the transform
results in a shift of the origin of the frequency plane to the
point (u 0 ,v 0 ).
( , )exp[ 2 ( )/ ] ( , ) 0 0 0 0
f x y j π u x + vy N ⇔ F u − u v − v
( , ) ( , )exp[ 2 ( )/ ] 0 0 0 0
f x − x y − y ⇔ F uv − j π ux + vy N
Translation (continued)
- For our purposes, u 0 =v0 =N/2. Therefore,
- and
- So, the origin of the Fourier transform of f(x,y) can be moved
to the center of the corresponding NxN simply by multiplying
f(x,y) by (-1) x+y^ before taking the transform
- Note: This does not affect the magnitude of the Fourier
transform
x y
j xy j ux vy N e
exp[ 2 ( )/ ]
( ) 0 0
π
f ( x , y )( 1 ) F ( u N / 2 , v N / 2 )
x y
Electrical & Computer Engineering Dr. D. J. Jackson Lecture 8-
Matlab example
%Create data for the test
f=zeros(128);
for x=1:
for y=1:
f(x,y)=128;
end
end
% Perform a translation shift on f(x,y)
for x=1:
for y=1:
f(x,y)=f(x,y)*((-1)^(x+y));
end
end
Matlab example (continued)
% Compute the 2-D discrete Fourier transform
F=fft2(f);
% Compute the Fourier spectrum
Fspect=sqrt(real(F).^2+imag(F).^2);
% Construct a scaling factor based on
% the dynamic range of the spectrum
FspectMAX=max(max(Fspect));
% Compute D, the scaled data
D=(256/(log(1+FspectMAX)))*log(1+Fspect);
figure(1);
% Plot, as an image, a subset of D
image(D(56:74,56:74));colormap(gray(256));