You are on page 1of 11

Seminar Topics

Resmi N.G.
1. Discrete Cosine Transform
2. Discrete Sine Transform
3. Hadamard Transform
4. Haar Transform
5. Optimum Mean Square Quantizer

1. Discrete Cosine Transform

An NxN cosine transform matrix C={c(k,n)}, also known as DCT is defined as
( )
1
, 0, 0 1
( , )
2 1
2
cos ,1 1, 0 1
2
k n N
N
c k n
n k
k N n N
N N

=

+ | |

\

Let N = 4.
1 1
0, 0, (0, 0) 0.5
2 4
1 1
1, (0,1) 0.5
2 4
1 1
2, (0, 2) 0.5
2 4
1 1
3, (0, 3) 0.5
2 4
Whenk n c
n c
n c
n c
= = = = =
= = = =
= = = =
= = = =

( )
( )
( )
( )
2 0 1 1 2 1
1, 0, (1, 0) cos cos 0.6533
4 2 4 8 2
2 1 1 1 2 1 3
1, (1,1) cos cos 0.2706
4 2 4 8 2
2 2 1 1
2 1 5
2, (1, 2) cos cos 0.2706
4 2 4 8 2
2 3 1 1
2
3, (1, 3) cos
4 2 4
Whenk n c
n c
n c
n c

+ | |
| |
= = = = =
| |

\
\
+ | |
| |
= = = =
| |

\
\
+ | |
| |
= = = =
| |

\
\
+
= =

1 7
cos 0.6533
8 2

| |
| |
= =
| |
\
\

( )
( )
( )
( )
2 0 1 2 2 1 2
2, 0, (2, 0) cos cos 0.5
4 2 4 8 2
2 1 1 2 2 1 6
1, (2,1) cos cos 0.5
4 2 4 8 2
2 2 1 2
2 1 10
2, (2, 2) cos cos 0.5
4 2 4 8 2
2 3 1 2
2
3, (2, 3) cos
4 2 4
When k n c
n c
n c
n c

+ | |
| |
= = = = =
| |

\
\
+ | |
| |
= = = =
| |

\
\
+ | |
| |
= = = =
| |

\
\
+ | |
= =
|

\
1 14
cos 0.5
8 2
| |
= =
|
\


( )
( )
( )
( )
2 0 1 3 2 1 3
3, 0, (3, 0) cos cos 0.2706
4 2 4 8 2
2 1 1 3 2 1 9
1, (3,1) cos cos 0.6533
4 2 4 8 2
2 2 1 3
2 1 15
2, (3, 2) cos cos 0.6533
4 2 4 8 2
2 3 1 3
2
3, (3, 3) cos
4 2
Whenk n c
n c
n c
n c

+ | |
| |
= = = = =
| |

\
\
+ | |
| |
= = = =
| |

\
\
+ | |
| |
= = = =
| |

\
\
+
= =
1 21
cos 0.2706
4 8 2

| |
| |
= =
| |

\
\

