The objective of this exercise is to give you practical experience with the use of dithering and colour lookup tables.
The source image is Lena, Soderberg,(http://tastymenues.com/lennapg/len_std.jpg) a standard test image used for image processing experiments. You are provided with the file in JPEG format with full colour. Your task is to produce versions of the image using 2 bits per pixel and 6 bits per pixel. You are to use error diffusion to partially correct for the quantization errors that this will introduce.
2 bits allow the use of a 4 colour pallette. You are to produce 2 different versions of the image each using a different pallette. The first pallette must consist of the following:
code | colour | r | g | b |
0 | black | 0 | 0 | 0 |
1 | red | 255 | 0 | 0 |
2 | green | 0 | 255 | 0 |
3 | white | 255 | 255 | 255 |
In this version the pallette is defined such that bits 0,1 encode blue, bits 2,3 encode green, and bits 4,5 encode red. The bits are taken to be the most significant 2 bits of the final 8 bit colour value for each independent colour channel.
You are to write a single java program which will read in an image whose url is supplied as a command line parameter, and which will output the files 2bita.jpg, 2bitb.jpg and 6bit.jpg. The file 2bita.jpg must use the black, red, green, white pallette, and file 2bitb.jpg must use a pallette of your choice, and the file 6bit.jpg must use the 6 bit pallette specified above. Your program must in addition print out the pallete that you are using for 2bitb.jpg as a table with 4 rows and 3 coloumns, giving the red, green and blue components of the pallette.
You must demonstrate your program running in class and also submit a listing
of the program.