Image Compression - Practice Assignment 8 | ECE 533, Assignments of Digital Signal Processing

Material Type: Assignment; Class: Digital Image Processing; Subject: Electrical & Computer Engineer; University: University of New Mexico; Term: Spring 2008;

Typology: Assignments

Pre 2010

Uploaded on 08/19/2009

koofers-user-6nl
koofers-user-6nl 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Digital Image Processing ECE 533
Assignment 8
Image Compression
Due date: May 15, 4 PM, in my office or by email
Department of Electrical and Computing Engineering,University of New Mexico.
Professor Majeed Hayat, [email protected]
May 6, 2008
From the text: Problems 8.5, 8.9(a–d), 8.17, 8.19
Problem 1. Huffman coding: Download from http://www.ece.unm.edu/~jpezoa/tmp
the file Huffman.zip, which contains the following files: File.txt, Lena.raw (a 512×512
pixels Lena saved as a binary image with 8 bits per pixel), encoder.exe, and decoder.exe.
Put all of them in a single directory.
To encode a file called input.txt, using ksymbols at a time, and rpercent perturba-
tion of the nominal probabilities, type the following at the MS-DOS command: encoder
input.txt output.txt k r. This puts the Huffman code for input.txt in the file output.txt
To decode the file output.txt and put in the file input.txt, type: decoder output.txt
input.txt k r
1. Open the image Lena.raw and calculate the empirical probabilities for the occurrence
of each symbol.
1
pf2

Partial preview of the text

Download Image Compression - Practice Assignment 8 | ECE 533 and more Assignments Digital Signal Processing in PDF only on Docsity!

Digital Image Processing ECE 533

Assignment 8

Image Compression

Due date: May 15, 4 PM, in my office or by email

Department of Electrical and Computing Engineering, University of New Mexico.

Professor Majeed Hayat, [email protected]

May 6, 2008

From the text: Problems 8.5, 8.9(a–d), 8.17, 8. Problem 1. Huffman coding: Download from http://www.ece.unm.edu/~jpezoa/tmp the file Huffman.zip, which contains the following files: File.txt, Lena.raw (a 512× 512 pixels Lena saved as a binary image with 8 bits per pixel), encoder.exe, and decoder.exe. Put all of them in a single directory. To encode a file called input.txt, using k symbols at a time, and r percent perturba- tion of the nominal probabilities, type the following at the MS-DOS command: encoder input.txt output.txt k r. This puts the Huffman code for input.txt in the file output.txt To decode the file output.txt and put in the file input.txt, type: decoder output.txt input.txt k r

  1. Open the image Lena.raw and calculate the empirical probabilities for the occurrence of each symbol.

1

  1. Compute the empirical entropy of the source (considering each gray level as an individual symbol).
  2. Use these probabilities to generate the Huffman code, compute the compression ratio and the code efficiency.
  3. Decode the compressed file and show that the decoding is error free by numerically comparing the original image to the decoded image. You can use, for example, a sum of pixel-wise square of errors or sum of absolute value of errors.
  4. Now perturb each calculated symbol probability randomly and independently by ±η%, where η = 10, and make sure that the probabilities still add up to one (e.g., by re-normalize the perturbed probabilities so that they sum up to one). Now obtain the Huffman according to the perturbed (i.e., wrong) probabilities code and calculate the compression and the coding efficiency in this case. Interpret your results.
  5. Repeat the previous part using η = 30. Comment on your results (using typed, good English).

The following MATLAB commands can be useful: fwrite(FileID1,Length,’ubit8’); fwrite(FileID1,Dictionary,’ubit1’); fwrite(FileID1,Coefficient,’single’);

Finally compare the results of your compression, in terms of compression rate, with the files obtained using standard tools such as WinZip, gzip and WinRaR. Explain clearly why the file format is necessary and what kind of constraints imposes on the compression algorithms.