Thursday, August 6, 2009

Activity 12 Color Image Segmentation

So far we have been doing image segmentation and morphology on binary and gray-scale images. In the past activities simple thresholding is enough to seperate our region of interest (ROI) but in some cases this wont be sufficient. In image processing there instances where binarizing an image or converting it into gray-scale wont separate it from the background, in such cases we need to utilize its color information. In this activity we use normalized chromaticity coordinates to do segmentation via color information.


Figure 1. Normalize Chromaticity Coordinates

The normalized chromaticity coordinates (NCC), shown in figure 1, can be thought of as a way of expressing 3 dimensional RGB information to a simpler 2 Dimensional r-g color space. The basis for this transform is that r+g+b=1 (done by normalizing RGB), hence the third value is redundant and it is enough to express color by only two values, in this case r and g.

After expressing an image in NCC we can now do the segmentation by using the probability distribution function (PDF) of the ROI in NCC. By mapping the image to the PDF of the ROI we are able to separate the ROI from the rest of the image. In this activity we calculate the PDF of the ROI using two methods, one of these is the parametric method which assumes that the PDF is a gaussian. In the parametric method we simply obtain the mean and standard deviation of the r and g of the ROI and use this to calculate its 2 dimensional PDF. The other method is the non-parametric method, here we do not assume any form of the PDF and we simply use the r and g (2 dimensional) histogram of the image and use this as the PDF. In both methods we obtain the PDF of the ROI by only taking a patch of it.

I used an image of multicolored candies to test these two methods for color image segmentation. Excluding the background, there are only three main colors in this image; red, orange, and green.

Figure 2 below shows the results of the segmentation using both parametric and non-parametric methods. For both methods separating the green region was accomplished almost perfectly. The pixelated result for the parametric method is caused by the actual texture of the candy and the parametric method wont be able to compensate for such a feature. On the otherhand the holes on the result of non-parametric method are most likely due to the patch I used to sample the ROI. This simply means that there are other colors which are part of the ROI that were not included in the sample patch. Using a better sampled patch would improve the result in this case.

Compared to the non-parametric the parametric method did not fare as well when segmenting the red or orange regions of the image. Since the parametric method assumes a gaussian PDF it is higly probable that the PDF of the red or orange ROI includes each other. Hence the parametric method fails when we try to separate colors that are very close to each other.

The non-parametric method does not suffer from the same problem as the parametric method since it uses the actual histogram of the ROI as the PDF for mapping. This means that even if the two colors are very close to each other there wont be any confusion as long as the other color does not appear frequently inside the ROI. As we can see from the histograms the orange and red are very close to each other but their histograms are almost mutually exclusive.




Figure 2. Original unsegmented image with the results of both parametric and non-parametric color segmentation. The patch of the ROI is also included as well as its histogram.

Overall, by looking at the results, I have to say that the non-parametric method is a much better color segmentation technique. Compared to the parametric method, the non-parametric is much more versatile, accurate, and the quality is also better.

I give myself a grade of 10 in this activity.

No comments:

Post a Comment