使用全局定义的ocr

This commit is contained in:
2024-07-17 14:10:55 +08:00
parent 681916ee36
commit 3a7addc733

View File

@@ -59,7 +59,7 @@ def find_box(content, layout, offset=0, length=None, improve=False, image_path=N
captured_image, offset_x, offset_y = image_util.expand_to_a4_size(captured_image, True)
cv2.imwrite(temp_file.name, captured_image)
try:
layouts = util.get_ocr_layout(OCR, temp_file.name)
layouts = OCR.parse({"doc": temp_file.name})["layout"]
except TypeError:
# 如果是类型错误,大概率是没识别到文字
layouts = []