fix region counting

pull/28/head
Konstantin Baierer 4 years ago
parent 03d75f5788
commit c5736e9b74

@ -45,11 +45,12 @@ def xml_reading_order(page, order_of_texts, id_of_texts, id_of_marginalia):
region_order = ET.SubElement(page, 'ReadingOrder')
region_order_sub = ET.SubElement(region_order, 'OrderedGroup')
region_order_sub.set('id', "ro357564684568544579089")
region_counter = EynollahIdCounter()
indexer_region = 0
for id_of_textregion in order_of_texts:
for idx_textregion, _ in enumerate(order_of_texts):
name = ET.SubElement(region_order_sub, 'RegionRefIndexed')
name.set('index', str(indexer_region))
name.set('regionRef', id_of_textregion)
name.set('regionRef', region_counter.region_id(order_of_texts[idx_textregion]))
indexer_region += 1
for id_marginal in id_of_marginalia:
name = ET.SubElement(region_order_sub, 'RegionRefIndexed')

@ -89,7 +89,7 @@ class EynollahXmlWriter():
region_bboxes = all_box_coord[region_idx]
points_co = ''
for idx_contour_textline, contour_textline in all_found_texline_polygons[region_idx][j]:
for idx_contour_textline, contour_textline in enumerate(all_found_texline_polygons[region_idx][j]):
if not self.curved_line:
if len(contour_textline) == 2:
textline_x_coord = max(0, int((contour_textline[0] + region_bboxes[2] + page_coord[2]) / self.scale_x))

Loading…
Cancel
Save