You are on page 1of 9

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 analogy with I-D signals that can be represented by an
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 an ( N �N ) image can be represented as ( N 2 �1 )
vector. An image transform provides a set of coordinates or basis
vectors for the vector space.

I-D-Transforms:

For a one dimensional sequence { u( n ), n = 0,1......N - 1 } r


r r
representing a vector u of size N , a unitary transform is : v = A u
N -1
 v(k) = � a( k ,n )u( n ) , for 0 �K �N - 1 (1)
n =0
(1)
T *T
where A-1 = A* (unitary)
r T r
This implies , u = A* v
N -1
or, u(n) = � v( k )a* ( k ,n ) , for 0 �n  N - 1 (2)
k =0
Equation (2) can be viewed as a series representation of sequence
u(n) . The columns of
A* i.e the vectors ak = { a ( k ,n ), 0 �n �N - 1 } are called the “basis
T r* D * T

vectors” of A.
The series coefficients v(k) give a representation of original
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 :
N -1
v(k,l) = � � u( m,n )ak ,l ( m,n ) , 0 �k ,l �N - 1 (3)
m,n = 0
N -1
*
u(m,n) = � � v( k ,l )ak ,l ( m,n ) , 0 �m,n �N - 1 (4)
k ,l = 0

where { ak ,l ( m,n )} is called an ” image transform.”


It is a set of complete orthogonal discrete basis functions
satisfying the properties:-

N -1
*
1) Orthonormality: � � ak ,l ( m,n )ak / ,l / ( m,n )
m,n = 0
= δ( k - k �
,l - l �
)
N -1
k
2) Completeness : � � ak ,l ( m,n )ak ,l ( m ��
,n )
k ,l = 0
= δ( m - m�
,n - n �
)
The elements v ( k ,l ) are transform coefficients and V D { v( k ,l )} is
the transformed image.
The orthonomality property assures that any truncated series
expansion of the form
P -1 Q -1
U P,Q ( m,n ) D � *
� v( k ,l )ak ,l ( m,n ) , for P �N ,
k =0 l =0
Q �N
will minimize the sum of squares error
N -1 2
σe2 = � � �
u( m,n ) - U P,Q ( m,n )�
� �
m,n = 0
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 O( N 4 ) . This is too
large for practical size images.
If the transform is restricted to be separable,
i.e ak ,l ( m,n ) = ak ( m )bl ( n )
D a( k ,m )b( l,n )

where { ak ( m ),k = 0( 1 )n - 1} ,
and { bl ( n ),l = 0( 1) N - 1} are 1D complete orthogonal sets of
basis vectors.
On imposition of completeness and orthonormality properties we
can show that A D { a( k ,m )} ,
and B D { b( l,n )} are unitary matrices.
i.e
T T * T T *
AA* = I = A A and BB* = I = B B

Often one chooses B same as A


N -1
 v( k ,l ) = � � a( k ,m )u( m,n )a( l,n )
m,n = 0
 V = A U T A (5)
N -1
* *
And u( m,n ) = � � a ( k ,m )v( k ,l )a ( l,n )
k ,l = 0
 U = A*T V A* (6)
Eqn (5) can be written as V T = A( AU )T
 Eqn (5) can be performed by first transforming each column of
U and then transforming each row of the result to obtain rows of
V.
Basis Images : Let ar*k denote k th column of A* .
T

Let us define the matrices A*k ,l = ar*k a*l and matrix inner
T

product of two N �N matrices F and G as


N -1
*
F ,G = � � f ( m,n )g ( m,n )
m,n = 0

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


N -1
U = � � v( k ,l ) A*k ,l
k ,l = 0
*
and v( k ,l ) = u , Ak ,l

Any image U can be expressed as linear combination of N 2


matrices. A*k ,l called “basis images”.
Therefore any N �N image can be expanded in a series using a
complete set of N 2 basis images.
1 1�
1 � �1 2�
Example: Let A = � �
1 -1 �
2�
; U =
�3 4�
� �
�5 -1�
Transformed image V = A U AT = �


-2 0 �
T
And Basis images are found as outer product of columns of A* i.e
1
1 ��
A*0 ,0 = �� (1 1)
1
2 ��
1 ��1
A*0 ,1 = �� (1 -1)
1
2 ��
1� 1 -1� T
= 2� � 1 -1�=
� A*1,0

1 �1 -1� �1 �
A*1,1 = � � � �(1 -1)
2� -1 1 � �-1�
The inverse transformation
1 1 ��5 -1��
1� 1 1�
*T
A *
VA = � ��
1 -1��
2�
��
-2 0 ��

1 -1�
�1 2�
= ��3 4 �=
� U

Dimensionality of Image transforms


The 2N 3 computations for V can also be reduced by restricting the
choice of A to fast transforms. This implies that A has a
structure that allows factorization of the type,
A = A( 1 ) A( 2 ) .........A( p )
where A( i ) , i = 1 , p( p << N ) are matrices with just a few non zero
entries say rwhere r << N
r r
Therefore a multiplication of the type : y = Ax is accomplished
in rpN operations.
For several transforms like Fourier, Sine, Cosine, Hadamard etc,
p = log 2 N , and operations reduce to the order of N log 2 N or
N 2 log 2 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 M1 �M 2 and N1 �N 2 matrices we define Kronecker
product as:
{
A � B D a( m,n )B}

