extractFaceCrop

suspend fun extractFaceCrop(portrait: ByteString): ByteString

Extracts the detected, aligned face crop image that is matched against.

Detects the face via BlazeFace, aligns the eyes horizontally, crops, and scales to the model's square input resolution (typically 112x112), returning the encoded PNG bytes.

Return

the encoded PNG bytes of the aligned face crop.

Parameters

portrait

encoded image bytes (e.g. JPEG or PNG).

Throws

if no face is detected in portrait or decoding fails.

if crop extraction fails.

if face matching is not supported on this platform.