You are on page 1of 85

Chapter 03

Image Transforms:

Introduction to Unitary Transform, DFT,


Properties of 2-D DFT, FFT, IFFT,
Walsh transform,
Hadamard Transform,
Discrete Cosine Transform,
Discrete Wavelet Transform

5a/06/11. Using Fast Hadamard transform, find X ([n] for x (n) ={4, 2, 2, 4}
1g/12/10. Prove that 2-Dimensional DFT matrix is unitary matrix
4c/12/10. Derive Fast Walsh Transform flow graph for N=4
3a/12/10. Let x (n) = { 2 [ n] + 3 [ n- ] + 4 [ n- 2] + 5 [ n -3]
Find 4 point DFT using FFT flow graph
2c/12/10. Given f (x , y ) =

5 6 7h (x, y) =
8 9 `10

1 2
3 4

find linear convolution of input image f (x, y)


6. Let x [ n ] be 4 point sequence with X [k ] = { 1, 2, 3, 4}
Find FFT of the following sequence using X [k ] and not otherwise
(1 )

p [ n ] = ( -1)n x [ n ]

( 2)

q [ n ] = x [ -n +1]
2

Discrete Image Transformations:


Apart from DFT, a number of linear transformations can be used for
image processing
Image transform :
Refers to a class of unitary matrices used for representing
images
An image can be expanded in terms of
a discrete set of basis arrays called basis images
Linear Transformations:
1. One Dimensional Discrete Linear Transformations
2. Unitary and Orthogonal Matrices
3. Two dimensional Discrete Linear Transformations
3

One Dimensional Discrete Linear Transformations


if

x is a N . 1 vector
T is a N . N matrix

Then yi

= ti j . X j

Y =
y0 t00 t01 .
y1
.
=
.
yn-1

tn-10

i 0, 1, 2, . . . , N-1

T
. x
. T0 n-1 x0 (y0 = t00 x0 + t01. x1 +

t10 t11 .
.
.

N rows, 1 column

. . .
. . .
. . .

rows

..

+ t0n-1xn-1)

t1 n-1 x1
.
.
tn-1 n-1

x
xn-1

Y defines linear transformation of x


- It is called linear transformation
as it is formed by the first order summation
4
of input elements
- Each element of y,

Unitary and Orthogonal Matrices:


y = T. x

represents linear transformation

There can be infinite number of transformation matrices T,


for above equation.
Commonly used transformation matrices [T ] belongs to
a class of matrices that have certain properties

-1
If T is a unitary matrix, then
T* =T
(conjugate transpose
matrix inverse)
T* indicate complex conjugate of matrix T (imaginary part negated)

i, j rowsj,as
i columns or columns as rows
A indicate transpose of a matrix A, write
-1 transpose of matrix A = A
-1

indicates inverse of a matrix T such that T . T = I (identity matrix)

I identity matrix =

1 0 0 0 n x n square matrix with 1s


5 in main diagonal
0 1 0 0
and zeros elsewhere

Symmetric matrix:
If transpose of matrix is equal to the Matrix
QT = Q
orthogonal matrix:
The matrix whose column and rows are
orthogonal unit vectors
or whose transpose is equal to its inverse
QT = Q -1

y matrix
T is unitary matrix, Then
T*

=T

plying by both sides by T,

ut T . T

=I

-1

where I

-1
-1

T . T* = T . T
is identity matrix

* = I , identity matrix
(Matrix T multiplied by conjugate, transpose of matrix T = Identity m

hus T is a Unitary matrix if

T. T

o find whether matrix T is unitary matrix, check if T . T*

T is unitary and it has only real elements,

hen its orthogonal matrix is same as T, or

if T is unitary matrix, then

multiplying both sides by T:

-1

T*

-1

T =

=I

=T

T . T = T . T

= I identity m

eck whether the one dimensional DFT matrix is an example


unitary transform

ourier Transform F = W . f where f is the input sequence


W is the DFT matrix
if N= 4
1 1 1 1
FT matrix W =
1 j -1 j
1 1 1 -1
1 j -1 -j

T matrix W is unitary matrix if W . W * = I


multiplied by complex conjugate, transpose of W equals I , identity matrix)

W
.
W*

1 1 1 1
1 j -1 j
1 1 1 -1
1 j -1 -j

1
.
1
1

1 1 1
1 j -1 -j
-1 1 -1
-j -1 j

4 0 00
=
0 4 0 0
0 0 4 0
0 0 0 4

= 4[I]

nce DFT is an example of a unitary transform


4, indicates that DFT is not normalized
8

is input sequence in column, then 1-D DFT can be computed by F = W f

Two Dimensional Discrete Linear Transformations:


Input image: f (N x N)
Transformed matrix F ( also N x N)
N-1 N-1
Fm, n =
fi, k (i, k, m, n)
i =0 k =0
where i, k, m and n are the
discrete variables, of range 0 to N-1
(i, k, m, n) can be thought of as an N2 x N2 block matrix
having N rows of N blocks,
each block is N x N submatrix
The blocks are indexed by m, n
and the elements of each block N x N submatrix are indexed by I, k
9

n
0
m
0 [ ]I, k
1 [ ]i, k
.
.
m = N-1

]I, k .

. [

]I, k

]i, k .
.

. [

]i, k

N xN submatrices

n =N-1

.
[

]i, k

]i,k .

]i,k

The transformation (i, k, m, n) is called separable,


- if it can be separated into the products of row-wise and
column-wise component functions
(i, k, m, n) = Trow (i, m) .

Tcol (k, n)

- Thus the transformation can be carried out in two steps:


- Row-wise transformation operation followed by
column-wise transformation operation
N-1
N-1
Fm, n =
[ fi, k Trow (i, m) ] Tco l(k, n)
10
i =0
k =0

Further If the two components Tcol and Trow are identical,


- The transformation is called symmetric,
(colums = rows )
(matrix is equal to its transpose)
(i, k, m, n) = Trow (i, m) . Tcol (k, n)
N-1

N-1

Fm, n =

T (i, m)

i =0

fi,k Trow (k, n)]

k =0

F= TfT
Here Transformation T is both separable and symmetric
The DFT matrix is both symmetric a well as separable
hence Transform can be obtained by using:
F = T. f. T
This is standard formula for computing
transform
of a 2D signal
11

Find the DFT of the given image


0 1 2 1
1 2 3 2
2 3 4 3
1 2 3 2
1 1 1 1
F = T. f.T
Since f is 4 x4 matrix
T = 1 -j -1 j
1 -1 1 -1
1 j -1 -j
T
f
T
1 1 1 1
0 1 2 1
1 1 1 1
F = 1 -j -1 j x
1 2 3 2
x
1 -j -1 j
1 -1 1 -1
2 3 4 3
1 -1 1 -1
1 j -1 -j
1 2 3 2
1 j -1 -j
=

4 8 12 8
-2 -2 -2 -2
0 0 0 0
-2 -2 -2 -2
32
-8
0
-8

-8
0
0
0

0 -8
0 0
0 0
0 0

T is symmetric

1 1 1 1
x 1 -j -1 j
1 -1 1 -1
1 j -1 -j

12

FFT Fast Fourier Transform


- X (k) , The Discrete Fourier Transform (DFT) of x (k) is given by:
N-1
DFT X [k] = x (n) WN
n =0
WN = e j 2 / N

n. k

0 k N-1

(twiddle factor)

The Inverse Fourier Transform (IDFT) of Fourier transform X (k):


x (n) is given by:
N-1
-n k
IDFT x (n) = 1/N
X (k) WN
0 n k-1
k=0
Direct computation of DFT requires about N2 complex multiplications
Fast Fourier Transform (FFT) refers to computation of DFT using fast algorithms:
- Takes about N log2 N computations
N N2
N log2 N
N = number of samples in an image
32 1024
160
N2 = Number of computations for DFT
128 16,384
896
13
2048
4, 194, 304 22,528

Two commonly used Fast Fourier Transform (FFT) algorithms:


1. DIT-FFT Decimation-in-time
(Decimate means kill)
2. DIF- FFT Decimation-in-frequency
rearrange in time)
Decimation-in-time DIT-FFT
- Re-arranging the time signal
- Exploits the symmetric and periodic properties of
the twiddle factor WN :
( WN = e j 2/ N )
(k + N/2 )

= - W N Symmetric

WN

k+N

WN = W N
Periodic
These ktwo properties
j 2 k/ N reduce the number of computations
WN = e

k + N/2 j 2 k/ N
- j2 N / 2N
j 2 k/ N
-j
k
k
=
W
.
-1
=
W
N
N
WN
=e
. e
=e
.e
k
WN k + N = vvN e j2 ( k+ N)/ N = WN e j2 k/N . W Ne j2 = W14
N

The DFT equation is :

N-1

X [k] =

n. k

x (n) WN
n =0
Where WN = e j 2 / N

k = 0, 1, 2, . . . N-1

Decimation-in-time: splits
and even parts:
n. k the input x (n) into
n. odd
k
X [k] = x (n) WN
n even (0, 2, 4. )

x (n) WN

n odd (1, 3, 5

N/2 -1
X [k] =
n=0

N/2 -1
x (2n) WN2 n.k +
n=02n. k

N/2 -1
X2[k] =
n=0

N/2 -1
x (2n) WN +
n=0

Now WN

= WN/2

2nk

x (2n+1) WN(2n+1). k
2n. k

WN = e

jx2.(2n+1)
2 / N WN- j 2 . /W
(NN/2)

=e
15

=WN/2

N/2 -1
X [k] =
n=0

n. k

x (2n) WN/2

N/2 -1
k
+
WN.
n=0

N/2 -1
nk
Let F1(k) = x (2n) WN/2
n=0
X (k) =

k
F1(k) + WN

X (k) =

F2(k)

Both are
n.k
x (2n+1) WN/2
DFTs

N/2 -1
F2(k) =
x(2n+1) WN/2
n=0

N/2 point

nk

F1(k) + WN . F2(k)

for k = 0, 1, 2. .

16

N/2 -1

F1(k) and F2(k) are periodic with period N/2

F1(k+N/2) = F1(k)

and

F2(k+N/2) = F2(k)

WN (k+N/2) = - W Nk

We get

X (k) = F1(k) + WNk F2(k)

k = 0, 1, 2 . . .

X( k + N/2) =

F1(k) - WN

k) and F2(k) requires (N/2)

F2(k)

complex multiplications, each.

o N/2 additional multiplications are required for

s the total multiplications required are


(as compared to N2 )

multiplying w

2
2 . (N/2)
+ 2.N/2
17

X (k )

= F1 (k) + WNk F2(k)

X(k+ N/2) =

F1(k)- WNk . F2(k)

(1)
for k = 0 to N/2 -1

For N = 8 , k will vary from 0, 1, 2, 3 ( 8/2 -1)


For k = 0

For k = 1

X ( 4 ) = F1(0 ) W4 0 . F2 (0)

from (2)

X ( 5 ) = F1(1 ) W4 1 . F2 (1)

X (2) = F1(2 ) + W4 2 . F2 (2)

For k = 2
For k = 3

from (1)

X (1) = F1(1 ) + W4 1 . F2 (1)

For k = 1
For k = 2

= 0 to 3

X (0) = F1(0 ) + W4 0 . F2 (0)

For k = 0

X ( 6 ) = F1(2 ) W4 2 . F2 (2)

X (3) = F1(3 ) + W4 3 . F2 (3)

For k = 3

(2)

X ( 7 ) = F1(3 ) W4 3 . F2 (3)
18

The equations (1) and (2) can be shown using a signal flow graph
for N= 8 as follows:
Input split
Even/odd
F1(0)
F1(0) + WN0 F2(0)
x(0) -----X[0]
N/2 point
WN 0
F1(1)
F1(1) + WN1 F2(1)
x(2) ------DFT
X[1]
(For N =8
WN1
2
F1(2)
x(4) ------4 point
X[2]F1(2) + WN F2(2)
DFT)
WFN2(3) + W 3 F (3)
F1(3)
1
N
2
x(6) -----X[3]
WN3
x(1) -----N/2 point
DFT
x(3) -----(For N=8
4 point
DFT) x(5) -----x(7) ------

F2(0)
F2(1)
F2(2)
F2(3)

-WN0
F1(0) - WN0 F2(0)
X[4]
-WNF11(1) WN1 F2(1)
X[5]
2
-WNF
2
1(2) WN F2(2)
X[6]
3
-WNF (3) W 3 F (3)
1
N
2
X[7]

19

X (k )

= F1 (k) + W Nk F2(k)

X(k+ N/2) =

F1(k)- W Nk . F2(k)

(1)
for k = 0 to N/2 -1

(2)

Since F1(k) and F2(k) are N/2 point DFTs,


These can be further split into odd and even parts
F1(k) =

G1(k)

F1(k+N/4) =
F2(k) =

G1(k)
H1(k)

F2(k+N/4) =

+ WN/2k G2(k)
-

WN/2k G2(k)

k =0, 1, 2 . ., (N/4 -1)

+ WN/2k H2(k)

H1(k) -

WN/2k H2(k)

For N = 8, k will have values

0 to 1

(N/4 -1)

F1(k) and F2(k), N/2 point DFTs


These are split into four N/4 point DFT,s
Flow graph for DFT for 8 point-input:

20

G1(0)
x(0) ------

F1(0)

WN/2
N/4
G (1)
F1(1)
Point x(4) ------ 1
WN/21
DFT

G2(0)

-WN/20F1(2)

N/4 x(2) -----1


Point
G2(1) -WN/2 F1(3)
DFT x(6) -----N/4
Point
DFT

x(1) -----x(5) ------

N/4
x(3) -----Point
DFT
x(7) ------

H1(0)
H1(1)

F2(0)
WN/20

F2(1)

WN/21

H2(0)

1
-WN/2F
2(2)

H2(1) -WN/20 F2(3)

X[0]
X[1]

WN0
WN1

X[2]
X[3]
X[4]
X[5]
X[6]
X[7]

21

WN2
WN3
-WN0
-WN1
-WN2
-WN3

A 2-point DFT is drawn as,

+1
-1
Hence the final flow graph is shown as following

22

x(0)
-1 x (4)
x (2)
-1

x (6)
x (1)

-1

x (5)
x (3)

-1

x (7)

G1(0)
G1(1)

F1(0)
WN/2

F1(1)

WN/21

G2(0)
G2(1)

-WN/21 F1(3)

H2(0)

F2(0)
WN/20
WN/21

X[1]

WN0
WN1

-WN/2F0 1(2)

H1(0)
H1(1)

X[0]

F2(1)

0
-WN/2F
2(2)

H2(1) -WN/21 F2(3)

X[2]
X[3]

WN2
WN3

X[4]
X[5]
X[6]
X[7]

Final signal flow graph for 8-point DIT FFT


The diagram is also called 8-point butterfly diagram
23

-WN0
-WN1
-WN2
-WN3

Bit-reversal
The order of input data can be obtained by reversing bits of
binary representation
000
001
010
011

000
100
010
110

x(0)
x(4)
x(2)
x(6)

100
101
110
111

001
101
011
111

x(1)
x(5)
x(3)
x(7)

24

Decimation in frequency DIF-FFT


Decimation in frequency implies retaining the order of input sequence
but
getting an output which is shuffled up
In this first split up input sequence into the first N/2 data points and
the second N/2 data points
N-1
DFT X [k] =
x (n) WNnk
n =0
WN = e j 2 / N

K = 0, 1, 2, . . . N-1

Split into First half


and
second half parts:
N/2 -1
N -1
X [k] = x(n) WNnk +
x(n ) W Nn k
n=0
n=N/2
(n = 0 to N/2 -1, n = N/2 to N-1)
Substituting n = n + N/2

N/2 -1
X [k] =
n=0

N/2 -1
x (n) WNnk +
n=0

x (n +N/2 )25 WN(n + N/2)k

Solving above equation,


N/2 -1
X [K] = [ x (n) +(-1)k + x (n +N/2)] WNnk
n=0
Split X (K) into odd/ even parts;
N/2 -1
X [2K] = [ x (n) + x (n + N/2)] W N2nk ;
Even part
n=0
N/2 -1
X [2K+1 ] = { [ x (n) x (n + N/2 )] WN n(2k+1)
Odd part
n=0
N/2 -1
X [2K] =
n=0
N/2 -1
X [2K+1 ] =
n=0

[ x (n) + x (n + N/2)] W N/2nk ;


g1

K = 0, 1, . . (N/2 - 1)

(1)

{ [ x(n) x (n + N/2 )] WN/2 nk }. WN/2 n k ; K = 0, 1, . . N/2 - 1 (2)


g2
26

Let g1(n) = [ x (n) + x (n + N/2 )]

and

g2(n) = [ x (n) x (n + N/2 )]


N/2 -1
X [2K] =
n=0
N/2 -1
X [2K+1] =
n=0

g1(n) WN/2 nk

g2(n) WN/2 nk

(3)

(4)

For n =0
g1(0) = x (0) + x (4)
g2(0) = x (0) - x (4)

A signal flow graph of the equations 1, 2, 3, and 4 can be


drawn as follows:
27

Signal flow diagram:


X(0) + x(4)

x(0)
x(1)

g1(0) N/2 Point


g1(1) DFT
g1(2)

x(2)

g1(3)

x(3)

(4 point
DFT)

X[0]
X[2]
X[4]
X[6)]

X(0) - x(4)

wN0 g2(0)

x(4)

-1

x(5)

-1

x(6)
x(7)

-1
-1

wN1
wN2
wN3

N/2 Point
g2(1) DFT
g2(2)
(4 point
g2(3) DFT)

Here input order is retained,


but the output is shuffled

X[1]
X[3)
X[5]
X[7]

k =0, g1(0) = x (0) + x (4)


g2(0) = x (0) x (4)
28

Equations 3 and 4 represent two N/2 point DFT


Since N=8, these two represent two 4-point DFTs
Each of these can be further split into two N/2 point DFTs
Splitting X(2K) into odd and even parts, and solving, we get:
N/4 -1
X(4K) =
[ g1 (n) + g1 (n + N/4)] WN/4nk
n=0
N/4 -1
X (4K+ 2) =
n=0

from (3)

k = 0, 1, . . (N/4 -1)

[ g1 (n) - g1 (n + N/4)] WN/2n WN/4nk k = 0, 1, . . (N/4 -1)

Similarly X (2K + 2 ) can be split into two N/4 point DFTs


A 2-point DFT can be represented as shown below:
+1
-1

29

from (4)

Final, 8-point DIF- FFT signal flow graph will be as follows


X(0)

x(0)
x(1)
x(2)

-1

x(3)

-1
-1

x(5)
x(6)

-1
-1

X(4)

wN/20

-1

x(4)

x(7)

X(2)

-1
wN/21

-1

X(6)

wN0

X(1)

wN1
wN2
wN3

X(3)
X(5)

-1
-1
-1

wN/20
wN/21

X(7)

-1

In DIF-FFT, the output is in the bit reversal format

30

Compute DFT of the image using DIT-DFT


0
1
2
1

1
2
3
2

2
3
4
3

First Row {f(0), f(1), f(2), f(3)} = {0, 1, 2, 1}

1
2
3
2

Since image is 4 x 4, we need to use 4-poit FFT butterfly


We first work along the rows, finding DFT for each row
then along the columns, DFT for each column
G(0)

f(0)
f(2)

1
-1

f(1)
f(3)

W
G(1)
1

H(0)

-1

H(1)
First Row {f(0), f(1), f(2), f(3)} = {0, 1, 2, 1}
G(0) = f(0) + f(2) = 0 + 2 = 2
G(1) = f(0) - f(2) = 0 - 2 = -2
H(0) = f(1) + f(3) = 1 + 1 = 2
H(1) = f(1) - f(3) = 1 - 1 = 0

0
4

W 41
- W 40
- W 41

X[0]
X[1]
X[2]
X[3]

X[0] = G(0) + W40 H(0) = 2 + 1.2 = 4


X[1] = G(1) + W41 H(1) = -2 -j.0 = -2
0
X[2] = G(0) - W
H(0) = 2 1.2 = 0
314
X[3] = G(1) - W41 H(1) = -2 - -j.0 = -2

WN = e j2

/N

WNnk = W4 nk = e j2

For n = 0 , k =0; W40.0 = e j2 / 4


n =1, k =1
W41.1 = e j2 / 4 . 1. 1 = -j
n =2, k =1
W42.1 = e j2 / 4 . 2. 1 = -1
n =3, k =1
W43.1 = e j2 / 4 . 3. 1 = j
n =2, k =2
W44.1 = e j2 / 4 . 2. 2 = 1
n =3, k =2
W43.2= e j2 / 4 . 3. 2 = -1
n =3, k =3
W43.3= e j2 / 4 . 3. 3 = -j
/4 n.k

32

. 0. 0

=1

So FFT of the first row

X [K] = {4, -2, 0, -2}

similarly FFT of remaining three rows can be determined:


4 -2 0 -2
8 -2 0 -2
12 -2 0 -2
8 -2 0 -2

FFT of 1st row


FFT of 2nd row
FFT of 3rd row
FFT of 4th row

Now we can work along each of the columns of the above


intermediate matrix:
Column 1

{4 8 12 8}

f(0) = 4,

f(1) = 8,

using same butterfly we get FFT as


So we will get
-8 0 0
0 0 0
-8 0 0

f(2) = 12, f(3) = 8

{32, -8, 0, -8}

32 -8 0 -8
FFT of 1st column
0
FFT of 2nd column
0
FFT of 3rd column
0
FFT of 4th column
33

Discrete Cosine Transform (DCT)


DCT uses only Cosine waves
(Fourier Transform only sine waves)
Hence DCT is purely real
(Whereas DFT is complex)
One Dimensional DCT of a sequence f (x),
N-1
F (u) = (u)
x =0

0 x N-1

f (x) cos [ (2x +1). u / 2N ]; 0 u N-1

Where
(0) = 1/N;
(u) = 2/N

for u = 0
for 1 u N-1

Inverse transform IDCT


N-1
f (x) =
(u)
F (u) cos [ (2x +1). u / 2N];

34

0 x N-1

-D DCT pair:

N-1 N-1
u, v) = (u). (v)
f (x, y ) cos [ (2x +1).u / 2N] . cos [ (2y +1).v / 2
x =0 y =0
For
u, v = 0, 1, 2, . . , N-1

erse DCT transform IDCT


N-1
N-1
y) = (u) (v) F (u, v) cos [ (2x +1). u / 2N]. Cos [ (2y +1). v / 2N]
u =0
v =0
For x, y = 0 to N-1

35

The N x N Cosine Transform Matrix C = { C (u, v) } defined as;


1/N
C (u, v ) =
2/N

u =0,
. Cos [ (2v +1). u / 2N]

0 v N-1
1 u N-1,

0 v N-1

In this Cosine transform Matrix is real and orthogonal


but Not Symmetric
(transpose of matrix is
not equal to the matrix)
(orthogonal matrix: whose column and rows are
orthogonal unit vectors or
its transpose is equal to its inverse)

36

Cosine transform Matrix is real and orthogonal


( Not Symmetric)

C = C*

(As only real, conjugate is same)

C-1 = C
C. C

(From T.T * = I
=I

unitary matrix equation)

identity matrix

The DCT of a column sequence f (x), 0 x N-1 can be computed


F=C.f

(DFT F =T f)

Since DCT is not symmetric


2-D DCT can be computed by
F=CfC

(DFT F = T f T)

37

Find DCT of the sequence: { 1, 2, 4, 7}


F=C.f
1/N .
u =0,
C (u,v ) =
2/N . Cos [ (2v +1). u / 2N]
Compute C
Since N = 4

0 v N-1
1 u N-1,

0 v N-1

C will be N x N = 4x 4 matrix

u v 0
1
2
3
0 0.5 0.5 0.5 0.5
1 0.653
0.2705 -0.2705 -0.653
2 0.5 -0.5 -0.5 0.5
3 0.2705 -0.653 0.635 -0.2705
C is not symmetric
1/N
for (u=0, v=0 to N-1) =
= = 0.5
2/N . Cos [ (2v +1). u / 2N] for (u=1, v=0) = 2/4 . cos /8 = 0.635
for (u=2, v=0) = 2/4 .cos / 4 = 0.5
38

F=C.f
C

f = { 1, 2, 4, 7}
f

0.5 0.5 0.5 0.5


0.653 0.2705
0.5 -0.5-0.50.5
0.2705 -0.653

F
1 7
-0.2705
-0.653
. 2 = -4.459
4 1
0.635 -0.2705
7 -0.3170

Hence DCT of the given sequence f is { 7, (-4.459), 1, (-0.3170)}


Find the DCT of a 4 x 4 image
4 6 8 3
2 8 10 4
3 8 6 2
F = C . F. C
C
f
0.5 0.5 0.5 0.5
= 0.653 0.2705 -0.2705
0.5 -0.5 -0.5 0.5
0.2705 -0.653 0.635
19 -0.2705 -8
F = -2.6913 -0.2498
-3.50
1.4645
0.0327 -1.6002

2 4 4 2

C (Transpose)
2 4 4 2
0.5 0.653 0.5
-0.653 . 4 6 8 3 . 0.5
2 8 10 4
0.5 -0.2705 -0.5
-0.2705
3 8 6 2
0.5

0.653
2.3087 0.8957
1.5 -1.6885
-0.9562 -0.2448

0.2705
0.2705 -0.5 -0.653
0.635
-0.653 0.5 - 0.2705

39

The Kronecker Product


For two matrices A and B
The Kronecker Product A x B is given by
multiplying B with each element ai j of A and
substituting the multiplied matrices, aijB
for the elements aij of A
Thus if W = A x B, then
a11B
a21B
.
an1B

W=
2
1x
1
2
3x
A x B =1

5
3
5
3

a12B . . a1nB
a22B . . a2nB
.
.
.
an2B If. Aann
=B

22 x 5
1 3
25 x5
1 3=

1
3

2
5

2 5
1 3

B=
2 5
1 3
6 15
3 9

4 10
2 6
10 25
5 15

40

amard Transform

damard transform is based on the Hadamard matrix


ich is a square array having entries of +1 and -1 only

damard matrix of order 2 is given by:


H(2) =

1 1
1 -1

also written as

+ +
+ -

ws and columns of Hadamard matrix are orthogonal;

rthogonality of vectors, the dot product of vectors has to be zero


The first row [ 1 1],

The second row [ 1 -1]

t product = [ 1 1] . [ 1 -1] = [1 1] . 1 = 1.1 +1.-1 = 0


-1
The first

1
column
1
1
1

[1

The
1
-11

1
second-1column
1
-1
41

For unitary transformation,


Matrix inverse A-1 = A *(transpose: row to col, comjugate)
A real unitary matrix is called orthogonal matrix.
For such matrix A -1 = A

( Matrix inverse = transpose)

So for checking if a matrix with real values only, is orthogonal


the A -1 = A
or A . A-1 = A A
or A A = I ( identity matrix)
Is Hadamard matrix orthogonal?
1 1
H(2) = A =
1 -1
A. A = 1 1
1 -1

A =
x1 1
1 -1

1 1
(A transpose: row to col.)
1 -1
2 =02 x
1= 2
0[I]
0 2
0 1

Thus Hadamard matrix is orthogonal, but since we get constant 2, it means


that It is not normalized
Normaized 2 x 2 Hadamard transform, orthogonal matrix is given by
HN(2) =

1/2

1 1
1 -1

42

Is normalized Hadamard matrix orthogonal?


HN(2)1= 1 1/2
1 -1

1/2 1/2
A. A =
1/2 -1/2

A = 1/2

1/2 1/2
=
1/2 -1/2

1 1
1 -1

= [I]

Therefore
1 1
HN(2) = 1/2
1 -1
is called normalized 2x 2 Hadamard matrix

43

1 0
0 -1

Hadamard matrices of the order 2n can be recursively generated


H(2n) = H(2) . H(2n-1)
Therefore H(2) = H(21) x H (20)
similarly H4 = (H2) x H(2)
From Kronecker Product :
=

1 =
. 1H(2)
1 -1

1 1
1 -1
H(4) =
1 1
1 -1

1 1
1 -1
-1 - 1
- 1 +1

1. [H(2) 1. [H(2)
1. [H(2) -1. [H(2)
Sign changes
0
3
1
2

Is H(4) Hadamard matrix is normalized and orthogonal?


A . A = [i]

= 4[I]
4x
0 1 0 0
0 0 1 0
0 0 0 1

1 0 0 0
44

H (4) is normalized and orthogonal:


1 1 1 1
H (4) = A 1 -1 1 -1
1 1 -1 -1
1 -1 -1 1
A.A

1
=
1 -1 1
1 1 -1 -1
1 -1 -1 1

1 1 1
A =
1 1 -1 -1
1 -1 -1 1

Check A . A = 1

1 -1 1 -1

1 1 1 1 1 1 1
-1 .
1 -1 1 -1
1 1 -1 -1 0 0 4
1 -1 -1 1
0

4 0 0 0
=
0 4 0 0
0
0 0 4

H(4) is orthogonal, but not normalized:


1 0 0 0
Normalized H(4) = 1 4 0 1 0 0
0 0 1 0
0 0 0 1

45

= 4[I]

Hence Normalized 4 x 4 Hadamard transform is given by


1 1 1 1
1 -1 1 -1
HN(4) = 1/ 4
1 1 -1 -1
1 -1 -1 1
Since H(2n) = H(2) x H(2n-1)
H(8) = H(2) x H(2 3-1) = H(2) x H(4)
1. [H(4)]
H(8) =
1. [H(4)]

8 = 23

1. [H(4)]
( Kronecker product)
-1. [H(4)]
Sign change

1 1 1 1
1 -1 1 -1
1 1 -1 -1
1 -1 -1 1
H(8) =
1 1 1 1
1 -1 1 -1
1 1-1 -1
1 -1 -1 1

1 1 1 10
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 1 -1

7
3
4
1
6
2
5

46

Using equation:

A. A

=[I]

H(8) x H(8) = 8 x [ I ] can be proved as orthogonal

Thus H(8)N = 1 8
normalized

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 -1 -1
1 -1 -1 1

Sign
change
0
7
3
4

1 1 1 1 -1 -1 -1 -1 1
1 -1 1 -1 -1 1 -1 1 6
1 1 -1 -1 -1 -1 1 1 2
-1 -1 1can 1be
-1considered
1 -1 5 to be samples of rectangular
The rows of Hadamard1 matrix
waves with sub-period of 1/ N units

47

Hadamard Transform Basis Function for N = 8


Hadamard signal representation is similar to Fourier Representation
Sequency
is defined
as half
the
number
of zero
crossing

Dotted lines
are the
Fourier basis

48

If x (n) is N point one dimensional sequence of finite valued real numbers


arranged in column, then
the Hadamard transformed sequence is given by :

X=T.x
X [n] = [ H (N). x (n)]

where x (n) is a column vector

H(N) is a N x N Hadamard matrix where N is the number of data points


The inverse Hadamard tranform is given by:
x (n) = 1/ N [H (N) X [n] ]
Where x (n) is a column vector

49

12th August

50

Compute the Hadamard Transform of the data sequence { 1, 2, 0, 3}


Here N =4
H (N) is a 4 x 4 matrix

X [n] = [H (N). x (n)]

X[n] =

1 1 1 1
1 -1 1 -1
1 1 -1 -1
1 -1 -1 1
H (N)

1
2
0
3
x (n)

1 +2 +0 +3
1 2 +0 -3
1 + 2 -0 -3
1 -2 -0 +3

6
-4
0
2

X [n]

51

Compute the Inverse Hadamard Transform of the data sequence { 6, -4, 0, 2}


Here N =4
The inverse Hadamard transform is:
x (n) = 1/ N . H (N) . X [n]

x(n) = 1/4

1/ N

1 1 1 1
1 -1 1 -1 .
1 1 -1 -1
1 -1 -1 1
H(N)

6
-4 = 1/4
0
2

6 -4 +0 +2
6 +4 +0 -2
6 -4 -0 -2
6 +4 -0 2

= 1/4

X [n]

Hence the data sequence is { 1, 2, 0, 3}

52

4
8
0
12

1
2
0
3

Hadamard transformation for a 2-D sequence of size N x N


If f is N x N image
F is transformed image
The Hadamard transform is given by :

F = T. f . T = [ H (N) . f. H (N)]

Compute Hadamard transformation of the image:


1232
2343
1232
The image is 4 x 4
F=
H(4) .
f.
H (4)
1 1 1 1
2121
1 1 1 1
1 -1 1 -1 1 2 3 2
1 -1 1 -1
F =
1 1 -1 -1
. 2343
. 1 1 -1 -1
1 -1 -1 1 1 2 3 2
1 1 -1 -1
6 8 12 8
2 0 0 0

1 1 1 1
1 -1 1 -1

34 2 -6 -6
2 2 2 2

2121

53

Fast Hadamard Transform


in general Hadamard transform involves N (N-1) additions
For N=2
Number of addition = 2.1 = 2
N=4
-do- = 4.3 = 12
N =8
-do= 8 x 7 = 54
If x (n) = { 4, 2, 2, 4}
X [n] = [H (4) . X (n)] 1 1 1 1
1 -1 1 -1
1 1 -1 -1
1 -1 -1 1

X [n] =

4
2
2
4

4.1 + 2.1 + 2.1 + 4.1


4.1+- 2.1 + 2.1 +- 4.1
4.1 +2.1 +-2.1 +-4.1
4.1 +-2.1 +-2.1 +4.1

12
0
0
4

Number of additions = 12,

3 per row

Since the Hadamard matrix is obtained through Kronecker product ,


it is possible to reduce the number of additions

54

Butterfly diagram for Fast Hadamard transform


Case 1: N = 2 If the data sequence is x (n) = { x(0), x(1) }
draw the butterfly diagram to compute Hadamard transform
Since N= 2 we require H(2)

X [n] = [ H(2) . x (n)]


X[0]
X[1]

x(0)
x(1)

= 1 1
= 1 -1

x(0)
.

x(1)

X[0] = [ x(0).1 + x(1).1]


X[1] = [ x(0).1 - x(1).1]
x(0) + x(1)

-1

x(0) - x(1)

X [0]
X[ 1 ]

X(1). ()
2 point Butterfly for Haddamard
55

Butterfly diagram for Hadamard transform


Case2: N = 4If the data sequence x(n) is { x(0), x(1), x(2), x(3) }
draw the butterfly diagram to compute Hadamard transform
Since N= 4 we require H(4)

X [n] = [ H(4) . X (n)]


1 1
1 -1
X[n] =
1 1
1 -1

1 1
1 -1

x(0)

-1 -1
-1 1

x(2)
x(3)

x(1)

Since H(4) is generated using Kronecker product


X[0]
X[1]
X[2]
X[3]

H(2)
=

H(2)

x(0)
x(1)
H(2) - H(2)
x(2)
x(3)
56

We partition H(4) as well as input


Let

G(0) =[H(2)] x(0)


G(1)
x(1)

=1 1
1 -1

x(0)
x(1)

H(0) =[H(2)]
x(2)
H(1)
x(3)
From above:
G(0) = x(0 )+ x(1)
G(1) = x(0) - x(1)
4 additions
H(0) = x(2) + x(3)
H(1) = x(2) - x(3)
Writing X [. ] in terms of G (.) and H(.)
X(0) = [ G(0) + H(0) ]
[ { x(0) + x(1)} + {x(2) +x(3)}]
X(1) = [ G(1) + H(1) ]
[ { x(0) - x(1)} + {x(2) -x(3)}]
4 additions
X(2) = [ G(0) - H(0) ]
[ { x(0) + x(1)} - {x(2) +x(3)}]
X(3) = [ G(1) - H(1) ]
[ { x(0) - x(1)} - {x(2) -x(3)}]
57

Drawing the Butterfly diagram


= x(0 )+ x(1)

x(0)
x(1)

X [0]

G (1)

= x(0 )- x(1)

H (0)

= x(2 )+ x(3)

-1

x(2)
x(3)

= G(0 )+ H(0)

G (0)

X [1]

= x(2 )- x(3)

H (1)
-1

X [2]

-1

X [3]

-1

= G(1 )+ H(1)
= G(0 )-H(0)
= G(1 )-H(1)

Using Butterfly diagram which is also called Fast Hadamard Transform


The total number of additions required are 4 + 4 = 8 in place of 12 (N. N-1)
Similarly for N = 8, the number of additions required are 24 ( instead of 56)

58

Given x (n) { 4, 2, 2 4}
Find X [n] using Fast Hadamard Transform
Since N = 4, a 4-point butterfly diagram can be used
G (0) = 6

x(0) 4
x(1) 2

G (1) = 2
-1

x(2) 2
x(3) 4

X [0] = 12
X [1] = 0

H (0) = 6

-1

H (1) = -2
-1

-1

X [2] = 0
X [3] = 4

G(0) = x(0) + x(1) = 4 + 2 = 6


G(1) = x(0) - x(1) = 4 - 2 = 2
H(0) = x(2) + x(3) = 2 + 4 = 6
H(1) = x(2) - x(3) = 2 - 4 = - 2
X[0] = [ G(0) + H(0)]
X[1] = [ G(1) + H(1)]
X[2] = [ G(0) - H(0)]
X[3] = [ G(1) - H(1)]
X [n] = { 12, 0, 0, 4}

= 6 + 6 = 12
= 2 + -2 = 0
= 6+ 6 = 0
= 2 - -2 = 4
59

For N =8
X[0]
X[1]
X[2]
X[3]
X[4]
X[5]
X[6]
X[7]
X[0]
X[1]
X[2]
F
X[3]
X[4]
K
X[5]
X[6]
H
X[7]
E

H(4)

H(4)

x(0)
H(4)
x(2)
x(3)
x(4)
- H(4)
x(6)
x(7)

H(2)

H(2)

H(2)

-H(2)

H(2)

H(2)

H(2)

- H(2)

H(2)
x(1)
H(2)
x(3)
-H(2)
x(5)
-H(2)
x(7)

x(1)

x(5)

H(2)

x(0)

-H(2)

x(2)

-H(2)

x(4)

H(2)

x(6)

60

Let

E [0] = 1
E [1] = 1 -1

1
x (0)
x (1)

F [2] = 1 1
F [3] = 1 -1

x (2)
x (3)

G [4] = 1 1
G [5] = 1 -1

x (4)
x (5)

H [6] = 1 1
F [7] = 1 -1

x (6)
x (7)

E[0] = x (0) + x (1)


E[1] = x (0) - x (1)
F[0] = x (2) + x (3)
F[1] = x (2) - x (3)
G[0] = x (4) + x (5)
G[1] = x (4) - x (5)
H[0] = x (6) + x (7)
H[1] = x (6) - x (7)
61

E(0)
x(0)

H(4) I(0)

H(8)
X [0]

E(1)
x(1)
-1
F(0)
x(2)

I(1)

X [1]

I(2)

X [2]

I(3)

X [3]

J(0)

X [4]

G(1)
x(5)

J(1)

X [5]

H(0)
x(6)

J(2)

X [6]

J(3)

X [7]

F(1)
x(3)
-1
G(0)
x(4)
-1

H(1)
x(7)
-1

-1
-1

-1
-1

I(0) = E(0) + F(0), I(2) = E(0) - F(0)


I(1) = E(1) + F(1), I(3) = E(1) - F(1)
j(0) = G(0) + H(0), J(2) = G(0) - H(0)
j(1) = G(1) + H(1), J(3) = G(1) - H(1)

-1
-1
-1

-1
X[0] = I[0] + J[0],
X[1] = I[1] + J[1],
X[2] = I[2] + J[2],
X[3] = I[3] + J[3],

X[4] = I[0] J[0]


X[5] = I[1] J[1]
X[6] = I[2] J[2]
X[7] = I[3] J[3]
62

Compute Fast Hadamard of the sequence x (n) { 1, 2, 1, 1, 3, 2, 1, 2}


1

E(0) =3
x(0)

E(1) =-1
x(1)

F(0) =2
x(2)

F(1) =0
x(3)

3
2
1
2

H(4) I(0) =5

H(8)
X [0]

=13

I(1) =-1

X [1]

=-1

I(2) =1

X [2]

=3

I(3) =-1

X [3]

=1

G(0) =5
x(4)

J(0)=8

X [4]

G(1) =1
x(5)

J(1)=0

X [5]

H(0) =3
x(6)

J(2)=2

X [6]

J(3)=2

X [7]

H(1) =-1
x(7)

-1
-1

-1

-1
I(0) = E(0) + F(0), I(2) = E(0) - F(0)
I(1) = E(1) + F(1), I(3) = E(1) - F(1)

j(0) = G(0) + H(0), J(2) = G(0) - H(0)


j(1) = G(1) + H(1), J(3) = G(1) - H(1)

-3

-1

=-1

-1

=-1

-1

-1
X[0] = I[0] + J[0],
X[1] = I[1] + J[1],
X[2] = I[2] + J[2],
X[7] = I[3] + J[3],

=-3
X[4] = I[0] J[0]
X[5] = I[1] J[1]
X[6] = I[2] J[2]
X[7] = I[3] J[3]
63

Total additions/subtraction = 24 (N log2N)as opposed to 8 x (8-1) = 56

Walsh Transform:
The Walsh transform matrix is obtained from Hadamard matrix
by re-arranging the rows in increasing order of sign
Sign change

H(8) =

W(8) =

1 1 1 1
1 -1 1 -1
1 1 -1 -1
1 -1 -1 1

1 1 1 10
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 -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
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 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
1 -1 1 -1

7
3
4
1
6
2
5
0
1
2
3
4
5

Rearranging sign changes


In ascending order
Walsh transform

6
7
64

Plotting each of the row of the Hadamard matrix gives us the


Walsh basis functions
(The combination of basis functions represent the
continuous functions)
Walsh transformation can be calculated using the matrix equations
X [n] = W (N) . x (n)
The Inverse Walsh transformation is given by
x (n) = 1/N . [ W(N) . X (n) ]

65

Walsh basis functions

Sequency

Sign changes

66

Compute Discrete Walsh function of the data sequence {1, 2, 0, 3}

H(4) =

1 1
1 -1

1 1
1 -1

0
3

1 1
1 -1

-1 - 1
- 1 +1

1
2

Sign change

Rearranging sign changes


In ascending order
1 1
W(4) = 1 1
1 -1
1 -1
X [n ] =
X [n] =

1 1
-1 - 1
- 1 +1
1 -1

0
1
2
3

W (n)
1 1
1 1
1 -1
1 -1

.
1 1
-1 - 1
- 1 +1
1 -1

x (n)
..

1
2
0
3

X [n]
1 +2 +0 +3
= 1 +2 -0 -3
1 -2 -0 +3
2
1 -2 +0 -3
-4
67

6
=

The Haar Transform


- It is derived from Haar Matrix
Haar transform like most of the other transforms is
separable and can be expressed as:
F=HfH
where f is N x N image
H is N x N transformation matrix
F is the resulting N x N matrix
The Haar transform H contains, the Haar basis functions hpq (x)
which are defined over the continuous closed interval x[0, 1]
The Haar basis functions are:
h00 (x) = 1/N .

x [0,1]

2p/2; (q - 1)/ 2p x (q 0.5)/ 2 p


hpq (x) = 1/N
- 2p/2; (q 0.5)/ 2p x q / 2p
0 ; otherwise, x [0,1]
68

Haar Transformation matrix


Case1: N = 2
0 p log2 N
0p1
Therefore p =0
Now
1 q 2p
1 q 20
Therefore

log22 = 1
20 =1
q =1

As h00 (x) = 1/ N . x [0,1]


Therefore
h00 (x) = 1/2 . x [0,1]
20/2 ; (1-1)/20 x (1 0.5)/ 20 for p =0, q =1
hpq (x) = 1/ N
- 20/2; (1 0.5)/ 20 x 1/ 20
0; otherwise
h01 (x) = 1/ 2

1;
-1;

0 x 0.5
0.5 x 1

69

From above equations


h01(x)

h00(x)
1/2

1/2
0.5

0.5

-1/2

Sampling the above two waveforms with N=2


1/2

1/2

1
1

-1/2

Writing in matrix form


Haar(2) = 1/ 2

1 1
It is same as Hadamard HN(2)
1 -1

70

Similarly, Haar(4) for N = 4 can be found out


1
1 1
1
1
1 -1 -1
2 -2 0
0
0
0 2 - 2

Haar(4) = 1/ 4

Haar(8) for N = 8

Haar(8) = 1/ 8

1
1
2
0
2
0
0
0

1
1
2
0
-2
0
0
0

1 1 1
1 1 -1
-2 -2 0
0
0 2
0
0 0
2 -2 0
0
0 2
0
0 0

1
-1
0
2
0
0
-2
0

1
1
-1 -1
0
0
-2 -2
0
0
0
0
0
0
2 -2

1/ 8 is required to normalize the matrix


71

Find the Haar transform of the signal x (n) = {1, 2, 0, 3}


X [n] = [ Haar (N) . x (n) ]

= 1/ 4

1
1 1 1
1
1 1 .-1 -1 =1/2 2
2 -2 0 0
0
0 0 2 -2
3

1+2+0+3
1+2-0-3 =1/2
2- 22+0+0
0+0 +0 -32

X [n] = 1/2{ 6, 0, -2, -32}

72

6
0
-2
-32

Find the Haar Transform of the given pseudo image


2 1 2 1
1 2 3 2
2 3 4 3
1 2 3 2
F = [ Haar (N) . f . Haar (N) ]
=
Haar (N)
.
= 1/ 4

F=

1 1 1 1
1 1 -1 -1
.
2 -2 0 0
0 0 2 -2

8.5
-1.5
-0.707
1.414

f.
2
1
2
1

Haar (N)

1 2 1
1 1 1 1
2 3 2
1 1 -1 -1
. 1/ 4
3 4 3
2 -2 0 0
2 32
0 0 2 -2

-1.5 -o.707 1.414


0.5 0.707
0
0.707 1.00 0
0.000.000.00

73

Modified Haar Transform (Fast Haar)


It is slight modification of Haar Transform
increases the speed of implementation
Retains the sign changes
Replaces all non-zero values by 1,
2 and 2 by 1
- 2 and -2 by -1
1 1
1 -1

Haar (2)M =

1
1 1 1
1 1 -1 -1
1 -1
0 0
Haar(4)M =0 0 1 -1
1
1
1
0
1
0
Haar(8) M =0
0

1 1 1 1 1 1 1
1
1 1 -1 -1 -1 -1
1
-1 -1 0 0 0 0
0
0 0 1 1 -1 -1
-1
0 0 0 0 0 0
0
1 -1 0 0 0 0
0
0 0 1 -1 0 0
0 0 0 0 0 0 1 -1

Global properties
Semi-Global properties
Local properties
74

E(0)
x(0)
E(1)
-1 x(1)
G(0)
x(2)
G(1)
-1 x(3)

A(0)

X[4]
-1

A(1)

B(0)
1

x(5)H(1)
x(6)F(0)

X[2]
X[5]

x(4)H(0)
-1

X[0]

-1

X[1]
X[6]

B(1)
-1

x(7)F(1)
-1

X[3]
X[7]

Butterfly diagram for Modified Haar

75

Compute the modified Haar For the given signal


x (n) = { 8, 2, 1, 3, 5, 6, 4, 7}

10+4 = 14

x(0)
8+28= 10
-1

using butterfly diagram


14+22 = 36
X[0] 36
1
X[4] 6

x(1)2
8-2 = 6
x(2)1
1+3 = 4

-1

X[2] 6

10-4 = 6

-1 x(3)
1-33 = -2

X[5] -2
11+11 = 22

x(4)5+6
5 = 11

-1

6 = -1
-1 x(5)5-6
x(6)4+7
4 = 11

X[1]
-8 = -8
14-22
X[6] -1

-1

11-11 = 0

X[3] 0

7 = -3
-1 x(7)4-7

X[7] -3

X [k] = {36, 6, 6, -2, -8, -1, 0, -3}

76

The result can be checked using standard equation:

X = HaarM (N) . x(n)


HaarM(N) .

1
1
1
0
1
0
0
0

1 1 1 1
1
1 1 -1
1
-1 -1 0
0
0 01
-1
0 0 0
0
1 -1 0
0
0 .0 1
0 0 0 0 0

x(n)
1
-1
0
1
0
0
-1
0

1
-1
0
-1
0
0
=0
1

1
-1
0
-1
0
0
0
-1

X
8
2
1
3
5
6
4
7

8+2+1+3+5+6+4+7 = 36
8+2+1+3 -5 -6-4-7 = -8
8+2-1- 3
=6
+5+6-4-7 = 0
8-2+0+0 -0 -0-0-0 = 6
0+0+1-3 -0 -0-0-0 = -2
0+0+0+0 +5 -6-0-0 = -1
0+0+0+0 -0 -0+4-7 = -3

36
-8
6
0
6
-2
-1
-3

77

Generate the pattern/ basis images for the Walsh transform N =4


W(4) = 1 1 1 1
1 1 -1 -1
1 -1 -1 1
1 -1 1 -1

Col. 0

u/v 1 1 1 1
00
1 1 1 1
1
1 1 1 1
1
1 1 1 1
1
1 1 1 1
1
10
1 1 1 1
1
1 1 1 1
1
-1-1 -1 -1
-1
-1-1 -1 -1
-1
20
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
01
1 1 -1 -1
1 1 -1 -1
1 1 -1 -1
1 1 -1 -1
11
1 1 -1 -1
1 1 -1 -1
-1 -1 1 1
-1 -1 1 1
21
1 1 -1 -1
-1 -1 1 1
1 1 -1 -1
-1 -1 1 1

2
3
1 -1 -1 1
02
03
1 -1 -1 1
1 -1 -1 1
1 -1 -1 1
1 -1 -1 1
12
13
1 -1 -1 1
1 -1 -1 1
-1 1 1 -1
-1 1 1 -1
22
23
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
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
1 -1 1 -1
-1 1 -1 1
1 -1 1 -1
-1 1 -1781

rows

1 1 1

1
1
1
1

1
1
1 -1
-1
1
-1
2 -1
1
1
-1
3 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 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 1 1 1
-1 -1 -1 -1
1 1 1 1
1 1 1 1

0
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 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 1
1 1
-1 -1
1 1
1 1

1
1
1
1

1
1
1
1

2
1 -1 -1
1
1
1
1

-1
-1
-1
-1

-1
-1
-1
-1

3
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 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
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 -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
1

1 1 1
-1 1 -1
1 1 1
1791 1

1
1
1
1

80

81

END

82

WN = e j2

/N

WNnk = W4 nk = e j2

W 40

For n = 0 , k =0; W40.0 = e j2 / 4


n =1, k =1
W41.1 = e j2 / 4 . 1. 1 = -j
n =2, k =1
W42.1 = e j2 / 4 . 2. 1 = -1
n =3, k =1
W43.1 = e j2 / 4 . 3. 1 = j
n =2, k =2
W44.1 = e j2 / 4 . 2. 2 = 1
n =3, k =2
W43.2= e j2 / 4 . 3. 2 = -1
= 1 n =3, k =3
W43.3= e j2 / 4 . 3. 3 = -j
/4 n.k

W41 = - j
W42 = -1
W43 = j
W44 = 1

83

. 0. 0

=1

3a / 12/2010
Let x (n) = { 2 [ n] + 3 [ n- 1] + 4 [ n- 2] + 5 [ n -3]
Find 4 point DFT using FFT flow graph
From above x (n) = { 2, 3, 4, 5}

x (0)

x (2)

x (1)
x (3)

4
-1

-2

-2

3
5-1

8
-2

8
-2

14

X (0)
W 40

-2 +2j

X(1)
W 41

-2

X(2)
-W40

-2 -2j
X (3)
-W41

W40 = 1, W41 = - j
84

8-point DIT FFT flow diagram

85

You might also like