0% found this document useful (0 votes)
29 views27 pages

Image Compression

Image compression involves reducing the size of image files to reduce storage needs and speed up transmission. It can be lossless, preserving all image information, or lossy, discarding some data. Key techniques include variable length coding like Huffman coding to reduce redundancy in symbol frequencies, and run length coding or predictive coding to reduce interpixel redundancy from correlations between neighboring pixels. Compression is evaluated using metrics like compression ratio, relative redundancy, mean squared error, and signal-to-noise ratio. Common applications require either symmetric algorithms for interactive uses or asymmetric for retrieval where decompression is faster.

Uploaded by

Roshan Erukulla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views27 pages

Image Compression

Image compression involves reducing the size of image files to reduce storage needs and speed up transmission. It can be lossless, preserving all image information, or lossy, discarding some data. Key techniques include variable length coding like Huffman coding to reduce redundancy in symbol frequencies, and run length coding or predictive coding to reduce interpixel redundancy from correlations between neighboring pixels. Compression is evaluated using metrics like compression ratio, relative redundancy, mean squared error, and signal-to-noise ratio. Common applications require either symmetric algorithms for interactive uses or asymmetric for retrieval where decompression is faster.

Uploaded by

Roshan Erukulla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Image

Compression
Compression Ratio
Cr = no/nc
no = Number of carrying units (bits) in the original
data (image)
nr = Number of carrying units (bits) in the compressed
data (image)

Also,
Rd = 1 – 1/ Cr

Rd = Relative data redundancy


Image Compression
Fidelity Criteria
Measure of loss or degradation
•  Mean Square Error (MSE)

•  Signal to Noise Ratio (SNR)


•  Subjective Voting
Image Compression
Compression Techniques
•  Loss-less Compression
Information can be compressed and
restored without any loss of information
•  Lossy Compression
Large compression, perfect recovery is
not possible
Image Compression
Compression Techniques
Symmetric
•  Same time for compression (coding) and decompression (decoding)
•  Used for dialog (interactive) mode applications
Asymmetric
•  Compression is done once so can take longer
•  Decompression is done frequently so should be fast
•  Used for retrieval model applications
Image Compression
Data Redundancy
•  Coding
Variable length coding with shorter codes
for frequent symbols
•  Interpixel
Neighboring pixels are similar

•  Psychovisual
Human visual perception - limited
Image Compression
Coding Redundancy
Example: (from Digital Image Processing by Gonzalez and Woods)

fixed length coding variable length coding


Avg length=3 bits Avg length=2.7 bits
Image Compression
Interpixel Redundancy
Example: (from Digital Image Processing by Gonzalez and Woods)

Image Histogram
Image Compression
Interpixel Redundancy
Example: (from Digital Image Processing by Gonzalez and Woods)

Image Histogram

High interpixel correlation


Image Compression
Psychovisual Redundancy
Example: (from Digital Image Processing by Gonzalez and Woods)

Original 256 levels 16 level quantization IGS quantization


Image Compression
Loss-less Techniques

•  Coding redundancy
Variable length coding

•  Interpixel redundancy
Run length coding
Predictive coding
Image Compression
Variable Length Coding (Huffman Coding)
Sequence of symbols (a1, a2, a3, a4, a5) with associated
probabilities (p1, p2, p3, p4, p5)

•  Start with two symbols of the least probability


a1:p1
a2:p2
•  Combine (a1 or a2) with probability (p1+p2)
•  Do it recursively (sort and combine)
•  A binary tree construction
Image Compression
Variable Length Coding (Huffman Coding)
Example:
Symbols and their probabilities of occurrence a2 (0.4)
a1 (0.2), a2 (0.4), a3 (0.2), a4 (0.1), a5 (0.1)
a1(0.2)

Sort in a3(0.2)
probability
a4(0.1)

a5(0.1)
Image Compression
Variable Length Coding (Huffman Coding)
Sort

a2 (0.4)

a1(0.2)

a3(0.2)

a4(0.1)

a5(0.1)
Image Compression
Variable Length Coding (Huffman Coding)
Sort combine

a2 (0.4)

a1(0.2)

a3(0.2)

a4(0.1) 0.2

a5(0.1)
Image Compression
Variable Length Coding (Huffman Coding)
Sort combine Sort

0.4
a2 (0.4)
0.2
a1(0.2)
0.2
a3(0.2)

a4(0.1) 0.2 0.2

a5(0.1)
Image Compression
Variable Length Coding (Huffman Coding)
Sort combine Sort combine Sort combine Sort combine

0.4 0.4 0.6


a2 (0.4) 1
0.2 0.4
a1(0.2) 0.6 0.4
0.2 0.2
a3(0.2) 0.4

a4(0.1) 0.2 0.2

a5(0.1)
Image Compression
Variable Length Coding (Huffman Coding)
Sort combine Sort combine Sort combine Sort combine

1 1 0.4 1 0.6 0
0.4
1 a2 (0.4) 1
01 0.2 01 0.4 00
01 a1(0.2) 0.6 0.4 1
000 0.2 000 0.2
000 a3(0.2) 0.4
01
0010
0010 a4(0.1) 0.2 0.2
Assign code
001
0011 a5(0.1)
0011
Image Compression
Variable Length Coding (Huffman Coding)
Example:

Avg length code:


0.4x1 + 0.2x2 + 0.2x3 + 0.1x4 + 0.1x4
= 2.2 bits
Image Compression
Variable Length Coding (Huffman Coding)

Entropy A measure of information that captures uncertainity


[I(e) = log (1/P(e))]
Image Compression
Entropy
Image Compression
Entropy
Example:
Image Compression
Entropy
Example:
Image Compression
Entropy
Example:
Image Compression
Variable Length Coding (Huffman Coding)
Example: Decoding
00111010001

?
Image Compression
Variable Length Coding (Huffman Coding)
Root
1
Example: Decoding 0

00111010001 0 1 a2

0 1 a1

0 1
a3

a4 a5
Image Compression
Variable Length Coding (Huffman Coding)
Root
1
Example: Decoding 0

00111010001 0 1 a2
a5 0 1 a1
a2
0 1
a1 a3
a3
a2 a4 a5
Image Compression

You might also like