LogoLogo
  • Introduction
  • Use Cases
  • Getting Started
    • Starting the server
    • Configuration
    • Licensing and Authorization
    • Using the Swagger Docs page
    • Authorization
  • OpenCV FR Server
    • Collection Management
    • Person Management
      • Bulk Enroll or Update Persons
    • Face Search
    • Face Compare
    • Liveness Detection
Powered by GitBook
On this page
Export as PDF
  1. OpenCV FR Server

Face Compare

PreviousFace SearchNextLiveness Detection

Last updated 2 months ago

Face Compare API allows you to compare two face images to determine if they correspond to the same person. A score higher than 0.7 is a good indicator that the two images belong to the same person.

You can also use a score of 0.67 or higher if the images are of the same person but taken at different times (years apart). The score is a number between 0 and 1, where 1 is a perfect match and 0 is a perfect mismatch. The score is calculated using a deep learning model trained on millions of face images.

If the liveness check is enabled in the provided server, you can check the liveness with the face compare feature in a single API call.

1:1 Face Compare

POST /compare

This endpoint is for 1:1 face compare, no person enrollment needed

Headers

Body

Name
Description

check_liveness

Required: yes

Type: boolean Default value: false Accepted values: false, true

Example:

face_base_64

Required: Yes

Type: string Example:

The image should contain a single face. Liveness will be checked on this face if enabled.

min_similarity_score

Required: Yes

Type: float Default value: 0.7 Example:

The default value is a good indicator to confirm the match. You can also use a score of 0.67 or higher if the images are of the same person but taken at different times (years apart).

ref_face_base_64

Required: Yes

Type: string Example:

Each reference image should contain a single face.

Response

{
  "is_match": true
}

A face could not be detected in the image(s)

{
  "code": "ERR_FACE_NOT_DETECTED",
  "message": "A face could not be detected in the image(s)."
}

Please use an API Key to access this endpoint

{
  "code": "ERR_API_KEY_NOT_PRESENT",
  "message": "The API key is missing from the request."
}

API Key is invalid. Please provide a valid API Key

{
  "code": "ERR_API_KEY_NOT_VALID",
  "message": "The API key is not valid."
}

The collection with the specified name does not exist

{
  "code": "ERR_NOT_FOUND",
  "message": "The requested entity could not be found."
}

Liveness error. The metadata contains the code that provides specifics about the error Common codes are: EYES_CLOSED || FACE_CLOSE_TO_BORDER || FACE_CROPPED || FACE_NOT_LIVE || FACE_TOO_CLOSE || FACE_ANGLE_TOO_LARGE || FACE_IS_OCCLUDED || FACE_NOT_FOUND || FACE_TOO_SMALL || LICENSE_ERROR || TOO_MANY_FACES || UNKNOWN_ERROR

{
  "code": "ERR_LIVENESS_ERROR",
  "message": "A liveness error occurred. Please check the supplied image and the error metadata.",
  "metadata": {
    "code": "FACE_NOT_LIVE || .. || UNKNOWN_ERROR"
  }
}

The images could not be decoded from base64

{
  "code": "ERR_BASE64_IMAGE_CANNOT_BE_DECODED",
  "message": "The posted Base64 image(s) could not be decoded as JPEG/PNG bytes."
}  

If set to true, the liveness check is performed during 1:N face search if the face is found. If no face is found, liveness is not checked. Check

"check_liveness": false,
"face_base_64": "U2Vjb25kIGltYWdl",
"min_similarity_score": 0.7
"ref_face_base_64": "Rmlyc3QgaW1hZ2U="
liveness image requirement here
Name
Value

Content-Type

application/json

x-api-key

<your-api-key>