车辆保险系统搭建——借助阿里云OCR接口
老样子,没时间,用python。
第一步,阿里云控制台获取accesskey
不管你调用任何的能力,基本都需要获取accesskey。
第二步,去阿里云视觉开放平台查看接口文档
编写代码(CV高级工程师上线)
#!/usr/bin/env python
#coding=utf-8
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdkocr.request.v20191230.RecognizeLicensePlateRequest import RecognizeLicensePlateRequest
from aliyunsdkocr.request.v20191230.RecognizeDriverLicenseRequest import RecognizeDriverLicenseRequest
from aliyunsdkocr.request.v20191230.RecognizeIdentityCardRequest import RecognizeIdentityCardRequest
client = AcsClient('<accessKeyId>', '<accessSecret>', 'cn-shanghai')
requestNumber = RecognizeLicensePlateRequest()
requestNumber.set_accept_format('json')
requestDriver = RecognizeDriverLicenseRequest()
requestDriver.set_accept_format('json')
requestIdnumber = RecognizeIdentityCardRequest()
requestIdnumber.set_accept_format('json')
requestNumber.set_ImageURL("车辆照片,含有车牌")
requestDriver.set_ImageURL("驾驶证照片正面")
requestDriver.set_Side("face")
requestIdnumber.set_ImageURL("身份证照片")
requestIdnumber.set_Side("face")
responseNumber = client.do_action_with_exception(requestNumber)
responseDriver = client.do_action_with_exception(requestDriver)
responseIdnumber = client.do_action_with_exception(requestIdnumber)
print(str(responseNumber, encoding='utf-8'))
print(str(responseDriver, encoding='utf-8'))
print(str(responseIdnumber, encoding='utf-8'))
实际效果
填写accesskeyid和accesssecret以及图片链接运行
对比原图查看识别效果
结语
有时间再完善,现在的话,又不是不能用~