uniapp 安卓百度OCR图文证件识别原生插件
安卓百度OCR图文证件识别原生插件,支持各种证件识别,图片文字识别。
·
插件介绍
安卓百度OCR图文证件识别原生插件,支持各种证件识别,图片文字识别
插件地址
安卓百度OCR图文证件识别原生插件 - DCloud 插件市场
使用文档
用法
在需要使用插件的页面加载以下代码
const module = uni.requireNativePlugin("leven-baiduOcr-OcrModule");
页面内容
<template>
<view>
<uni-card title="安卓百度OCR图文证件识别原生插件">
<button type="primary" @click="init">初始化</button>
<uni-section title="通用文字识别类型">
<uni-data-checkbox v-model="basicTextType" :localdata="basicTextTypeList"></uni-data-checkbox>
</uni-section>
<button type="primary" @click="basicText">通用文字识别</button>
<button type="primary" @click="webImage">网络图片识别</button>
<uni-section title="身份证识别类型">
<uni-data-checkbox v-model="idCardType" :localdata="idCardTypeList"></uni-data-checkbox>
</uni-section>
<button type="primary" @click="idCard">身份证识别</button>
<button type="primary" @click="bankCard">银行卡识别</button>
<button type="primary" @click="vehicleCard">行驶证识别</button>
<button type="primary" @click="drivingCard">驾驶证识别</button>
<button type="primary" @click="licensePlate">车牌识别</button>
<button type="primary" @click="businessLicense">营业执照识别</button>
<button type="primary" @click="receipt">通用票据识别</button>
<button type="primary" @click="vatInvoice">增值税发票识别</button>
<button type="primary" @click="taxiCoupon">出租车票识别</button>
<button type="primary" @click="vinCode">VIN码识别</button>
<button type="primary" @click="trainTicket">火车票识别</button>
<button type="primary" @click="number">数字识别</button>
<button type="primary" @click="qrcodeRecognize">二维码识别</button>
<button type="primary" @click="businessCard">名片识别</button>
<button type="primary" @click="handwriting">手写识别</button>
<button type="primary" @click="tripTicket">行程单识别</button>
<button type="primary" @click="carSellTicket">机动车销售发票识别</button>
<button type="primary" @click="vehicleCertificate">车辆合格证识别</button>
<button type="primary" @click="exampleRecognize">试卷分析和识别</button>
<button type="primary" @click="passPort">护照识别</button>
<button type="primary" @click="huKou">户口本识别</button>
<button type="primary" @click="commonMachineInvoice">普通机打发票识别</button>
<button type="primary" @click="weightNote">磅单识别</button>
<button type="primary" @click="medicalDetail">医疗费用明细识别</button>
<button type="primary" @click="onlineTaxiItinerary">网约车行程单识别</button>
<button type="primary" @click="custom">自定义识别</button>
<button type="primary" @click="logStr = ''">清空日志</button>
</uni-card>
<view>
<uni-card class="uni-card-box" title="日志">
<view><text style="font-size: 14px; flex-wrap: wrap;">{{logStr}}</text></view>
</uni-card>
</view>
</view>
</template>
<script>
const module = uni.requireNativePlugin("leven-baiduOcr-OcrModule");
export default {
data() {
return {
logStr: "",
//通用文字识别列表
basicTextType: 1,
//通用文字识别类型列表
basicTextTypeList: [{
text: "普通版",
value: 1
}, {
text: "高精度版",
value: 2
}, {
text: "含位置信息版",
value: 3
}, {
text: "含位置信息高精度版",
value: 4
}, {
text: "含生僻字版",
value: 5
}],
//身份证识别类型
idCardType: 1,
//身份证识别类型列表
idCardTypeList: [{
text: "正面",
value: 1
}, {
text: "背面",
value: 2
}]
}
},
methods: {
//初始化
init() {
module.init({
//license文件名称
licenseFile: "aip-ocr.license"
}, res => {
this.writeLog(JSON.stringify(res))
});
},
//通用文字识别
basicText() {
module.basicText({
//类型,1.普通版,2.高精度版,3.含位置信息版,4.含位置信息高精度版,5.含生僻字版
type: this.basicTextType
}, res => {
this.writeLog(JSON.stringify(res))
});
},
//网络图片识别
webImage() {
module.webImage(res => {
this.writeLog(JSON.stringify(res))
});
},
//身份证识别
idCard() {
module.idCard({
//类型,1.正面,2.背面
type: this.idCardType
}, res => {
this.writeLog(JSON.stringify(res))
});
},
//银行卡识别
bankCard() {
module.bankCard(res => {
this.writeLog(JSON.stringify(res))
});
},
//行驶证识别
vehicleCard() {
module.vehicleCard(res => {
this.writeLog(JSON.stringify(res))
});
},
//驾驶证识别
drivingCard() {
module.drivingCard(res => {
this.writeLog(JSON.stringify(res))
});
},
//车牌识别
licensePlate() {
module.licensePlate(res => {
this.writeLog(JSON.stringify(res))
});
},
//营业执照识别
businessLicense() {
module.businessLicense(res => {
this.writeLog(JSON.stringify(res))
});
},
//通用票据识别
receipt() {
module.receipt(res => {
this.writeLog(JSON.stringify(res))
});
},
//增值税发票识别
vatInvoice() {
module.vatInvoice(res => {
this.writeLog(JSON.stringify(res))
});
},
//出租车票识别
taxiCoupon() {
module.taxiCoupon(res => {
this.writeLog(JSON.stringify(res))
});
},
//VIN码识别
vinCode() {
module.vinCode(res => {
this.writeLog(JSON.stringify(res))
});
},
//火车票识别
trainTicket() {
module.trainTicket(res => {
this.writeLog(JSON.stringify(res))
});
},
//数字识别
number() {
module.number(res => {
this.writeLog(JSON.stringify(res))
});
},
//二维码识别
qrcodeRecognize() {
module.qrcodeRecognize(res => {
this.writeLog(JSON.stringify(res))
});
},
//名片识别
businessCard() {
module.businessCard(res => {
this.writeLog(JSON.stringify(res))
});
},
//手写识别
handwriting() {
module.handwriting(res => {
this.writeLog(JSON.stringify(res))
});
},
//行程单识别
tripTicket() {
module.tripTicket(res => {
this.writeLog(JSON.stringify(res))
});
},
//机动车销售发票识别
carSellTicket() {
module.carSellTicket(res => {
this.writeLog(JSON.stringify(res))
});
},
//车辆合格证识别
vehicleCertificate() {
module.vehicleCertificate(res => {
this.writeLog(JSON.stringify(res))
});
},
//试卷分析和识别
exampleRecognize() {
module.exampleRecognize(res => {
this.writeLog(JSON.stringify(res))
});
},
//护照识别
passPort() {
module.passPort(res => {
this.writeLog(JSON.stringify(res))
});
},
//户口本识别
huKou() {
module.huKou(res => {
this.writeLog(JSON.stringify(res))
});
},
//普通机打发票识别
commonMachineInvoice() {
module.commonMachineInvoice(res => {
this.writeLog(JSON.stringify(res))
});
},
//磅单识别
weightNote() {
module.weightNote(res => {
this.writeLog(JSON.stringify(res))
});
},
//医疗费用明细识别
medicalDetail() {
module.medicalDetail(res => {
this.writeLog(JSON.stringify(res))
});
},
//网约车行程单识别
onlineTaxiItinerary() {
module.onlineTaxiItinerary(res => {
this.writeLog(JSON.stringify(res))
});
},
//自定义识别
custom() {
module.custom(res => {
this.writeLog(JSON.stringify(res))
});
},
// 写日志
writeLog(str) {
console.log(str)
let logStr = uni.$lv.date.format(null, "yyyy-mm-dd hh:MM:ss") + " " + str + "\n";
// let logStr = str + "\n";
this.logStr = logStr + this.logStr;
}
}
}
</script>
<style>
</style>
插件方法
- 初始化
- 通用文字识别
- 网络图片识别
- 身份证识别
- 银行卡识别
- 行驶证识别
- 驾驶证识别
- 车牌识别
- 营业执照识别
- 通用票据识别
- 增值税发票识别
- 出租车票识别
- VIN码识别
- 火车票识别
- 数字识别
- 二维码识别
- 名片识别
- 手写识别
- 行程单识别
- 机动车销售发票识别
- 车辆合格证识别
- 试卷分析和识别
- 护照识别
- 户口本识别
- 普通机打发票识别
- 磅单识别
- 医疗费用明细识别
- 网约车行程单识别
- 自定义识别
具体方法的使用请参考使用说明文档
联系作者
购买插件前请先试用,试用通过再购买。在试用中如果遇到任何问题,可与作者联系,将全力协助你使用本插件
加入公众号可联系作者
图片预览
更多推荐
所有评论(0)