mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
fix
This commit is contained in:
parent
5c2a884b37
commit
bcf49962d9
@ -95,6 +95,9 @@ def ocr_end():
|
|||||||
|
|
||||||
|
|
||||||
def ocr_run(qimage: QImage):
|
def ocr_run(qimage: QImage):
|
||||||
|
image = qimage2binary(qimage, "PNG")
|
||||||
|
if not image:
|
||||||
|
return ""
|
||||||
global _nowuseocr, _ocrengine
|
global _nowuseocr, _ocrengine
|
||||||
|
|
||||||
use = None
|
use = None
|
||||||
@ -116,7 +119,7 @@ def ocr_run(qimage: QImage):
|
|||||||
aclass = importlib.import_module("ocrengines." + use).OCR
|
aclass = importlib.import_module("ocrengines." + use).OCR
|
||||||
_ocrengine = aclass(use)
|
_ocrengine = aclass(use)
|
||||||
_nowuseocr = use
|
_nowuseocr = use
|
||||||
text = _ocrengine._private_ocr(qimage2binary(qimage, "PNG"))
|
text = _ocrengine._private_ocr(image)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if isinstance(e, ArgsEmptyExc):
|
if isinstance(e, ArgsEmptyExc):
|
||||||
msg = str(e)
|
msg = str(e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user