Replace leptonica deskew with tesseract find skew and pillow rotate
Also rebuild the cache.
This commit is contained in:
@@ -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)):
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user