Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero...

24
Wavelet Based Image Compression Ahmed AbuHajar, Ph.D. March 10, 2011 University of Massachusetts, Lowell.

Transcript of Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero...

Page 1: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Wavelet Based Image gCompression

Ahmed Abu‐Hajar, Ph.D.March 10, 2011

University of Massachusetts, Lowell.y ,

Page 2: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Outline Outline

• Introduce Digital Image• Objective of Image Compression• Basic Idea of Compression• Discrete Cosine Transform (DCT)• Discrete Cosine Transform (DCT)• DCT‐Based Image Compression• Basic Idea of Entropy Coding• Wavelet Transform• Basic Idea of Wavelet Image Compression• Our developed Image Compression AlgorithmOur developed Image Compression Algorithm• Results & Conclusion• Summary.

Page 3: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

What is an Image? What is an Image?

• Recall: 1‐D signal f(t). f(t)Recall: 1 D signal f(t).

• Image is a 2‐D signalImage is a 2 D signal – I(x,y)  indicates the intensity of the reflected 

t

x

light at each spatial location (x,y)P i l R d Bl– Primary colors: Red, Blue, Green

y

Page 4: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Digitizing an Image Digitizing an Image

• Recall: 1‐D analog signal that is l d

f(t)sampled. 

– Rounded to finite  n‐bit represntation• Digital Image: An analog image is 

sampled at each location with a

t

sampled at each location with a rectangle called pixel

– Rounded off to n‐bit 

Page 5: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Why Image Compression?Why Image Compression?• Uncompressed images require large 

bandwidthExample: BW of STD TV– Example: BW of STD TV 

BW = 720 x 480 x 3 x 8 x 30 =248.8 Mbps

• Solution:  Image Compression– Reduce the amount of data required to transmit or 

store the image without degrading from the quality g g g q yof the image below an acceptable  level.

– The compressed image is an approximation Of the actual image

• Where:– Î(n,m) is the compressed image– e(n,m) is the noise due to compression

Page 6: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Observation About Natural ImagesObservation About Natural Images

– Frequency Content of 1‐D SignalsImages are locally smooth– Images are locally smooth 

• Most of the energy (information) is located in low frequency   – The high frequency content 

• Contains the details  (edges, textures,….)

f1(t)

t|F(ω) |

f2(t)

|F(ω) |

ω

Page 7: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Obtaining the Frequency Content Obtaining the Frequency Content

– Frequency content of a signal is obtained by DFT (FFT) 

– 1‐D

– 2‐D

Page 8: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

The Basic Idea Behind Image C iCompression

Convert the image into the frequency domain using DFT or (FFT)

h h h f ff• Truncate the high frequency coefficients • You will end up with many high frequency coefficients to be zerocoefficients to be zero

• Disadvantages: – Each coefficient is complex value – we may truncate important high frequency values. – Solution: use Discrete Cosine Transform (DCT)

Page 9: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Discrete Cosine Transform (DCT)Discrete Cosine Transform (DCT)

• Basic Idea:  f(n)f(‐n)

Let f(n) be a real value signal• Lets also add f(‐n) to the signal 

– We end up with a symmetric Signal k f h b l

n

• Take FFT of the combined signals

• The result is DCT

Page 10: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Discrete Cosine Transform DCTDiscrete Cosine Transform DCT

• 2‐D DCT (8x8) Block

• Advantage:Advantage: – The high energy is compacted in the low frequency coefficients. 

• Use 8x8 blocksUses 8X8 matrixes– Uses 8X8 matrixes 

– Simpler hardware T =

Page 11: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Basic DCT Image CompressionBasic DCT Image Compression

Q ti () EntropyQuantize()

& Sort()

Entropy 

CodingTransform()

Transmission

& Storage

Entropy 

Decoding

Inverse

Quantize()

& Sort()

Inverse Transform()

& Sort()

Page 12: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Basic DCT Image CompressionBasic DCT Image Compression

– Entropy Coding : The minimum bits required to code– Entropy Coding : The minimum bits required to code a sequence of symbols (values)

