Project 3 - Color Image Compression Using Unsupervised Learning (Clustering) (Due 03/29)

Background

Many display devices allow only a limited number of colors to be simultaneously displayed. Therefore, true color images may need to be converted to indexed color images for the purpose of saving storage space or display in restricted display devices [1].

Data

The image given is a 120x120 full-color image (flowersm.ppm). This image can also be treated as a 120 x 120 x 3 matrix, representing a 3-dimensional feature space of 120 x 120 samples. For a 2x2 color image, the matrix would look like
R(0,0) G(0,0) B(0,0) R(0,1) G(0,1) B(0,1)
R(1,0) G(1,0) B(1,0) R(1,1) G(1,1) B(1,1)
If you use the C++ Matrix library provided, you can call the "readImage()" and "writeImage()" functions to read from and write to an image file of PPM format.

Tasks

In this project, you are given a full color image. Each pixel of this color image has three components: red, green, and blue components. Each component is an 8-bit unsigned char. There are thus totally 2^24 possible colors. For certain computers which can only display 256 (or 2^8) different colors, that is, each pixel only has 8 bits representing the color information, you are asked to find the best 2^8 colors that can approximate the original full-color image. Note that a report (20 pts) is still required.

Reference

[1] M. T. Orchard, C. A. Bouman, "Color quantization of images," IEEE Transactions on Signal Processing, 39(12):2677-2690, December, 1991.