添加图片清晰度测试,保存结果对照

This commit is contained in:
2025-04-01 15:11:40 +08:00
parent 3e9c0c99b9
commit 5287df4959
3 changed files with 14 additions and 2 deletions

View File

@@ -258,6 +258,18 @@ def information_extraction(ie, phrecs, identity):
session = MysqlSession()
session.add_all(zx_ie_results)
session.commit()
# 添加清晰度测试
if not better_image:
# 替换后图片默认清晰
clarity_result = image_util.parse_clarity(image)
unsharp_flag = 0 if (clarity_result[0] == 0 and clarity_result[1] >= 0.8) else 1
update_clarity = (update(ZxPhrec).where(ZxPhrec.pk_phrec == phrec.pk_phrec).values(
cfjaddress2=json.dumps(clarity_result),
unsharp_flag=unsharp_flag,
))
session.execute(update_clarity)
session.commit()
session.close()
result['ocr_text'] = ocr_text