Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

- image compression ppt by Shivangi Saxena 8567 views
- Image compression by Partha Pratim Deb 5826 views
- Image Compression by Paramjeet Singh J... 6674 views
- Image compression by Ale Johnsan 5814 views
- Image compression by Bassam Kanber 1535 views
- Image processing and compression te... by Ashwin Venkataraman 1516 views

29,290 views

29,412 views

29,412 views

Published on

This slide show explains the concept of image compression.

No Downloads

Total views

29,290

On SlideShare

0

From Embeds

0

Number of Embeds

106

Shares

0

Downloads

2,390

Comments

0

Likes

24

No embeds

No notes for slide

- 1. DIGITAL IMAGE PROCESSINGIMAGE COMPRESSION by Paresh Kamble
- 2. Introduction Image Compression: It is the Art & Science of reducing the amount of data required to represent an image. It is the most useful and commercially successful technologies in the field of Digital Image Processing. The number of images compressed and decompressed daily is innumerable.
- 3. Introduction To understand the need for compact image representation, consider the amount of data required to represent a 2 hour Standard Definition (SD) using 720 x 480 x 24 bit pixel arrays. A video is a sequence of video frames where each frame is a full color still image. Because video player must display the frames sequentially at rates near 30fps, SD video data must be accessed at30fps x (720x480)ppf x 3bpp = 31,104,000 bpsfps – frames per second,ppf – pixels per frame,bpp – bytes per pixel & bps – bytes per second
- 4. IntroductionThus a 2 hour movie consists of31,104,000 bps x (602) sph x 2 hrs ≈ 2.24 x 1011 bytes. OR 224GB of datasph = second per hour Twenty seven 8.5GB dual layer DVDs are needed to store it. To put a 2hr movie on a single DVD, each frame must be compressed by a factor of around 26.3. The compression must be even higher for HD, where image resolution reach 1920 x 1080 x 24 bits/image.
- 5. Introduction Web page images & High-resolution digital camera photos also are also compressed to save storage space & reduce transmission time. Residential Internet connection delivers data at speeds ranging from 56kbps (conventional phone line) to more than 12mbps (broadband). Time required to transmit a small 128 x 128 x 24 bit full color image over this range of speed is from 7.0 to 0.03 sec. Compression can reduce the transmission time by a factor of around 2 to 10 or more. Similarly, number of uncompressed full color images that an 8 Megapixel digital camera can store on a 1GB Memory card can be increased.
- 6. Introduction Along with these applications , image compression plays an important role in many other areas including:
- 7. Fundamentals Data Compression: It refers to the process of reducing the amount of data required to represent a given quantity of information. Data Vs Information Data and Information are not the same thing; data are the means by which information is conveyed. Because various amount of data can be used to represent the same amount of information, representations that contain irrelevant or repeated information are said to contain redundant data.
- 8. Fundamentals
- 9. Fundamentals Let b & b’ denote the number of bits in two representations of the same information, the relative data redundancy R of the representation with b bits is• R = 1 – (1/C); where, C commonly called the compression ratio, is defined as• C = b / b’ If C = 10 (or 10:1), for larger representation has 10 bits of data for every 1 bit of data in smaller representation.So, R = 0.9, indicating that 90% of its data is redundant.
- 10. Fundamentals 2D intensity arrays suffers from 3 principal types of data redundancies:1) Coding redundancy: A code is a system of symbols used to represent a body of information or sets of events. Each piece of event is assigned a code word (code symbol). The number of symbols in each code word is its length. The 8-bit codes that are used to represent the intensities in most 2D intensity arrays contain more bits than are needed to represent the intensities.
- 11. Fundamentals2) Spatial & Temporal redundancy: Because the pixels of most 2D intensity arrays are correlated spatially, information is replicated unnecessarily. In video sequence, temporally correlated pixels also duplicate information.3) Irrelevant Information: Most 2D intensity arrays contain information that is ignored by the human visual system. It is redundant in the sense that it is not used.
- 12. Fundamentals1) Coding Redundancy: Assume a discrete random variable rk in interval [0 – L-1] is used to represent the intensities of an M x N image. Also the each rk occurs with probability pr (rk). pr(rk) = nk / MN k = 0, 1, 2, ………….L-1 -----(a) Where, L is no. of intensity values & nk is no. of times kth intensity appears in the image.If no. of bits used to represent each value of rk is l(rk), then avg no of bits required to represent each pixel is L-1 Lavg = Σ l(rk) pr(rk) k=0Thus, total no. of bits required to represent an MxN image is MNLavg.
- 13. Fundamentals If the intensities are represented using a natural m-bits fixed length code, the RHS reduces to m bits. i.e. Lavg = m where m is substituted for l(rk). Constant m can be taken out the summation leaving only sum of pr(rk) for 0 ≤ k ≤ L-1, which = 1. rk pr(rk) code 1 l1(rk) code 2 l2(rk)r87 = 87 0.25 01010111 8 01 2r128 = 128 0.47 10000000 8 1 1r186 = 186 0.25 11000100 8 000 3r255 = 255 0.03 11111111 8 001 3rk for k ≠ 87, 0 - 8 - 0 128, 186, 255
- 14. FundamentalsWith respect to the above table, If a natural 8-bit binary code is used to represent its 4 possible intensities, Lavg = 8, coz l1(rk) = 8 bits for all rk.On the other hand, If code 2 scheme is used, the avg length of encoded pixels is,Lavg = 0.25(2) + 0.47(1) + 0.25(3) + 0.03(3) = 1.81 bits.Total no. of bits rqd to represent entire image = MNLavg = 256 x 256 x 1.81 = 118,621Resulting compressionC = 256 x 256 x 8 / 118,621 = 8 / 1.81 ≈ 4.42Relative redundancyR = 1 – 1/4.42 = 0.774Thus, 77.4% of data in original 8-bit 2D intensity array is redundant.
- 15. Fidelity CriteriaFidelity Criteria:• Removal of irrelevant visual information involves a loss of real or quantitative image information.• Since information is lost, a means of quantifying the nature of loss is needed.Objective fidelity criteria Subjective fidelity criteria Objective fidelity criteria: When information loss can be expressed as a mathematical function of input & output of a compression process. Eg RMS error between 2 images.Error between two imagese(x, y) = f’(x, y) – f(x, y)So, total error between two images M-1 N-1 Σ Σ *f’(x, y) – f(x, y)] x=0 y = 0
- 16. Fidelity CriteriaRMS error is given by M-1 N-1erms = [(1/MN)Σ Σ *f’(x, y) – f(x, y)]2]1/2 x=0 y = 0If f’(x, y) is considered to be the sum of original image f(x, y) & an error or noise signal e(x, y), the Mean Square SNR of output image denoted by SNRrms can be defined as M-1 N-1 Σ Σ f’(x, y)2 SNRrms = x=0 y = 0 M-1 N-1 Σ Σ *f’(x, y) – f(x, y)]2 x=0 y = 0
- 17. Fidelity Criteria Subjective fidelity criteria:• A Decompressed image is presented to a cross section of viewers and averaging their evaluations.• It can be done by using an absolute rating scale Or• By means of side by side comparisons of f(x, y) & f’(x, y).• Side by Side comparison can be done with a scale such as {-3, -2, -1, 0, 1, 2, 3} to represent the subjective valuations{much worse, worse, slightly worse, the same, slightly better, better, much better} respectively.
- 18. Image Compression Models• The image compression system is composed of 2 distinct functional component: an encoder & a decoder.• Encoder performs Compression while• Decoder performs Decompression.• Both operations can be performed in Software, as in case of Web browsers & many commercial image editing programs.• Or in a combination of hardware & firmware, as in DVD Players.• A codec is a device which performs coding & decoding.
- 19. Image Compression Models• Input image f(x,…..) is fed into the encoder, which creates a compressed representation of input.• It is stored for future for later use or transmitted for storage and use at a remote location.• When the compressed image is given to decoder, a reconstructed output image f’(x,…..) is generated.• In still image applications, the encoded input and decoder output are f(x, y) & f’(x, y) resp.• In video applications, they are f(x, y, t) & f’(x, y, t) where t is time.• If both functions are equal then the system is called lossless, error free. If not then it s referred to as lossy.
- 20. Image Compression Models SymbolMapper Quantizer coder Symbol Inverse Decoder Mapper
- 21. Image Compression ModelsEncoding or Compression process:Encoder is used to remove the redundancies through a series of 3 independent operations.Mapper: It transforms f(x,…) into a format designed to reduce spatial and temporal redundancies.• It is reversible• It may / may not reduce the amount of data to represent image.Ex. Run Length coding• In video applications, mapper uses previous frames to remove temporal redundancies.
- 22. Image Compression ModelsQuantizer: It keeps irrelevant information out of compressed representations.• This operation is irreversible.• It must be omitted when error free compression is desired.• In video applications, bit rate of encoded output is often measured and used to adjust the operation of the quantizer so that a predetermined average output is maintained.• The visual quality of the output can vary from frame to frame as a function of image content.
- 23. Image Compression ModelsSymbol Encoder: Generates a fixed or variable length code to represent the quantizer output and maps the output in accordance with the code.• Shortest code words are assigned to the most frequently occurring quantizer output values. Thus minimizing coding redundancy.• It is reversible.• Upon its completion, the input image has been processed for the removal of all 3 redundancies.
- 24. Image Compression ModelsDecoding or Decompression process:• Quantization results in irreversible loss, an inverse quantizer block is not included in the decoder block.
- 25. Some Basic Compression MethodsHuffman Coding:• Most popular technique for removing coding redundancies.• It yields smallest possible code symbol per source symbol.Original Source Source reductionSymbol Probability 1 2 3 4 a2 0.4 0.4 0.4 0.4 0.6 a6 0.3 0.3 0.3 0.3 0.4 a1 0.1 0.1 0.2 0.3 a4 0.1 0.1 0.1 a3 0.06 0.1 a5 0.04
- 26. Some Basic Compression MethodsHuffman Coding:Original Source Source reductionSymbol Probability Code 1 2 3 4 a2 0.4 1 0.4 1 0.4 1 0.4 1 0.6 0 a6 0.3 00 0.3 00 0.3 00 0.3 00 0.4 1 a1 0.1 011 0.1 011 0.2 010 0.3 01 a4 0.1 0100 0.1 0100 0.1 011 a3 0.06 01010 0.1 0101 a5 0.04 01011Lavg = (0.4)(1) + (0.3)(2) + (0.1)(3) + (0.06)(5) + (0.04)(5) = 2.2 bits / pixel.
- 27. Some Basic Compression MethodsHuffman Coding:• It is instantaneous.• Coz each code word in a string of code symbols ca be decoded without referencing succeeding symbols.• It is uniquely decodable.• Coz any string of code symbols can be decoded by examining individual symbols of string from left to right.Ex. 010100111100
- 28. Some Basic Compression MethodsHuffman Coding:• It is instantaneous.• Coz each code word in a string of code symbols ca be decoded without referencing succeeding symbols.• It is uniquely decodable.• Coz any string of code symbols can be decoded by examining individual symbols of string from left to right.Ex. 01010 011 1 1 00First valid code:01010 – a3,011 – a1,Thus, completely decoding the message, we get, a3a1a2a2a6
- 29. Some Basic Compression MethodsArithmetic coding:It generates non block codes.One to One correspondence between source symbols and code words does not exist.Instead, an entire sequence of source symbols is assigned a single arithmetic code.Code word defines an integer of real numbers between 0 & 1.As No. of symbols in msg. interval to represent it no. of bits to represent infoEach symbol of msg size of interval in accordance with its probability of occurrence.
- 30. Some Basic Compression MethodsBasic Arithmetic coding process:5 symbol message, a1a2a3a3a4 from 4 symbol source is coded. Source Symbol Probability Initial Subinterval a1 0.2 [0.0, 0.2) a2 0.2 [0.2, 0.4) a3 0.4 [0.4, 0.8) a4 0.2 [0.8, 1.0)
- 31. Some Basic Compression MethodsArithmetic coding: a1 a2 a3 a3 a41 0.2 0.08 0.072 0.0688 a4 a4 a4 a4 a4 a3 a3 a3 a3 a3 a2 a2 a2 a2 a2 a1 a1 a1 a1 a10 0 0.04 0.056 0.0624
- 32. Some Basic Compression MethodsArithmetic coding: a1 a2 a3 a3 a41 0.2 0.08 0.072 0.0688 a4 a4 a4 a4 a4 a3 a3 a3 a3 a3 a2 a2 a2 a2 a2 a1 a1 a1 a1 a10 0 0.04 0.056 0.0624
- 33. Some Basic Compression MethodsArithmetic coding: a1 a2 a3 a3 a41 0.2 0.08 0.072 0.0688 a4 a4 a4 a4 a4 a3 a3 a3 a3 a3 a2 a2 a2 a2 a2 a1 a1 a1 a1 a10 0 0.04 0.056 0.0624
- 34. Some Basic Compression MethodsArithmetic coding: a1 a2 a3 a3 a41 0.2 0.08 0.072 0.0688 a4 a4 a4 a4 a4 a3 a3 a3 a3 a3 a2 a2 a2 a2 a2 a1 a1 a1 a1 a10 0 0.04 0.056 0.0624
- 35. Some Basic Compression MethodsArithmetic coding: a1 a2 a3 a3 a41 0.2 0.08 0.072 0.0688 a4 a4 a4 a4 a4 a3 a3 a3 a3 a3 a2 a2 a2 a2 a2 a1 a1 a1 a1 a10 0 0.04 0.056 0.0624
- 36. Some Basic Compression MethodsArithmetic coding: Encoding Sequence a1 a2 a3 a3 a41 0.2 0.08 0.072 0.0688 a4 a4 a4 a4 a4 a3 a3 a3 a3 a3 a2 a2 a2 a2 a2 a1 a1 a1 a1 a10 0 0.04 0.056 0.0624
- 37. Some Basic Compression MethodsThe final message symbol narrows to [0.06752, 0.0688).Any number between this interval can be used to represent the message.Eg. 0.0683 decimal digits are used to represent the 5 symbol message.
- 38. Some Basic Compression MethodsLZW Coding: LZW – Lempel-Ziv-Welch coding Error free compression approach that also addresses spatial redundancies in an image. It assigns fixed-length code words to variable length sequences of source symbols. It requires no prior knowledge of probability of occurrence of the symbols to be encoded.
- 39. Some Basic Compression MethodsLZW Coding: It is conceptually very simple. Initially, a codebook or dictionary containing the source symbols to be coded is constructed. For an 8-bit BW images, the first 256 words of dictionary are assigned to intensities 0, 1, 2, …., 255.
- 40. Some Basic Compression MethodsLZW Coding:Consider the 4 x 4 8-bit image having a vertical edge. 39 39 126 126 39 39 126 126 39 39 126 126 39 39 126 126A 512-word dictionary with following content is assumed: Dictionary Location Entry 0 0 1 1 . . . . 255 255 256 - . . 511 -
- 41. Some Basic Compression MethodsCurrently Pixel Being Encoded Dictionary DictionaryRecognized Processed Output Location EntrySequence 39 39 39 39 256 39-39 39 126 39 257 39-126 126 126 126 258 126-126 126 39 126 259 126-39 39 3939-39 126 256 260 39-39-126 126 126126-126 39 258 261 126-126-39 39 3939-39 12639-39-126 126 260 262 39-39-126-126 126 39126-39 39 259 263 126-39-39 39 12639-126 126 257 264 39-126-126126 126
- 42. Some Basic Compression MethodsUnique feature of LZW coding: Coding dictionary or code book is created while data are being encoded.
- 43. Some Basic Compression MethodsBit-plane coding: Another effective method to reduce interpixel redundancies. Image’s bit planes are processed individually. Based on decomposing a multilevel (monochrome / color) image into a series of binary images & compressing each binary using any binary compression method.Bit plane decomposition: Gray levels of an m-bit gray level image can be represented in form of base 2 polynomial. am-12m-1+am-22m-2+……..+a121+a020 ………(1)
- 44. Some Basic Compression Methods A simple method of decomposing the image into a collection of binary image is to separate the m coefficients of the polynomial into m-1 bit planes.Disadvantage: Small changes in gray level can have significant impact on complexity of bit planes.Ex. If two adjacent pixels have intensity of 127 (01111111) and 128 (10000000), every bit plane will contain a corresponding 0 to 1 (or 1 to 0) transition.
- 45. Some Basic Compression MethodsAlternate decomposition approach: Reduces the effect of small gray level variations. Requires the representation of image into m-bit gray code. m-bit gray code gm-1…..g2g1g0 can be computed from gi = ai xor ai+1 0 ≤ i ≤ m-2 gm-1 = am-1 This code has unique property that successive code words differ by only 1 bit position. Small changes in gray level are less likely to affect all m bit planes.Ex. 127 (11000000) & 128 (01000000).
- 46. Some Basic Compression MethodsRun-Length Coding: Standard compression approach used in facsimile (FAX). Basic concept is to code each contiguous group of 0’s & 1’s encountered in L to R scan of a row by its length & to develop a convention for determining the value of run. Most common approach for determining the value of run:i) Specify value of first run of each row.ii) To assume each row begins with a white run whose run length may in fact be zero.
- 47. Some Basic Compression Methods• Although Run length coding is in itself an effective method of compressing an image, additional compression can be realized by variable-length coding.• Black & white run lengths may be coded separately using variable-length codes.Ex. If aj represent a black run of length j, we can estimate its probability.• The approximate run-length entropy of the image is: HRL = (H0 + H1) / (L0 + L1)• where, L0 & L1 denote average values of black & white run lengths resp.• Above equation also provides an estimate of the average no. of bits per pixel required to code the run lengths in a binary image.
- 48. Some Basic Compression MethodsLossless predictive coding:• Based on eliminating the interpixel redundancies of closely spaced pixels by extracting & coding only the new information in each pixel.• New information: difference between the actual & predicted value of that pixel.
- 49. Some Basic Compression Methods• Figure shows basic component of a lossless predictivecoding system.• It consists of an encoder & a decoder each containing anidentical predictor.• As each successive pixel of input image f(n) is introducedto the encoder, predictor generates its anticipated value. Output of the predictor is then rounded to the nearest integerf(n)bar & used to form the difference or prediction error. e(n) = f(n)– f(n)bar
- 50. Some Basic Compression Methods• It is coded using a variable length to generate the next element of the compressed data stream.• The decoder reconstruct the fn from the received variable- length code words & perform the inverse operation• f(n) = e(n) + f(n)bar• f(n)bar is generated by prediction formed by a linear combination of m previous pixels. mf(n)bar = round[Σ αi f(n-i)] where, m – order of linear predictor i=1round – function used to denote roundingαi – for i = 1, 2, 3, ….. m are prediction coefficients.
- 51. Some Basic Compression MethodsLossy Predictive coding:
- 52. Some Basic Compression MethodsLossy Predictive coding:• In this method we add a quantizer to the lossless predictive coding model.• It replaces the nearest integer function & is placed between symbol encoder & point where prediction error forms.• It maps the prediction error into a limited range of outputs denoted by ë(n), which establish the amount of compression & distortion.• In order to accommodate the insertion of the quantization step, the error free encoder must be altered so that the predictions by the encoder & decoder are equivalent.
- 53. Some Basic Compression MethodsLossy Predictive coding:• This is accomplished by placing the predictor within a feedback loop, where its input ƒ(n)dot is generated as a function of past predictions & quantized errors.ƒ(n)dot = e(n)dot + f(n)bar• This closed loop configuration prevents error buildup at the decoder’s output.
- 54. Some Basic Compression MethodsQuestions asked in RTMNU exams1) Enlist different image compression techniques. Explain any one in brief.2) Huffman coding algorithm for image compression3) aeiou!4) Explain generalized image compression model with neat block diagram.5) Discuss about image compression. Explain the need of image compression in image processing.6) Short note on image compression standard.7) Short note on Lossy Predictive coding.8) Short note on LZW coding.9) Explain various types of data redundancies used in digital image compression.

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment