自动识别营业执照号码和地址实例

该段代码展示了如何使用腾讯云OCR服务来识别营业执照。首先,它通过设置ID和密钥创建Credential对象,然后配置HTTPProfile和ClientProfile。接着,创建OcrClient并调用BizLicenseOCR方法,传入图片URL以获取识别结果。识别结果通过log.info打印,并最终将响应转化为ResultVO返回。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 public ResultVo businessLicenseOcr(String picUrl){
        try{
			String id ="**************";
			String key = "************";
            Credential cred = new Credential(id, key);
            HttpProfile httpProfile = new HttpProfile();
            httpProfile.setEndpoint("ocr.tencentcloudapi.com");

            ClientProfile clientProfile = new ClientProfile();
            clientProfile.setHttpProfile(httpProfile);

            OcrClient client = new OcrClient(cred, "ap-beijing", clientProfile);

            BizLicenseOCRRequest req = new BizLicenseOCRRequest();
            req.setImageUrl(picUrl);
            BizLicenseOCRResponse resp = client.BizLicenseOCR(req);
            log.info(BizLicenseOCRResponse.toJsonString(resp));
            return ResultVOUtils.success(resp);
        } catch (TencentCloudSDKException e) {
            log.info(e.toString());
            return ResultVOUtils.error(Constants.$Failure,e.getMessage());
        }
    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值