Title: Image Compression
1Image Compression
- ?.??????? ???????
- ??????????????????? ??????????????
- ?????????????????????????????????????????????
2Image Compression
- Reducing the size of image data files
- While retaining necessary information
Original Image
Compressed Image file
extracted Image file
compress
decompress
3Terminology
- refer relation between original image and
- the compressed file
- Compression Ratio
- Bits per Pixel
A larger number implies a better compression
A smaller number implies a better compression
4Compression Ratio
(1)
- Ex Image 256X256 pixels, 256 level grayscale can
be compressed file size 6554 byte. - Original Image Size 256X256(pixels) X
1(byte/pixel) - 65536 bytes
5Bits per Pixel
- Ex Image 256X256 pixels, 256 level grayscale can
be compressed file size 6554 byte. - Original Image Size 256X256(pixels) X
1(byte/pixel) - 65536 bytes
- Compressed file 6554(bytes)X8(bits/pixel)
- 52432 bits
6Why we want to compress?
- To transmit an RGB 512X512, 24 bit image
- via modem 28.2 kbaud(kilobits/second)
7Key of compression
- Reducing Data but Retaining Information
DATA are used to convey information.
Various amounts of data can be used to represent
the same amount of information. Its Data
redundancy
Relative data redundancy
8Entropy
- Average information in an image.
- Average number of bits per pixel
9Redundancy
- Coding Redundancy
- Interpixel Redundancy
- Psychovisual Redundancy
10Coding Redundancy
- Occurred when data used to represent image are
not utilized in an optimal manner
11Coding Redundancy(cont)
- An 8 gray-level image distribution shown in Table
rk p(rk) code1 l1(rk) code2 l2(rk)
r00 0.19 000 3 11 2
r11/7 0.25 001 3 01 2
r22/7 0.21 010 3 10 2
r33/7 0.16 011 3 001 3
r44/7 0.08 100 3 0001 4
r55/7 0.06 101 3 00001 5
r66/7 0.03 110 3 000001 6
r71 0.02 111 3 000000 6
12Coding Redundancy(cont)
- Original Image 8 possible gray level 23
13Interpixel Redundancy
- Adjacent pixel values tend to be highly correlated
14Psychovisual Redundancy
- Some information is more important to the human
visual system than other types of information
15Compression System Model
16Types of Compression
- There are 2 types of Compression
- Loseless Compression
- Lossy Compression
17Loseless Compression
- No data are lost
- Can recreated exactly original image
- Often the achievable compression is mush less
18Huffman Coding
- Using Histogram probability
- 5 Steps
- Find the histogram probabilities
- Order the input probabilities(small?large)
- Addition the 2 smallest
- Repeat step 23, until 2 probability are left
- Backward along the tree assign 0 and 1
19Huffman Coding(cont)
- Step 1 Histogram Probability
p0 20/100 0.2 p1 30/100 0.3 p2 10/100
0.1 p3 40/100 0.4
p3 ? 0.4 p1 ? 0.3 p0 ? 0.2 p2 ? 0.1
20Huffman Coding(cont)
Natural Code Probability Huffman Code
00 0.2 010
01 0.3 00
10 0.1 011
11 0.4 1
21Huffman Coding(cont)
- The original Image average 2 bits/pixel
- The Huffman Codeaverage
22Run-Length Coding
- Counting the number of adjacent pixels with the
same gray-level value - Used primarily for binary image
- Mostly use horizontal RLC
23Run-Length Coding(cont)
horizontal
1st Row 8
2nd Row 0,4,4
3rd Row 1,2,5
4th Row 1,5,2
5th Row 1,3,2,1,1
6th Row 2,1,2,2,1
7th Row 0,4,1,1,2
8th Row 8
24Run-Length Coding(cont)
- Extending basic RLC to gray-level image by using
bit-plane coding - It will better if change the natural code into
gray code
00 01 10 11
00 01 11 10
Natural
Gray Code
25Lempel-Ziv-Weich Coding(LZW)
CRS PBP Encoded O/P Dictionary Location Dictionary Entry
39 39 39 256 39-39
39 120 39 257 39-120
120 39 120 259 120-39
39-39 120 256 260 39-39-126
- Assign fixed-length code words to variable
- GIF,TIFF,PDF
26Lossy Compression
- Allow a loss in the actual image data
- Can not recreated exactly original image
- Commonly the achievable compression is mush more
- JPEG
27Fidelity Criteria
- Objective fidelity criteria
- RMS Error
- RMS Signal-To-Noise Ratio
- Subjective fidelity criteria
28JPEG