Skip to main content

Module alignment

Module alignment 

Source
Expand description

Face alignment via 5-point similarity transform.

Maps detected 5-point landmarks (left eye, right eye, nose, left mouth, right mouth) onto the canonical InsightFace 112x112 template via a least-squares similarity transform (uniform scale + rotation + translation), then bilinearly samples the source image to produce a 112x112 RGB crop ready for the embedder.

Replaces the naive eye-center-crop approach which did not correct for head tilt and produced different embeddings for the same face at small rotations.

Structs§

SimilarityTransform
2x3 affine transform: q = M * [p_x, p_y, 1]^T.

Constants§

CANONICAL_TEMPLATE_112
InsightFace canonical 5-point template (ArcFace / GLinTR) at 112x112. Order: left eye, right eye, nose, left mouth, right mouth.

Functions§

align_face_112
Warp a source image onto the 112x112 canonical face template using the given 5-point landmarks. Bilinear sampling, black fill for out-of-bounds.
estimate_similarity
Least-squares similarity transform from source -> target (both 5 points).