ocrd-tool: add "allow_enhancement" parameter

refactoring-2024-08-merged
kba 4 months ago
parent 4a13781ef4
commit 9ce02a569e

@ -29,11 +29,11 @@
"default": true, "default": true,
"description": "Try to detect all element subtypes, including drop-caps and headings" "description": "Try to detect all element subtypes, including drop-caps and headings"
}, },
"tables": { "tables": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,
"description": "Try to detect table regions" "description": "Try to detect table regions"
}, },
"curved_line": { "curved_line": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,
@ -44,6 +44,11 @@
"default": false, "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)" "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": { "headers_off": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,
@ -51,14 +56,14 @@
} }
}, },
"resources": [ "resources": [
{ {
"description": "models for eynollah (TensorFlow format)", "description": "models for eynollah (TensorFlow format)",
"url": "https://github.com/qurator-spk/eynollah/releases/download/v0.3.0/models_eynollah.tar.gz", "url": "https://github.com/qurator-spk/eynollah/releases/download/v0.3.0/models_eynollah.tar.gz",
"name": "default", "name": "default",
"size": 1761991295, "size": 1761991295,
"type": "archive", "type": "archive",
"path_in_archive": "models_eynollah" "path_in_archive": "models_eynollah"
} }
] ]
} }
} }

@ -20,15 +20,15 @@ class EynollahProcessor(Processor):
# page_image, _, _ = self.workspace.image_from_page(page, page_id, feature_filter='binarized') # 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 image_filename = self.workspace.download_file(next(self.workspace.mets.find_files(local_filename=page.imageFilename))).local_filename
Eynollah( Eynollah(
dir_models=self.resolve_resource(self.parameter['models']), self.resolve_resource(self.parameter['models']),
allow_enhancement=False, self.logger,
allow_enhancement=self.parameter['allow_enhancement'],
curved_line=self.parameter['curved_line'], curved_line=self.parameter['curved_line'],
full_layout=self.parameter['full_layout'], full_layout=self.parameter['full_layout'],
allow_scaling=self.parameter['allow_scaling'], allow_scaling=self.parameter['allow_scaling'],
headers_off=self.parameter['headers_off'], headers_off=self.parameter['headers_off'],
tables=self.parameter['tables'], tables=self.parameter['tables'],
override_dpi=self.parameter['dpi'], override_dpi=self.parameter['dpi'],
logger=self.logger,
pcgts=pcgts, pcgts=pcgts,
image_filename=image_filename image_filename=image_filename
).run() ).run()

Loading…
Cancel
Save