Professional Documents
Culture Documents
Dip Mod 6 - Cec Notes - Ktustudents - in
Dip Mod 6 - Cec Notes - Ktustudents - in
Image Compression
Arithmetic coding
Compression
KTUStudents.in
standards
Anjana Devi
AP in ECE
For more study materials: WWW.KTUSTUDENTS.IN
CE, Cherthala 1
Arithmetic Coding
KTUStudents.in
KTUStudents.in
current pixel value in the probability distribution
KTUStudents.in
KTUStudents.in
KTUStudents.in
do this separately prior to taking the forward
transform
• Eg: required for DCT, but not for wavelet transform
• Disadv of block processing
– Introduction of block artifacts
• discontinuities in the adjacent regions resulting
from rectangular windowing
KTUStudents.in
The newer JPEG2000 algorithms uses the wavelet
•
• 1. Decorrelation-
– Transform should generate less correlated or
uncorrelated coefficients to achieve high
KTUStudents.in
compression ratio
• 2. Linearity
– Allows one to one mapping between pixel values
and transform coefficients
• 3. Orthogonality
– To eliminate redundancy in the transformed
image
KTUStudents.in
number of bits needed to represent it.
• This method is effective because the
frequency/sequency transform of images is very efficient
at putting most of the information into relatively few
coefficients, so many of the high frequency coefficients
can be quantized to 0 (eliminated completely)
• Irreversible process
KTUStudents.in
since the transform data is typically floating point
and thus 4 or 8 bytes per pixel (compared to the
original pixel data at 1 byte per pixel), so
quantization and coding is applied to the reduced
data after the transformation phase.
•
KTUStudents.in
mostly the relation is logarithmic.
Typically non uniform quantisation is used for image
compression
• More bits are used for lower frequency components
where the energy is concentrated for most images,
resulting in a variable bit rate or nonuniform
quantization and better resolution
KTUStudents.in
•
KTUStudents.in
These two vary in the method they use for
selecting the transform coefficients to be retained
before quantization and encoding stages.
• selects the coefficients based on
– Max Variance
– A threshold
KTUStudents.in
and desired compression ratio, which streamlines
the compression process
•
KTUStudents.in
Otherwise the coeff will be retained
A different threshold mask is required for each
block
• Therefore adaptive method
• Increases file size as well as algorithmic
complexity
A block size of 64x64 was used, a circular zonal mask, and DC coefficients were not qua
KTUStudents.in
a) Original image, a view of c) Error image comparing the
St. Louis, Missouri, from original and (b), histogram
the Gateway Arch stretched to show detail
KTUStudents.in
d) Results from using the DCT with e) Error image comparing the original and
a compression ratio = 14.94 (d), histogram stretched to show detail,
KTUStudents.in
change relatively slowly across images, i.e., it is unusual for
intensity values to alter up and down several times in a
small area, for example, within an 8 x 8 image block.
A translation of this fact into the spatial frequency domain,
implies, generally, lower spatial frequency components
contain more information than the high frequency
components which often correspond to less useful details
and noises.
Observation 2: Experiments suggest that humans are more
immune to loss of higher spatial frequency components
than loss of lower frequency components.
KTUStudents.in
Coding redundancy
Tables Zig Zag
Scan Differential Pulse Code
Modulation(DPCM) on
Header
the DC component and
Tables
Run length Coding of
DPCM the AC components
Data Entropy Entropy coding (Huffman)
Coding of the final output
RLC
KTUStudents.in
each of the numbers ->(4,4,3,1 ). : Through this
transformation we lost the spatial information but captured
the frequency information.
There are other transformations which retain the spatial
information. E.g., Fourier transform, DCT etc. Therefore
allowing us to move back and forth between spatial and
frequency domains.
DFT
DCTDCT FFT
KTUStudents.in
100 -52 0 -5 0 -2 0 0.4 36 10 10 6 6 4 4 4
Inverse DCT Inverse FFT
8 15 24 32 40 48 57 63 24 12 20 32 40 51 59 48
Example Description:
f(n) is given from n = 0 to 7; (N=8)
Using DCT(FFT) we compute F(ω) for ω = 0 to 7
We truncate and use Inverse Transform to compute f’(n)
For more study materials: WWW.KTUSTUDENTS.IN 35
2-D DCT
Images are two-dimensional; How do you perform 2-D
DCT?
Two series of 1-D transforms result in a 2-D transform as
demonstrated in the figure below
f (i,j )
KTUStudents.in
1-D 1-D
Row- Column-
wise wise
F (u,v)
KTUStudents.in
Custom quantization tables can be put in image/scan
header.
JPEG Standard defines two default quantization tables, one
each for luminance and chrominance.
KTUStudents.in
DCT coefficient matrix after transform coding is divided by the
quantization matrix and then rounded to the nearest integer
High freq components become zero after this process
Eliminates psycho visual redundancy and irrelevancy
Makes it easier for the next stage of entropy coding
KTUStudents.in
Maps 8 x 8 matrix to a 1 x 64 vector
8x8
...
For more study materials: WWW.KTUSTUDENTS.IN
1x64
40
DPCM on DC Components
The DC component value in each 8x8 block is large and
varies across blocks, but is often close to that in the
previous block.
Differential Pulse Code Modulation (DPCM): Encode the
difference between the current and previous 8x8 block.
KTUStudents.in
Remember, smaller number -> fewer bits
45 45
1x64 1x64
54 9
1x64 1x64
48 -6
1x64 1x64
. .
. .
. .
32 12
1x64 1x64
36 4
41
1x64 1x64
For more study materials: WWW.KTUSTUDENTS.IN
Entropy Coding: AC Components
AC components are coded using Run length and Huffman coding
KTUStudents.in
KTUStudents.in
example of such a mode, also referred to as the
Baseline Sequential Mode.
Default JPEG mode
It supports only 8-bit images
KTUStudents.in
quantization(the source of the loss).
Used in medical image compression
Here is the simple block diagram of the technique:
Predictive
Difference
Huffman
Lossless
EnCoder
Coding
KTUStudents.in
AC coefficients first, then gradually some more ACs.
Spectral
Selection:
First Scan:
Second
Scan:
Third Scan:
.
.
Nth Scan:
Image Pixels
KTUStudents.in
User has a choice whether to continue receiving the image
data after the first scan
3 algorithms exist in progressive mode.
a) Progressive spectral selection
b) Progressive successive approximation
c) combined progressive algorithm
MSB
KTUStudents.in
7 6 5 4 3 2 1 0 LSB
Pixels ordered (zig-zag-wise)
Second ...
Scan:
Third Scan: ...
. .
. .
5th Scan: ...
KTUStudents.in
the next higher resolution pyramid level
Used primarily to support multiple resolutions of the
same image which can be chosen from depending on
the target’s capabilities.
In applications in which a very high resolution image
must be accessed by a lower resolution display
• EXAMPLE 10.3.7:
KTUStudents.in
A typical 8-bit image has a range of gray levels of 0
to 255. Level shifting this range to be centered at
zero involves subtracting 128 from each pixel value,
so the resulting range is from -128 to 127
KTUStudents.in
• For color signals JPEG transforms the RGB
components into the YCrCb color space, and
subsamples the two color difference signals (Cr and
Cb), since we perceive more detail in the luminance
(brightness) than in the color information
KTUStudents.in
KTUStudents.in
KTUStudents.in
•
KTUStudents.in
The committee that developed the standard had
certain goals for JPEG2000
KTUStudents.in
quality images
•
KTUStudents.in
The JPEG2000 compression method begins by
level shifting the data to center it at zero, followed
by an optional transform to decorrelate the data,
such as a color transform for color images
KTUStudents.in
coded on a bitplane basis