Image Compression
Image Compression
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
• Psychovisual
Human visual perception - limited
Image Compression
Coding 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
• 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)
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)
a5(0.1)
Image Compression
Variable Length Coding (Huffman Coding)
Sort combine Sort combine Sort combine Sort combine
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:
?
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