def get_landmarks(im):
#get a bounding rectangle for the primary face in the image
rects = cascade.detectMultiScale(im, 1.3, 5)
# only get the x y w h coordinates of the first face detected
x, y, w, h = rects[0].astype(long)
# define a rectangle that will contain the face
rect = dlib.rectangle(x, y, x + w, y + h)
# use our predictor to find the facial points within our bounding box
face_points = predictor(im, rect).parts()
#save our results in an array
landmarks = []
for p in face_points:
landmarks.append([p.x, p.y])
return landmarks
faceWarp.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录