This is a simple program used to detect the skin region from an RGB image. The algorithm simply uses the constraints on the RGB values of each pixel in the image to identify the skin regions. Does not work for grayscale images.
%Function to identify the skin region in a RGB image. Does not work for a
%grayscale image. works very well for rgb images
%USAGE: face(img)
% where img = handle of a RGB image from imread
function face(img)
final_image = zeros(size(img,1), size(img,2));
if(size(img, 3) > 1)
for i = 1:size(img,1)
for j = 1:size(img,2)
R = img(i,j,1);
G = img(i,j,2);
B = img(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;
end
end
end
end
end
figure, imshow(final_image);
end
Skin Detection in images
-
by farsun 10:58 PM
-
Tags:
About The Author
Ut dignissim aliquet nibh tristique hendrerit. Donec ullamcorper nulla quis metus vulputate id placerat augue eleifend. Aenean venenatis consectetur orci, sit amet ultricies magna sagittis vel. Nulla non diam nisi, ut ultrices massa. Pellentesque sed nisl metus. Praesent a mi vel ante molestie venenatis.
Related Posts
Connect With Us
Recommend us on Google!
So what is result?
ReplyDeleteReasonably Good. Appreciable at stage 1.
ReplyDelete