mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-01 01:54:13 +08:00
nores
This commit is contained in:
parent
b1cce57c3f
commit
c3949794ba
@ -90,6 +90,8 @@ def ocr_run(qimage: QImage):
|
|||||||
try:
|
try:
|
||||||
ocr_init()
|
ocr_init()
|
||||||
res = _ocrengine._private_ocr(image)
|
res = _ocrengine._private_ocr(image)
|
||||||
|
if not res:
|
||||||
|
return "", None
|
||||||
gobject.baseobject.maybesetocrresult(res)
|
gobject.baseobject.maybesetocrresult(res)
|
||||||
text = res["textonly"]
|
text = res["textonly"]
|
||||||
if res["isocrtranslate"]:
|
if res["isocrtranslate"]:
|
||||||
|
@ -129,7 +129,7 @@ class baseocr(commonbase):
|
|||||||
elif isinstance(text, (tuple, list)):
|
elif isinstance(text, (tuple, list)):
|
||||||
text = {"text": text}
|
text = {"text": text}
|
||||||
elif not text:
|
elif not text:
|
||||||
text = {}
|
return
|
||||||
boxs = text.get("box")
|
boxs = text.get("box")
|
||||||
texts = text.get("text")
|
texts = text.get("text")
|
||||||
if not boxs:
|
if not boxs:
|
||||||
|
@ -36,4 +36,6 @@ class OCR(baseocr):
|
|||||||
|
|
||||||
res = ""
|
res = ""
|
||||||
text = lens_object["data"][3][4][0]
|
text = lens_object["data"][3][4][0]
|
||||||
|
if len(text) == 0:
|
||||||
|
return
|
||||||
return text[0]
|
return text[0]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user