On this page, find detailed information about faces comparison in Face SDK Web API.
The SDK can compare faces on the same image as well as on 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 index number of an image. 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.|
If set to true, the detection of all faces on the image is enabled.
If set to false, only one face on the image is detected: the most central one.
The type of the image, defines the way the comparison is performed. Should be set by a user.
If set to true, in Response, returns
If set to false,
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 on 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:
See the list of error codes below.
|detections||The array of detected faces. Includes
|faces||The array of detected faces. Includes
|faceIndex||The index number of each of the detected face. 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.|
|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.|
|rotationAngle||Angle of rotation of the face from the vertical axis, degrees.|
|thumbnail||Base64 cropped image that contains the vertically aligned face.|
|imageIndex||The same as the
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.
Here is a list of possible errors and their meanings:
|FR_FACE_NOT_DETECTED = 2||No faces are detected, most probably, the image does not contain faces.|
|FACER_NO_LICENSE = 200||There is no license.|
|FACER_IS_NOT_INITIALIZED = 201||The library is not initialized.|
|FACER_COMMAND_IS_NOT_SUPPORTED = 202||The command is not supported.|
|FACER_COMMAND_PARAMS_READ_ERROR = 203||The request is formed incorrectly.|
|FACER_LESS_THAN_TWO_IMAGES_IN_REQUEST = 224||There are fewer than two images selected.|
|FACER_OUTPUT_IS_NOT_DEFINED = 229||There is no memory allocated for the response.|
|FACER_IMAGES_COUNT_LIMIT_EXCEEDED = 238||The number of images of the same type for comparison is exceeded—you can’t compare more than two images of the same type.|