Download as pdf or txt
Download as pdf or txt
You are on page 1of 47

Transform For Image Compression

1
Evocation

2
Objectives

General Objective (GO):

Students will be able to understand the DCT, Walsh, and Hadamard


Transformation used in image compression.

Specific Objectives (SO):

SO1: Illustrate the working of DCT used in the compression of the


image. [U/C]

SO2: Interpret the principle of Walsh in image compression. [U/C]

SO3: Infer the Hadamard transformation process in image


compression. [U/C]

3
Role of Transform

White Light? VIBGYOR!

Time Transform Frequency


domain domain
Transform

Forward
Transform

Time Frequency
domain domain
Inverse
Transform
What do Frequencies Mean in an Image?

• Large values at high frequency components mean the data is

changing rapidly on a short distance scale.

E.g .: a page of small font text, brick wall, vegetation.

• Large low frequency components then the large scale features of the

picture are more important.

E.g . a single fairly simple object which occupies most of the image.

6
Need for Transform

Transform is basically a mathematical tool to represent a signal.

i. Mathematical Convenience

ii. To extract more information

• Applying Transform we get another image of same size.

• After applying Inverse Transform we get the original image back.

7
Applications

 Preprocessing
- Filtering
- Enhancement, etc

 Data Compression

 Feature Extraction
- Edge Detection
- Corner detection, etc
The Road to Compression

• How do we achieve compression?


• Low pass filter — ignore high frequency noise components
• Only store lower frequency components
• High pass filter — spot gradual changes
• If changes are too low/slow — eye does not respond soignore?
Classification of Image transforms

Basis function
Orthogonal Non-sinusoidal
Depending on Directional
sinusoidal Orthogonal
statistics transformation
Basis function Basis function
of input signal

Fourier KL transform Hough


transform Haar transform
transform SVD
Discrete Radon
cosine Walsh transform
transform transform
Ridgelet
Discrete Sine Hadamard transform
transform transform
Contourlet
slant
transform

Image Compression Resolutions Energy Compaction Directional


Information
Fourier Transform

Jean Baptiste Joseph Fourier

French Mathematical Physicist

Idea in 1809

Flow of heat through objects


Fourier Transform

• The tool which converts a spatial (real space) description of


audio/image data into one in terms of its frequency components is
called the Fourier transform.
• The new version is usually referred to as the Fourier space
description of the data.
• We then essentially process the data: E.g . for filtering basically this
means attenuating or setting certain frequencies to zero We then
need to convert data back to real audio/imagery to use in our
applications.
• The corresponding inverse transformation which turns a Fourier
space description back into a real space one is called the inverse
Fourier transform.

12
1-D Discrete Fourier Transform

Forward Transform
x[n ] Analysis
X[k ]

X[k ] Inverse Transform x[n ]


Synthesis
1-D DFT (cont..)

N 1 2
j
X[k ]   x[n ]e
kn
N
, k  0 to N  1
n 0

x[n] represents the signal

X[k] represents the spectrum


2-D DFT

x[n] f (m, n)
1-D signal 2-D signal

X [k ] F [k , l ]
1-D Spectrum 2-D Spectrum
2-D DFT

N 1 2
j kn
X [k ]  x[n] e N

 n 0

N 1 N 1

F (k , l )    f (m, n)
2 2
j mk j nl
N
e e N

m 0 n 0
2-D DFT

Magnitude

Forward
Image Transform

Phase
Amplitude and Phase

F (x)

amplitude

phase

original
F (x)
Importance of Phase
Originalimage OriginalImage

Cameraman image after phase reversal


Lenna image after phase reversal
Application of Fourier Transform in Image
Processing
Image Filtering

f(m,n) g(m,n)
h(m,n)

f(m,n) Input image


h(m,n) Impulse response of the filter

g(m,n) Output image

g(m,n) = f(m,n) * h(m,n)


Application of Fourier Transform in Image
Processing

f(m,n) F(k,l) G(k,l) g(m,n)


DFT H(k,l) IDFT

F(k,l) Spectrum of input signal


H(k,l) Filter function
g(m,n) Output image

Convolution in time domain = Multiplication in frequency domain


Transform Coding
Transformation[JPEG]
DISCRETE COSINE TRANSFORM

• A Fourier-related transform similar to the Discrete Fourier Transform


(DFT), but using only real numbers.
• Often used in signal and image processing.
• Maps values from spatial domain to frequency domain – image areas
with low frequency
(large blocks of single color) are compressed more efficiently.
• Used in JPEG, MJPEG, MPEG, and DV Compression.
DISCRETE COSINE TRANSFORM

N 1 N 1
 2m  1k   2n  1l 
F [k , l ]   (k ) (l )  f (m, n) cos  cos 
m 0 n 0  2 N   2 N 

 1  1
 if k  0  if l  0
 (k )   N  (l )   N
 2 if k  0  2 if l  0
 N  N
Discrete Cosine Transforms
N 1
1D DCT: C (u )   (u ) f ( x) cos  (2 x2N1)u  for u = 0,1,....,N-1
x 0
N 1
1D IDCT: f ( x)    (u )C (u ) cos  (2 x2N1)u  for x = 0,1,....,N-1
u 0
 1
for u=0
 (u )   N

 for u=1,2,...,N-1
1
2N

N 1
2D DCT:C (u, v)   (u ) (v)  f
x 0
( x, y ) cos  (2 x 1) u
 2N   cos  (2 x 1) v
 2 N 
for u,v = 0,1,....,N-1
2D IDCT: N 1
f ( x, y )   (u ) (v)C (u, v) cos  (2 x2N1)u  cos  (2 x2N1) v 
u 0
for x,y = 0,1,....,N-1
Walsh Transform Properties

