从图像
问题描述:
获取文本我需要使用pytesseract从这张照片中提取文本:enter image description here从图像
但是,我用pytesseract。它不会work.Here是我的代码:
try:
import Image
except ImportError:
from PIL import Image
import pytesseract
print(pytesseract.image_to_string(Image.open('1.png')))
答
您在使用这一点,我们可以从中提取任何扩展文本安装
textract
。
# some python file
import textract
text = textract.process("path/to/file.extension")
您可以提供file
作为图像或pdf或任何文档。 为您的代码
text = textract.process("1.png")
你能提供你得到的错误吗? – Chobeat
确保您已下载tesseract并设置您的系统以正确运行。 pytesseract取决于tesseract – jlaur
是的,我已经下载tesseract和它的正常运行。其实它没有打印,并为所述错误感到抱歉。 – GMB