1. 简介
利用训练好的 shape_predictor_68_face_landmarks.dat(人脸 68 点特征检测器),进行人脸面部轮廓特征的提取。
下载地址:http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
2. 代码
face_landmark_detector_remark.py
# -*- coding: utf-8 -*-
import dlib
from skimage import io
import os
import glob
#获取人脸检测器
detector = dlib.get_frontal_face_detector()
#获取当前路径
current_path = os.getcwd()
predictor_path = current_path + "\\model\\shape_predictor_68_face_landmarks.dat"
#dlib 68个特征点模型
predictor = dlib.shape_predictor(predictor_path)
#绘制图片
win = dlib.image_window()
#循环检测当前目录下的jpg图片
for img_path in glob.glob(os.path.join(current_path,"*.jpg")):
#读取图片
img = io.imread(