百度 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);
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于