File size: 382 Bytes
10469c8
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
"""Read a page and print its lines with confidence and box.  python examples/ocr_page.py [image]"""
import os
import sys

from sumoocr import SumoOCR

path = sys.argv[1] if len(sys.argv) > 1 else os.path.join(os.path.dirname(__file__), "invoice.png")
ocr = SumoOCR()
for line in ocr(path):
    x0, y0 = line.box[0]
    print(f"{line.conf:.2f}  ({x0:6.0f}, {y0:6.0f})  {line.text}")