Make rotation optional (for now it's off, possibly should be on)

This commit is contained in:
James R. Barlow
2016-02-07 15:43:45 -08:00
parent 8484caddfb
commit 178aee4687
+8
View File
@@ -140,6 +140,9 @@ metadata.add_argument(
preprocessing = parser.add_argument_group(
"Preprocessing options",
"Improve OCR quality and final image")
preprocessing.add_argument(
'-r', '--rotate-pages', action='store_true',
help="automatically rotate pages based on detected text orientation")
preprocessing.add_argument(
'-d', '--deskew', action='store_true',
help="deskew each page before performing OCR")
@@ -442,6 +445,7 @@ def split_pages(
os.path.basename(filename)[0:6] + alt_suffix))
@active_if(options.rotate_pages)
@transform(
input=split_pages,
filter=suffix('.page.pdf'),
@@ -476,6 +480,10 @@ def orient_page(
pdfinfo_lock):
page_pdf = next(ii for ii in infiles if ii.endswith('.page.pdf'))
if not options.rotate_pages:
re_symlink(page_pdf, output_file)
return
preview = next(ii for ii in infiles if ii.endswith('.preview.png'))
orient_conf = tesseract.get_orientation(