computer graphics & image processing chapter # 8 image compression

57
Computer Graphics Computer Graphics & & Image Processing Image Processing Chapter # 8 Chapter # 8 Image compression Image compression

Upload: floyd

Post on 06-Jan-2016

32 views

Category:

Documents


0 download

DESCRIPTION

Computer Graphics & Image Processing Chapter # 8 Image compression. ALI JAVED Lecturer SOFTWARE ENGINEERING DEPARTMENT U.E.T TAXILA Email:: [email protected] Office Room #:: 7. Background. Principal objective: To minimize the number of bits required to represent an image. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

Computer Graphics Computer Graphics & &

Image Processing Image Processing

Chapter # 8Chapter # 8

Image compression Image compression

Page 2: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

ALI JAVED Lecturer

SOFTWARE ENGINEERING DEPARTMENT

U.E.T TAXILA

Email:: [email protected]

Office Room #:: 7

Page 3: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

3

Background

Principal objective:To minimize the number of bits required to represent an image.

Applications

Transmission:Broadcast TV via satellite, military communications via aircraft,

teleconferencing, computer communications etc.

Storage:Educational and business documents, medical images (CT, MRI

and digital radiology), motion pictures, satellite images, weather maps, geological surveys, e.t.c)

Page 4: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

4

Overview

Image data compression methods fall into two common categories:

I. Information preserving compression

Especial for image archiving (storage of legal or medical records)

Compress and decompress images without losing information

II. Lossy image compression

Provide higher levels of data reduction Result in a less than perfect reproduction of the original image Applications: –broadcast television, videoconferencing

Page 5: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

5

Page 6: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

6

Data vs. information

• Data is not the same thing as information

• Data are the means to convey information; various amounts of data may be used to represent the same amount of information Part of data may provide no relevant information: data redundancy

• The amount of data can be much larger expressed than the amount of information.

Page 7: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

7

Data Redundancy

• Data that provide no relevant information=redundant data or redundancy.

• Image compression techniques can be designed by reducing or eliminating the Data Redundancy

• Image coding or compression has a goal to reduce the amount of data by reducing the amount of redundancy.

Page 8: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

8

Data Redundancy

Page 9: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

9

Data Redundancy

Three basic data redundancies

Coding Redundancy Interpixel Redundancy Psychovisual Redundancy

Page 10: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

10

Coding Redundancy

A natural m-bit coding method assigns m-bit to each gray level without considering the probability that gray level occurs with: Very likely to contain coding redundancy

Basic concept:

Utilize the probability of occurrence of each gray level (histogram) to determine length of code representing that particular gray level: variable-length coding.

Assign shorter code words to the gray levels that occur most frequently or vice versa.

Page 11: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

11

Coding Redundancy

Page 12: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

12

Coding Redundancy (Example)

Page 13: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

13

Coding Redundancy (Example)

Page 14: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

14

Coding Redundancy (Example)

Page 15: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

15

Interpixel Redundancy

Caused by High Interpixel Correlations within an image, i.e., gray level of any given pixel can be reasonably predicted from the value of its neighbors (information carried by individual pixels is relatively small) spatial redundancy, geometric redundancy, interframe redundancy (in general, interpixel redundancy )

To reduce the interpixel redundancy, mapping is used. The mapping scheme can be selected according to the properties of redundancy.

An example of mapping can be to map pixels of an image: f(x,y) to a sequence of pairs: (g1,r1), (g2,r2), ..., (gi,ri), ..

gi: ith gray level ri: run length of the ith run

Page 16: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

16

Interpixel Redundancy (Example)

Page 17: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

17

Psychovisual Redundancy

The eye does not respond with equal sensitivity to all visual information.

Certain information has less relative importance than other information in normal visual processing psychovisually redundant (which can be eliminated without significantly impairing the quality of image perception).

The elimination of psychovisually redundant data results in a loss of quantitative information lossy data compression method.

Image compression methods based on the elimination of psychovisually redundant data (usually called quantization) are usually applied to commercial broadcast TV and similar applications for human visualization.

Page 18: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

18

Psychovisual Redundancy

Page 19: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

19

Psychovisual Redundancy

Page 20: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

20

Psychovisual Redundancy

Page 21: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

21

Fidelity Criteria

Page 22: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

22

Fidelity Criteria

Page 23: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

23

Fidelity Criteria

Page 24: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

24

Image Compression Models

The encoder creates a set of symbols (compressed) from the input data.

The data is transmitted over the channel and is fed to decoder.

The decoder reconstructs the output signal from the coded symbols.

The source encoder removes the input redundancies, and the channel encoder increases the noise immunity.

Page 25: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

25

Source Encoder and Decoder

Page 26: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

Error-Free Compression

26

Page 27: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

Variable-length Coding Methods: Huffman Coding

27

Page 28: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

Variable-length Coding Methods: Huffman Coding

28

Page 29: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

29

Page 30: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

Mapping

30

•There is often correlation between adjacent pixels, i.e. the value of the neighbors of an observed pixel can often be predicted from the value of the observed pixel. (Interpixel Redundancy).

•Mapping is used to remove Interpixel Redundancy.

•Two mapping techniques are:

Run length coding Difference coding.

Page 31: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

31

Page 32: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

32

Page 33: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

33

Page 34: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

34

Page 35: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

35

Page 36: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

LZW Coding (Dictionary based coding)

•Dictionary-based coding techniques are based on the idea of incrementally building a dictionary (table) while receiving the data. Unlike VLC techniques, dictionary-based techniques use fixed-length code words to represent variable-length strings of symbols that commonly occur together.

•Lempel-Ziv-Welch (LZW) coding assigns fixed length code words to variable length sequences of source symbols.

•It also takes care of the interpixel redundancies.

•Popular coding scheme used in formats like GIF, TIFF e.t.c

36

Page 37: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

LZW Coding (Dictionary based coding)

•METHOD

•A code book or dictionary containing the source symbols to be coded is constructed. For 8 bit monochrome images, the first 256 words of the dictionary are assigned to the gray values 0,1,2,…,255. As the encoder sequentially examines the image’s pixels, gray level sequences that are not in the dictionary are placed algorithmically determined (e.g., the next unused) locations. If the first two pixels of the image are white, for instance, sequence “255-255” might be assigned to location 256. the next time that two consecutive white pixels are encountered, code word 256, the address of the location containing sequence 255-255, is used to represent them.

•A unique feature of LZW coding is that coding dictionary or code book is created while the data are being encoded.

37

Page 38: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

Example

38

Page 39: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

39

Page 40: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

Bit-Plane Coding

Page 41: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

Binary Image Compression

Page 42: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

Binary Image Compression: Constant Area Coding (CAC)

Page 43: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

Binary Image Compression: 1-D Run-Length Coding (1D RLC):

Page 44: Computer Graphics  &  Image Processing  Chapter # 8  Image compression
Page 45: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

Lossy Compression

• A lossy compression method is one where compressing data and then decompressing it retrieves data that may well be different from the original, but is close enough to be useful in some way.

• Lossy compression is most commonly used to compress multimedia data (audio, video, still images), especially in applications such as streaming media and internet telephony.

Page 46: Computer Graphics  &  Image Processing  Chapter # 8  Image compression
Page 47: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

JPEG

• Lossy Compression Technique based on use of Discrete Cosine Transform (DCT)

• A DCT is similar to a Fourier transform in the sense that it produces a kind of spatial frequency spectrum

Page 48: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

STEPS IN JPEG COMPRESSION

• Divide Each plane into 8x8 size blocks.

• Compute DCT of each block

• Treat separately DC components of each block.

• Apply Quantization to discard values

• Separately encode DC components and transmit data.

Page 49: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

JPEG COMPRESSION

Page 50: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

JPEG COMPRESSION•Using the DCT, the entries in Y will be organized based on the human visual system.•The most important values to our eyes will be placed in the upper left corner of the matrix.•The least important values will be mostly in the lower right corner of the matrix.

Semi-Important

Most Important

Least Important

Page 51: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

JPEG COMPRESSIONThe example image 8*8 matrix before DCT transformation.

Page 52: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

JPEG COMPRESSIONGray-Scale Example:Value Range 0 (black) --- 255 (white)

63 33 36 28 63 81 86 9827 18 17 11 22 48 104 108 72 52 28 15 17 16 47 77 132 100 56 19 10 9 21 55 187 186 166 88 13 34 43 51 184 203 199 177 82 44 97 73 211 214 208 198 134 52 78 83

211 210 203 191 133 79 74 86

Page 53: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

JPEG COMPRESSION2D-DCT of matrixValue Range 0 (Gray) --- -355 (Black)

-304 210 104 -69 10 20 -12 7-327 -260 67 70 -10 -15 21 8 93 -84 -66 16 24 -2 -5 9 89 33 -19 -20 -26 21 -3 0 -9 42 18 27 -7 -17 29 -7 -5 15 -10 17 32 -15 -4 7 10 3 -12 -1 2 3 -2 -3 12 30 0 -3 -3 -6 12 -1

Page 54: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

JPEG COMPRESSIONCut the least significant componentsValue Range 0 (Gray) --- -355 (Black)

-304 210 104 -69 10 20 -12 0-327 -260 67 70 -10 -15 0 0 93 -84 -66 16 24 0 0 0 89 33 -19 -20 0 0 0 0 -9 42 18 0 0 0 0 0 -5 15 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Page 55: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

JPEG COMPRESSION

Original Compressed

RReessuulltts…s…

Page 56: Computer Graphics  &  Image Processing  Chapter # 8  Image compression
Page 57: Computer Graphics  &  Image Processing  Chapter # 8  Image compression

Any question