20
Mahmoud El-Sakka, 1999 Mahmoud El-Sakka, 1999

Mahmoud El-Sakka, 1999 - pami.uwaterloo.capami.uwaterloo.ca/mkamel/SD776/NOTES/Compression.pdf · 7 5 1 1 n 1 2 If data v alues are de-correlated, then the correla-tion matrix will

Embed Size (px)

Citation preview

Mahmoud El-Sakka, 1999

Adaptive Block-Based Image Compression:

Is it Worth it?

Mahmoud El-Sakka

Pattern Analysis and Machine Intelligence group

Systems Design department

University of Waterloo

Waterloo, Ontario, Canada

Summer 1999

Mahmoud El-Sakka, 1999

Outline

� Introduction

� Image Compression Techniques

� JPEG: The Current Still Image Compression Standard

� ABC-SC: A New Adaptive Compression Scheme

� Objectives

� Methodology

� Scheme Description

� Experimental results

� JPEG2000: The New Still Image Compression Standard

� Conclusions

#

Mahmoud El-Sakka, 1999

Introduction to Image Compression

� Image:

� Is a representation of the visual information of a

given object

� Can be:

� Single frame (Still image)

� Sequence of frames (Moving sequence)

#

Mahmoud El-Sakka, 1999Image Information

� Types:

� Redundant (e.g., background)

� Irrelevant (e.g., enormous details)

� Useful (e.g., edges)

The Lena image

#

Mahmoud El-Sakka, 1999

Introduction to Image Compression

� Compression is a process intended to yield a

compact representation of a given object

� Do we need image compression?

� Storage (Memory)

� Transmission (Communication channels)

#

Mahmoud El-Sakka, 1999

De�nitions

� MEANfXg = EXPECTEDfXg

= EfXg

= �x

� VARIANCEfXg = VARfXg

= Ef(X-�x)2g

= EfX2g - �2x

= �2

x

� STANDARD DEVIATIONfXg = �x

� COVARIANCEfX,Yg = COVfX,Yg

= Ef(X-�x) � (Y-�y)g

= EfX � Yg - �x � �y

= �x;y

� COVfX,Xg = �x;x

= �2

x

#

Mahmoud El-Sakka, 1999

De�nitions

� SIMPLE CORRELATION FACTOR= �x;y

=

COV fX;Y gpV ARfXg�V ARfY g

=

�x;y

�x��y

� Note that:

� �1 � �x;y � 1

� �x;x = 1

� �x;�x = �1

� �x;y 2 f1;�1g =) these two variables can be repre-

sented by only one variable.

� �x;y = 1 =) both values are exactly the same.

� �x;y = �1 =) both values are exactly the same but

just with opposite sign.

� �x;y = 0 =) both values are un-correlated.#

Mahmoud El-Sakka, 1999

De�nitions

COVARIANCE MATRIX = � =

26666666664�11 �12 � � � �1j � � � �1n

�21 �22 � � � �2j � � � �2n

...

...

. . .

...

...

�i1 �i2 � � � �ij � � � �in

...

...

...

. . .

...

�n1 �n2 � � � �nj � � � �nn3

7777777775

CORRELATION MATRIX = � =

26666666664�11 �12 � � � �1j � � � �1n

�21 �22 � � � �2j � � � �2n

...

...

. . .

...

...

�i1 �i2 � � � �ii � � � �in

...

...

...

. . .

...

�n1 �n2 � � � �nj � � � �nn3

7777777775

=

266666666641 �12 � � � �1j � � � �1n

�21 1 � � � �2j � � � �2n

...

...

. . .

...

...

�i1 �i2 � � � 1 � � � �in

...

...

...

. . .

...

�n1 �n2 � � � �nj � � � 1

37777777775

� If data values are de-correlated, then the correla-

tion matrix will equal unity.

� If data values are totally correlated (totally depen-

dent), then the correlation matrix elements will be

2 f�1; 1g and the whole vector can be represented

by a scaler value.

#

Mahmoud El-Sakka, 1999

� Example 1:

Y

X1 2 4 6

1

2

4

6

� data = f (1, 1), (2, 2), (4, 4), (6, 6) g

� � = (3:25; 3:25)

� � =2

4 3:6875 3:6875

3:6875 3:68753

5

� CORRELATION MATRIX =2

4 1 11 1

35

� These data are totally correlated, i.e., totally

dependent.

#

Mahmoud El-Sakka, 1999

Example 2

� The relationship between neighboring pixels (to the left)

0

32

64

96

128

160

192

224

0 32 64 96 128 160 192 224

Pre

viou

s P

ixel

Val

ue

Pixel Value

0

32

64

96

128

160

192

224

0 32 64 96 128 160 192 224

Pre

