FaceCompressor.compressAiFromDetectedFace Method

Module: FaceCompressor

Definition

Aligns and crops an already detected face into a Bioseal portrait (256x192), and compresses it into a fixed-size 500-byte template using a Deep Learning encoder model.

Unlike compress_ai, no face detection is performed: the caller provides the face, which avoids running the FaceDetector model a second time when it has already been run on the image.

Important

The input image must be in 24-bit BGR format. Loading the FaceCompressionEncoder model is required to use this function. Unlike compress_ai, no FaceDetector model needs to be loaded.

Uint8List compressAiFromDetectedFace(Image image, DetectedFace detectedFace)

Parameters

image Image
in Source image the face was detected in.

detectedFace DetectedFace
in Face to compress, as previously returned by a FaceDetector. It must be expressed in the coordinate system of ‘image’: if it was detected on a downscaled copy, rescale it back with DetectedFace.rescale() first.

Returns

Uint8List
Buffer that receives the 500-byte compressed face template.

Exceptions

An error has occurred during Face Library execution.