美文网首页
验证码识别pytesseract

验证码识别pytesseract

作者: SmallPot_Yang | 来源:发表于2018-03-30 13:24 被阅读0次

pytesseract模块支持:
链接:https://pan.baidu.com/s/1URKMjx2r8ff34-pmtmgvdQ
密码:e6fv

安装完成后需要添加运行文件到系统的环境变量当中

from PIL import Image
import requests
import pytesseract

codeurl = 'https://vis.vip.com/checkCode.php?t=0.898739192822086'
valcode = requests.get(codeurl)

f = open('checkCode.jpg', 'wb')
# 将response的二进制内容写入到文件中
f.write(valcode.content)
# 关闭文件流对象.
f.close()

im = Image.open('checkCode.jpg')
text = pytesseract.image_to_string(im)

print(text)

相关文章

网友评论

      本文标题:验证码识别pytesseract

      本文链接:https://www.haomeiwen.com/subject/ycqicftx.html