车辆登记证识别
接口描述
用户通过发送HTTP Post请求方式提交数据至公有云服务器,服务器识别并返回json格式的识别结果。
接口说明
请求URL:http://api.exocr.com/ocr/v1/vehicle_register
请求方式: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_register";
//设置请求参数
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": {
"jdcsyr": {
"words": "林##居民身份证/44##",
"score": 1,
"position": {
"left": 306,
"top": 68,
"width": 261,
"height": 20
},
"chinese_key": "1.机动车所有人/身份证名称/号码"
},
"djjg": {
"words": "汕头市公安局交通警察支队车辆街",
"score": 1,
"position": {
"left": 175,
"top": 84,
"width": 215,
"height": 20
},
"chinese_key": "2.登记机关"
},
"djrq": {
"words": "200x-xx-xx",
"score": 1,
"position": {
"left": 480,
"top": 93,
"width": 73,
"height": 16
},
"chinese_key": "3.登记日期"
},
"jdcbh": {
"words": "10047",
"score": 1,
"position": {
"left": 535,
"top": 70,
"width": 32,
"height": 18
},
"chinese_key": "4.机动车登记编号"
},
"cllx": {
"words": "小型轿车",
"score": 1,
"position": {
"left": 209,
"top": 611,
"width": 60,
"height": 18
},
"chinese_key": "5.车辆类型"
},
"clpp": {
"words": "",
"score": 1,
"position": {
"left": 557,
"top": 593,
"width": 222,
"height": 42
},
"chinese_key": "6.车辆品牌"
},
"clxh": {
"words": "LAA##",
"score": 1,
"position": {
"left": 209,
"top": 641,
"width": 60,
"height": 17
},
"chinese_key": "7.车辆型号"
},
"csys": {
"words": "红",
"score": 1,
"position": {
"left": 589,
"top": 643,
"width": 20,
"height": 17
},
"chinese_key": "8.车身颜色"
},
"clsbdm": {
"words": "",
"score": 1,
"position": {
"left": 181,
"top": 648,
"width": 274,
"height": 43
},
"chinese_key": "9.车辆识别代码/车架号"
},
"gcjk": {
"words": "海关进口",
"score": 1,
"position": {
"left": 591,
"top": 672,
"width": 60,
"height": 16
},
"chinese_key": "10.国产/进口"
},
"fdjh": {
"words": "39##",
"score": 1,
"position": {
"left": 237,
"top": 700,
"width": 32,
"height": 16
},
"chinese_key": "11.发动机号"
},
"fdjxh": {
"words": "2.4L",
"score": 1,
"position": {
"left": 589,
"top": 702,
"width": 32,
"height": 16
},
"chinese_key": "12.发动机型号"
},
"rlzl": {
"words": "汽油",
"score": 1,
"position": {
"left": 207,
"top": 730,
"width": 32,
"height": 18
},
"chinese_key": "13.燃料种类"
},
"plgl": {
"words": "2429ml/105kw",
"score": 1,
"position": {
"left": 591,
"top": 726,
"width": 159,
"height": 24
},
"chinese_key": "14.排量/功率"
},
"zzcmc": {
"words": "克莱斯勤有限责任公司",
"score": 1,
"position": {
"left": 207,
"top": 762,
"width": 145,
"height": 16
},
"chinese_key": "15.制造厂名称"
},
"zxxs": {
"words": "方向盘",
"score": 1,
"position": {
"left": 591,
"top": 764,
"width": 44,
"height": 18
},
"chinese_key": "16.转向形式"
},
"lj": {
"words": "前1481后1478mm",
"score": 1,
"position": {
"left": 193,
"top": 782,
"width": 253,
"height": 28
},
"chinese_key": "17.轮距"
},
"lts": {
"words": "",
"score": 1,
"position": {
"left": 557,
"top": 771,
"width": 222,
"height": 46
},
"chinese_key": "18.轮胎数"
},
"ltgg": {
"words": "205150R17",
"score": 1,
"position": {
"left": 207,
"top": 822,
"width": 68,
"height": 15
},
"chinese_key": "19.轮胎规格"
},
"gbthps": {
"words": "后轴片",
"score": 1,
"position": {
"left": 573,
"top": 816,
"width": 171,
"height": 18
},
"chinese_key": "20.钢板弹簧片数"
},
"zj": {
"words": "2616",
"score": 1,
"position": {
"left": 207,
"top": 851,
"width": 32,
"height": 16
},
"chinese_key": "21.轴距(mm)"
},
"zs": {
"words": "2",
"score": 1,
"position": {
"left": 589,
"top": 853,
"width": 12,
"height": 16
},
"chinese_key": "22.轴数"
},
"wkcc": {
"words": "长4288宽1704高1601mm",
"score": 1,
"position": {
"left": 193,
"top": 873,
"width": 364,
"height": 26
},
"chinese_key": "23.外廓尺寸(mm)"
},
"hxnbcc": {
"words": "长宽高mm",
"score": 1,
"position": {
"left": 193,
"top": 903,
"width": 364,
"height": 18
},
"chinese_key": "24.货厢内部尺寸(mm)"
},
"zzl": {
"words": "品",
"score": 1,
"position": {
"left": 161,
"top": 933,
"width": 18,
"height": 16
},
"chinese_key": "25.总质量(kg)"
},
"hdzzl": {
"words": "",
"score": 1,
"position": {
"left": 446,
"top": 1003,
"width": 127,
"height": -37
},
"chinese_key": "26.核定载质量(kg)"
},
"kdzk": {
"words": "5",
"score": 1,
"position": {
"left": 205,
"top": 973,
"width": 12,
"height": 16
},
"chinese_key": "27.核定载客(人)"
},
"zqyzzl": {
"words": "",
"score": 1,
"position": {
"left": 446,
"top": 950,
"width": 127,
"height": 46
},
"chinese_key": "28.准牵引总质量(kg)"
},
"jsszk": {
"words": "",
"score": 1,
"position": {
"left": 177,
"top": 978,
"width": 149,
"height": 45
},
"chinese_key": "29.驾驶室载客(人)"
},
"syxz": {
"words": "非营运",
"score": 1,
"position": {
"left": 473,
"top": 1006,
"width": 47,
"height": 19
},
"chinese_key": "30.使用性质"
},
"clhdfs": {
"words": "购买",
"score": 1,
"position": {
"left": 205,
"top": 1034,
"width": 32,
"height": 18
},
"chinese_key": "31.车辆获得方式"
},
"clccrq": {
"words": "2008-05-01",
"score": 1,
"position": {
"left": 474,
"top": 1038,
"width": 71,
"height": 16
},
"chinese_key": "32.车辆出厂日期"
},
"fzrq": {
"words": "2009-07-02",
"score": 1,
"position": {
"left": 665,
"top": 1038,
"width": 73,
"height": 18
},
"chinese_key": "34.发证日期"
}
},
"error_code": 0,
"description": "识别成功",
"request_id": "B7602CB34DCB484F953E1755BF9F883C",
"recognize_time": 1719,
"available_count": 123074
}
返回说明
通用参数
参数 | 类型 | 说明 |
---|---|---|
result | array | 返回结果数组,包括所有字段的识别信息 |
error_code | int | 错误码,返回0为正确,其他为错误 |
description | string | 识别结果描述 |
request_id | string | 请求唯一标识符 |
recognize_time | int | 识别所用时间,单位为毫秒 |
available_count | int | 识别剩余可用次数,次数不足时无法继续识别,可在控制台进行充值次数 |
车辆登记证识别特有参数
参数 | 类型 | 说明 |
---|---|---|
jdcsyr | string | 机动车所有人/身份证名称/号码 |
djjg | string | 登记机关 |
djrq | string | 登记日期 |
jdcbh | string | 机动车登记编号 |
cllx | string | 车辆类型 |
clpp | string | 车辆品牌 |
clxh | string | 车辆型号 |
csys | string | 车身颜色 |
clsbdm | string | 车辆识别代码/车架号 |
gcjk | string | 国产/进口 |
fdjh | string | 发动机号 |
fdjxh | string | 发动机型号 |
rlzl | string | 燃料种类 |
plgl | string | 排量/功率 |
zzcmc | string | 制造厂名称 |
zxxs | string | 转向形式 |
lj | string | 轮距 |
lts | string | 轮胎数 |
ltgg | string | 轮胎规格 |
gbthps | string | 钢板弹簧片数 |
zj | string | 轴距 |
zs | string | 轴数 |
wkcc | string | 外廓尺寸 |
hxnbcc | string | 货厢内部尺寸 |
zzl | string | 总质量 |
hdzzl | string | 核定载质量 |
kdzk | string | 核定载客 |
zqyzzl | string | 准牵引总质量 |
jsszk | string | 驾驶室载客 |
syxz | string | 使用性质 |
clhdfs | string | 车辆获得方式 |
clccrq | string | 车辆出厂日期 |
fzrq | string | 发证日期 |
position | array | 当前字段在图像上的位置信息 |
left | int | 位置值,距离原图左侧距离x,单位为像素 |
top | int | 位置值,距离原图上方距离y,单位为像素 |
width | int | 位置值,字段所在图框宽度w,单位为像素 |
height | int | 位置值,字段所在图框高度h,单位为像素 |
words | string | 识别结果 |
score | float | 照片可信度 |
quad | string | 四个顶点坐标 |
chinese_key | string | 该字段中文含义 |