(1)The transform is separable and symmetric.

(2)The coefficients near origin have maximum energy and it reduces


as we go further away from the origin.

(3)It has energy compaction property but NOT so strong as in DCT.


Walsh Transform
Walsh Transform
Walsh Transform

Walsh basis function:


m 1
1
g(n, k )   (1) b i ( n ) b m 1 i ( k )

N i 0
m  log 2 N
n time index

k frequency index

N Order

Walsh
Walsh basis for N=4

Step 1: To compute ‘m’


m  log 2 N m  log 2 4  2
Step 2: Substituting N=4 and m=2 in g(n,k)
1 m1
g(n, k )   (1) b i ( n ) b m 1 i ( k )

N i 0
1 21
g (n, k )   (1) bi ( n )b21i ( k )
4 i 0
1 1
g (n, k )   (1)bi ( n )b1i ( k )
4 i 0
Walsh basis for N=4

Step 3: Substituting n=0 and k=0 in g(n,k)


1 1
g (n, k )   (1) b ( n )b i 1i ( k )

4 i 0
1 1
g (0,0)   (1) bi ( 0)b1i ( 0)
4 i 0
Walsh basis for N=4

Step 4: Substituting i = 0 and i = 1 in g(0,0)

g (0,0)  ( 1)b 
1 0 ( 0 ) b1 ( 0 )
 ( 1)b ( 0 ) b
1 0 (0)

4
b0 (0) Zeroth bit position in the binary value of zero

b1 (0) First bit position in the binary value of zero

0 binary representation 0 0
Zeroth bit position
First bit position
Walsh basis for N=4

Step 5: Substitute b0 (0)  0 and b1 (0)  0 in g(0,0)

g (0,0) 
1
4

(1)  (1) 
0 0 1
4

To compute g(2,1)
1 1
g (n, k )   (1) b ( n )b i 1i (k )

4 i 0
1 1
g (2,1)   (1) b ( 2)b i 1i (1)

4 i 0
Walsh basis for N=4

1 1
g (2,1)   (1) bi ( 2)b1i (1)
4 i 0
Substituting i=0 and i=1 in the expression of g(2,1)

1

g (2,1)  (1)b0 ( 2)b1 (1)  (1)b1 ( 2)b0 (1)
4

b0 ( 2 ) Zeroth bit position in the binary value of 2
b1 (1) First bit position in the binary value of 1
b1 ( 2 ) First bit position in the binary value of 2

b0 (1) Zeroth bit position in the binary value of 1


Walsh basis for N=4

Decimal number Binary representation

0 0 0

1 0 1
2 1 0
Zeroth bit position
3 1 1

First bit position

b0 ( 2 )

b1 (1)
= 0
= 0
1

g(2,1)  (1) b0 ( 2) b1(1)  (1) b1( 2) b0 (1)
4

 
b1 ( 2 ) = 1 1 1
b0 (1) = 1 g(2,1)  (1)  (1)  
0 1
4 4
Walsh basis for N=4

 1 1 1 1
     No sign change
 4 4 4 4
 1 
1

1

1
One sign change
g (n , k )   4 4 4 4
1 1 1 1
     Three sign changes
 4 4 4 4
  1 
1

1 1
  Two sign changes
 4 4 4 4
Walsh Basis for N=4

 1 1 1 1 n=1 and k=2


    
 4 4 4 4
 1 
1

1

1 n=1 0 1
g (n , k )   4 4 4 4
1 1 1 1 k=2
original
1 0
    
reversal
 4 4 4 4 k=2 0 1
  1 
1

1 1
 
 4 4 4 4 0 1
No. of
0 1 overlap is
odd
No. of overlap of one is odd
then sign is negative
Walsh Transform
HADAMARD TRANSFORM

H N HN 
H2N  
H N  HN 
Jacques Salomon
Hadamard

1 1 
H2   
1  1
HADAMARD TRANSFORM PROPERTIES

• Hadamard Transform H is real, symmetric & orthogonal.


• H=H*=HTH-1

• It is fast transform (faster than DCT).


• The 1D transformation can be implemented in Nlog2N additions
and subtraction.
• Since HT contain only +/- values, no multiplications are required
in the calculations.
• It has very good energy compression for highly correlated images.
• It is useful in hardware implementation for DFT algorithm, used in
image, data compression, filtering and designing of codes.
Hadamard Transformation (HT)

1) 1D F = H. f H is symmetric
2) 2D F = H . f . HT Non sinusoidal function

H=

2x2
Find HT
1) 2D 2) F = H . F . HT
3) H = HT (symmetric)

F=
MindMap
Summary
• An image transform can be applied to an image to convert it from one
domain to another.
• A discrete cosine transform expresses a finite sequence of data points in
terms of a sum of cosine functions oscillating at different frequencies.
• The discrete cosine transform (DCT) helps to separate the image into parts of
differing importance (with respect to the image's visual quality).
• Discrete Cosine Transform is used in lossy image compression because it has
very strong energy compaction, i.e., its large amount of information is stored
in very low frequency component of a signal and rest other frequency having
very small data which can be stored by using very less number of bits
(usually, at most 2 or 3 bit).
• The Walsh-Hadamard transform (WHT) is an orthogonal transformation that
decomposes a signal into a set of orthogonal, rectangular waveforms
called Walsh functions. The transformation has no multipliers and is real
because the amplitude of Walsh (or Hadamard) functions has only two
values, +1 or -1.
Notes

• The technique that consists of scanning all the pixels in the original
image, and then computing their position in the new image is called
the Forward Transformation.
• In spatial domain, we deal with images as it is. The value of the pixels
of the image change with respect to scene. Whereas in frequency
domain, we deal with the rate at which the pixel values are changing
in spatial domain.

You might also like