From e1beedec96a8eac5bfe99638af505be73c4ed852 Mon Sep 17 00:00:00 2001 From: liuyebo <1515783401@qq.com> Date: Thu, 11 Jul 2024 18:09:38 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=E9=80=92=E5=BD=92=E6=AC=A1?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- photo_mask.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/photo_mask.py b/photo_mask.py index 6275a64..de1dc61 100644 --- a/photo_mask.py +++ b/photo_mask.py @@ -196,7 +196,7 @@ def zoom_box(box, ratio): return [x1, y1, x2, y2] -def find_box_of_content(content, layout, img_path): +def find_box_of_content(content, layout, img_path, improve=True): full_box = layout[0] x_len = full_box[2] - full_box[0] y_len = full_box[3] - full_box[1] @@ -232,7 +232,7 @@ def find_box_of_content(content, layout, img_path): ] is_abnormal = box[3] - box[1] < (box[2] - box[0]) * len(content) / 2 - if is_abnormal: + if is_abnormal and improve: # 比例异常,再次识别 image = cv2.imread(img_path) # 截图时偏大一点 @@ -250,7 +250,7 @@ def find_box_of_content(content, layout, img_path): raise e for layout in layouts: if content in layout[1]: - temp_box = find_box_of_content(content, layout, temp_file.name) + temp_box = find_box_of_content(content, layout, temp_file.name, False) if temp_box: box = [ temp_box[0] + capture_box[0],