mirror of
https://github.com/qurator-spk/neat.git
synced 2025-07-04 07:59:54 +02:00
fix wrong computation of boundaries
This commit is contained in:
parent
f069419064
commit
daa9a2676e
1 changed files with 7 additions and 4 deletions
11
tools/cli.py
11
tools/cli.py
|
@ -126,10 +126,13 @@ def page2tsv(page_xml_file, tsv_out_file, image_url):
|
||||||
|
|
||||||
points = [int(pos) for p in coords.attrib['points'].split(' ') for pos in p.split(',')]
|
points = [int(pos) for p in coords.attrib['points'].split(' ') for pos in p.split(',')]
|
||||||
|
|
||||||
left = points[0]
|
x_points = [points[i] for i in range(0, len(points), 2)]
|
||||||
right = points[2]
|
y_points = [points[i] for i in range(1, len(points), 2)]
|
||||||
top = points[1]
|
|
||||||
bottom = points[5]
|
left = min(x_points)
|
||||||
|
right = max(x_points)
|
||||||
|
top = min(y_points)
|
||||||
|
bottom = max(y_points)
|
||||||
|
|
||||||
tsv.append((0, text, 'O', 'O', '-', len(urls), left, right, top, bottom))
|
tsv.append((0, text, 'O', 'O', '-', len(urls), left, right, top, bottom))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue