0% found this document useful (0 votes)
1 views

Image Compression

Uploaded by

pandadipu915
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Image Compression

Uploaded by

pandadipu915
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Image Compression

Dr. Nilamani Bhoi


Associate Professor
Dept. of Electronics and Telecommunication
Veer Surendra Sai University of Technology, Burla
Image Compression

Image compression is minimizing the size in bytes of a graphic file without


degrading the quality of image.

Need of image compression:

1. Transmission
2. Storage

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 2
Performance measures of image compression

Bits/pixel:
It is defined as the number of bits required to represent a single pixel.
Image Compression

Compression ratio:
It is the ratio of the size of original image to the size of compressed image

Example:
Consider 8-bit image of 256×256 pixels. After compression, the size is
6554 bytes. Find the compression ratio and bits/pixel.

Ans:
Compression ratio= 10:1
Bits/pixel=0.8

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 3
Compression is possible due to redundancies present in image.

Redundancy: Irrelevant or repeated information in image


Image Compression

Relationship between relative data redundancy RD and compression ratio:

CR = Compression Ratio

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 4
Image Compression

Three basic redundancies in image compression are

(i) Interpixel redundancy


(ii) Psychovisual redundancy
(iii)Coding redundancy

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 5
Interpixel redundancy
Interpixel redundancy is due to the correlation between the nieghboring pixel.
Image Compression

A pixel can be predicted from neighboring pixel. So visual contribution of a single


pixel to an image is redundant.

The interpixel redundancies are achieved by transforming the image into other
domain such as DCT, DWT, etc.
0 0 0 0 0 0 0 0
0 200 165 167 166 169 171 172
0 206 164 167 171 175 174 175
161 160 160 159 159 159 158 159 0 211 165 168 174 173 177 175
161 161 160 159 159 158 159 160 0 209 167 171 170 175 174 174
163 162 161 160 159 160 161 161 Beginning 8×8 pixels 0 209 166 169 172 171 173 173
Beginning 8×8 pixels
163 163 162 161 160 160 161 160 0 204 162 170 174 176 175 178
162 162 160 160 160 159 159 160 0 208 166 172 174 172 173 172
162 161 160 158 158 158 158 160
160 159 158 157 158 157 157 157
159 158 157 157 156 156 156 157

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 6
Psychovisual redundancy
Human eye does not respond to all visual information with equal sensitivity.
Image Compression

Certain information has relatively less importance than other information.


This information is said to be psychovisually redundant.

Removing this type of redundancy is a lossy process and the lost information can
not be recovered.

The method used to remove this type of redundancy is called quantization which
means the mapping of broad range of input values to a limited number of output
values.

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 7
Psychovisual redundancy
Image Compression

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 8
Image Compression Psychovisual redundancy

(b)
(a)

(a)Original Image
(b) Uniform quantization to 16 levels
(c)IGS quantization to 16 levels

(c)

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 9
Image Compression

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 10
Coding redundancy

In coding redundancy various coding techniques are used to achieve compression.

The average number of bits required to represent each pixel is


Image Compression

the no. of bits used to represent each pixel value r k

probability of gray level rk

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 11
Coding Techniques

There are many coding techniques used in image compression.


Image Compression

(i) Run length coding


(ii) Huffman coding
(iii) Block coding
(iv) Contour coding, etc.

Most frequently used coding are run length coding and Huffman
coding

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 12
Run length coding
In this code, every code ward is made up of a pair (g,l) where g is the gray
level, and l is the number of pixels with that gray level (length or ‘run’).
Image Compression

Exp:

56 56 56 82 82 82 83 80 Run length codes

56 56 56 56 56 80 80 80 (56,3) , (82,3), (83,1), (80,4), (56,5)

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 13
Huffman coding
In this code shorter code wards are assigned to most frequently occurring
gray levels and longer code wards to less frequently occurring gray levels.
Image Compression

We divide the coding method in two stages.

In first stage we arrange the gray levels based on their probabilities.

In the second stage we assign the code wards.

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 14
Huffman coding
First stage
Image Compression

1. Sort the gray levels by decreasing order of probabilities.


2. Sum the two smallest probabilities.
3. Sort (decreasing order) the new value in the list.
4. Repeat (1) to (3) until only two probabilities remains.

Second stage

1. Give the code 0 to the highest probability, and the code 1 to the lowest
probability
2. Go backwards through the tree one node at a time and repeat from (1)
until all gray levels have a unique code.

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 15
Huffman coding
Example:

A 10×10, 2-bit image with gray levels and their occurrences are given in the
following table. Find the Huffman code.
Image Compression

Gray level 0 1 2 3
Freq. Of occurrences 20 45 30 5

Gray level 0 1 2 3
Huffman code 010 1 00 011

Lavg = 1×0.45+2×0.3+3×0.2+3×0.05
=0.45+0.6+0.6+0.15
=1.8
4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 16
Image Compression System
Image Compression

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 17
Mapper

-Use DCT, DWT to achieve inpterpixel redundancy


Image Compression

• Using the DCT, the entries in Y will be organized based on


the human visual system.

• The most important values to Most


our eyes will be placed in the
Important
upper left corner of the matrix.
Semi-

• The least important values Important


will be mostly in the lower Least
right corner of the matrix. Important

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 18
DCT of normalized image
JPEG use DCT as mapper
Image Compression

DCT not normalized image


4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 19
Important and can
JPEG use DCT as mapper be used to recover
the image
Image Compression

Recovered Image

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 20
Important and can
JPEG use DCT as mapper be used to recover
the image
Image Compression

Recovered Image

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 21
JPEG Coding
Cr
Cb f(i, j) F(u, v)
Steps Involved:
Fq(u, v)
Y DCT Quantization 1. Discrete Cosine
Transform of each 8x8
8x8 8x8
pixel array
Image Compression

f(x,y) T F(u,v)
Quant… 2. Quantization using a
Tables table or using a constant
Coding 3. Zig-Zag scan to exploit
Tables Zig Zag redundancy
Scan 4. Differential Pulse Code
Header Modulation(DPCM) on
Tables the DC component and
DPCM Run length Coding of the
Data Entropy AC components
Coding 5. Entropy coding
RLC (Huffman) of the final
output

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 22 22
Quantization Table

Luminance: QY =
Image Compression

p { 16 11 10 16 24 40 51 61
12 12 14 19 26 58 60 55
14 13 16 24 40 57 69 56
14 17 22 29 51 87 80 62
18 22 37 56 68 109 103 77
24 35 55 64 81 104 113 92
49 64 78 87 103 121 120 101
72 92 95 98 112 100 103 99}

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 23
Quantization Table

Chrominance:
QC =
Image Compression

{ 17 18 24 47 99 99 99 99
18 21 26 66 99 99 99 99
24 26 56 99 99 99 99 99
47 66 99 99 99 99 99 99
99 99 99 99 99 99 99 99
99 99 99 99 99 99 99 99
99 99 99 99 99 99 99 99
99 99 99 99 99 99 99 99}

4/18/2025 Dr. Nilamani Bhoi, Associate Professor, ETC Engg, VSSUT Burla 24

You might also like