Anda di halaman 1dari 20

Comparison and Enhancement of Lossy Image

Compression Techniques

By

Ahmed Mohamed Mohamed Ibrahem EL-Shafie

A thesis submitted to the


Faculty of Engineering at Cairo University
In Partial Fulfillment of the
Requirements for the Degree of
Master of Science

In

Electronics and Communication Engineering

Under the supervision of


Prof. Dr. Neamat S. Abdel Kader Ass. Prof. Dr. Ahmed Hussien

Electronics and Communication Department,


Faculty of Engineering,
Cairo University,

Faculty of Engineering, Cairo University


Giza, Egypt
2012
ii
Comparison and Enhancement of Lossy Image
Compression Techniques

By

Ahmed Mohamed Mohamed Ibrahem EL-Shafie

A thesis submitted to the


Faculty of Engineering at Cairo University
In Partial Fulfillment of the
Requirements for the Degree of
Master of Science

In
Electronics and Communication Engineering
Approved by examining committee
__________________________________________________________
Prof. Dr. Elsaid Mustafa Saad
(Professor in the Faculty of Engineering Helwan University)

___________________________________________________________
Prof. Dr. Prof. Dr. Amin Mohamed Nassar
___________________________________________________________
Prof. Dr. Neamat S Abdel Kader Thesis Advisor
___________________________________________________________
Ass. Prof. Dr. Ahmed Hussien Khalil Thesis Advisor
___________________________________________________________
Faculty of Engineering, Cairo University
Giza, Egypt
2012
iii
Engineer: Ahmed Mohamed Mohamed Ibrahem EL-Shafie
Date of Birth: 28/6/1984
Nationality: Egyptian
E-mail: eng_shafeey@yahoo.com
Phone: 01110847544
Address: 38, Ahmed gabr street, El-Naam, Cairo
Registration Date: 1/ 10/ 2008
Awarding Date: / /
Degree: Master of Science
Department: Electronics and Communication Engineering

Supervisors: Prof. Dr. Neamat Said Abdel Kader


Ass. Prof. Dr. Ahmed Hussien Khalil

Examiners: Prof. Dr. Elsaid Mustafa Saad (Helwan University)


Prof. Dr. Amin Mohamed Nassar
Prof. Dr. Neamat Said Abdel Kader
Ass. Prof. Dr. Ahmed Hussien Khalil

Title of Thesis: Lossy Image Compression Techniques: Compression

Key Words: DCT, DWT, SVD, VQ, BTC, CR, NRMSE


Summary:
Image compression seeks to reduce digital image sizes while maintaining
image quality. This is achieved by applying the methods of data compression to images.
An images size can be reduced with or without a loss in quality of the image. The work
presented here investigates lossy image compression using five algorithms; Discrete
Cosine Transform (DCT), Discrete Wavelet Transform (DWT), Singular Value
Decomposition (SVD), Vector Quantization (VQ) and Block Truncation Code (BTC).
The objective measures; Compression Ratio (CR) and Normalized Root Mean Square
Error (NRMSE) were used to evaluate the quality of the reconstructed image. The results
have shown that image compression using DCT provides higher CR and lower NRMSE
than the other four techniques. The work in this thesis presents a modification to VQ by
using (Hybrid DCT-VQ) which improved the CR by 85% and NRMSE by 9%. A
proposed modification in the traditional DWT is used which has improvement NRMSE
by 41%.

iv
CONTENTS

Page
LIST OF TABLES viii

LIST OF FIGURES.. ix

LIST OF SYMOBOLS .xi

LIST OF ABREVIATIONS. xiii

ACKNOWLEDGEMENTS.. xiv

ABSTRACT.......xv

1. INTRODUCTION.1

1.1. What is the image compression...2


1.2. Image compression and decompression model.....3

1.2.1. Transform .....4


1.2.2. Quantizer ...... 5
1.2.3. Symbol (entropy) Encoder 6

1.3. Image Compression Techniques............7

1.3.1. Lossless Compression..7


1.3.2. Lossy Compression 9

1.4. Image Compression: Performance Measures 12


1.5. Thesis out line.. 13

v
2. IMAGE COMPRESSION TECHNIQUES . 14

