# Image Transformations - nptel

AI and Robotics

Nov 6, 2013 (4 years and 7 months ago)

105 views

Image Transformations

Introduction:

Two dimensional unitary transforms play an important role in
image processing. The term image transform refers to a class of
unitary matrices used for representation of images.

In anal
ogy with I
-
D signals that can be represented by a
n

orthogonal series of basis functions , we can similarly represent an
image in terms of a discrete set of basis arrays called “
basis
images
”. These are generated by unitary matrices.

Alternatively
a
n

( N N )

image can be represented as

2
1

( N )

vector. An image transform provides a set of coordinates or basis
vectors for the vector space.

I
-
D
-
Transforms
:

For a one dimensional sequence

01 1
 
u( n),n,......N

representing a vector
u

of size
N

, a unitary transform is :
v

=
A
u

v
(
k
)

=
1
0

N
n
a( k,n)u( n)
,

for

0 1
  
K N

(1)

(1)

where

1

A

=
T
A
*
T
*

(unitary)

This implies ,

u
=
T
A
*
v

or
,
u(n)

=
1
0

N
k
v( k )a* ( k,n)

,

for
0

n
1

N

(2)

Equation (2) can be viewed as

a series representation of sequence
u(n)

. The columns
of

T
A
*
i.e the vectors

*
k
a

0 1
  
T
*
a ( k,n),n N

are called the “basis
vectors” of
A
.

The series coeffi
cients
v(k)

give a representation of origin
al
sequence u(n) and are useful in compression , filtering , feature
extraction and other analysis.

Two dimensional Orthogonal and Unitary transforms:

As applied to image processing, a general orthogonal series
expansion for an
N N

image is a pair of transformations of the
form :

v(k,l
) =
1
0
N
k,l
m,n
u( m,n)a ( m,n)

 

,
0 1
k,l N
  

(3)

u(m,n)

=
1
0
N
*
k,l
k,l
v( k,l )a ( m,n)

 

,
0 1
m,n N
  

(4)

where

k,l
a ( m,n)

is called an ” image transform.”

It is a set of complete orthogonal discrete basis

functions
satisfying the properties
:
-

1)

Orthonormality
:

1
0
//
N
*
k,l
k,l
m,n
a ( m,n)a ( m,n)

 

=
δ
( k k,l l )
 
 

2) Completeness
:

1
0
N
k
k,l
k,l
k,l
a ( m,n)a ( m,n )

 
 

=
δ
( m m,n n )
 
 

The elements
v
( k,l )

are transform coefficients and

V

v( k,l )
is
the transformed image.

The orthonomality property assures that any truncated series
expansion of the form

P,Q
U ( m,n)

1
0
P
k

1
0
Q
*
k,l
l
v( k,l )a ( m,n)

, for

P N

,

Q N

w
ill minimize the sum of squares error

1
2
2
0
σ
N
e P,Q
m,n
u( m,n) U ( m,n)

 
 
 
 

where coefficients
v( k,l )

are given by (3).

The completeness property assures that this error

will be zero for
P Q N
 

Separable Unitary Transforms:

The number of multiplications and additions required to compute
transform coefficients
v( k,l )

in equation(3) is
4
O( N )
. This is too
large for practica
l size images.

If the transform is restricted to be separable,

i.e
k,l k l
a ( m,n ) a ( m)b ( n )

a( k,m)b( l,n)

where

0 1 1
k
a ( m),k ( )n
 
,

and

