You are on page 1of 67

DIGITAL IMAGE PROCESSING

(ELECTIVE - III) LA806-5


MODULE 2
Prepared by
AKAS G KAMAL
Asst. Professor
ECE Department
Amaljyothi College of Engineering
Module 2
• Image Transforms
• Two dimensional orthogonal & unitary
transforms
• Properties of unitary transforms –
• Two dimensional DFT & its properties
• Cosine – Hadamard – Haar – Sine - KL
Transforms & their properties.
Image Transform

• Transform is basically a mathematical


tool, which allows us to move from one
domain to another domain.
• Example : time domain to the frequency domain
• Transform changes the representation
of a signal by projecting it onto a set of
basis function
Need for transform
• Mathematical convenience
– Convolution in time domain<->Multiplication in
frequency domain
• To extract more information

• For efficient storage and transmission


• Pick a few “representatives” (basis)
• Just store/send the “contribution” from each
basis
Need for transform
Need for transform
Vectors and matrices
• A column vector U containing N
elements is denoted as
Vectors and matrices
What’s a basis ?

the vector going from the origin to that point is equal to a weighted sum of
the units vectors of the axes.

v=4i +2j
2

i 4 x
Fourier Transform: Concept
■ A signal can be
represented as a
weighted sum of
sinusoids.

■ Fourier Transform is a
change of basis, where
the basis functions
consist of sines and
cosines (complex
exponentials).

12
A vector space consists of a set of
vectors, a field of scalars, a vector
addition operation, and a scalar
Basis Vectors and Basis Images multiplication operation.
• A basis for a vector space ~ a set of vectors
– Linearly independent ~  a v = 0 if and only if all a =0
i i i
– Uniquely represent every vector in the space by their linear
combination
~  bi vi ( “spanning set” {vi} )
• Orthonormal basis
– Orthogonality ~ inner product <x, y> = y*T x= 0
– Normalized length ~ || x ||2 = <x, x> = x*T x= 1

• Inner product for 2-D arrays


– <F, G> = m n f(m,n) g*(m,n) = G*T F (rewrite matrix into vector)
2D Basis Matrices (Basis Images) 
– Represent any images of the same size as a linear combination
of basis images
Classification of image transforms
Orthogonal Non- Basis function
sinusoidal basis sinusoidal depending on Directional
function orthogonal statistics of transform
basis function input signal

Fourier
transform Hough
Haar
transform KL transform transform

Discrete
cosine
transform Walsh Singular value Radon
transform decomposition transform

Discrete sine
transform Hadamard Ridgelet
transform transform

Slant Contourlet
transform transform
Orthogonal Matrices
• Orthogonal matrix is such that its
inverse is equal to its transpose
A is orthogonal if
ie,A-1=AT
or
ATA=AAT=I
Unitary Matrices
• If its inverse is equal to its
conjugate transpose
ie,A-1=A*T
or
A*TA=AA*T=I
Image Transform
1-D DFT and Vector Form
 1 N 1

Z (k ) 
 N
 z ( n )  W Nnk
• { z(n) }  { Z(k) } 
n0

 z (n)  1
N 1
n, k = 0, 1, …, N-1
 N
 Z ( k )  W N nk
WN = exp{ - j2 / N } k 0

~ complex conjugate of primitive Nth root of unity


• Vector form and interpretation for inverse transform
z = k Z(k) ak
ak = [ 1 WN-k WN-2k … WN-(N-1)k ]T /  N
• Basis vectors 
– akH = ak* T = [ 1 WNk WN2k … WN(N-1)k ] /  N

– Use akH as row vectors to construct a matrix F


– Z = F z  z = F*T Z = F* Z

– F is symmetric (FT=F) and unitary (F-1 = FH where FH = F*T ) 


Image Transform
• The term image transforms usually
refers to a class of unitary matrices
used to representing images.
• Basis function –Basis Image
Two dimensional orthogonal and
unitary transform
Orthonormality and
completeness
Separable unitary Transform

Complexity O(N4)
Separable unitary Transform

Total O(2N3) Complexity of


multiplication of two
n x n matrix is O(N3)
Basis image
Basis image
Example
Example
Example
Properties of 1-D Unitary Transform
v=Au
• Energy Conservation
– || v ||2 = || u ||2

