Académique Documents
Professionnel Documents
Culture Documents
x =149
e = x x =
1
Lossy compression
Lossless compression usually gives a maximum
compression of 3:1 (for monochrome images)
Lossy compression can give compression up to 100:1
(for recognizable monochrome images) 50:1 for virtually
indistinguishable images
The popular JPEG (Joint Photographic Experts Group)
format uses lossy transform-based compression.
22
Delta Modulation
23
TRANSFORM CODING
A linear, reversible transform (such as the Fourier
transform) is used to map the image into a set of
transform co-efficients, which are then quantized and
coded.
For most natural images, a significant number of (high
frequency) coefficients have small magnitudes and can be
coarsely quantized with little image distortion
Other than the DFT, we have the Discrete Cosine
Transform (used in JPEG) and the Walsh Hadamard
Transform
Energy Compaction
Efficacy of a transformation scheme can be
directly gauged by its ability to pack input
data into as few coefficients as possible.
This allows the quantizer to discard
coefficients with relatively small amplitudes
without introducing visual distortion in the
reconstructed image.
DCT exhibits excellent energy compaction for
highly correlated images.
Image resolution
Image and pixel aspect ratio
Color system
Image compexity
chroma subsampling
JPEG:
Joint Photographic Experts Group
Step 1: block preparation,
Step 2: DCT (Discrete Cosine Transform)
transformation
Step 3: quantization,
Entropy Coding
Step 4: further compression via differential
compression,
Step 5: zig-zag scanning and run-length
coding compression,
Step 6: Huffman coding compression
9/1/16
42
9/1/16
43
9/1/16
44
30 40 50 60
40 50 60 70
50 60 70 80
60 70 80 90
T-matrix
60 720 -182 0 -19 0
70 -182 0
0
80 0
0
0
90 -19
0 0
100 0
0
0
0
0
0
0
0
0
0 0
30 40 50 60 70 -182 0
0 0 0
40 50 60 70 80 0
0
0 0 0
50 60 70 80 90 -19
0 0 0 0
60 70 80 90 100 0
0 0 0 0
Step 3: Quantization
Quantization: Provides a way of
ignoring small differences in an
image that may not be perceptible.
Step 3: Quantization
52
Quantization
Quantization in JPEG aims at
reducing the total number of bits in
the compressed image
Divide each entry in the frequency
space block by an integer, then round
Use a quantization matrix Q(u, v)
Quantization
Use larger entries in Q for the higher
spatial frequencies
These are entries to the lower right part
of the matrix
The following slide shows the default
Q(u, v) values for luminance and
chrominance
Based on psychophysical studies intended to
maximize compression ratios while
minimizing perceptual distortion
Since after division the entries are smaller,
we can use fewer bits to encode them
Quantization
Quantization
Can we recover by multiplying the
elements with 10?
If the loss is minimal, the vision
system may not notice.
Dividing T-elements by the same
number is not practical, may result in
too much loss.
Retain the effects of lower spatial
frequencies as much as possible
less subtle features noticed if
Quantization
Upper left elements to be divided
with smaller values
Lower right elements higher spatial
frequencies, finer details - to be
divided with larger values
Quantization
Multiple quantization matrices can be
used (perhaps by scaling the
defaults), allowing the user to choose
how much compression to use
Trades off quality vs. compression ratio
More compression means larger entries
in Q
Compression ratios
9/1/16
63
Coding of DC Coefficients
Now we handle the DC coefficients
1 DC per block
DC coefficients may vary greatly over
the whole image, but slowly from one
block to its neighbor (once again, zigzag
order)
So apply Differential Pulse Code
Modulation (DPCM) for the DC
coefficients
If the first five DC coefficients are 150,
155, 149, 152, 144, we come up with
DPCM code- 150, 5, -6, 3, -8
9/1/16
65
Run-Length Coding
We now do run-length coding
The AC and DC components are treated
differently
Since after quantization we have many 0
AC components, RLC is a good idea
Note that most of the zero components
are towards the lower right corner (high
spatial frequencies)
To take advantage of this, use zigzag
scanning to create a 64-vector
Run-Length Coding
Now the RLC step replaces values in a 64vector (previously an 8x8 block) by a pair
(RUNLENGTH, VALUE), where RUNLENGTH
is the number of zeroes in the run and
VALUE is the next non-zero value
From the first example we have (32, 6, -1, -1,
0, -1, 0, 0, 0, -1, 0, 0, 1, 0, 0, , 0)
This becomes (0,6) (0,-1) (0,-1)(1,-1)(3,-1)(2,1)
(0,0) - Note that DC coefficient is ignored
Run-Length Coding
9/1/16
70
JPEG compression
DCT(x128)
Zig-Zag Scan
JPEG
file
Entropy Coding
Quantizatio
n