0 1 1
l
b ( n),l ( N
 

are 1D complete orthogonal sets of
basis vectors.

On imposition of completeness and orthonormality properties we
can show that
A

a( k,m)
,

and
B

b( l,n)

are unitary matrices.

i.e

T
*
AA
=
I

=
T *
A A
and
T
*
BB
=
I

=
T *
B B

O
ften one chooses
B

same as
A

v( k,l )

=
1
0
N
m,n
a( k,m)u( m,n)a( l,n)

 

V

=
A
U
T
A

(5)

And
u( m,n)

=
1
0
N
* *
k,l
a ( k,m)v( k,l )a ( l,n)

 

U

=
T
*
A
V
*
A

(6)

Eqn (5) can be written as
T
V

=
T
A( AU )

Eqn (5) can be performed by first transforming each column of
U
and then tr
ansforming each row of the result to obtain rows of

V
.

Basi
s

Images

:

Let
*
k
a

denote
th
k

column of
T
*
A
.

Let us define the matrices
T
*
* *
k l
k,l
A a a

and matrix inn
er
product of two
N N

matrices
F

and
G

as

F,G

=
1
0
N
*
m,n
f ( m,n)g ( m,n)

 

Then equ (6) and (5) give a series representation
.

U

=
1
0
N
k,l
v( k,l )

 
*
k,l
A

and

v( k,l )

=
*
k,l
u,A

A
ny image
U

can be expressed as linear combination of
2
N

matrices.
*
k,l
A

called “basi
s

images”.

Therefore any
N N

image can be expanded in a series using a
complete set of
2
N

basis images.

Example:

Let
A

=
1 1
1
1 1
2
 
 

 

;
U

=
1 2
3 4
 
 
 

Transformed image

V

=
A
U
T
A

=
5 1
2 0

 
 

 

And Basis images are found as outer product of columns of

*
T
A
i.e

0 0
*
,
A

=
1
1
(1 1)
1
2
 
 
 

0 1
*
,
A

=

1
1
(1 1)
1
2
 

 
 

=
1 1
1
1 1
2

 
 

 

=
1 0
*
,
T
A

11
*
,
A

=
1 1
1
1 1
2

 
 

 

1
(1 1)
1
 

 

 

The inverse transformation

* *
T
A V A

=
1 1
1
1 1
2
 
 

 
5 1
2 0

 
 

 
1 1
1 1
 
 

 

=
1 2
3 4
 
 
 

=
U

Dimensionality of Image transforms

The
3
2
N

computations for
V

can also be reduced by
r
estricting the
choice of
A

to

fast transforms
.

This implies that

A

has a
structure that allows factorization of the type,

A

=
1 2
( ) ( ) ( )
.........
p
A A A

where
( )
i
A

,
1
i

,
p( p N )


are matrices with just a few non zero
entries say
r

where

r N


Therefore

a

multiplication of the type

:
y
=
Ax

is accomplished
in
rpN

o
perations.

For several transforms like Fourier, Sine, Cosine, Hadamard etc,
2
p log N

,

and operations reduce to the

order of

2
Nlog N

or
2
2
N log N

(for
N N

images).

Depending on the transform
,

an operation is defined as

1
multiplication + 1 addition.

Or, 1 addition or subtraction as in Hadamard Transform
.

Kronecker products
:

If
A

and

B

are

1 2
M M

and
1 2
N N

matrices w
e define

Kronecker
product as:

A

B

a( m,n)B

Consider the transform,
V
=
A
U
T
A

or,

v( k,l )

=
1
0
N
m,n
a( k,m)u( m,n)a( l,n)

 

(
7)

If
k
v

and

k
u

denote

th
k

and

th
m

row vecto
rs of

V

and

U

then (1)
becomes
,

T
k
v
=
m
a( k,m)

 
 
 
T
m
AU

=

T
m
m
k,m
A A u

where

k,m
is the

th
( k,m)

block of

A A

If
U

and
V

are row ordered into vector
s

v

and
u

respectively,

then
V

=
T
AUA

v

=
(
A A

)
u

The
number of operations required for implementing equation(
7
)
reduces from
4
O( N )

to
3
2
O( N )
.

Properties of Unitary transforms
:
-

1)
Energy conservatio
n
:

In the unitary transformation,
v
=
Au
,

2
v

=
2
u

Proof

2
v

2
1
0
N
k
v( k )

=
T
*
v v
=
T
*
u
T
A
Au

=
2
u
.

unitary transformation preserves signal
energy or equivalently the length of v
ector
u

in
N

dimensional vector space. That is , every unitary
transformation is simply a rotation of
u

in
N

dimensional
vector space.

Alternatively , a unitary transfor
m is a
rotation of basis coordinates and components of
v

are
projections of
u

on the new basis.

Similarly , for 2D
unitary transformations, it can be proved that

2
1
0
,
)
,
(

N
n
m
n
m
u
=
2
1
0
,
)
,
(

N
l
k
l
k
v

Example: Consider the vector
x

=

1
0
x
x

and

A
=

cos
sin
sin
cos

(
diagram
)

This

,
0
y
=
x
a
T

0

;
1
y

=
x
a
T

1

Transformation
y

=
x
A

can be written as

y

=

1
0
y
y

=

cos
sin
sin
cos

1
0
x
x

=

cos
sin
sin
cos
1
0
1
0
x
x
x
x

with new basis as
0
a

,
1
a

.

For 2D unitary transforms we have

2
)
,
(

m
n
n
m
u
=
2
)
,
(

k
l
l
k
v
.

2)
Energy Compaction Property
:

