Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy)...

44
Digital Image Processing Lecture 15 (Image Compression) Bu-Ali Sina University Computer Engineering Dep. Fall 2017

Transcript of Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy)...

Page 1: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Digital Image Processing

Lecture 15(Image Compression)

Bu-Ali Sina UniversityComputer Engineering Dep.

Fall 2017

Page 2: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Image Compression

Page 3: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Image Compression

Reducing the amount of data requiredto represent a digital image.The basis of the reduction process is

the removal of redundant data.

Page 4: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Coding redundancy

Page 5: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Interpixel redundancy

Page 6: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Psychovisual redundancy

Page 7: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Fidelity Criteria

ObjectiveSubjective

Page 8: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Image compression model

•Source Encoder is used to remove redundancy in the input image.

• Channel Encoder is used to introduce redundancy in a controlledfashion to help combat noise. Example: Parity bit.

• This provides a certain level of immunity from noise that is inherentin any storage/transmission system.

• The Channel could be a communication link or a storage/retrieval system.

Page 9: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

• What is information --- how to quantify it?• What is the minimum amount of data that is sufficient to represent an imagewithout loss of information?• What is theoretically the best compression possible?• What is the theoretically best possible transmission rate for reliablecommunication over a noisy channel?• Information theory provides answers to these and other related fundamentalquestions.• The fundamental premise of information theory is that the generation ofinformation can be modeled as a probabilistic process.• A discrete source of information generates one of N possible symbolsfrom a source alphabet set

in unit time.

Information theory

Page 10: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Example:

• The source output can be modeled as a discrete random variable E, which cantake values in set

• With corresponding probabilities

• We will denote the symbol probabilities by the vector

• Naturally,

• The information source is characterized by the pair (A, z).

Information theory

Page 11: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Observing an occurrence of the random variable E results in some gain ofinformation denoted by I(E). This gain of information was defined to be(Shannon):

The base for the logarithm depends on the units for measuring information.Usually, we use base 2, which gives the information in units of “binary digits” or“bits.” Using a base 10 logarithm would give the entropy in the units of decimaldigits.

The amount of information attributed to an event E is inversely related to theprobability of that event.

Information theory

Page 12: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

· Examples:Certain event: P(E) =1 . In this case I (E) = log(1/1) = 0.This agrees with intuition, since if the event E is certain to occur(has probability 1), knowing that it has occurred has not led to anygain of information.

Coin toss: P(E = Heads) = 0.5. In this case I (E) = log(1/ 0.5) =log(2) =1 bit.

Rare event: P(E) = 0.001. In this case I (E) = log(1/ 0.001) =log(1000) = 9.97 bits. This again agrees with intuition, sinceknowing that a rare event has occurred leads to a significant gain ofinformation.

Information theory

Page 13: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

· The entropy H(z) of a source is defined as the average amount of informationgained by observing a single source symbol:

· By convention, in the above formula, we set 0log 0 = 0.

· The entropy of a source quantifies the “randomness” of a source.

· Higher the source entropy, more the uncertainty associated with a source output,and higher the information associated with a source.

· For a fixed number of source symbols, the entropy is maximized if all thesymbols are equally likely (recall uniform histogram).

Information theory

Page 14: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Information theorySelf information of

event E

Average selfinformation of k

event

Average informationor entropy (uncertainty)

Zero memory noiselessZero memory noiseless

Average informationor entropy (uncertainty)

Efficiency

Page 15: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Information theory

Page 16: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

· Given that a source produces the above symbols with indicated probabilities,how do we represent them using binary strings?

Information theory

Page 17: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Compression MethodsError free (lossless)

–Run length–Huffman–Arithmetic coding–LZW coding

Lossy–Transform coding

Page 18: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Lossless compression Variable-Length coding

– Huffman coding

Page 19: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

010100111100a3a1a2a2a6

Lossless compression

Page 20: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of
Page 21: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

LZW (Lempel-Ziv-Welch) coding

– (remove coding and interpixel

redundancy)Assign fixed code to variable length cod

without needing to a prior knowledge ofprobability

– Is used for gif, tiff and pdf formats

Lossless compression

Page 22: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

LZW coding

Page 23: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Bit plane codingBit plan decomposition

– Polynomial– Gray code

Binary coding– Constant area– Run length coding

Page 24: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of
Page 25: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of
Page 26: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Predictive coding

Page 27: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Example

Page 28: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Lossy Compression

Lossy predictive compression

Page 29: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Transform coding

Page 30: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Transform Coding

H and g are Forwardand inverse

transformationkernels

Transformcoefficient

Page 31: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Transform coding

Fourier kernel

Walsh-hadamard

kernel (WHT)

Page 32: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

WHT basis function

Page 33: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

DCT transform

Page 34: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Subimage size

Page 35: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Bit allocation

truncating–zonal coding (maximum variance)–Threshold coding (maximum magnitude)

QuantizingCoding

Page 36: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of
Page 37: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of
Page 38: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

JPEG compressionDCT computation (8*8 blocks)QuantizationVariable length coding

Page 39: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of
Page 40: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of
Page 41: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of
Page 42: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of
Page 43: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of
Page 44: Digital Image Processing Lecture 15 - basu.ac.ir · – (remove coding and interpixel redundancy) Assign fixed code to variable length cod without needing to a prior knowledge of

Assignment8-3,8-4,8-13,8-15,