viou

s P

ixel

Val

ue

Pixel Value

#

Mahmoud El-Sakka, 1999

Example 2

� The relationship between neighboring pixels (to the left)

before noise

0

32

64

96

128

160

192

224

0 32 64 96 128 160 192 224

Pre

viou

s P

ixel

Val

ue

Pixel Value

Gaussian noise

� = 40

#

Mahmoud El-Sakka, 1999

How Can Compression Be Achieved?

� Correlation

redundant information reduction, lossless

� Prediction

� Transformation

� Quantization, lossy

resolution reduction

dimensionality reduction

� Modeling

approximation, lossy

� Omitting, or at least reducing, irrelevant details

approximation, lossy

� E�cient encoding

#

Mahmoud El-Sakka, 1999

Image Compression Techniques

� Can be classi�ed based on:

� Reversibility

� Reversible (lossless): exactly the same as the original image

� Irreversible (lossy): close to the original image

� Adaptivity

� Adaptive: adjusts itself according to the input

� Static: treats all the inputs similarly, regardless of their con-

tent

� The compression domain

� Spatial-domain (waveform techniques)

� Transform-domain (transform techniques)

� Feature-domain (model-based techniques)

� Basic compression element

� Pixel-based: (e.g., PCM, DPCM)

� Block-based: (e.g., DCT, KLT, BTC, VQ, Fractal)

� Image-based: (e.g., Wavelet, Multi-resolution Pyramids)

#

Mahmoud El-Sakka, 1999

Patent and Compression

� Patent: To secure the exclusive right/privilege

of inventors for a term of years to make,

use, or sell their inventions, i.e., a granted

monopoly

� Example 1: The LZW algorithm is patented by

Unisys

� GIF issue

� Example 2: The Q-coder implementation of the

arithmetic coding is patented by IBM

� JPEG issue

#

Mahmoud El-Sakka, 1999

The Current Still Image Compression Standard

Joint Photographic Experts Group (JPEG)

� Objectives:

� Capability to do:

� sequential encoding

� progressive encoding

� lossy encoding

� lossless encoding

� feasibility for hardware implementation at 64 Kbits/sec

� March, 1987: 12 proposals were registered

� June, 1987: The selection �eld was narrowed

to 3 approaches

� January 1988: The DCT-based and DPCM-

based approachs were selected

� 1992: JPEG became the ISO/CCITT still

image compression standard

Note that: Wavelet was not a part of the

JPEG, although it exists in the literature

decades ago

#

Mahmoud El-Sakka, 1999

JPEG

� Basic Idea

SourceImageData

ReconstructedImageData

Run-lengthDecoding IDCT

EntropyDecoding

Compressed

Image Data reorderingZigzag Dequantizer

Run-lengthEncoding

EntropyEncoding

Compressed

Image DataFDCT QuantizerOrdering

Zigzag

JPEG Encoder

8x8 blocks

JPEG Decoder

#

Mahmoud El-Sakka, 1999

The ABC-SC Compression Algorithm �

� An Adaptive Block Compression method based

on Segmentation and Classi�cation (ABC-SC)

� Objectives:

� Exceed the compression performance of the current

image compression standard

� Provide a state-of-the-art block-based compression

technique

� Give users the ability to trade o� between desired

compression and image quality

� Have modest computational complexity

� Be amenable to hardware implementation

� Mahmoud R. El-Sakka, \Adaptive Digital Image Compression

Based on Segmentation and Block Classi�cation", Ph.D. Disserta-

tion, Systems Design Engineering, University of Waterloo, Water-

loo, Ontario, Canada, 1997.

#

Mahmoud El-Sakka, 1999

Methodology

� Focus on the useful information

� Reduce the redundant information

� Inter-pixel (Transformation, Reordering, � � � etc)

� Encoding (Prediction, Variable-length Encoding, � � � etc)

� Omit, or at least reduce, the irrelevant information

� Psycho-visual (Image Understanding, Quantization, � � � etc)

#

Mahmoud El-Sakka, 1999

ABC-SC Block Diagram

decompressor

Side information

InformationSide

Smooth regions

decompressor

DecompressedSmooth Regions

DecompressedEdgeRegions

decompressor

Edge regions

decompressor

DecompressedTexturalRegions

Textural regions

Quad-tree reconstructor

Smooth regions

compressor

RegionsSmooth Edge

Regions

compressor

Edge regions

Regions

Quad-tree generator

SmoothRegions Regions

Regions

Blocking suppressor

compressor

Side information

InformationSide

Compressed Image

Dec

oder

Enc

oder

Input Image

Reconstructed Image

Image divider

Textural

Textural

Image reconstructor

compressor

Textural regions

Edge

Side

Information

#