• || v ||2 = || Au ||2= (Au)*T (Au)= u*T A*T A u = u*T u = || x ||2

• Rotation
– The angles between vectors are preserved

– A unitary transformation is a rotation of a


vector in an N-dimension space, i.e., a rotation
of basis coordinates
Properties of 1-D Unitary Transform (cont’d)

• Energy Compaction
– Many common unitary transforms tend to pack a large fraction
of signal energy into just a few transform coefficients

• Decorrelation
– Highly correlated input elements  quite uncorrelated output
coefficients
– Covariance matrix E[ ( y – E(y) ) ( y – E(y) )*T ]
• small correlation implies small off-diagonal terms
Example
• Check whether the DFT matrix is
unitary or not
• X(0)=x(0)+x(1)+x(2)+x(3)
Compute the 2D DFT of the
4 x4 grayscale image given
1D DCT
2D DCT
1D DST
Hadamard Transform
denotes the Kronecker product of two
matrices
the Hadamard transform has good to very good energy packing
properties.

Fast algorithms for its computation in    subtractions


and/or additions
Where bk(z) is the kth bit in the binary representation of z.
So the forward and inverse Hadamard transforms are equal in form;
that is:
Haar transform
The Haar transform is based on the
Haar functions, Hk(Z), which are
defined over the continuous, closed
interval [0,1] for z, and for k=0,1,2,
…,N-1, where N=2n
HAAR TRANSFORM
Determine the order of N

Determine n where n=log2 N

Determine p and q

p
Determine k=2 +q-1

Determine Z

Using N,n,p,q,k,Z compute the Haar


function Hk(z)
Algorithm
• Step 1:Determine the order of N of the Haar
basis
• Step 2:Determine n where n=log2 N
• Step 3:Determine p and q
– (i) 0 ≤ p ‹ n-1
– (ii) If p=0 then q=0 or q=1
– (iii) If p≠0, 1 ≤ q ≤ 2p
p
• Step 4:Determine k=2 +q-1
• Step 5:Determine Z
– Z[0,1){0/N ,1/N ,…………..,(N-1)/N}
Step 6:
 q 1 q 1/ 2
 2
p/2
Z
2p
2
p

1  q 1/ 2 q
H Z   H z  

 2 Z
p/2

N 2 2
k pq p p


 0 otherwise

1
then H Z   H Z  

If k  0
N
k 00
Example
Generate Haar basis for N=2
• Step 1:N =2
• Step 2: n=log2 2=1
• Step 3:Determine p and q
– (i) since n=1,the only value of p is 0
– (ii) so q takes the value of 0 or 1
p
• Step 4:Determine the value of k using k=2 +q-1

p q k
0 0 0
0 1 1
• Step 5:Determine Z
– Z[0,1){0/2 ,1/2}

• Step 6:  q 1 q 1/ 2
2 Z 
p/2

2 p
2p

p=0
1 
 q 1/ 2 q
Z   H z  

q=0 q=1 H  2
p/2
Z 
N 2 2
k pq p p


 0 otherwise


1
H Z   H Z  

If k 0 then
N
k 00

If k=0 then H(Z)=1/√2


For k=1; p=0;q=1

1 0  Z  1/ 2
1 
Z   H z  

H  1 1/ 2  Z  1
2
k pq

0 otherwise

 q 1 q 1/ 2
2 Z 
p/2

2 p
2 p

1 
 q 1/ 2 q
H Z   H z  

 2 Z 
p/2

N 2 2
k pq p p


 0 otherwise


1
H Z   H Z  

If k 0 then
N
k 00

If k=0 then H(Z)=1/√2

For k=1; p=0;q=1

1 0  Z  1/ 2
1 
Z   H z  

H  1 1/ 2  Z  1
2
k pq

0 otherwise

Haar basis for N=2

k n 0 1
0 1/√2 1/√2
1 1/√2 -1/√2

HW:compute the Haar basis for N=4


Properties of Haar
transform
Slant transform
1 1
 3N 2
 2
 N 4 
2 2
aN  bN  
 4 N 2
 1
  4 N  1
2 
Karhunen-Loeve
Transform (KLT)
• Also known as Hotelling
Transform and Eigenvector Transform
• Principal Component Analysis (PCA)

You might also like