2

看了 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
1.2k 声望41 粉丝

时间永远分岔,通往无数未来


« 上一篇
BOM 惨案