Consider the transform, V = A U AT


N -1
or, v( k ,l ) = � � a( k ,m )u( m,n )a( l,n )
m,n = 0
(7)
r r
If and uk denote
vk k th and mth row vectors of V and U then (1)
becomes , uuur
rT �a( k ,m ) �
AU T �
vk = m � m� �

r
=� [ A �A] umT where [ ] k ,m is the ( k ,m )th block of [ A �A]
m k ,m
r r
If U and V are row ordered into vectors v and u respectively,
r r
then V = AU AT  v = ( A �A ) u
The number of operations required for implementing equation(7)
reduces from O( N 4 ) to O( 2 N 3 ) .
Properties of Unitary transforms:-
1) Energy conservation: r
r
In the unitary transformation, v = Au ,
r2 r2
v = u
Proof
2
r 2 N -1
v D � v( k ) = r*T r = r*T T Aur
v v u A
k =0

= ur 2 .
 unitary transformation preserves signal
r
energy or equivalently the length of vector 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 transform is a
r
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
N -1 2 N -1 2
  u (m, n)
m, n = 0
=   v(k , l )
k ,l = 0

  x0 
Example: Consider the vector x =  and
 x1 
 cos  sin  
A = - sin 
 cos  
(diagram)
    
This  , y0 = ; y1 = a1T x
a0T x
 
Transformation y = Ax can be written as
  y0   cos   x0 
sin    x0 cos   x1 sin  
y = y  = - sin  x 
cos   =  - x 
 x1 cos  
 1   1  0 sin 
 
with new basis as a0 , a1 .

For 2D unitary transforms we have


2 2
  u (m, n) =   v(k , l ) .
m n k l

2) Energy Compaction Property:


Most unitary transforms have a tendency 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 R u denote the mean and covariance
 
of vector u then corresponding quantities for v are
   
 v D E [ v ] = E[ Au ] = Au

And v [
Rv = E (v -  ) (v -  )*
u
T
]
= E[( Au - Au ) ( Au - Au )* ]
T

= A E[( Au - Au ) ( Au - Au )* ] A*


T T

= AR u A*
T

Variances of the transform coefficients are given by the


diagonal elements of R v i.e [ R v ] k , k =  v2 (k )
  v2 (k ) = [ A R u AkT ]k , k
Since A is unitary , it implies:
N -1 2
T  T T 
  v (k )
k =0
=  v*  v =  * A* Au

N -1 2

=  u (u )
n=0
N -1
  v2 (k ) = Tr  A R u A*  Tr [ R u ]
T

and k =0

 
 =
N -1
  n2 (n)
= n =0

N -1
[2
 E v(k ) =  E u (n)
k
2
] N -1

n=0
[ ]
The average energy E  v(k ) ) of transform coefficients v(k ) tends
2

to be unevenly distributed, although it may be evenly distributed


for input sequence u (n) .
For a 2D random field u (m, n) , with mean u  m, n ) and covariance
r  m, n; m, n) , its transform coefficients v k , l )
satisfy the properties,
N -1
 v (k , l ) =  m a (k , m) a (l , n) u ( m, n)
,n =0
N -1
  v (k , l ) =   a (k , m)a (l , n) E [ u  m, n ) ]
m, n = 0

and  v2 (k , l ) = {
E v k , l ) - u  k , l )
2
}
=    a  k , m )a  l , n ) r  m, n; m, n) a*  k , m)  a*  l , n)
m n m n
If covariance of u  m, n ) is separable i.e
r  m, n; m, n) = r1  m, m) r2  n, n)
Then variances of transform coefficients can be written as a
separable product
 v2  k , l ) =  12  k ) 22  k )
D  A R1 A*   A R A*T 
T


 
 k,k 

2 
 k,k

where R1 = { r1  m, m)} ;
R 2 = { r2  n, n)}
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 R v tend to be small
compared to diagonal elements.
4) Other properties : (a) The determinant 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 N  1 Gaussian random vector u

with mean  and covariance R u , as :
log 2  2e R u )
 N
H u) =
12
2

To show H  u ) is invariant under any unitary transformation.
 
Let v = Au

 u = A v = A* v -1 T

N
log 2  2eRu N 
1
 
H  Au ) =
2  
Use the definition of Ru we have
1
   T
E  Au  - Au )   Au - Au ) * 
N
 

 T 1N
= AR A *
u
1
= Ru N

1 1 1 1

Now = T N
Rv N A N Ru N A*

1
= Ru 4

=
T
Rv A R u A*
Also AA

*T
= AT A* = I
 A R v A =
 T
A A R u A* A
= 
R u AT A* ) T

= Ru
N
log 2e A R v A N 
*T 1
 
H  Au ) =
2  
1 1 1
N
= 2
log(2ex A  N Rv N A N )

You might also like