0% found this document useful (0 votes)
14 views65 pages

transforms notes

The document discusses various types of matrices, including symmetric, Hermitian, orthogonal, and Toeplitz matrices, and their properties. It also covers concepts related to linear systems, impulse response, convolution, and image transforms in the frequency domain, emphasizing the importance of these techniques in image processing. Additionally, it highlights the Fourier Transform and its applications in transforming images for better processing and analysis.

Uploaded by

adrijazen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views65 pages

transforms notes

The document discusses various types of matrices, including symmetric, Hermitian, orthogonal, and Toeplitz matrices, and their properties. It also covers concepts related to linear systems, impulse response, convolution, and image transforms in the frequency domain, emphasizing the importance of these techniques in image processing. Additionally, it highlights the Fourier Transform and its applications in transforming images for better processing and analysis.

Uploaded by

adrijazen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

Image Transforms and Image

Enhancement in Frequency
Domain
Types of Matrix
• Symmetric Matrix: A is called symmetric if
𝐴" = 𝐴
• Hermitian Matrix: A is called Hermitian if
𝐴∗" = 𝐴
• Orthogonal Matrix
𝐴%& = 𝐴"
• Unitary Matrix
𝐴%&= 𝐴∗"
Types of Matrix
• Toeplitz Matrix: A NXN matrix is a Toeplitz matrix if
• The diagonals contain the same elements
• Each of the sub diagonals contain the same elements
𝐴 𝐵 𝐶 𝐷
𝐸 𝐴 𝐵 𝐶
𝐹 𝐸 𝐴 𝐵
𝐺 𝐹 𝐸 𝐴
• Circulant Matrix : each row is obtained by the circular shift of the previous
row
𝐴 𝐵 𝐶 𝐷
𝐷 𝐴 𝐵 𝐶
𝐶 𝐷 𝐴 𝐵
𝐵 𝐶 𝐷 𝐴
LINEAR SYSTEM
• f(m,n)-----Input sequence, g[m,n]= output sequence

f(m,n) g[m,n]
T
• The 2-D system can be written as
𝑔 𝑚, 𝑛 = 𝑇𝑓 𝑚, 𝑛

• A system is called linear if and only if any linear combination of two


inputs 𝑓1 𝑚, 𝑛 and 𝑓2 𝑚, 𝑛 produces the same combination of their
respective outputs 𝑔1 𝑚, 𝑛 and 𝑔2 𝑚, 𝑛 .
𝑇 𝑎𝑓1 𝑚, 𝑛 + 𝑏𝑓2 𝑚, 𝑛 = 𝑎𝑇𝑓1 𝑚, 𝑛 + 𝑏𝑇𝑓2 𝑚, 𝑛
width = b

(infinitely high,

LINEAR SYSTEM infinitely narrow)

• Dirac Delta or Impulse function: x


>
𝛿 𝑥 =0 𝑥 ≠ 0 𝑎𝑛𝑑 = 𝛿 𝑥 𝑑𝑥 = 1
%> Note that the integral of the delta function is the area under the curve, and has been held c
throughout the limit process.
• Dirac Delta function a derivative of the unit step 1
function.
• Amplitude of dirac delta function at 𝑥 = 0 shouldShifting
be the origin. Just as a parabola can be shifted away from the origin by writing
instead of , any function can be shifted to the right by writing in place of x
infinite so that area under curve is unity. y
>
• Sifting Property: ∫%> 𝑓(𝑥)𝛿 𝑥 − 𝑥0 𝑑𝑥 = 𝑓(𝑥0)
• When a delta function 𝛿 𝑥 − 𝑥0 multiplies another x
function 𝑓(𝑥), the product must be zero everywhere x0
except at the location of the infinite peak 𝑥0 is Shifting the position of the peak doesn’t affect the total area if the integral is taken from –
interval from a to b contains the peak.
1

For that matter, since all of the area occurs right in one spot, one can write:

