Adaptive Skin Color Detector

download Adaptive Skin Color Detector

of 8

description

The article describes an adaptive skin color detector based on paper " An Adaptive Real-time Skin Detector Based on Hue Thresholding: A Comparison on Two Motion Tracking Methods " by Dadgostar, Farhad and Sarrafzadeh, Abdolhossein and provides implementation in C++ .The code can be found in OpenVision Repository on https://github.com/pi19404/OpenVision .The class AdaptiveSkinDetector encapsulates the methods implementing the adaptive skin color detection and code can be found in files ImgProc/adaptiveskindetector.hppand ImgProc/adaptiveskindetector.cpp

Transcript of Adaptive Skin Color Detector

  • Adaptive Skin ColorDetection

    Pi19404

    April 24, 2014

  • Contents

    Contents

    Adaptive Skin Color Detection 3

    0.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30.1.1 Global Skin Colored Detector . . . . . . . . . . . . . . . . 40.1.2 Skin Color Histogram . . . . . . . . . . . . . . . . . . . . . . 4

    0.2 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    2 | 8

  • Adaptive Skin Color Detection

    Adaptive Skin Color Detection

    0.1 IntroductionIn this article we will look at Adaptive Skin Color Detection tech-nique described in the paper Dadgostar and Sarrafzadeh, 2006.

    Skin Color can be efficiently represented using Hue channel ofHSV color space.

    A static Skin color detector/Global Skin color detection can bespecified by low and higher hue thresholds.

    The hue range specified global skin color detector should detectthe aactual skin colored pixels ,but it would also falsely detectsome non skin colored pixels belonging to background or ob-jects with similar hue color as skin like wood etc

    The ammount of falsely detected pixels may be large in somesitutations compared to actual skin pixels,if a significant am-mount of scence contains objects with hue similar to the skincolor.

    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 communicatewith the computer and assuming that dominant motion in thescene belongs to hand and skin pixels.

    One of the ways to detect the regions belonging to skin re-gions is motion tracking.

    The Hue thresholds are adaptively changed by observing the mo-tion of skin colored pixels in the image.

    Thus the first step is to determine the in motion skin coloredpixels.

    3 | 8

  • Adaptive Skin Color Detection

    0.1.1 Global Skin Colored Detector

    A Global Skin Colored Detector is specified by lower and upperHue 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 coverall the possible skin colors.

    Due to the generic nature of the skin threshold,some back-ground objects whose hue is similar to skin or falls within thespecified threshold may also be detected.

    The initial lower and higher intensity thresholds are chosen as 15and 250.

    The thresholds are choosen such to avoid over or under-exposedregions in the images.

    0.1.2 Skin Color Histogram

    The filtered skin colored pixels can be used to construct a skincolored histogram which represents the statistical distributionof the skin colored pixels in the scene.

    In case of global Skin colored detector,this histogram also accu-mulates the data due to background pixles.

    Let us known assume that we known the pixels that belong tohand or face pixels.

    We again compute the histogram of skin colored pixels.

    The Actual Skin Colored histogram is merged with original skincolored histogram

    The histograms are combined using a weighted average

    H

    i+1

    = (1 a)H

    i

    + aH

    j

    H

    i+1

    is new histogramH

    i

    is Global Skin histogramH

    j

    is histogram obtained from skin colored pixels of hand/facea is the weight for merging the histograms

    A good result is obtained by choosing a value in the range 0.02-0.05 for a.

    4 | 8

  • Adaptive Skin Color Detection

    For each frame the range of hue thresholds are re-calculatedbased on new histogram.

    The criteria used for selection of lower and upper thresholds issuch that area under the histogram covers f%.

    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 se-lection of lower and upper threholds ,simply is instrumental inremoval of outliers.

    In the figures shown ,some background pixels,pixels belonging tohair,lips etc are also shown as skin colored pixels.

    Now let is consider pixels which belong to face,This in givenmanually by specifying a mask.Pixels in ROI (168,63,50,50) is ex-plicitly 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 com-bined by performing a weighted average.

    Obviously the pixels in histogram computed over entire imageare large than ones computed in small ROI,to avoid bias due tocount of pixels used to build the histogram, the histograms arenormalized between 0 to 1,before computing the linear combi-nation.

    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 infigure 1d

    (d) New threshold (e) Skin Image

    Thus incorporating the cues about skin color,enhances the de-tection performane of skin colored pixels.

    In the above example the cue has been encorporated manu-ally,however if we can incorporate the cur automatically thenwe have make the process of skin color detection completelyadaptive.

    Some techniques suggested in the paper were based on usingmotion based cue like frame differencing and optical flow track-ing.

    These techniques are suitable for HCI application assuming theobject of interest is in motion.

    6 | 8

  • Adaptive Skin Color Detection

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

    0.2 Code

    The code for the same can be found at OpenVision Repositoryhttps://github.com/pi19404/OpenVision The class AdaptiveSkinDe-tector encapsulates the methods for implementing the skin de-tector. The code for the same can be found in files ImgProc/adaptiveskindetector.cpp IgmProc/adaptiveskindetector.hpp. Forhistogram computation the class Histogram is used which can befound in the files ImgProc/Histogram.cpp,ImgProc/Histogram.hpp

    #include "ImgProc/adaptiveskindetector.hpp"

    ...

    AdaptiveSkinDetector ss1;

    ...

    Mat hmask;

    ss1.run(image,hmask);

    ...

    7 | 8

  • Bibliography

    Bibliography[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. issn:

    0167-8655. doi: 10.1016/j.patrec.2006.01.007. url: http://dx.doi.

    org/10.1016/j.patrec.2006.01.007.

    8 | 8

    Adaptive Skin Color DetectionIntroductionGlobal Skin Colored DetectorSkin Color Histogram

    CodeReferences