Digital Image Processing (CS-323)
Lecture-25
Dr. Ajay Kumar Mallick
Department of Computer Science and Engineering
NIT Hamirpur, India
Dr. Ajay Kumar Mallick,
NIT Hamirpur
Outline
▪ Topics to Learn
▪ Image Compression
▪ Block Transformation Coding: JPEG Compression
Dr. Ajay Kumar Mallick,
NIT Hamirpur
JPEG Compression
▪ One of the most popular and comprehensive continuous tone, still-
frame compression standards is the JPEG standard.
▪ It is defined as a lossy baseline coding system, which is based on the
DCT and is adequate for most compression applications.
▪ In the baseline system, often called the sequential baseline system,
the input and output data precision is limited to 8 bits, whereas the
quantized DCT values are restricted to 11 bits. Dr. Ajay Kumar Mallick,
NIT Hamirpur
JPEG Compression
▪ The image is first subdivided into pixel blocks of size 8 × 8, which are
processed left-to-right, top-to-bottom.
▪ As each 8 × 8 block or subimage is encountered, its 64 pixels are
level-shifted by subtracting the quantity 2𝑘−1 , where 2𝑘 is the
maximum number of intensity levels.
▪ The 2-D discrete cosine transform of the block is then computed,
quantized in accordance with Eq. shown below, and reordered, using
the zigzag pattern, to form a 1-D sequence of quantized coefficients.
𝑇(𝑢,𝑣) Dr. Ajay Kumar Mallick,
𝑇(u,v) =round NIT Hamirpur
𝑍(𝑢,𝑣)
JPEG Compression: Steps of Compression
▪ Consider compression and reconstruction of the following 8x8 subimage with the
JPEG baseline standard:
The original image consists of 256 or 28 possible intensities, so the coding process
begins by level shifting the pixels of the original subimage by − 27 or −128 intensity
levels. The resulting shifted array is
Dr. Ajay Kumar Mallick,
NIT Hamirpur
JPEG Compression
▪ Transformed in accordance with the forward DCT
Dr. Ajay Kumar Mallick,
NIT Hamirpur
JPEG Compression
▪ The normalizing matrix is:
𝑇(𝑢,𝑣)
▪ 𝑇 𝑢, 𝑣 = T(u,v)
𝑍(𝑢,𝑣)
▪ The output after normalization is:
Dr. Ajay Kumar Mallick,
NIT Hamirpur
Z(u,v)
JPEG Compression
▪ The transformation and normalization process produces a large
number of zero-valued coefficients.
▪ When the coefficients are reordered in accordance with the zigzag
ordering pattern and the resulting 1-D coefficient sequence with EOB
(End-of-block condition)
Dr. Ajay Kumar Mallick,
NIT Hamirpur
JPEG Compression: Steps of Decompress
▪ To decompress a JPEG compressed subimage, the decoder must
first recreate the normalized transform coefficients that led to the
compressed bit stream.
Z(u,v)
▪ Denormalization:
Dr. Ajay Kumar Mallick,
NIT Hamirpur
T(u,v)
JPEG Compression
▪ Inverse DCT
Dr. Ajay Kumar Mallick,
NIT Hamirpur
JPEG Compression
▪ The level shifting each inverse transformed pixel by 27 (or +128) to
yield.
+128 =
Dr. Ajay Kumar Mallick,
NIT Hamirpur
JPEG Compression
Original subimage Block Reconstructed subimage Block
Difference subimage between original and
reconstructed
Dr. Ajay Kumar Mallick,
NIT Hamirpur
▪ The root-mean-squared error of the overall compression and
reconstruction process is approximately5.8 intensity levels.
JPEG Compression
▪ JPEG approximations of the monochrome image.
Dr. Ajay Kumar Mallick,
NIT Hamirpur