zoukankan      html  css  js  c++  java
  • 基于python图片识别工具(图片识别,车牌,PDF,验证码)

    先上图  不多说。

    对于一般的用户来说识别率还是能达到百分之90以上。

    已经打包成exe文件。windows用户可以直接使用。要软件的加我QQ

    python代码:

    # -*- coding: UTF-8 -*-
    from aip import AipOcr
    def main():
    img_path = input('请输入图片路径')

    # 定义常量
    APP_ID = 'you APP_ID'
    API_KEY = 'YOU KEY'
    SECRET_KEY = 'YOU SECRET_KEY'

    # 初始化AipFace对象
    aipOcr = AipOcr(APP_ID, API_KEY, SECRET_KEY)

    # 图片路径
    filePath = ("%s" % (img_path))
    aaa = filePath.replace("\", "\\")

    # 读取图片
    def get_file_content(filePath):
    with open(filePath, 'rb') as fp:
    return fp.read()

    # 其他配置参数
    options = {
    'detect_direction': 'true', # 检测图像朝向
    'language_type': 'CHN_ENG', # 识别语言类型
    }

    # 调用通用文字识别接口
    result = aipOcr.basicGeneral(get_file_content(filePath), options)
    print(' ' * 1)
    print("检测到图片文字可能有 %s 行 内容如下: "%(result["words_result_num"]))

    fd = open("识别文字.txt",'w+')
    fd.write("检测到图片文字可能有 %s 行 内容如下: "%(result["words_result_num"])+' ')

    list=result["words_result"]
    for i in list:
    print(i["words"])
    fd.write(i["words"]+' ')

    if __name__ == '__main__':
    main()
    print(' ' * 1)
    input(' ---------------------感谢你的支持---------------------'
    ' -----------------联系作者:386960026---------------------'
    ' ---------------------按任意键退出---------------------')
  • 相关阅读:
    JD20 紧急疏散
    排序-归并
    排序:快排
    剑指offer-二叉树镜像
    美的笔试--分糖果
    centos限定端口访问
    javascript中使用ajax异步验证数据库后方法return true时总是返回undefined
    javascript自定义startWith()和endWith()方法
    jsp <input type="file"> 清空value值的一种方式
    Could not initialize class sun.awt.X11GraphicsEnvironment
  • 原文地址:https://www.cnblogs.com/Beliefblog/p/8086331.html
Copyright © 2011-2022 走看看