Image Processing PPT Unit 5
Image Processing PPT Unit 5
Processing
KCS 062
Image Compression
Image Compression
Image Compression
Image Compression
Run Length Coding
Run Length Coding
11111000000001111111110011111100000111111111
5 1’s, 8 0’s, 9 1’s, 2 0’s, 6 1’s, 5 0’s, 9 1’s
(1,5), (0,8), (1,9), (0,2), (1,6), (0,5), (1,9)
10101, 01000, 11001, 00010, 10110, 00101, 11001
10101010001100100010101100010111001
Total bits = 35
Before Encoding Total bits were = 44
Run Length Coding
Horizontal RLC
0 0 0 0 0 • Run Length Vector
0 0 0 1 1 • (0,5)
1 1 1 1 1 • (0,3),(1,2)
• (1,5)
1 1 1 1 1 • (1,5)
1 1 1 1 1 • (1,5)
• Max length = 5 → 3bits
• No. of pixels per = 1
• No. of vectors = 6
• Total no. of pixels = 6 * (3+1) = 24
• No. of Pixels for original image = 5*5 = 25
• Compression Ratio = 25/24 = 1.042 = 1
Run Length Coding
Vertical RLC
0 0 0 0 0 • Run Length Vector
0 0 0 1 1 • (0,2), (1,3)
1 1 1 1 1 • (0,2),(1,3)
• (0,2),(1,3)
1 1 1 1 1 • (0,1),(1,4)
1 1 1 1 1 • (0,1),(1,4)
• Max length = 4 → 3bits
• No. of bits per pixel= 1
• No. of vectors = 10
• Total no. of pixels = 10 * (3+1) = 40
• No. of Pixels for original image = 5*5 = 25
• Compression Ratio = 25/40 = 0.6 = 1
Huffman Coding
Symbols Codewords
Symbols Probabilities 0
A 1
A 0.4 0.4 0.6
B 01
B 0.3 0.3 0 0.4
0
C 000
C 0.2 0.3 1
1 D 001
D 0.1
1
Huffman Coding Tree Approach
Symbols A B C D
Probability 0.4 0.3 0.2 0.1
1.0
0 1
Symbols Codewords
0.4 0.6
A 0
B 10 0 1
C 110
D 111
0.3 0.3
0 1
0.2 0.1
Huffman Coding
• Example: Calculate the Huffman Codes for the set of
symbols as shown in the table
Symbols X1 X2 X3 X4 X5
Probability 0.3 0.15 0.25 0.05 0.25
Symbols Codewords Length
X1 00 2 Average Length of code
X2 110 3 word = σ𝑛𝑘=1 𝑙𝑒𝑛𝑔𝑡ℎ𝑘 ∗ 𝑝𝑘
X3 01 2
X4 111 3
X5 10 2
Huffman Coding
Symbols Prob. Codeword Length Average Length of code word =
s σ𝑛𝑘=1 𝑙𝑒𝑛𝑔𝑡ℎ𝑘 ∗ 𝑝𝑘
X1 0.3 00 2
Avg(L) = 2*0.3 + 3*0.15 + 2*0.25
X2 0.15 110 3
+ 3*0.15 + 2*0.05
X3 0.25 01 2
Avg(L) = 2.2 Letters/message
X4 0.15 111 3
X5 0.05 10 2
𝐻(𝑋)
• Efficiency =
𝐴𝑣𝑔 𝐿
2.15
• Efficiency = = 0.977
2.2
Simple Regional Descriptors
Holes: H
Connected Components : C
Euler Number : E = C-H
→For Polygon networks:
Vertices: V, Edges: Q, Faces: F
E = V-Q+F = C-H
Texture Regional Descriptors
Texture Regional Descriptors
Statistical
• Histogram Based
texture • Co-occurrence based
descriptors
Spectral
texture • Use Fourier Transform.
descriptors