Delta functions – pg 1
Impulse Response
𝛿 𝑚 − 𝑚& , 𝑛 − 𝑛& T ℎ 𝑚, 𝑛; 𝑚& , 𝑛&

• When the input is a delta function at location [𝑚& , 𝑛& ], the output at
location [𝑚, 𝑛] is given by

ℎ 𝑚, 𝑛; 𝑚& , 𝑛& = 𝑇𝛿[𝑚 − 𝑚& , 𝑛 − 𝑛& ]

• This is called the impulse response of the system. Takes general, negative
as well as complex values

• Point Spread Function : A impulse response is called a Point Spread


Function (PSF) when the input and output represent a positive quantity
such as intensity of light
Impulse Response
• Output of any linear system can be obtained from its impulse response and
input by applying Superposition Theorem

𝑔 𝑚, 𝑛 = 𝑇𝑓 𝑚, 𝑛

𝑔 𝑚, 𝑛 = 𝑇[G G 𝑓 𝑚$, 𝑛$ 𝛿[𝑚 − 𝑚$, 𝑛 − 𝑛$]]


!" #"

𝑔 𝑚, 𝑛 = G G 𝑓 𝑚$, 𝑛$ 𝑇[𝛿[𝑚 − 𝑚$, 𝑛 − 𝑛$]]


!" #"

𝑔 𝑚, 𝑛 = G G 𝑓 𝑚$, 𝑛$ ℎ[𝑚 − 𝑚$, 𝑛 − 𝑛$]


!" #"
Convolution
• A convolution operation is a cross-correlation where the filter is
flipped both horizontally and vertically before being applied to the
image: > >
𝑔 𝑚, 𝑛 = G G 𝑓 𝑚&, 𝑛& ℎ[𝑚 − 𝑚&, 𝑛 − 𝑛&]
H" I"
How to perform convolution?
• In order to perform convolution on an image, following steps should
be taken.
• Flip the mask (horizontally and vertically) only once
• Slide the mask onto the image.
• Multiply the corresponding elements and then add them
• Repeat this procedure until all values of the image has been
calculated.
Convolution
• Flipping of the kernel along, rows followed by a flip along its columns
Convolution Example
1
4 5 6
Pb) Convolve ℎ 𝑚, 𝑛 = 1 with 𝑥 𝑚, 𝑛 =
7 8 9
1
SOLUTION: After convolution of the two signals the dimension of the
resultant matrix is given by

Dimension Y= ( No. of rows of x+ no of rows of h-1) X (No. of columns


of x-1 + no of columns of h-1)
Here dimension of Y is (2+3-1)X (3+1-1)=4 X 3
1
4 5 6
• ℎ 𝑚, 𝑛 = 1 with 𝑥 𝑚, 𝑛 =
7 8 9
1

4 5 6
11 13 15
• Ans: 𝑌 = 11 13 15
7 8 9
Convolution Example
123
Pb) Convolve ℎ 𝑚, 𝑛 = 3 4 5 with 𝑥 𝑚, 𝑛 = 4 5 6
789
SOLUTION: After convolution of the two signals the dimension of the
resultant matrix is given by

Dimension Y= ( No. of rows of x+ no of rows of h-1) X (No. of columns


of x-1 + no of columns of h-1)
Here dimension of Y is (3+1-1)X (3+3-1)=3 X 5
123
• ℎ 𝑚, 𝑛 = 3 4 5 with 𝑥 𝑚, 𝑛 = 4 5 6
789

3 10 21 22 15
• 𝑌 = 12 31 58 49 30
21 52 94 76 45
Convolution Example
11 123
Pb) Convolve ℎ 𝑚, 𝑛 = 1 1 with 𝑥 𝑚, 𝑛 = 4 5 6
11 789
SOLUTION: After convolution of the two signals the dimension of the
resultant matrix is given by

Dimension Y= ( No. of rows of x+ no of rows of h-1) X (No. of columns


of x-1 + no of columns of h-1)
Here dimension of Y is (3+3-1)X (3+2-1)=5 X 4
11 123
• ℎ 𝑚, 𝑛 = 1 1 with 𝑥 𝑚, 𝑛 = 4 5 6
11 789

