Part 1: Entropy of Images

Given babooon.png and lena.png, modify the skeleton code for Part 1 to compute

 

 

 

of each image, where P(i) the probability that a pixel has intensity value i.

The following points are important:

Make sure your code outputs the histogram values into a file, and displays the entropy and total number bits on the screen.

Part 2. Run Length Coding of Binary Images

Run length coding is a very common lossless compression technique. Details about this method will be explained in the lab session by some examples. Modify the skeleton code to compute the run length code of lenaerrdiff.png and weaskedforit.png.

The following points are important:

 

 

Make sure your code outputs the run length histogram values into a file, and displays entropy, total number of bits and bits spent per pixel on the screen.

Part 3. Run Length Coding of Image Bit Planes

Compile lab10-bitplanes.cc (without modification) using

gmake lab10-bitplanes

This command will produce the executable file bitplanes. This file seperates a given a grayscale image into 8 different images, which are all bilevel. These images are called the bitplanes of the original image. The conversion from the grayscale value to the individual bitplanes is done by first mapping the binary digits of the grayscale value to gray-coded binary values so as to minimize the number of bitplanes whose values will change due to a small change in the value of the intensity value. This point will be explained further during the lab-session. An example usage of this function would be:

./lab10-bitplanes lena.png lena_bit

After execution, 8 images will be produced, with the names:

lena_bit0.png
lena_bit1.png
lena_bit2.png
lena_bit3.png
lena_bit4.png
lena_bit5.png
lena_bit6.png
lena_bit7.png

All of these images are composed of the pixel values 0 or 255, from the bit planes of lena.png. You are going to process these bit plane images using the code of part 2. There is no seperate code needed for this part.

Form 8 binary versions of lena.png, one for each bit plane, using the executable file lab10-bitplanes. Now use your code from Part 2 to run length code each of the 8 bit plane images of lena. Observe that the least significant bit plane is the noisiest bit plane.

For each bit plane, make sure your code outputs the run length histogram values into a file, and outputs the entropy value (bits/run), the total number of bits and the average number of bits spent/pixel on the screen (as you did in Part 2).

Part 4. Predictive Coding: "Raster Snakes"

In this part you will do predictive coding. The following points are important:

Carry out the experiments in Part 4 for both lena.png and baboon.png images. Compare the entropy values you found in this part with the entropy values you found in Part 1 for each image. This gives you some hints about the usage of predictive coding in lossless compression.