Chapter 6
Chapter 6
Chapter 6
Chapter Six:
Image Compression
Kassawmar Mandefro
Department of Computer Science
April, 2024
2
Cont….
Image compression refers to the process of reducing the size
of a digital image file while attempting to minimize the loss of
image quality.
The primary goal of image compression is to efficiently store
or transmit images using less storage space or bandwidth.
Image compression involves reducing the size of image data
files, while retaining necessary information.
Retaining necessary information depends upon the
application.
Image segmentation methods, which are primarily a data
reduction process, can be used for compression.
3
Cont…
Compression algorithm development starts with
applications to two-dimensional (2-D) images.
After the 2-D methods are developed, they are often
extended to video (motion imaging).
However, we will focus on image compression of single
frames of image data.
Applications that require image compression are:
1. Internet
2. Businesses
3. Multimedia
4. Satellite imaging
5. Medical imaging
4
Cont…
There are two primary types of image compression
methods:
1. Lossless compression methods:
These methods reduce the file size of an image without
sacrificing any image quality.
These methods exploit redundancy within the image data to
eliminate unnecessary or redundant information while
preserving all the original image details.
These techniques aim to preserve all the original pixel values
and details of the image.
Like compression in PNG and GIF formats.
Examples of lossless compression methods include:
• Run-Length Encoding (RLE)
• Huffman coding
• Arithmetic coding
• Lempel-Ziv-Welch (LZW) compression. 5
2. Lossy compression methods:
Cont…
These methods reduce the file size of an image by discarding
some image data that are less important.
This results in some loss of image quality, which may or may
not be noticeable depending on the compression ratio and the
specific characteristics of the image.
These techniques are commonly used in scenarios where
reducing file size is prioritized over preserving every detail of
the image, such as in multimedia applications, web-based image
sharing, and video streaming.
Examples of lossy compression methods include:
• JPEG, which is widely used for photographic images, and
• MPEG (Moving Picture Experts Group), used for compressing
video sequences.
6
Data redundancy
Compression algorithms are developed by taking
advantage of the redundancy that is inherent in image
data.
Data redundancy refers to the presence of repetitive
information within a dataset, leading to inefficiency in
storage, transmission, or processing.
Four primary types of redundancy that can be found in
images are:
1. Coding
2. Interpixel
3. Interband
4. Psychovisual redundancy 7
Cont…
1. Coding redundancy
Occurs when the data used to represent the image is not
utilized in an optimal manner.
It is due to inefficient encoding of data. For instance, if a
certain pattern or information is repeated in the image, it can
be compressed or encoded more efficiently.
2. Interpixel redundancy
This redundancy refers to correlations between neighboring
pixels within an image.
Occurs because adjacent pixels tend to be highly correlated,
in most images the brightness levels do not change rapidly,
but change gradually.
8
3. Interband redundancy Cont…
In color images, different color channels (e.g., red, green, blue) may
contain redundant information.
Occurs in color images due to the correlation between bands
within an image – if we extract the red, green and blue bands they
look similar.
4. Psychovisual redundancy
Not all information in an image is equally important for human
interpretation. Some information is more important to the
human visual system than other.
This redundancy related to the characteristics of human visual
perception.
Compression algorithms can remove or reduce information that
humans are less likely to notice, based on principles of human visual
perception. 9
Cont…
Reducing redundancy is a fundamental goal in image
compression and various other image processing tasks.
10
Cont…
The key in image compression algorithm development is to
determine the minimal data required to retain the
necessary information.
11
Cont…
To determine which information can be removed and which
information is important, the image fidelity criteria are used.
12
Compression System Model
1. The compressor
2. The decompressor
22
Cont…
Quantization may be necessary to convert the data into digital
form (BYTE data type), depending on the mapping equation
used.
The code can be an equal length code, where all the code
words are the same size, or an unequal length code with
variable length code words.
24
Types of data compression
25
LOSSLESS COMPRESSION METHODS
No loss of data, decompressed image exactly same as
uncompressed image
Medical images or any images used in courts
Lossless compression methods typically provide about a 10%
reduction in file size for complex images.
Lossless compression methods can provide significant
compression for simple images.
However, lossless compression techniques may be used
for both preprocessing and postprocessing in image
compression algorithms to obtain the extra 10%
compression.
26
Huffman coding
Huffman coding is a widely used method for lossless data
compression.
It was developed by David A. Huffman in 1952 while he was a
student at MIT (Massachusetts Institute of Technology).
It is particularly effective for compressing data with non-uniform
(unequal length code) probability distributions, such as image data
where certain pixel values occur more frequently than others.
The basic idea behind Huffman coding is to assign variable-length
codes to symbols based on their frequencies, with more frequent
symbols being assigned shorter codes, and less frequent symbols
being assigned longer codes.
This results is ensuring that the encoded data can be uniquely
decoded. 27
Cont..
Huffman coding is widely used in various applications,
including image and video compression (e.g., within the JPEG
compression standard), file compression algorithms (e.g., ZIP),
and communication systems.
20
Decode the encoded msg by its Huffman tree
9 we generate:
0 Decoded Message (original I/p) = BCC……
11
5
0 0
2 3 4 5 6
E A D B C
34
Run-Length Coding
Run-length coding (RLC) works by counting adjacent
pixels with the same gray level value called the run-
length, which is then encoded and stored.
35
Cont…
RLC can be implemented in various ways, but the first step is
to define the required parameters.
39
Bit-plane coding
Bit-plane coding decomposes an image into multiple bit-
planes, where each bit-plane represents a different level of
significance in the image data.
40
Lossy Compression Methods
41
42