tesseract 是一个很强大的ocr引擎,之前看到它早就想拿来玩一玩啦,无奈时间不是很够呢。今天下午刚好有空,想到之前一直想做的选课辅助插件,今天就来做个验证码识别。软件版本:Tesseract Open Source OCR Engine v3.04.01
样本获取
很简单,直接在登陆页面把验证码爬下来就行
def download_auth_code_batch(num):
# 获取验证码
for _ in range(num):
auth_code = session.get(url + '/ValidateCode.aspx', cookies=page.cookies)
img = Image.open(BytesIO(auth_code.content))
img.save('auth_codes/auth_code_%s.png' % time.time())
2018/6/23大约 3 分钟约 779 字