Python PIL从图像中提取数字

use*_*597 3 python ocr python-imaging-library

我有一张像这样的图片: 数字

我想要一个写在白色上的黑色数字,以便我可以使用 OCR 来识别它。我怎样才能在Python中实现这一点?

非常感谢,

约翰。

cyb*_*org 5

您无需为 OCR 操作图像。例如,您可以只使用pytesser

from PIL import Image
from pytesser import *
im = Image.open('wjNL6.jpg')
text = image_to_string(im)
print text
Run Code Online (Sandbox Code Playgroud)

输出:

0
Run Code Online (Sandbox Code Playgroud)

  • 哇,我不知道我们有 Python 中的直接 OCR 库。 (4认同)