FaceCaptureService class

Orchestrates the "capture a still photo → detect → quality-gate → align → embed → match/register" flow — the counterpart to LivenessController's live-frame identity pipeline, for apps that want enrollment/verification from a single captured picture rather than a full liveness session.

Composes existing services without duplicating their logic: face detection (FaceDetectorService/YoloFaceDetectorService via FaceDetectorBackend), alignment (FacePreprocessor, through FaceIdentityService.computeEmbeddingFromRgb), and matching (FaceIdentityService.identifyFromEmbeddings).

Constructors

FaceCaptureService({required FaceIdentityService faceIdentity, FaceDetectorBackend backend = FaceDetectorBackend.mlkit, double brightnessMin = 0.12, double brightnessMax = 0.92, double blurThreshold = 80.0, double faceTooFarRatio = 0.015, double faceTooCloseRatio = 0.70, double detectionConfidenceThreshold = 0.5})

Properties

backend FaceDetectorBackend
final
blurThreshold double
final
brightnessMax double
final
brightnessMin double
final
detectionConfidenceThreshold double
final
faceTooCloseRatio double
final
faceTooFarRatio double
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

captureAndIdentify(File imageFile, {FaceIdMode? modeOverride}) Future<FaceCaptureResult>
Runs the full capture → identify pipeline on a photo file (e.g. from camera.takePicture()).
dispose() Future<void>
initialize({void onYoloModelDownloadProgress(double)?}) Future<void>
Loads the selected detector backend. Call once before captureAndIdentify. (ML Kit's detector initialises instantly; YOLOv8 downloads its model on first use — pass onYoloModelDownloadProgress to surface that.)
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited