1、文字识别 - 接口说明
| 接口地址 | |
|---|---|
| 图片为base64流 | https://netocr.com/api/recogliu.do | 
| 图片为file格式 | https://netocr.com/api/recog.do | 
| 接口调用方法 | post | 
(注:调用图片为base64流接口时传参数img,调用图片为file格式接口传参数file)
2、请求参数
(1) 图片为base64流
| 接口地址 | https://netocr.com/api/recogliu.do | 
|---|---|
| 接口调用方法 | post | 
接口接收参数:
| 序号 | 名称 | 类型 | 必填 | 说明 | 
|---|---|---|---|---|
| 1 | img | String | 是 | 上传的文件(图片的base64流) | 
| 2 | key | String | 是 | 用户ocrKey | 
| 3 | secret | String | 是 | 用户ocrSecrert | 
| 4 | typeId | Integer | 是 | 识别类型(简体中文(印刷)1993;简体中文(印刷+手写)1994;繁体中文(印刷)1995;) 详见类型编码表 | 
| 5 | format | String | 是 | 返回格式(xml或者json),如果format为空,则默认返回xml | 
(2) 图片为file格式
| 接口地址 | https://netocr.com/api/recog.do | 
|---|---|
| 接口调用方法 | post | 
接口接收参数:
| 序号 | 名称 | 类型 | 必填 | 说明 | 
|---|---|---|---|---|
| 1 | file | MultipartFile | 是 | 上传的文件(上传文件的字段名必须是“file”) | 
| 2 | key | String | 是 | 用户ocrKey | 
| 3 | secret | String | 是 | 用户ocrSecrert | 
| 4 | typeId | Integer | 是 | 识别类型(简体中文(印刷)1993;简体中文(印刷+手写)1994;繁体中文(印刷)1995; 详见类型编码表 | 
| 5 | format | String | 是 | 返回格式(xml或者json),如果format为空,则默认返回xml | 
3、结果示例
简体中文(印刷)1993;简体中文(印刷+手写)1994;繁体中文(印刷)1995;
{
    "message": {
        "status": 0,
        "value": "识别完成"
    },
    "cardsinfo": {
        "card": {
            "type": "1993",
            "rowitem": [
                {
                    "rowdesc": "row0", 
                    "pagedesc": "1", 
                    "rowInfo": {
                        "left_top_right_bottom": "1727-719-2094-769-2080-872-1713-822"
                    }, 
                    "rowContext": {
                        "charitem": [
                            {
                                "charInfo": {
                                    "left_top_right_bottom": "1727-719-2094-769-2080-872-1713-822"
                                }, 
                                "chardesc": "char0", 
                                "charValue": "***"//识别结果
                            }
                        ]
                    }
                },
                ……
                {
                    "rowdesc": "row2", 
                    "pagedesc": "0", 
                    "rowInfo": {
                        "left_top_right_bottom": "0-0-0-0-0-0-0-0"
                    }, 
                    "rowContext": {
                        "charitem": [
                            {
                                "charInfo": {"left_top_right_bottom": "0-0-0-0-0-0-0-0"}, 
                                "chardesc": "char0", "charValue": "核心时间:419"//识别耗时
                            }
                        ]
                    }
                }
            ]
        }
    }
}