npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-baidu-ocr

v1.1.1

Published

Cordova plugin of Baidu Ocr

Downloads

1

Readme

Cordova Baidu OCR 文字识别插件

================================

百度云OCR的cordova插件,iOS和android能识别身份证、银行卡、行驶证、驾驶证、车牌、营业执照、通用票据,android还能识别护照、数字、二维码、名片、手写、彩票、增值税发票。

Installation

1、Run

cordova plugin add cordova-baidu-ocr

Or

cordova plugin add https://github.com/hankersyan/cordova-baidu-ocr.git

2、Baidu云申请并下载aip.license授权文件。注意:id应匹配。

3、在config.xml里添加license文件的resource-file,注意:修改PATH/TO/

<platform name="android">
    <resource-file src="PATH/TO/aip-android.license" target="app/src/main/assets/aip.license" />
</platform>
<platform name="ios">
    <resource-file src="PATH/TO/aip-ios.license" target="aip.license" />
</platform>

Supported Platforms

  • Android
  • iOS

Using the plugin

A full example could be:

初始化(init):

    BaiduOcr.init(
        ()=>{
            console.log('init ok');
        },
        (error)=>{
            console.log(error)
        })

销毁本地控制模型(destroy):

    BaiduOcr.destroy(
        ()=>{
            console.log('destroy 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)
        });

扫描银行卡:

    BaiduOcr.scanBankCard({}, (result)=>{
        console.log(JSON.stringify(result));
    },
    (error)=>{
        console.log(JSON.stringify(error));
    });

扫描行驶证:

    BaiduOcr.scanVehicleLicense({}, (result)=>{
        console.log(JSON.stringify(result));
    },
    (error)=>{
        console.log(JSON.stringify(error));
    });

扫描驾驶证:

    BaiduOcr.scanDrivingLicense({}, (result)=>{
        console.log(JSON.stringify(result));
    },
    (error)=>{
        console.log(JSON.stringify(error));
    });

扫描车牌:

    BaiduOcr.scanLicensePlate({}, (result)=>{
        console.log(JSON.stringify(result));
    },
    (error)=>{
        console.log(JSON.stringify(error));
    });

扫描营业执照:

    BaiduOcr.scanBusinessLicense({}, (result)=>{
        console.log(JSON.stringify(result));
    },
    (error)=>{
        console.log(JSON.stringify(error));
    });

扫描通用票据:

    BaiduOcr.scanReceipt({}, (result)=>{
        console.log(JSON.stringify(result));
    },
    (error)=>{
        console.log(JSON.stringify(error));
    });

Android还支持以下方法:

//护照
scanPassport
//数字
scanNumbers
//二维码
scanQrCode
//名片
scanBusinessCard
//手写
scanHandWriting
//彩票
scanLottery
//增值税发票
scanVatInvoice