Download presentation
Presentation is loading. Please wait.
1
Introduction to JPEG m5141153 Akram Ben Ahmed http://en.wikipedia.org/wiki/JPEG
2
Outline Introduction Encoding Decoding Summary and Future work Research Paper Reading22010/7/12
3
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/2011Research Progress Seminar3
4
Outline Introduction Encoding Decoding Summary and Future work Research Paper Reading42010/7/12
5
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, C b and C r elements of it. 06/22/2011Research Progress Seminar5
6
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/2011Research Progress Seminar6
7
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/2011Research Progress Seminar7
8
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/2011Research Progress Seminar8
9
Encoding The next process steps are done to each Y Cr Cb components separately. 06/22/2011Research Progress Seminar9
10
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/2011Research Progress Seminar10
11
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/2011Research Progress Seminar11
12
Encoding: Discrete cosine transform 06/22/2011Research Progress Seminar12 m= Original Block matrixg= Resulted shifted matrix
13
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. –. – g x,y is the pixel value at coordinates (x,y) – G u,v is the DCT coefficient at coordinates (u,v) 06/22/2011Research Progress Seminar13
14
Encoding: Discrete cosine transform The resulted DCT matrix G is: 06/22/2011Research Progress Seminar14
15
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/2011Research Progress Seminar15
16
Encoding: Quantization Assuming the following quantization matrix: 06/22/2011Research Progress Seminar16
17
Encoding: Quantization And that the quantization formula is: The resulted rounded matrix is: 06/22/2011Research Progress Seminar17
18
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/2011Research Progress Seminar18
19
Encoding: Entropy coding 06/22/2011Research Progress Seminar19 The zigzag sequence for the above quantized matrix B is:
20
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/2011Research Progress Seminar20
21
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/2011Research Progress Seminar21
22
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/2011Research Progress Seminar22
23
Encoding: Entropy coding Using this special code word: "EOB", the sequence becomes: 06/22/2011Research Progress Seminar23
24
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/2011Research Progress Seminar24
25
Outline Introduction Encoding Decoding Summary and Future work Research Paper Reading252010/7/12
26
Decoding Decoding consists of doing all the encoding steps in reverse. Starting with DCT coefficient matrix of one single 8x8 block: 06/22/2011Research Progress Seminar26
27
Decoding Make entry-for-entry product with the same quantization Q matrix as in Encoding : 06/22/2011Research Progress Seminar27
28
Decoding Using the Inverse 2D-DCT expressed by: 06/22/2011Research Progress Seminar28
29
Decoding We round then the resulted values we can get the following matrix: 06/22/2011Research Progress Seminar29
30
Decoding As we did in the Encoding part, we should shift back the values by 128 to obtain : 06/22/2011Research Progress Seminar30
31
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/2011Research Progress Seminar31
32
Decoding Subtracting the uncompressed resulted image from the original one we can obtain the following error matrix: 06/22/2011Research Progress Seminar32
33
Decoding Finally we can calculate the average absolute error to evaluate the decompression quality: 06/22/2011Research Progress Seminar33
34
Outline Introduction Encoding Decoding Other Summary and Future work Research Paper Reading342010/7/12
35
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/2011Research Progress Seminar35
36
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/2011Research Progress Seminar36
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.