Search code examples
opencvface-detectionmetaldlib

Detect skin in video stream


I need to blur skin of face in the video input. Using built-in functions I can find the face. Moreover, I find facial landmarks using dlib (I need it for another purpose). What is the fastest way to detect skin, if in any case, I detect face and facial landmarks? Is there any algorithm that uses face position (or facial landmarks) to find skin?

dlib facial landmarks


Solution

  • Given that hair and facial hair can be inside the region surrounded by the dlib landmarks, I suggest:

    1. Extracting the polygon surrounded by dlib points (1, 29, 17.16, 15, 31, 3,2 ,1*)

    2. Cutting out 15% of the width from both left and right

    3. Convert the pixels to HSV and estimate the ranges

    4. Analyze pixels in the region detected by dlib, and above the eyebrows and around the chin (if needed) to extract all skin regions.

    I have used this in a few applications, and it generally works.