sumoOCR-tiny / examples /ocr_page.py
bikramdocsumo
Initial release: SumoOCR tiny v0.1.0
10469c8
Raw History Blame Contribute Delete
382 Bytes
"""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}")