JPEG Compression Ian Snyder December 11, 2009 Ian Snyder JPEG - - PowerPoint PPT Presentation

jpeg compression
SMART_READER_LITE
LIVE PREVIEW

JPEG Compression Ian Snyder December 11, 2009 Ian Snyder JPEG - - PowerPoint PPT Presentation

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion JPEG Compression Ian Snyder December 11, 2009 Ian Snyder JPEG Compression Outline Introduction Images


slide-1
SLIDE 1

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

JPEG Compression

Ian Snyder December 11, 2009

Ian Snyder JPEG Compression

slide-2
SLIDE 2

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Ian Snyder JPEG Compression

slide-3
SLIDE 3

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

JPEG Image Compression Standard

◮ Need for a standard

Ian Snyder JPEG Compression

slide-4
SLIDE 4

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

JPEG Image Compression Standard

◮ Need for a standard ◮ History, develpoment and adoption of JPEG’s standard

Ian Snyder JPEG Compression

slide-5
SLIDE 5

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

JPEG Image Compression Standard

◮ Need for a standard ◮ History, develpoment and adoption of JPEG’s standard ◮ Widespread use

Ian Snyder JPEG Compression

slide-6
SLIDE 6

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Image Compression

Definition: The compression of graphics for storage and/or transmission.

Ian Snyder JPEG Compression

slide-7
SLIDE 7

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Compression Methods

◮ Lossless Compression: Compression that does not remove any

data from the original file.

Ian Snyder JPEG Compression

slide-8
SLIDE 8

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Compression Methods

◮ Lossless Compression: Compression that does not remove any

data from the original file.

◮ Lossy Compression: Compression that deletes information in

  • rder to achieve a better compression ratio.

Ian Snyder JPEG Compression

slide-9
SLIDE 9

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Bitmap Images

A bitmap image is represented by an array of bits that correspond to pixel colors.

Ian Snyder JPEG Compression

slide-10
SLIDE 10

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Image Types

There are three general types of bitmap images:

◮ Intensity Images ◮ Indexed (256-color) Images ◮ RGB (Truecolor) Images

Ian Snyder JPEG Compression

slide-11
SLIDE 11

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

RGB Example Image

Ian Snyder JPEG Compression

slide-12
SLIDE 12

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Seal Image

This is the intensity image that was compressed step by step.

Ian Snyder JPEG Compression

slide-13
SLIDE 13

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

JPEG Compression Steps

◮ The Discrete Cosine Transform ◮ Quantization ◮ Reordering ◮ Huffman Coding

Ian Snyder JPEG Compression

slide-14
SLIDE 14

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Block Division of Image Matrix

When an image is JPEG compressed, it it first sliced into 8 × 8 matrix blocks of pixel entries.

Ian Snyder JPEG Compression

slide-15
SLIDE 15

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Example Image Matrix

This is the matrix taken from the top left corner of the ‘Seal’ image: O =             182 181 176 178 176 177 173 175 182 184 177 176 179 174 176 173 176 176 176 180 178 174 171 168 182 174 176 180 177 169 168 168 180 172 181 178 171 170 173 172 181 170 171 170 170 178 174 174 176 174 170 170 171 182 179 166 176 173 170 176 173 181 179 168            

Ian Snyder JPEG Compression

slide-16
SLIDE 16

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Discrete Cosine Transform

◮ The discrete cosine transform converts an image matrix from

its spatial domain into a frequency domain.

Ian Snyder JPEG Compression

slide-17
SLIDE 17

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Discrete Cosine Transform

◮ The discrete cosine transform converts an image matrix from

its spatial domain into a frequency domain.

◮ Greater changes in luminosity across the image are

represented by higher frequencies.

Ian Snyder JPEG Compression

slide-18
SLIDE 18

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Discrete Cosine Transform

◮ The discrete cosine transform converts an image matrix from

its spatial domain into a frequency domain.

◮ Greater changes in luminosity across the image are

represented by higher frequencies.

◮ The greatest frequencies are concentrated in the upper left of

the matrix.

Ian Snyder JPEG Compression

slide-19
SLIDE 19

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

DCT Equation

Cuv = αuαv

M−1

  • m=0

N−1

  • n=0

Amncos π(2m + 1)u 2M cos π(2n + 1)v 2N 0 ≤ u ≤ M − 1, 0 ≤ v ≤ N − 1

Ian Snyder JPEG Compression

slide-20
SLIDE 20

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

DCT Equation Continued

αu =

  • 1/

√ M, if p = 0,

  • 2/M,

if 1 ≤ p ≤ M − 1 αv =

  • 1/

√ M, if p = 0,

  • 2/M,

if 1 ≤ p ≤ M − 1

Ian Snyder JPEG Compression

slide-21
SLIDE 21

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

DCT Matrix

The previous equation produces this DCT matrix ‘C’: C =             .353 .353 .353 .353 .353 .353 .353 .353 .490 .415 .277 .097 −.097 −.277 −.415 −.490 .461 .191 −.191 −.461 −.461 −.191 .191 .461 .415 −.097 −.490 −.277 .277 .490 .097 −.415 .353 −.353 −.353 .353 .353 −.353 −.353 .353 .277 −.490 .097 .415 −.415 −.097 .490 −.277 .191 −.461 .461 −.191 −.191 .461 −.461 .191 .097 −.277 .415 −.490 .490 −.415 .277 −.097            

Ian Snyder JPEG Compression

slide-22
SLIDE 22

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Applying the DCT

Matrix ‘C’ is then applied to each 8 × 8 block matrix ‘A’ as follows: D = CAC T

Ian Snyder JPEG Compression

slide-23
SLIDE 23

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

DCT Applied to the Example Matrix

The DCT is now applied to the example 8 × 8 matrix: D =             376.12 13.58 −.99 10.16 .37 6.70 .54 −2.06 9.64 9.97 −1.75 −7.70 6.32 −6.77 −2.98 1.77 5.24 −6.02 2.05 7.20 −7.09 −3.05 −3.76 −4.34 .48 −2.14 8.93 −.52 −.65 .10 5.10 .051 1.12 3.51 −1.91 −4.79 4.37 2.96 .92 −.19 −3.62 .35 −2.44 3.88 .042 −.70 .32 −1.94 −2.03 −3.09 −1.01 .22 2.80 .22 2.94 −2.40 −.34 −9.40 −3.36 −2.92 −3.73 1.89 .15 −.24            

Ian Snyder JPEG Compression

slide-24
SLIDE 24

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Quantization

◮ Quantization is where compression really happens in JPEG’s

process.

Ian Snyder JPEG Compression

slide-25
SLIDE 25

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Quantization

◮ Quantization is where compression really happens in JPEG’s

process.

◮ Information is discarded from the image at this point, and it

cannot be recovered.

Ian Snyder JPEG Compression

slide-26
SLIDE 26

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Quantization Process

◮ The quantization process takes DCT matrix D and divides

each entry in that matrix by each entry in a quantization matrix Q, resulting in the quantized matrix R.

Ian Snyder JPEG Compression

slide-27
SLIDE 27

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Quantization Process

◮ The quantization process takes DCT matrix D and divides

each entry in that matrix by each entry in a quantization matrix Q, resulting in the quantized matrix R.

R = round Dij Qij

  • Ian Snyder

JPEG Compression

slide-28
SLIDE 28

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Quantization Matrix

This is the standard JPEG quatization matrix for the luminance coefficients: Q =             16 11 10 16 24 40 51 61 12 12 14 19 26 58 60 55 14 13 16 24 40 57 69 56 14 17 22 29 51 87 80 62 18 22 37 56 68 109 103 77 24 35 55 64 81 104 113 92 49 64 78 87 103 121 120 101 72 92 95 98 112 100 103 99            

Ian Snyder JPEG Compression

slide-29
SLIDE 29

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Quantized Image Matrix

This is the result of quantizing the example matrix: R =             24 1 1 1 1            

