I am using pytesseract and OpenCV to read text from images. At the moment I take a screenshot, save to disk then extract the text. My code works ok but I am doing something that is time-critical so I wondered whether there is a better approach.
import pytesseract
import cv2
from timeit import default_timer as timer
start = timer()
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
img = cv2.imread('temp_chit.png')
text = pytesseract.image_to_string(img)
print(text)
end = timer()
print(end - start)