0% found this document useful (0 votes)
722 views49 pages

Module 2 21EC732

Uploaded by

nikitatenjarla14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
722 views49 pages

Module 2 21EC732

Uploaded by

nikitatenjarla14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Module 2: Image Transforms

(Chapter 5 from Anil. K. Jain)


Transform Representation (1D)
• Represent a vector f as the weighted combination of some basis
vectors hn . Weights tn are called transform coefficients
• An N-dimensional vector needs N non-linearly dependent bases

+
t1 t2 t3 t4

h1 h2 h3 h4

2
One Dimensional Linear Transform
• Let CN represent the N dimensional complex space.
• Let h0, h1, …, hN-1 represent N linearly independent
vectors in CN.
• Any vector f єCN can be represented as a linear
combination of h0, h1, …, hN-1 :

N 1
f   t(k)h k  Bt,
k 0

 t(0)  t  B1f  Af
 t(1) 
where B  [h 0 ,h1 ,...,h N 1 ], t   . f and t form a transform pair
 ⁝ 
 
 t(N 1)
3
Inner Product
• Definition of inner product N 1
 f1 ,f 2  f1 f 2   f1 (n) f 2 (n)
H *

n0

• Orthogonal  f1 ,f 2  0
N 1
• 2-Norm of a vector  f, f  f f   | f (n) |2
2 H
f
n0

• Normalized vector: unit norm f 2


1

• Orthonomal = orthogonal + normalized

4
Orthonormal Basis Vectors (OBV)
1 k  l
 h k ,h l   k ,l 
• {hk, k=0,…N-1} are OBV if 0 k  l

• With OBV
N 1 N 1
 h l ,f  h l ,  t(k)h k   t(k)  h l ,h k  t(l)  h l H f
k 0 k 0

hH 
 0H 
 h1 
t  f  B H
f  Af
 ⁝ H
hN 1 

B 1  B H , or B H B  BB H  I. B is unitary

5
Definition of Unitary Transform

• Basis vectors are orthonormal


• Forward transform N 1
t(k)  h k ,f   hk (n)* f (n),
n0

 h H0 
 hH 
t   1 f  B H f  Af
 ⁝ 
 H 
• Inverse transform h N 1 

N 1
f (n)   t(k)hk (n), 𝐴𝐻 = 𝐴∗ 𝑇
k 0 𝐴𝐻 = 𝐴𝑇 if 𝐴 is real
N 1
f   t(k)h k h 0 h1 ! h N 1 t  Bt  A H t
k 0

6
2-D orthogonal and unitary
transforms

 Orthogonal series expansion for an NN image


u(m, n)
N 1 N 1

v(k,l)   u(m,n)a
m0 n0
k ,l
(m,n) 0  k,l  N  1
N 1 N 1

u(m,n)   v(k,l)a
k 0 l0
*
k ,l
(m,n) 0  m,n  N  1

 v(k, l)’s are the transform coefficients, V  {v(k,l)}


represents the transformed image
 {a k ,l (m,n)} is a set of orthonormal functions,
representing the image transform
7 Digital Image Processing-21EC732 11/28/2024
Orthonormality and
completeness
 {a (m, n)} must satisfies
k ,l

N 1 N 1

orthonormality : 
m0 n0
*
a k ,l (m,n)a k,l (m,n)   (k  k ,l  l )
N 1 N 1

completeness :  a
k 0 l0
k ,l
(m,n)a k*,l (m,n )   (m  m,n  n )

8 Digital Image Processing-21EC732 11/28/2024


Matrix representation of image
transform
N 1 N 1 N 1 N 1
 v(k,l)   u(m,n)a
m0 n0
k ,l
(m,n) U 
k 0 l0
v(k,l)A *k ,l
N 1 N 1

u(m,n)   v(k,l)a
k 0 l0
*
k ,l
(m,n) v(k,l)  U, A *k ,l 
N 1 N 1

  F,G   f (m,n)g (m,n)


m0 n0
*
is the matrix inner product
 Image U can be described as a linear combination
*
of N 2 matrix A k ,l , k, l = 0,...,N-1
*
 A k ,l are called the basis images

 v(k, l) can be considered as the projection of u(m, n) on

9
the (k, l)-th basis image
Digital Image Processing-21EC732 11/28/2024
 Basis images

10 Digital Image Processing-21EC732 11/28/2024


