Title: Image Compression
1Image Compression
2Topics Covered
- Introduction
- Static Image Compression
- JPEG
3Introduction
4Introduction
- We all know what Image Compression is
File Format
Original Image
Reproduction
5Introduction Lossless Compression
- Compression often restricted, but reproduction is
identical to original
Original Image
Reproduction
6Introduction Lossy Compression
- Higher Compression, but some image information is
lost
gt
Original Image
Reproduction
7Introduction The Need for Standards
- Growth of communications networks (WWW, Mobile
Phones, etc) - Prevent the proliferation of different types of
file formats, keep everything manageable - Transmission of images of particular kinds
requires that some minimum level of service can
be expected.
8Static Image Compression
9Compression of Static Images.
- In any image there is redundant information.
- Compression seeks to remove the redundant
information so that only essential information
remains. - We use mathematical notions of what constitutes
information.
10Information
- Information Uncertainty (Claude Shannon, 1948)
Take 1 pixel
11Two Approaches to Compression
- Lossless most efficient encoding so as to
reduce redundancy in representation. - Lossy most efficient coding, and reducing
perceptual redundancy.
12Lossless Encoding - Huffman
- Huffman Encoding variable length encoding
system, to reduce redundancy in a data set. - Eg. Take an image with n greylevels.
- For the image calculate the probability of each
grey level
13Huffman Encoding
0
1
14Huffman Encoding
- The two grey-levels (symbols) with the smallest
probabilities are combined to make a new compound
symbol, whose probability is the summed
individual probabilities. - The symbols are then reordered in terms of their
probability, and the symbols with the two
smallest probabilities are combined until we
arrive at two symbols.
15Huffman Coding
- The easiest way of encoding two symbols is with 0
and 1. - The symbol with the highest probability therefore
obtains the code 0, and the other symbol is a 1. - We then decompose the compound symbol into its
two components, and add a 0 and 1 to its
components. - We continue to decompose until we end up with a
complete set of code symbols.
16Huffman Encoding
17Lossy Encoding Frequency Analysis
- Spatial Frequency transforms reorder the image
such that the intensity of the power at each
frequency, represents the number of pixels at
that frequency. - Most power in images is usually at the lower
frequencies.
18Low Pass Filtering
- Usually higher Frequencies have lower power.
- This correlates to large areas of redundant
information. - LP Filtering in the frequency domain is a good
compression strategy.
19What Transform?
- Several Means of transforming images into
Frequency domain - Fourier
- Wavelet
- Cosine
- Walsh, Hadamard, Hartley, etc.
20Problems with Transforms
- Often based on difficult numbers.
- Fourier Transform is rendered unsuitable, because
it relies on complex numbers less tractable in
compression algorithms. - Other techniques more suitable because they rely
on real numbers, usually converted to integers
for storage using rounding.
21Spatial Decorrelation
- Frequency transforms decorrelate the spatial
information, placing it in increasing order of
frequency. - Inverse transformation is required in order to
reconstruct the spatial image at the inverse
stage.
22Low Pass Filtering
- Attenuate (set to zero) all information above a
certain distance from the origin.
0.9,0.8,0.75,0.7,0.4, 0.1,0.12,0.115,0.115,0.1
Power
0.9,0.8,0.75,0.7,0.4, 0.1,0,0,0,0
w
23Low Pass Filtering
Original Image
FFT
LPF in Fourier Domain
IFFT
24Low Pass Filtering
Wavelet Transform
Original Image
Wavelet LPF
Restored Image
25The JPEG Compression Standard
- Highly configurable standard, used extensively
in - Graphic Arts
- Desktop Publishing
- Faxes
- Medical Images
- Etc.
26JPEG
- Supports both lossless, and lossy compression, of
any size and bit depth. - The technique is also parameterisable so users
can trade off degree of compression, against
quality. - Offers four modes of operation
- Sequential encoding in the order the image was
scanned. - Progressive mulitipass encoding so that a
coarse image is transmitted rapidly, followed by
repeated passes at higher resolutions - Lossless lossless compression
- Hierarchical, the image is encoded at multiple
resolutions.
27JPEG
- Basic lossy compression is based on the Direct
Cosine Transform (DCT). - Image is subdivided into 8x8 blocks, to which the
DCT is applied. - The coefficients are quantised according to a
quantisation table supplied as part of the
application. - The quantisation table becomes part of the
compressed stream.
28JPEG Quantisation
- DCT version of the 8x8 image is divided by a
quantisation table. - Where Iq is rounded.
- The quantisation table is itself an 8x8 matrix of
integers, where large values imply coarser
quantisation. - Normally the range of values in a quantisation
table are between 0 and 255
29JPEG
- Each image can have its own quantisation table,
which can be submitted as part of the format. - If using a bespoke quantisation table, ensure
that pixels with high degrees of variation obtain
finer quantisation, than those pixels with lower
quantisation.
30JPEG
- The transformed image is then stored as a series
of lists of coefficients, using zig-zag ordering.
This creates a 1D array of coefficient values,
so that the information rich parts of the
frequency spectrum are at the beginning, and the
zeros are at the end.
31JPEG
- An End of Block marker (EOB) identifies the point
at which all coefficients become zero. - This facilitates the the next step which is
statistical coding (typically Huffman encoding).
32JPEG
- High resolution colour images, JPEG can compress
to a ratio of 101 with results being more than
adequate in many cases. - JPEG forms the basis of the MPEG system for
encoding images, as will be discussed in due
course.