1 3 5 3
5 12 16 9
• 𝑌 = 12 27 33 18
11 24 28 15
7 15 17 9
Image Transforms
• Most image processing applications are real timed
• Require very fast and simple operations
• Often Processing in frequency domain is easier than in the time
domain

• Frequency in image processing is the rate of change of pixel intensity


of an image in space
Image Transforms
• Transformation is a mathematical tool which allows us to move from one
domain to another domain

• Mainly done for mathematical convenience and to extract more


information
WHY TRANSFORM?
• Better image processing
• Take into account long-range correlations in space
• Conceptual insights in spatial-frequency information.
what it means to be “smooth, moderate change, fast change, …”
• Fast computation: convolution vs. multiplication

• Alternative representation and sensing


• Obtain transformed data as measurement in radiology images (medical and
astrophysics), inverse transform to recover image

• Efficient storage and transmission ?


• Energy compaction
• Pick a few “representatives” (basis)
• Just store/send the “contribution” from each basis
Classification of Image Transforms
• Broadly classified into sinusoidal basis based orthogonal transforms
and non-sinusoidal basis based orthogonal transforms

• Sinusoidal basis based orthogonal transforms : Fourier Transform


(FT), Discrete Cosine Transform (DCT) , Discrete Sine Transform (DST)

• Non-Sinusoidal basis based orthogonal transforms : Haar Transform


(Wavelet), Walsh Hadamard, Slant Transform
Fourier Transform

• Fourier transform: a
continuous signal can be
represented as a
(countable) weighted sum
of sinusoids.
• Transform an intensity
image into the domain of
spatial frequency
1-D continuous FT
n 1D – FT

real(g(wx)) imag(g(wx))

w =0

n 1D – DFT of length N

w =7

x x
Fourier Transform
• CTFT:
𝑥 𝑡 → 𝑋(Ω)
>
•𝑋 Ω = ∫%> 𝑥 𝑡 𝑒 %VWX 𝑑𝑡
• DTFT: A continuous time signal x(t) is converted to discrete time
signal x(nT) by sampling process (T : sampling interval)

