文章内容
接口简介:

接口盒子官方版轻量OCR图片识别,支持数十种语言,可识别常规图片文字,打印字体,支持返回文字坐标。不支持元素复杂的图片识别。该接口无论是否识别成功,均扣费。



请求地址:

https://cn.apihz.cn/api/ocr/apihzocr.php



请求方式:

POST或GET。



请求参数:

【名称】【参数】【必填】【说明】

【用户ID】【id】【是】【用户中心的数字ID,例:id=10000000】

【用户KEY】【key】【是】【用户中心通讯秘钥,例:key=15he5h15ty854j5sr152hs2】

【识别语言】【lan】【否】【指定识别语言,默认中英识别,可2-3种组合,用<>链接,例如eng<>chi_sim,在识别语言不正确时可自行指定语言包。对应语言包请查看【https://www.apihz.cn/article/c53554be3692bd5e1ccf0115c74d76f6.html】例:lan=chi_sim】

【二值化】【type】【否】【1=二值化处理,0=不处理,识别内容不理想时可进行二值化处理,默认1。例:type=1】

【二值化调整】【threshold】【否】【调整二值化级别,0-1之间的单精度小数,不同的图片可通过调整二值化级别来提升识别准确度,默认0.7。例:threshold=1】

【图片】【img】【是】【可以是网络图片地址,也可以是BASE64图片编码数据,图片大小不能超过500KB,例:img=https://down.erguanmingmin.com/api/test/test.png】



返回参数:

【名称】【参数】【说明】

【状态码】【code】【200成功,400错误】

【消息内容】【msg】【信息提示。】

【识别数据集】【data】【识别数据集。】

【识别文字】【data.text_nospace】【识别出的文字内容。】

【识别区域】【data.count】【识别出的文字区域数量。】

【文字数量】【data.wordcount】【文字数量,最多返回200个字。】

【文字数据集】【data.items】【文字数据集。】

【识别文字单个】【data.items.text】【识别出的单个文字。】

【可信度】【data.items.confidence】【可信度,准确度。】

【坐标数据集】【data.items.bbox】【识别出的文字坐标数据集。】

【左边距离】【data.items.bbox.left】【横坐标。】

【顶边距离】【data.items.bbox.top】【纵坐标。】

【宽度】【data.items.bbox.width】【文字宽度。】

【高度】【data.items.bbox.height】【文字高度。】



GET请求示例:

https://cn.apihz.cn/api/ocr/apihzocr.php?id=88888888&key=88888888&lan=chi_sim&type=1&threshold=0.7&img=https://down.erguanmingmin.com/api/test/test.png

注意:示例里的ID与KEY为公共ID与KEY,共享每分钟调用频次限制,接口本身免费,请使用自己的ID与KEY,独享每分钟调用频次。每日调用无上限。



POST请求示例:

请根据开发语言自行POST。



返回数据示例:

示例:{"code":400,"msg":"通讯秘钥错误。"}

示例:

{

"code": 200,

"msg": "识别成功",

"data": {

"items": [{

"text": "解",

"confidence": 92,

"bbox": {

"left": 25,

"top": 25,

"width": 26.5,

"height": 17

}

}, {

"text": "决",

"confidence": 92,

"bbox": {

"left": 51.5,

"top": 25,

"width": 26.5,

"height": 17

}

}, {

"text": "方",

"confidence": 96,

"bbox": {

"left": 80,

"top": 25,

"width": 11.5,

"height": 17

}

}, {

"text": "案",

"confidence": 96,

"bbox": {

"left": 91.5,

"top": 25,

"width": 11.5,

"height": 17

}

}, {

"text": "1",

"confidence": 70,

"bbox": {

"left": 107,

"top": 21,

"width": 4.5,

"height": 31

}

}, {

"text": ";",

"confidence": 70,

"bbox": {

"left": 111.5,

"top": 21,

"width": 4.5,

"height": 31

}

}, {

"text": "修",

"confidence": 93,

"bbox": {

"left": 123,

"top": 25,

"width": 25.5,

"height": 17

}

}, {

"text": "复",

"confidence": 93,

"bbox": {

"left": 148.5,

"top": 25,

"width": 25.5,

"height": 17

}

}, {

"text": "目",

"confidence": 96,

"bbox": {

"left": 160,

"top": 21,

"width": 17,

"height": 31

}

}, {

"text": "录",

"confidence": 96,

"bbox": {

"left": 177,

"top": 21,

"width": 17,

"height": 31

}

}, {

"text": "权",

"confidence": 96,

"bbox": {

"left": 195,

"top": 25,

"width": 25.5,

"height": 17

}

}, {

"text": "限",

"confidence": 96,

"bbox": {

"left": 220.5,

"top": 25,

"width": 25.5,

"height": 17

}

}, {

"text": "问",

"confidence": 93,

"bbox": {

"left": 249,

"top": 21,

"width": 10,

"height": 31

}

}, {

"text": "题",

"confidence": 93,

"bbox": {

"left": 259,

"top": 21,

"width": 10,

"height": 31

}

}],

"text_nospace": "解决方案1;修复目录权限问题",

"count": 14,

"wordcount": 14

}

}



参考资料(版权):

https://www.apihz.cn/api/ocrapihzocr.html
如有侵权请联系我们删除!