Uploaded by muhammadfaizsyukra

kuliah 2B Overview of 2-D Systems and matrix 2022

advertisement
Kuliah 2.2 : Linear System & Matrix Review
Tati R. Mengko
Biomedical Engineering School of Electrical Engineering & Informatics
Institut Teknologi Bandung
LINEAR SHIFT INVARIANT (LSI)
SYSTEM
2
Some Special Functions
• Dirac Delta:
 (x, y ) =  (x) (y )


  f (x ', y ') (x − x ', y − y ')dx 'dy ' = f (x, y )
 
lim    (x, y )dxdy = 1
 

− −
→0
−
−
• Kronecker Delta:
 (m,n) =  (m) (n)
x (m,n) =


  x (m',n ') (m − m ',n − n ')
m '=− n '=


  (m,n) = 1
m=− n=
4
Some Special Functions
• Rectangle
1 x  1 dan y 
2
rect (x, y ) = 
0 lainnya
1
2
• Sinc 2-D
sin x sin y
sinc( x, y ) =
x y
• Comb
comb (k,l ) =


   (k − k ',l − l ')
k '=− l '=
5
2-D Linear System
H [.]
x(m,n)
y(m,n)
y(m,n) = H [x(m,n)]
• Linear system criterion:
H [a1x1(m,n) + a2x2(m,n)] = a1H [x1(m,n)] + a2H [x2(m,n)]
= a1 y1(m,n) + a2 y2(m,n)
• Impulse response:
System response (output) given a delta kronecker input:
h(m,n; m’,n’)  H [(m - m’, n - n’)]
– PSF (point spread function) → impulse response of system
whose inputs and outputs are always positive quantity, such as
intensity.
6
Point Spread Function (PSF)
The point spread function (PSF)
specifies the imaging quality:
• Visually indicates how much a
point object is spread over the
image/ how much blurring an
imaging system introduces
• Smaller spread, higher intensity
PSF ~ sharper, higher resolution
image
Image
3-D PSF Plot
7
Images from Wikipedia & Zeiss Microscopy
Point Spread Function (PSF)
LSI & CONVOLUTION
8
Defining convolution
• Let f be the image and g be the kernel. The output of
convolving f with g is denoted f * g.
( f  g)[m, n] =  f [m − k, n − l] g[k, l]
k,l
Convention:
kernel is “flipped”
f
• MATLAB functions: conv2, filter2, imfilter
Source: F. Durand
Convolution as Sum of Products
1 Flip the kernel
2
Center on source pixel, then do sum of products
3
Repeat step 2 for shifted source pixel
Original Convolution Kernel:
-4
0
0
0
0
0
0
0
4
Flipped (180⁰-rotated) Kernel:
4 0 0
0
0
0
0
0
-4
10
Key properties
• Linearity: conv(f1 + f2,g) = conv(f1,g) + conv(f2,g)
• Shift invariance: same behavior regardless of pixel
location: conv(shift(f),g) = shift(conv(f,g))
Any linear shift-invariant operator can be represented by
convolution
Most digital filtering in image processing are performed
as convolution
Image filter coefficients are represented as convolution
kernel coefficients
Properties in more detail
• Commutative: a * b = b * a
Conceptually no difference between filter and signal
• Associative: a * (b * c) = (a * b) * c
Applying several filters one after another:
(((a * b1) * b2) * b3)
is equivalent to applying one filter: a * (b1 * b2 * b3)
• Distributes over addition: a * (b + c) = (a * b) + (a * c)
• Scalars factor out: ka * b = a * kb = k (a * b)
• Identity: unit impulse e = […, 0, 0, 1, 0, 0, …],
a*e=a
Annoying details
What is the size of the output?
• MATLAB: filter2(g, f, shape)
• shape = ‘full’: output size is sum of sizes of f and g
• shape = ‘same’: output size is same as f
• shape = ‘valid’: output size is difference of sizes of f and g
full
g
same
g
g
f
g
valid
g
g
f
g
g
g
f
g
g
g
FOURIER TRANSFORM
16
The Fourier Transform
• 2-D Fourier/ Inverse Fourier Transform Formulations:
F (1, 2 ) = 

f (x, y ) = 



− −
 
− −
f (x, y )exp − j2 (x1 + y2 )dxdy
F (1 ,2 )exp  j2 (x1 + y2 ) d1d 2
f(x,y)
F(1, 2)
(x,y)
1
(x  x0, y  y0)
exp(j2x01). exp(j2y02)
exp(j2x01). exp(j2y0 2)
exp[-(x2 + y2 )]
(1 -+ 1, 2 -+ 2)
rect(x, y)
sinc(1, 2)
tri(x, y)
sinc2(1, 2)
comb(x, y)
comb(1, 2)
exp[-(12 + 22 )]
17
Properties of the Fourier Transform
1.
2.
3.
Spatial Frequencies
If f(x,y) is luminance and (x,y) is the spatial coordinates, then 1, 2 are the
spatial frequencies that represent luminance changes with respect to spatial
distances.
Uniqueness
Since for continuous functions f(x,y) and F(1,2) are unique with respect to
one another, Fourier transform of these functions does not cause any loss in
signal information.
Separability
By definition, the Fourier transform kernel is separable, so that it can be
viewed as a separable transformation in x and y.
F (1 ,  2 ) =
4.
  f (x, y ) exp ( − j2  x  )dx  exp ( − j2  y  )dy
1
2
−   − 


Frequency response and eigenfunctions
•
•
Frequency response → fourier transform of a shift-invariant system impulse
response.
Eigenfunctions of a linear shift-invariant system is a complex-exponential
function.
18
Properties of the Fourier Tranform
5.
Convolution theorem
The Fourier transform of the convolution of two functions is the product
of their Fourier transform:
g(x,y) = h(x,y)f(x,y)  G(1,2) = H(1,2)F(1,2)
6.
Spatial correlation
Spatial correlation of two signals can be defined as:
C(1,2) = H(-1,-2)F(1,2)
7.
Parseval Formula (~Energy Conversing)
 |f(x,y)|2dxdy =  |F(1,2)|2 d1d2
8.
Circular symmetry
The Fourier transform of a circularly symmetric function is also circularly
symmetric
19
2-D DTFT & DFT
The Discrete-time Fourier transform (DTFT) pair of a 2-D sequence x(m,n):
X (1 ,2 ) 


  x (m,n )exp − j (m
1
+ n2 )
m=− n=−
x (m,n) =
1
4
2


−
−
    X ( , )exp  − j (m
1
2
1
Aperiodic signal,
periodic transform
+ n2 )
The Discrete Fourier transform (DFT) pair of a 2-D sequence x(m,n):
Periodized signal,
periodic & sampled
transform
20
2-D DFT Transform: Magnitude
2-D DFT Transform: Magnitude
under translation & rotation
2-D DFT Transform: Phase Angle
under translation & rotation
2-D DFT Transform: Phase Angle
contains image structural information
MATRIX OPERATIONS
30
Matrix Theory
• One- and two-dimensional sequence will be represented as vectors
and matrices.
 u(1)
 u (2 )

u  u(n)= 
 ... 


 u (n )
 a(1,1)
 a(2,1)
A  a(m, n)= 
 ...

 a ( M ,1)
•
Transpose: AT = {a(m,n)}T = {a(n,m)}
•
Transposition and Conjugation Rules
a(1,2)
a(2,2 )
...
...
...
...
a ( M ,2) ...
a(1, N ) 
a(2, N ) 

...

a ( M , N )
1. A*T = [AT]*
2. [AB] = BTAT
3. [A-1]T = [AT]-1
4. [AB]* = A*B*
31
Toeplitz and Circulant Matrices
• A Toeplitz matrix T is a matrix that has constant elements alongthe
main diagonal and the subdiagonals.
• A matrix C is called circulant if each of its rows (or columns) is a
circular shift of the previous row (or columns)
 t0
 t
 1
T =  t2

 ...
tN−1
•
t −1
...
...
t0
t −1
...
...
...
...
...
...
t2
t1
t − N +1 
 c0


t− N +2 
 c N −1
...  C =  ...


... 
 c2
 c1
t 0 
c1
c0
...
...
c2
c2
c1
...
...
...
...
...
...
...
c N −1
c N −1 
c N − 2 
... 

... 
c N 
Note that C is also Toeplitz and:
c(m,n) = c((m,n) modulo N)
32
Example
•
A LSI (linear shift invariant) system
h(n)=n, -1n1 with input x(n) which is
zero outside 0n4, is given by the
convolution:
y(n) = h(n)x(n)= 0~4h(n-k)x(k).
1-D convolution = Toeplitz outer product
•
If two convolving sequences are
periodic, then their convolution is also
periodic and can be represented as
0 0
 y(−1)  −1 0 0
 y(0)   0 −1 0
0 0  x(0)



0 −1 0 0   x(1)
 y(1)   1


= 0
0
1
0
−1
 x(2)
 y(2)  
0 1
0 −1  x(3)
 y (3)   0


 y(4)  
0  x(4)
0 0 1

 0
 y(5)   0
0 0
0 1 
 y(0 )  3
 y (1)  0

 =
y(n) = 0~(N-1) h(n-k)x(k), 0 nN-1
 y(2 )  1

where h(-n) = h(N-4) and N is the period.  y(3)  2
2
1
3
2
0
1
3
0
Let N=4 and h(n)=n+3 (modulo 4).
1-D convolution of periodic signals = Circulant outer product
0  x(0)
1   x(1)
2  x(2)
3   x(3)
33
Separability
2D convolution
(center location only)
The filter factors
into a product of 1D
filters:
Perform convolution
along rows:
*
=
Followed by convolution
along the remaining column:
*
=
Source: K. Grauman
Why is separability useful?
• What is the complexity (: numbers of arithmetic
operation required) of filtering an n×n image with an
m×m kernel?
• O(n2 m2)
• What if the kernel is separable?
• O(2n2 m)
Separability of the Gaussian filter
Source: D. Lowe
DIY Reading: Eigen Decomposition
Definition: The eigenvalues of a real matrix M are the real numbers  for
which there is a nonzero vector e such that:
Me = e
The eigenvectors of M are the nonzero vectors e for which there is a real
number  such that Me =  e.
If Me =  e for e  0, then e is an eigenvector of M associated with
eigenvalue , and vice versa.
The eigenvectors and corresponding eigenvalues of M constitute the
eigensystem of M.
Eigen decomposition is mainly a way of stating a real matrix M as a
linear combination of its basis matrices/vectors
Applications: Eigenface
• Any face can be expressed as linear
combination of eigenfaces
• Face can be recognized based on the
characteristic coefficients of its
eigenfaces linear combination
•Tutorial & matlab code available online:
https://cnx.org/contents/m0ECB7MO@3/Ob
taining-the-Eigenface-Basis
https://en.wikipedia.org/wiki/Eigenface
Download