From fe0e74ece8df46cf8ae6e3e7650143d5fcdf11f0 Mon Sep 17 00:00:00 2001 From: xsl Date: Thu, 30 Jul 2026 22:58:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8E=A5=E5=8F=A31/6=20=E6=A0=87?= =?UTF-8?q?=E6=B3=A8=E5=B1=82=E5=AD=97=E5=8F=B7=E4=B8=8A=E8=B0=83=E4=B8=80?= =?UTF-8?q?=E6=A1=A3=20+=20=E7=9C=89=E5=BF=83=E6=94=B9=E7=94=A8=209=20?= =?UTF-8?q?=E5=8F=B7=E7=82=B9=E5=AE=9A=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - annotation: 自适应字号系数 0.017→0.020(下限 8→9),标注文字更大更清晰 - measure: _brow_center 只取 FaceMesh 9 号点(眉间上点),不再与 151 取中点 Co-authored-by: Cursor --- face_analysis/annotation.py | 2 +- face_analysis/measure.py | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/face_analysis/annotation.py b/face_analysis/annotation.py index fd2ff03..e206fed 100644 --- a/face_analysis/annotation.py +++ b/face_analysis/annotation.py @@ -202,7 +202,7 @@ def create_annotated_image(image_bgr, measure_result, ear_mask=None, hair_mask=N # --- 自适应尺寸:字号/线宽/虚线/箭头按短边缩放 --- s = min(w, h) - font_size = max(8, round(s * 0.017)) # 字体更小 + font_size = max(9, round(s * 0.020)) # 字号上调一档 line_w = max(1, round(s * 0.0022)) dash_len = max(4, round(s * 0.008)) gap_len = max(2, round(dash_len * 0.7)) # 虚线更稠密(间隙<划线) diff --git a/face_analysis/measure.py b/face_analysis/measure.py index 5cfac61..975c5c4 100644 --- a/face_analysis/measure.py +++ b/face_analysis/measure.py @@ -12,7 +12,7 @@ from face_analysis.calibration import ( estimate_scale_factor, normalized_to_pixel, pixel_distance, _lm_list, ) from face_analysis.face_mesh_landmarks import ( - GLABELLA_9, GLABELLA_151, NOSE_BOTTOM, CHIN_TIP, + GLABELLA_9, NOSE_BOTTOM, CHIN_TIP, LEFT_EYE_OUTER, LEFT_EYE_INNER, RIGHT_EYE_INNER, RIGHT_EYE_OUTER, LEFT_CHEEK, RIGHT_CHEEK, LEFT_POSITION, RIGHT_POSITION, ) @@ -24,10 +24,8 @@ _TOP_RATIO = 0.22 / 0.28 # 顶庭 ÷ 中庭(≈ 0.786) def _brow_center(lm, w, h): - """眉心 = 索引 9 / 151 中点。""" - g9 = normalized_to_pixel(lm[GLABELLA_9], w, h) - g151 = normalized_to_pixel(lm[GLABELLA_151], w, h) - return (g9[0] + g151[0]) / 2, (g9[1] + g151[1]) / 2 + """眉心 = 索引 9(眉间上点)。""" + return normalized_to_pixel(lm[GLABELLA_9], w, h) def estimate_vertical_landmarks(landmarks, image_width, image_height):