On this page, find detailed information about faces comparison in Face SDK Web API.
To perform a comparison of faces in the same image or in two different images, use POST
The SDK can compare faces in the same image or in two different images. This is defined by the
The request contains the following parameters:
└── images | └── data | └── index | └── detectAll | └── type └── thumbnails
|images||The array of all images included in the comparison:
|index||The image index number.|
Whether to detect all faces in the image. If set to false, only one face is detected: the most central one.
The type of the image, defines the way the comparison is performed. Should be set by a user.
Whether to return
Before comparing faces, the Face SDK detects them. The detection result is displayed in the
Each face is identified by two parameters:
faceIndex (the index number of the face) and
imageIndex (the index number of the image on which the face is detected).
So, if there are two images each of which has two faces on them and all index numbers start from 0, the parameters will be the following:
First face in the first image:
"faceIndex": 0, "imageIndex": 0
Second face in the first image:
"faceIndex": 1, "imageIndex": 0
First face of the second image:
"faceIndex": 0, "imageIndex": 1
Second face in the second image:
"faceIndex": 1, "imageIndex": 1
The response contains the following parameters:
└── ErrorCode └── code └── detections | └── faces | | └── faceIndex | | └── landmarks | | └── roi | | └── rotationAngle | | └── thumbnail | └── imageIndex | └── status └── results | └── first | └── firstFaceIndex | └── firstIndex | └── score | └── second | └── secondFaceIndex | └── secondIndex | └── similarity
The result code the SDK returns.
If everything is OK, the result looks as follows:
|detections||The array of detected faces. Includes
|faces||The array of detected faces. Includes
|faceIndex||The detected face index number.|
|landmarks||Returns absolute coordinates (x,y) of five points of each detected face: left eye, right eye, nose, left point of lips, right point of lips.|
|roi||The rectangular area of a detected face that is represented by a set of four elements: the X and Y coordinates of the top-left point, and the width and height dimensions of the rectangle.|
|rotationAngle||Angle of rotation of the face from the vertical axis, degrees.|
|thumbnail||Base64 cropped image that contains the vertically aligned face.|
|imageIndex||The image index number. Can be given; if not given, the index numbers are set automatically starting from 0. All index numbers must be whole and unique—not repeated.|
Returns the same value as
|results||The comparison results include
|score||A dimensionless number that shows how similar the compared faces are. 0—absolutely identical faces.|
The detected faces similarity, %.
100%—absolutely identical faces, 0%—absolutely not identical.
To compare several images from a document and look up a person in the database in one request, use POST
/api/match_and_search. In this case, the calculation of the discriptor will be performed only once, as opposed to using two requests for the same operation.
Find comprehensive information in OpenAPI documentation.