$30
Project 4 - Color Image Compression Using Unsupervised Learning (Clustering)
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 (flowers.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)
Use 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.
(40/30) Task 1: Use k-means algorithm to find 256 colors that best represent the original full-color image.
Display the color image using these 256 colors only.
(10/10) Task 2: Compare the color image you generated with the original full color image. Design some
metrics to illustrate the performance gain/loss.
(20/10) Task 3: Use winner-take-all algorithm and redo the first 2 items.
(+10/20) Task 4: Use Kohonen maps to redo the first 2 items.
(10/10) Task 5: Try to use cluster number of 128, 64, 32, etc. and compare the quality of the pseudo-color
image.
(+10/+10) Task 6: Use mean-shift to automatically determine the optimal clusters based on a given
bandwidth.
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.