Replace leptonica deskew with tesseract find skew and pillow rotate

Also rebuild the cache.
This commit is contained in:
James R. Barlow
2021-11-12 16:35:08 -08:00
parent 25d046ae95
commit a55ab05d16
135 changed files with 4253 additions and 4016 deletions
+5
View File
@@ -181,6 +181,11 @@ class CacheOcrEngine(TesseractOcrEngine):
with patch('ocrmypdf._exec.tesseract.run', new=partial(cached_run, options)):
return TesseractOcrEngine.get_orientation(input_file, options)
@staticmethod
def get_deskew(input_file, options) -> float:
with patch('ocrmypdf._exec.tesseract.run', new=partial(cached_run, options)):
return TesseractOcrEngine.get_deskew(input_file, options)
@staticmethod
def generate_hocr(input_file, output_hocr, output_text, options):
with patch('ocrmypdf._exec.tesseract.run', new=partial(cached_run, options)):
+4
View File
@@ -79,6 +79,10 @@ class NoopOcrEngine(OcrEngine):
def get_orientation(input_file, options):
return OrientationConfidence(angle=0, confidence=0.0)
@staticmethod
def get_deskew(input_file, options):
return 0.0
@staticmethod
def generate_hocr(input_file, output_hocr, output_text, options):
with Image.open(input_file) as im, open(