mirror of
https://github.com/qurator-spk/sbb_textline_detection.git
synced 2025-06-30 22:20:00 +02:00
⚙ sbb_textline_detector: Use click instead of argparse
This commit is contained in:
parent
91fb2e01a6
commit
561a6f8a90
2 changed files with 9 additions and 12 deletions
|
@ -23,7 +23,7 @@ from scipy.signal import find_peaks
|
||||||
from scipy.ndimage import gaussian_filter1d
|
from scipy.ndimage import gaussian_filter1d
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
import warnings
|
import warnings
|
||||||
import argparse
|
import click
|
||||||
|
|
||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
warnings.simplefilter("ignore")
|
warnings.simplefilter("ignore")
|
||||||
|
@ -1314,18 +1314,14 @@ class textlineerkenner:
|
||||||
self.write_into_page_xml(contours, page_coord, self.dir_out)
|
self.write_into_page_xml(contours, page_coord, self.dir_out)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
@click.command()
|
||||||
parser = argparse.ArgumentParser()
|
@click.option('--image', '-i', help='image filename', type=click.Path(exists=True, dir_okay=False))
|
||||||
|
@click.option('--out', '-o', help='directory to write output xml data', type=click.Path(exists=True, file_okay=False))
|
||||||
parser.add_argument('-i', '--image', dest='inp1', default=None, help='image filename.')
|
@click.option('--model', '-m', help='directory of models', type=click.Path(exists=True, file_okay=False))
|
||||||
parser.add_argument('-o', '--out', dest='inp2', default=None, help='directory to write output xml data.')
|
def main(image, out, model):
|
||||||
parser.add_argument('-m', '--model', dest='inp3', default=None, help='directory of models.')
|
possibles = globals() # XXX unused?
|
||||||
|
|
||||||
options = parser.parse_args()
|
|
||||||
|
|
||||||
possibles = globals()
|
|
||||||
possibles.update(locals())
|
possibles.update(locals())
|
||||||
x = textlineerkenner(options.inp1, options.inp2, options.inp3)
|
x = textlineerkenner(image, out, model)
|
||||||
x.run()
|
x.run()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,3 +8,4 @@ shapely
|
||||||
scikit-learn
|
scikit-learn
|
||||||
tensorflow-gpu < 2.0
|
tensorflow-gpu < 2.0
|
||||||
scipy
|
scipy
|
||||||
|
click
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue