Introduction to JPEG

36
Introduction to JPEG m5141153 Akram Ben Ahmed http:// en.wikipedia.org/wiki/ JPEG

description

http://en.wikipedia.org/wiki/JPEG. Introduction to JPEG. m5141153 Akram Ben Ahmed. Outline. Introduction Encoding Decoding Summary and Future work. Introduction. JPEG (Joint Photographic Experts Group) is one of the most widely used lossy compression method. - PowerPoint PPT Presentation

Transcript of Introduction to JPEG

Page 1: Introduction to JPEG

Introduction to JPEG

m5141153 Akram Ben Ahmed

http://en.wikipedia.org/wiki/JPEG

森 憲一
Page 2: Introduction to JPEG

Outline

• Introduction• Encoding• Decoding• Summary and Future work

Research Paper Reading 22010/7/12

Page 3: Introduction to JPEG

Introduction

• JPEG (Joint Photographic Experts Group) is one of the most widely used lossy compression method.

• JPEG has many standards and can be encoded in many ways.

06/22/2011 Research Progress Seminar 3

Page 4: Introduction to JPEG

Outline

• Introduction• Encoding• Decoding• Summary and Future work

Research Paper Reading 42010/7/12

Page 5: Introduction to JPEG

Encoding: Color space transformation

• The image should be converted first from RGB to YCrCb.

• Y represents the brightness of the picture while Cr and Cb represent the red and bleu chrominance respectively.

• This picture shows a color image and the Y, Cb and Cr elements of it.

06/22/2011 Research Progress Seminar 5

Page 6: Introduction to JPEG

Encoding: Color space transformation

• The conversion is done by multiplying the pixels values of the RGB image by Y, Cr and Cb factors as shown below.

06/22/2011 Research Progress Seminar 6

Page 7: Introduction to JPEG

Encoding: Downsampling

• In this step, the resolution of the Chroma components (Cr and Cb) is reduced.

• This reduction came from the fact that human eyes detect the brightness change more than the color differences.

06/22/2011 Research Progress Seminar 7

Page 8: Introduction to JPEG

Encoding: Downsampling

• The ratios at which the downsampling is ordinarily done for JPEG images are 4:4:4, 4:2:2 or 4:2:0 (most commonly) .

06/22/2011 Research Progress Seminar 8

Page 9: Introduction to JPEG

Encoding

• The next process steps are done to each Y Cr Cb components separately.

06/22/2011 Research Progress Seminar 9

Page 10: Introduction to JPEG

Encoding: Discrete cosine transform

• We divide first the image into 8x8 blocks.• If one block can’t be exactly represented in

8x8, the encoder must fill the remaining area of the incomplete blocks with some form of dummy data.

06/22/2011 Research Progress Seminar 10

Page 11: Introduction to JPEG

Encoding: Discrete cosine transform

• Before computing the DCT of the 8×8 block, its values are shifted from a positive range (0-->255) to one centered around zero by subtracting the mid-point of the range (128 in our case) from the original block values.

06/22/2011 Research Progress Seminar 11

Page 12: Introduction to JPEG

Encoding: Discrete cosine transform

06/22/2011 Research Progress Seminar 12

m= Original Block matrix g= Resulted shifted matrix

Page 13: Introduction to JPEG

Encoding: Discrete cosine transform

• We perform now the 2D DCT given by:

– u is the horizontal spatial frequency, for the integers 0<u<8.– v is the vertical spatial frequency, for the integers 0<v<8.

– .

– gx,y is the pixel value at coordinates (x,y)– Gu,v is the DCT coefficient at coordinates (u,v)

06/22/2011 Research Progress Seminar 13

Page 14: Introduction to JPEG

Encoding: Discrete cosine transform

• The resulted DCT matrix G is:

06/22/2011 Research Progress Seminar 14

Page 15: Introduction to JPEG

Encoding: Quantization

• This step consists of dividing each component in the frequency domain by a constant for that component, and then rounding to the nearest integer.

• This makes the quantization the only lossy operation due to the rounding operation.

06/22/2011 Research Progress Seminar 15

Page 16: Introduction to JPEG

Encoding: Quantization

• Assuming the following quantization matrix:

06/22/2011 Research Progress Seminar 16

Page 17: Introduction to JPEG

Encoding: Quantization

• And that the quantization formula is:

• The resulted rounded matrix is:

06/22/2011 Research Progress Seminar 17

Page 18: Introduction to JPEG

Encoding: Entropy coding

• Involves arranging the image components in a "zigzag" order employing run-length encoding (RLE) algorithm that groups similar frequencies together, inserting length coding zeros, and then using Huffman coding on what is left.

06/22/2011 Research Progress Seminar 18

Page 19: Introduction to JPEG

Encoding: Entropy coding

06/22/2011 Research Progress Seminar 19

• The zigzag sequence for the above quantized matrix B is:

Page 20: Introduction to JPEG

Encoding: Entropy coding

• In order to encode the above generated coefficient pattern, JPEG uses Huffman encoding.

• If we consider that an image can be divided into n 8x8 blocks {B1, B2, … Bn} and each block is represented by horizontal (x) and vertical (y)

coordinates, we distinguish 2 different types of encoding.

06/22/2011 Research Progress Seminar 20

Page 21: Introduction to JPEG

Encoding: Entropy coding

• Baseline sequential encoding: Takes the components of one single block then go to next block of the image.

• Starting from i=1, the order of the zigzag encoding is Bi(0,0), B0(0,1), Bi(1,0), Bi(2,0), Bi(1,1), Bi(0,2), Bi(0,3), Bi(1,2). Then the next block (i+1) until Bn.

06/22/2011 Research Progress Seminar 21

Page 22: Introduction to JPEG

Encoding: Entropy coding

• Progressive encoding: Takes one single component for all the different blocks, then move to the next component.

• The order of the zigzag encoding starts with Bi(0,0) for all the blocks {B1, B2, … Bn} then Bi(0,1) also for all the blocks.

• JPEG has a special Huffman code word for ending the sequence prematurely when the remaining coefficients are zero.

06/22/2011 Research Progress Seminar 22

Page 23: Introduction to JPEG

Encoding: Entropy coding

• Using this special code word: "EOB", the sequence becomes:

06/22/2011 Research Progress Seminar 23

Page 24: Introduction to JPEG

Encoding: Compression ratio and artifacts

• One of the problems that can be found with JPEG, is some differences between the original and the resulted compressed image.

• These differences are called artifacts and I should be fixed to assure a good compression quality.

06/22/2011 Research Progress Seminar 24

Page 25: Introduction to JPEG

Outline

• Introduction• Encoding• Decoding• Summary and Future work

Research Paper Reading 252010/7/12

Page 26: Introduction to JPEG

Decoding

• Decoding consists of doing all the encoding steps in reverse. Starting with DCT coefficient matrix of one single 8x8 block:

06/22/2011 Research Progress Seminar 26

Page 27: Introduction to JPEG

Decoding

• Make entry-for-entry product with the same quantization Q matrix as in Encoding :

06/22/2011 Research Progress Seminar 27

Page 28: Introduction to JPEG

Decoding

• Using the Inverse 2D-DCT expressed by:

06/22/2011 Research Progress Seminar 28

Page 29: Introduction to JPEG

Decoding

• We round then the resulted values we can get the following matrix:

06/22/2011 Research Progress Seminar 29

Page 30: Introduction to JPEG

Decoding

• As we did in the Encoding part, we should shift back the values by 128 to obtain :

06/22/2011 Research Progress Seminar 30

Page 31: Introduction to JPEG

Decoding

• Since the previous steps are for one block, we should reassemble all the blocks together to form the complete image.

• One way to check the quality of the compression is to compare the original image with the decompressed one.

06/22/2011 Research Progress Seminar 31

Page 32: Introduction to JPEG

Decoding

• Subtracting the uncompressed resulted image from the original one we can obtain the following error matrix:

06/22/2011 Research Progress Seminar 32

Page 33: Introduction to JPEG

Decoding

• Finally we can calculate the average absolute error to evaluate the decompression quality:

06/22/2011 Research Progress Seminar 33

Page 34: Introduction to JPEG

Outline

• Introduction• Encoding• Decoding• Other• Summary and Future work

Research Paper Reading 342010/7/12

Page 35: Introduction to JPEG

Summary and Future work

• In this article, JPEG was presented as a well known compression technique widely used in different image processing domains thanks to its simplicity and high flexibility maintaining a good compression quality.

06/22/2011 Research Progress Seminar 35

Page 36: Introduction to JPEG

Summary and Future work

• Unfortunately this article doesn’t explain the steps after the Huffman coding and the buffering operation after this process.

• As this part of the JPEG encoder is extremely important, I should investigate more about it as a future work.

06/22/2011 Research Progress Seminar 36