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))