用dlib实现人脸识别的68个特征点

看了 10行Python实现更快更准的人脸识别后,发现dlib太短小精悍了,所以打算不用opencv来实现人脸的68的特征点

# -*- coding: UTF-8 -*-
import dlib
from skimage import io
import matplotlib.pyplot as plt

detector = dlib.get_frontal_face_detector()
landmark_predictor = dlib.shape_predictor("shape_predictor_68_face_landmarks.dat/data")
sample_image = io.imread('/home/mugbya/Pictures/d.jpeg')
faces = detector(sample_image, 1)

for k, d in enumerate(faces):
    shape = landmark_predictor(sample_image, d)
    for i in range(68):
        pt = shape.part(i)
        plt.plot(pt.x, pt.y, 'ro')
    plt.imshow(sample_image)
    plt.show()
    原文作者:mugbya
    原文地址: https://segmentfault.com/a/1190000013140225
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