Ian Snyder JPEG Compression

slide-30
SLIDE 30

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Reordering

◮ The matrix is now transformed into a vector and reordered.

Ian Snyder JPEG Compression

slide-31
SLIDE 31

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Reordering

◮ The matrix is now transformed into a vector and reordered. ◮ This allows a long string of zero entries to be eliminated.

Ian Snyder JPEG Compression

slide-32
SLIDE 32

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Reordering Sequence

Ian Snyder JPEG Compression

slide-33
SLIDE 33

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Reordered Matrix

This is result of the reordering sequence performed on the quantized image matrix: V = [24 1 1 0 1 0 1 0 0 0 0 0 ...] (1)

Ian Snyder JPEG Compression

slide-34
SLIDE 34

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Full Image Compression

◮ All 8 × 8 blocks are DCTed, quantized, and reordered using as

previously shown.

Ian Snyder JPEG Compression

slide-35
SLIDE 35

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Full Image Compression

◮ All 8 × 8 blocks are DCTed, quantized, and reordered using as

previously shown.

◮ The reordered strings of entries are now shortened by

eliminating all zeros following the last non-zero entry.

Ian Snyder JPEG Compression

slide-36
SLIDE 36

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Full Image Compression

◮ All 8 × 8 blocks are DCTed, quantized, and reordered using as

previously shown.

◮ The reordered strings of entries are now shortened by

eliminating all zeros following the last non-zero entry.

◮ An ‘End of Block’ marker is place at the end of each string,

and all reordered “blocks” are placed in one long line.

Ian Snyder JPEG Compression

slide-37
SLIDE 37

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Huffman Coding

◮ Huffman coding allows redundancies in the values of the

string of entries to be exploited, compressing the image file even more.

◮ The original symbols (in this case, pixel values) are mapped to

unique strings of bits based on their relative frequency in the sample.

Ian Snyder JPEG Compression

slide-38
SLIDE 38

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Example Huffman Tree

Ian Snyder JPEG Compression

slide-39
SLIDE 39

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Final Storage

◮ The final string of bits produced by the Huffman Coding will

be stored as a JPEG file.

Ian Snyder JPEG Compression

slide-40
SLIDE 40

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Final Storage

◮ The final string of bits produced by the Huffman Coding will

be stored as a JPEG file.

◮ When the file is read, it will be decompressed through the

inverse steps.

Ian Snyder JPEG Compression

slide-41
SLIDE 41

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Compression Results

◮ The final results of compressing the Seal image yielded about

a 10:1 compression ratio.

◮ Original image size: 1769 kilobytes ◮ Compressed image size: 158 kilobytes

Ian Snyder JPEG Compression

slide-42
SLIDE 42

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Compressed Seal Image

Ian Snyder JPEG Compression

slide-43
SLIDE 43

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Original Image

Ian Snyder JPEG Compression

slide-44
SLIDE 44

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Conclusion

The ‘Seal’ image has been successfully compressed with good results and all the steps of the JPEG compression method have been outlined and described.

Ian Snyder JPEG Compression

slide-45
SLIDE 45

Outline Introduction Images and Compression Walkthrough of JPEG Compression Steps Complete Compression Process Results and Conclusion

Bibliography

Austin, David. Image Compression: Seeing What’s Not There. Holloway, Catherine. JPEG Image Compression: Transformation, Quantization, and Encoding. O’Hanen, Ben and Matthew Wisan. “JPEG Compression”. Student Projects in Linear Algebra. Ed. David Arnold. 16 Dec.

  • 2005. Accessed 2 Sept. 2009.

Penfield, Paul. “Chapter 3: Compression”. Notes. 12 Feb. 2004.

  • MIT. Accessed 6 Sept. 2009.

Poynton, Charles. Digital Video and HDTV: Algorithms and Interfaces Wallace, Gregory K. “The JPEG Still Picture Compression Standard”. Communications of the ACM. 1 April 1991: 30-44. Accessed online.

Ian Snyder JPEG Compression