I am trying to use pytesseract to read text from images. This is my code-
import cv2
from pytesseract import image_to_string
pytesseract.pytesseract.tesseract_cmd='C:\Program Files\Tesseract-OCR\tesseract.exe'
img = cv2.imread("download.png")
print('image is',img)
gry = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
(h, w) = gry.shape[:2]
gry = cv2.resize(gry, (w*2, h*2))
cls = cv2.morphologyEx(gry, cv2.MORPH_CLOSE, None)
thr = cv2.threshold(cls, 0, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
# pytesseract.tesseract_cmd='C:\Program Files\Tesseract-OCR\tesseract.exe'
txt = image_to_string(thr)
print(txt)
I am getting the following error-
AttributeError: module 'pytesseract.pytesseract' has no attribute 'pytesseract'.
I have already downloaded the tesseract windows binary and specified the correct path. I have already downloaded pytesseract and tesseract using pip. Can anyone help with this issue?