Most unitary transforms have a tenden
cy to pack a large
fraction of average energy of an image into relatively few
transform coefficients. Since total energy is preserved this
implies that many transform coefficients will contain very
little energy. If
u

and
u
R

denote the mean and covariance
of vector
u

then corresponding quantities for
v

are

v

v
E

=
]
[
u
A
E

=
u
A

And
v
R

=

T
u
v
v
v
E
*
)
(
)
(

=
]
)
(
)
(
[
*
T
u
u
A
u
A
A
u
A
E

=
A
]
)
(
)
(
[
*
T
u
u
A
u
A
A
u
A
E

T
A
*

=
T
A
R
A
u
*

Varia
nces of the transform coefficients are given by the
diagonal elements of
v
R

i.e

k
k
v
R
,
=
)
(
2
k
v

)
(
2
k
v

=

k
k
kT
u
A
R
A
,

Since
A

is unitary , it implies:

2
1
0
)
(

N
k
v
k

=
v
v
T

*

=
u
A
A
T
T

*
*

=
2
1
0
)
(

N
n
u
u

and
)
(
1
0
2
k
N
k
v

=

T
A
R
A
T
u
r
*

=

u
r
R
T

=
)
(
1
0
2
n
N
n
n

2
1
)
(
k
v
E
N
k

=

1
0
2
)
(
N
n
n
u
E

The average energy

2
)
(
k
v
E

of transform coefficients

)
(
k
v
tends to be unevenly distributed, although it may be evenly
distributed for input sequence

)
(
n
u
.

For a 2D random field

)
,
(
n
m
u

,
with mean

n
m
u
,

and
covariance

n
m
n
m
r

,
;
,

,
its transform coefficients

l
k
v
,

satisfy the properties
,

)
,
(
l
k
v

=
)
,
(
)
,
(
)
,
(
1
0
,
n
m
n
l
a
m
k
a
N
n
m
u

)
,
(
l
k
v

=

1
0
,
,
)
,
(
)
,
(
N
n
m
n
m
u
E
n
l
a
m
k
a

and

)
,
(
2
l
k
v

=

2
,
,
l
k
l
k
v
E
u

=

n
l
a
m
k
a
m
n
m
n
,
,

n
l
a
m
k
a
n
m
n
m
r

,
,
,
;
,
*
*

If covariance of

n
m
u
,

is separable i.e

n
m
n
m
r

,
;
,

=

n
n
r
m
m
r

,
,
2
1

Then variances of transform coefficients

can be written as a
sepa
rable product

l
k
v
,
2

=

k
k
2
2
2
1

k
k
k
k
T
T
A
R
A
A
R
A
,
*
2
,
*
1

where
1
R
=

m
m
r

,
1

;

n
n
r
R

,
2
2

3) Decorrelation : When input
vector elements are highly
correlated , the transform coefficients tend to be uncorrelated. That
is , the off
-
diagonal terms of covariance matrix

v
R

tend to be small
compared to diagonal elements.

4)
Other properties

:
(a) The determin
ant and eigenvalues of
a unitary matrix have unity magnitute.

(b) Entropy of a random vector is observed under unitary
transformation average information of the random vector
is preserved.

Example
:

Given the entropy of an
1

N

Gaussian

random vector
u

with mean

and covariance
u
R
, as :

u
H

=

2
1
2
2
log
2
u
R
e
N

To show

u
H

is invariant under any unitary
transformation.

Let

v

=
u
A

u

=
v
A

1

=
v
A
T

*

u
A
H

=

N
u
eR
N
1
2
2
log
2

Use the definition of
u
R

we have

N
u
u
T
A
u
A
A
u
A
E
1
*

=
N
T
u
A
R
A
1
*

=

N
u
R
1

Now
N
v
R
1

=
N
A
1
N
u
R
1
N
T
A
1
*

=
4
1
u
R

v
R

=
T
A
R
A
u
*

Also
T
A
A
*

=
*
A
A
T

=
I

A
R
A
v

=
A
A
R
A
A
T
u
*

=

T
T
u
A
A
R
*

=
u
R

u
A
H

=

N
v
A
R
A
e
N
T
1
*
2
log
2

=
)
2
log(
2
1
1
1
N
N
v
N
A
R
A
ex
N