没有识别结果也保存图片

This commit is contained in:
2024-07-01 09:46:31 +08:00
parent 203f1c4e4a
commit 9bd9c9d705

View File

@@ -78,6 +78,10 @@ def check_ie_result(pk_phhd):
font = ImageFont.truetype("./font/simfang.ttf", size=size)
ocr = session.query(ZxOcr.id, ZxOcr.content, ZxOcr.x_offset, ZxOcr.y_offset).filter(ZxOcr.pk_phrec == phrec.pk_phrec).all()
if not ocr:
os.makedirs(f"./check_result/{pk_phhd}/0", exist_ok=True)
image.save(f"./check_result/{pk_phhd}/0/{img_name}")
for id, group_results in groupby(ocr, key=lambda x: x.id):
draw = ImageDraw.Draw(image)
for ocr_item in group_results: