mirror of
https://github.com/qurator-spk/eynollah.git
synced 2025-06-09 20:29:55 +02:00
adding extracting images only in cli
This commit is contained in:
parent
6aac0b8faf
commit
364ccacab2
2 changed files with 13 additions and 4 deletions
|
@ -67,6 +67,12 @@ from qurator.eynollah.eynollah import Eynollah
|
||||||
is_flag=True,
|
is_flag=True,
|
||||||
help="If set, will plot intermediary files and images",
|
help="If set, will plot intermediary files and images",
|
||||||
)
|
)
|
||||||
|
@click.option(
|
||||||
|
"--extract_only_images/--disable-extracting_only_images",
|
||||||
|
"-eoi/-noeoi",
|
||||||
|
is_flag=True,
|
||||||
|
help="If a directory is given, only images in documents will be cropped and saved there and the other processing will not be done",
|
||||||
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"--allow-enhancement/--no-allow-enhancement",
|
"--allow-enhancement/--no-allow-enhancement",
|
||||||
"-ae/-noae",
|
"-ae/-noae",
|
||||||
|
@ -148,6 +154,7 @@ def main(
|
||||||
save_layout,
|
save_layout,
|
||||||
save_deskewed,
|
save_deskewed,
|
||||||
save_all,
|
save_all,
|
||||||
|
extract_only_images,
|
||||||
save_page,
|
save_page,
|
||||||
enable_plotting,
|
enable_plotting,
|
||||||
allow_enhancement,
|
allow_enhancement,
|
||||||
|
@ -175,12 +182,16 @@ def main(
|
||||||
if textline_light and not light_version:
|
if textline_light and not light_version:
|
||||||
print('Error: You used -tll to enable light textline detection but -light is not enabled')
|
print('Error: You used -tll to enable light textline detection but -light is not enabled')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
if extract_only_images and not ( save_images and enable_plotting):
|
||||||
|
print('Error: You used -eoi to enable extract images only mode but did not enable plotting with -ep and providing an output directory with -si')
|
||||||
|
sys.exit(1)
|
||||||
eynollah = Eynollah(
|
eynollah = Eynollah(
|
||||||
image_filename=image,
|
image_filename=image,
|
||||||
dir_out=out,
|
dir_out=out,
|
||||||
dir_in=dir_in,
|
dir_in=dir_in,
|
||||||
dir_models=model,
|
dir_models=model,
|
||||||
dir_of_cropped_images=save_images,
|
dir_of_cropped_images=save_images,
|
||||||
|
extract_only_images=extract_only_images,
|
||||||
dir_of_layout=save_layout,
|
dir_of_layout=save_layout,
|
||||||
dir_of_deskewed=save_deskewed,
|
dir_of_deskewed=save_deskewed,
|
||||||
dir_of_all=save_all,
|
dir_of_all=save_all,
|
||||||
|
|
|
@ -148,6 +148,7 @@ class Eynollah:
|
||||||
dir_out=None,
|
dir_out=None,
|
||||||
dir_in=None,
|
dir_in=None,
|
||||||
dir_of_cropped_images=None,
|
dir_of_cropped_images=None,
|
||||||
|
extract_only_images=False,
|
||||||
dir_of_layout=None,
|
dir_of_layout=None,
|
||||||
dir_of_deskewed=None,
|
dir_of_deskewed=None,
|
||||||
dir_of_all=None,
|
dir_of_all=None,
|
||||||
|
@ -195,7 +196,7 @@ class Eynollah:
|
||||||
self.allow_scaling = allow_scaling
|
self.allow_scaling = allow_scaling
|
||||||
self.headers_off = headers_off
|
self.headers_off = headers_off
|
||||||
self.light_version = light_version
|
self.light_version = light_version
|
||||||
self.extract_only_images = True
|
self.extract_only_images = extract_only_images
|
||||||
self.ignore_page_extraction = ignore_page_extraction
|
self.ignore_page_extraction = ignore_page_extraction
|
||||||
self.pcgts = pcgts
|
self.pcgts = pcgts
|
||||||
if not dir_in:
|
if not dir_in:
|
||||||
|
@ -2953,9 +2954,6 @@ class Eynollah:
|
||||||
Get image and scales, then extract the page of scanned image
|
Get image and scales, then extract the page of scanned image
|
||||||
"""
|
"""
|
||||||
self.logger.debug("enter run")
|
self.logger.debug("enter run")
|
||||||
|
|
||||||
self.extract_only_images = True
|
|
||||||
|
|
||||||
|
|
||||||
t0_tot = time.time()
|
t0_tot = time.time()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue