swan.ai.ocrVehicleLicense

解释 :对机动车行驶证正本所有关键字段进行识别。

方法参数

Object object

object参数说明 :

success 返回参数说明 :

words_result 返回值说明

品牌型号、发证日期、使用性质、发动机号码、号牌号码、所有人、住址、注册日期、车辆识别代号、车辆类型 返回值说明

示例

在开发者工具中预览效果 请使用百度APP扫码

图片示例

代码示例

  1. Page({ ocrVehicleLicense() { swan.chooseImage({ success: res => { let image = res.tempFilePaths[0]; // AI系列的api有宿主使用限制,只可在百度App中使用,建议使用时加一层判断防止代码报未知错误 let host = swan.getSystemInfoSync().host; if (host === 'baiduboxapp') { swan.ai.ocrVehicleLicense({ image, // 暂不支持识别网络图片 detect_direction: true, accuracy: normal success: res => { console.log('ocrVehicleLicense res', res.words_result); }, fail: err => { console.log('ocrVehicleLicense err', err); } }); } else { swan.showToast({ title: '此api目前仅可在百度App上使用', icon: 'none' }); } } }) }});

返回值示例

  1. { "log_id": $log_id, "direction": 0, "words_result_num": 10, "words_result": { "品牌型号": { "words": "保时捷GT37182RUCRE" }, "发证日期": { "words": "20160104" }, "使用性质": { "words": "非营运" }, "发动机号码": { "words": "20832" }, "号牌号码": { "words": "苏A001" }, "所有人": { "words": "圆圆" }, "住址": { "words": "南京市江宁区弘景大道" }, "注册日期": { "words": "20160104" }, "车辆识别代号": { "words": "HCE58" }, "车辆类型": { "words": "小型轿车" } }}}