Top Banner
Digital Image Processing IMAGE DATA COMPRESSION – PART2 Hamid R. Rabiee Fall 2015
28

Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

May 25, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

Digital Image Processing

IMAGE DATA COMPRESSION – PART2

Hamid R. Rabiee

Fall 2015

Page 2: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

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

Page 3: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

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

Page 4: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

DPCM CODEC scheme 4

Page 5: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

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

Page 6: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

Feedback Versus Feedforward

Prediction Example6

Page 7: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

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

Page 8: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

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:

Page 9: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

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

Page 10: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

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

Page 11: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

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

Page 12: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

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:

Page 13: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

Transform Coding Example 13

Page 14: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

Transform Coding Performance 14

Page 15: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

Zonal Versus Threshold Coding

We define a zonal mask as the array:

15

Page 16: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

Hybrid coding and vector DPCM 16

Page 17: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

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

Page 18: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

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

Page 19: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

JPEG baseline default quantization arrays 19

JPEG baseline default chrominance quantization arrayJPEG baseline default luminance quantization array

Page 20: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

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.

Page 21: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

21

JPEG baseline

difference categories

for DC coding

Page 22: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

22

Luminance and chrominanceDC difference Huffman codes

Page 23: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

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

Page 24: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

24

JPEG baseline categories

for AC coding

Page 25: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

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.

Page 26: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

JPEG2000 Discrete Wavelet Filters 26

Page 27: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

JPEG

200

0 v

s. JPEG

27

Page 28: Digital Image Processing - Sharif University of …ce.sharif.edu/.../Lecture16-Image.Data.Compression-Part2.pdfDigital Image Processing IMAGE DATA COMPRESSION –PART2 Hamid R. Rabiee

End of Lecture 16 – part2

Thank You!

images and materials are taken from Jain and Pratt book.