feat: 新增42号人脸特征与72号B端关键点接口

This commit is contained in:
xsl
2026-11-07 20:35:55 +08:00
parent ccb9c142c4
commit c9a47a76c9
16 changed files with 983 additions and 25 deletions
+13
View File
@@ -216,3 +216,16 @@ def normalize_portrait(photo, landmarks, profile=None):
"reference_image_url": profile["reference_image_url"],
}
return image, moved, metadata
class NoPortraitFaceError(ValueError):
"""The portrait landmarker could not find a face."""
def prepare_portrait(photo):
"""Shared interface-52 preprocessing, including the same landmark model/profile."""
from .face_landmarks import get_landmarker
landmarks = get_landmarker().detect(cv2.cvtColor(photo, cv2.COLOR_BGR2RGB), include_iris=True)
if landmarks is None:
raise NoPortraitFaceError("未检出人脸")
return normalize_portrait(photo, landmarks)