faceWarp.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:DelaunayVisualization-FacialWarp 作者: sneha-belkhale 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号