mirror of
				https://github.com/qurator-spk/page2tsv.git
				synced 2025-11-04 10:34:14 +01:00 
			
		
		
		
	try other coordinate computation
This commit is contained in:
		
							parent
							
								
									f320904503
								
							
						
					
					
						commit
						e5b635ec2d
					
				
					 1 changed files with 8 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -107,8 +107,10 @@ def page2tsv(page_xml_file, tsv_out_file, purpose, image_url, ner_rest_endpoint,
 | 
			
		|||
    for region_idx, region in enumerate(pcgts.get_Page().get_AllRegions(classes=['Text'], order='reading-order')):
 | 
			
		||||
        for text_line in region.get_TextLine():
 | 
			
		||||
 | 
			
		||||
            points = [int(scale_factor * float(pos)) for coords in text_line.get_Coords() for p in
 | 
			
		||||
                      coords.attrib['points'].split(' ') for pos in p.split(',')]
 | 
			
		||||
            # points = [int(scale_factor * float(pos)) for coords in text_line.get_Coords() for p in
 | 
			
		||||
            #          coords.attrib['points'].split(' ') for pos in p.split(',')]
 | 
			
		||||
 | 
			
		||||
            points = [int(scale_factor * float(pos)) for pos in text_line.get_Coords().points]
 | 
			
		||||
 | 
			
		||||
            x_points, y_points = points[0::2], points[1::2]
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -128,8 +130,10 @@ def page2tsv(page_xml_file, tsv_out_file, purpose, image_url, ner_rest_endpoint,
 | 
			
		|||
                    # transform OCR coordinates using `scale_factor` to derive
 | 
			
		||||
                    # correct coordinates for the web presentation image
 | 
			
		||||
 | 
			
		||||
                    points = [int(scale_factor * float(pos)) for coords in text_line.get_Coords() for p in
 | 
			
		||||
                              coords.attrib['points'].split(' ') for pos in p.split(',')]
 | 
			
		||||
                    # points = [int(scale_factor * float(pos)) for coords in text_equiv.get_Coords() for p in
 | 
			
		||||
                    #           coords.attrib['points'].split(' ') for pos in p.split(',')]
 | 
			
		||||
 | 
			
		||||
                    points = [int(scale_factor * float(pos)) for pos in text_equiv.get_Coords().points]
 | 
			
		||||
 | 
			
		||||
                    x_points, y_points = points[0::2], points[1::2]
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue