diff options
author | Adam Outler <[email protected]> | 2022-08-29 21:57:50 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2022-08-30 04:57:50 +0300 |
commit | 170cee937da1bc9466c9fa56f4c9c7e7690c3100 (patch) | |
tree | 269ba4acd18617d8ea14a624ce7152d0a6e297f7 /kvmd | |
parent | f16774203d190f61da32122158b227ac898bfa0f (diff) |
Zoom and Enhance before reading text (#113)
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/apps/kvmd/tesseract.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kvmd/apps/kvmd/tesseract.py b/kvmd/apps/kvmd/tesseract.py index ae40c756..a5292439 100644 --- a/kvmd/apps/kvmd/tesseract.py +++ b/kvmd/apps/kvmd/tesseract.py @@ -41,6 +41,7 @@ from typing import Set from typing import Generator from typing import Optional +from PIL import ImageOps from PIL import Image as PilImage from ...errors import OperationError @@ -149,6 +150,8 @@ class TesseractOcr: image.close() image = image_cropped + ImageOps.grayscale(image) + image=image.resize((int(image.size[0]*2),int(image.size[1]*2)), PilImage.BICUBIC) _libtess.TessBaseAPISetImage(api, image.tobytes("raw", "RGB"), image.width, image.height, 3, image.width * 3) text_ptr = None try: |