[英]Extract text from image using pytesseract
我想使用Python
从以下图像中提取文本:
我试过下面的代码,但它抛出了一个错误:
import pytesseract
from PIL import Image
img=Image.open(r'gif file path')
pytesseract.pytesseract.tesseract_cmd = 'C:/Program Files (x86)/Tesseract-
OCR/tesseract'
r=pytesseract.image_to_string(img)
print(r)
And
from PIL import Image
from pytesseract import image_to_string
img=Image.open('gif file path')
text=image_to_string(img)
print(text)
错误:
TesseractNotFoundError。
请帮助以任何方式使用Python
获取文本。
注意: pytesseract
已经安装。
一件事是安装库 pytesseract,另一件事是安装 Tesseract。
如果您使用的是 Linux,请尝试:
sudo apt install libtesseract-dev tesseract-ocr
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.