首页 > 编程语言 > 详细

python——识别图中文字

时间:2019-09-03 20:22:39      阅读:84      评论:0      收藏:0      [点我收藏+]

纯干货直接上代码

百度:

    from aip import AipOcr

    config = {
        appId: ‘‘,
        apiKey: ‘‘,
        secretKey: ‘‘
    }

    client = AipOcr(**config)

    def get_file_content(file):
        with open(file, rb) as fp:
            return fp.read()

    def img_to_str(image_path):
        image = get_file_content(image_path)
        image = image.content
        result = client.basicAccurate(image)
        if words_result in result:
            return \n.join([w[words] for w in result[words_result]])

谷歌:

# open image
    image = Image.open(‘‘)
    code = pytesseract.image_to_string(image, lang=chi_sim)
    print(code)

 

参考

↓↓↓↓↓↓↓

 

看这里

python——识别图中文字

原文:https://www.cnblogs.com/qmjy/p/11454894.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!