Thursday, 24 April 2014

Adaptive Skin Color Detector

Adaptive Skin Color Detection

Introduction

In this article we will look at Adaptive Skin Color Detection technique described in the paper \cite{Dadgostar:2006:ARS:1151986.1151991}.
  • 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,pre-processing 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.

    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.

    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

  • A good result is obtained by choosing a value in the range 0.02-0.05 for a.
  • 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 f%.
  • In the paper a criteria of 90-96\% was used

    Original
    Global Threshold
    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.
  • 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 fig:image5

    New threshold
    Skin Image
  • Thus incorporating the cue's 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.
  • Frame differencing provides a simple method to determine the region which encountered motion and use these pixels .

    Code

    The code for the same can be found at OpenVision Repository https://github.com/pi19404/OpenVision 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 filesImgProc/Histogram.cpp,ImgProc/Histogram.hpp
    1#include "ImgProc/adaptiveskindetector.hpp"
    2...
    3AdaptiveSkinDetector ss1;
    4...
    5Mat hmask;
    6ss1.run(image,hmask);
    7...
References

  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. 1342 1352.  issn:0167-8655. doi: 10.1016/j.patrec.2006.01.007. url: http://dx.doi. org/10.1016/j.patrec.2006.01.007.


The PDF version of the document can be found below