From e3bd3a89169f412930b8e096076ead502321ecd4 Mon Sep 17 00:00:00 2001 From: xsl Date: Tue, 4 Aug 2026 22:25:25 +0800 Subject: [PATCH] save --- face_analysis/annotation.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/face_analysis/annotation.py b/face_analysis/annotation.py index e206fed..3bc6483 100644 --- a/face_analysis/annotation.py +++ b/face_analysis/annotation.py @@ -259,6 +259,18 @@ def create_annotated_image(image_bgr, measure_result, ear_mask=None, hair_mask=N draw = ImageDraw.Draw(canvas) font = _load_font(font_size) + # --- 2b. 每条横线在「中间线段」(两内眼角之间)中点画原点突出 --- + # 注意:原点不在整条线的中点 face_cx,而在被竖线切出的中间段(左内眼角↔右内眼角) + # 的正中,即脸的竖直中轴附近、两内眼角连线中点。 + li_x = pts["left_inner"][0] + ri_x = pts["right_inner"][0] + dot_cx = (li_x + ri_x) / 2 + dot_r = max(2, round(s * 0.0045)) # 原点半径,与 arrow_size 同档自适应 + for cy in ys: + x0, y0 = dot_cx - dot_r, cy - dot_r + x1, y1 = dot_cx + dot_r, cy + dot_r + draw.ellipse((x0, y0, x1, y1), fill=LINE_COLOR) + # --- 3a. 横线右侧:线名(头顶/发际线/眉心/鼻翼下缘/下巴尖),文字纵向居中对齐到线 --- name_x = fx1 + over + pad # 移到横线右端外侧一点(往右) for i, name in enumerate(order):