From cce3f2308c21ea2857cf8d812f5f360aa1293ba0 Mon Sep 17 00:00:00 2001 From: syan Date: Wed, 4 Jul 2018 16:10:15 +0800 Subject: [PATCH] Update README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index ccacd1e..c8485c0 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,16 @@ import numpy as np grr = cv2.imread("images_rec/demo1.jpg") model = pr.LPR("model/cascade.xml","model/model12.h5","model/ocr_plate_all_gru.h5") +def drawRectBox(image,rect,addText): + cv2.rectangle(image, (int(rect[0]), int(rect[1])), (int(rect[0] + rect[2]), int(rect[1] + rect[3])), (0,0, 255), 2,cv2.LINE_AA) + cv2.rectangle(image, (int(rect[0]-1), int(rect[1])-16), (int(rect[0] + 115), int(rect[1])), (0, 0, 255), -1, + cv2.LINE_AA) + img = Image.fromarray(image) + draw = ImageDraw.Draw(img) + draw.text((int(rect[0]+1), int(rect[1]-16)), addText.decode("utf-8"), (255, 255, 255), font=fontC) + imagex = np.array(img) + return imagex + for pstr,confidence,rect in model.SimpleRecognizePlateByE2E(grr): if confidence>0.7: image = drawRectBox(grr, rect, pstr+" "+str(round(confidence,3)))