首页 > 其他 > 详细

接入腾讯云的OCR识别身份证信息

时间:2021-07-08 18:31:07      阅读:46      评论:0      收藏:0      [点我收藏+]

在公司用到这个功能在这里进行总结一下

1 导入Pom

    <dependency>
            <groupId>com.tencentcloudapi</groupId>
            <artifactId>tencentcloud-sdk-java</artifactId>
            <version>3.1.94</version>
        </dependency>

2 测试类

public class CertificationTest {

    @Test
    public void  CertificationTest(){
        String tsecretId="xxxxx";
        String tsecretKey="xxxx";
        String image="xxxx";
        try{
            Credential cred = new Credential(tsecretId, tsecretKey);
            HttpProfile httpProfile = new HttpProfile();
            httpProfile.setEndpoint("ocr.tencentcloudapi.com");
            ClientProfile clientProfile = new ClientProfile();
            clientProfile.setHttpProfile(httpProfile);
            OcrClient client = new OcrClient(cred, "ap-beijing", clientProfile);
            IDCardOCRRequest req = new IDCardOCRRequest();
            req.setImageUrl(image);
            IDCardOCRResponse resp = client.IDCardOCR(req);

            System.out.println(IDCardOCRResponse.toJsonString(resp));
        } catch (TencentCloudSDKException e) {
            System.out.println(e.toString());
        }
    }
}

接入腾讯云的OCR识别身份证信息

原文:https://www.cnblogs.com/HezhenbinGoGo/p/14986481.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!