From 9ce02a569e49fe21ddff01dc14261b3f0583789f Mon Sep 17 00:00:00 2001 From: kba Date: Fri, 23 Aug 2024 18:32:59 +0200 Subject: [PATCH] ocrd-tool: add "allow_enhancement" parameter --- qurator/eynollah/ocrd-tool.json | 31 ++++++++++++++++++------------- qurator/eynollah/processor.py | 6 +++--- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/qurator/eynollah/ocrd-tool.json b/qurator/eynollah/ocrd-tool.json index 8a2cb95..311ac21 100644 --- a/qurator/eynollah/ocrd-tool.json +++ b/qurator/eynollah/ocrd-tool.json @@ -29,11 +29,11 @@ "default": true, "description": "Try to detect all element subtypes, including drop-caps and headings" }, - "tables": { - "type": "boolean", - "default": false, - "description": "Try to detect table regions" - }, + "tables": { + "type": "boolean", + "default": false, + "description": "Try to detect table regions" + }, "curved_line": { "type": "boolean", "default": false, @@ -44,6 +44,11 @@ "default": false, "description": "check the resolution against the number of detected columns and if needed, scale the image up or down during layout detection (heuristic to improve quality and performance)" }, + "allow_enhancement": { + "type": "boolean", + "default": false, + "description": "if this parameter set to true, this tool would check that input image need resizing and enhancement or not." + }, "headers_off": { "type": "boolean", "default": false, @@ -51,14 +56,14 @@ } }, "resources": [ - { - "description": "models for eynollah (TensorFlow format)", - "url": "https://github.com/qurator-spk/eynollah/releases/download/v0.3.0/models_eynollah.tar.gz", - "name": "default", - "size": 1761991295, - "type": "archive", - "path_in_archive": "models_eynollah" - } + { + "description": "models for eynollah (TensorFlow format)", + "url": "https://github.com/qurator-spk/eynollah/releases/download/v0.3.0/models_eynollah.tar.gz", + "name": "default", + "size": 1761991295, + "type": "archive", + "path_in_archive": "models_eynollah" + } ] } } diff --git a/qurator/eynollah/processor.py b/qurator/eynollah/processor.py index c8748af..304524a 100644 --- a/qurator/eynollah/processor.py +++ b/qurator/eynollah/processor.py @@ -20,15 +20,15 @@ class EynollahProcessor(Processor): # page_image, _, _ = self.workspace.image_from_page(page, page_id, feature_filter='binarized') image_filename = self.workspace.download_file(next(self.workspace.mets.find_files(local_filename=page.imageFilename))).local_filename Eynollah( - dir_models=self.resolve_resource(self.parameter['models']), - allow_enhancement=False, + self.resolve_resource(self.parameter['models']), + self.logger, + allow_enhancement=self.parameter['allow_enhancement'], curved_line=self.parameter['curved_line'], full_layout=self.parameter['full_layout'], allow_scaling=self.parameter['allow_scaling'], headers_off=self.parameter['headers_off'], tables=self.parameter['tables'], override_dpi=self.parameter['dpi'], - logger=self.logger, pcgts=pcgts, image_filename=image_filename ).run()