1. 2 第四章 医学图像的变换 the fourier transform 3 in a sense, the fourier transform is...
TRANSCRIPT
1
2
第四章 医学图像的变换
The Fourier Transform
3
In a sense, the Fourier transform is like a second language for describing functions. Bilingual persons frequently find one language better than another for expressing certain ideas.
The Fourier transform is a very important tool for digital image processing and analysis, for anyone who intends to use digital image processing seriously in their work, however, the time spent becoming familiar with the Fourier transform is well invested.
4
f(t) F(S)Fourier transform
Spatial domain Frequency domain
Working in the frequency domain gives many more opportunities for the image analyst. To convert an image between the spatial and the frequency domain we use the Fourier transform. This is practical because of the Fast Fourier Transform algorithm (FFT). Two principle areas of application are filtering and focus correction.
5
Fourier transform has two main strongpoints:
1 、 can obtain the signal magnitude at every frequency point.
2 、 can transform convolution operation into product operation.
6
7
8
磁共振成像 (MRI, Magnetic Resonance Imaging) 技术是研究以不同的射频 (RF, Radio Frequency) 脉冲序列对组织激励后,用线圈检测技术获得组织弛豫信息和质子密度信息,通过图像重建形成磁共振图像的方法和技术。
9
1 、 the Fourier transform of one- dimensional functions :
the Fourier transform of one-dimensional continuous functions
dxexfuF uxj 2)()(
dueuFxf uxj 2)()(
10
1
0
2)()(
N
x
N
uxj
exfuF
1
0
2)(
1)(
N
u
N
uxj
euFN
xf
u=0,1,…,N-1
x=0,1,…,N-1
the Fourier transform of one-dimensional discrete functions
11
Use Euler Formula
F(u) can be described as follows:
1
0
1
0
2)/2sin()/2cos()()()(
N
x
N
x
N
uxj
NuxjNuxxfexfuF
)()()()()( ujeuFujIuRuF
polar coordinates
12
13
Temporal ----amplitude Frequency----amplitude
14
15
16
• Every periodic function can be represented as the sum of sine and cosine functions (basis function)----at early 19th.(1807) ---Fourier series
• Each coefficient describes the 1D sinusoidal function needed to reconstruct the function f(x)
Frequency domain can be applied to a non- periodic function if it is nonzero over a finite range------Fourier transform---
• Transform a function between a time and freq. domain
Fourier transform
17
• Fourier series
其中
an 和 bn 表示第 n 个谐振函数的振幅大小。确定这些系数的过程称为 Fourier 分析。假设有下述函数:
t
F(t)
A
-AT
18
• 它是一个方波函数,即 t = 0 至 t = ½T
间 F(t) = +A 而 t = ½T 至 t = T 间 F(t) = -A ,函数的周期为 T 。它可以展开如下:
19
20
Time and Frequency
• example : sin(ω t) + (1/3)sin(3 ω t)
21
Time and Frequency• example : F(t) = sin(ω t) + (1/3)sin(3 ω t)
= +
22
Time and Frequency• example : F(t) = sin(ω t) + (1/3)sin(3 ω t)
= +
23
Time and Frequency• example : g(t) = {
= +
=
1, a/2 < t < a/2 0, elsewhere
24
Time and Frequency• example : g(t) = {
= +
=
1, a/2 < t < a/2 0, elsewhere
25
Time and Frequency• example : g(t) = {
= +
=
1, a/2 < t < a/2 0, elsewhere
26
Time and Frequency• example : g(t) = {
= +
=
1, a/2 < t < a/2 0, elsewhere
27
Time and Frequency• example : g(t) = {
=
1, a/2 < t < a/2 0, elsewhere
1
1sin(2 )
k
A ktk
28
Time and Frequency• If the shape of the function is far from regular wave
its Fourier expansion will include infinite num of frequencies.
= 1
1sin(2 )
k
A ktk
29
Approximating Arbitrary Functions with Sinusoidal Sums
courtesy of H. Hel-Or
30
Sine & Cosine Functions: Review
courtesy of H. Hel-Or
31
Sine Function: Amplitude & Phase
courtesy of H. Hel-Or
nonlinearoperation
32
Combining Sine & Cosine Waves for Linear Shifting
Using this result, we can define a sinusoidal basis
courtesy of H. Hel-Or
Observation: Adding a sine wave to a cosine wave with the same frequency yields a scaled
and shifted (co)-sine wave with the same frequency
33
2 、 the Fourier transform of two- dimensional functions :
the Fourier transform of two-dimensional continuous functions
dxdyeyxfvuF vyuxj )(2),(),(
dudvevuFyxf vyuxj )(2),(),(
Where f(x,y) is an image and F(u,v)is its spectrum. F(u,v) is , in general, a complex-valued function of two real frequency variables u and v. the variable u corresponds to frequency along the x-axis, and similarly for v and the y-axis.
34
• Discrete Fourier Transform (DFT)
– Imaginary part
– Real part
1
0
1
0
2
),(1
),(M
x
N
y
N
vy
M
uxi
eyxfMN
vuF
1
0
1
0
2cos),(1
),(M
x
N
yr N
vy
M
uxyxf
MNvuF
1
0
1
0
2sin),(1
),(M
x
N
yi N
vy
M
uxyxf
MNvuF
35
•Inverse Fourier Transform
1
0
1
0
2
),(1
),(M
x
N
y
N
vy
M
uxi
evuFMN
yxf
36
•The image can be decomposed into a weighted sum ofsinusoids and cosinuoids of different frequency.
•Fourier transform gives us the weights
dudvevuFyxf vyuxj )(2),(),(
1
0
1
0
2
),(1
),(M
x
N
y
N
vy
M
uxi
evuFMN
yxf
37
(F)(F) )(2sin),(
)(2cos),(
),(),( )(2
jIRdxdyvyuxyxfj
dxdyvyuxyxf
dxdyeyxfvuF vyuxj
38
F(u,v) is a complex number, with real and imaginary parts. We can thus define the magnitude and phase of F(u,v):
),(),(),(),(),( vujevuFvujIvuRvuF
Thus, magnitude and phase are given by:
),(
),(tan),(
),(),(),(
1
22
vuR
vuIvu
vuIvuRvuF
39
■ The previous equations allow us to decompose an array of complex coefficients into arrays of magnitudes and phases.
■ Magnitudes – amplitudes of the basis images in the Fourier representation.
■ Array of magnitudes is the amplitude spectrum.
■ Array of phases is the phase spectrum.
■ When we talk about the ‘spectrum’, we normally mean the amplitude spectrum, which is more significant in terms of interpretation. However, both are needed to reconstruct an image from the frequency to the spatial domain.
■ Another term used is the power spectrum, or spectral density:
),(),(),(),( 222 vuIvuRvuFvuP
40
■ Calculating a single value of F(u,v) involves a summation over all pixels in the image
■ Note that the dynamic range of Fourier spectra is usually much higher than that of a typical display device, so that only the brightest parts of the image are visible on the display screen.
■ To compensate for this we often display the following:
),(1log),( vuFcvuD
Where c is a scaling constant and the logarithmic function performs the desired compression.
This greatly facilitates visual analysis of Fourier spectra.
41
Example
Original Amplitude Phase
Using mag. onlyUsing phase. only
42
Both the magnitude and the phase functions are necessary for the complete reconstruction of an image from its Fourier transform.
Neither the magnitude information nor the phase information is sufficient to restore the image.
43
Matrix Formulation
In matrix notation, the DFT can be written as
G=FgF
Where
Nikjik e
NfF /21
i,k=0,1,2,……,N-1
44
1,10,1
1,00,0
...
.........
...
NNN
N
ff
ff
F
45
Please educe the DFT matrix F used for 4X4 image
N=4, i,k=0,1,2,3
jjj
jj
jjj
jjjj
jjjj
jjjj
jjjj
eee
ee
eee
eeee
eeee
eeee
eeee
F
42
46
23
2
42
42
42
42
42
42
42
42
42
42
42
42
42
42
42
42
1
11
1
1111
2
1
4
1
1230
2020
3210
0000
46
jje
je
jjee
j
j
jj
2
3sin
2
3cos
1sincos
2sin
2cos
46
242
jj
jjF
11
1111
11
1111
2
1
47
Exercises:
1 、 calculate the follow image’s DFT
0100
0100
0100
0100
g
2 、 educe the matrix F used for calculating a 8X8 image’s DFT
48
Fourier Transform
1,...,2,1,0,
}/)(2exp{),(1
),(
,1,...,2,1,0,
}/)(2exp{),(1
),(
1
0
1
0
1
0
1
0
Nyxfor
NvyuxjvuFN
yxf
andNvufor
NvyuxjyxfN
vuF
N
u
N
v
N
x
N
y
• When the images are sampled in a square array, NxN, then
49
3 、 Properties of Fourier Transform
• Seperability
• Translation
• Periodicity and Conjugate Symmetry
• Rotation
• Distributivity and Scaling
• Convolution
• Correlation
50
Separability• The principle advantage of the separability property is that
F(u,v) or f(x,y) can be obtained in two steps by successive applications of the 1-D Fourier transform or its inverse.
1,...,2,1,0,
}2
exp{),(}2
exp{1
),(
,1,...,2,1,0,
}2
exp{),(}2
exp{1
),(
1
0
1
0
1
0
1
0
Nyxfor
N
vyjvuF
N
uxj
Nyxf
andNvufor
N
vyjyxf
N
uxj
NvuF
N
u
N
v
N
x
N
y
51
52
Translation• The translation properties of the Fourier transform pair are
}/)(2exp{),(),(
}/)(2exp{),(),(
0000
0000
NyvxujvuFyyxxf
and
NyvxujyxfvvuuF
where the double arrow indicates the correspondence between
a function and its Fourier transform (and vice versa)
53
对一幅 M*N 的图像 f(X,Y), 经 Fourier 变换后 ,如
果把频率平面的原点从 (0,0) 平移到 (M/2,N/2),
计算 f(X,Y) 应乘的因子 .
54
Periodicity andConjugate Symmetry
• The discrete Fourier transform and its inverse are periodic with period N; that is
),(),(),(),( NvNuFNvuFvNuFvuF
• If f(x,y) is real, the Fourier transform also exhibits conjugate symmetry:
),(),( * vuFvuF
• or, more interestingly,
),(),( vuFvuF
55
Rotation• Let the polar coordinates
sincossincos vuryrx
then f(x,y) and F(u,v) become f(r,and F(,), respectively.
Direct substitution in Fourier transform pair yields
),(),( 00 Frf
In other word, rotating f(x,y) by an angle 0 rotates F(u,v) by
the same angle.
56
57
Distributivity and Scaling• The Fourier transform and its inverse are distributive over
addition but not over multiplication.
)},({)},({)},(),({
general,in and,
)},({)},({)},(),({
2121
2121
yxfyxfyxfyxf
yxfyxfyxfyxf
• For two scalar a and b,
),(1
),(and),(),(b
v
a
uF
abbyaxfvuaFyxaf
58
59
Average Value• The average value of 2-D discrete function is
1
0
1
02
),(1
),(N
x
N
y
yxfN
yxf
• Substituting u=v=0 in the Fourier transform equation yields
1
0
1
02
),(1
)0,0(N
x
N
y
yxfN
F
• Therefore, the average value can be obtained by
)0,0(1
),( FN
yxf
60
Fuv(0,0)
61
Laplacian• The Laplacian of a two-variable function f(x,y) is defined
as
2
2
2
22 ),(
y
f
x
fyxf
• From the definition of the 2-D Fourier transform, we have
),(2),( 2222 vuFvuyxf
62
Convolution• The convolution of two functions f(x,y) and g(x,y), denoted
by f(x,y)*g(x,y), is defined by
ddyxgfyxgyxf
),(),(),(),(
• Then, we have
),(),(),(),(
and
),(),(),(),(
vuGvuFyxgyxf
vuGvuFyxgyxf
63
Correlation• The correlation of two functions f(x,y) and g(x,y), denoted
by f(x,y) o g(x,y), is defined by
conjugate.complex theis*where
),(),(),(),( * ddyxgfyxgyxf
• Then, we have
and),(),(),(),(
),(),(),(),(*
*
vuGvuFyxgyxf
vuGvuFyxgyxf
64
Optical Transformation• It is common practice to transform the viewing output
from the frequency transform into an optical image with the frequency 0 in the center.
A B
D C
C D
B A
Original frequencydomain image
Optical transformed
65
66
Fourier transform• Radius (pixels) % image power
• 8 95
• 16 97
• 32 98
• 64 99.4
• 128 99.8
67
4 、 The concept of Basis imagesThe concept of basis functions
■ Techniques for the analysis and manipulation of spatial frequency are based on the work of Jean Baptiste Joseph Fourier.
■ The key idea is that any periodic function, however complex, can be represented as a sum of sines and cosines.
■ Thus, for a function with period L:
10
2sin
2cos)(
nnn L
nxb
L
nxaaxf
■ The set of sine and cosine functions are known as the basis functions.
■ A weighted sum of these basis functions is known as a Fourier Series.
■ The weighting factors an and bn are the Fourier coefficients.
68
Fourier Coefficients
10
2sin
2cos)(
nnn L
nxb
L
nxaaxf
L
n
L
n
L
dxL
nxxf
Lb
dxL
nxxf
La
dxxfL
a
0
0
0
0
.2
sin).(2
.2
cos).(2
).(1
69
Square wave reconstruction
n = 2n = 5
n = 10 n = 50
70
Extension to two dimensions
0 0
)(2)(2),(
u vuvuv L
vyuxCosB
L
vyuxSinAyxf
■ In two dimensions, the basis functions are 2D sine and cosine functions.
■ A Fourier series of a 2D function f(x,y) can be written as follows:
■ Where u and v are the number of cycles fitting into one horizontal and vertical period, respectively.
■ This Fourier series can be used to represent any image and we can visualize the basis functions as ‘basis images’.
■ If u=0 and v=0, the basis image is constant, with value a00. The is the mean grey level in the image.
■ Higher terms in u and v introduce the fluctuations about this mean level that are needed to represent changes in grey level across the image.
71
spatial frequency所谓空间频率是指在一定方向上的单位空间(距离)波动的周期数 , 它不仅具有大小而且具有方向 , 是一个矢量 . 频率是单位时间内波动的次数,是一个标量。
72
73
74
Frequency: f= (u2 + v2)1/2 (number of times the wave repeats itself in a given length)• Wavelength: = 1/f• Direction: = tan-1(v/u)•p--phase (position that the wave starts)
75
dudvevuFyxf vyuxj )(2),(),(
76
Fourier 基图像• 由 2D 离散 Fourier 反变换可知,由于 u 和
v 均有 0,1,….N-1 的 N 个可能的取值,所以 f(x,y) 由 N2 个频率分量组成,所以每个频率分量都与一个特定的( u,v) 值相对应;
• 对于某个特定的( u,v) 值来说,当 (x,y) 取遍所有可能的值( x,y=0,1,2,…N-1) 时,就可以得到对应于该特定的( u,v) 值的一幅基图像。
77
1
0
1
0
2
),(1
),(N
x
N
y
N
vyuxj
evuFN
yxf
NvNuN
NvuN
NvuN
NvNu
Nvu
Nvu
NvNu
Nvu
Nvu
vu
jjj
jjj
jjj
f
)1()1(1)1(0)1(
)1(11101
)1(01000
,
(2exp...)(2exp)(2exp
............
)(2exp...)(2exp)(2exp
)(2exp...)(2exp)(2exp
显然,对应于不同( u,v) 值的基图像工有 N2 幅,且它们与 f(x,y) 无关,如果把实部和虚部分开,则可分别得到 N2 幅实部基图像和虚部基图像。
78
Fourier reconstruction in two dimensions
1
0
1
0
2
),(1
),(M
x
N
y
N
vy
M
uxi
evuFMN
yxf
79
Any image cab be represented by a linear combination of basis images.
Image Representation
1
0
1
0
2
),(1
),(M
x
N
y
N
vy
M
uxi
evuFMN
yxf
80
Image Representation
• Recall our discussion of basis vectors for coordinate systems:– Describe point as linear combination of ortho-gonal
basis vectors: x = a1v1 + ... + anvn
• The standard basis for images is the set of unit vectors corresponding to each pixel. A toy example:
81
Another Image Basis• The standard basis is not the only one we can use to describe an i
mage• E.g., the Hadamard basis (basis images shown here for 2
x 2 images, where black = +1, white = -1)– For the previous example, we can express the image with these new
(normalized) basis vectors as:
Note that the number of basis images = Image dimensions (w x h)
82
一、三角函数系的正交性1 、正交的定义:
如果 是 [a,b] 上两个不同的可积函
数,且满足 ,那么称 在
上是正交的。
)(),( xx
)(),( xx 0)()( b
adxxx
2 、三角函数系的正交性 三角函数系
在区间 上是正交的,也即
,sin,cos,,2sin,2cos,sin,cos,1 nxnxxxxx
],[
.
上的积分等于零以上任意两个不同函数在 ],[
83
,0cos
nxdx
,0sin
nxdx
),3,2,1( n
),3,2,1( n
,,
,0sinsin
nm
nmnxdxmx
,,
,0coscos
nm
nmnxdxmx
.0cossin
nxdxmx ),2,1,( nm其中
以上都可以通过有关积分运算来验证。
84
Orthonormal Basis
Definition: to a function set Sn(t), n is an integer, if in an area [0,T],
T
mn mnif
mnifkdttStS
0 0)()(
Then , we call the set is orthogonal. If k=1, we call the set is orthonormal. The basis functional set of Fourier transform ejnt is orthonormal.
85
Every image is constructed by basis image set
u
v
Nvyuxje /)(2
86
Fourier Basis
• The Fourier basis uses the following family of complex sinusoidal functions
Real(cos) part
Imaginary(sin) part
(u, v) (1, 0) (0, 5)(1, 1)
87
v
Fourier Basis (Imaginary part)
88
89
90
+
+
+
91
Fourier 变换后的图像,中间部分为低频部分,越靠外边频率越高。
幅度谱:二维频率空间的每个点的幅值(实部和虚部的平方和的平方根)格式化为显示灰度级
92
作业 4
• 傅立叶变换有哪些主要的性质?• 试叙述 Fourier 变换的物理意义及其应用。• 对一幅 M*N 的图像 f(X,Y), 经 Fourier
变换后 , 如果把频率平面的原点从 (0,0)平移到 (M/2,N/2), 计算 f(X,Y) 应乘的因子 .