Face detection
Warning
The Vision OCR features listed below are legacy features discontinued on May 14, 2024.
This section describes how the Yandex Vision OCR face detection feature works.
This feature allows you to detect human faces in an image. For example, you can use it to tag people in a photo or find all photos with portraits.
Note
This feature cannot 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": "b1gvmob95yys********",
"analyze_specs": [{
"content": "iVBORw0KGgo...",
"features": [{
"type": "FACE_DETECTION"
}]
}]
}
Service response
Yandex Vision OCR searches for human faces in the image and marks them with rectangles. In the response, it 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 top-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:
- The supported file formats are JPEG, PNG, and PDF. Specify the MIME type
of the file in themime_type
property. The default value isimage
. - The maximum file size is 1 MB.
- The image size should not exceed 20 MP (height × width).