Skip to content

Latest commit

 

History

History
115 lines (99 loc) · 3.2 KB

concept-detecting-faces.md

File metadata and controls

115 lines (99 loc) · 3.2 KB
title titleSuffix description author manager ms.service ms.topic ms.date ms.author
Face detection - Azure AI Vision
Azure AI services
Learn concepts related to the face detection feature of the Azure AI Vision API.
PatrickFarley
nitinme
azure-ai-vision
conceptual
01/19/2024
pafarley

Face detection with Image Analysis 3.2

Image Analysis 3.2 can detect human faces within an image and generate rectangle coordinates for each detected face.

Note

This feature is also offered by the dedicated Azure AI Face service. Use that alternative for more detailed face analysis, including face identification and head pose detection.

[!INCLUDE Sensitive attributes notice]

Face detection examples

The following example demonstrates the JSON response returned by Analyze API for an image containing a single human face.

Vision Analyze Woman Roof Face

{
    "faces": [
        {
            "age": 23,
            "gender": "Female",
            "faceRectangle": {
                "top": 45,
                "left": 194,
                "width": 44,
                "height": 44
            }
        }
    ],
    "requestId": "8439ba87-de65-441b-a0f1-c85913157ecd",
    "metadata": {
        "height": 200,
        "width": 300,
        "format": "Png"
    }
}

The next example demonstrates the JSON response returned for an image containing multiple faces.

Vision Analyze Family Photo Face

{
    "faces": [
        {
            "age": 11,
            "gender": "Male",
            "faceRectangle": {
                "top": 62,
                "left": 22,
                "width": 45,
                "height": 45
            }
        },
        {
            "age": 11,
            "gender": "Female",
            "faceRectangle": {
                "top": 127,
                "left": 240,
                "width": 42,
                "height": 42
            }
        },
        {
            "age": 37,
            "gender": "Female",
            "faceRectangle": {
                "top": 55,
                "left": 200,
                "width": 41,
                "height": 41
            }
        },
        {
            "age": 41,
            "gender": "Male",
            "faceRectangle": {
                "top": 45,
                "left": 103,
                "width": 39,
                "height": 39
            }
        }
    ],
    "requestId": "3a383cbe-1a05-4104-9ce7-1b5cf352b239",
    "metadata": {
        "height": 230,
        "width": 300,
        "format": "Png"
    }
}

Use the API

The face detection feature is part of the Analyze Image 3.2 API. You can call this API through a native SDK or through REST calls. Include Faces in the visualFeatures query parameter. Then, when you get the full JSON response, simply parse the string for the contents of the "faces" section.