Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion bot/recog/ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ def ocr(img, lang="ch"):
# ocr_line 文字识别图片,返回所有出现的文字
def ocr_line(img, lang="ch"):
ocr_result = ocr(img, lang)

if ocr_result == [None]:
ocr_result = [[[[28.0, 23.0], [84.0, 23.0], [84.0, 47.0], [28.0, 47.0]], ('0', 0.9994117617607117)]]
else :
ocr_result = ocr_result[0]

text = ""
ocr_result = ocr_result[0]
for text_info in ocr_result:
if len(text_info) > 0:
text += text_info[1][0]
print("提取的text_info:", text_info[1][0])
return text


Expand Down