Lecture 15 DCT, Walsh and Hadamard Transform

7,436 views 14 slides Oct 12, 2020
Slide 1
Slide 1 of 14
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14

About This Presentation

DCT, Walsh and Hadamard Transform


Slide Content

Discrete Cosine, Walsh and Hadamard Transform for
2D Signal
Subject: Image Procesing & Computer Vision
Dr. Varun Kumar
Subject: Image Procesing & Computer Vision Dr. Varun Kumar(IIIT Surat)Lecture 15 1 / 14

Outlines
1
Discrete Cosine Transform
2
Walsh Transform
3
Hadamard Transform
4
References
Subject: Image Procesing & Computer Vision Dr. Varun Kumar(IIIT Surat)Lecture 15 2 / 14

Introduction to forward and inverse transform
Forward and inverse transform
Discrete Fourier transform (DFT) is a special class of transformation.
Generalforward transformationcan be expressed as
T(u;v) =
N1
X
x=0
N1
X
y=0
f(x;y)g(x;y;u;v) (1)
In case of DFT,g(x;y;u;v) =
1
N
e
j
2
N
(ux+vy)
Inverse transformation
f(x;y) =
N1
X
u=0
N1
X
v=0
T(u;v)h(x;y;u;v) (2)
In case of I-DFT,h(x;y;u;v) =
1
N
e
j
2
N
(ux+vy)
Subject: Image Procesing & Computer Vision Dr. Varun Kumar(IIIT Surat)Lecture 15 3 / 14

Continued{
g(x;y;u;v) =g1(x;u)g2(y;v) General expression
=g1(x;u)g1(y;v) Symmetric form
(3)
In case of DFT,
g(x;y;u;v) =
1
N
e
j
2
N
(ux+vy)
=
1
p
N
e
j
2
N
ux
|{z}
g1(x;u)
1
p
N
e
j
2
N
vy
|{z}
g1(y;v)
(4)
Note:
Symmetric and separable forward transformation.
Similarly, symmetric and separable inverse transformation.
Subject: Image Procesing & Computer Vision Dr. Varun Kumar(IIIT Surat)Lecture 15 4 / 14

Discrete cosine transform (DCT)
g(x;y;u;v) =(u)(v) cos
h
(2x+ 1)u
2N
i
cos
h
(2y+ 1)v
2N
i
(5)
g(x;y;u;v)!Forward transformation kernel.
(u) =
1
p
N
;whenu= 0
=
r
2
N
8u= 1;2; :::N1
(6)
Hence forward transformation for DCT
C(u;v) =(u)(v)
N1
X
x=0
N1
X
y=0
f(x;y) cos
h
(2x+ 1)u
2N
i
cos
h
(2y+ 1)v
2N
i
(7)
Subject: Image Procesing & Computer Vision Dr. Varun Kumar(IIIT Surat)Lecture 15 5 / 14

Inverse DCT
f(x;y) =
N1
X
u=0
N1
X
v=0
(u)(v)C(u;v) cos
h
(2x+ 1)u
2N
i
cos
h
(2y+ 1)v
2N
i
(8)
Note:
)Periodicity of DCT (2N) does not remain same as the periodicity of
DFT (N).
)The major application of DCT is for the data compression and energy
contraction.
Subject: Image Procesing & Computer Vision Dr. Varun Kumar(IIIT Surat)Lecture 15 6 / 14

Walsh transform
1D kernel and forward transformation
g(x;u) =
1
N
n1
Y
i=0
(1)
bi(x)bn1i(u)
(9)
)N!Total number of samples
)n!Number of bitsx=u
)bk(z)!k
th
bit in digital/binary representation ofz.
Forward transformation
W(u) =
1
N
N1
X
x=0
f(x)
n1
Y
i=0
(1)
bi(x)bn1i(x)
(10)
Inverse transformation kernel
h(x;u) =
n1
Y
i=0
(1)
bi(x)bn1i(u)
(11)
Subject: Image Procesing & Computer Vision Dr. Varun Kumar(IIIT Surat)Lecture 15 7 / 14

