看了 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()