Module 5 - Part1
Module 5 - Part1
Module 6 (Part 1)
Image Compression
Ms. Sherry Ann Sacharias
Assistant Professor
Dept. of ECE
RSET
Reference Textbooks
(Chapter 8)
• In any coding scheme, the average no. of bits used to represent each
pixel is given by
Lavg = σ𝐿−1
𝑘=0 𝑙 𝑟𝑘 𝑝(𝑟𝑘 )
b 256 × 256 × 8
𝐶= = = 4.42
b′ 256 × 256 × 1.81
1 1
𝑅 =1− =1− = 0.774
𝐶 4.42
• Huffman Coding: It assigns a binary code for each intensity level and
uses shorter codes for intensities with higher probability.
S Code Length
𝒔𝟏 1 1
𝒔𝟐 01 2
𝒔𝟑 000 3
𝒔𝟒 0010 4
𝒔𝟓 0011 4
• H s = −{ 0.4 log 2 0.4 + 0.2 log 2 0.2 + 0.2 log 2 0.2 + 0.1 log 2 0.1 +
0.1 log 2 0.1 }
= 2.12 bits/ symbol
𝜂 = 𝐻(𝑧)/𝐿𝑎𝑣𝑔
S Code Length
2.12
= = 0.963 𝒔𝟏 1 1
2.2
𝒔𝟐 01 2
𝒔𝟑 000 3
• Variance of the code is given by, 𝒔𝟒 0010 4
𝒔𝟓 0011 4
𝒒
𝜎 2 = σ𝒊=𝟏 𝒑𝒊 (𝒍𝒊 − 𝑳𝒂𝒗𝒈 )𝟐
2 2 2 2
= 0.4 1 − 2.2 + 0.2 2 − 2.2 + 0.2 3 − 2.2 + 2 × 0.1 4 − 2.2
= 1.36
• Find the sub range for each symbol in between the interval 0.7 and 1.0
• The new range for each symbol is
• Now find the sub range for each symbol in the range 0.7 to 0.82
• Here the tag value corresponding to the final interval 0.784 to 0.82 is
calculated as:
0.784 + 0.82
𝑡𝑎𝑔 = = 0.802
2
Hence the tag value 0.802 is the arithmetic code corresponding to the
message ‘dad’
Rajagiri School of Engineering & Technology 31
Decoding Procedure
The tag value and symbol probabilities will be sent to the receiver. The
data is decoded from the tag value
Example: For the above problem, decode the transmitted data given
the tag value 0.802 and symbol probabilities as follows:
• The tag value is compared with the symbol sub range. The tag value 0.802
lies in the sub interval 0.7 and 1.0 which shows that d is the first decoded
symbol.
• Step 2: Since the first decoded symbol is d, the new interval is fixed as 0.7
to 1.0
This tag value lies in the range 0 to 0.4, hence the next decoded symbol is a
• Step 4: Since the decoded symbol is a, the new interval is 0 to 0.4
0.34 − 0
𝑡∗ = = 0.85
0.4
This tag value lies between 0.7 and 1.0 and hence decoded symbol is d
From the above steps, it is clear that that the decoded word is dad
Drawback: An end of message indicator needed to separate one message
from another
Rajagiri School of Engineering & Technology 35
Summary
• Image compression involves methods to reduce amount of data
required to represent data
• The need for compression and types of redundancies found in images
was discussed
• Error free compression techniques such as Huffman coding and
Arithmetic coding