You are on page 1of 2

HUB4045F: Assignment 1: 20% of final mark Due date: 15 March 2012, 13:00, submitted on Vula Do the following in MATLAB

and submit a report containing images and answers to the questions as indicated, as well as your m-files. The m-files should be named according to the question number and should run without errors and display the required images; m-files that do not run will receive no marks. Please add comments to your m-files.
A. Segment the image that is supplied. Load assignment1.mat from the Assigments section on Vula. The matrix malaria is an image of a blood smear, containing red blood cells, some of which are infected with the parasite that causes malaria.

red blood cells

parasites

The image may be viewed using imagesc(malaria); colormap(gray)

(1) Construct (a) median and (b) smoothing/averaging filters of size 9x9 and 15x15, and apply them to the image. Recall that a median filter assigns to a pixel the median of the pixels in the filter window. In order to find the median, you will have to rearrange the pixels in the filter window as a one-dimensional array using 'reshape', and then apply the median function. (Note that Matlabs image processing toolbox contains a two-dimensional median filtering function you will, however, construct one yourself). You may use the function conv2 to apply the smoothing filter. (c) Comment briefly (100 words or less) in your report on any differences in the smoothing-filtered and median-filtered results, with reference to the differences in the structure of the filters. Your program should display the filtered images. Your report should show the filtered images. [10 marks] (2.1) Apply a k-means clustering algorithm to partition (a) the original image (malaria) and (b) the smoothed images from (1) into regions corresponding to red blood cells, parasites and background, as follows (Matlabs Statistics Toolbox has a built-in k-means clustering function, but you will construct your own): i. Select 3 seed points (gray values). ii. Partition the image into 3 clusters as follows: calculate the distance (in this case gray level/intensity difference) between each pixel in the image and each of the 3 seed points; assign each pixel to a cluster associated with the closest seed point. iii. Calculate the centroids (mean intensity) of the clusters. iv. Assign each pixel to the cluster whose centroid is closest. v. Recalculate the pixel centroids.

vi. Repeat steps iv and v until no more reassignments take place or until the number of pixels being reassigned reaches a threshold value. Show the final kmeans-clustered image in your report. Your m-file should also display this image. [10 marks] (2.2) (a) Describe how you chose your seed points and why. (b) Comment on the way the smoothing filter affects the clustering results (100 words or less). (c) One of the reasons to segment a blood smear would be to determine the ratio of parasites to red blood cells, i.e. the level of infection. Suggest a way (without implementing it) to find this ratio from the kmeans clustered image (150 words or less). [8 marks] (3) The matrix nofilt.mat contains a segmented red blood cell. smooth9, smooth15 and smooth21 contain segmentations of the cell after application of 9x9, 15x15 and 21x21 smoothing filters. (a) Evaluate the segmentations by computing the mutual overlap between nofilt and each of the filtered versions. You may use the number of pixels occupied by the red blood cell as the area; the function find will extract 1-valued pixels. Your m-file should output the values of the overlap measure and your report should contain them. (b) Explain how you determined the overlap of the red blood cells in pairs of images. (c) Comment on the overlap values with reference to the amount of smoothing applied to the images before segmentation (100 words or less). [7 marks] B. Comment on contrast Comment on the chest x-ray image: 1. Image contrast do you think the image has good contrast? Why? 2. Based on the filters discussed in lectures, write a short paragraph (150 words or less) indicating some methods that could be used to enhance the image; describe the expected enhancements. [5 marks]

Submit your answers on Vula put everything in a ZIP file with your student number as the filename. The ZIP file should contain your m-files and your report. We will test whether your m-files do what theyre supposed to do by running them on a test image. For each question, please supply a function that takes an image as input, runs your m-files, and gives the requested output. Note that this is an individual assignment. [Total: 40 marks]

You might also like