Академический Документы
Профессиональный Документы
Культура Документы
Outline
• Circular and linear convolutions
• 2D DFT
• 2D DCT
• Properties
• Other formulations
• Examples
2
Circular convolution
• Finite length signals (N0 samples) → circular or periodic convolution
N 0 −1
– the summation is over 1 period
– the result is a N0 period sequence c[k ] = f [k ] ⊗ g[k ] = ∑ f [ n] g[ k − n]
n=0
• The circular convolution is equivalent to the linear convolution of the zero-
padded equal length sequences
* =
m m m
Length=P Length=Q Length=P+Q-1
For the convolution property to hold, M must be greater than or equal to P+Q-1.
3
Convolution
f [ m] g[ m] f [m]* g[m]
* =
m m m
4-point DFT
(M=4)
F [k ] G[k ] F [k ]G[k ]
4
In words
• Given 2 sequences of length N and M, let y[k] be their linear convolution
+∞
y[k ] = f [k ] ∗ h[k ] = ∑ f [n]h[k − n]
n =−∞
• y[k] is also equal to the circular convolution of the two suitably zero padded
sequences making them consist of the same number of samples
N 0 −1
c[k ] = f [k ] ⊗ h[k ] = ∑ f [n]h[k − n]
n=0
N 0 = N f +N h − 1: length of the zero-padded seq
• In this way, the linear convolution between two sequences having a different length
(filtering) can be computed by the DFT (which rests on the circular convolution)
– The procedure is the following
• Pad f[n] with Nh-1 zeros and h[n] with Nf-1 zeros
• Find Y[r] as the product of F[r] and H[r] (which are the DFTs of the corresponding zero-padded
signals)
• Find the inverse DFT of Y[r]
6
2D Discrete Fourier Transform (2D DFT)
∞ ∞
F (u, v) = ∑∑ f [m, n]e − j 2π (um+ vn ) a-periodic signal
m =−∞ n =−∞ periodic transform
M −1 N −1 ⎛ k l ⎞
1 − j 2π ⎜ m + n ⎟
⎝ M N ⎠ periodized signal
F [k , l ] = ∑∑ f [m, n]e periodic and sampled
MN m=0 n =0
transform
7
2D DFT: Periodicity
M −1 N −1 ⎛ k l ⎞
1 − j 2π ⎜ m + n ⎟
⎝ M N ⎠
F [k , l ] = ∑ ∑ f [m, n]e
MN m=0 n =0
M −1 N −1 ⎛ k + M l + N ⎞
1 − j 2π ⎜
⎝ M
m+ n ⎟
N ⎠
F [k + M , l + N ] = ∑ ∑ f [m, n]e
MN m=0 n=0
1
M −1 N −1 ⎛ k l ⎞ ⎛ M N ⎞
1 − j 2π ⎜ m + n ⎟ − j 2π ⎜ m + n ⎟
⎝ M N ⎠ ⎝ M N ⎠
=
MN
∑ ∑ f [m, n]e
m=0 n =0
e
= F [k , l ]
f [k , l ] = f [k + mM , l ] = f [k , l + nN ] = f [k + mM , l + nN ]
M/2 M u
0
9
Periodicity: 1D
f [k ] ↔ F [u ] changing the sign of every other
j 2π
u0 k sample of the DFT puts F[0] at
f [k ]e M
↔ F [u − u0 ] the center of the interval [0,M]
u k Mk
M j 2π 0 j 2π
u0 = →e M
= e 2 M = e jπ k = (−1) k
2
M
(−1) k f [k ] ↔ F [u − ]
2
F[u] The two inverted periods meet here
M/2 M u
0
It is more practical to have one complete period positioned in [0, M-1]
10
Periodicity in 2D
1/M↔128
1/N↔128
11
Periodicity
fft2 fftshift(fft2)
0,0
0,0
0,127=1/M,1/N
12
Periodicity: 2D
DFT periods
-M/2
(0,0) M/2
4 inverted
periods meet F[u,v]
here
-N/2
13
Periodicity: 2D data contain one centered
F[u,v] complete period
N-1
j 2π (
u0 k v0 l
+ )
DFT periods
f [k , l ]e M N
↔ F [u − u0 , v − v0 ]
M N
u0 = , v0 = → MxN values
2 2 N/2
k +l ⎡ M N ⎤
(−1) f [k ] ↔ F ⎢u − , v − ⎥
⎣ 2 2 ⎦
(0,0) M/2 M-1
4 inverted
periods meet
here
14
Angle and phase spectra
F [ u , v ] = F [u , v ] e j Φ [ u , v ]
2 2 1/ 2
F [u , v ] = ⎡ Re {F [u , v ]} + Im {F [u , v ]} ⎤ modulus (amplitude spectrum)
⎣ ⎦
⎡ Im {F [u , v ]} ⎤ phase
Φ [u , v ] = arctan ⎢ ⎥
⎣ Re { F [ u , v ]} ⎦
2 power spectrum
P[u , v] = F [u , v ]
15
Translation and rotation
⎛ m n ⎞
j 2π ⎜ k + l ⎟
⎝ M N ⎠
f [k , l ]e ↔ F [u − m, v − l ]
⎛ m n ⎞
− j 2π ⎜ k + l ⎟
f [ k − m, l − n ] ↔ F [u , v ] ⎝ M N ⎠
16
DFT Properties: (5) Rotation
• Rotating f(x,y) by θ rotates F(u,v) by θ
mean value
N −1 M −1
1
F [0, 0] = ∑ ∑ f [n, m] DC coefficient
NM n =0 m=0
18
Separability
• The discrete two-dimensional Fourier transform of an image array is defined
in series form as
M −1 N −1 ⎛ k l ⎞
1 − j 2π ⎜ m + n ⎟
⎝ M N ⎠
F [k , l ] = ∑ ∑ f [m, n]e
MN m=0 n =0
• Inverse transform
M −1 N −1 ⎛ k l ⎞
j 2π ⎜ m + n ⎟
⎝ M N ⎠
f [m, n] = ∑ ∑ F [k , l ]e
k =0 l =0
• Because the transform kernels are separable and symmetric, the two dimensional
transforms can be computed as sequential row and column one-dimensional
transforms.
• The basis functions of the transform are complex exponentials that may be
decomposed into sine and cosine components.
19
2D DFT: summary
20
2D DFT: summary
21
2D DFT: summary
22
2D DFT: summary
23
Magnitude and Phase of DFT
magnitude phase
27
Ex. 2
28
Ex. 3
Magnitudes
29
Margherita Hack
30
Einstein
31
Examples
32
other formulations
2D Discrete Fourier Transform
M −1 N −1 ⎛ k l ⎞
1 − j 2π ⎜ m + n ⎟
⎝ M N ⎠
F [k , l ] = ∑ ∑ f [m, n]e
MN m=0 n =0
where l = 0,1,..., N − 1
k = 0,1,..., M − 1
• Inverse DFT
M −1 N −1 ⎛ k l ⎞
j 2π ⎜ m + n ⎟
⎝ M N ⎠
f [m, n] = ∑ ∑ F [k , l ]e
k =0 l =0
34
2D Discrete Fourier Transform
M −1 N −1 ⎛ k l ⎞
1 − j 2π ⎜ m + n ⎟
⎝ M N ⎠
F [k , l ] = ∑ ∑ f [m, n]e
MN m=0 n =0
where k = 0,1,..., M − 1
l = 0,1,..., N − 1
• Inverse DFT
M −1 N −1 ⎛ k l ⎞
1 j 2π ⎜ m + n ⎟
⎝ M N ⎠
f [m, n] = ∑ ∑ F [k , l ]e
MN k =0 l =0
35
2D Discrete Fourier Transform
• Or, as follows
M −1 N −1 ⎛ k l ⎞
− j 2π ⎜ m + n ⎟
⎝ M N ⎠
F [k , l ] = ∑ ∑ f [m, n]e
m =0 n =0
• Inverse DFT
M −1 N −1 ⎛ k l ⎞
1 j 2π ⎜ m + n ⎟
⎝ M N ⎠
f [m, n] = ∑ ∑ F [k , l ]e
MN k =0 l =0
36
2D DFT
• The discrete two-dimensional Fourier transform of an image array is defined
in series form as
• inverse transform
37
2D DCT
u,x=0,1,…, N-1
“mean” value
39
1D basis functions
Figure 1
40
2D DCT
• Corresponding 2D formulation
direct
u,v=0,1,…., N-1
inverse
41
2D basis functions
• The 2-D basis functions can be generated by multiplying the horizontally
oriented 1-D basis functions (shown in Figure 1) with vertically oriented set
of the same functions.
• The basis functions for N = 8 are shown in Figure 2.
– The basis functions exhibit a progressive increase in frequency both in the
vertical and horizontal direction.
– The top left basis function assumes a constant value and is referred to as the DC
coefficient.
42
2D DCT basis functions
Figure 2
43
Separability
The inverse of a multi-dimensional DCT is just a separable product of the inverse(s) of the
corresponding one-dimensional DCT , e.g. the one-dimensional inverses applied along one
dimension at a time
44
Separability
• Symmetry
– Another look at the row and column operations reveals that these operations are
functionally identical. Such a transformation is called a symmetric transformation.
– A separable and symmetric transform can be expressed in the form
T = AfA
– where A is a NxN symmetric transformation matrix which entries a(i,j) are given
by
• This is an extremely useful property since it implies that the transformation matrix can
be pre computed offline and then applied to the image thereby providing orders of
magnitude improvement in computation efficiency.
45
Computational efficiency
• Computational efficiency
– Inverse transform
– DCT basis functions are orthogonal. Thus, the inverse transformation matrix of A
is equal to its transpose i.e. A-1= AT.
• This property renders some reduction in the pre-computation complexity.
46
Block-based implementation
Basis function
Block-based transform
Block size
N=M=8
47
Energy compaction
48
Energy compaction
49
Appendix
• Eulero’s formula
50