ocr.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:WebScraping 作者: liinnux 项目源码 文件源码
def ocr(img):
    # threshold the image to ignore background and keep text
    gray = img.convert('L')
    #gray.save('captcha_greyscale.png')
    bw = gray.point(lambda x: 0 if x < 1 else 255, '1')
    #bw.save('captcha_threshold.png')
    word = pytesseract.image_to_string(bw)
    ascii_word = ''.join(c for c in word if c in string.letters).lower()
    return ascii_word
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号