report-detect/scripts/test_ocr_debug.py

21 lines
467 B
Python

import cv2
import os
from paddleocr import PaddleOCR
def test_debug():
img_path = "seal_cropped.png"
img = cv2.imread(img_path)
ocr = PaddleOCR(use_angle_cls=True, lang='ch')
print("Testing OCR on image ARRAY...")
res_arr = ocr.ocr(img)
print(f"Array Result: {res_arr}")
print("\nTesting OCR on image PATH...")
res_path = ocr.ocr(img_path)
print(f"Path Result: {res_path}")
if __name__ == "__main__":
test_debug()