Skip to content

Instantly share code, notes, and snippets.

@quangnhat185
Last active April 11, 2020 12:53
Show Gist options
  • Save quangnhat185/7918d29337843c8d17645be0647e50e8 to your computer and use it in GitHub Desktop.
Save quangnhat185/7918d29337843c8d17645be0647e50e8 to your computer and use it in GitHub Desktop.
def draw_box(image_path, cor, thickness=3):
pts=[]
x_coordinates=cor[0][0]
y_coordinates=cor[0][1]
# store the top-left, top-right, bottom-left, bottom-right
# of the plate license respectively
for i in range(4):
pts.append([int(x_coordinates[i]),int(y_coordinates[i])])
pts = np.array(pts, np.int32)
pts = pts.reshape((-1,1,2))
vehicle_image = preprocess_image(image_path)
cv2.polylines(vehicle_image,[pts],True,(0,255,0),thickness)
return vehicle_image
plt.figure(figsize=(8,8))
plt.axis(False)
plt.imshow(draw_box(test_image,cor))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment