Face detection
Face detection is currently at the Preview stage.
This section describes how the face detection feature works in the service.
This feature lets you find human faces in an image. For example, you can use it to mark people in a photo or find all photos with portraits.
Note
This feature doesn't recognize faces. You will not be able to use it to find similar faces or identify a person.
Request format
In the feature type, specify FACE_DETECTION
:
{
"folderId": "b1gvmob95yysaplct532",
"analyze_specs": [{
"content": "iVBORw0KGgo...",
"features": [{
"type": "FACE_DETECTION"
}]
}]
}
Service response
The service searches for human faces in the image and marks them with rectangles. In the response, the service returns the coordinates of the rectangles for all detected faces:
If two faces are adjacent, the rectangles may intersect.
The coordinates of a rectangle are calculated from the upper-left corner and specified counterclockwise:
1←4
↓ ↑
2→3
Sample response with the coordinates of the detected face:
{
"results": [{
"results": [{
"faceDetection": {
"faces": [{
"boundingBox": {
"vertices": [{
"x": "410",
"y": "404"
},
{
"x": "410",
"y": "467"
},
{
"x": "559",
"y": "467"
},
{
"x": "559",
"y": "404"
}
]
}
}]
}
}]
}]
}
Image requirements
An image in a request must meet the following requirements:
-
Supported file formats: JPEG, PNG, PDF.
You specify the MIME type of the file in the
mime_type
property. The default isimage
. -
Maximum file size: 1 MB.
-
Image size should not exceed 20 MP (length x width).