Browse Source

Update README.md

pull/1/MERGE
syan GitHub 6 years ago
parent
commit
cce3f2308c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      README.md

+ 10
- 0
README.md View File

@@ -94,6 +94,16 @@ import numpy as np
grr = cv2.imread("images_rec/demo1.jpg") grr = cv2.imread("images_rec/demo1.jpg")
model = pr.LPR("model/cascade.xml","model/model12.h5","model/ocr_plate_all_gru.h5") 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): for pstr,confidence,rect in model.SimpleRecognizePlateByE2E(grr):
if confidence>0.7: if confidence>0.7:
image = drawRectBox(grr, rect, pstr+" "+str(round(confidence,3))) image = drawRectBox(grr, rect, pstr+" "+str(round(confidence,3)))


Loading…
Cancel
Save