Browse Source

update pipline

pull/1/MERGE
jackyu 6 years ago
parent
commit
2da219865a
5 changed files with 13 additions and 35 deletions
  1. +0
    -3
      .gitignore
  2. +13
    -32
      hyperlpr/pipline.py
  3. BIN
      images_rec/006vT0dkzy73eTACbIh15.jpg
  4. BIN
      images_rec/2_.jpg
  5. +0
    -0
      model/cascade_lbp.xml

+ 0
- 3
.gitignore View File

@@ -1,3 +0,0 @@
images_rec/*.*
cache/*.*
hyperlpr/*.pyc

+ 13
- 32
hyperlpr/pipline.py View File

@@ -118,7 +118,8 @@ def RecognizePlateJson(image):




plate,rect,origin_plate =plate plate,rect,origin_plate =plate

res, confidence = e2e.recognizeOne(origin_plate)
print "res",res


cv2.imwrite("./"+str(j)+"_rough.jpg",plate) cv2.imwrite("./"+str(j)+"_rough.jpg",plate)


@@ -146,37 +147,17 @@ def RecognizePlateJson(image):




t2 = time.time() t2 = time.time()
val = segmentation.slidingWindowsEval(image_gray)
if len(val)==3:
blocks, res, confidence = val
if confidence/7>0.0:
image = drawRectBox(image,rect,res)
for i,block in enumerate(blocks):

block_ = cv2.resize(block,(25,25))
block_ = cv2.cvtColor(block_,cv2.COLOR_GRAY2BGR)
image[j * 25:(j * 25) + 25, i * 25:(i * 25) + 25] = block_
if image[j*25:(j*25)+25,i*25:(i*25)+25].shape == block_.shape:
pass

plate_name = res
res_json = {}
if confidence/7>0.0:
res_json["Name"] = plate_name.decode()
res_json["Type"] = td.plateType[ptype]
res_json["Confidence"] = confidence/7;
res_json["x"] = int(rect[0])
res_json["y"] = int(rect[1])
res_json["w"] = int(rect[2])
res_json["h"] = int(rect[3])
# print "车牌:",res,"置信度:",confidence/7
jsons.append(res_json)


else:
pass
# print "不确定的车牌:", res, "置信度:", confidence
print jsons
res, confidence = e2e.recognizeOne(image_rgb)
res_json = {}
if confidence > 0.6:
res_json["Name"] = res
res_json["Type"] = td.plateType[ptype]
res_json["Confidence"] = confidence;
res_json["x"] = int(rect[0])
res_json["y"] = int(rect[1])
res_json["w"] = int(rect[2])
res_json["h"] = int(rect[3])
jsons.append(res_json)
print json.dumps(jsons,ensure_ascii=False,encoding="gb2312") print json.dumps(jsons,ensure_ascii=False,encoding="gb2312")


return json.dumps(jsons,ensure_ascii=False,encoding="gb2312") return json.dumps(jsons,ensure_ascii=False,encoding="gb2312")


BIN
images_rec/006vT0dkzy73eTACbIh15.jpg View File

Before After
Width: 690  |  Height: 518  |  Size: 55 kB

BIN
images_rec/2_.jpg View File

Before After
Width: 936  |  Height: 1104  |  Size: 422 kB

model/cascadelbp.xml → model/cascade_lbp.xml View File


Loading…
Cancel
Save