使用全局定义的ocr
This commit is contained in:
@@ -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)
|
captured_image, offset_x, offset_y = image_util.expand_to_a4_size(captured_image, True)
|
||||||
cv2.imwrite(temp_file.name, captured_image)
|
cv2.imwrite(temp_file.name, captured_image)
|
||||||
try:
|
try:
|
||||||
layouts = util.get_ocr_layout(OCR, temp_file.name)
|
layouts = OCR.parse({"doc": temp_file.name})["layout"]
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# 如果是类型错误,大概率是没识别到文字
|
# 如果是类型错误,大概率是没识别到文字
|
||||||
layouts = []
|
layouts = []
|
||||||
|
|||||||
Reference in New Issue
Block a user