How to detect skin here?
4 views (last 30 days)
Show older comments
Hello. In the last topic, I tried to find the region for the eyes. Thankfully I could do it. Then I asked some friends from here to tell me how to find skin to divide eyelids from eye. The programs were helpful but now, I need to detect skin, just with the following method. Could anyone help me please? This is the rule for skin detection for my project:
(R>95)AND(G>40)AND(B>20)AND(max{R,G,B}-min{R,G,B}>15)AND( R>15)
The first part of my project, namely, detection of eye region is:
if true
% i=imread('pic8.jpg');
subplot(5,5,1)
imshow(i)
title('original image');
iycbcr=rgb2ycbcr(i);
iycbcr = im2double(iycbcr);
subplot(5,5,2)
imshow(iycbcr)
title('YCBCR space');
y=iycbcr(:,:,1);
cb=iycbcr(:,:,2);
cr=iycbcr(:,:,3);
ccb=cb.^2;
subplot(5,5,3)
imshow(ccb)
title('CB^2');
ccr=(1-cr).^2;
subplot(5,5,4)
imshow(ccr)
title('(1-CR)^2');
cbcr=ccb./cr;
subplot(5,5,5)
imshow(cbcr)
title('CB/CR');
igray=rgb2gray(i);
igray=~igray;
subplot(5,5,6)
imshow(igray)
title('Gray space');
g=1./3;
l=g*ccb;
m=g*ccr;
n=g*cbcr;
eyemapchr=l+m+n;
subplot(5,5,7)
imshow(eyemapchr)
title('Chrom Eyemap');
t=histeq(eyemapchr);
subplot(5,5,8)
imshow(t)
title('Equalized image');
SE=strel('disk',15,8);
o=imdilate(igray,SE);
p=1+imerode(igray,SE);
eyemaplum=o./p;
subplot(5,5,9)
imshow(eyemaplum)
title('Lum Eyemap');
cc=and(t,eyemaplum);
subplot(5,5,10)
imshow(cc)
title('AND of Lum&Chrom');
subplot(5,5,11)
imshow(i);
I=im2double(i);
title('original image');
R=I(:,:,1);
G=I(:,:,2);
B=I(:,:,3);
newi=I.*repmat(cc,[1,1,3]);
subplot(5,5,12)
imshow(newi)
title('Multiplication');
end
1 Comment
Mohammad Farhad Aryan
on 6 Nov 2019
Hi Zahra,
I need to detect the skin part of the image in my research too and found some tutorials worked on the same issue but using different rules.
Could you please tell me how do you make this rule (specially numbers of each color component) such the one you are using in your project?
(R>95)AND(G>40)AND(B>20)AND(max{R,G,B}-min{R,G,B}>15)AND( R>15)
Answers (1)
Image Analyst
on 6 Apr 2014
There will be a lot of ambiguous pixels if you have a pink skinned baby in pink clothing. Why do you need to find the skin? Just find the eyes, and pink pixels. Who cares if the pink is clothing or baby. It doesn't matter if all you want to do it find the eyes on the face.
2 Comments
Image Analyst
on 6 Apr 2014
Well how does your paper describe it? I'm sure there are different methods. If you say you can find the skin then I would look for all non-skin black "islands" inside your skin mask. First you need to find the eyes and not any other non-skin pixels like freckled, moles, nostrils, ear holes or any other non-skin areas that may also be there. For example you can look at their color. If they're dark, then they're not sclera. So try to find all the light blobs inside the skin mask. Then see if those areas are next to another non-skin area, which would be the iris. Measure the area and estimate the degree to which that eye is open of closed. I'm sure the code will be at least 3 times as long as what you've got here, maybe longer, so keep working on it.
See Also
Categories
Find more on Feature Detection and Extraction in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!