I have following code of skin detection but I am not understanding it completely. Is it HSV or Ycbcr or combined. Can anybody please tell me which type of this code is. And please explain me following code in brief.
I=imread('filename');
I=double(I);
[hue,s,v]=rgb2hsv(I);
cb = 0.148* I(:,:,1) - 0.291* I(:,:,2) + 0.439 * I(:,:,3) + 128;
cr = 0.439 * I(:,:,1) - 0.368 * I(:,:,2) -0.071 * I(:,:,3) + 128;
[w h]=size(I(:,:,1));
for i=1:w
for j=1:h
if 140<=cr(i,j) && cr(i,j)<=165 && 140<=cb(i,j) && cb(i,j)<=195 && 0.01<=hue(i,j) && hue(i,j)<=0.1
segment(i,j)=1;
else
segment(i,j)=0;
end
end
end
% imshow(segment);
im(:,:,1)=I(:,:,1).*segment;
im(:,:,2)=I(:,:,2).*segment;
im(:,:,3)=I(:,:,3).*segment;
figure,imshow(uint8(im));
Thanks in Advance.

7 commentaires

Yash
Yash le 9 Juil 2012
upload an image and check step by step u will get to knwo ti very easily
matlab_image
matlab_image le 10 Juil 2012
ok i will.Thanks
Karbala'a Unvi. Science
Karbala'a Unvi. Science le 14 Oct 2013
Dear Sir, I hope that you help me in skin detection by using the RGB image directly not transfer it in to the Cb Cr color model
Suresh Matyal
Suresh Matyal le 11 Juil 2014
you have execute the all lines one by one in command prompt, I hope you definitely understand complete code well
zonaira afzal
zonaira afzal le 16 Nov 2017
I don't want to black the other area i want it to be same as in the original picture. what i should do? i want to dress up the a person, and don't want the dress to be apply on the hands feet, neck and head.. Kindly help me in this regard...
Ravindra Singh Pawar
Ravindra Singh Pawar le 25 Sep 2018
Will you provide your reasearch paper please
Image Analyst
Image Analyst le 25 Sep 2018
I seriously doubt whether that ad hoc code was the subject of any research paper. For papers on image processing, see http://www.visionbib.com/bibliography/contents.html - it has almost all of them.

Connectez-vous pour commenter.

 Réponse acceptée

Image Analyst
Image Analyst le 9 Juil 2012

0 votes

It's using both - for some reason. It's using Cb, Cr, and hue.

2 commentaires

Ravindra Singh Pawar
Ravindra Singh Pawar le 27 Sep 2018
how can we not write ycbcr like [y,cb,cr]=rgb2ycbcr(I);
Not sure, that's just the way it is. Actually using rgb2hsv() like
[hue,s,v]=rgb2hsv(rgbImage);
is an undocumented usage. The help for rgb2hsv() does not mention the possibility of accepting 3 returned arrays. It only mentions that one array is returned.

Connectez-vous pour commenter.

Plus de réponses (1)

Karbala'a Unvi. Science
Karbala'a Unvi. Science le 14 Oct 2013

0 votes

Dear Sir, I hope that you help me in skin detection by using the RGB image directly not transfer it in to the Cb Cr color model

1 commentaire

Image Analyst
Image Analyst le 14 Oct 2013
Skin color cannot be segmented in RGB color space by simple thresholding. That's because the gamut in 3D color space is not a simple box shape that can be carved out by thresholding. At least not for skin in general, though you may be able to do it for one person's skin, but not for skin of multiple different people of different skin colors. If you were to do it in RGB space you'd have to employ a complicated ad hoc scheme like tree bagging or something. That's much more complicated than going to a different color space though it would probably do a better job than simple thresholding in YCbCr space because it can follow the curves of the boomerang-shaped gamut better. Of course using tree bagger would work in any space due to the nature of it, but it depends on a complete training set where you teach it with all skin colors you ever expect to encounter. I know it's very confusing but I hope that explains it better.

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by