Thursday, September 23, 2010

Color Segmentation: Finding Color in a Color Image

One good ability we can acquire in processing images is the ability to isolate a certain color from an image. By creating an algorithm that isolates certain colors, we can find parts of an image we are interested in.

So how do we do this? There are two ways, parametric and non-parametric probability distribution estimations.

For parametric probability distribution estimations, first we get a region of the image we want to find in the rest of the image. Now, in this region we get the mean value and the standard deviation of red and green (note that red and green values are the normalized values using the sum of Red, Green and Blue values of the image).

Then, we assume that the distribution of the color in the region is Gaussian. So that we can use the Gaussian distribution to determine the probability of red of a certain pixel. Then all we have to do is use the joint probability of red and green (using the same method for green as in red) where we multiply the resulting probability. If the color of the pixel is far from the color of the Region of Interest, then the resulting joint probability will be very low, producing a black or close to black pixel.

Parametric Segmentation with Corresponding Regions of Interest

The problem of this is that it computes values which may take a little longer than the next method used. So lets explore the Non-Parametric Probability Distribution Estimation.

This method is much simpler. First, choose a region of interest. Then, get the 2D histogram of the region of interest. Next, get the normalize red and green values of the whole image and and scale them from 0 - 32 and round them. Then, by using the value of red and green as the row and column coordinates get the histogram value from the Region of Interest. Then use that value as the image value of a new gray scale image. Once done for the whole image, you will get the regions with similar colors as that of the region of interest.

The idea is that the colors absent in the region of interest will give a low histogram value in the 2D histogram. Hence, when a pixel of that color is used, the back projected value is lower than the colors of the region of interest.

Non Parametric Segmentation

For this exercise I give myself a grade of 8.

No comments:

Post a Comment