2. Bitmap Images
RGB Color Model (Red, Green & Blue)
3 bytes of Information for each Pixel:
1 byte for Red, 1 byte for Green & 1 byte for Blue
Memory space of a 640 × 480 24-bit RGB
color image:
640 × 480 = 307,200 pixels
307,200 × 3 = 921,600 bytes = 900 kilobytes
Image Compression Methods (like JPEG)
3. What is JPEG?
“Joint Photographic Expert Group”, A joint effort by
the CCITT and the ISO. (1991)
An Image Compression Method for continuous-
tone still images, both grayscale and color.
Facts on Human Visual System used in JPEG:
1. The eye seems to be more sensitive at the luminance of a
colour than at the nuance of that colour. (Y & CbCr)
2. The eye is much more sensitive to lower spatial
frequencies than to higher frequencies
5. Color Space Transformation
RGB to YCbCr
Y is Luminance (Brightness).
CbCr is the Chrominance.
Sampling:
RGB
RGB
Y
Cb Cr
+ (Down Sampling)
6. RGB to YCbCr
First the image is divided into 8x8 blocks.
RGB RGB
RGB RGB
Y Y
Y Y
Cb
Cr
+
8
8
8 8
8
8
8 8
8
8
8
4 x 64 x 3 byte 4 x 64 x 1 byte 2 x 64 x 1 byte
Y = 0.299 R + 0.587 G + 0.114 B
Cb = - 0.169 R - 0.331 G + 0.500 B
Cr = 0.500 R - 0.419 G - 0.081 B
8. DCT (cont’d)
Why we apply DCT?
To move from Spatial Domain to Frequency
Domain.
Why not FFT?
DCT is like FFT, but can approximate linear
signals well with few [real] coefficients.
DCT is slow
1024 multiplications and 896 additions.
JPEG 2000: Wavelet Transforms.
9. Quantization
DCT Coefficients are 12 bits per sample.
Why Quantization?
To reduce number of bits per sample.
F'[u, v] = round ( F[u, v] / Q[u, v] )
Two Quantization Tables are used in JPEG
Header File (QY & QCbCr).
Quantization error is the main source of the
Lossy Compression.
10. Zig Zag Scan
8x8 Blocks to a 1x64
Vector.
Why Zig Zag Scan?
To sort 8x8 DCT
coefficients based on the
spatial frequencies (low
frequency coefficients in
top of vector).
0 1 2 . . . 63
DC Component
(No Frequency)
Highest Frequency
1x64 Vector:
11. DPCM & RLE
1. DPCM on DC Component
Differential Pulse Code Modulation.
DC component is large and varied, but often
close to previous value.
2. RLE on AC Components
Zero Run Length Encoding.
1 x 64 vector has lots of zeros in it.
57,45,0,0,0,0,23,0,-30,-16,0,0,1,0,0,0, 0 , 0 ,0 , only 0,..,0
RLC: (0,57); (0,45); (4,23); (1,-30); (0,-16); (2,1); EOB
EOB = (0,0)
12. Entropy Coding
Entropy Coding is a form of compression that
relies on developing "code" words in a library
for the input values or "symbols".
Huffman Coding in JPEG.
4 Huffman Tables are stored in JPEG Header
File:
2 tables for DC Component (Y & CbCr)
2 tables for AC Components (Y & CbCr)