注意:需要安装opencv和dlib库,安装可见此教程。同时需要下载dlib库封装好的代码shape_predictor_68_face_landmarks.dat(用于人脸68维特征点标注)及dlib_face_recognition_resnet_model_v1.dat(用于提取人脸128维特征)。
本文所有代码及封装库可从https://github.com/TimeIvyace/Dlib-OpenCV_face.git中下载。
使用OpenCV调用摄像头并用Dlib人脸检测和标注特征点
import cv2
import dlib
PREDICTOR_PATH = "shape_predictor_68_face_landmarks.dat"
# 使用dlib自带的frontal_face_detector作为人脸提取器
detector = dlib.get_frontal_face_detector()
# 使用官方模型构建特征提取器
predictor = dlib.shape_predictor(PREDICTOR_PATH)
if __name__ ==


8922

被折叠的 条评论
为什么被折叠?



