def post(self): try: param = self.request.body.decode('utf-8') prarm = json.loads(param) image = readb64(prarm["pic"]) filename=str(uuid.uuid1()).replace("-", "") cv2.imwrite("./pics/"+filename+'.png', image) #self.set_header("Content-Type", "text/plain") #self.write("You wrote " + self.get_argument("pic")) r=pipline.RecognizePlateJson(image) print(r) self.finish({'result': r,'status':'ok'}) except: self.finish({'result':'unknown error.','status':'error'})
def recognize(filename): image = cv2.imread(filename) return pipline.RecognizePlateJson(image)
def recognizeBase64(base64_code): file_bytes = np.asarray(bytearray(base64.b64decode(base64_code)), dtype=np.uint8) image_data_ndarray = cv2.imdecode(file_bytes, 1) return pipline.RecognizePlateJson(image_data_ndarray)
def recognize(filename): image = cv2.imread(filename) #通过文件名读入一张图片 放到 image中 return pipline.RecognizePlateJson(image)