Mahmoud El-Sakka, 1999

Quad-tree Representation

non-homo

homo

homo

non-homo

non-homo

homo

homohomo

homo

non-homo

homonon-homo

homo

homo

homo

homohomo

homo

non-homo

non-homo

non-homo

homoNon-leaf node,

Non-homogeneous leaf,

or Homogeneous leaf.

#

Mahmoud El-Sakka, 1999

A Segmentation Example

the original Lena image smooth segment image

textural segment image edge segment image

#

Mahmoud El-Sakka, 1999ADPCM Predictor

� Utilizes di�erent linear prediction rules, including

2nd and 3rd order two-dimensional prediction rules

� Applies only one rule per prediction

� The choice between these rules is based on the dif-

ferences between the neighboring encoded block av-

erages

C

A

being predictedBlock-average

B L1

L2 L3

#

Mahmoud El-Sakka, 1999

Performance Metrics

� Compression ratio (CR)

� From actual runs, not an entropy estimate

CR =image width� image height

actual compressed �le size

� Objective evaluation

� Root Mean Squared Error (RMSE)

RMSE =vuuut 1

MN

M�1Xx=0

N�1Xy=0

�^f(x; y)� f(x; y)�2

� Peak Signal-to-Noise-Ratio (PSNR)

PSNR = 10 log10

255

RMSE!2

dB

#

Mahmoud El-Sakka, 1999Experimental Results

� Results are presented for the Lena image

� We do compress other images:

for example, the Woman, Tulips, Bridge,

Man, Monarch, Boats, Rocks, Barbara, Zelda,

Peppers, Goldhill, and F16

� Results categories:

� ABC-SC vs JPEG/IJPEG

� ABC-SC vs other segmentation-based techniques

� ABC-SC vs SPIHT-A/SPIHT-B

� Three-class case

� Adaptive prediction e�ect

� Post-processing e�ect

� Execution time

#

Mahmoud El-Sakka, 1999

ABC-SC vs JPEG/IJPEG

ABC-SC, QF = 147 IJPEG, QF = 6

CR = 62:47, RMSE = 8:43 CR = 59:89, RMSE = 9:86JPEG IJPEG

0

4

8

12

16

20

24

28

32

0 50 100 150 200 250 300 350

R.M

.S. e

rror

Compression ratio

ABC-SC

JPEG, QF = 2 rate-distortion relation

CR = 62:22, RMSE = 20:42

#

Mahmoud El-Sakka, 1999ABC-SC vs IJPEG

ABC-SC, QF = 184 IJPEG, QF = 11

CR = 36:81, RMSE = 6:50 CR = 36:69, RMSE = 7:39

ABC-SC, QF = 89 IJPEG, QF = 1

CR = 177:01, RMSE = 12:66 CR = 176:05, RMSE = 32:27

#

Mahmoud El-Sakka, 1999

ABC-SC vs Other Segmentation-based

Techniques

[Vaisey’92][Lee’94][Ran’95]

[Chen’89][Nasiopoulos’91]

[Radha’96]

0

2

4

6

8

10

12

14

16

0 25 50 75 100 125

Compression ratio

R.M

.S. e

rror

IJPEG

JPEG

ABC-SC

#

Mahmoud El-Sakka, 1999

ABC-SC vs Other Segmentation-based

Techniques

[Chen'89 ] C. Chen, \Adaptive Transform Coding Via Quadtree-

Based Variable Blocksize DCT", IEEE International Conference

on Acoustics, Speech and Signal Processing (ICASSP'89), Vol. 3,

pp. 1854-1857, May 1989.

[Nasiopoulos'91 ] P. Nasiopoulos, R.Ward, and D. Morse, \Adap-

tive Compression Coding", IEEE Transactions on Communica-

tions, Vol. 39, No. 8, pp. 1245-1254, August, 1991.

[Vaisey'92 ] J. Vaisey and A. Gersho, \Image Compression with

Variable Block Size Segmentation", IEEE Transactions on Sig-

nal Processing, Vol. 40, No. 8, pp. 2040-2060, August 1992.

[Lee'94 ] M. Lee and G. Crebbin, \Classi�ed Vector Quantisation

With Variable Block-Size DCT models", IEE proceedings: Vi-

sion, Image and Signal Processing, Vol. 141, No. 1, pp. 39-48,

February 1994.

[Ran'95 ] X. Ran and N. Farvardin, \A Perceptually Motivated

Three-Component Image Model - Part II: Applications to

Image Compression", IEEE Transactions on Image Processing,

Vol. 4, No. 4, pp. 430-447, April 1995.

[Radha'96 ] H. Radha, M. Vetterli, and R. Leonardi, \Image

Compression Using Binary Space Partitioning Trees", IEEE

Transactions on Image Processing, Vol. 5, No. 12, pp. 1610-

1624, December 1996.

#

Mahmoud El-Sakka, 1999

ABC-SC vs SPIHT-A/SPIHT-B

ABC-SC, QF = 32 SPIHT-A

CR = 235:11, RMSE = 13:97 CR = 235:11, RMSE = 12:29

0

4

8

12

16

0 50 100 150 200 250 300 350

Compression ratio

SPIHT-B

SPIHT-A

R.M

.S. e

rror

2

6

10

14ABC-SC

SPIHT-B rate-distortion relation

CR = 235:11, RMSE = 12:95

#

Mahmoud El-Sakka, 1999

ABC-SC vs SPIHT-A/SPIHT-B

ABC-SC, QF = 1

CR = 374:49, RMSE = 16:34

SPIHT-A SPIHT-B

CR = 374:49, RMSE = 14:70 CR = 374:49, RMSE = 15:12

#

Mahmoud El-Sakka, 1999

Three-class Case

ABC-SC, QF = 200, TQR = 1:0 ABC-SC, QF = 200, TQR = 0:3

CR = 32:05, RMSE = 6:11 CR = 38:14, RMSE = 7:38

the absolute error the absolute error

in the above image in the above image

#

Mahmoud El-Sakka, 1999

Adaptive Prediction E�ect

block average predictionusing no

ABC-SC

block average prediction

ABC-SCusing JPEG

ABC-SC

block average predictionusing ADPCM

0

2

4

6

8

10

14

16

0 50 100 150 200 250 300 350

12

R.M

.S. e

rror

Compression ratio

#

Mahmoud El-Sakka, 1999

Execution Time

Average Average Average

Encoding compression decompression enhancement

scheme time time time

ABC-SC,

TQR = 1:0 0.919 0.846 0.414

ABC-SC,

TQR = 0:3 1.070 0.815 0.414

SPIHT-A 1.253 1.051

SPIHT-B 0.763 0.532

JPEG 0.109 0.084

IJPEG 0.122 0.081

� Execution time in seconds,

based on runs on a SUN Ultra 1 computer

#

Mahmoud El-Sakka, 1999

Summary of ABC-SC Results

� Experimental results have demonstrated the

following characteristics of the ABC-SC tech-

nique:

� Excellent reconstructed image quality (visual)

� Excellent reconstructed rate-distortion performance

� Outperforms and surpasses JPEG/IJPEG

� Moves block-based compression beyond the limits

of JPEG/IJPEG

� Comparable to the wavelet-based compression tech-

niques (SPIHT-A/SPIHT-B)

� A good alternative to the wavelet-based compres-

sion techniques, especially when adaptability to im-

age content is of interest

� Fast execution time

� Potential for even faster execution time

#

Mahmoud El-Sakka, 1999

JPEG2000

The New Still Image Compression Standard

� Objective: To improve in areas where cur-

rent standard fails to produce the best qual-

ity, including:

� low bit-rate compression

� compound documents compression

� �xed-rate (�xed-size) compression

� protective image security

� March, 1997: A call for contributions is

issued (24 algorithms has been submitted)

� November, 1997: TheWavelet Trellis Coded

Quantization (WTCQ) approach has been

selected

� 200x: JPEG2000 is expected to become the

new ISO/CCITT still image compression stan-

dard

#

Mahmoud El-Sakka, 1999

JPEG2000

� Basic Idea

Compressed

Image Data

ReconstructedImageData

QuantizerInverse Inverse

ScannerEntropy

Decoding

JPEG2000 Decoder

InverseDWT

Compressed

Image Data

SourceImageData

EntropyEncodingDWT Scanner

Classifier

SequencesQuantizer

TCQ

Indices

JPEG2000 Encoder

RateAllocator

... ......

to 8x8 blocks

HL(1)

Map 2 appliedto 8x8 blocks

HH(1)

Map 3 applied

to 8x8 blocks

LH(1)

Map 1 appliedMap 2appliedto 4x4blocks

Map 3appliedto 4x4blocks

Map 1appliedto 4x4blocks

* Calculate variance of 8x8 blocks in level 1* K-means cluster the variances* Label each 8x8 block as belonging to one K classes* Propagate labels up through tree* Include entropy encoded class maps in code stream header

#

Mahmoud El-Sakka, 1999

Conclusions

� Image compression standards are outlined

� A new adaptive block-based compression

scheme (ABC-SC) is introduced

� This new compression scheme outperforms

and surpasses the current image compres-

sion standard

� Its performance is comparable to the per-

formance of the wavelet compression tech-

niques

#

Mahmoud El-Sakka, 1999

Adaptive Block-Based Image Compression

Is it Worth it?

#