新车发票

接口描述

用户通过发送HTTP Post请求方式提交数据至公有云服务器,服务器识别并返回json格式的识别结果。

接口说明

请求URL:http://api.exocr.com/ocr/v1/vehicle_invoice

请求方式:HTTP Post

返回格式:json

参数
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_invoice";

      //设置请求参数

      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":{

    "print_code":{

      "words":"142##1",

      "score":1,

      "position":{

        "left":320,

        "top":282,

        "width":244,

        "height":33

      },

      "chinese_key":"机打代码"

    },

    "print_no":{

      "words":"0##86",

      "score":1,

      "position":{

        "left":320,

        "top":339,

        "width":168,

        "height":32

      },

      "chinese_key":"机打号码"

    },

    "machine_no":{

      "words":"88##7042",

      "score":1,

      "position":{

        "left":322,

        "top":397,

        "width":244,

        "height":30

      },

      "chinese_key":"机器编号"

    },

    "invoice_date":{

      "words":"2017-09-01",

      "score":1,

       "position":{

        "left":220,

        "top":189,

        "width":204,

        "height":33

      },

      "chinese_key":"开票日期"

    },

    "invoice_code":{

      "words":"142##001",

      "score":1,

      "position":{

        "left":1385,

        "top":113,

        "width":246,

        "height":41

      },

      "chinese_key":"发票代码"

    },

    "invoice_no":{

      "words":"0##",

      "score":1,

      "position":{

        "left":1391,

        "top":166,

        "width":168,

        "height":36

      },

      "chinese_key":"发票号码"

    },

    "tax_code":{

      "words":"",

      "score":1,

      "position":{

        "left":756,

        "top":196,

        "width":940,

        "height":319

      },

      "chinese_key":"税控码"

    },

    "buyer_name":{

      "words":"##",

      "score":1,

      "position":{

        "left":296,

        "top":497,

        "width":62,

        "height":32

      },

      "chinese_key":"购方名称"

    },

    "buyer_id":{

      "words":"420##14427",

      "score":1,

      "position":{

        "left":320,

        "top":545,

        "width":362,

        "height":28

      },

      "chinese_key":"购买方身份证号或组织机构代码"

    },

    "vehicle_type":{

      "words":"多用途乘用车",

      "score":1,

      "position":{

        "left":308,

        "top":605,

        "width":170,

        "height":30

      },

      "chinese_key":"车辆类型"

    },

    "brand":{

      "words":"雪佛兰牌/CHEVROLETSGM6479DAA1",

      "score":1,

      "position":{

        "left":780,

        "top":603,

        "width":397,

        "height":30

      },

      "chinese_key":"厂牌型号"

    },

    "production_addr":{

      "words":"武汉市",

      "score":1,

      "position":{

        "left":1393,

        "top":599,

        "width":86,

        "height":30

      },

      "chinese_key":"产地"

    },

    "cert_no":{

      "words":"WA##376",

      "score":1,

      "position":{

        "left":304,

        "top":681,

        "width":218,

        "height":26

      },

      "chinese_key":"合格证号"

    },

    "import_no":{

      "words":"",

      "score":1,

      "position":{

        "left":780,

        "top":635,

        "width":478,

        "height":110

      },

      "chinese_key":"进口证明书号"

    },

    "test_no":{

      "words":"",

      "score":1,

      "position":{

        "left":1369,

        "top":0,

        "width":310,

        "height":745

      },

      "chinese_key":"商检单号"

    },

    "engine_no":{

      "words":"17##31",

      "score":1,

      "position":{

         "left":306,

        "top":753,

        "width":132,

        "height":26

      },

      "chinese_key":"发动机号码"

    },

    "vin":{

      "words":"SG##34955",

      "score":1,

      "position":{

        "left":1158,

        "top":742,

        "width":339,

        "height":33

      },

      "chinese_key":"车辆识别代码"

    },

    "amount_big":{

      "words":"壹拾伍万陆仟玖佰圆整",

      "score":1,

      "position":{

        "left":342,

        "top":824,

        "width":329,

        "height":38

      },

      "chinese_key":"价税合计大写"

    },

    "amount_small":{

      "words":"",

      "score":1,

      "position":{

        "left":0,

        "top":779,

        "width":1696,

        "height":112

      },

      "chinese_key":"价税合计小写"

    },

    "seller_name":{

      "words":"湖##公司",

      "score":1,

      "position":{

        "left":304,

        "top":893,

        "width":449,

        "height":41

      },

      "chinese_key":"销方名称"

    },

    "seller_tax_no":{

      "words":"914##72F",

      "score":1,

      "position":{

        "left":305,

        "top":968,

        "width":368,

        "height":42

      },

      "chinese_key":"销方纳税人识别号"

    },

    "seller_address":{

      "words":"##",

      "score":1,

      "position":{

        "left":303,

        "top":1045,

        "width":354,

        "height":42

      },

      "chinese_key":"销方地址"

    },

    "seller_phone":{

      "words":"##15",

      "score":1,

      "position":{

        "left":1195,

        "top":887,

        "width":170,

        "height":26

      },

      "chinese_key":"销方电话"

    },

    "seller_bank_account":{

      "words":"##",

      "score":1,

      "position":{

        "left":1195,

        "top":961,

        "width":236,

        "height":26

      },

      "chinese_key":"销方账号"

    },

    "seller_bank":{

      "words":"##",

      "score":1,

      "position":{

         "left":1058,

        "top":1036,

        "width":219,

        "height":36

      },

      "chinese_key":"销方开户行"

    }

  },

  "error_code":0,

  "description":"识别成功",

  "request_id":"D092EA132F924A1E92124B3AB9FDD2DE",

  "recognize_time":1734,

  "available_count":9993

}

