
Digital Image Processing IMAGE DATA COMPRESSION - PART1 Hamid R. Rabiee Fall 2015 Image Compression 2 Why we use compression? Store more data in the same space Transfer that data in less time Transfer it with less bandwidth Why we use word “data” instead of “information”? Because, for pure data compression algorithms, the compressed file contains exactly the same amount of information as the original one. For example, if someone sends you the same e-mail twice, you have two e- mails' worth of data, but just one e-mail's worth of information. However, the repetition itself might be considered to add a little bit of information. (when?) Image Compression 3 We can classify image compression based on loss of information: Lossless compression Lossy compression Image Compression Ratio 4 How much we can compress a chunk of data without distortion? According to Shannon's noiseless coding theorem it is possible to code a source of entropy H bits per symbol using H + 휺 bits per symbol. So the maximum achievable compression C, will be: Vector Quantization 5 Computation of such a compression ratio for images is impractical, if not impossible: For example an N x M digital image with B bits per pixel is one of 푳 = ퟐ푵푴푩 possible image patterns that could occur! Then one could store all the L possible image patterns and encode the image by its address. Such a method of coding is called vector quantization, or block coding. Using a few prototype training images will make this method more practical Adapted Vector Quantization 6 For making vector quantization we can do these steps: 1. Each block is normalized to have zero mean and unity variance 2. The most probable subset containing L' << L images is stored 3. If the input block is one of these L' blocks, it is coded by the address of the block; otherwise it is replaced by its mean value. 4. The entropy of an image can also be estimated from its conditional entropy: For a block of N pixels 풖ퟎ, 풖ퟏ, … , 풖푵−ퟏ , with B bits per pixel and arranged in an arbitrary order, the Nth-order conditional entropy is defined as Adapted Vector Quantization 7 (Cont’d) Simple Image Compression Methods 8 Reduce the sampling rate down to the limits of aliasing phenomena. Reduce the number of quantization levels down to the limits of contouring phenomena. Reduce the refresh rate (number of frames per second) down to the limits of flickering phenomena. Line interlacing: 1. Each frame is divided into an odd field containing the odd line addresses and an even field containing the even line addresses 2. Frames are transmitted alternately 3. Each field is displayed at half the refresh rate in frames per second However we can obtain better image compression ratio using more complicated Image compression methods More Complicated Image Compression 9 Methods Pixel Coding 10 In these techniques each pixel is processed independently, ignoring the inter pixel dependencies, Below are the most popular pixel coding methods: PCM Entropy Coding Run-Length Coding Bit-Plane Encoding PCM (Pulse code modulation) 11 Then it is quantized, and coded by a suitable code word The incoming video The compression achieved signal is sampled by these techniques is generally less than 2 : 1 Entropy Coding 12 If the quantized pixels are not uniformly distributed, then their entropy will be less than B, and there exists a code that uses less than B bits per pixel This gives a variable-length code for each block, where highly probable blocks are represented by small-length codes, and vice versa For a given block size, a technique called Huffman coding is the most efficient fixed to variable length encoding method. Huffman Coding 13 1. Arrange the symbol probabilities in a decreasing order and consider them as leaf nodes of a tree. 2. While there is more than one node: Merge the two nodes with smallest probability to form a new node whose probability is the sum of the two merged nodes. Arbitrarily assign 1 and 0 to each pair of branches merging into a node. 3. Read sequentially from the root node to the leaf node where the symbol is located. Huffman Coding Alternatives 14 What happens if code-word has more bits than our buffer? A practical version of Huffman code is called the truncated Huffman code: For a suitably selected 푳ퟏ < 푳, the first 푳ퟏ symbols are Huffman coded and the remaining symbols are coded by a prefix code followed by a suitable fixed- length code. Another alternative is called the modified Huffman code: The integer i is represented as the first 푳ퟏ symbols are Huffman coded. The remaining symbols are coded by a prefix code representing the quotient q, followed by a terminator code, which is the same as the Huffman code for the remainder j. 15 efficiency efficiency Comparison Different Huffman Codes x, x', x" = prefix codes, y = fixed length code, z = terminator code. Run-Length Coding 16 Suppose the runs are coded in maximum lengths of M (suppose 푴 = ퟐ풎 − ퟏ) If the successive 0s occur independently, then the average number of symbols per run will be: The compression achieved is, therefore, For M=15 and p=0.9 Code efficiency will be 91% Bit-Plane Encoding 17 A gray-level image can be considered as a set of 1-bit planes Each of which can be run-length encoded For 8-bit monochrome images, compression ratios of 1.5 to 2 can be achieved This method becomes very sensitive to channel errors unless the significant bit planes are carefully protected End of Lecture 16 – part1 Thank You! images and materials are taken from Jain.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages18 Page
-
File Size-