百度云OCR的cordova插件,目前支持车牌识别 去掉了x86支持
Installation 1、Run
cordova plugin add https://github.com/smxs1994/ty-cordova-baidu-ocr.git
2、Baidu云申请并下载aip.license授权文件。注意:id应匹配。
3、在config.xml里添加license文件的resource-file,注意:修改PATH/TO/
Supported Platforms Android iOS Using the plugin A full example could be:初始化(init):
BaiduOcr.init(
()=>{
console.log('init ok');
},
(error)=>{
console.log(error)
})
扫描身份证(scan id card):
//默认使用的是本地质量控制,如果想使用拍照的方式,可以修改参数为
//nativeEnable:false,nativeEnableManual:false
BaiduOcr.scanId(
{
contentType:"IDCardFront", // 背面传 IDCardBack
nativeEnable:true,
nativeEnableManual:true
},
(result)=>{
console.log(JSON.stringify(result));
},
(error)=>{
console.log(error)
});
车牌识别:
//默认使用的是本地质量控制,如果想使用拍照的方式,可以修改参数为
//nativeEnable:false,nativeEnableManual:false
BaiduOcr.scanLicensePlate(
(result)=>{
console.log(JSON.stringify(result));
},
(error)=>{
console.log(error)
});
销毁本地控制模型(destroy):
BaiduOcr.destroy(
()=>{
console.log('destroy ok');
},
(error)=>{
console.log(error)
});