简单验证码识别


from
PIL import Image import pytesseract im = Image.open('./1.jpg') imgry = im.convert('L') threshold = 140 table = [] for i in range(256): if i < threshold: table.append(0) else: table.append(1) out = imgry.point(table, '1') print(out) str = pytesseract.image_to_string(out) print(str)
安装插件 # https://github.com/tesseract-ocr/tesseract/wiki
sudo apt install tesseract-ocr
sudo apt install libtesseract-dev
pip install pytesseract
pip install Pillow


posted @ 2020-01-21 14:15  酷酷的城池  阅读(142)  评论(0编辑  收藏  举报