利用OCR技术识别并返回营业执照相关文本信息 ## 接口说明 该接口目前可返回如下两种识别结果: - 识别成功:OCR成功识别证件信息,并返回识别出的文字信息字段 - 非营业执照或检测不出营业执照信息:上传的照片为非营业执照照片,或因像素或拍摄角度等原因造成OCR无法识别出证照信息。 ### 鉴权说明 易盾信息认证服务使用签名方法对接口进行鉴权,所有接口每一次请求都需要包含签名信息(signature参数),以验证用户身份,防止信息被恶意篡改。目前支持MD5,SHA1,SHA256,SM3几种加密算法,详细信息,请参见接口鉴权 (https://support.dun.163.com/documents/391676076156063744?docId=622572798032863232) ## 请求 ### 请求地址 名称 | 值 HTTP URL | http://verify.dun.163.com/v1/ocr/business_license (http://verify.dun.163.com/v1/ocr/business_license) HTTP Method | POST ### 请求头 名称 | 类型 | 必填 | 描述 Content-Type | String | 是 | 固定值:"application/x-www-form-urlencoded" ### 请求参数 请求参数由请求公共参数和请求业务参数两部分组成,通用参数见请求通用字段 (https://support.dun.163.com/documents/391676076156063744?docId=622573136165068800) 名称 | 类 型 | 必填 | 最大长度 | 描述 image | String | 是 | 4M | 默认BASE64格式,要求BASE64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/jpeg/png/bmp格式.注:图片的BASE64编码是不包含图片头的,如(data:image/jpg;BASE64) accuracy | String | 否 | 10 | 精确度:normal,high参数选normal或为空使用快速服务;选择high使用高精度服务,但是时延会根据具体图片有相应的增加 detectDirection | String | 否 | 10 | 是否检测图像朝向:可选值true - 检测朝向;false - 不检测朝向。朝向是指输入图像是正常方向、逆时针旋转90/180/270度 ### 请求体示例 Code: image=imageBASE64 string&version=v1&businessId=xxx×tamp=1638180222235&nonce=xxx&secretId=xxx&signature=xxx ## 响应 ### 响应结果 响应字段如下,响应通用字段已省略,详细见响应公共字段 (https://support.dun.163.com/documents/391676076156063744?docId=624032228347863040) 参数名称 | 类型 | 必须返回 | 描述 status | Number | 是 | 1-识别成功 2-图像识别错误 3-图像格式错误 4-其他错误 taskId | String | 是 | 本次请求数据标识,可以根据该标识查询数据最新结果 isPayed | Number | 是 | 本次请求是否收费标识,1代表收费,0代表不收费 ocrResponseDetail | Object | 否 | OCR识别信息 ∟ wordsResultNum | Number | 否 | 识别结果数,表示words_result的元素个数 ∟ direction | Number | 否 | 图像方向,当 detectDirection = true 时,返回该参数。 -1:未定义 0:正向1:逆时针90度2:逆时针180度3:逆时针270度 ∟ wordsResult | Object | 否 | OCR识别数据项,结构见下方 ∟words | Number | 否 | 识别结果字符串 ∟location | Object | 否 | 坐标信息,结构如下 ∟top | Number | 否 | 表示定位位置的长方形左上顶点的垂直坐标 ∟left | Number | 否 | 表示定位位置的长方形左上顶点的水平坐标 ∟width | Number | 否 | 表示定位位置的长方形的宽度 ∟ height | Number | 否 | 表示定位位置的长方形的高度 ### 响应体示例 Code (json): { "status": 1, "taskId": "75c1014c7cf645a7b485fad1913456", "isPayed": 1, "ocrResponseDetail": { "wordsResult": { "社会信用代码": { "words": "1234567", "location": { "top": 123, "left": 401, "width": 50, "height": 7 } }, "组成形式": { "words": "个体经营", "location": { "top": 176, "left": 177, "width": 34, "height": 9 } }, "经营范围": { "words": "餐饮", "location": { "top": 222, "left": 176, "width": 19, "height": 9 } }, "成立日期": { "words": "无", "location": { "top": -1, "left": -1, "width": 0, "height": 0 } }, "法人": { "words": "李一", "location": { "top": 151, "left": 176, "width": 18, "height": 9 } }, "注册资本": { "words": "无", "location": { "top": -1, "left": -1, "width": 0, "height": 0 } }, "证件编号": { "words": "无", "location": { "top": -1, "left": -1, "width": 0, "height": 0 } }, "地址": { "words": "xxx路155号", "location": { "top": 198, "left": 177, "width": 97, "height": 10 } }, "单位名称": { "words": "xxx单位", "location": { "top": 127, "left": 178, "width": 67, "height": 10 } }, "有效期": { "words": "无", "location": { "top": -1, "left": -1, "width": 0, "height": 0 } }, "类型": { "words": "无", "location": { "top": -1, "left": -1, "width": 0, "height": 0 } } }, "wordsResultNum": 11, "direction": 0 } } ### 响应返回码 响应返回码见:响应返回码 (https://support.dun.163.com/documents/391676076156063744?docId=624032338595143680)