出生证明识别

接口描述

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

接口说明

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

请求方式: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/birth_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": {

    "baby_name": {

      "words": "于##",

      "score": 1,

      "position": {

        "left": 434,

        "top": 293,

        "width": 86,

        "height": 32

      },

      "chinese_key": "新生儿姓名"

    },

    "gender": {

      "words": "女",

      "score": 1,

      "position": {

        "left": 744,

        "top": 293,

        "width": 30,

        "height": 32

      },

      "chinese_key": "性别"

    },

    "birth_time": {

      "words": "201X年X月X日11时52",

      "score": 1,

      "position": {

        "left": 951,

        "top": 297,

        "width": 490,

        "height": 34

      },

      "chinese_key": "出生时间"

    },

    "pregnant_weeks": {

      "words": "39",

      "score": 1,

      "position": {

        "left": 380,

        "top": 361,

        "width": 32,

        "height": 26

      },

      "chinese_key": "出生孕周"

    },

    "birth_weight": {

      "words": "3750",

      "score": 1,

      "position": {

        "left": 812,

        "top": 359,

        "width": 57,

        "height": 26

      },

      "chinese_key": "出生体重"

    },

    "birth_height": {

      "words": "50",

      "score": 1,

      "position": {

        "left": 1243,

        "top": 359,

        "width": 32,

        "height": 26

      },

      "chinese_key": "出生身长"

    },

    "birth_place": {

      "words": "江苏石苏州市昆山市县(区)",

      "score": 1,

      "position": {

        "left": 340,

        "top": 417,

        "width": 543,

         "height": 32

      },

      "chinese_key": "出生地点"

    },

    "hospital_name": {

      "words": "昆山市##医院",

      "score": 1,

      "position": {

        "left": 1075,

        "top": 415,

        "width": 262,

        "height": 32

      },

      "chinese_key": "医疗机构名称"

    },

    "mother_name": {

      "words": "陈##",

      "score": 1,

      "position": {

        "left": 368,

         "top": 523,

        "width": 58,

        "height": 32

      },

      "chinese_key": "母亲姓名"

    },

    "mother_age": {

      "words": "36",

      "score": 1,

      "position": {

        "left": 606,

        "top": 529,

        "width": 80,

        "height": 24

      },

      "chinese_key": "母亲年龄"

    },

    "mother_country": {

      "words": "中国",

      "score": 1,

      "position": {

        "left": 790,

        "top": 523,

        "width": 57,

        "height": 32

      },

      "chinese_key": "母亲国籍"

    },

    "mother_nationality": {

      "words": "",

       "score": 1,

      "position": {

        "left": 0,

        "top": 204,

        "width": 1646,

        "height": 961

      },

      "chinese_key": "母亲民族"

    },

    "mother_address": {

      "words": "武汉###3号",

      "score": 1,

      "position": {

        "left": 1135,

        "top": 527,

        "width": 332,

        "height": 26

      },

      "chinese_key": "母亲住址"

    },

    "mother_id_no": {

      "words": "",

      "score": 1,

      "position": {

        "left": 0,

        "top": 204,

        "width": 1646,

        "height": 961

      },

      "chinese_key": "母亲有效身份证件号码"

    },

    "father_name": {

      "words": "于##",

      "score": 1,

      "position": {

        "left": 370,

        "top": 687,

        "width": 58,

        "height": 28

      },

       "chinese_key": "父亲姓名"

    },

    "father_age": {

      "words": "37",

      "score": 1,

      "position": {

        "left": 605,

        "top": 691,

        "width": 79,

        "height": 26

      },

      "chinese_key": "父亲年龄"

    },

    "father_country": {

      "words": "中国",

      "score": 1,

      "position": {

        "left": 790,

        "top": 685,

        "width": 57,

         "height": 32

      },

      "chinese_key": "父亲国籍"

    },

    "father_nationality": {

      "words": "",

      "score": 1,

      "position": {

        "left": 0,

        "top": 204,

        "width": 1646,

        "height": 961

      },

      "chinese_key": "父亲民族"

    },

    "father_address": {

      "words": "山东###1号楼",

      "score": 1,

      "position": {

        "left": 1137,

        "top": 660,

        "width": 420,

        "height": 57

      },

      "chinese_key": "父亲住址"

    },

    "father_id_no": {

      "words": "",

      "score": 1,

      "position": {

        "left": 0,

        "top": 204,

        "width": 1646,

        "height": 961

      },

      "chinese_key": "父亲有效身份证件号码"

    },

    "issue_authority": {

      "words": "昆山###医院",

      "score": 1,

      "position": {

        "left": 396,

        "top": 875,

        "width": 260,

        "height": 31

      },

      "chinese_key": "签发机构"

    },

    "issue_date": {

      "words": "201X年X月X日",

      "score": 1,

      "position": {

        "left": 350,

        "top": 942,

        "width": 302,

        "height": 26

      },

      "chinese_key": "签发日期"

    }

  },

  "error_code": 0,

  "description": "识别成功",

  "request_id": "F1DADE3F02A74493949DB407BDC860F1",

  "recognize_time": 1899,

  "available_count": 123079

}

返回说明

通用参数

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

出生证明识别特有参数

参数 类型 说明
baby_name string 新生儿姓名
gender string 性别
birth_time string 出生时间
pregnant_weeks string 出生孕周
birth_weight string 出生体重
birth_height string 出生体长
birth_place string 出生地点
hospital_name string 医疗机构名称
mother_name string 母亲姓名
mother_age string 母亲年龄
mother_country string 母亲国籍
mother_nationality string 母亲民族
mother_address string 母亲住址
mother_id_no string 母亲有效身份证件号码
father_name string 父亲姓名
father_age string 父亲年龄
father_country string 父亲国籍
father_nationality string 父亲民族
father_address string 父亲住址
father_id_no string 父亲有效身份证件号码
issue_authority string 签发机构
issue_date string 签发日期
position array 当前字段在图像上的位置信息
left int 位置值,距离原图左侧距离x,单位为像素
top int 位置值,距离原图上方距离y,单位为像素
width int 位置值,字段所在图框宽度w,单位为像素
height int 位置值,字段所在图框高度h,单位为像素
chinese_key String 该字段中文含义
words String 识别结果
score Float 照片可信度,取值范围为0~1
quad String 四个顶点坐标,依次为左上,右上,右下,左下四个点的坐标值
mother_id_type Object 母亲有效证件类别
father_id_type Object 父亲有效证件类别
cert_no Object 编号
Copyright © 2020 易道博识 all right reserved,powered by Gitbook该文件修订时间: 2023-12-04 14:10:10

results matching ""

    No results matching ""