Digital Image Processing Ee.Sharif.Edu/~Dip

Digital Image Processing Ee.Sharif.Edu/~Dip

Digital Image Processing ee.sharif.edu/~dip Image Compression • Goal: – Reducing the amount of data required to represent a digital image. • Transmission • Archiving – Mathematical Definition: • Transforming a 2-D pixel array into a statistically uncorrelated data set. 1 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Two Main Category: – Lossless: TIFF (LZW,ZIP) – Lossy: JPEG and JPEG2000 2 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Example: Original vs. JPEG2000 CR 13.31 RD 0.925 Best Compressor: I am 1,085,496 Byte 510,576 bytes I am 81,503 Byte 3 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Fundamentals: – Raw image: A set of n1bits – Compressed image: A set of n2 bits. n – Compression ratio: C 1 R n 2 1 – Relative Data Redundancy in A: RD 1 CR – Example: n1= 100KB and n2 = 10Kb, then C0 = 10 , and RD = 90% • Special cases: 1) n1>>n2 → CR ≈ ∞, RD ≈ 1 • 2) n1 ≈ n2 → CR ≈ 1, RD ≈ 0 • 3) n1 << n2 → CR ≈ 0, RD ≈ -∞ 4 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Three basic data redundancies: – Coding redundancy – Spatial/Temporal (Inter-Pixel) redundancy, – Irrelevant/Psycho-Visual redundancy. 5 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Coding redundancy: – Type of coding (# of bits for each gray level) – Image histogram: • rk: Represents the gray levels of an image • pr(rk): Probability of occurrence of rk n p( r )k k 0,1,2,..., L 1 rk n • l(rk): Number of bits used to represent each rk. • Lavg: Average # of bits required to represent each pixel: L1 Lavg l()() r k p r r k k0 6 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Example (1): Variable Length Coding Lavg = 0.25(2)+0.47(1)+0.25(3)+0.03(3)=1.81 bits Code 2: n1 256 256 8 8 1 CRRD 4.42 1 0.774 77.4% n2 256 256 1.81 1.81 4.42 7 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Example (2): Spatial Redundancy – Uniform intensity – Highly correlated in horizontal direction – No correlation in vertical direction – Coding using run-length pairs: g1, RL 1 , g 2, RL 2 , 8 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Irrelevant/Psychovisual Redundancy: – Human perception of images: • Normally does NOT involve quantitative analysis of every pixel value. – Quantization eliminates psychovisual redundancy 9 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Image Compression using Psychovisual Redundancy: – A Simple method: Discard lower order bits (4) – IGS (Improved Gray Scale) Quantization: • Eye sensitivity to edges. • Add a pseudo random number (lower order bits of neighbors) to central pixel and then discard lower order bits. 169 ÷ 16 = 10.56 11 11 × 16 = 176 167 ÷ 16 = 10.43 10 10 × 16 = 160 Rounded values 10 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • IGS Example: Pixel Gray Level SUM IGC i-1 N/A 0000 0000 N/A i 0110 1100 0110 1100 0110 i+1 1000 1011 1001 0111 1001 i+2 1000 0111 1000 1110 1000 i+3 1111 0100 1111 0100 1111 11 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Sample Results: Original Simple Discard IGS 12 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Image information Measure: – Self Information 1 IEPE logm log : m-ary units PE m2 for bit expression ( P E 0.5 I E 1) 13 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Information Channel: – A Source of statistically independent random events – Discrete possible events a 12 ,,, a a J with associated probability: P a12,,, P a P aJ – Average information per source output (Entropy): J H P ajjlog P a j1 – For “zero-memory” (intensity source) imaging system: • Using Histogram L1 H pr r klog2 p k r k bits / pixel k 0 • This lower band of bits-length 14 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Example: H 1.6614 bits/pixel 15 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Shannon First Theorem (Noiseless Coding Theorem): – For a n-symbol group with Lavg, n average number of code symbol: Lavg, n lim H n n 16 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Fidelity Criteria: – Objective (Quantitative) • A number (vector) is calculated – Subjective (Qualitative) • Judgment of different subject is used in limited level. 17 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Objective Criteria: – f x , y :input image – f ˆ x , y : approximated image e x,,, y fˆ x y f x y MN11 1 ˆ Eabs f x,, y f x y MN xy00 12 MN11 1 ˆ 2 Erms f x,, y f x y MN xy00 MN11 2 fˆ x, y SNR xy00 ms MN11 2 fˆ x,, y f x y xy00 18 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Objective Criteria: – PSNR: Peak SNR 2 L PSNR 10log10 MN11 1 ˆ 2 f x,, y f x y MN xy00 L : Maximum level of images (255 for 8bits) 19 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Subjective Test 20 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Example: – Original and three approximation. Erms=5.17 Erms=15.67 Erms=14.17 21 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Image Compression Model: – Encoder: Create a set of symbols from image date. • Source Encoder: Reduce input redundancy. • Channel Encoder*: Increase noise immunity (noise robustness) – Decoder: Construct output image from transmitted symbols • Source Decoder: Reverse of Source encoder • Channel Decoder*: Error detection/correction. 22 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Source Encoder-Decoder: – Mapper: Map input data to suitable format for interpixel redundancies reduction (i.e., Run-Length coding) – Quantizer: Reduce accuracy of mapper output according to fidelity criteria (i.e., Psychovisual Redundancy) – Symbol Encoder: Create Fix or variable length symbols (code redundancy) 23 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Channel Encoder-Decoder*: – Add controlled redundancy to source encoded data – Increase noise robustness. – Hamming (7-4) as an example: 4 bit binary input data: b3 b 2 b 1 b 0 7 bit binary output data: h7 h 6 h 5h4 h 3 h 2 h 1 b 0 b 1bb23 h 4 h 2 h 1 h1 b 3 b 2 b 1 c1 h 1 h 3 h 5 h 7 h2 b 3 b 1 b 0Parity bits, Error check: c 2 h 2 h 3 h 6 h 7 hb4 2 bb 1 0 c4 h4 h 5 h 6 h 7 24 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Image Compression Standards • See Tables 8.3 and 8.4 for more details 25 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Error-Free Compression: – ZIP, RAR, TIFF(LZW/ZIP) • Compression Ratio: 2-10 – Steps: • Alternative representation to reduce interpixel redundancy • Coding the representation to reduce coding redundancy 26 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Variable-Length Coding: – Variable-Length Coding • Assign variable bit length to symbols based on its probability: • Low probability (high information) more bits • High Probability (low information) less bits 27 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Huffman Coding: – Uses frequencies (Probability) of symbols in a string to build a variable rate prefix code. – Each symbol is mapped to a binary string. – More frequent symbols have shorter codes. – No code is a prefix of another. (Uniquely decodable) – It is optimum! – CCITT, JBIG2, JPEG MPEG (1, 2, 4), H261-4 28 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Huffman Coding: – Example: • We have three symbols a, b, c, and c. 29 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Huffman Coding: – A source string: aabddcaa • Fixed Length Coding: 16 bits (ordinary coding) – 00 00 01 11 11 10 00 00 • Variable length coding: 14bits (Huffman coding) – 0 0 100 11 11 101 0 0 • Uniquely Decodable: 0 0 1 0 0 1 1 1 1 1 0 1 0 0 a a b d d c a a 30 E. Fatemizadeh, Sharif University of Technology, 2011 Digital Image Processing ee.sharif.edu/~dip Image Compression • Huffman Coding: – Consider an information source: S s12, s, , sm – Assume symbols are ranked decreasing with respect to occurrence probabilities: p s1 p s 2 p smm 1 p s – We seek for optimum code, the lengths of codewords assigned to the source symbols should be: l1 l 2 lmm 1 l 31 E.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    159 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us