Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information “Your...

38

Transcript of Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information “Your...

Page 1: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.
Page 2: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Chapter 17 Image Compression

17.1 Introduction 17.1.1 Redundant and irrelevant information

“Your wife, Helen, will meet you at Logan Airport in Boston at 5 minutes past 6:00 P.M. tomorrow night.”

Lossless: “Your wife will meet you at Logan Airport at 5 minutes past 6:00 P.M. tomorrow night.”

Lossy: “Helen will meet you at Logan at 6:00 P.M. tomorrow night.”

Page 3: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Coding Redundancy

The average bits per symbol is 2.7 for Code 2

Page 4: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Interpixel Redundancy

Page 5: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Psychovisual Redundancy

Page 6: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Chapter 17 Image compression

Data compression techniques exploit inherent redundancy an irrelevancy of information by transforming a data file into a smaller file from which the original image file can later be reconstructed, exactly or approximately.

Compression ratio: the ratio of the two file sizes before and after compression.

Page 7: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Chapter 17 Image compression

Lossless compression: eliminating only redundant information, the original image can be recovered exactly by decompressionLossy compression: eliminating irrelevant information as well. Only an approximate reconstruction of the original image can be achieved. Higher compression ratio.In practice, compression ratio and compression algorithm must be considered to make a proper choice.

Page 8: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

17.2 Lossless compression techniques

Dictionary-based techniques (fixed-length codes) and statistical methods (variable-length codes)Dictionary-based techniques Run-Length Encoding (RLE) In an image, a consecutive set of pixels having the same

gray-level value is called a run. One can store a code specifying that value, followed by the length of the run, rather than simply storing the same value many times.

RLE achieves considerable compaction with images of objects residing upon a constant background.

In the worst case, RLE can double the size of the file.

Page 9: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

An example of RLE

Page 10: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Dictionary-based techniques

LZW encoding First proposed by Lemple and Ziv, and extended by Welch. Encoding by building up a table of strings and their

corresponding codes For example, a file of 8-bit bytes can be encoded into 12-bit

codes. A string of first emerging is stored in full, along with the

code that is assigned to it. When that string occurs again, only its code is stored.

The string table is dynamic and need not be stored with the compressed file.

Page 11: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

17.2.2 Statistical encoding methods

The information content of a message A memoryless source of message that use an

alphabet , and each symbol with the probability of occurrence .

A measure of the information of the symbol is defined as

.1,,1,0 },{ Kkak

)( kaP

ka

)](log[)( kk aPaI

Page 12: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Statistical encoding methods

The entropy of the message is defined by

The entropy specifies the average symbol information content of the message.

When the base for the logarithm is 2, the unit of entropy is bits per symbol.

The average word length is the length (in bits, for binary coding) of the code word used to represent the symbol .

1

0

)](log[)()}({K

kkkk aPaPaIEH

)( kw aL

ka

Page 13: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Statistical encoding methods

The redundancy remaining in a message after encoding is defined by

If R=0, I.e,

all redundancy is removed. This formula represents a lower bound on average word length.

HaLER kw )}({

)](log[)( kkw aPaL

Page 14: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Statistical encoding methods

Huffman coding A lossless statistical coding method that always

finds a variable-length code with minimum redundancy.

Using a binary encoding tree for representing commonly occurring values in few bits and less common values in more bits.

Page 15: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Chapter 17 Image compression

Static Huffman coding and dynamic Huffman coding.

Binary Image compression standard Two standards for facsimile transmission by

Consultative Committee of the International Telephone and Telegraph (CCITT, now ITU).

Group 3 standard is based on horizontal RLE using a Huffman code to specify the run lengths.

Group 4 Typical compression ratio about 15:1.

Page 16: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

17.3 Lossy Image Coding

Scalar quantization Quantize the image to a smaller number of gray

levels.

Input

Output

Page 17: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Chapter 17 Lossy Image coding

Rate Distortion Theory Rate distortion function relates the distortion

(reconstruction error) of a fixed-word-length coding scheme to the data rate (e.g. number of bits per pixel).

The distortion is defined as the mean square error between the reconstructed and the original images

})],(),({[ 2yxgyxfED

Page 18: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Lossy image coding

The rate distortion function is the lower bound of the bit rate required for a coding scheme when given a maximum allowable amount of distortion .

The rate distortion function

)( DR

D

D

R(D)

Page 19: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Lossy image coding

The entropy of the reconstruction error is bounded by

Equality holds if the difference image has statistically independent pixels and a Gaussian pdf.

The best encoding scheme will produce an error image that contains only white, Gaussian nosie.

One can subjectively evaluate an image coder by examining the difference image.

)2log(2

1)],(),((

DeyxgyxfH

Page 20: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Lossy image coding

Uncorrelated Gaussian images If the image has statistically independent pixels and a

Gaussian pdf with variance , the rate distortion function is

Define the Signal-to-Noise ratio of (in dB) the coding scheme as

The relation between SNR and R(D) is a straight line with slop 6, this means that each additional bit of code word length adds 6 dB to the SNR.

2

0,logmax

2

1)(

2

2 DDR

DSNR

2

10log10

Page 21: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Lossy Image coding

Correlated Gaussian Images When pixels in an image is correlated,

distortion and bit rate can be written as functions of a common parameters

dudvvuPD f )],(,min[

4

1)(

2

dudv

vuPR f

),(log,0max

8

1)(

2

Page 22: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Lossy Image coding

For example, If the image has a Gaussian pdf and an exponential decaying autocorrelation function, then its rate distortion-SNR curve falls about 2.3 bits below that of the uncorrelated case. This implies that more compression can be achieved for correlated image with a given distortion .

Correlated Gaussian

Uncorrelated Gaussian

SNR(dB)

Date rate

(bits per pixel) 2.3 bit

1

2

10 40

Page 23: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

17.4 Transform Image Coding

Introduction Transform the images using a discrete image

transform, discard those coefficients that are near zero, and coarsely quantize those that are small. The images are stored and transmitted by the remaining significant transform coefficients. This approach is called transform image coding.

Page 24: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

17.4 Transform image coding

Block encoding The image is divided into blocks of typically 8-

by-8 or 16-by-16 pixels, and each of these is transformed separately.

Blocking artifact that causes noticeable changes on edges of the blocks may arisen.

Bit allocation. Rate distortion function could be used to decide how many bits will be used to code each of the transform coefficients

0,logmax

2

12

,2, D

r jiji

Page 25: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

An example image

Page 26: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Block artifact

Page 27: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

17.4 Transform image coding

Image Quality considerations. There is a trade-off between the compression ratio and the image quality. Human eye or mean square error are used as subjective and objective criteria.

Transform selection The nature of transforms The properties of images. Computational efficiency

Page 28: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

Image compression by DCT

Page 29: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.
Page 30: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.
Page 31: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

17.4 Transform image coding

Image coding with eigenvector-based transforms SVD transform.

The SVD transform is capable of the most data compression. Its basis functions are image-dependent

Computational load is severe. No fast algorithm, eigenvectors must be computed.

This technique finds little use in practice.

Page 32: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

17.4 Transform image coding

K-L transform K-L transform is capable of considerable data

compression. A group of images that have similar statistics

can be encoded by the same kernel matrix. Computation is also time consuming.

Page 33: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

17.4 Transform Image coding

Markov processes. A stationary random sequence is called a first-

order Markov sequence if the conditional probability of each element in the sequence depends only upon the value of the immediately preceding element.

The covariance matrix of an N-by-1 Markov sequence is

1

1

1

321

2

12

NNN

N

N

C

Page 34: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

17.4 Transform image coding

The basis vectors of the K-L transform can be computed for a Markov sequence.

DCT approximation of the K-L transform If , the basis vectors of the DCT offer a good

approximation to those of the K-L transform. DCT is often used as a substitute for the K-L

transform, as in the JPEG compression algorithm.

1

Page 35: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

17.4 Image compression standards

The Joint Photographics Experts Group (JPEG) Sponsored by International Standards

Organization (ISO) and CCITT(now ITU). Open algorithm for compression of still images Using DCT, RLE and Huffman coding scheme Typical compression ratio: 15 to 25.

Page 36: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

JPEG Compression

compression reatio 8:1

compression ratio 10:1

Page 37: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.

17.4 Image compression standards

Motion Picture Experts Group (MPEG) Compression for video. JPEG+Motion estimation to remove

redundancy between frames. MPEG-1,MPEG-2, MPEG-4,MPEG-7.

Page 38: Chapter 17 Image Compression 17.1 Introduction 17.1.1 Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.