更新OCR版本,Bata版,还不能上线

This commit is contained in:
2025-09-15 15:41:30 +08:00
parent d266c2828c
commit 670172e79e
9 changed files with 117 additions and 110 deletions

View File

@@ -62,7 +62,7 @@ def find_boxes(content, layout, offset=0, length=None, improve=False, image_path
captured_image, offset_x, offset_y = image_util.expand_to_a4_size(captured_image)
cv2.imwrite(temp_file.name, captured_image)
try:
layouts = util.get_ocr_layout(OCR, temp_file.name)
layouts, _ = util.get_ocr_layout(OCR, temp_file.name)
except TypeError:
# 如果是类型错误,大概率是没识别到文字
layouts = []
@@ -100,7 +100,7 @@ def get_mask_layout(image, name, id_card_num):
result = []
try:
try:
layouts = util.get_ocr_layout(OCR, temp_file.name)
layouts, _ = util.get_ocr_layout(OCR, temp_file.name)
# layouts = OCR.parse({"doc": temp_file.name})["layout"]
except TypeError:
# 如果是类型错误,大概率是没识别到文字
@@ -198,7 +198,7 @@ def mask_photo(img_url, name, id_card_num, color=(255, 255, 255)):
return do_mask, i
# 打开图片
image = image_util.read(img_url)
image, _ = image_util.read(img_url)
if image is None:
return False, image
original_image = image