原文地址:http://www.cnblogs.com/tanghuang/p/6380588.html

适用版本:python2以下

将图片中的数字通过 pytesseract.image_to_string(image)识别后将结果存入到本地的txt文件中
Python2图像文本识别
 1 #-*-encoding:utf-8-*-
 2 import pytesseract
 3 from PIL import Image
 4 
 5 class GetImageDate(object):
 6     def m(self):
 7         image = Image.open(u"C:\\a.png")
 8         text = pytesseract.image_to_string(image)
 9         return text
10 
11     def SaveResultToDocument(self):
12         text = self.m()
13         f = open(u"C:\\Verification.txt","w")
14         print text
15         f.write(str(text))
16         f.close()
17 
18 g = GetImageDate()
19 g.SaveResultToDocument()
Python2图像文本识别
 
 

相关文章:

  • 2021-06-10
  • 2021-04-11
  • 2021-10-10
  • 2022-12-23
  • 2021-08-20
  • 2021-11-21
  • 2022-01-20
猜你喜欢
  • 2021-11-04
  • 2021-09-23
  • 2021-06-14
  • 2021-12-05
相关资源
相似解决方案