Lab exercise for gmm3



Paul Cockshott



The purpose of this exercise is to compare the effectiveness of two simple means of compressing an image file.


Method 1 half toning

The image is half toned, mapping it to black and white pixels.


Method 2 decimation

The image is broken up into blocks of pixels, or dimensions 4 by 2, these are then rendered to the average brightness of the original 8 pixels.



 It can be readily seen that the information content of the two formats will be the same, as 8 bits are used to render each block of 8 pixels. The question you have to determine is which method yields the best image quality.


The image to be used for testing is here. Click on it and download it.




You are to produce a java program that reads the image and produces 2 output files one rendered with half toning and the other using decimation. The output files should be in jpeg format. Your program should also print out the signal to noise ratio of the two encodings.


Signal to noise ratio


The signal to noise ratio is defined as 10* log10( total signal energy/ total noise energy).


Signal energy is, in this case, the square of the pixel values in the original image. Noise energy is the square of the difference between the pixel values in your representation and the pixel values in the original.


The exercise is to be marked in class, but a printed copy is also to be handed to the supervisor as it is being marked.


Deadline Dec 3rd.  Marks 10. Marks will be awarded for subjective image quality, for completion of each part and for signal to noise ratio.