From 06b637544aff723e3ff8cc998826f06d946ae984 Mon Sep 17 00:00:00 2001 From: liuyebo <1515783401@qq.com> Date: Wed, 28 Aug 2024 15:25:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=8E=E5=88=86=E5=89=B2=E5=90=8E=E5=B0=B1?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E5=9B=BE=E7=89=87=E6=98=AF=E5=90=A6=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- photo_review/auto_photo_review.py | 2 ++ util/image_util.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/photo_review/auto_photo_review.py b/photo_review/auto_photo_review.py index a9b1317..7596e57 100644 --- a/photo_review/auto_photo_review.py +++ b/photo_review/auto_photo_review.py @@ -92,6 +92,8 @@ def information_extraction(ie, phrecs, identity): zx_ie_results = [] split_results = image_util.split(dewarped_image) for split_result in split_results: + if split_result["img"] is None or split_result["img"].size == 0: + continue rotated_img = image_util.rotate(split_result["img"], int(angles[0])) ie_results = [{"result": ie_temp_image(ie, OCR, rotated_img), "angle": angles[0]}] if not ie_results[0]["result"] or len(ie_results[0]["result"]) < len(ie.kwargs.get("schema")): diff --git a/util/image_util.py b/util/image_util.py index ec80cdf..0b30cc0 100644 --- a/util/image_util.py +++ b/util/image_util.py @@ -111,7 +111,7 @@ def rotate(image, angle): :param angle: 逆时针旋转角度 :return: 旋转后的图片NumPy数组 """ - if angle == 0 or image is None or image.size == 0: + if angle == 0: return image height, width = image.shape[:2] if angle == 180: