mirror of
https://github.com/qurator-spk/sbb_binarization.git
synced 2025-07-11 03:49:52 +02:00
image_from_segment: exclude already binarized images
Co-authored-by: Robert Sachunsky <38561704+bertsky@users.noreply.github.com>
This commit is contained in:
parent
12b44af329
commit
0650bad533
1 changed files with 3 additions and 3 deletions
|
@ -73,7 +73,7 @@ class SbbBinarizeProcessor(Processor):
|
||||||
|
|
||||||
if oplevel == 'page':
|
if oplevel == 'page':
|
||||||
LOG.info("Binarizing on 'page' level in page '%s'", page_id)
|
LOG.info("Binarizing on 'page' level in page '%s'", page_id)
|
||||||
page_image, page_xywh, _ = self.workspace.image_from_page(page, page_id)
|
page_image, page_xywh, _ = self.workspace.image_from_page(page, page_id, feature_filter='binarized')
|
||||||
bin_image = self._run_binarizer(page_image)
|
bin_image = self._run_binarizer(page_image)
|
||||||
# update METS (add the image file):
|
# update METS (add the image file):
|
||||||
bin_image_path = self.workspace.save_image_file(bin_image,
|
bin_image_path = self.workspace.save_image_file(bin_image,
|
||||||
|
@ -88,7 +88,7 @@ class SbbBinarizeProcessor(Processor):
|
||||||
LOG.warning("Page '%s' contains no text/table regions", page_id)
|
LOG.warning("Page '%s' contains no text/table regions", page_id)
|
||||||
|
|
||||||
for region in regions:
|
for region in regions:
|
||||||
region_image, region_xywh = self.workspace.image_from_segment(region, page_image, page_xywh)
|
region_image, region_xywh = self.workspace.image_from_segment(region, page_image, page_xywh, feature_filter='binarized')
|
||||||
|
|
||||||
if oplevel == 'region':
|
if oplevel == 'region':
|
||||||
region_image_bin = self._run_binarizer(region_image)
|
region_image_bin = self._run_binarizer(region_image)
|
||||||
|
@ -105,7 +105,7 @@ class SbbBinarizeProcessor(Processor):
|
||||||
if not lines:
|
if not lines:
|
||||||
LOG.warning("Page '%s' region '%s' contains no text lines", page_id, region.id)
|
LOG.warning("Page '%s' region '%s' contains no text lines", page_id, region.id)
|
||||||
for line in lines:
|
for line in lines:
|
||||||
line_image, line_xywh = self.workspace.image_from_segment(line, page_image, page_xywh)
|
line_image, line_xywh = self.workspace.image_from_segment(line, page_image, page_xywh, feature_filter='binarized')
|
||||||
line_image_bin = self._run_binarizer(line_image)
|
line_image_bin = self._run_binarizer(line_image)
|
||||||
line_image_bin_path = self.workspace.save_image_file(
|
line_image_bin_path = self.workspace.save_image_file(
|
||||||
line_image_bin,
|
line_image_bin,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue