代码:
import dlib
#face_recognition_models里面有几个图像模型
import face_recognition_models as fcmodel
img=dlib.load_rgb_image(r'd:/obama.jpg')
#检测
face_detector=dlib.get_frontal_face_detector()
faces=face_detector(img,1)
#预测,
predictor=dlib.shape_predictor(fcmodel.pose_predictor_model_location())#shape_predictor_68_face_landmarks.dat
shape=predictor(img,faces[0])
#打开窗口
win=dlib.image_window()
win.set_image(img)
#检测覆盖原图
win.add_overlay(shape)
win.add_overlay(faces)
dlib.hit_enter_to_continue()
说明:face_recognition_models 有4个模型一个识别、一个检测、两个预测

效果:
1645

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