Continued{
f(x) =
N1
X
u=0
W(u)
n1
Y
i=0
(1)
bi(x)bn1i(u)
(12)
In case of 2D signal (forward transformation kernel)
g(x;y;u;v) =
1
N
n1
Y
i=0
(1)
bi(x)bn1i(u)+bi(y)bn1i(v)
(13)
(Inverse transformation kernel)
h(x;y;u;v) =
1
N
n1
Y
i=0
(1)
bi(x)bn1i(u)+bi(y)bn1i(v)
(14)
Subject: Image Procesing & Computer Vision Dr. Varun Kumar(IIIT Surat)Lecture 15 8 / 14

Walsh transform for 2D signal
Forward and inverse transform
Forward transform
W(u;v) =
1
N
N1
X
x=0
N1
X
y=0
f(x;y)
n1
Y
i=0
(1)
bi(x)bn1i(u)+bi(y)bn1i(v)
(15)
Inverse transform
f(x;y) =
1
N
N1
X
u=0
N1
X
v=0
W(u;v)
n1
Y
i=0
(1)
bi(x)bn1i(u)+bi(y)bn1i(v)
(16)
Note
1
Walsh transformation is separable and symmetric.
2
It is faster 2D signal transformation compare to DFT.
Subject: Image Procesing & Computer Vision Dr. Varun Kumar(IIIT Surat)Lecture 15 9 / 14

Fast Walsh transform
Computational observation
1D signal
W(u) =
1
2
h
Weven(u) +Wodd(u)
i
(17)
or
W(u+M) =
1
2
h
Weven(u)Wodd(u)
i
(18)
)u= 0;1; :::(N=21)
)M=N=2
Note:
This is a recursive operation and like FFT, fast Walsh transform can
also be done.
Subject: Image Procesing & Computer Vision Dr. Varun Kumar(IIIT Surat)Lecture 15 10 / 14

Hadamard transformation
1D signal
g(x;u) =
1
N
(1)
P
n1
i=0
bi(x)bi(u)
(19)
and
H(u) =
1
N
N1
X
x=0
f(x)(1)
P
n1
i=0
bi(x)bi(u)
(20)
Note:
)Forward and inverse kernel both are identical like Walsh transform.
h(x;u) =
1
N
(1)
P
n1
i=0
bi(x)bi(u)
(21)
and
f(x) =
1
N
N1
X
u=0
H(u)(1)
P
n1
i=0
bi(x)bi(u)
(22)
Subject: Image Procesing & Computer Vision Dr. Varun Kumar(IIIT Surat)Lecture 15 11 / 14

Continued{
For 2D signal
g(x;y;u;v) =
1
N
(1)
P
n1
i=0
bi(x)bi(u)+bi(y)bi(v)
(23)
and
h(x;y;u;v) =
1
N
(1)
P
n1
i=0
bi(x)bi(u)+bi(y)bi(v)
(24)
Forward and inverse kernel are identical.
Hadamard matrix
H=

1 1
11

at N= 2and H2N=

HNHN
HNHN

(25)
Subject: Image Procesing & Computer Vision Dr. Varun Kumar(IIIT Surat)Lecture 15 12 / 14

Modied Hadamard relation
g(x;u) =
1
N
(1)
P
n1
i=0
bi(x)pi(u)
(26)
where,
p0(u) =bn1(u)
p1(u) =bn1(u) +bn2(u)
.
.
.
pn1(u) =b1(u) +b0(u)
Subject: Image Procesing & Computer Vision Dr. Varun Kumar(IIIT Surat)Lecture 15 13 / 14

References
M. Sonka, V. Hlavac, and R. Boyle,Image processing, analysis, and machine vision.
Cengage Learning, 2014.
D. A. Forsyth and J. Ponce, \A modern approach,"Computer vision: a modern
approach, vol. 17, pp. 21{48, 2003.
L. Shapiro and G. Stockman, \Computer vision prentice hall,"Inc., New Jersey,
2001.
R. C. Gonzalez, R. E. Woods, and S. L. Eddins,Digital image processing using
MATLAB. Pearson Education India, 2004.
Subject: Image Procesing & Computer Vision Dr. Varun Kumar(IIIT Surat)Lecture 15 14 / 14