video_helper.faces.align module

video_helper.faces.align

Mouth-ROI extraction for the active-speaker (lip) stream.

Recognition alignment (the canonical 112×112 face crop) is handled inside cv2.FaceRecognizerSF.alignCrop — see video_helper.faces.recognize. What ASD additionally needs is a stable crop centred on the lips, derived here from the two mouth-corner landmarks so the articulatory signal dominates.

video_helper.faces.align.mouth_openness(frame_bgr, face)[source]

Cheap vertical-mouth-opening proxy in [0, 1] (weights-free ASD cue).

Uses the vertical gradient energy inside the lip ROI, normalised by the ROI size, as a stand-in for mouth opening/closing. It is deliberately crude — the lip-motion ASD proxy scores variance over time of this signal, not its absolute value, so only relative movement matters.

Parameters:
  • frame_bgr (ndarray)

  • face (Face)

Return type:

float

video_helper.faces.align.mouth_roi(frame_bgr, face, *, size=112, pad=1.6)[source]

Crop a square, lip-centred grayscale ROI for the ASD visual stream.

The crop is centred on the mouth-corner midpoint, sized to pad times the inter-corner distance (so the whole mouth plus a margin is captured), clamped to the frame, and resized to size``×``size. Returns a (size, size) uint8 grayscale array (zeros if the face falls entirely off-frame).

Parameters:
Return type:

ndarray