• 𝑋 𝑒 VY = ∑>
I[%> 𝑥 𝑛𝑇 𝑒
%VWIX

• 𝑋 𝑒 VY is the Discrete Time Fourier Transform and is a continuous


function of 𝜔.
Fourier Transform (Relation between 𝜔 and Ω)
• 𝜔 = ΩT ; Ω = 2π𝑓;
• 𝜔 = 2π𝑓T where T is sampling interval
& b
• Sampling frequency 𝑓` = "
. Thus, 𝜔 = 2π b = 2π𝑘
%
b
• Where 𝑘 = b%
.
Y f
• To limit the infinite number of values to a finite number, de
=g
• The DFT of finite duration sequence is defined as
g%&
−𝑗2𝜋𝑘𝑛
𝑋 𝐾 = G 𝑥 𝑛 exp( )
𝑁
i
Where k=0,1…………N-1
2D DFT

• 𝑓 𝑚, 𝑛 → 2𝐷 𝐷𝐹𝑇 → 𝐹(𝑘, 𝑙)

%VdrfH %VdrsI
• F 𝑘, 𝑙 = ∑q%& g%&
q[i ∑g[i 𝑓 𝑚, 𝑛 exp q
exp g

• Inverse Transform

& VdrfH VdrsI


• 𝑓 𝑚, 𝑛 = q×g ∑q%& ∑g%&
f[i s[i 𝐹 𝑘, 𝑙 exp q
exp g
2D DFT
%VdrfH %VdrsI
• F 𝑘, 𝑙 = ∑q%& ∑ g%&
q[i g[i 𝑓 𝑚, 𝑛 exp exp
q g
• F 𝑘, 𝑙 = 𝑅 𝑘, 𝑙 + 𝑗𝐼(𝑘, 𝑙)

• In polar form , F 𝑘, 𝑙 is written as 𝐹 𝑘, 𝑙 = 𝐹 𝑘, 𝑙 𝑒 Vw f,s


• Where 𝐹 𝑘, 𝑙 = 𝑅 d + 𝐼 d is called the magnitude spectrum of
Fourier Transform
%& |
• 𝜑 𝑘, 𝑙 = tan is called the phase spectrum of Fourier
}
Transform

• In the Fourier representation of signals, spectral magnitude and phase tend


to play different roles and, in some situations, many of the important
features of a signal are preserved if only the phase is retained.
Phase Importance Illustration
1) In matlab write a program to find the FT of an image. Then make
the phase of the FT zero. Reconstruct the image.
2) In matlab write a program to find the FT of an image. Then make
the magnitude spectrum equal to unity. Reconstruct the image.
3) In matlab write a program to find the FT of two different images.
Interchange the phases and reconstruct image.
DFT Kernel for N=4
%VdrfI
• 𝑋 𝐾 = ∑~I[i 𝑥 𝑛 exp( •
) k=0,1,2,3
• Compute:
• X(0), X(1), X(2) and X(3)
• Collect coefficients
• DFT kernel for N=4 is obtained (Question asked)
1 1 1 1
1 −𝑗 −1 𝑗
•𝑋 𝑘 =𝐴=
1 −1 1 −1
1 𝑗 −1 −𝑗
Unitary Transform€
• Unitary Condition: 𝐴×𝐴 = 𝐼 𝑎𝑛𝑑 𝐴€ = 𝐴∗"
• Properties of unitary transform

Given v = Au (A is a unitary transform)


𝑣 2 = 𝑢 2 , i.e., energy-conserved
• A unitary transformation is a rotation of the basis coordinates , or a
rotation of the vector u in N- Dimensional vector space
• Unitary transform tends to concentrate most of the signal energy on a
small set of transform coefficients
• The transform coefficients tends to be decorrelated, i.e., the off-
diagonal elements of Rv are approaching zero
• The entropy of a random vector is preserved under a unitary
transformation (i.e., information preserved)
Prove DFT is an Unitary Transform

1) Prove DFT is an Unitary Transform Unitary


(Condition: 𝐴×𝐴€ = 𝐼 𝑎𝑛𝑑 𝐴€ = 𝐴∗" )

2) Apply DFT to the following sequence and verify whether it works.


x={1 3 8 9}
Hint: N=4, 1-D signal
𝑋 𝑘 = 𝑘𝑒𝑟𝑛𝑒𝑙 ×𝑥 (Forward Transform)
& ∗
𝑥= •
𝑘𝑒𝑟𝑛𝑒𝑙 ×𝑋(𝑘) ( Inverse Transform)
• 3) Compute 2D DFT of 4 x 4 grayscale image f(m,n) and find its
inverse.
1111
1111
𝑓 𝑚, 𝑛 =
11 1 1
1111
HINT: Here N=4
𝐹(𝑘) = 𝑘𝑒𝑟𝑛𝑒𝑙 ×𝑥×𝑘𝑒𝑟𝑛𝑎𝑙" (Forward Transform)
& "
𝑓= •ו
𝑘𝑒𝑟𝑛𝑒𝑙×𝑋(𝑘) 𝑘𝑒𝑟𝑛𝑎𝑙 ( Inverse Transform)
Discrete Cosine Transform (DCT)
• Discrete Cosine Transform (DCT) was developed by Ahmed, Natarajan
and Rao in 1974
• It is a real-valued discrete sinusoidal unitary transform
• DCT has very high energy compaction capabilities.
• DCT is widely used in image compression
• The 1-D DCT pair is given by the expression:
d…‰& Šr
• 𝐶 𝑢 = 𝑊 𝑢 ∑g%&
…[i 𝑓 𝑥 𝑐𝑜𝑠 dg
where
Discrete Cosine Transform (DCT)
• The 1-D DCT is given by the expression
d…‰& Šr
𝐶 𝑢 = 𝑊 𝑢 ∑g%&
…[i 𝑓 𝑥 𝑐𝑜𝑠 dg
where
&
𝑊 𝑢 = g
𝑓𝑜𝑟 𝑢 = 0 and
d
𝑊 𝑢 = g
𝑓𝑜𝑟 𝑢 ≠ 0
&
Hence, 𝐶(0) = ∑g%& 𝑓 𝑥
g …[i
• 𝐶(0) is called the DC component ( average of all values). All other cpmponents
are called AC components.
• The inverse 1-D DCT is given by the expression
d…‰& Šr
𝑓(𝑥) = ∑g%&
Š[i 𝑊 𝑢 ×𝐶(𝑢)×𝑐𝑜𝑠 dg
Discrete Cosine Transform (DCT)
• The 2-D DCT is given by the expression
g%& g%&
2𝑥 + 1 𝑢𝜋 2𝑦 + 1 𝑣𝜋
𝐶 𝑢, 𝑣 = 𝑊 𝑢 𝑊(𝑣) G G 𝑓(𝑥, 𝑦) cos cos
2𝑁 2𝑁
…[i ‹[i

• The 2-D inverse DCT transform is


g%& g%&
2𝑥 + 1 𝑢𝜋 2𝑦 + 1 𝑣𝜋
𝑓 𝑥, 𝑦 = G G 𝑊 𝑢 𝑊 𝑣 𝐶 𝑢, 𝑣 cos cos
2𝑁 2𝑁
…[i ‹[i
3 3 Other
3.3 Oth S Separable
bl TTransforms
f
Discrete
3.3.
Cosine
3.3.2 Discrete
sc e e Cosine
Transform
Cos e Transform
s o (DCT)
( C )
(DCT)
• BasisBasis function
function matrix
matrix
x
⎡ 1/ 2 1/ 2 L 1/ 2 ⎤
u ⎢ ⎥
⎢ cos π / 2 N cos 3π / 2 N L cos(2 N − 1)π / 2 N ⎥
⎢ cos 2π / 2 N cos 6π / 2 N L cos 2(2 N − 1)π / 2 N ⎥
2 ⎢ ⎥
CN = ⎢ cos 3π / 2 N cos 9π / 2 N L cos 3(2 N − 1)π / 2 N ⎥
N⎢
cos 4π / 2 N cos12π / 2 N L cos 4(2 N − 1)π / 2 N ⎥
⎢ ⎥
⎢ M M O M ⎥
⎢ ⎥
⎢⎣cos( N − 1)π / 2 N cos 3( N − 1)π / 2 N L cos(2 N − 1)( N − 1)π / 2 N ⎦⎥

Digital Image Processing 75


Prof.zhengkai Liu Dr.Rong Zhang
Discrete Cosine Transform (DCT)
• Compute DCT matrix for N=2.
&
2𝑥 + 1 𝑢𝜋
𝐶 𝑢 = 𝑊 𝑢 G 𝑓(𝑥) cos
2𝑁
& …[i
1 1
𝐶 0 = G 𝑓(𝑥) cos 0 = 𝑓 0 + 𝑓(1)
2 …[i 2

&
2𝑥 + 1 𝜋 1
𝐶(1) = G 𝑓(𝑥) cos = 𝑓 0 − 𝑓(1)
4 2
…[i

& &
d d
DCT Matrix= & &

d d
1 2
• Apply DCT to F= and show energy compaction.
2 1
• Solution: 𝐷𝐶𝑇 = 𝑇𝐹𝑇 "
& 1 1 1 2 1 1
𝐷𝐶𝑇 = d
1 −1 2 1 1 −1

& 1 1 3 −1
𝐷𝐶𝑇 =d
1 −1 3 1
& 6 0 3 0
𝐷𝐶𝑇 =d =
0 −2 0 −1

Almost all the energy is present in the DC component. Most of the


values are equal to zero. Hence DCT results in high energy compaction.
• Compute DCT matrix for N=4.
*&+$ ,-
𝐶 𝑢 = 𝑊 𝑢 ∑)&'( 𝑓(𝑥) cos
*.
$ $ * $
𝑊 0 = = , 𝑊 𝑢 = =
/ * / *
)
1 1
𝐶 0 = G 𝑓(𝑥) cos 0 = 𝑓 0 + 𝑓 1 + 𝑓 2 + 𝑓(3)
2 2
&'(

)
1 2𝑥 + 1 𝜋 1 𝜋 3𝜋 5𝜋 7𝜋
𝐶(1) = G 𝑓(𝑥) cos = 𝑓 0 cos + 𝑓 1 cos + 𝑓 2 cos + 𝑓(3) cos
2 &'( 8 2 8 8 8 8

)
1 2𝑥 + 1 𝜋 1 𝜋 3𝜋 5𝜋 7𝜋
𝐶(2) = G 𝑓(𝑥) cos = 𝑓 0 cos + 𝑓 1 cos + 𝑓 2 cos + 𝑓(3) cos
2 &'( 4 2 4 4 4 4

)
1 2𝑥 + 1 3𝜋 1 3𝜋 9𝜋 15𝜋 21𝜋
𝐶(3) = G 𝑓(𝑥) cos = 𝑓 0 cos + 𝑓 1 cos + 𝑓 2 cos + 𝑓(3) cos
2 &'( 8 2 8 8 8 8
0.5 0.5 0.5 0.5
0.6533 0.2706 − 0.2076 − 0.6533
• 𝐷𝐶𝑇 𝑀𝑎𝑡𝑟𝑖𝑥 =
0.5 0.5 0.5 0.5
0.2706 − 0.6533 0.6533 − 0.2706

1 2 3 4
5 6 7 8
• Apply DCT to 𝐹 =
1 2 3 4
5 6 7 8
WALSH TRANSFORM
• Square-wave functions and take only two values +1 or -1.
• The Walsh Transform basis is given by
I%&
1
ℎ(𝑥, 𝑢) = ’(−1)[”• (…)”–—˜—• (Š)
𝑁
“[i

𝑥 represents the time index, y represents the frequency index


𝑏“ (𝑥) represents the ith bit of the binary representation of 𝑥
Value of 𝑛 is given by 𝑛 = 𝑙𝑜𝑔d 𝑁
Inverse Walsh Kernel is given by
I%&

ℎ(𝑥, 𝑢) = ’(−1)[”• (…)”–—˜—• (Š)


“[i
NOTE: Factor 1/N not present in inverse transform
Walsh Basis for N=4
• Here N=4. Thus 𝑛 = 𝑙𝑜𝑔d4 = 2
• 𝑥 𝑎𝑛𝑑 𝑢 vary from 0 to N-1 i.e they take the values 0,1,2,3.
• 𝑖 varies from 0 to n-1 i.e 0 and 1
& &
• When 𝑥 = 0 𝑜𝑟 𝑢 = 0 ; ℎ 𝑥, 𝑢 = g = •
• Construction of Walsh basis for N=4

Decimal Value Binary Values


x 𝑏1 (x) 𝑏0 (x)
0 𝑏1 (0)=0 𝑏0 (0)=0
1 𝑏1(1)=0 𝑏0 (1)=1
2 𝑏1 (2)=1 𝑏0 (2)=0
3 𝑏1 (3)=1 𝑏0 (3)=1
Walsh Transformation Basis for N=4

y x 0 1 2 3
0 1/4 1/4 1/4 1/4

1 1/4 1/4 −1/4 −1/4

2 1/4 −1/4 1/4 −1/4

3 1/4 −1/4 −1/4 1/4


To find h(2,1)
• Here x=2,u=1. Thus

& &
ℎ(2,1) = • ∏“[i(−1)[”0 (d)”12"20 (&)
&
ℎ(2,1) = • −1 ”3 (d)”" (&) × −1 ”" (d)”3 (&)
&
ℎ(2,1) = • −1 i×i × −1 &×&
&
ℎ(2,1) = • 1 × −1
&
ℎ 2,1 = − •
Easy Method
• Step 1: Write the binary representation of x
• Step 2: Write the binary representation of u in reverse order
• Step 3: Check the number of overlaps pf 1 between x and u
• Step 4: If the number of overlaps of 1 is
• Zero then sign is positive
• Even then sign is positive
• Odd then sign is negative
• When x=2, binary is 1 0, when u=1, binary is 0 1 ( reverse 1 0)
1 0
• Look for overlap of ones
1 0
• Number of overlaps =1 (odd) so negative ( already done in previous
eg)
Properties of Walsh Transform
• The 2-D Walsh transform is separable and symmetric.
• It can be implemented as a sequence of two 1-D Walsh transforms, in
a fashion similar to that of the 2-D DFT.
• Remember that the Fourier transform basis functions consist of
complex sinusoids.
• The Walsh transform consists of basis functions whose values are only
1 and −1.
• They have the form of square waves.
• These functions can be implemented more efficiently in a digital
environment than the exponential basis functions of the Fourier
transform.
• For any function f(x), the 1-D Walsh Transform is given by
& g%&
W(𝑢) = ∑…[i 𝑓(𝑥) ∏I%&
“[i (−1)[”0 (…)”12"20 (Š)
g

Inverse Walsh Transform


g%& I%&

𝑓(𝑥) = G 𝑊(𝑢) ’(−1)[”0 … ”12"20 Š ]

…[i “[i

• For any function f(x), the 2-D Walsh Transform is given by


& g%& g%&
W(𝑢, 𝑣) = ∑…[i ∑‹[i 𝑓(𝑥, 𝑦) ∏I%&
“[i (−1)[”0 … ”12"20 Š ‰”0 ‹ ”12"20 › ]
g

Inverse Walsh Transform


g%& g%& I%&
1
𝑓(𝑥, 𝑦) = G G 𝑊(𝑢, 𝑣) ’(−1)[”0 … ”12"20 Š ‰”0 ‹ ”12"20 › ]
𝑁
…[i ‹[i “[i
HADAMARD TRANSFORM
• For any function f(x), the 1-D Hadamard Transform is given by
$ #4$
𝐻(𝑢) = . ∑.4$&'( 𝑓(𝑥) ∏5'( (−1)
[70 (&)70 (,)

Inverse Hadamard Transform


.4$ #4$
𝑓(𝑥) = G 𝑊(𝑢) ’(−1)[70 & 70 , ]

&'( 5'(

• For any function f(x), the 2-D Hadamard Transform is given by


$ #4$
W(𝑢, 𝑣) = . ∑.4$ .4$
&'( ∑;'( 𝑓(𝑥, 𝑦) ∏5'( (−1)
[70 & 70 , +70 ; 70 < ]

Inverse Hadamard Transform


.4$ .4$ #4$
1
𝑓(𝑥, 𝑦) = G G 𝑊(𝑢, 𝑣) ’(−1)[70 & 70 , +70 ; 70 < ]
𝑁
&'( ;'( 5'(
HADAMARD TRANSFORM
• Same as Walsh Transform except the rows of the transform matrix
are re-ordered.
• The Hadamard transform differs from the Walsh transform only in the
order of basis functions.
• The Hadamard transform of an image f is denoted by
&
𝑔 = 𝐴×𝑓×𝐴 where 𝐴= 𝐻
g •,•

For order N=2, Hadamard matrix is given by


1 1
𝐻d =
1 −1
HADAMARD TRANSFORM
• An important property of the Hadamard transform is that, letting 𝐻
represent the Hadamard transform of order 𝑁 the recursive recursive
holds:

𝐻g 𝐻g
𝐻dg =
𝐻g −𝐻g

• Therefore, starting from a small Hadamard matrix we can compute a


Hadamard matrix of any size.
HADAMARD TRANSFORM
• Substituting N=2,
𝐻d 𝐻d
𝐻• =
𝐻d −𝐻d

1 1 1 1
𝐻• = 1 −1 1 −1
1 1 −1 −1
1 −1 −1 1
• Similarly, Hadamard matrix for 8,16 etc can be formed.
Sequency ordered Walsh Matrix from Hadamard
Matrix
• Sequency : Number of sign changes in a row
1 1 1 1
• 𝐻• = 1 −1 1 −1 No of sign changes : 0,3, 1, 2
1 1 −1 −1
1 −1 −1 1
• Arrange the rows in the sequency 0,1,2 3. We get the Walsh Matrix

1 1 1 1
• Walsh Matrix: 𝑊• = 1 1 −1 −1 Sequency: 0,1,2,3
1 −1 −1 1
1 −1 1 −1
Problem:
1. Prove that Hadamard transform works for the following image:
2 2
𝐹=
2 1
&
(Hint: 𝑇 = 𝐴×𝐹×𝐴 where 𝐴 = 𝐻d )
d

2. Given image F={1,2,0,3}. Apply Walsh Transform and Hadamard Transform


and compare the results ( 1D case: T=W.F)

2121
1232
3. Given image 𝐹 = . Apply Walsh Transform and Hadamard
2343
1232
Transform and compare the results ( 2D case: T=W.F.WT)
• Let 𝑓(𝑥, 𝑦) denote the following constant 4 × 4 digital image that is
zero outside 0 ≤ 𝑥 ≤ 3, 0 ≤ 𝑦 ≤ 3, with 𝑟 a constant value.
𝑟 𝑟 𝑟 𝑟
𝑓(𝑥, 𝑦) = 𝑟𝑟 𝑟𝑟 𝑟𝑟 𝑟𝑟
𝑟 𝑟 𝑟 𝑟
Give the standard Hadamard Transform of 𝑓(𝑥, 𝑦) without carrying out
any mathematical manipulations.

𝑟 𝑟 𝑟 𝑟
𝑟 𝑟 𝑟 𝑟
Repeat the same with 𝑓(𝑥, 𝑦) = 0 0 0 0
0 0 0 0
Criticism of Fourier Spectrum
It’s giving you the spectrum of the
‘whole time-series’

Which is OK if the time-series is stationary


But what if its not?

We need a technique that can “march along” a


timeseries and that is capable of:

Analyzing spectral content in different places


Detecting sharp changes in spectral character
Fourier Analysis is based on an indefinitely long
cosine wave of a specific frequency

time, t
Wavelet Analysis is based on a short duration
wavelet of a specific center frequency

time, t
Wavelet Transform
• What is a wavelet…?

A wavelet is a waveform of effectively limited duration


that has an average value of zero.
Wavelet's properties
• Short time localized waves with zero integral value.

• Possibility of time shifting.

• Flexibility.
FT Vs WT
Scaling
n Wavelet analysis produces a time-scale view of the signal.
n Scaling means stretching or compressing of the signal.
n scale factor (a) for sine waves:

f ( t ) = sin(t ) ; a = 1
f ( t ) = sin(2t ) ; a = 1 2
f ( t ) = sin(4t ) ; a = 1 4
Scaling (Cont’d)
n Scale factor works exactly the same with
wavelets:

f ( t ) = Y(t ) ; a = 1
f ( t ) = Y ( 2t ) ; a = 1 2
f ( t ) = Y ( 4t ) ; a = 1 4
What is a wavelet?
• A function that “waves” above and below the x-axis with the
following properties:
• Varying frequency
• Limited duration
• Zero average value
• This is in contrast to sinusoids, used by FT, which have infinite
duration and constant frequency.

Sinusoid Wavelet
Basis Functions Using Wavelets
• Like sin( ) and cos( ) functions in the Fourier Transform,
wavelets can define a set of basis functions ψk(t):
f (t ) = å aky k (t )
k

• Span of ψk(t): vector space S containing all functions f(t)


that can be represented by ψk(t).
HAAR Transform : Done in class
Refer notes given in class

You might also like