2-D Separable image
transformation
 {a (m, n)} is separable
k ,l

a k ,l (m, n)  a k (m)bl (n)  a(k ,m)b(l, n)


N 1 N 1
v(k ,l)    a(k ,m)u(m,n)a(l,n)  V  AUAT
m0 n0
N 1 N 1
u(m,n)   a *
(k ,m)v(k ,l)a *
(l,n)  U  A *T
VA *

k 0 l0

 A  {a(k,m)} B  {b(l, n)} are unitary matrices


 Consider the above as “transforming columns of U by
A, then transforming rows of the result by AT
11 Digital Image Processing-21EC732 11/28/2024
Example of image transform

 Given 1 1 1 , U  


1 2

A
2 1 1  3 4
1 1 1 
 1 2 
 1 1   5 1
compute transform V 
2 1 1 3 41 1   2 0 

1 1 1 1 1


Basis images A 0,0
*
  1 1
2 1 2 1 1
1 1 1 1 1  1  1 1
A*0 ,1   1 1   A1,*T0 A1,1  
*

2 1 2 1 1 2  1 1 

1 1 1  5 1
 1 1   1 2 

*T
A VA 
*

12 Digital Image Processing-21EC732 2 1 1  2
 0 1 1   3 4  11/28/2024
Properties of unitary transform
 Given v  Au (A is a unitary transform)
v  u
2 2
 , i.e., energy-conserved
 a unitary transformation is a rotation of the basis
coordinates , or a rotation of the vector u in N-
Dimensional vector space
 Unitary transform tends to concentrate most of the
signal energy on a small set of transform
coefficients
 µ v  Aµ u R v  AR uA*T
13 Digital Image Processing-21EC732 11/28/2024
Properties of unitary transform
(cont)

 The transform coefficients tends to be decorrelated,


i.e., the off-diagonal elements of R v are
approaching zero
 The entropy of a random vector is preserved under
a unitary transformation (i.e., information
preserved)

14 Digital Image Processing-21EC732 11/28/2024


1-D DFT
 1-D DFT pair (unitary transformation)
N 1


1 k  0,..., N  1
v(k)  u(n)W kn
N
N n0

N 1


1 v(k)WNkn n  0,..., N  1
u(n) 
N k 0

 j2 
WN  exp 
 N 
 N×N transform matrix F for v  Fu
 1 
F WN ,
kn
0  k, n  N 1
 N
Digital Image Processing-21EC732
 11/28/2024
15
Properties of DFT
 Symmetry F  F T  F 1  F * (unitary : F 1  F )
*T

 FFT needs O(N log N ) operations (DFT needs O(N 2 ) )


2

 Real DFT is conjugate symmetrical about N/2


N N
v* (  k)  v(  k)
2 2
 x 2 (n) is the circular convolution between h(n) and x1 (n)
DFT{x 2 (n)}N  DFT{h(n)} N DFT{x1 (n)}N
 Extend the length of h(n) ( N ) and x1 (n) (N) with zeros to have the
same length ( M  N   N  1 ), the above equation can be used to
compute linear convolution

16 Digital Image Processing-21EC732 11/28/2024


2-D DFT
 2-D DFT is a separable transform
N 1 N 1


1
v(k,l)  u(m,n)W NkmW Nln 0  k,l  N  1
N m0 n0

N 1 N 1


1
u(m,n)  v(k,l)W NkmW Nln 0  m,n  N  1
N k 0 l 0

 In matrix form
V  FUF T  FUF

17 Digital Image Processing-21EC732 11/28/2024


Properties of 2-D DFT
 Symmetric and unitary  F  F and F  F T 1 *

 Periodic  v(k  N ,l  N )  v(k,l)


 V  FUF needs 2N times of 1-D FFT
T

 DFT of real images is conjugate symmetrical with


respect to ( N , N )
2 2
v(k,l)  v * (N  k, N  l)
 N 2 basis images
1
WN( kmln) ,0  m, n  N  1 0  k,l  N  1
N
18 Digital Image Processing-21EC732 11/28/2024
Plots of DFT

19 Digital Image Processing-21EC732 11/28/2024


Cosine transform
 DCT (discrete cosine transform)
 1
 , k  0,0  n  N 1
N
c(k, n)  
 2 cos  (2n 1)k
