Professional Documents
Culture Documents
Img - Compression - FT
Img - Compression - FT
1
Outline
□ Fundamentals
□ Some basic compression methods
2
Image compression
▪ Image compression is minimizing the size in
bytes of a graphics file without degrading the
quality of the image to an unacceptable level.
3
Image compression..
REDUNDANT
DATA
INFORMATION
6
□ Coding redundancy is due to inefficiencies in
data representations.
□ Spatial and temporal redundancy
■ remove unnecessarily replicated
information in the representations of the
pixels
□ Irrelevant information
■ Remove information ignored by the
human visual system.
7
Coding redundancy
□ The gray level of an image, rk occur with
probability pr (rk).
□ The average of number bits required to
represent each pixel
□ Where
■ L= number of gray levels.
■ l( rk ) = number of bits used to represent
each value of rk.
8
Image
Compression
□Variable length coding -assign fewer bits to the more
probable gray level than less probable ones achieve data
compression
9
Interpixel redundancy
12
Image compression models
□ Source encoder
■ Reduce or eliminate any coding, inter-pixel or
psychovisual redundancies in the input image
□ The corresponding source encoder-
■ mapper,
■ quantizer and
■ symbol encoder
□ Mapper
■ transforms the input data into a format designed
to reduce inter-pixel redundancies
■ Reversible process
13
Image compression models….
□ Quantizer
■ Reduce psycho-visual redundancy
■ Irreversible operation.
□ The symbol encoder
■ Creates a fixed or variable-length to represent
quantizer output and maps the output in
accordance with the code
■ A variable length code is used to represent the
mapped and quantized data set
□ Source decoder contains only two components: a
symbol decoder and inverse mapper because of
irreversible operation of quantizer
14
Image
Compression
15
Lossless compression
□ Provides limited compression capabilities - information
theory provides a mathematical framework for (and
good measures of) the levels of compression that can
be achieved
16
Huffman coding
□ Provides a data representation with the smallest
possible number of code symbols per source symbol.
□ Source reductions
■ Create a series of source reductions by ordering
the probabilities of the symbols and then
■ combine the symbols of lowest probability to form
new symbols recursively.
■ This step is sometimes referred to as “building a
Huffman tree” and can be done statistically
□ Code assignment
□ When only two symbols remain, retrace the steps in
(1) and assign a code bit to the symbols in each step
17
Image
Compression
18
Arithmetic coding
19
Image
Compression
20
Run-length coding
21
Predictive coding
□ Provides a data representation where code words
express source symbol deviations from predicted
values (usually values of neighboring pixels)
□ Predictive coding efficiently reduces interpixel
redundancies
• 1D & 2D – pixels are predicted from neighboring
pixels
• 3D – pixels are predicted between frames as well
□ Input data
222222222226666666666666699999999999999999
□ Code
200000000004000000000000030000000000000000
22
Lossy compression
□ Provides higher compression capabilities - is
usually specified in terms of application
23
Transform coding
□ In transform coding a linear transform is used to
map the image data into a set of transform
coefficients.
□ The image is subdivided into smaller subimages
before the transformation computation to reduce
computational complexity
□ The goal of the transformation process is to
minimize the variance of the pixels of the
subimages as much as possible
□ Transformation coding can be
• Adaptive – each subimage is treated in an
individual manner
• Non-adaptive – all subimages are treated in the
same way
24
Transform coding
25
JPEG
26
JPEG Encoding Process outlined
1. Color Space Transformation
2. Downsampling
3. Discrete Cosine Transform
4. Quantization
5. Entropy Coding
27
Color Space Transformation
□ Color space is transformed
□ from RGB to YCbCr
28
Downsampling
□ Cb and Cr components are
downsampled
□ Possible ratios in JPEG:
■ 4:4:4
■ 4:2:2
■ 4:2:0 (most common, reduce by factor 2
in both directions)
29
Discrete Cosine Transform
□ Transformation to
frequency domain is
done in 8×8 blocks
(matrices)
□ All values in the matrix
are first shifted down
(subtracted) by 128
30
DCT
□ DCT is applied
□ values are rounded to
integers
□ 2-D DCT transforms
the image into linear
combination of these
patterns
31
Quantization
□ Values in the transformed
matrix are divided by
corresponding values in
Quantization matrix.
□ Round (-415/16)
= Round(-25.93)
= -26
32
Entropy Coding
▪ The matrix is sequenced using zig-
zag scanning, that groups similar
frequencies together
▪ The sequence is compressed using
lossless RLE and the coded with
Huffman or Arithmetic coding.
33
Decoding Process
□ Basically the encoding done backwards
□ Reconstruct the Huffman/RLE stream to a
sequence
□ Arrange the sequence to a matrix using the
zigzag scanning backwards
□ Multiply the matrix by quantization table
□ Perform inverse DCT
□ Shift the values by +128
□ Transform back to RGB color space
34
Thank You
35