Python PIL从图像中提取数字 [英] Python PIL to extract number from image

查看:1181
本文介绍了Python PIL从图像中提取数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张这样的图片:

I have an image like this one:

,我想将一个黑色数字写在白色上,以便可以使用OCR识别它.如何在Python中实现?

and I would like to have a black number written on white so that I can use an OCR to recognise it. How could I achieve that in Python?

非常感谢,

约翰.

推荐答案

您无需为OCR操纵图像.例如,您可以只使用 pytesser :

You don't need to manipulate the image for OCR. For example, you could just use pytesser:

from PIL import Image
from pytesser import *
im = Image.open('wjNL6.jpg')
text = image_to_string(im)
print text

输出:

0

这篇关于Python PIL从图像中提取数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