0.5000 0.5000 0.5000 0.5000
0.6533 0.2706 -0.2706 -0.6533
0.5000 -0.5000 -0.5000 0.5000
0.2706 -0.6533 0.6533 -0.2706
C
(
(
(
=
(
(



Orthogonality of 4x4 DCT matrix:

CC
T
=C
T
C=I







1.0000 0.0000 0.0000 0.0000
0.0000 1.0000 0.0000 0.0000
0.0000 0.0000 1.0000 0.0000
0.0000 0.0000 0.0000 1.0000
(
(
(
=
(
(



0.5000 0.5000 0.5000 0.5000 0.5000 0.6533 0.5000 0.2706
0.6533 0.2706 -0.2706 -0.6533 0.50
0.5000 -0.5000 -0.5000 0.5000
0.2706 -0.6533 0.6533 -0.2706
T
CC
(
(
(
=
(
(

00 0.2706 -0.5000 -0.6533
0.5000 -0.2706 -0.5000 0.6533
0.5000 -0.6533 0.5000 -0.2706
(
(
(
(
(

0.5000 0.6533 0.5000 0.2706 0.5000 0.5000 0.5000 0.5000
0.5000 0.2706 -0.5000 -0.6533 0.65
0.5000 -0.2706 -0.5000 0.6533
0.5000 -0.6533 0.5000 -0.2706
T
C C
(
(
(
=
(
(

33 0.2706 -0.2706 -0.6533
0.5000 -0.5000 -0.5000 0.5000
0.2706 -0.6533 0.6533 -0.2706
(
(
(
(
(



1.0000 0.0000 0.0000 0.0000
0.0000 1.0000 0.0000 0.0000
0.0000 0.0000 1.0000 0.0000
0.0000 0.0000 0.0000 1.0000
(
(
(
=
(
(



One dimensional DCT of a sequence {u(n)},0 n N-1 is defined as

1
0
(2 1)
( ) ( ) ( ) cos , 0 1
2
1
, 0
( )
2
, 1 1
N
n
n k
v k k u n k N
N
k
N
where k
k N
N

=
+ | |
=
|
\



Inverse transform is given by,

1
0
(2 1)
( ) ( ) ( ) cos , 0 1
2
N
k
n k
u n k v k n N
N

=
+ | |
=
|
\



Properties of DCT:
1. DCT is real and orthogonal.
* 1 T
C C C C

= =
2. DCT is NOT the real part of DFT.
3. It is a fast transform and requires only O(Nlog
2
N) operations via N-point FFT.
4. Excellent energy compaction for highly correlated data.

2. Discrete Sine Transform

An NxN sine transform matrix ={(k,n)}, also known as DST is defined as
2 ( 1)( 1)
( , ) sin , 0 1, 0 1
1 1
k n
k n k N n N
N N

+ + | |
=
|
+ +
\

Let N = 4.
2 (0 1)(0 1) 2
0, 0, (0, 0) sin sin 0.3717
4 1 4 1 5 5
2 (0 1)(1 1) 2 2
1, (0,1) sin sin 0.6015
4 1 4 1 5 5
2 (0 1)(2 1) 2 3
2, (0, 2) sin sin 0.6015
4 1 4 1 5 5
2
3, (0, 3)
4
Whenk n
n
n
n

+ + | | | |
= = = = =
| |
+ +
\ \
+ + | | | |
= = = =
| |
+ +
\ \
+ + | | | |
= = = =
| |
+ +
\ \
= =
(0 1)(3 1) 2 4
sin sin 0.3717
1 4 1 5 5
+ + | | | |
= =
| |
+ +
\ \


2 (1 1)(0 1) 2 2
1, 0, (1, 0) sin sin 0.6015
4 1 4 1 5 5
2 (1 1)(1 1) 2 4
1, (1,1) sin sin 0.3717
4 1 4 1 5 5
2 (1 1)(2 1) 2 6
2, (1, 2) sin sin 0.3717
4 1 4 1 5 5
3, (1, 3)
Whenk n
n
n
n

+ + | | | |
= = = = =
| |
+ +
\ \
+ + | | | |
= = = =
| |
+ +
\ \
+ + | | | |
= = = =
| |
+ +
\ \
= =
2 (1 1)(3 1) 2 8
sin sin 0.6015
4 1 4 1 5 5
+ + | | | |
= =
| |
+ +
\ \

2 (2 1)(0 1) 2 3
2, 0, (2, 0) sin sin 0.6015
4 1 4 1 5 5
2 (2 1)(1 1) 2 6
1, (2,1) sin sin 0.3717
4 1 4 1 5 5
2 (2 1)(2 1) 2 9
2, (2, 2) sin sin 0.3717
4 1 4 1 5 5
3, (2, 3)
Whenk n
n
n
n

+ + | | | |
= = = = =
| |
+ +
\ \
+ + | | | |
= = = =
| |
+ +
\ \
+ + | | | |
= = = =
| |
+ +
\ \
=
2 (2 1)(3 1) 2 12
sin sin 0.6015
4 1 4 1 5 5
+ + | | | |
= = =
| |
+ +
\ \


2 (3 1)(0 1) 2 4
3, 0, (3, 0) sin sin 0.3717
4 1 4 1 5 5
2 (3 1)(1 1) 2 8
1, (3,1) sin sin 0.6015
4 1 4 1 5 5
2 (3 1)(2 1) 2 12
2, (3, 2) sin sin 0.6015
4 1 4 1 5 5
3, (3, 3)
Whenk n
n
n
n

+ + | | | |
= = = = =
| |
+ +
\ \
+ + | | | |
= = = =
| |
+ +
\ \
+ + | | | |
= = = =
| |
+ +
\ \
=
2 (3 1)(3 1) 2 16
sin sin 0.3717
4 1 4 1 5 5
+ + | | | |
= = =
| |
+ +
\ \

0.3717 0.6015 0.6015 0.3717
0.6015 0.3717 -0.3717 -0.6015
0.6015 -0.3717 -0.3717 0.6015
0.3717 -0.6015 0.6015 -0.3717
(
(
(
=
(
(



Orthogonality of 4x4 DCT matrix:

T
=
T
=I







1.0000 0.0000 0.0000 0.0000
0.0000 1.0000 0.0000 0.0000
0.0000 0.0000 1.0000 0.0000
0.0000 0.0000 0.0000 1.0000
(
(
(
=
(
(

=
T


Sine Transform of a one dimensional sequence {u(n)},0 n N-1 is defined as

1
0
2 ( 1)( 1)
( ) ( )sin , 0 1
1 1
N
n
k n
v k u n k N
N N

=
+ + | |
=
|
+ +
\




Inverse transform is given by,

1
0
2 ( 1)( 1)
( ) ( ) sin , 0 1
1 1
N
k
k n
u n v k n N
N N

=
+ + | |
=
|
+ +
\




Properties of DST:
1. DST is real, symmetric, and orthogonal.
* 1 T
= = =
Thus, the forward and inverse transforms are identical.
2. DST is NOT the imaginary part of unitary DFT.
3. It is a fast transform and requires only O(Nlog
2
N) operations via N+1-point FFT.

3. Hadamard Transform

Elements of basis vectors of Hadamard Transform take only binary values {+1,-1}. Hadamard
transform matrices H
k
s are NxN matrices where N=2
n
, n=1,2,3.
0.3717 0.6015 0.6015 0.3717 0.3717 0.6015 0.6015 0.3717
0.6015 0.3717 -0.3717 -0.6015 0.60
0.6015 -0.3717 -0.3717 0.6015
0.3717 -0.6015 0.6015 -0.3717
T
(
(
(
=
(
(

15 0.3717 -0.3717 -0.6015
0.6015 -0.3717 -0.3717 0.6015
0.3717 -0.6015 0.6015 -0.3717
(
(
(
(
(

H can easily be generated by using
1
1 1
1
1 1
2
H
(
=
(




and Kronecker product recursion

1 1 1 1
1 1
1 1
1
2
n n n
n n
n n
H H H H H
H H
H H



= =
(
=
(




3 1 2
2 1 1
3, For n
H H H
H H H
=
=
=


1 1
2
1 1
1
2
1 1 1 1
1 1 1 1
1 1
2 2
1 1 1 1
1 1 1 1
H H
H
H H
(
=
(


(
(

(
=
(

(
(



2 2 2 2
3
2 2 2 2
1 1 1 1
2 2 2 8
H H H H
H
H H H H
( (
= =
( (




The basis vectors of Hadamard transform can also be obtained by sampling Walsh functions
which take only binary value {+1,-1}.

Orthogonality of Hadamard Matrix:

2 2
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1
1 1 1 1 1 1 1 1 2 2
1 1 1 1 1 1 1 1
T
H H
( (
( (

( (
=
( (
( (




2 2
4 0 0 0
0 4 0 0
1
0 0 4 0 4
0 0 0 4
T
I H H
(
(
(
= = =
(
(



Hadamard transform pair is given by
H
H
v u
u v
=
=

where
2
, log
n
H H n N = = .

It can be written as

1
( , )
0
1
( , )
0
1
0
1
0 1 1
1
0 1
1
( ) ( )( 1) , 0 1
1
( ) ( )( 1) , 0 1
( , ) , , 0,1
{ },{ } .
; 2 ... 2
2 ... 2
N
b k m
m
N
b k m
k
n
i i i i
i
i i
n
n
n
n
v k u m k N
N
u m v k m N
N
where b k m k m k m
and k m are the binary representations of k and m resp
ie k k k k
m m m m

=
=
= =
= + + +
= + + +

1


Properties:
1. H is real, symmetric and orthogonal.
* -1 T
H=H =H =H
2. It is a fast transform and requires O(Nlog
2
N) additions and subtractions.
3. Very good energy compaction for highly correlated images.

4. Haar Transform

Haar functions ( )
k
h x are defined on a continuous interval [0,1], 0,1,..., 1, 2
n
x k N N = = . k is
decomposed as 2 1
p
k q = + , where 0 1 p n , 0,1 0 q for p = = , and 1 2 0
n
q for p .
4,
0 1 2 3
0 0 1 1
0 1 1 2
For n
k
p
q
=

Let k be represented by (p,q). Then,
0 0, 0
1
( ) ( ) , [0,1]
k p q
h x h x x
N
= = =
= =
2
,
2
1
1
2
2 ,
2 2
1
1
( ) ( )
2
2 ,
2 2
0, [0,1]
p
p p
p
k p q
p p
q
q
x
q
h x h x
q
N
x
otherwise for x


<


= =

<


For N=4
0 0, 0
1
( ) ( )
4
k p q
h x h x
= = =
= =
0
2
0 0
1 0, 1 0
2
0 0
1
1
1 1
2
2 ,
2 2
1
1
1
( ) ( )
1
2
4
2 ,
2 2
0, [0,1]
1
1, 0
2
1
1
1, 1
2
4
0, [0,1]
k p q
x
h x h x
x
otherwise for x
x
x
otherwise for x
= = =


<


= =

<

<

<
=



1
2
1 1
2 1, 1 1
2
1 1
1
1
1 1
2
2 ,
2 2
1
1
1
( ) ( )
1
2
4
2 ,
2 2
0, [0,1]
1
2, 0
4
1 1
1
2,
4 2
4
0, [0,1]
k p q
x
h x h x
x
otherwise for x
x
x
otherwise for x
= = =


<


= =

<

<

<
=


1
2
1 1
3 1, 2 1
2
1 1
1
2
2 1
2
2 ,
2 2
1
1
2
( ) ( )
2
2
4
2 ,
2 2
0, [0,1]
k p q
x
h x h x
x
otherwise for x
= = =


<


= =

<


1 3
2,
2 4
3
1
2, 1
4
4
0, [0,1]
x
x
otherwise for x

<

<
=


Therefore, the Haar Matrix for N=4 is
1 1 1 1
1 1 1 1
1
2 2 0 0
4
0 0 2 2
H
(
(

(
=
(

(
(



Orthogonality of Haar Matrix:
1 1 1 1 1 1 2 0
1 1 1 1
1 1 2 0
1 1
2 2 0 0
4 4
1 1 0 2
0 0 2 2
1 1 0 2
T
HH
(
(
(
(

(
(
=
(
(


(
(
(
(




4 0 0 0
0 4 0 0
1
0 0 4 0 4
0 0 0 4
T
I H H
(
(
(
= = =
(
(



5. Optimum Mean Square Quantizer

This quantizer minimizes the mean square error for a given number of quantization levels.

A quantizer maps a continuous variable u into discrete variable u, which takes values from a
finite set
1 2
{ , ,..., }
L
r r r . { }, 1, 2,... 1
k
t k L = + is a set of decision levels with
1 1 L
t and t
+
as the
minimum and maximum values of u respectively.

If u is in
1
[ , )
k k
t t
+
, it is mapped to
k
r , the k
th
reconstruction level.

1 1 k k k k
q t t r r

= = is constant for different values of k and is called the quantization interval.

1
1
1
2
2
2
1
min .
[( ') ]
( ') ( )
( ) ( )
( ) .
L
i
i
t
u
t
t
L
i u
i
t
u
The mean square error is imized
E u u
u u p u du
u r p u du
where p u is the probability density of u

+
+
=
=
=
=




In order to get the necessary conditions to minimize error , differentiate with respect to
k k
t and r and equate the results to zero.

1
1
1
2
1
2 2
1
( ) ( )
... ( ) ( ) ( ) ( ) ...
i
i
k k
k k
k k
t
L
i u
i
t
t t
k u k u
t t
t and r terms in
u r p u du
u r p u du u r p u du

+
+

=
= + + +




Differentiating with respect to
k k
t and r , we get
2 2
1
2
1
0 ( ) ( ) 0 0 ( ) ( ) 0
( ) ( )
k k u k k k u k
k
k k u k
t r p t t r p t
t
t r p t

( ( = + =


2
( ) ( )
k k u k
t r p t =
2
k
t
2 2
1 1
2
k k k k
t r r t

+ =
2
2 2
1 1
1
2
2 2
2 ( )
k k k
k k k k k k
k k k
t r r
t r t r r r
t r r

+
=

1 1
( ) ( )
k k k k
r r r r

= +
1
2
k k
k
r r
t

+
=


1
1 1
1 1
1 1
1
1
0 2 ( ) ( ) 0
( ) ( ) 0
( ) ( )
( ) ( )
( )
[ | ]
( )
k
k
k k
k k
k k
k k
k k
k k
k
k
k
k
t
k u
k t
t t
u k u
t t
t t
k u u
t t
t t
k u u
t t
t
u
t
k k t
u
t
u r p u du
r
up u du r p u du
r p u du up u du
r p u du up u du
up u du
r E u u I
p u du

+
+ +
+ +
+ +
+
+

= =

=
=
=
= =


where
k
I is the interval
1
[ , )
k k
t t
+
.

That is, the optimum transition levels {
k
t } lie half way between the optimum reconstruction
levels {
k
r } which lie at the centre of mass of probability density in between the transition levels.

You might also like