def get_facial_landmarks(img):
# No need to upsample
rects = face_detector(img, 0)
if len(rects) == 0:
print "No faces"
return None
rect = rects[0]
shape = shape_predictor(img, rect)
return np.matrix([[pt.x, pt.y] for pt in shape.parts()]), rect
评论列表
文章目录