免费使用识别身份证信息、银行卡、驾驶证、行驶证、车牌、营业执照、网络图片文字等

免费使用识别身份证信息银行卡驾驶证行驶证车牌营业执照网络图片文字等。。。。

身份证效果展示(其他不展示)

在这里插入图片描述

前提

  1. 注册注册百度云,注册之后登录。

  2. 点击右上角的头像,跳转页面之后,点击左上角的菜单,选择文字识别。

  3. 点击创建应用,按照要求填写信息。到达这个界面。
    在这里插入图片描述

  4. 按照领取免费使用资源领取刚刚创建应用的使用资源。

  5. 开始进行实现功能。

功能实现

1. 导入依赖百度jar

<!--百度api识别-->
        <dependency>
            <groupId>com.baidu.aip</groupId>
            <artifactId>java-sdk</artifactId>
            <version>4.16.3</version>
        </dependency>

2. 写一个测试类
APP_ID、 API_KEY、SECRET_KEY更换成自己的。

import com.baidu.aip.ocr.AipOcr;
import org.json.JSONObject;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;

/**
 * @author lenovo
 */
@RestController
@RequestMapping("/baidu")
public class BaiduController {


    /**
     * 识别身份证信息、银行卡、驾驶证、行驶证、车牌、营业执照、网络图片文字等。。。。
     */
    @GetMapping("/carId")
    public void export1(){
        String APP_ID="xxxx";
        String API_KEY="xxxxxxxxxxx";
        String SECRET_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
        //身份证图片
        String frontImgPath="F:/baidujdktemplant/carId_1.jpg";
        String backImgPath="F:/baidujdktemplant/carId_2.jpg";
        //银行卡图片
        String bankImgPath="F:/baidujdktemplant/carId_2.jpg";
        //驾驶证图片
        String drivingImgPath="F:/baidujdktemplant/carId_2.jpg";
        //行驶证图片
        String vehicleImgPath="F:/baidujdktemplant/carId_2.jpg";
        //车牌
        String plateImgPath="F:/baidujdktemplant/carId_2.jpg";
        //营业执照
        String businessImgPath="F:/baidujdktemplant/carId_2.jpg";
        //网络图片文字(可以是本地图片、网络图片)
        String webImgPath="F:/baidujdktemplant/carId_2.jpg";

        // 初始化一个AipOcr
        AipOcr client = new AipOcr(APP_ID, API_KEY, SECRET_KEY);

        // 可选:设置网络连接参数
        client.setConnectionTimeoutInMillis(2000);
        client.setSocketTimeoutInMillis(60000);
        // 传入可选参数调用接口
        HashMap<String, String> options = new HashMap<String, String>();
        options.put("detect_direction", "true");
        options.put("detect_risk", "false");

        // 识别身份证正面(正面图片为本地图片,即D:\1.png)
        JSONObject frontres = client.idcard(frontImgPath, "front", options);
        System.out.println(frontres.toString(2));

        // 识别身份证反面(反面图片为本地图片,即D:\2.png)
        JSONObject backres = client.idcard(backImgPath, "back", options);
        System.out.println(backres.toString(2));

        // 识别银行卡
        JSONObject res = client.bankcard(bankImgPath, options);
        System.out.println(res.toString(2));

        // 识别银行卡、
        JSONObject bank = client.bankcard(bankImgPath, options);
        System.out.println(bank.toString(2));

        // 识别驾驶证、
        JSONObject driving = client.drivingLicense(drivingImgPath, options);
        System.out.println(driving.toString(2));

        // 识别行驶证、
        JSONObject vehicle = client.vehicleLicense(vehicleImgPath, options);
        System.out.println(vehicle.toString(2));

        // 识别车牌、
        JSONObject plate = client.plateLicense(plateImgPath, options);
        System.out.println(plate.toString(2));

        // 识别营业执照、
        JSONObject business = client.businessLicense(businessImgPath, options);
        System.out.println(business.toString(2));

        // 识别网络图片文字
        JSONObject web = client.webImage(webImgPath, options);
        System.out.println(web.toString(2));

    }



}

3. 调用该接口输出结果。
4. 错误代码请参考
官方错误代码
如果是错误代码18,说明领取资源有问题。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

XuDream

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值