dlib

dlib / FaceDetection / 0.2.1

README.md

Introduction

This algorithm detects human faces in given images. Works best with forward facing faces.

Input

  • ​(Required): Image URL (http(s) url or dataAPI url)
  • (Optional): Detected faces image save location

Output

  • ​Image URL
  • Detected faces coordinates
  • Detected faces image (if save location given)

Example(s)

Example 1.

  • ​Parameter 1: Image URL
{
  "images": [
    {
      "url": "https://en.wikipedia.org/wiki/Barack_Obama#/media/File:DIG13623-230.jpg"
    }
  ]
}

Output:

{
  "images": [
    {
      "detected_faces": [
        {
          "bottom": 1704,
          "left": 1882,
          "right": 2203,
          "top": 1383
        },
        {
          "bottom": 1660,
          "left": 632,
          "right": 1017,
          "top": 1274
        }
      ],
      "url": "https://en.wikipedia.org/wiki/Barack_Obama#/media/File:DIG13623-230.jpg"}
  ]
}

Example 2.

  • ​Parameter 1: Multiple Image URLs
{
  "images": [
    {
      "url": "https://en.wikipedia.org/wiki/Barack_Obama#/media/File:DIG13623-230.jpg"
    },
    {
      "url": "https://upload.wikimedia.org/wikipedia/commons/b/b6/Obamamiltondavis1.jpg"
    }
  ]
}

Output:

{
  "images": [
    {
      "detected_faces": [
        {
          "bottom": 1704,
          "left": 1882,
          "right": 2203,
          "top": 1383
        },
        {
          "bottom": 1660,
          "left": 632,
          "right": 1017,
          "top": 1274
        }
      ],
      "url": "https://en.wikipedia.org/wiki/Barack_Obama#/media/File:DIG13623-230.jpg"
    },
    {
      "detected_faces": [
        {
          "bottom": 182,
          "left": 377,
          "right": 429,
          "top": 130
        },
        {
          "bottom": 228,
          "left": 290,
          "right": 333,
          "top": 185
        },
        {
          "bottom": 218,
          "left": 93,
          "right": 136,
          "top": 175
        },
        {
          "bottom": 257,
          "left": 204,
          "right": 247,
          "top": 214
        },
        {
          "bottom": 278,
          "left": 25,
          "right": 61,
          "top": 242
        }
      ],
      "url": "https://upload.wikimedia.org/wikipedia/commons/b/b6/Obamamiltondavis1.jpg"
    }
  ]
}

Example 3.

  • ​Parameter 1: Image URL
  • Parameter 2: Detected faces image save location
{
  "images": [
    {
      "url": "https://en.wikipedia.org/wiki/Barack_Obama#/media/File:DIG13623-230.jpg",
      "output": "data://.algo/temp/detected_faces.png"
    }
  ]
}

Output:

{
  "images": [
    {
      "detected_faces": [
        {
          "bottom": 1704,
          "left": 1882,
          "right": 2203,
          "top": 1383
        },
        {
          "bottom": 1660,
          "left": 632,
          "right": 1017,
          "top": 1274
        }
      ],
      "output": "data://.algo/temp/detected_faces.png",
      "url": "https://en.wikipedia.org/wiki/Barack_Obama#/media/File:DIG13623-230.jpg"
    }
  ]
}

Credits

Description from Facial Recognition Wikipedia.

Face recognition model from dlib.

Example image from Unsplash.