Image compression_btech
-
Upload
sumant-dube -
Category
Documents
-
view
103 -
download
0
Transcript of Image compression_btech
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Unit 5: Image Compression
•Fundamentals
•Redundancies
•Fidelity criteria
•Image Compression Models
•Error free compression
•Lossy Compression
•Image compression Standards :Binary Image &
continuous tone still image compression standards
•Video compression standards
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Image CompressionImage Compression
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Image CompressionImage Compression
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Image CompressionImage Compression
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Image CompressionImage Compression
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
EXAMPLE OF Psychovisal RedundancyEXAMPLE OF Psychovisal Redundancy
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
IGS quantization procedure
1. Set initial SUM = 0000 0000
2. if most significant 4 bits of current pixel A = 1111 new_SUM = A + 0000 else new_SUM = A + least significant 4 bits of old SUM
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
IGS QUANTIZATION EXAMPLEIGS QUANTIZATION EXAMPLE
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Objective Fidelity criteria
Fidelity criteria
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Subjective Fidelity criteriaSubjective Fidelity criteria
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
General Compression System ModelGeneral Compression System Model
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Chapter 8Image Compression
Chapter 8Image Compression
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
ERROR FREE COMPRESSION
• Huffman Coding• LZW Coding• Bit Plane Coding•Constant Area Coding• Run length coding•Lossless Predictive Coding
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Chapter 8Image Compression
Chapter 8Image Compression
Another Method
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Assignment :Q1 Generate the IGS code for following gray level values of pixels.
100,120,130,170,160,110
Q2 Generate Huffman code for certain message, The frequency of occurrence of elements given below
A=20,B=30,C=10,D=0,E=10,F=20,G=10
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
LZW (Lempel-Ziv-Welch) coding, assigns fixed-length code words to variable length sequences of source symbols, but requires no a priori knowledge of the probability of the source symbols.
The nth extension of a source can be coded with fewer average bits per symbol than the original source.
LZW is used in:•Tagged Image file format (TIFF)•Graphic interchange format (GIF)Portable document format (PDF)LZW was formulated in 1984
LZW Coding
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
The Algorithm:•A codebook or “dictionary” containing the source symbols is constructed.
•For 8-bit monochrome images, the first 256 words of the dictionary are assigned to the gray levels 0-255
•Remaining part of the dictionary is filled with sequences of the gray levels
LZW Coding
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
39 39 126 126
39 39 126 126
39 39 126 126
39 39 126 126
LZW Coding
Consider 4x4 , 8 Bit image::
Dictionary Location
Entry
0 0
1 1
: :
255 255
256 --
: :
511 --
512 Word Dictionary
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
LZW CodingLZW Coding
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Important features of LZW:•The dictionary is created while the data are being encoded. So encoding can be done “on the fly”
•The dictionary need not be transmitted. Dictionary can be built up at receiving end “on the fly”
•If the dictionary “overflows” then we have to reinitialize the dictionary and add a bit to each one of the code words.
•Choosing a large dictionary size avoids overflow, but spoils compressions
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Decoding LZW:Let the bit stream received be: 39 39 126 126 256 258 260 259 257
126In LZW, the dictionary which was used for encoding need not be
sent with the image. A separate dictionary is built by the decoder, on the “fly”, as it reads the received code words.
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
An m-bit gray scale image can be converted into m binary images by bit-plane slicing. These individual images are then encoded using run-length coding.
However, a small difference in the gray level of adjacent pixels can cause a disruption of the run of zeroes or ones.
Eg: Let us say one pixel has a gray level of 127 and the next pixel has a gray level of 128.In binary: 127 = 01111111& 128 = 10000000Therefore a small change in gray level has decreased the run-lengths in all the bit-planes!
Bit Plane CodingBit Plane Coding
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
GRAY CODE•Gray coded images are free of this problem which affects images which are in binary format.• In gray code the representation of adjacent gray levels will differ only in one bit (unlike binary format where all the bits can change.
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Let gm-1…….g1g0 represent the gray code representation of a binary number.Then:
11
1 20
mm
iii
ag
miaag
In gray code:127 = 01000000128 = 11000000
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Bit Plane CodingBit Plane Coding
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Bit Plane Coding Bit Plane Coding
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Chapter 8Image Compression
Chapter 8Image Compression
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Lossless Predictive CodingLossless Predictive Coding
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
•Based on eliminating the interpixel redundancy in an image•We extract and code only the new information in each pixel•New information is defined as the difference between the actual (fn) and the predicted value, of that pixel.
nf̂
nnn ffe ˆ
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
nnn fef ˆDecompression:
m
iinin froundf
1
ˆ Most general form :
Most Simple form
1ˆ
nn ff
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Lossy Predictive CodingLossy Predictive Coding
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Lossy compression•Lossless compression usually gives a maximum compression of 3:1 (for monochrome images)•Lossy compression can give compression upto 100:1 (for recognizable monochrome images) 50:1 for virtually indistinguishable images•The popular JPEG (Joint Photographic Experts Group) format uses lossy transform-based compression.
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Assignment
Q1> Write short note on :•Image compression Standards :Binary Image & continuous tone still image compression standards•Video compression standards•JPEG 2000
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods 35
Arithmetic Coding
• Arithmetic coding bypasses the idea of replacing an input symbol with a specific code. It replaces a stream of input symbols with a single floating-point output number.
• Arithmetic coding is especially useful when dealing with sources with small alphabets, such as binary sources, and alphabets with highly skewed probabilities.
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Arithmetic CodingArithmetic Coding
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
0.2
0.4
0.8
0.04
0.08
0.16
0.048
0.056
0.072
0.0592
0.0624
0.0688
0.06368
0.06496
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
End of Unit5 : Image Compression