首页 车牌识别 车牌识别示例代码 车牌识别[Python]

车牌识别示例代码[Python]

作者:liuxiaojie 阅读数:1873 上传时间:2016-03-10

车牌识别

#!/usr/bin/python
# encoding:utf-8

import urllib2, json, urllib, cookielib
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers



# 1、车牌识别

data = {}
data["appkey"] = "your_appkey_here"
register_openers()
datagen, headers = multipart_encode({"pic": open("11.jpg", "rb")})

url_values = urllib.urlencode(data)
url = "https://api.jisuapi.com/licenseplaterecognition/recognize" + "?" + url_values

request = urllib2.Request(url,datagen, headers)
result = urllib2.urlopen(request)
jsonarr = json.loads(result.read())

if jsonarr["status"] != u"0":
    print jsonarr["msg"]
    exit()
result = jsonarr["result"]
for v in result:
    print v,result[v]