这个网址提供了一个云车牌识别的测试接口,我测试一下.下边是代码.
import base64
import requests
image_path = "1.jpg"
secret_key = 'YOUR_KEY' #注册后软件会给一个Key
with open(image_path, 'rb') as image_file:
image_base64 = base64.b64encode(image_file.read())
url = ('https://api.openalpr.com/v2/recognize_bytes'
+ '?recognize_vehicle=1&country=eu&secret_key={}'.format(secret key))
r= requests.post(url, data=img_base64)
try:
print({
'plate': r.json()['results'][0]['plate'],
'Brand': r.json()['results'][0]['vehicle']['make'][0]['name'],
'Color': r.json()['results'][0]['vehicle']['color'][0]['name']
})
except:
print('Plate cannot be identified')
输出:
{'Plate': '5G6330,, 'Brand': 'mercedes-benz', 'Color': 'silver-gray'}
这个网址效果还行,就是太贵了.
最后的话:
这篇文章发布在CSDN/蓝色的杯子, 没事多留言,让我们一起爱智求真吧.我的邮箱wisdomfriend@126.com.