• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
fbhell
N久更新一次,备注学习资源
博客园    首页    新随笔    联系   管理    订阅  订阅

Python 识别验证码

1、图形验证码部分

 1 # -- coding: utf-8 --
 2 import pytesseract
 3 from PIL import Image
 4 
 5 im=Image.open('image.png')
 6 img=im.convert("L")
 7 # img.show()
 8 threshold=140
 9 table=[]
10 for i in range(256):
11     if i <threshold:
12         table.append(0)
13     else:
14         table.append(1)
15 out=img.point(table,"1")
16 out.show()
17 print(pytesseract.image_to_string(out))

 

posted @ 2022-06-12 11:08  fbhell  阅读(29)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3