Presentation is loading. Please wait.

Presentation is loading. Please wait.

Digital Image Processing Lecture 21: Lossy Compression May 18, 2005

Similar presentations


Presentation on theme: "Digital Image Processing Lecture 21: Lossy Compression May 18, 2005"— Presentation transcript:

1 Digital Image Processing Lecture 21: Lossy Compression May 18, 2005
Prof. Charlene Tsai

2 JPEG Algorithm Lossy compression trades some acceptable data loss for greater rate of compression. There are many available, but the most popular is the one developed by JPEG – transform coding. Coding not done on pixel values, but on a transform.

3 Transform Discrete Cosine Transform (DCT)
Applying to 8x8 blocks, the forward and inverse DCT are DCT are real-valued, high information-packing capability, and separable.

4 Comparison with FFT Given the following sequence
If using FFT, the inverse of the first 4 FFT coefficients gives If using DCT, the result is

5 JPEG Compression For each 8x8 image block, perform the compression
Subtracting 128 from each value Apply DCT Normalization by dividing by matrix Q (the lossy part) Turning most of the elements zero Change the matrix into a vector by reading the nonzero element in a zigzag fashion. O

6 (con’d) The first element (DC coefficient) of the vector is encoded as the difference between itself and the DC of previous block. Keeps all values (except the very first one) small Compressed using RLE Other values (AC coefficients) are compressed using Huffman coding Rate of compression is controlled by scaling Q => more scaling, more compression (see page 413~415 for an example)

7 Decompression Inverse the operations: Decode Huffman encoding and RLE
Put the vector back to 8x8 matrix Multiply by Q Inverse DCT Shift back by 128

8 The Lossless Parts Huffman Coding and RLE for AC and DC terms, respectively. We’ll focus the discussion on the AC terms Each nonzero value x is assigned a category k The number of preceding 0s (run). Values: Category: Run:

9 Huffman Code Table Part of JPEG baseline standard
See page 417 and 418 for the code table, and the application.


Download ppt "Digital Image Processing Lecture 21: Lossy Compression May 18, 2005"

Similar presentations


Ads by Google