Tuesday, September 14, 2010

Activity 13: Color Image Segmentation

Segmentation in image processing is a process of partitioning digital images into a number of segments. So if we want to pick out a region of interest (ROI) from the digital image that has its own unique features, we can use segmentation. Segmentation can be done in colored images as well as gray scaled images. However, for gray scaled images, color information is lost and so selection rules in segmentation are limited. The goal in this activity is to pick out a ROI from a digital image that has its unique color information from the rest of the image. Also, since segmentation can separate a ROI by color differentiation, face recognition, which segmentation is often applied to, was tried.

Since we are using 3D images, a single chroma may have different shades. It is more convinent to differentiate colors if we transform our RGB (Red, Green, and Blue) image into an rgI (normalized Red, normalized Green, and brightness) image.
From the mathematical proof above, we can see that from RGB color space, we can use the red and green color probabilities, r and g, to express all the pure colors and have the quantity, I, to cover for the brightness.

Two methods are used in the segmentation process, the parametric method, which assumes that the probability of a certain pixel to a specific pure color is a Gaussian distribution, and the non-parametric method, which doesn't assume any probability distribution.

Parametric method
In this method, a subregion of the region of interest are obtained. The mean and the standard deviation of the red and green colors are calculated from the subregion.
The mean and standard deviation obtained was used as a parameter for the Gaussian distribution.
Where xi is the pixels of the normalized red or green layer of the image. After the probabilities of the red and green colors were calculated. The two was then multiplied to get the joint probability. The joint probability obtained show the segmented image.

Non-parametric method
In this method, a subregion of the ROI is also obtained. Then a 2D histogram (r-g) was then calculated from the subregion. Since non-parametric method does not assume any probability distribution, it directly relies on the histogram of the subregion of the ROI. Segmentation is done by back projecting the histogram obtained from the subregion. The back projecting method is similar to previous activity, Enhancement by Histogram Manipulation. The back projected image shows the segmented image.

Applying the Two Methods
We will use the image that we used in the previous activity, Image Types and Formats.
Figure 1. Image of a flower.
Suppose we want to segment the petals from the image. First we took a subregion from the petals.
Figure 2. Subregion of the ROI.

Now we apply the the parametric method.
Figure 3. Segmented image using parametric method.

Next, we apply the non-parametric method.
Figure 4. 2D histogram of the image in figure 1.

Figure 5. Segmented image using non-parametric method.

Comparing the 2D histogram in Figure 4 from the Normalized Chromaticity Space (NCS) in Figure 6, we can see that the two agrees with each other. The histogram has high values in the purplish region on the NCS.
Figure 6. Normalized Chromaticity Space.

Now comparing the results of the parametric and non-parametric methods, we can see that the parametric shows a smooth segmented image, while in the non-parametric method, a rough segmented image was acquired. The smoothness of the segmented image produced by the parametric method is due to the Gaussian probability spread. The spread included colors that are close to the color of the subregion used for mean and standard deviation calculations. On the other hand, the roughness of the segmented image produced by the non-parametric method was due to the discretization of the the values in the 2D histogram used for back projection.

From these results, it is clearly shown that segmentation by colors is possible. So how about we try to find different colored candies in this image.
Figure 7. Image of different colored candies. The image are taken here.

Now let's find all the blue colored candies using the parametric method.
Figure 8. Segmented image of all the blue colored candies.

Now let's try the green candies.
Figure 9. Segmented image of all the green colored candies.

Lastly, the red colored candies.
Figure 10. Segmented image of all the red colored candies.

Since segmentation is often used in face recognition, we'll attempt to do face recognition using segmentation by colors. The image we'll use is shown below:
Figure 11. My Toga picture.

We are using my face as the ROI, so we'll use a subregion from my face to compute the mean and standard deviation that will be used in the parametric method.
Figure 12. Subregion obtained from the ROI in the image in figure 11.

We now apply the parametric method.
Figure 13. Segmented image using parametric method.

Now let us try the non-parametric method.
Figure 14. 2D histogram of the subregion.

Figure 15. Segmented image using non-parametric method.

Image segmentation by color is successfully done, face recognition was also accomplished using two methods, the parametric and non-parametric methods. The images produced from the two methods differ in quality. The dissimilarities are accounted on how the two methods uniquely calculate color probabilities. I will give myself a grade of 10 in this activity since I have accomplished the objectives.

Reference:
  • Dr. Soriano. Applied Physics 186 activity manuals: A13-Color Image Segmentation. 2010.
  • http://www.ica-d.com/puzzle/play/memb/kids/candies/0candies4-d.html.

No comments:

Post a Comment