【百度AI】Postman调用OCR服务-车牌识别

00. 目录

01. 概述

提供通过可视化工具 Postman 调用 OCR 通用文字识别(高精度版)API 的样例,帮助您零编码快速体验并熟悉文字识别服务。

02. Postman下载

下载地址如下:

03. Postman安装

(1)双击安装包。

(2)初次登录无账号,可点击图示最下方蓝色字体部分,直接进入 postman 主界面。

在这里插入图片描述

04. 获取 Access Token

将请求格式改为 “POST” 并填写请求地址:https://aip.baidubce.com/oauth/2.0/token
在这里插入图片描述

点击 Body,选择“x-www-form-urlencoded”,在 key 和 value 中分别输入以下3个请求参数。

  • grant_type: 必须参数,固定为 client_credentials
  • client_id: 必须参数,应用的 API Key
  • client_secret: 必须参数,应用的 Secret Key
    在这里插入图片描述

点击右上角蓝色“send”,即可在下方返回值区域中获取 access_token。
在这里插入图片描述

05. 进行接口调用

1) 将请求格式改为 “POST” 并填写请求地址(以车牌识别为例):https://aip.baidubce.com/rest/2.0/ocr/v1/license_plate

URL参数:

参数
access_token 通过API Key和Secret Key获取的access_token,参考“Access Token获取

Header如下:

参数
Content-Type application/x-www-form-urlencoded

在这里插入图片描述

(2) 点击 Params,在 key 和 value 中分别输入1个请求参数

key 栏输入:access_token

value 栏输入:上一步中获取的的 access_token
在这里插入图片描述

(3) 修改请求头,点击 Headers,在 key 和 value 中分别输入1个请求参数

key 栏输入:Content-Type

value 栏输入:application/x-www-form-urlencoded

在这里插入图片描述

(4) 点击 Body,选择“x-www-form-urlencoded”,在 key 和 value 中分别输入1个请求参数

key 栏输入:image

value 栏输入:任意文字图片的base64编码后的结果

网址:http://www.jsons.cn/img2base64/
在这里插入图片描述
在这里插入图片描述

(5) 开始请求

点击右上角蓝色“send”,即可在下方返回值区域中获取识别结果。

{
    
    
    "words_result": {
    
    
        "number": "粤BB88B8B",
        "vertexes_location": [
            {
    
    
                "x": 13,
                "y": 13
            },
            {
    
    
                "x": 515,
                "y": 20
            },
            {
    
    
                "x": 512,
                "y": 175
            },
            {
    
    
                "x": 7,
                "y": 167
            }
        ],
        "color": "green",
        "probability": [
            0.9995259047,
            0.9999268055,
            0.9991205335,
            0.9998419285,
            0.9995332956,
            0.9909687638,
            0.9998990297,
            0.9969483018,
            0.9982205629
        ]
    },
    "log_id": 1678040187004057815
}

06. 附录

猜你喜欢

转载自blog.csdn.net/dengjin20104042056/article/details/131628145