mirror of
https://github.com/qurator-spk/eynollah.git
synced 2025-06-09 12:19:54 +02:00
ocrd interface: add textline_light
This commit is contained in:
parent
87adc4b0c6
commit
39b16e5978
2 changed files with 11 additions and 1 deletions
|
@ -49,11 +49,16 @@
|
||||||
"default": false,
|
"default": false,
|
||||||
"description": "if this parameter set to true, this tool would check that input image need resizing and enhancement or not."
|
"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",
|
"type": "boolean",
|
||||||
"default": false,
|
"default": false,
|
||||||
"description": "lighter and faster but simpler method for main region detection and deskewing"
|
"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": {
|
"headers_off": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false,
|
"default": false,
|
||||||
|
|
|
@ -11,6 +11,10 @@ class EynollahProcessor(Processor):
|
||||||
def metadata_filename(self) -> str:
|
def metadata_filename(self) -> str:
|
||||||
return 'eynollah/ocrd-tool.json'
|
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:
|
def process_page_pcgts(self, *input_pcgts: Optional[OcrdPage], page_id: Optional[str] = None) -> OcrdPageResult:
|
||||||
assert input_pcgts
|
assert input_pcgts
|
||||||
assert input_pcgts[0]
|
assert input_pcgts[0]
|
||||||
|
@ -26,6 +30,7 @@ class EynollahProcessor(Processor):
|
||||||
allow_enhancement=self.parameter['allow_enhancement'],
|
allow_enhancement=self.parameter['allow_enhancement'],
|
||||||
curved_line=self.parameter['curved_line'],
|
curved_line=self.parameter['curved_line'],
|
||||||
light_version=self.parameter['light_mode'],
|
light_version=self.parameter['light_mode'],
|
||||||
|
textline_light=self.parameter['textline_light'],
|
||||||
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'],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue