| Automatic size recognition | Go back to the index | Face detection |
The automatic color recognition takes advantage of the fact that the skin color of the faces in the image will be very similar to the color of the templates.
First all the template faces are loaded, converted to Lab and averaged so that a single pair of (a,b) values are obtained. This would be the reference skin color. Next the distance in the (a,b) space from each pixel in the photo to the skin color is calculated, obtaining a difference image. For example, the next two images show the original photo, and the difference image to the skin color.
![]() |
![]() |
As expected, low values are obtained in the face area. Next, a sigmoid function is applied to this difference image. The exact parameters of this sigmoid function have been optimized through tests of several natural photos. The sigmoid is scaled such that in the high flat area it has a value of 2, and in the lower flat area the value is -2. While these values may seem low, they have been optimized through several natural photos to provide a good enhancement while avoiding false positives. The following image show the result of the sigmoid:

One could think that if all the faces in the templates are caucasian, the skin color would be such that the automatic color recognition algorithm would not work with other races. However, this is not the case. First, most of the apparent change in the color from one race to another is contained in the luminance component and therefore it does not affect the color recognition algorithm. Secondly, as a sigmoid is used for the enhancement, it provides the flexibility to include the small changes in the (a,b) components from one race to another. The following photos show the automatic color recognition algorithm working for different races:
Indian
![]() |
![]() |
Asian
![]() |
![]() |
Black and middle-eastern
![]() |
![]() |
| Automatic size recognition | Go back to the index | Face detection |