From 170cee937da1bc9466c9fa56f4c9c7e7690c3100 Mon Sep 17 00:00:00 2001 From: Adam Outler Date: Mon, 29 Aug 2022 21:57:50 -0400 Subject: Zoom and Enhance before reading text (#113) --- kvmd/apps/kvmd/tesseract.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'kvmd') 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: -- cgit v1.2.3