From 6e8113b3ff56d8d660d17dbf9c9fbd1450925b08 Mon Sep 17 00:00:00 2001 From: xsl Date: Tue, 23 Jun 2026 22:46:24 +0800 Subject: [PATCH] save code --- face_analysis/annotation.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/face_analysis/annotation.py b/face_analysis/annotation.py index 1bb40ff..dd7b335 100644 --- a/face_analysis/annotation.py +++ b/face_analysis/annotation.py @@ -161,9 +161,9 @@ def create_annotated_image(image_bgr, measure_result, hair_mask=None): s = min(w, h) font_size = max(11, round(s * 0.026)) # 字体更小 line_w = max(1, round(s * 0.0022)) - dash_len = max(4, round(s * 0.013)) - gap_len = max(4, round(dash_len * 1.2)) # 虚线更稀疏(间隙>划线) - arrow_size = max(2, round(s * 0.007)) # 箭头更小 + dash_len = max(4, round(s * 0.008)) + gap_len = max(2, round(dash_len * 0.7)) # 虚线更稠密(间隙<划线) + arrow_size = max(2, round(s * 0.0045)) # 箭头更小 pad = max(4, round(s * 0.012)) # 文字与线的间距 line_h = font_size + max(2, round(font_size * 0.18)) @@ -206,7 +206,7 @@ def create_annotated_image(image_bgr, measure_result, hair_mask=None): # --- 3a. 横线右侧:线名(头顶/发际线/眉心/鼻翼下缘/下巴尖),文字在线上方 --- name_x = fx1 + pad - name_gap = max(2, round(pad * 0.5)) # 文字底部到线的间距 + name_gap = max(2, round(pad * 1.6)) # 文字底部到线的间距(再上移) for i, name in enumerate(order): text = _LINE_NAMES[name] tw, th = _text_size(draw, text, font) @@ -237,8 +237,8 @@ def create_annotated_image(image_bgr, measure_result, hair_mask=None): draw.text((max(2, label_right - vw), y_top + line_h), val, fill=LINE_COLOR, font=font) # --- 4. 七眼每段宽度:上下交替(上 3 / 下 4),横向虚线双箭头 + 数值(无 cm) --- - # 文字与箭头间留出「箭头高度 + pad」,避免文字压住箭头 - txt_off = arrow_size + pad + # 文字与箭头间留更大间距,避免文字压住箭头 + txt_off = arrow_size + pad * 2 y_arrow_top = max(txt_off + font_size + 2, fy0 - pad - arrow_size) y_arrow_bot = min(h - txt_off - font_size - 2, fy1 + pad + arrow_size) for i in range(len(xs) - 1):