温馨提示×

使用python如何做图像识别

养鱼的猫咪
193
2021-03-08 17:01:28
栏目: 编程语言

使用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()

0