mirror of
https://github.com/qurator-spk/eynollah.git
synced 2026-06-16 09:59:13 +02:00
extracting ocr textline images and text: vertical lines threshold has changed to 1.4
This commit is contained in:
parent
4776ea9fc4
commit
d0b3bb419f
1 changed files with 10 additions and 0 deletions
|
|
@ -50,6 +50,12 @@ from ..utils import is_image_filename
|
||||||
is_flag=True,
|
is_flag=True,
|
||||||
help="if this parameter set to true, cropped textline images will not be masked with textline contour.",
|
help="if this parameter set to true, cropped textline images will not be masked with textline contour.",
|
||||||
)
|
)
|
||||||
|
@click.option(
|
||||||
|
"--exclude_vertical_lines",
|
||||||
|
"-exv",
|
||||||
|
is_flag=True,
|
||||||
|
help="if this parameter set to true, vertical textline images will be excluded.",
|
||||||
|
)
|
||||||
def linegt_cli(
|
def linegt_cli(
|
||||||
image,
|
image,
|
||||||
dir_in,
|
dir_in,
|
||||||
|
|
@ -57,6 +63,7 @@ def linegt_cli(
|
||||||
dir_out,
|
dir_out,
|
||||||
pref_of_dataset,
|
pref_of_dataset,
|
||||||
do_not_mask_with_textline_contour,
|
do_not_mask_with_textline_contour,
|
||||||
|
exclude_vertical_lines,
|
||||||
):
|
):
|
||||||
assert bool(dir_in) ^ bool(image), "Set --dir-in or --image-filename, not both"
|
assert bool(dir_in) ^ bool(image), "Set --dir-in or --image-filename, not both"
|
||||||
if dir_in:
|
if dir_in:
|
||||||
|
|
@ -100,6 +107,9 @@ def linegt_cli(
|
||||||
|
|
||||||
x, y, w, h = cv2.boundingRect(textline_coords)
|
x, y, w, h = cv2.boundingRect(textline_coords)
|
||||||
|
|
||||||
|
if exclude_vertical_lines and h > 2 * w:
|
||||||
|
continue
|
||||||
|
|
||||||
total_bb_coordinates.append([x, y, w, h])
|
total_bb_coordinates.append([x, y, w, h])
|
||||||
|
|
||||||
img_poly_on_img = np.copy(img)
|
img_poly_on_img = np.copy(img)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue