Face detection may be performed in two ways:
- By the selected parameters when you add them manually to the request. In this case, the configuration is not saved and can not be automatically repeated.
- By a processing scenario that already includes certain parameters. You can use the predefined scenarios or add a custom one.
For face detection, the following scenarios are available:
CropCentralFacereturns the cropped portrait of the person whose face is the most central in the photo by the set
CropAllFacesreturns the cropped portraits of all the people in the image by the set
Thumbnailreturns the cropped portrait of the person whose face is the most central in the photo in the original size.
The SDK uses the following parameters to detect faces, check face image quality, and evaluate attributes.
└── image └── thumbnails └── processParam └── scenario └── onlyCentralFace └── outputImageParams | └── backgroundColor | └── crop | └── type | └── size | └── padColor | └── returnOriginalRect └── quality | └── backgroundMatchColor | └── config | └── name | └── range └── attributes | └── config | └── name
|image||The Base64 image.|
If set to true, returns
If set to false,
|processParam||The processing parameters.|
|scenario||The name of the scenario. If applied and the scenario is found, the settings are set automatically for the face image quality assessment and any other parameters mentioned in the request are ignored.
If not set, left empty, or the name is not found, the processing is performed according to the set parameters.
|onlyCentralFace||Whether to process only the central face on the image or all the faces. If set to true, the SDK detects and processes only one—the most central face in the image. If set to false, the SDK processess all faces in the image.|
|outputImageParams||If set, the uploaded image is processed according to the indicated settings.|
|background||If set, the background color is replaced. Defines the RGB value for the background color: the silhouette of a person is cut out and the background is filled with this color.|
|crop||If set, the Base64 of an aligned and cropped portrait is returned in the
If there are more than one face in the photo, all the faces will be detected and processed, and separate portraits for each face will be returned. So, if there were five people in the photo, you'll get five processed portraits. Each portrait can be downloaded.
|type||The aspect ratio according to which alignment is performed. See the FaceImageQualityAlignType enum.|
|size||The resize value in case
|padColor||When an image is aligned by
|returnOriginalRect||If set, the coordinates of the rectangle with the face in the original image prepared for the face crop are returned in the
|quality||If set, the portrait quality assessment is performed, find the detailed info on the Face Image Quality Assessment page.|
|attributes||If set, the selected attributes are checked, find the detailed info on the Attributes Detection page.|
The response returns the list of parameters with a processing status for the corresponding ones. The list of returned parameters is defined by the set configuration.
└── code └── msg └── results └── detections | └── attributes | | └── details | | | └── name | | | └── value | | | └── confidence | └── crop | └── landmarks | └── originalRect | └── quality | | └── details | | | └── groupId | | | └── name | | | └── range | | | └── status | | | └── value | | └── detailsGroups | | | └── compliantCount | | | └── groupId | | | └── name | | | └── totalCount | | └── nonCompliant | | └── score | | └── timer | └── roi └── detectorType └── landmarksType └── scenario └── timer
|code||The code the SDK returns.|
The message result.
If everything is OK, the result looks as follows:
See the list of error codes.
|results||The returned results.|
|detections||The array of performed checks.|
|attributes||The array of the checked attributes, see details in the Attributes response section.|
|crop||Base64 of the aligned and cropped portrait.|
|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.|
|quality||The array for the face image quality assessment, see the portrait quality assessment response.|
|roi||Сoordinates of the rectangular area that contains the face relative to the overall image: x, y, height, width.|
|detectorType||The type of detector, for internal use and can not be changed.|
|landmarksType||The type of landmarks identification, for internal use and can not be changed.|
|scenario||The used processing scenario if was set.|
|timer||The total time.|
|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.|