返回说明

通用参数

参数 类型 说明
result array 返回结果数组,包括所有字段的识别信息
error_code int 错误码,返回0为正确,其他为错误
description string 识别结果描述
request_id string 请求唯一标识符
recognize_time int 识别所用时间,单位为毫秒
available_count int 识别剩余可用次数,次数不足时无法继续识别,可在控制台进行充值次数

机动车发票识别特有参数

参数 类型 说明
print_code string 机打代码
print_no string 机打号码
machine_no string 机器编号
invoice_date string 开票日期
invoice_code string 发票代码
invoice_no string 发票号码
tax_code string 税控码
buyer_name string 购方名称
buyer_tax_no string 购买方身份证号或组织机构代码
vehicle_type string 车辆类型
brand string 厂牌型号
production_addr string 产地
cert_no string 合格证号
import_no string 进口证明书号
test_no string 商检单号
engine_no string 发动机号码
vin string 车辆识别代码
amount_big string 价税合计大写
amount_small string 价税合计小写
seller_name string 销方名称
seller_tax_no string 销方纳税人识别号
seller_address string 销方地址
seller_phone string 销方电话
seller_bank_account string 销方账号
seller_bank string 销方开户行
position array 当前字段在图像上的位置信息
left int 位置值,距离原图左侧距离x,单位为像素
top int 位置值,距离原图上方距离y,单位为像素
width int 位置值,字段所在图框宽度w,单位为像素
height int 位置值,字段所在图框高度h,单位为像素
sheet_type Object 联次
tax_rate Object 税率
tax_amount Object 合计税额
pretax_amount object 不含税价小写
tax_gov_name object 主管税务机关
tax_gov_no object 主管税务机关代码
tax_payment_receipt object 完税凭证号码
tonnage object 吨位
limit_passengers object 限乘人数
issuer object 开票人
price_tax_correction object 价税互纠
words string 识别结果
score float 照片可信度
quad string 四个顶点坐标
chinese_key string 该字段中文含义
Copyright © 2020 易道博识 all right reserved,powered by Gitbook该文件修订时间: 2023-12-04 14:10:10

results matching ""

    No results matching ""