Skip to content

Commit

Permalink
ocrd interface: add textline_light
Browse files Browse the repository at this point in the history
  • Loading branch information
kba committed Aug 24, 2024
1 parent 87adc4b commit cc0e8e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion qurator/eynollah/ocrd-tool.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,16 @@
"default": false,
"description": "if this parameter set to true, this tool would check that input image need resizing and enhancement or not."
},
"light mode": {
"light_mode": {
"type": "boolean",
"default": false,
"description": "lighter and faster but simpler method for main region detection and deskewing"
},
"textline_light": {
"type": "boolean",
"default": false,
"description": "if this parameter set to true, this tool will try to return contoure of textlines instead of rectangle bounding box of textline with a faster method."
},
"headers_off": {
"type": "boolean",
"default": false,
Expand Down
4 changes: 4 additions & 0 deletions qurator/eynollah/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class EynollahProcessor(Processor):
def metadata_filename(self) -> str:
return 'eynollah/ocrd-tool.json'

def setup(self) -> None:
if self.parameter['textline_light'] and not self.parameter['light_mode']:
raise ValueError("Error: You set parameter 'textline_light' to enable light textline detection but parameter 'light_mode' is not enabled")

def process_page_pcgts(self, *input_pcgts: Optional[OcrdPage], page_id: Optional[str] = None) -> OcrdPageResult:
assert input_pcgts
assert input_pcgts[0]
Expand Down

0 comments on commit cc0e8e3

Please sign in to comment.