Update main.py

pull/1/head
Rezanezhad, Vahid 5 years ago
parent 0b7bc8d93e
commit 47d972b459

@ -1374,8 +1374,7 @@ class textlineerkenner:
coord_page.set('points',points_page_print) coord_page.set('points',points_page_print)
""" """
if len(contours)>0:
region_order=ET.SubElement(page, 'ReadingOrder') region_order=ET.SubElement(page, 'ReadingOrder')
region_order_sub = ET.SubElement(region_order, 'OrderedGroup') region_order_sub = ET.SubElement(region_order, 'OrderedGroup')
@ -1596,6 +1595,8 @@ class textlineerkenner:
image_page,page_coord=self.extract_page() image_page,page_coord=self.extract_page()
text_regions=self.extract_text_regions(image_page) text_regions=self.extract_text_regions(image_page)
boxes,contours=self.get_text_region_contours_and_boxes(text_regions) boxes,contours=self.get_text_region_contours_and_boxes(text_regions)
if len(contours)>0:
self.get_all_image_patches_based_on_text_regions(boxes,image_page) self.get_all_image_patches_based_on_text_regions(boxes,image_page)
textline_mask_tot=self.textline_contours(image_page) textline_mask_tot=self.textline_contours(image_page)
@ -1605,6 +1606,10 @@ class textlineerkenner:
self.get_textlines_for_each_textregions(textline_mask_tot,boxes) self.get_textlines_for_each_textregions(textline_mask_tot,boxes)
self.get_slopes_for_each_text_region(contours) self.get_slopes_for_each_text_region(contours)
self.deskew_textline_patches(contours, boxes) self.deskew_textline_patches(contours, boxes)
else:
contours=[]
order_of_texts=None
id_of_texts=None
self.write_into_page_xml(contours,page_coord,self.dir_out , order_of_texts , id_of_texts) self.write_into_page_xml(contours,page_coord,self.dir_out , order_of_texts , id_of_texts)
# Destroy the current Keras session/graph to free memory # Destroy the current Keras session/graph to free memory

Loading…
Cancel
Save