User Guide

This skin color filter relies on the result of face detection, hence you might want to use bob.ip.facedetect (and in particular bob.ip.facedetect.detect_single_face()) to first detect a face in the image.

The skin color distribution is modeled as a bivariate gaussian in the normalised rg colorspace. The parameters of the distribution are estimated from a circular region centered on the face, where extreme luma values have been eliminated (see [taylor-spie-2014] for details).

Skin pixels detection in a single image

The function to detect skin pixels will return a mask (logical numpy array of the same size of the image) where location corresponding to skin color pixels is True. Hence, to detect skin pixels inside a face image, you should do the following:

>>> face_image ='test-face.jpg') 
>>> detection = bob.ip.facedetect.detect_single_face(face_image)
>>> bounding_box, quality = bob.ip.facedetect.detect_single_face(face_image)
>>> face = face_image[:,, bounding_box.left:bounding_box.right]
>>> skin_filter = bob.ip.skincolorfilter.SkinColorFilter()
>>> skin_filter.estimate_gaussian_parameters(face)
>>> skin_mask = skin_filter.get_skin_mask(face_image, 0.5)

(Source code)


Fig. 1 (png, hires.png, pdf)


Fig. 2 (png, hires.png, pdf)

Picture taken from

Skin pixels detection in videos

To detect skin pixels in video, you do not need to re-estimate the gaussian parameters at each frame. However, you can do it by calling SkinColorFilter.estimate_gaussian_parameters().