Thursday, August 6, 2009

ACTIVITY 9 - Binary Operations

This activity is an integration of everything we have learned to determine the best estimate area in pixel count of simulated "cells". In addition, we are going to use more morphological operators such as the closing and opening operator for enhancing and analyzing binarized images.
The image above which is an image of scattered punched paper digitized using a flatbed scanner was utilized in this activity. We imagine that the circles are imaged cells on a slide. Our primary goal: estimate the area of ONE "cell".

We begin the task by dividing the whole image into 256 x 256 subimages. Each subimage was opened in grayscale. A sample subimage was shown below.
The threshold of the subimage was obtained from its histogram. The threshold is important in order to separate the background from the cell, which is our region of interest (ROI). Then the subimage was binarize using the Scilab function im2bw.
In order to emphasize the separation of ROI from the background, we implemented opening and closing operator using the dilate and erode functions which are built-in functions in Scilab.

//opening
image1 = erode(dilate(image));
Opening operator removes small objects inside the cell.

//closing
image2 = dilate(erode(image1));

While closing operator removes small holes on the background.

After doing morphological operations, we have now a cleaner image of the cells. Then, contiguous blobs are formed within each subimage. The bwlabel function was used to label each blob on the subimage. The area or the number of pixels of each blob was measured from each subimage and then tallied.

//area computation
[L, n] = bwlabel(image2);
area = [];
for i = 1:n
area(i) = sum(i==L);
end

From the histogram of the areas, the average of the area was taken from the range of areas with high occurrences. The calculated mean area was found to be 526 pixels with a standard deviation of 24.67. In order to verify this calculation, a single "cell" was taken from the whole image, binarized and then summed in order to get the area in pixel.
The area of a single cell was measured to be 535 pixels. In comparison to the calculated area, a 1.76% error was obtained.

I will give myself a grade of 10/10 for finishing this activity. Aside from obtaining a small percentage error, I understand most part of the activity. I was able to apply image processing and area calculation techniques I have learned in previous activity. I think that using bwlabel function in calculating the area of each blob in a subimage was a clever idea. As always, I want to acknowledged Gilbert in helping me understand the activity.


No comments:

Post a Comment