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§
- Similarity
Transform - 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).