新车合格证识别
接口描述
用户通过发送HTTP Post请求方式提交数据至公有云服务器,服务器识别并返回json格式的识别结果。
接口说明
请求URL:http://api.exocr.com/ocr/v1/vehicle_cert
请求方式:HTTP Post
返回格式:json
Header
参数 | 值 |
---|---|
Content-Type | 使用二进制方式时,为multipart/form-data;使用base64和url方式时,为application/x-www-form-urlencoded |
请求参数
参数 | 必选 | 类型 | 说明 |
---|---|---|---|
app_key | 是 | string | 请在控制台->我的应用中获取 |
app_secret | 是 | string | 请在控制台->我的应用中获取 |
image_base64 | 否 | string | 图像base64编码。image_base64、image_url、image_binary三个参数中至少选择一个,读取优先级从前到后依次降低。如:同时选择了以上三个参数,则以image_base64图像为准。 |
image_url | 否 | string | 图像url地址。image_base64、image_url、image_binary三个参数中至少选择一个,读取优先级从前到后依次降低。如:同时选择了以上三个参数,则以image_base64图像为准。 |
image_binary | 否 | data | 图像二进制。image_base64、image_url、image_binary三个参数中至少选择一个,读取优先级从前到后依次降低。如:同时选择了以上三个参数,则以image_base64图像为准。 |
调用示例
java(相关依赖库下载)
package com.exocr.httpclient;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import com.exocr.common.utils.HttpClientUtils;
public class Test {
public static void main(String[] args) throws FileNotFoundException {
/**
* base64
*/
//识别url
String url = " http://api.exocr.com/ocr/v1/vehicle_cert";
//设置请求参数
Map<String, String> params = new HashMap<String, String>();
params.put("app_key", "#####");
params.put("app_secret", "#####");
//设置识别图像base64编码
params.put("image_base64", "base64ImageStr");
//发送请求,得到识别结果
String result = HttpClientUtils.doPost(url, params);
System.out.println(result);
/**
* url
*/
//设置请求参数、识别图像url
params.put("app_key", "#####");
params.put("app_secret", "#####");
params.put("image_url", "imageUrl");
//发送请求,得到识别结果
result = HttpClientUtils.doPost(url, params);
System.out.println(result);
/**
* 二进制
*/
//设置请求参数
params.put("app_key", "#####");
params.put("app_secret", "#####");
//拿到本地图像,写入数据流
File file = new File("/Users/mac/logs/test.png");
InputStream in = new FileInputStream(file);
//设置数据流
Map<String, InputStream> streamMap = new HashMap<String, InputStream>();
streamMap.put("image_binary", in);
//发送请求,得到识别结果
result = HttpClientUtils.doPostStream(url, params, streamMap);
//关闭io流
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(result);
}
}
返回示例
{
"result":{
"hgzbh":{
"words":"YE7###85",
"score":1,
"position":{
"left":296,
"top":72,
"width":167,
"height":25
},
"chinese_key":"1.合格证编号"
},
"fzrq":{
"words":"2017年05月15日",
"score":1,
"position":{
"left":836,
"top":79,
"width":141,
"height":25
},
"chinese_key":"2.发证日期"
},
"clzzqymc":{
"words":"江###司",
"score":1,
"position":{
"left":296,
"top":108,
"width":174,
"height":24
},
"chinese_key":"3.车辆制造企业名称"
},
"clpp":{
"words":"江##车",
"score":1,
"position":{
"left":294,
"top":144,
"width":411,
"height":24
},
"chinese_key":"4.车辆品牌/车辆名称"
},
"clxh":{
"words":"JX##机)",
"score":1,
"position":{
"left":828,
"top":292,
"width":168,
"height":22
},
"chinese_key":"5.车辆型号"
},
"clsbdm":{
"words":"LVX###4616",
"score":1,
"position":{
"left":766,
"top":183,
"width":244,
"height":25
},
"chinese_key":"6.车辆识别代码/车架号"
},
"csys":{
"words":"##",
"score":1,
"position":{
"left":296,
"top":216,
"width":65,
"height":24
},
"chinese_key":"7.车身颜色"
},
"dpxh":{
"words":"-",
"score":1,
"position":{
"left":294,
"top":254,
"width":16,
"height":20
},
"chinese_key":"8.底盘型号/底盘ID"
},
"dphgzbh":{
"words":"-",
"score":1,
"position":{
"left":292,
"top":290,
"width":18,
"height":22
},
"chinese_key":"9.底盘合格证编号"
},
"fdjxh":{
"words":"JX7##EV",
"score":1,
"position":{
"left":294,
"top":180,
"width":101,
"height":24
},
"chinese_key":"10.发动机型号"
},
"fdjh":{
"words":"2260",
"score":1,
"position":{
"left":292,
"top":614,
"width":45,
"height":20
},
"chinese_key":"11.发动机号"
},
"rlzl":{
"words":"电",
"score":1,
"position":{
"left":296,
"top":362,
"width":22,
"height":22
},
"chinese_key":"12.燃料种类"
},
"plhgl":{
"words":"0-20",
"score":1,
"position":{
"left":826,
"top":364,
"width":168,
"height":20
},
"chinese_key":"13.排量和功率(ml/kW)"
},
"pfbz":{
"words":"1360",
"score":1,
"position":{
"left":292,
"top":578,
"width":47,
"height":22
},
"chinese_key":"14.排放标准"
},
"yh":{
"words":"-",
"score":1,
"position":{
"left":292,
"top":436,
"width":18,
"height":20
},
"chinese_key":"15.油耗"
},
"wkcc":{
"words":"3427x1565x1510",
"score":1,
"position":{
"left":292,
"top":470,
"width":244,
"height":22
},
"chinese_key":"16.外廓尺寸(mm)"
},
"hxnbcc":{
"words":"-x-x-",
"score":1,
"position":{
"left":826,
"top":472,
"width":206,
"height":18
},
"chinese_key":"17.货厢内部尺寸(mm)"
},
"gbthps":{
"words":"1125",
"score":1,
"position":{
"left":290,
"top":720,
"width":47,
"height":22
},
"chinese_key":"18.钢板弹簧片数(片)"
},
"lts":{
"words":"4",
"score":1,
"position":{
"left":826,
"top":506,
"width":14,
"height":20
},
"chinese_key":"19.轮胎数"
},
"ltgg":{
"words":"1360",
"score":1,
"position":{
"left":589,
"top":576,
"width":46,
"height":20
},
"chinese_key":"20.轮胎规格"
},
"ljqh":{
"words":"1360x1360",
"score":1,
"position":{
"left":292,
"top":576,
"width":343,
"height":24
},
"chinese_key":"21.轮距(前/后)(mm)"
},
"zj":{
"words":"(mm)",
"score":1,
"position":{
"left":128,
"top":614,
"width":51,
"height":22
},
"chinese_key":"22.轴距"
},
"zh":{
"words":"539/586",
"score":1,
"position":{
"left":292,
"top":648,
"width":79,
"height":22
},
"chinese_key":"23.轴荷(kg)"
},
"zs":{
"words":"2",
"score":1,
"position":{
"left":290,
"top":684,
"width":16,
"height":22
},
"chinese_key":"24.轴数"
},
"zxxs":{
"words":"方向盘",
"score":1,
"position":{
"left":824,
"top":680,
"width":67,
"height":22
},
"chinese_key":"25.转向形式"
},
"zzl":{
"words":"Special",
"score":1,
"position":{
"left":873,
"top":1424,
"width":54,
"height":20
},
"chinese_key":"26.总质量(kg)"
},
"zbzl":{
"words":"825",
"score":1,
"position":{
"left":824,
"top":716,
"width":35,
"height":20
},
"chinese_key":"27.整备质量(kg)"
},
"edzzl":{
"words":"-",
"score":1,
"position":{
"left":290,
"top":758,
"width":16,
"height":20
},
"chinese_key":"28.额定载质量(kg)"
},
"zzllyxs":{
"words":"-",
"score":1,
"position":{
"left":824,
"top":752,
"width":16,
"height":20
},
"chinese_key":"29.载质量利用系数"
},
"zqyzzl":{
"words":"—",
"score":1,
"position":{
"left":292,
"top":808,
"width":12,
"height":20
},
"chinese_key":"30.准牵引总质量(kg)"
},
"bgcazzdyxzzl":{
"words":"1565",
"score":1,
"position":{
"left":393,
"top":470,
"width":46,
"height":22
},
"chinese_key":"31.半挂车鞍座最大允许总质量(kg)"
},
"jsszcrs":{
"words":"3427",
"score":1,
"position":{
"left":292,
"top":470,
"width":45,
"height":22
},
"chinese_key":"32.驾驶室准乘人数(人)"
},
"edzk":{
"words":"4",
"score":1,
"position":{
"left":288,
"top":898,
"width":18,
"height":22
},
"chinese_key":"33.额定载客(人)"
},
"zgsjcs":{
"words":"100",
"score":1,
"position":{
"left":288,
"top":934,
"width":36,
"height":22
},
"chinese_key":"34.最高设计车速(km/h)"
},
"zlzzrq":{
"words":"2017年05月15日",
"score":1,
"position":{
"left":288,
"top":968,
"width":151,
"height":22
},
"chinese_key":"35.车辆制造日期"
}
},
"error_code":0,
"description":"识别成功",
"request_id":"DE7672EE34CE416481B6EAABDF6DC575",
"recognize_time":1925,
"available_count":9996
}
返回说明
通用参数
参数 | 类型 | 说明 |
---|---|---|
result | array | 返回结果数组,包括所有字段的识别信息 |
error_code | int | 错误码,返回0为正确,其他为错误 |
description | string | 识别结果描述 |
request_id | string | 请求唯一标识符 |
recognize_time | int | 识别所用时间,单位为毫秒 |
available_count | int | 识别剩余可用次数,次数不足时无法继续识别,可在控制台进行充值次数 |
新车合格证识别特有参数
参数 | 类型 | 说明 |
---|---|---|
hgzbh | string | 合格证编号 |
fzrq | string | 发证日期 |
clzzqymc | string | 车辆制造企业名称 |
clpp | string | 车辆品牌/车辆名称 |
clxh | string | 车辆型号 |
clsbdm | string | 车辆识别代码/车架号 |
csys | string | 车身颜色 |
dpxh | string | 底盘型号/底盘ID |
dphgzbh | string | 底盘合格证编号 |
fdjxh | string | 发动机型号 |
fdjh | string | 发动机号 |
rlzl | string | 燃料种类 |
plhgl | string | 排量和功率(ml/kW) |
pfbz | string | 排放标准 |
yh | string | 油耗 |
wkcc | string | 外廓尺寸(mm) |
hxnbcc | string | 货厢内部尺寸(mm) |
gbthps | string | 钢板弹簧片数(片) |
lts | string | 轮胎数 |
ltgg | string | 轮胎规格 |
ljqh | string | 轮距(前/后)(mm) |
zj | string | 轴距 |
zh | string | 轴荷(kg) |
zs | string | 轴数 |
zxxs | string | 转向形式 |
zzl | string | 总质量(kg) |
zbzl | string | 额定载质量(kg) |
zzllyxs | string | 载质量利用系数 |
zqyzzl | string | 准牵引总质量(kg) |
bgcazzdyxzzl | string | 半挂车鞍座最大允许总质量(kg) |
jsszcrs | string | .驾驶室准乘人数(人) |
edzk | string | 额定载客(人) |
zgsjcs | string | .最高设计车速(km/h) |
zlzzrq | string | 车辆制造日期 |
position | array | 当前字段在图像上的位置信息 |
left | int | 位置值,距离原图左侧距离x,单位为像素 |
top | int | 位置值,距离原图上方距离y,单位为像素 |
width | int | 位置值,字段所在图框宽度w,单位为像素 |
height | int | 位置值,字段所在图框高度h,单位为像素 |
edzzl | object | 额定载质量(kg) |
clscdwmc | object | 车辆生产单位名称 |
clscdwdz | object | 车辆生产单位地址 |
words | string | 识别结果 |
score | float | 照片可信度 |
quad | string | 四个顶点坐标 |
chinese_key | string | 该字段中文含义 |