简体   繁体   中英

pyTesseract not outputing text from image

maybe someone could help me! When I run the following code

import pytesseract from pytesseract import image_to_string from PIL import Image import PIL

file = Image.open('/usr/local/Cellar/tesseract/4.1.0/share/tessdata/cap.png')
we_will = pytesseract.image_to_string(file)
print(we_will)

all that gets outputed is:

Process finished with exit code 0

which is no help. What am I doing wrong?

Sounds like we_will is the empty string. Try printing repr(we_will) to understand this idea more clearly.

IIRC, PyTesseract does this when it can't figure out what the text is inside the image. You can get the best results for a cropped image with a single-color background.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM