简单验证码识别


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


原文地址:https://www.cnblogs.com/chengfengchi/p/12221567.html