扫描二维码下载沐宇APP

沐宇

微信扫码使用沐宇小程序

沐宇

使用python如何做图像识别

扬州沐宇科技
2021-03-08 17:01:28
python

使用python如何做图像识别

在python中使用pytesseract模块实现一个图像识别,具体方法如下:

import pytesseract #导入pytesseract模块

from PIL import Image

class GetImageDate(object):

def m(self):

image = Image.open(u"a.png")

text = pytesseract.image_to_string(image)

return text

def SaveResultToDocument(self):

text = self.m()

f = open(u"Verification.txt","w")

print text

f.write(str(text))

f.close()

g = GetImageDate()

g.SaveResultToDocument()

扫码添加客服微信