MATLAB:SKINTONE EXTRACTION WITH RGB VALUES

This code is to detect the Skin Region through RGB Color space.

RGB.m:

I=imread('2.jpg');
clear('Re')
clear('Gree')
clear('Blu')
final_image = zeros(size(I,1), size(I,2));
for i = 1:size(I,1)
for j = 1:size(I,2)
R = I(i,j,1);
G = I(i,j,2);
B = I(i,j,3);
if(R > 95 && G > 40 && B > 20)
v = [R,G,B];
if((max(v) - min(v)) > 15)
if(abs(R-G) > 15 && R > G && R > B)
%it is a skin
final_image(i,j) = 1;
Re{i}=R;
Gree{i}=G;
Blu{i}=B;
end
end
end
end
end
disp(Re);
disp(Gree);
disp(Blu);
figure, imshow(final_image);

Leave a Reply

Your email address will not be published. Required fields are marked *