Exact Skin color HSV range

I know it is too late to reply to this. But I am doing the same, and I used K means clustering to get the skin color. That is first you have to Detect the face, which I am doing with the use of Haar cascade classifier, and then based on the coordinates of the face you can crop the face and then use it as the source to cluster the color. Find out the cluster that has the most elements and that will be your skin color. Or without specifying one particular value you can get the cluster center point and you can use it as a range by deducting and adding a particular value. This will be helpful http://answers.opencv.org/question/23196/k-mean-clustering-of-hsv-histogram-of-frames-of-a-video/


I have tried
lower = np.array([0, 10, 60], dtype = "uint8") upper = np.array([20, 150, 255], dtype = "uint8") It gives almost good result .


According to this : http://matmidia.org/sibgrapi2009/media/posters/59928.pdf

The skin in channel H is characterized by values between 0 and 50, in the channel S from 0.23 to 0.68 for Asian and Caucasian ethnics.

You'll have to take extra care with very dark parts of the image and probably discard them altogether, as the HSV conversion gets really noisy for small values of V.

Depending on what your constraints are, you could also consider using a coloured glove (some colour that is not appearing normally in the scene), or setting a background of different colour than red, that is further away from skin colours (magenta, green, whatever).


Basically, it's hard to have one fixed color range for skin, because even if you want to detect only your own skin, its color will actually change a lot depending on lighting conditions.

So, maybe you can use the idea of this nice scientific article from 2011:

http://www.robots.ox.ac.uk/~vgg/research/hands/

Basically, they detect face (it's easy with oepncv). Then they extract the skin color of the face (which is very specific to the persons on the image). Then they detect skin using this color. Since the color is very specific, they should have much less false detection, than what you have with your fixed color range.