rgbImage = imread('r1.jpg');
close all
figure(1)
subplot(2,1,1)
imshow(rgbImage);
impixelinfo;
subplot(2,1,2)
HSVimage = rgb2hsv(rgbImage);
imshow(HSVimage);
figure(1)
h = HSVimage(:, :, 1);
s = HSVimage(:, :, 2);
v = HSVimage(:, :, 3);
figure(2)
imshow(h);
rwe= 3;
[ImSizeY,ImSizeX,null] = size(h);
Segment1 = zeros(ImSizeY, ImSizeX);
output = zeros(size(rgbImage));
SearchVal = [(0.3492 - 0.010) , (0.3492 +0.010) ; (0.6218 - 0.010) , (0.6218 +0.010) ; (0.9887 - 0.010) , (0.9887 +0.010);
(0.03509-0.010),(0.03509+0.010);(0.7 - 0.010),(0.7+0.010);(0.9275-0.010 ),(0.9275+0.010);(0.9722-0.010),(0.9722+0.010);(0.9167-0.001),(0.9167);]
for LookupIndex = 1:1:length(SearchVal)
for indexY=1:1:ImSizeY
for indexX=1:1:ImSizeX
if (h(indexY,indexX) > SearchVal(LookupIndex,1)) && (h(indexY,indexX) < SearchVal(LookupIndex,2))
Segment1(indexY,indexX) = 1;
output(indexY,indexX,:) = rgbImage(indexY,indexX,:);
else
Segment1(indexY,indexX) = 0;
output(indexY,indexX) = 0;
end
%output(indexY,indexX) = h(indexY,indexX)*Segment1(indexY,indexX);
end
end
end
figure(3)
imshow(Segment1)
figure(4)
imshow(output)
figure
imshow(rgbImage);