Wednesday, August 28, 2013

Activity 9 Color Image Segmentation

One of the most analyzed properties of image is its colors. Basically an image color is how our eyes interpret what we see and perceived. Not only that color is studied for artistic purposes but also for other useful purposes.
Color has been used to segment images in a variety of useful application such as; recognition of  skin regions in face and hand, land cover in remote sensing, and cells in microscopy.[1]

This activity aims to use both Parametric and Non-Parametric Segmentation

First thing to do is to find an image to be sampled of different colors; that's why the first thing in mind is to find an image of a rainbow. [2] (I posted the link if ever you want to browse colorful images)

Anyway. I think this image is a very good example so we can have a bunch of colors to be our region of interest (ROI).

Figure 1. Rainbow colored image

The next part is cropping monochromatic region of interest in Figure 1. So for this image i cropped 7 colors (using Paint) to represent the 7 colors of the rainbow (ROYGBIV).


Figure 2. Cropped ROI from original image (ROYGBIV from left to right)

The first method is by parametric segmentation. This is implemented by the following code. Take note that the file names and the ROIs are varied inside the code for different colors.

//Parametric Segmentation
clear;
stacksize('max');
ROI = double(imread('C:\Users\Jazz\Desktop\Color Segmentation\violet.png'));
R1 = ROI(:, :, 1);
G1 = ROI(:, :, 2);
B1 = ROI(:, :, 3);
I1 = R1 + G1 + B1;

I1 (find(I1==0)) = 1000000;

r1 = R1 ./ I1;
g1 = G1 ./ I1;

mu_r = mean2(r1);
mu_g = mean2(g1);
sigma_r = std2(r1);
sigma_g = std2(g1);
disp(sigma_g)

im = double(imread('C:\Users\Jazz\Desktop\Color Segmentation\rainbow.jpg'));

R = im(:, :, 1);
G = im(:, :, 2);
B = im(:, :, 3);

I = R + G + B;
I (find(I==0)) = 1000000;

r = R ./ I;
g = G ./ I;

Pr = exp(-((r - mu_r).^2)/(2*(sigma_r.^2)));
Pg = exp(-((g - mu_g).^2)/(2*(sigma_g.^2)));

segmented_image = Pr.*Pg;
imshow(segmented_image);
imwrite(segmented_image,'C:\Users\Jazz\Desktop\Color Segmentation\rainbowviolet.jpg' );

The results is the following :

Figure 3. Segmented image using RED region of interest at the corner

Figure 4. Segmented image using ORANGE region of interest at the corner

Figure 5. Segmented image using YELLOW region of interest at the corner

Figure 6. Segmented image using GREEN region of interest at the corner

Figure 7. Segmented image using BLUE region of interest at the corner

Figure 8. Segmented image using INDIGO region of interest at the corner

Figure 9. Segmented image using VIOLET region of interest at the corner



References
[1]AP 186 Handouts. A9 –Color Image Segmentation. Maricor Soriano 2013
[2]http://4hdwallpapers.com/abstract-rainbow-wallpapers.html

--------------------------------------------------------------------------------------------
Self-Grade:
8/10

2 comments:

  1. In Image Segmentation Projects , Color image segmentation is the process of dividing a color image into meaningful regions based on similarities in color, texture, or intensity. Unlike grayscale segmentation, it uses information from multiple color channels (such as RGB, HSV, or LAB) to achieve more accurate and detailed results. Techniques like thresholding, region growing, edge detection, and clustering (e.g., K-means) are commonly used to group pixels with similar color characteristics. These methods help identify objects, boundaries, or regions of interest in an image, making segmentation more effective in complex scenes.

    ReplyDelete
  2. Advanced approaches use models from Deep Learning Projects for Final Year such as convolutional neural networks (CNNs) to perform semantic or instance segmentation on color images. These models can learn intricate patterns and context, enabling high accuracy in applications like medical imaging, autonomous driving, satellite imagery, and object recognition. Color image segmentation plays a crucial role in computer vision by enhancing image understanding and enabling machines to interpret visual data more effectively.

    ReplyDelete