trasseract Unsupported image object
Question:
I learning python and I want read a document but ones words are diferent. I use this code,
pytesseract.pytesseract.tesseract_cmd = r'C:Program Files (x86)Tesseract-OCRtesseract'
img = cv2.imread('tes_palabra.png')
words = pytesseract.image_to_string(img)
print(words)
image used and required is https://ibb.co/KscWbD3
but return Unsupported image object
Answers:
Try somethink like this, using Image module from PIL:
from PIL import Image
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r'C:Program Files (x86)Tesseract-OCRtesseract'
img_file = r'tes_palabra.png'
img = Image.open(img_file)
words = pytesseract.image_to_string(img)
print(words)
I learning python and I want read a document but ones words are diferent. I use this code,
pytesseract.pytesseract.tesseract_cmd = r'C:Program Files (x86)Tesseract-OCRtesseract'
img = cv2.imread('tes_palabra.png')
words = pytesseract.image_to_string(img)
print(words)
image used and required is https://ibb.co/KscWbD3
but return Unsupported image object
Try somethink like this, using Image module from PIL:
from PIL import Image
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r'C:Program Files (x86)Tesseract-OCRtesseract'
img_file = r'tes_palabra.png'
img = Image.open(img_file)
words = pytesseract.image_to_string(img)
print(words)