Color Detection using Fuzzy sets of operation
2 views (last 30 days)
Show older comments
Hello,
I'm currently working on detecting colors in an image. For example, given an image that have multiple colors, and text will appear to indicate or to show each region color by displaying the color names.
I've work on HSV color space, and represent them in Fuzzy set operation.
close all; clc; clear all
img='Peppers2.bmp';
OrigImg=imread(img); % reading the image
HSVimg=(rgb2hsv(OrigImg)); % RGB->HSV conversion
Himg=(HSVimg(:,:,1)); % extracting the hue component, between [0,1]
H=(Himg*255); % normalizing to [0, 255]
% computation of the membership degree of each pixel, to each fuzzy set
RedH_l=trimf(H, [0 0 21]);
RedH_r=trimf(H, [234 255 255]);
RedH=max(RedH_l, RedH_r);
OrangeH=trimf(H, [0 21 43]);
YellowH=trimf(H, [21 43 80]);
GreenH=trapmf(H, [43 80 90 128]);
CyanH=trimf(H, [90 128 165]);
BlueH=trapmf(H, [128 165 175 191]);
PurpleH=trimf(H, [175 191 213]);
PinkH=trimf(H, [213 234 255]);
I only managed to perform the coding until here. I am not sure whether I should put in the membership function for saturation (S) and value (V) component.
For displaying image, just appear the original image and add text to indicate the color names inside the image.
Your assistance and guide are very much appreciated.
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!