– The most probable values are coded with  the least bit sizebit size.

– Example: lets say we have four symbols A, B, C, and D. 

• Fixed length symbols will code each symbols with two bits. – AAABAAABAC ( 2bits X 10 symbols = 20bits)Assign A = 1, B = 01, C = 001. 11101111011001 14 bit11101111011001 = 14 bits. 

– Image Decompression (Decoding)• Mimic the opposite 

Page 13: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Wavelet TransformWavelet Transform• Basic Idea: use subband Coding 

– Analysis Side: Decomposes the signal into two bandsAnalysis Side: Decomposes the signal into two bands • low frequency & High frequency. • The same number of coefficients as the number of the sample original signal. 

– Synthesis Side: Forces the condition of perfectly reconstruct the original signal.  

– DSP & Compression is executed before the synthesis Side

Ho(ω) 2 G (ω)2L(n)

H1(ω) 2

Ho(ω) Go(ω)

G1(ω)2

Y(n)

H(n)Ŷ(n)DSP

Page 14: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

2-D Wavelet Transform of IImages

• Steps for evaluating Wavelet transform– Decompose each row into two subbands (L &H)– Decompose each column into two subbands(LL LH HL HH)(LL,LH, HL,HH)

– Repeat the process on the LL level. ( here we have three Levels. 

– Image Algorithms have five levels. 

Page 15: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Wavelet Zero TreeWavelet Zero Tree

Page 16: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Bit-Plane Representation of W l t C ffi i tWavelet Coefficients

• Each coefficient is represented using n‐bit and a sign bit (SBn‐1 Bn‐2 … B1 B0)

• Bit Plane: only one bit is placed on the tree for all the coefficientscoefficients.

• Progressive Coding: each coefficient is coded by progressively refine it value p g yfrom the most significant bit to the least significant bit.  

Page 17: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Wavelet Based Image C iCompression

Q ti () EntropyQuantize()

& Sort()

Entropy 

CodingTransform()

Transmission

& Storage

Entropy 

Decoding

Inverse

Quantize()

& Sort()

Inverse Transform()

& Sort()

Page 18: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Set Partition in Hierarchical Tree SPIHT(SPIHT)

• For each bit plane • For each subband• For each subband• Start from the top level to the least 

level. • If the 2x2 node or any of its 

descendants has a “1”  ( significant bit) code the four bitssignificant bit)  code the four bits of the at the nod.  

• If the coefficient codes the first “1” bit code its sign with it. 

• Stop when • bandwidth requirement is met• or when PSNR is met • or when all bits are coded ( 

lossless)

Page 19: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Algorithm of (P-SPIHT)Algorithm of (P SPIHT)Image

DWT

Bit Plane

Pr (Bi =1)

P1 < 0.2 P1 > 0.3

Mode 1

Mode 2 Mode 3

0.2 < P1 < 0.3Move to the Next Bit plane

Sort DataF

Organize StreamOrganize Stream

EndBit Stream

Page 20: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Results for Lossless CompressionResults for Lossless Compression

– 16 bits superior to SPIHT & JPEG2000 

Page 21: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Results for Lossy Compression vs. Q liQuality

– 8‐bit resolution superior to SPIHT comparable to  JPEG2000 

Page 22: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Results for Lossy Compression vs. Q liQuality

– 16‐bit high resolution superior to SPIHT comparable to  JPEG2000 p

Page 23: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Performance of the Arithmetic C dCoder

• Results for the arithmetic coder. – The efficiency of the arithmetic coder doubles with P‐SPIHT.

Page 24: Wavelet Based Image Compressionfaculty.uml.edu/ahmed_abuhajar/documents/WaveletBased...Wavelet Zero Tree Bit-Plane Representation of t i i f Cf WltW avelet Coefficients • Each coefficient

Summary Summary

• The concept of digital image and the need forThe concept of digital image and the need for image compression was introduced. Then we looked at DCT based and wavelet basedlooked at DCT based and wavelet based compression algorithms. We have shown some results for high resolution imagessome results for high resolution images.