In this recipe, you will learn how to use a parametric model (namely, a Gaussian mixture model) to detect color and segment the pixels corresponding to human skin in an image. You will be given a dataset containing a set of RGB pixel values and their labels (whether they correspond to human skin or not). This dataset is from the UCI Machine Learning Repository, and it is collected by randomly sampling R, G, and B values from images of the faces of different age groups (young, middle-aged, old), regions, and genders. The following table shows the size of the samples in the dataset to be used:
Total learning sample size |
Skin sample size |
Non-skin sample size |
245057 |
50859 |
194198 |
We shall use the YCbCr colorspace instead of RGB, since it separates the luminance from chrominances in RGB values using a linear transform...