def annotate_landmarks(img, landmarks, font_scale = 0.4):
"""
Annotate face landmarks on image.
Args:
img: a cv2 image object.
landmarks: numpy matrix consisted of points.
Return:
annotated image.
"""
img = img.copy()
for idx, point in enumerate(landmarks):
pos = (point[0, 0], point[0, 1])
cv2.putText(img, str(idx), pos,
fontFace=cv2.FONT_HERSHEY_SCRIPT_SIMPLEX,
fontScale=font_scale,
color=(0, 0, 255))
cv2.circle(img, pos, 3, color=(0, 255, 255))
return img
评论列表
文章目录