Digital Image Processing IMAGE DATA COMPRESSION – PART2 Hamid R. Rabiee Fall 2015
Digital Image Processing
IMAGE DATA COMPRESSION – PART2
Hamid R. Rabiee
Fall 2015
Predictive Techniques
Previous methods doesn’t consider correlation between
pixels. However, in real word images we always expect
some kind of correlation in images.
The philosophy underlying predictive techniques is to
remove mutual redundancy between successive pixels
and encode only the new information
2
DPCM (differential PCM)
For each pixel 𝒖 𝒏 a quantity 𝒖.(𝒏) an estimate of 𝒖.(𝒏)(decoded sample), is predicted from the previously
decoded samples
Now it is sufficient to code the prediction error:
If 𝒆.(𝒏) is the quantized value of 𝒆(𝒏) then:
3
DPCM CODEC scheme 4
Feedforward Prediction
In DPCM the prediction is based on the output rather than the input,
so that the quantizer error at a given step is fed back to the
quantizer input at the next step.
If the prediction rule is based on the past inputs the signal
reconstruction error would depend on all the past and present
quantization errors in the feedforward prediction-error sequence.
5
Feedback Versus Feedforward
Prediction Example6
Delta Modulation
The simplest of the predictive coders uses a one-step delay function as a
predictor and a 1-bit quantizer, giving a 1-bit representation of the signal:
7
Other DPCM Variants 8
Line-by-Line DPCM:
In this method each scan line of the image is coded
independently by the DPCM technique.
Two-Dimensional DPCM:
Adaptive Techniques for DPCM
To improve DPCM performance we can adapt the
quantizer or predictor to variations in the local statistics
of the image data such as:
Adaptive gain control
Adaptive classification
9
Adaptive gain control 10
A simple adaptive quantizer updates the variance of the prediction
error at each step and adjusts the spacing of the quantizer levels
accordingly.
This can be done by normalizing the prediction error by its updated
standard deviation and designing the quantizer levels for unit
variance inputs
Adaptive classification
These schemes segment the image into different regions according
to spatial detail, or activity, and different quantizer characteristics
are used for each activity class (e. g. the variance of the pixels in
the neighborhood of the pixel).
11
Transform coding of images 12
1. Divide the given image (𝑴×𝑵) into small rectangular blocks of size 𝒑 × 𝒒and transform each block to obtain 𝑽𝒊, 𝒊 = 𝟏,… , 𝑰 − 𝟏, 𝑰 = 𝑴𝑵/𝒑𝒒.
2. Calculate the transform coefficient variances 𝝈𝒌,𝒍𝟐 and allocate bits based
on:
3. Design the quantizers:
The dc coefficient distribution is modeled by the Rayleigh density.
For the remaining tranform coefficients, Laplacian or Gaussian densities are used to design
their quantizers.
4. Code the output into code words and transmit or store.
5. Assuming a noiseless channel, reproduce the coefficients at the decoder
as:
Transform Coding Example 13
Transform Coding Performance 14
Zonal Versus Threshold Coding
We define a zonal mask as the array:
15
Hybrid coding and vector DPCM 16
Case Study: JPEG basline
1. The first step is to level shift each input image pixel by subtracting integer
128 from it to create a two’s complement image representation.
2. Next, non-overlapping pixel blocks are extracted from the YCbCr
components of the color image.
3. Each block then undergoes a 𝟖 × 𝟖 discrete cosine transform.
4. The transform coefficients are quantized by division by 𝟖 × 𝟖 quantization
array.
5. The next step in the encoder is symbol coding of the quantized coefficients
6. This step is followed by Huffman entropy coding of the coefficient symbols
to create the compressed image.
17
JPEG system scheme
1. The first step is to level shift each input image pixel by subtracting integer
128 from it to create a two’s complement image representation.
2. Next, non-overlapping pixel blocks are extracted from the YCbCr
components of the color image.
3. Each block then undergoes a 𝟖 × 𝟖 discrete cosine transform.
4. The transform coefficients are quantized by division by 𝟖 × 𝟖 quantization
array.
5. The next step in the encoder is symbol coding of the quantized coefficients
6. This step is followed by Huffman entropy coding of the coefficient symbols
to create the compressed image.
18
JPEG baseline default quantization arrays 19
JPEG baseline default chrominance quantization arrayJPEG baseline default luminance quantization array
JPEG DC coefficient encoding 20
The symbol coding process for DC coefficients begins with the
generation of the difference of the DC coefficient of the present
block from the DC coefficient of the corresponding previously
processed block of the same video type
There are 12 difference categories, denoted by the four bit index
SSSS in the JPEG baseline standard.
The DC difference can be coded by a category index Huffman
code appended by an additional bits code.
21
JPEG baseline
difference categories
for DC coding
22
Luminance and chrominanceDC difference Huffman codes
JPEG AC coefficient encoding 23
The symbol coding process for AC coefficients begins with the
formation of a one dimensional array of the 63 AC coefficients by
zigzag scanning of a block of DCT coefficients.
The non-zero coefficients are run length coded to produce a code
pair RRRR/SSSS
RRRR denotes the run length of zeros before the next non-zero coefficients
SSSS is the size of the next non-zero coefficient
24
JPEG baseline categories
for AC coding
JPEG2000 baseline image coding 25
1. The JPEG2000 standard specifies low pass and high pass analysis and
synthesis finite impulse response (FIR) filters. They are the so called
Daubechies (9,7) 9-tap and 7-tap FIR biorthogonal spline filters.
2. The JPEG 2000 standard specifies uniform scalar quantization of subbandcoefficients with a step size of ∆𝒃 and a zero-level step dead-zone
width of 𝟐∆𝒃 .The quantization operation is governed by
3. Then the quantized coefficients are converted to sign-magnitude format for
entropy encoding (which is out of our scope).
and s.t.
JPEG2000 Discrete Wavelet Filters 26
JPEG
200
0 v
s. JPEG
27
End of Lecture 16 – part2
Thank You!
images and materials are taken from Jain and Pratt book.