, 1  k  N 1,0  n  N 1
 N 2N
 8×8 2-D DCT

20 Digital Image Processing-21EC732 11/28/2024


Properties of DCT
 DCT is real and orthogonal  C  C and C  C * 1 T

 DCT ≠ Real {DFT}


 DCT can be calculated via FFT
~
v(k)  Re[ (k)W2kN/ 2 DFT{u(n)} ]
N

 u~(n)  u(2n) N
u~(N  n  1)  u(2n  1) 0  n  ( ) 1
 2

 For highly correlated data, DCT has good energy


compaction. That is, for first-order stationary Markov
sequence with correlation   1, DCT is approximate
21
toProcessing-21EC732
Digital Image KL transform 11/28/2024
Haar Transform

22 Digital Image Processing-21EC732 11/28/2024


Haar Transform

23 Digital Image Processing-21EC732 11/28/2024


Haar Transform

24 Digital Image Processing-21EC732 11/28/2024


Haar Transform

25 Digital Image Processing-21EC732 11/28/2024


Haar Transform

26 Digital Image Processing-21EC732 11/28/2024


Haar Transform

27 Digital Image Processing-21EC732 11/28/2024


Haar Transform

28 Digital Image Processing-21EC732 11/28/2024


Haar Transform

29 Digital Image Processing-21EC732 11/28/2024


Haar Transform

30 Digital Image Processing-21EC732 11/28/2024


Haar Transform

31 Digital Image Processing-21EC732 11/28/2024


Sine transform
 DST (discrete sine transform)
2  (k  1)(n  1) ,
 (k, n)  sin 0  k,n  N  1
N 1 N 1
 Properties
 DST is real, symmetric, and orthogonal.  ψ ψ ψ
* T
 ψ1

 DST and DST-1 are the same in the form (cf. DCT)
 DST≠ Imagery {DFT}
 For first-order stationary Markov sequence with
correlation   (-0.5, 0.5), the energy compaction of
DST is approximate to KL transform
32 Digital Image Processing-21EC732 11/28/2024
(Walsh-) Hadamard transform
Kronecker
 Hadamard matrix operator
H n1 
1 1  H n  H n1  H1  1  n1
H
H1  1  
2  1 1  2  H n1  H n1 
 Components of HT vector contain only 1 and -1
 The number of transitions from 1 to -1 is called
sequency (like  in the continuous case)
1 1 1 1 1 1 1 1 0
1
 1 1 1 1 1 1 1 7 sequency
1 1 1 1 1 1 1 1 3
  Not in order
1 1 1 1 1 1 1 1 1  4
H3 
8 1 1 1 1 1 1 1 1 1

1 1 1 1 1 1 1 1  6
1 1 1 1 1 1 1 1
Digital Image Processing-21EC732   2
33 1 11/28/2024
1 1 1 1 1 1 1 5
(Walsh-) Hadamard transform
(cont.)
 Hadamard transform pair :
N 1


1
v(k )  b ( k ,m )
0  k  N 1
v  Hu N
u(m)(1) ,

m0

u  Hv
N 1


1
u(m)  v(k)(1) b ( k ,m )
, 0  m  N 1
N k 0

k m
n1

b(k,m)  i i
k i ,mi  0,1
i0

 Notice the disordering effect in the sequency in


HT spectrum when filtering will be performed

34 Digital Image Processing-21EC732 11/28/2024


Properties of Hadamard
transform
Real, symmetric, and orthogonal  H  H  H  H * T 1

 Fast computation (only addition is needed)


 Can be decomposed into product of sparse matrix
~
H  Hn  H n n  log 2 N
1 1 0 0 . . . . 
0 
 0 1 1 0 . . . 
~n ~~ ~
. . . . . . . . 
  v  Hu  u ... u
~ 1 0
H
0 . . . . 1 1 H HH H
2 1 1 0 0 . . . . 
0 0 1 1 0 . . .
. . . . . . . . 
 
0 0 . . . . 1 1

 For highly correlated images, Hadamard transform also has


good energy compaction
35 Digital Image Processing-21EC732 11/28/2024
Plot of Hadamard transform

36 Digital Image Processing-21EC732 11/28/2024


37 Digital Image Processing-21EC732 11/28/2024
38 Digital Image Processing-21EC732 11/28/2024
KL transform of 1-D vector
 For a real N×1 random vector u with autocorrelation matrix
