You are on page 1of 8

Adaptive Skin Color Detection

April 24, 2014


Adaptive Skin Color Detection
Introduction . . . . . . . . . . . . . . . . . . . 0.1.1 Global Skin Colored Detector 0.1.2 Skin Color Histogram . . . . . . 0.2 Code . . . . . . . . . . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . 0.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3 4 4 7 7

2 | 8

Adaptive Skin Color Detection

Adaptive Skin Color Detection

0.1 Introduction
In this article we will look at Adaptive Skin Color Detection technique described in the paper Dadgostar and Sarrafzadeh, 2006.


Skin Color can be efficiently represented using Hue channel of HSV color space. A static Skin color detector/Global Skin color detection can be specified by low and higher hue thresholds. The hue range specified global skin color detector should detect the aactual skin colored pixels ,but it would also falsely detect some non skin colored pixels belonging to background or objects with similar hue color as skin like wood etc The ammount of falsely detected pixels may be large in some situtations compared to actual skin pixels,if a significant ammount of scence contains objects with hue similar to the skin color. The choise of image aquisition system,lighting conditions,preprocessing etc affect the choice of hue thresholds. Hence the optimum thresholds needs to be decided adaptively. In HCI applications hand or face regions are used to communicate with the computer and assuming that dominant motion in the scene belongs to hand and skin pixels. One of the ways to detect the regions belonging to skin regions is motion tracking. The Hue thresholds are adaptively changed by observing the motion of skin colored pixels in the image. Thus the first step is to determine the in motion skin colored pixels.

3 | 8

Adaptive Skin Color Detection

0.1.1 Global Skin Colored Detector


A Global Skin Colored Detector is specified by lower and upper Hue thresholds and lower and higher intensity thresholds. Initals lower and upper hue thresholds are chosen as 3 and 33. The Hue range provided is a generic thresholds that will cover all the possible skin colors. Due to the generic nature of the skin threshold,some background objects whose hue is similar to skin or falls within the specified threshold may also be detected. The initial lower and higher intensity thresholds are chosen as 15 and 250. The thresholds are choosen such to avoid over or under-exposed regions in the images.

0.1.2 Skin Color Histogram


The filtered skin colored pixels can be used to construct a skin colored histogram which represents the statistical distribution of the skin colored pixels in the scene. In case of global Skin colored detector,this histogram also accumulates the data due to background pixles. Let us known assume that we known the pixels that belong to hand or face pixels. We again compute the histogram of skin colored pixels. The Actual Skin Colored histogram is merged with original skin colored histogram The histograms are combined using a weighted average

H +1 = (1 a)H + aH H +1 is new histogram H is Global Skin histogram H is histogram obtained from skin colored pixels of hand/face a is the weight for merging the histograms
i i i j i j

A good result is obtained by choosing a value in the range 0.020.05 for a.

4 | 8

Adaptive Skin Color Detection


For each frame the range of hue thresholds are re-calculated based on new histogram. The criteria used for selection of lower and upper thresholds is such that area under the histogram covers .


In the paper a criteria of 90-96% was used

(a) Original

(b) Global Threshold

(c) new Threshold


Without any additional information ,the criteria used for selection of lower and upper threholds ,simply is instrumental in removal of outliers. In the figures shown ,some background pixels,pixels belonging to hair,lips etc are also shown as skin colored pixels. Now let is consider pixels which belong to face,This in given manually by specifying a mask.Pixels in ROI (168,63,50,50) is explicitly specified as skin colored pixels.

5 | 8

Adaptive Skin Color Detection


A histogram is computed by considering only the pixels in ROI. The global histogram and newly constructed histogram are combined by performing a weighted average. Obviously the pixels in histogram computed over entire image are large than ones computed in small ROI,to avoid bias due to count of pixels used to build the histogram, the histograms are normalized between 0 to 1,before computing the linear combination. Then we determine the pixels between which 90% of pixels lie. The hue range corresponding to this is (13,16) The skin color detected considering the new range in shown in figure 1d


(d) New threshold

(e) Skin Image


Thus incorporating the cues about skin color,enhances the detection performane of skin colored pixels. In the above example the cue has been encorporated manually,however if we can incorporate the cur automatically then we have make the process of skin color detection completely adaptive. Some techniques suggested in the paper were based on using motion based cue like frame differencing and optical flow tracking. These techniques are suitable for HCI application assuming the object of interest is in motion.

6 | 8

Adaptive Skin Color Detection

Frame differencing provides a simple method to determine the region which encountered motion and use these pixels .

0.2 Code
The code for the same can be found at OpenVision Repository The class AdaptiveSkinDetector encapsulates the methods for implementing the skin detector. The code for the same can be found in files ImgProc/ adaptiveskindetector.cpp IgmProc/adaptiveskindetector.hpp. For histogram computation the class Histogram is used which can be found in the files ImgProc/Histogram.cpp,ImgProc/Histogram.hpp

#include "ImgProc/adaptiveskindetector.hpp" ... AdaptiveSkinDetector ss1; ... Mat hmask;,hmask); ...

7 | 8


[1] Farhad Dadgostar and Abdolhossein Sarrafzadeh.  An Adaptive Real-time Skin Detector Based on Hue Thresholding: A Comparison on Two Motion Tracking Methods. In: Pattern Recogn. Lett. 27.12 (Sept. 2006), pp. 13421352. 0167-8655.


issn: doi: 10.1016/j.patrec.2006.01.007. url: http://dx.doi.

8 | 8