简单易用的百度 OCR 接口操作工具包

本贴最后更新于 1962 天前,其中的信息可能已经时移世改

百度 OCR 接口操作工具类,不依赖第三方框架实现,让您 5 行代码即可调用百度 OCR 的各个接口

项目代码:github/baidu-ocr-operator

如何使用

  • Maven 加载项目依赖
<dependency>
    <groupId>com.liumapp.operator.baidu.ocr</groupId>
    <artifactId>baidu-ocr-operator</artifactId>
    <version>v1.0.2</version>
</dependency>
  • 配置应用,在您的项目 resources 目录下创建一个 baidu-ocr.yml 文件(需要严格注意文件命名),并配置您的应用信息
com:
  liumapp:
    baidu:
      ocr:
        appId: 'your app id here'
        appKey: 'your app key here'
        appSecret: 'your app secret here'

营业执照 OCR

OcrOperator ocrOperator = new OcrOperator();
BusinessLicenseOcr businessLicenseOcr = new BusinessLicenseOcr();
BusinessLicenseOcrRequire businessLicenseOcrRequire = new BusinessLicenseOcrRequire();
businessLicenseOcrRequire.setLicensePicPath(dataPath + "/businessLicense01.jpg");
JSONObject res = ocrOperator.doJob(businessLicenseOcr, businessLicenseOcrRequire);
System.out.println(res.toJSONString());

驾驶证 OCR

OcrOperator ocrOperator = new OcrOperator();  
DriveLicenseOcr driveLicenseOcr = new DriveLicenseOcr();  
DriveLicenseOcrRequire driveLicenseOcrRequire = new DriveLicenseOcrRequire();  
driveLicenseOcrRequire.setLicensePicPath(dataPath + "/driveLicense01.jpg");  
JSONObject res = ocrOperator.doJob(driveLicenseOcr, driveLicenseOcrRequire);  
System.out.println(res.toJSONString());

行驶证 OCR

OcrOperator ocrOperator = new OcrOperator();  
VehicleLicenseOcr vehicleLicenseOcr = new VehicleLicenseOcr();  
VehicleLicenseOcrRequire vehicleLicenseOcrRequire = new VehicleLicenseOcrRequire();  
vehicleLicenseOcrRequire.setLicensePicPath(dataPath + "/vehicleLicense01.jpg");  
JSONObject res = ocrOperator.doJob(vehicleLicenseOcr, vehicleLicenseOcrRequire);  
System.out.println(res);
  • OCR
    9 引用 • 7 回帖
  • Java

    Java 是一种可以撰写跨平台应用软件的面向对象的程序设计语言,是由 Sun Microsystems 公司于 1995 年 5 月推出的。Java 技术具有卓越的通用性、高效性、平台移植性和安全性。

    3168 引用 • 8207 回帖
  • 百度

    百度(Nasdaq:BIDU)是全球最大的中文搜索引擎、最大的中文网站。2000 年 1 月由李彦宏创立于北京中关村,致力于向人们提供“简单,可依赖”的信息获取方式。“百度”二字源于中国宋朝词人辛弃疾的《青玉案·元夕》词句“众里寻他千百度”,象征着百度对中文信息检索技术的执著追求。

    63 引用 • 785 回帖 • 253 关注

相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...