Image Compression
Image Compression
Content
Redundancies
Coding
Interpixel
Psychovisual
Fidelity Criteria
Image Compression models
Error free compression
Lossy compression
Image compression standards
Compression..??
What is compression.?
A technique by which the data is stored as information.
Representation of data in such a way that it makes the
use of less resources to store and transmit it.
How it is done..??
By reducing the redundancy present in the data.
Redundancy = Data – Information
Redundancy = Irrelevant or symmetric data.
R= 1- 1/C
Where
c= b/b’
R = relative redundancy
b= bits used to represent data
b’ = bits used to represent the information from that data
Redundancies
Coding Redundancies
Interpixel Redundancies
Psychovisual Redundancies
Coding Redundancies
Code: system of letters, numbers, bits (symbols)
Codeword: Meaningful sequence of symbols
Code Length: Number of symbols used to form codeword
Often Coding techniques makes the use of more number of bits than
that required to store the intensity.
Example
In 8 bit gray scale representation intensity level ‘6’ is represented by
‘00000110’
where only 3 last bits are significant and rest 5 are redundant.
In this example
Code = {1,0}, Codeword = 00000110 and Code Length = 8
Other way to exploit redundancy
Suppose we are making use of 8 bits to represent the gray levels in the
image.
But suppose image is having only ’64’ different intensity levels in it out
of possible ‘256’ gray levels.
Now if we assign new code to those ’64’ intensities, ‘6’ bits are sufficient
to store the pixel information
Interpixel Redundancy (based
on planes)
Spetial (Intra plane) Redundancy:
The correlated pixels in a still image
Instantaneous:
do not refer|ence s{uz cceed}ing symbols
Uniquely decodable
symbols can be decoded in only one way
Block code
for each symbol: only one code
Example
Symbol Frequency
A 24
B 12
C 10
D 08
E 08
Total 186 bit (with 3 bit per code word)
Steps
The two rarest symbols 'E' and 'D' are connected first,
followed by 'C' and 'D'.
The new parent nodes have the frequency 16 and 22
respectively and are brought together in the next step.
The resulting node and the remaining symbol 'A' are
subordinated to the root node that is created in a final
step.
Example Continued
Example Continued
S F C CL TL
A 24 0 1 24
B 12 100 3 36
C 10 101 3 30
D 8 110 3 24
E 8 111 3 24
-------------------------------------
186 138 bits
Lavg = (0.4)(1) + (0.3)(2) + (0.1)(3) + (0.1)(4) + (0.06)(5) +
(0.04)(5) = 2.2 bits/pixel
Arithmetic Coding
When encoding begins the code table contains only the first 256
entries, with the remainder of the table being blanks.
BABAABAAA
Example 1: LZW Compression Step 1
BABAABAAA P=A
STRING TABLE
C=empty
ENCODER OUTPUT
string codeword representing output code
BA 256 B 66
Example 1: LZW Compression Step 2
BABAABAAA P=B
STRING TABLE
C=empty
ENCODER OUTPUT
string codeword representing output code
BA 256 B 66
AB 257 A 65
Example 1: LZW Compression Step 3
BABAABAAA P=A
STRING TABLE
C=empty
ENCODER OUTPUT
string codeword representing output code
BA 256 B 66
AB 257 A 65
BAA 258 BA 256
Example 1: LZW Compression Step 4
BABAABAAA P=A
STRING TABLE
C=empty
ENCODER OUTPUT
string codeword representing output code
BA 256 B 66
AB 257 A 65
BAA 258 BA 256
ABA 259 AB 257
Example 1: LZW Compression Step 5
BABAABAAA P=A
STRING TABLE
C=A
ENCODER OUTPUT
string codeword representing output code
BA 256 B 66
AB 257 A 65
BAA 258 BA 256
ABA 259 AB 257
AA 260 A 65
Example 1: LZW Compression Step 6
BABAABAAA P=AA
STRING TABLE
C=empty
ENCODER OUTPUT
string codeword representing output code
BA 256 B 66
AB 257 A 65
BAA 258 BA 256
ABA 259 AB 257
AA 260 A 65
AA 260
LZW Decompression
It starts with the first 256 table entries initialized to single characters.
The string table is updated for each character in the input stream,
except the first one.
CCITT
JPEG
M-JPEG
BMP
Symbol Based Coding
It exploits coding as well as spetial
redundancies
It assign a unique value to each symbol.
For compression it stores location and
corresponding code of that symbol.
Bit Plane Coding
First make the use of bit slice of the image
Then use one of the available techniques to compress the file.
Generally
Image is broken up into bit planes and then RLE is applied to each
plane.
Let the image is represented as
am-12m-1 + am-2 2m-2 + a1 21 + a0 20
So here we will get ‘m’ planes (0,1,2...m-1)
Problem:
Small change in intensities can cause lots of variation in code i.e. 127
(01111111) and 128(10000000)
Solution
Make the use of gray code
gi = ai EXOR ai+1 where 0<=i<=m-2 and gm-1 = am-1
Block Transform Coding
Y = 0.30R+0.59G+0.11B
I = 0.60R-0.28G-0.32B
Q = 0.21R-0.52G+0.31B
4800 blocks
Block ‘Y’ matrix to DCT
Computation of the quantized DCT coefficients
Transmission order
Image Compression
Standards
JPEG
CCITT
BMP