Topic 5 Image Compression Introduction Data Compression: The process of reducing the amount of data required to represent a given quantity of information. Purpose of Image Compression: the reduction of the amount of data required to represent a digital image. How? Idea is to remove redundant data from the image (i.e., data which do not affect image quality significantly) 1
Introduction Image compression is very important for (i) Image Storage (ii) Image Transmission Image Storage Applications - Educational and business documents - Medical images - Weather maps - Fingerprints (FBI database) Image Transmission Applications - Remote sensing via satellite - Military communications via aircraft, radar, and sonar - Teleconferencing - Facsimile transmission (FAX) Introduction Compression ratio: Relative data redundancy: 2
Introduction Three basic redundancy can be exploited for image compression: (i) coding redundancy (ii) inter-pixel redundancy (iii) psychovisual redundancy Coding Redundancy Basic idea: different gray levels occur with different probability (non uniform histogram). Use shorter code words for the more common gray levels Use longer code words for the less common gray levels. This is called Variable Length Coding. Probability of Occurrence, p r (r k ) = n k /n; r k = gray levels of an image; n k = no of times the kth gray level appears in the image; n = total no of pixels in the image; L = number of gray levels, l(r k ) = no of bits to used to represent each r k Average number of bits for each pixel L 1 L l( r ) p ( r ) = avg k = 0 Total number of bits required to code an M x N image = MNL avg ; k r k 3
Coding Redundancy Fixed-Length Coding Variable-Length Coding Interpixel Redundancy Interpixel redundancy is also called spatial redundancy or geometric redundancy or intraframe redundancy the value of any given pixel can be predicted from the value of its neighbors therefore, compression can be made based on the Structural or geometric relationships between the objects in the image For example, differences between adjacent pixels can be used to represent an image 4
Interpixel Redundancy Run length coding: Every code word is made up of a pair (g,l) where g is the gray level and l is the number of pixels with that gray level (length or run ). Ex: 56 56 56 82 82 82 83 80 80 80 80 56 56 56 56 56 creates the run length code: (56,3) (82,3) (83,1) (80,4) (56,5) Psychovisual Redundancy Human eye does not respond equally to all visual information Certain information has less importance to others. Human vision perception does not involve quantitative analysis of every pixel It looks for distinguished features like edges, texture, etc. Less important information is said to be psychovisually redundant and can be removed without causing image perception Removal of this redundant data removes quantitative information irreversible 5
Psychovisual Redundancy (b) Removing the least significant bits of the data caused Edge Effects Fidelity criteria Removal of redundant data caused a loss of real or quantitative visual information Fidelity criteria is the criteria use to check whether how close is the decompressed image is to the original image 2 methods to test the quality of the Compressed Image: (i) Objective eg. Signal to Noise Ratio (SNR) or Error = Decrompressed Image Original Image (ii) Subjective 6
Image Compression Models f(x,y) Source Encoder Channel Encoder Channel Channel Decoder Source Decoder f (x,y) Compression Techniques (i) Lossless Compression (No Loss): - Information preserving - Low compression ratios (ii) Lossy Compression: - Not information preserving - High compression ratios Tradeoff: image quality vs compression ratio 7
Compression Techniques Lossless (Noiseless) Huffman Coding Arithmetic Decomposition Lempel Ziv Run-Length Coding Bit-Plane Coding Huffman coding minimizes the number of code symbols per source symbol Variable Length coding eg. Huffman coding Original image Source reduction Symbol 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 8
Huffman code assignment Original image Source reduction Symbol Probability 1 2 3 4 A2 0.4 1 0.4 1 0.4 1 0.4 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 01011 Assigned bit 0 to the higher probability Bit Plane coding Divide an image into a series of binary images (each bit plane) An 8 bit image will be represented by 8 coded binary images 9
Bit Plane coding Lossless Predictive coding Eliminate inter-pixel redundancy using predictor The predictor generates the anticipated value of current pixel f n based on past pixels. The output of the predictor is round to the nearest integer 10
Lossy compression Lossy compression techniques compromise the accuracy of the reconstructed image in exchange for increased compression Result: High Compression Ratio Lossy Predictive Coding The quantizer is inserted. The predictions generated by the encoder and the decoder must be equivalent. 11
Lossy Predictive Coding Transform Coding Fourier Transform, Hadamard Transform, Discrete Cosine Transform Half of the transform coefficients are discarded. The actual rms errors are 1.28, 0.86, 0.68 12
Transform Coding Discrete Cosine Transform Image Compression Standards Discrete cosine Transform Wavelet Transform 13