From 0a7e5b42e81ed57d5a2993ee6ce5fdddc3b1a68a Mon Sep 17 00:00:00 2001 From: liuyebo <1515783401@qq.com> Date: Wed, 10 Jul 2024 10:52:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A4=9A=E8=A7=92=E5=BA=A6?= =?UTF-8?q?=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- photo_mask.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/photo_mask.py b/photo_mask.py index 6e04ed9..e28f68e 100644 --- a/photo_mask.py +++ b/photo_mask.py @@ -241,13 +241,18 @@ def photo_mask(pk_phhd, content): split_result = split_image(image) for img in split_result: angles = get_image_rotation_angles(img["img"]) - rotated_img = rotate_image(img["img"], int(angles[0])) + angle = int(angles[0]) + rotated_img = rotate_image(img["img"], angle) results = get_mask_layout(rotated_img, content) + if not results: + angle = int(angles[1]) + rotated_img = rotate_image(img["img"], angle) + results = get_mask_layout(rotated_img, content) for result in results: height, width = img["img"].shape[:2] center = (width / 2, height / 2) - result = rotate_rectangle(result, center, int(angles[0])) + result = rotate_rectangle(result, center, angle) result = ( result[0] + img["x_offset"], result[1] + img["y_offset"],