Update demo.py
This commit is contained in:
@@ -2,14 +2,11 @@ import sys
|
|||||||
reload(sys)
|
reload(sys)
|
||||||
sys.setdefaultencoding("utf-8")
|
sys.setdefaultencoding("utf-8")
|
||||||
|
|
||||||
from PIL import ImageFont
|
|
||||||
from PIL import Image
|
|
||||||
from PIL import ImageDraw
|
|
||||||
fontC = ImageFont.truetype("./Font/platech.ttf", 14, 0)
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def SpeedTest(image_path):
|
def SpeedTest(image_path):
|
||||||
grr = cv2.imread(image_path)
|
grr = cv2.imread(image_path)
|
||||||
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")
|
||||||
@@ -22,7 +19,10 @@ def SpeedTest(image_path):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
from PIL import ImageFont
|
||||||
|
from PIL import Image
|
||||||
|
from PIL import ImageDraw
|
||||||
|
fontC = ImageFont.truetype("./Font/platech.ttf", 14, 0)
|
||||||
|
|
||||||
def drawRectBox(image,rect,addText):
|
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]), int(rect[1])), (int(rect[0] + rect[2]), int(rect[1] + rect[3])), (0,0, 255), 2,cv2.LINE_AA)
|
||||||
@@ -35,10 +35,12 @@ def drawRectBox(image,rect,addText):
|
|||||||
return imagex
|
return imagex
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import HyperLPRLite as pr
|
import HyperLPRLite as pr
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
grr = cv2.imread("images_rec/2_.jpg")
|
grr = cv2.imread("images_rec/2_.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")
|
||||||
for pstr,confidence,rect in model.SimpleRecognizePlateByE2E(grr):
|
for pstr,confidence,rect in model.SimpleRecognizePlateByE2E(grr):
|
||||||
@@ -49,7 +51,6 @@ for pstr,confidence,rect in model.SimpleRecognizePlateByE2E(grr):
|
|||||||
print "plate_confidence"
|
print "plate_confidence"
|
||||||
print confidence
|
print confidence
|
||||||
|
|
||||||
|
|
||||||
cv2.imshow("image",image)
|
cv2.imshow("image",image)
|
||||||
cv2.waitKey(0)
|
cv2.waitKey(0)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user