EE/CSE 576: Image Understanding

Spring 2001

EE/CSE 576: Lab Exercise 2
Clustering for Image Segmentation

Due Date: April 27

Download the software you may need. (Code for reading and writing PPM images can be found in imgformat.h and imgformat.c in the canedg directory.)
Download the test images.

In this assignment, you will segment images into regions of similarly-colored pixels, using the K-means algorithm discussed in class and given in Chapter 10.

original image false-colored labeling after k-means

Your K-means implementation should take a color PPM image, such as the one shown above on the left, and a number of clusters K. It should output a grayscale image with each pixel labeled by its class. (You can pass this image to autocolor to produce a false-colored image such as the one above.)

You can also pass this output image to conrgn to separate out the connected components within each class. Example output looks like:

false-color labeling after connected components

You should use the input images P1010021, P7180319, Ssgp1908, fb06931, fb11117 and fb23469, that are available from the image data page. For each input image, turn in printouts (preferably color) of

Also, note how many clusters you divided the pixels into (the value of K) and the number of connected components produced.

This technique will likely produce too many connected components. If you want to get rid of the small ones, you will need to construct a table of their areas (counts of pixels) and make a final pass over the image to change tiny components to label 0 (which means background).

Finally, you should turn in a listing of your K-means implementation including the headers as in Assignment 1 and internal comments to clarify the code.

Extra Credit:

Interesting Sites (in Java Applet):

Last updated on 04/15/01 at 11AM.