使用 Python 从图像中获取文本的最佳方法是什么?
我想从图像中获取文本。我尝试了 tesseract,但安装时遇到了问题,所以我想知道是否可以获得一些帮助或其他方法来做到这一点。 当我尝试使用 tesseract 时,它说我没有模块名称 PIL?但我知道我安装了枕头,我认为这是指它。
I want to get the text out of an image. I tried tesseract but I had issues installing it, so im wondering if I can get some help with that or another way to do it.
When I try to use tesseract it says I have no module names PIL? But I know I have pillow installed and i thought that was in reference to it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我提供了一个 Colab 解决方案,因为这可能对大多数人有用。
在我们的 Colab 环境中安装 tesseract。
导入库并安装我们的驱动器
设置我们的 pytesseract 路径,从我们的驱动器读取源图像,显示我们的源图像,然后最终将图像转换为文本。
I've provided a Colab solution since that will probably be useful to the most people.
Install tesseract in our Colab environment.
Import libraries and mount our Drive
Set our pytesseract path, read in source image from our Drive, show our source image, then finally convert the image to text.