R, KL transform of u is defined as
v  Φ*T u u  Φ v
where Rφ   φ , 0  k  N  1 , i.e., φ k’s are orthonormalized
k k k

eigenvectors of R and φ k is the k-th column of 


  reduces R to its diagonal form, i.e.,
Φ*T RΦ Λ  Diag{k }
 If we replace R with R 0  R µ µ T, then eigenmatrix of R 0
is the KL transform of u-
 KL transform is independent of the image data themselves,

39
butProcessing-21EC732
Digital Image related to its 2nd-order statistics 11/28/2024
KL transform of 2-D image
 FFT, DCT, DST all are special cases of KL transform
 For an image u(m, n) of N×N pixels, its autocorrelation
function denoted as r(m,n;m ,n ) (or an N  N R matrix), 2 2

the basis images of the KL transform are  k ,l (m,n) :


N 1 N 1
0  k,l  N  1

m0 n0
r(m,n;m ,n ) k ,l (m ,n )  k ,l k ,l (m,n)
0  m, n  N  1

or Rψi  iψ i i  0,..., N 2  1


ψ i is the N 1 vector representation of  k ,l (m,n)
2

40 Digital Image Processing-21EC732 11/28/2024


KL transform of 2-D image
(cont.)
 If R matrix is separable, then Ψ  {ψ } of N  N is also
i
2 2

separable
Kronecker
R  R1  R 2 Ψ  Φ1 Φ2 operator

where Φj R jΦ*Tj  Λ j , j  1,2


 KL transform : v  Ψ*T
u or V  Φ UΦ *T
1
*

 Advantages of this separability : reduce


2 the eigenvalue
problem of R matrix ( N  N ) into two eigenvalue
2 2

problems of R1, R2 ( N  N )

41 Digital Image Processing-21EC732 11/28/2024


Properties of the KL transform
 Decorrelation
{v(k ), k  0,..., N  1}are uncorrelated and have zero mean
  is not unique, not necessarily be the eigenmatrix of R

 Minimum basis restriction error


u A v Im w B z
NN 1≦m≦N NN

 Signal u is transformed via A to be v, clip the first m values by Im


to form w, and transformed back to z via B。The basis restriction
error is defined as

J m  1 E  2 
N 1


1
u(n)  z(n)   Tr[E{(u  z)(u  z)*T }]
N  n0  N
42 Digital Image Processing-21EC732 11/28/2024
Properties of the KL transform (cont.)
 Minimum transmission rate at a given distortion
 In a noisy channel, given a distortion specification,
1
 D E[(u  u. )*T (u  u. )]
 Find A KL and B KL (KL transform) such that J m is minimized for
each value of m [1, N ] . (KL is effective in compacting the energy)
 Select A  Φ*T and B  Φ , AB  I , and columns of  are sorted
according to their corresponding eigenvalues       .....  
0 1 2 N 1

N
KL transform can, among all unitary transformation A (include A
= I ), achieve the minimum transmission rate 
R(Φ*T )  R(A)
u A v v. u.
Digital Image Processing-21EC732(unitary)
channel A*T
43 11/28/2024
An example of KL-transform

 A 21 vector u, whose covariance matrix is


 1 
R ,  1
 1 
The KL transform is
1 1 1 
Φ  Φ *T
 
2 1 1 
v  Φ u E{[v(0)]2}  0  1   , E{[v(1)]2 }  1  
1 1 1   )  max(0, 1 log 1  
R(Φ)  [max(0, log )]
2 2  2 
comparing R(I)  1 [2log ], 0  1
4
44 R(Φ)  R(I)
Digital Image Processing-21EC732 Let  be small, say   1  11/28/2024
Comparison of energy distribution
between transforms
 For first-order stationary Markov process with
large , DCT is comparable to KL
 With small , DST is comparable to KL
 For any , we can find a faster sinusoidal
transform (DCT or DST) to substitute for the
optimal KL transform which needs covariance
matrix to compute transform basis vectors

45 Digital Image Processing-21EC732 11/28/2024


46 Digital Image Processing-21EC732 11/28/2024
Comparison of Image Transforms

47 Digital Image Processing-21EC732 11/28/2024


48 Digital Image Processing-21EC732 11/28/2024
49 Digital Image Processing-21EC732 11/28/2024

You might also like