Calibration
Faces differ more than any fixed threshold allows. Resting eyes vary by a factor of two between people, glasses change how open they look, and a laptop webcam a metre away sees a different face from a phone at arm’s length. So Mimic never asks “is this eye less than X open?”. It asks “is this eye much less open than this player’s resting eye?”.
Calibration measures that resting face. Until it finishes, only face.found, face.lost and expression.match can fire.
What happens
Section titled “What happens”The player looks at the camera with a relaxed face for about 2.5 seconds of good frames. Calibration is quality-gated, not a stopwatch: a frame only counts when it is clearly a resting face, so it can’t finish with the eyes shut or mid-grin. Each frame gets a verdict:
| Quality | Meaning | A prompt that works |
|---|---|---|
noFace |
No face in the frame | “Look at the camera” |
offCenter |
Outside your framing guide (if you set one) | “Centre your face” |
eyesClosed |
Eyes shut for longer than a blink | “Eyes open” |
mouthMoving |
Smiling, talking or opening the mouth | “Relax your mouth” |
headMoving |
Head moving away from where it settled | “Hold your head still” |
good |
Counting | “Hold still…” |
Natural blinks during calibration are forgiven and counted, which is a nice thing to show the player: proof the camera is watching.
If too much time passes without enough good frames, calibration fails and reports the quality that cost the most time, so you can tell the player exactly what to fix.
Storing the profile
Section titled “Storing the profile”The result is a CalibrationProfile: plain JSON with the resting eye openness (per eye), gaze, mouth shape, brow height and head pose. Store it per player and pass it back to skip calibration next session. A profile taken on one platform loads on another.
Recalibrate when the player changes, the lighting changes a lot, or they put glasses on or take them off. Offering a “recalibrate” button is cheap.
During play
Section titled “During play”Eyes relax over a session; people often settle to around 80% of how open their eyes were while calibrating. Mimic follows that slowly from frames where the eyes are clearly open, so blink detection keeps working without a recalibration. Blinks and held winks don’t move it.