From 6543e74deb3ed1ec5bffcc8d4d089bfb7f901702 Mon Sep 17 00:00:00 2001 From: Konstantin Baierer Date: Fri, 16 Oct 2020 12:52:16 +0200 Subject: [PATCH] remove "patches" parameter, always use_patches --- sbb_binarize/ocrd-tool.json | 5 ----- sbb_binarize/ocrd_cli.py | 7 +++---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/sbb_binarize/ocrd-tool.json b/sbb_binarize/ocrd-tool.json index 8a1b1b9..3095eeb 100644 --- a/sbb_binarize/ocrd-tool.json +++ b/sbb_binarize/ocrd-tool.json @@ -16,11 +16,6 @@ "default": "page", "description": "PAGE XML hierarchy level to operate on" }, - "patches": { - "description": "by setting this parameter to true you let the model to see the image in patches.", - "type": "boolean", - "default": true - }, "model": { "description": "models directory.", "type": "string", diff --git a/sbb_binarize/ocrd_cli.py b/sbb_binarize/ocrd_cli.py index 14b9b9c..9868c20 100644 --- a/sbb_binarize/ocrd_cli.py +++ b/sbb_binarize/ocrd_cli.py @@ -48,7 +48,6 @@ class SbbBinarizeProcessor(Processor): assert_file_grp_cardinality(self.output_file_grp, 1) oplevel = self.parameter['operation_level'] - use_patches = self.parameter['patches'] # pylint: disable=attribute-defined-outside-init model_path = self.parameter['model'] # pylint: disable=attribute-defined-outside-init binarizer = SbbBinarizer(model_dir=model_path) @@ -64,7 +63,7 @@ class SbbBinarizeProcessor(Processor): if oplevel == 'page': LOG.info("Binarizing on 'page' level in page '%s'", page_id) page_image, page_xywh, _ = self.workspace.image_from_page(page, page_id, feature_filter='binarized') - bin_image = cv2pil(binarizer.run(image=pil2cv(page_image), use_patches=use_patches)) + bin_image = cv2pil(binarizer.run(image=pil2cv(page_image), use_patches=True)) # update METS (add the image file): bin_image_path = self.workspace.save_image_file(bin_image, file_id + '.IMG-BIN', @@ -78,7 +77,7 @@ class SbbBinarizeProcessor(Processor): LOG.warning("Page '%s' contains no text/table regions", page_id) for region in regions: region_image, region_xywh = self.workspace.image_from_segment(region, page_image, page_xywh, feature_filter='binarized') - region_image_bin = cv2pil(binarizer.run(image=pil2cv(region_image), use_patches=use_patches)) + region_image_bin = cv2pil(binarizer.run(image=pil2cv(region_image), use_patches=True)) region_image_bin_path = self.workspace.save_image_file( region_image_bin, "%s_%s.IMG-BIN" % (file_id, region.id), @@ -93,7 +92,7 @@ class SbbBinarizeProcessor(Processor): LOG.warning("Page '%s' contains no text lines", page_id) for region_id, line in region_line_tuples: line_image, line_xywh = self.workspace.image_from_segment(line, page_image, page_xywh, feature_filter='binarized') - line_image_bin = cv2pil(binarizer.run(image=pil2cv(line_image), use_patches=use_patches)) + line_image_bin = cv2pil(binarizer.run(image=pil2cv(line_image), use_patches=True)) line_image_bin_path = self.workspace.save_image_file( line_image_bin, "%s_%s_%s.IMG-BIN" % (file_id, region_id, line.id),