Detect skin tone from an image

后端 未结 3 1716
渐次进展
渐次进展 2021-02-14 21:19

I am trying to develop an application which will detect the color of the face once an image is provided. I was able to find out the face detection algorithm from OpenCV and inte

3条回答
  •  忘掉有多难
    2021-02-14 21:42

    To detect skin tone of a face (or any image!), I highly recommend that you use the HSV color space (or a more complex colorspace such as LAB) rather than the default RGB colorspace, because RGB values will vary a lot depending on strong or dim lighting and shadows, etc. Whereas HSV is much better at handling lighting differences, and it gives you an easy to use color value.

    HSV means Hue-Saturation-Value, where the Hue is the color. eg: a Hue of 0 is red and a Hue of 50 might be green. Saturation is the greyness, so that a Saturation value near 0 means it is dull or grey looking whereas as a Saturation value of 200 might be a very strong color (eg: red if Hue is 0). And Value is the brightness of the pixel, so 0 is black and 255 is white.

    So whether you use a histogram or not is upto you, but either way you should first convert your image to HSV, then you can look for the most common Hue value using a histogram or just a simple search. The Hue value will be the skin tone or color you want. And if you want to make it a bit more advanced, you could take into account the values of Saturation and brightness Value to decide if it is actually black or white or grey rather than a color at all.

    I have some more OpenCV RGB to HSV conversion info on my HSV tutorial page at:

    http://www.shervinemami.co.cc/colorConversion.html

提交回复
热议问题