Untitled
unknown
plain_text
5 months ago
570 B
4
Indexable
import easyocr import cv2 from matplotlib import pyplot as plt import numpy as np IMAGE_PATH = "C:\\Users\\risha\\Downloads\\rishavML.jfif" reader = easyocr.Reader(['en']) result = reader.readtext(IMAGE_PATH) top_left = tuple(result[0][0][0]) bottom_right = tuple(result[0][0][2]) text = result[0][1] font = cv2.FONT_HERSHEY_SIMPLEX img = cv2.imread(IMAGE_PATH) img = cv2.rectangle(img, top_left, bottom_right, (0, 255, 0), 3) img = cv2.putText(img, text, top_left, font, 3, (255, 0, 255), 2, cv2.LINE_AA) print(text) plt.imshow(img) plt.show()
Editor is loading...
Leave a Comment