Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in...

18
1 IIP 1 Image Compression (in addition to notes) • Motivation/application/Taxonomy • Redundant vs. irrelevant information Lossless compression techniques Lossy compression techniques Graphics file formats IIP 2 Image Compression – Motivation Example: A video-based CD-ROM application Full-motion video, 30 fps, 720x480 resolution generates 20.736 Mbytes/s Storing 31 s of video on a 650 Mbytes CD- ROM Compression increases storage capacity to 74 min for VHS-grade video quality

Transcript of Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in...

Page 1: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

1

IIP1

Image Compression (in addition to notes)

• Motivation/application/Taxonomy

• Redundant vs. irrelevant information

• Lossless compression techniques

• Lossy compression techniques

• Graphics file formats

IIP2

Image Compression – Motivation

Example: A video-based CD-ROM application

• Full-motion video, 30 fps, 720x480 resolution

generates 20.736 Mbytes/s

• Storing 31 s of video on a 650 Mbytes CD-ROM

• Compression increases storage capacity to

74 min for VHS-grade video quality

Page 2: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

2

IIP3

Applications of Image, Video & Audio Compression

Bhaskaran & Konstantinides, 1997

IIP4

A Taxonomy of Image, Video & Audio Compression Methods

Bhaskaran & Konstantinides, 1997Bhaskaran & Konstantinides, 1997

Page 3: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

3

IIP5

Redundant vs. IrrelevantInformation

: הודעה למשהתפגוש אותך בשדה התעופה , שו לה, אשתך ה יקרה ". " מחר בע רב6- דקות ל 5-גוריון ב לוד ב -בן

5-גורי ון ב -שולה תפגוש אותך בשדה התעופה בן " . " מחר בע רב6-דקות ל

." מחר ב ע רב6-גוריון ב -שו לה תפגוש אותך ב בן "

IIP6

Lossless vs. Lossy Image Compression

• Lossless compression techniques (dictionary: RLE, LZW; statistical: Huffman) – only redundant; small ratios (less than 3:1)

• Lossy compression techniques (scalar quantization; transform image coding (DFT, DCT, Hadamard)) – also irrelevant; larger ratios (even more than 100:1)

Page 4: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

4

IIP7

Lossless & Lossy Compression –Coding Framework

Note: Most compression standards employ both lossy the losslessschemes to achieve high coding efficiency

IIP8

Lossless Compression (1) –Differential Coding (1)

• If pixels are in the order x1,…,xN, then instead of compressing the pixels, compress the prediction residuals

0 and

,1 ,

0

1

==−= −

x

Nixxy iii

Page 5: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

5

IIP9

Lossless Compression (2)–Differential Coding (2)

2

1~ 8 for the image ( ) no compression1

( ) log 255

8 for the residual image ( ) compression

ii

ii

bits pI s

pbits p

≈ →= = < ↑ →

residualspixel

values

the residual has smaller entropy thus higher compression ratios may be obtained

IIP10

Lossless Compression (3) – Run-Length Encoding (RLE) (1)

Page 6: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

6

IIP11

Lossless Compression (4) –RLE (2): An Example

0

20

40

60

80

100

120

1 3 5 7 9 11 13 15 17 19

pixel number

grey

leve

l

The RLE code of the given section of raw image is: 4,30;3,50;2,25;7,100;1,50;2,0

IIP12

Lossless Compression (5) –Lempel-Ziv-Welch (LZW)

Compression• LZ77 LZ78 LZW

• Builds up a code during file encoding

• In the first time a string appears it is stored with its code, thereafter only the code

• No separate dictionary is needed (as for RLE) since the code is part of the file

• GIF, TIFF, modem & text compression, PS level 2 (photoshop)

Page 7: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

7

IIP13

Lossless Compression (6)–Huffman Coding (1)

• The main idea behind statistical encoding techniques is to represent frequently occurring characters in the file with fewer bits than less commonly occurring ones.

• A good example is Morse coding invented for telegraph coding. Morse codes often used letters (e.g., the letter e) using single symbols (dot in the case of e) and much less common letters using a sequence of symbols (e.g., dash, dash, dot, dot for z).

• Huffman Coding uses a binary encoding tree for representing commonly occurring values in few bits and less common values in more bits.

D. Huffman, 1952

IIP14

Lossless Compression (7)–Huffman Coding (2)

Construction procedure:1. Arrange symbols s1,…,sN with probabilities of

occurrence p1,…,pN such that .Assign a tree leaf node to each symbol

2. Merge 2 nodes with the smallest probabilities by replacing sN-1 & sN with HN-1 that has a probability of occurrence pN-1 + pN (sN-1 & sN are mutually exclusive thus )

3. Arbitrarily assign 1 & 0 to each pair of branches merging into a node

4. Repeat the previous steps until the final set has only one member (establishing a binary tree)

Npppp ≥≥≥≥ ...321

1 1( ) ( ) ( )N N N NP S S P S P S− −+ = +

Page 8: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

8

IIP15

Lossless Compression (8)– Huffman Codeword Construction (3)

Bhaskaran & Konstantinides, 1997

IIP16

Lossless Compression (9)–Huffman Coding (4)

• Facsimile compression standards (Group 3, Group 4 etc.) yield compression ratios of 20:1 to 50:1

(B/W run-length encoding + Huffman coding)

Page 9: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

9

IIP17

Lossy Compression (1) – DPCM

Jain, 1989

e

e*

IIP18

Lossy Compression (2) –Transform Image Coding (1)

• Transform the image; discard near zero coefficients; quantize small coefficients coarsely; repeat for blocks; transmit/store large coefficients

• As block size increases, higher compression ratios are achieved for the same distortion level

• Spatial-domain block coding: pixels are grouped into blocks which are then compressed

• Transform-domain block coding: blocks are first transformed to another domain and less important information in the transformed domain is discarded (DFT, DCT, DHT)

Page 10: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

10

IIP19

Lossy Compression (3) –Transform Image Coding (2): DCT-Based Coding System

Bhaskaran & Konstantinides, 1997

IIP20

Lossy Compression (4) – DCT (2)

• See previous lectures

• DCT has high compaction level and is image independent

• Used in almost all image & video compression methods

• Block size of 8x8; 64 waveforms

Page 11: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

11

IIP21

Lossy Video Compression (1)

• 1st, reduce temporal redundancy

(the difference frame has many pixels near zero high compression ratios)

interframe coder

• 2nd, reduce spatial redundancy (as for still image; e.g., DCT)

intraframe coder

IIP22

Lossy Video Compression (2) –Motion Compensation

coder

decoder

Bhaskaran & Konstantinides, 1997

Page 12: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

12

IIP23

Lossy Video Compression (3) –Motion Estimation

N=M=16

p=15 head & shoulder

p=63 sporting events

Bhaskaran & Konstantinides, 1997

IIP24

Data Types

Vector Data

Bitmap Data

Page 13: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

13

IIP25

Graphics File Formats (1)• TIFF, GIF

• BMP, PCX

• JPEG (still images)

• MPEG-1, MPEG-2 (video storage & broadcasting)

• H.261 & H.263 (video conferencing)

• MPEG-4, MPEG-7 (next generation of audiovisual coding standard)

• MPEG & Dolby AC-3 (audio coding)

IIP26

Graphics File Formats (2) – TIFF (1)

Murray & vanRyper, 1996

Page 14: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

14

IIP27

Graphics File Formats (3) – TIFF (2)

Murray & vanRyper, 1996

IIP28

Graphics File Formats (4) –The JPEG Standard (1)

• Joint Photographic Experts Group (1980; 1992)

• Continuous effort to establish state of the art image compression

• Tradeoff easily between compression and image quality

• Modest computational complexity (software-only implementation)

Page 15: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

15

IIP29

Graphics File Formats (5) –The JPEG Standard (2)

Murray & vanRyper, 1996

IIP30

JPEG (3)Castleman, 1996

Page 16: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

16

IIP31

Graphics File Formats (7)

Castleman, 1996

compression statistics for previous picture

IIP32

The MPEG Video Standards (1)

• MPEG-1 (1991) – coding video+audio ≤ 1.5 Mbit/s (CD-ROM)

• MPEG-2 (1994) – ≤ 100 Mbit/s (HDTV)• MPEG-4 (1999) – various communication paradigms

(interactive telecommunication broadcast & internet); object-based paradigm for scene representation (compared to frame-based of MPEG-1&2)

• MPEG-7 – associate with the content allowing search; description of shape, size, texture and color (digital libraries, multimedia directory services (yellow pages),…)

Page 17: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

17

IIP33

The MPEG Video Standards (2)

Compression functions:

• Sample rate reduction in spatial & temporal domains of both luminance & chrominance

• Block-based DCT for the intraframes & interframes

• Block-based motion compensation

• Huffman coding for the lossless compression of motion vectors & quantised DCT coefficients

IIP34

The MPEG Video Standards (3) –MPEG-1 Encoder

Bhaskaran & Konstantinides, 1997

Page 18: Image Compression (in addition to notes) - BGUiip/slides/compression.pdf · Image Compression (in addition to notes) ... transform image coding (DFT, DCT, ... • Huffman coding for

18

IIP35

The MPEG Video Standards (4) –MPEG-4

Bhaskaran & Konstantinides, 1997

VOP –video object

plane