2.1. Discrete Cosine Transform... 14

2.1.1. Transform Coding .. 16


2.1.2. Properties of DCT... 22
2.1.3. Advantages and Disadvantages.. 22
2.1.4. DCT for Image Compression.. 23

2.2 Discrete Wavelet Transform. 23

2.2.1. Image compression by DWT. 25


2.2.2. One Level and Two Level Transform....28
2.2.3. Process of wavelet based image compression... 32

2.3 Singular Value Decomposition 32

2.3.1. Arbitrary Example. 33


2.3.2. Data Reduction with SVD. 42
2.3.3. Image Compression using SVD. 44

2.4 Vector Quantization ....45

2.4.1. VQ in Data Compression.. 46


2.4.2. K-means.46
2.4.3. Image Compression using VQ.. 48

2.4.3.1. Transforming image.49

2.5. Block Truncation Coding52

2.5.1. Image Compression by BTC..53

vi
3. EXPERIMENTAL WORK.55

3.1. Results of DCT Algorithm.56


3.2. Results of DWT Algorithm....63
3.3. Modification for DWT ..67
3.4. Results of SVD Algorithm.70
3.5. Results of VQ Algorithm....74
3.6. Hybrid DCT_VQ ...80
3.7. Results of BTC Algorithm..83

4. CONCLUSION AND FUTURE WORK..92

4.1. CONCLUSION....92
4.2. FUTURE WORK94

REFRANCES..95

vii
LIST OF TABLES

Page
Table 3.1 Results of CR and NRMSE using DCT..............................................57

Table 3.2 Results of CR and NRMSE using DWT and IDWT............................64

Table3.3 CR and NRMSE using DWT and modified DWT...............................67

Table 3.4 CR and NRMSE using SVD Algorithm................................................71

Table 3.5 CR and NRMSE using VQ Algorithm.........................74

Table 3.6 CR and NRMSE using VQ and Hybrid DCT_VQ ......................80

Table 3.7 Results CR and NRMSE using BTC Algorithm .........................84

Table 3.8 Compression times, Decompression times, CR and NRMSE for


all methods..........................................................................87

Table 3.9 The summary of the above results for maximum CR, minimum
NRMSE with time.89

Table 3.10 Comparison between all the previous compression techniques..90

viii
LIST OF FIGURES

Page
Figure 1.1 Compression and Decompression model. 3

Figure 2.1 Transforms image from spatial domain to frequency domain....16

Figure 2.2 A K-level, 1-D wavelet decomposition...26

Figure 2.3 The subban labeling scheme for a one-level, 2-D wavelet
transform.26

Figure 2.4 The subband labeling scheme for a three-level, 2-D wavelet
transform.....27

Figure 2.5 One level of transform.....28

Figure 2.6 Image compression using the first level transform.29

Figure 2.7 Two levels transform...30

Figure 2.8 Image compression using the second level transform.31

Figure 2.9 Creates two clusters from separated random data...47

Figure 2.10 The encoder and the decoder in VQ..48

Figure 2.11 Data transformation operation..49

Figure 2.12 Transformation for image in row blocks..51

Figure 3.1 Original image..55

ix
Figure 3.2 The relation between CR and NRMSE using DCT...58

Figure 3.3 Compressed image using DCT..60

Figure 3.4 The relation between CR and NRMSE using DWT by taking
approximation coefficient with different levels....65

Figure 3.5 IDWT of image form approximation coefficient....65

Figure 3.6 The relation between CR and NRMSE using modified IDWT.......68

Figure 3.7 Modified IDWT of image from approximation and horizontal


coefficients..69

Figure 3.8 The relation between CR and NRMSE using SVD...72

Figure 3.9 Compressed image using SVD...73

Figure 3.10 The relation between CR and NRMSE using VQ.75

Figure 3.11 Compressed image using VQ..77

Figure 3.12 Decompressed image using Hybrid DCT_VQ 8*8 block size.. 81

Figure 3.13 Decompressed image using Hybrid DCT_VQ 16*16 block size...82

Figure 3.14 The relation between CR and NRMSE using BTC.85

Figure 3.15 Compressed image using BTC86

x
LIST OF SYMOBOLS

I(x, y) All pixels in original image

I r (x , y) All pixels in reconstructed image

m*n Number of pixels in image

DFT Discrete Fourier Transform

A Signal (image) input

B Discrete Cosine Transform coefficients for original signal (image)

x Input signal

y Discrete Cosine Transform coefficients for input signal

M Number of rows in the original image

N Number of columns in the original image

AT Transpose of matrix A

h High pass filter

g Low pass filter

d ij Coefficient notation

xi
K Number of levels in Discrete Wavelet transform

LL Approximation Coefficients

HL Horizontal Coefficients

LH Vertical Coefficients

HH Diagonal Coefficients

U Orthogonal matrix

V Orthogonal matrix

S Diagonal matrix

Eigenvalues

r Rank of the matrix

Mean

Stander Deviation

x(i,j) Pixel elements of the original block

y(i,j) Elements of the compressed block

m The total number of pixels in the block

q The number of pixels greater than the mean ()

xii
LIST ABREVIATIONS

VQ Vector Quantization

SPIHT Set Partitioning in Hierarchical Trees

DCT Discrete Cosine Transform

DWT Discrete Wavelet Transform

SVD Singular Value Decomposition

BTC Block Truncation Code

AMBTC Absolute Moment Block Truncation Code

DSAD Digitally Sampled Analog Data

JPEG Joint Photographic Experts Group

MPEG Moving Picture Experts Group

CR Compression Ratio

NRMSE Normalized Root Mean Square Error

IDCT Inverse Discrete Cosine Transform

IDWT Inverse Discrete wavelet Transform

xiii
ACKNOWLEDGMENTS

Most importantly, I am ever grateful to GOD the major source of


strength when I worked on my MSc. thesis research and it is under His
grace that we live and learn.
I would like to express my sincere gratitude to my advisors, Prof.Dr.
Neamat Said Abdel Kader, and Ass.Prof.Dr. Ahmed Hussien Khalil,
for their invaluable guidance, advice and encouragement during the
course of my graduate study.
I would like to appreciate the help offered by the Electronics and
Communications department staff and library staff, faculty of
engineering, Cairo University.

Also, I would also like to thank my friends for real support during my
postgraduate study.

Last but not the least; I would like to acknowledge the support of all
members of my family, my parents, and my wife for their good
support throughout my life.

xiv
ABSTRACT

Image compression seeks to reduce digital image sizes while maintaining


image quality. This is achieved by applying the methods of data
compression to images. An images size can be reduced with or without a
loss in quality of the image; so the image compression techniques are
classified into: lossy compression and lossless compression. The work
presented here investigates lossy image compression using five
algorithms; Discrete Cosine Transform, Discrete Wavelet Transform,
Singular Value Decomposition, Vector Quantization and Block
Truncation Code. The objective measures; Compression Ratio (CR) and
Normalized Root Mean Square Error (NRMSE) were used to evaluate the
quality of the reconstructed image. The results have shown that image
compression using Discrete Cosine Transform provides higher
Compression Ratio and lower Normalized Root Mean Square Error than
the other four techniques. The work in this thesis presents a modification
to Vector Quantization by using (Hybrid DCT-VQ) which improved the
Compression Ratio by 85% and Normalized Root Mean Square Error by
9%. A proposed modification in the traditional Discrete Wavelet
Transform is used which has an improvement of Normalized Root Mean
Square Error by 41%.

xv
Chapter 1 INTRODUCTION

CHAPTER ONE

INTRODUCTION

Image compression is considered one of the most important fields in the


signal processing area for a long time ago and recently. This field takes
more interest in research and its applications cover several important
areas. Compression is the reduction in size of data in order to save
space or transmission time. The bit rate of uncompressed digital cinema
data exceeds 1 Gbps, so requirements may outstrip the anticipated
increase of storage space and bandwidth, and then we need to make
compression in data transmission. Image compression can be
considering obvious successful task because of many factors.
Neighboring pixels are not independent but correlated so this
information can be used to achieved compression.

1
Chapter 1 INTRODUCTION

This chapter introduces several terms related to the image compression


and the modules required for image compression and reconstruction.
The techniques of compression and decompression in lossy and lossless
image compression are overviewed. Also, the performance measures
are investigated.

1.1 What is the image compression

Compressing images are essentially needed now-a-days. Large storage


and bandwidth are needed to store and transmit the images, which is
quite costly. Image compression is useful when a computer user wishes
to minimize required storage space or maximize data transfer rates of
an image [1]. Image compression seeks to reduce digital image size
while maintaining image quality. This is achieved by applying the
methods used in the compression of data files. An image's size can be
reduced with or without a loss in quality of the image; so the image
compression techniques are classified into: lossless compression
[2] and lossy compression [3]. Several techniques have been developed
for lossy image compression. In lossy compression higher compression
ratios can be satisfied at the expense that the compressed image
contains less information. On the other hand, in the lossless
compression a lower compression ratio is satisfied.

2
Chapter 1 INTRODUCTION

1.2 Image compression and decompression model

Image compression model, as shown in figure (1.1.a), consists of


several modules; transformer, quantizer and encoder. On the other hand
the modules of the decompression model simply perform the inverse of
the compression modules as shown in figure (1.1.b) [4]. In the
following subsections, these modules are illustrated.

(a)

(b)

Figure 1.1 (a) Compression model (b) Decompression model.

3
Chapter 1 INTRODUCTION

1.2.1 Transform

This module transforms the input data into a format to reduce inter-
pixel redundancies in the input image. Transform coding techniques use
a reversible, linear mathematical transform to map the pixel values onto
a set of coefficients, which are then quantized and encoded. The key
factor behind the success of transform-based coding schemes is that
many of the resulting coefficients for most natural images have small
magnitudes and can be quantized without causing significant distortion
in the decoded image. For compression purpose, the higher capability,
of compressing information in fewer coefficients, the better the
transform [4].

Transform coding algorithms usually start by partitioning the original


image into blocks (n*n) pixels. For each block, the transform
coefficients are calculated, effectively converting the original n n
array of pixel values into an array of coefficients. Within these
coefficients, those are closer to the top-left corner usually contain most
of the information needed to quantize and encode (and eventually
perform the reverse process at the decoders side) the image with little
perceptual distortion. The resulting coefficients are then quantized and
the output of the quantizer is used by symbol encoding techniques to
produce the output bit stream representing the encoded image [4]. In
image decompression model, at the decoders side, the reverse process

4
Chapter 1 INTRODUCTION

takes place, with the obvious difference that the dequantization stage
will only generate an approximated version of the original coefficient
values.

1.2.2 Quantizer

This block reduces the accuracy of the transformers output in


accordance with some reestablished fidelity criterion. This operation is
not reversible and must be omitted if lossless compression is desired.
The quantization stage is at the core of any lossy image encoding
algorithm. Quantization at the encoder side, means partitioning of the
input data range into a smaller set of values. There are two main types
of quantizers: scalar quantizers and vector quantizers. A scalar
quantizer partitions the domain of input values into a smaller number of
intervals. If the output intervals are equally spaced, which is the
simplest way to do it, the process is called uniform scalar quantization;
otherwise, for reasons usually related to minimization of total
distortion, it is called non uniform scalar quantization. One of the most
popular non uniform quantizers is the Lloyd-Max quantizer. Vector
Quantization (VQ) techniques extend the basic principles of scalar
quantization to multiple dimensions [4]. One of the most well known
(VQ) techniques is the k-means [4].

5
Chapter 1 INTRODUCTION

1.2.3 Symbol (entropy) Encoder

This module creates a fixed or variable-length code to represent the


quantizers output and maps the output in accordance with the code. In
most cases, a variable-length code is used because a variable length
code is more efficient than fixed length code when the probability
distribution is not uniform, because that the variable-length packing
codes is to store only the actual part of the field that is filled in, and not
the trailing spaces that would be added for a fixed-length field. For a
field which is normally only partially filled, this can mean saving
considerable disk space. For small fields however it may not save any
space, since the database now has to store the length information in the
field, which is not necessary for a fixed-length field [5]. An entropy
encoder compresses the compressed values obtained by the quantizer to
provide more efficient compression. Most important types of entropy
encoders used in lossy image compression techniques are arithmetic
encoder, Huffman encoder and run-length encoder [4].

Anda mungkin juga menyukai