python人脸识别(二)

2 py人脸识别库 

python人脸识别(二)

python人脸识别(二)

python人脸识别(二)

3 人脸探测原理

python人脸识别(二)

3.1线性分类器

python人脸识别(二)

python人脸识别(二)

python人脸识别(二) 3.2 滑动窗口检测

python人脸识别(二)

 3.3 影像金字塔

python人脸识别(二)

python人脸识别(二)

 4 人脸探测步骤

python人脸识别(二)

4.1 程序源代码 

import dlib
from skimage import io

# 使用 Dlib 的正面人脸检测器 frontal_face_detector
detector = dlib.get_frontal_face_detector()

# 图片所在路径
img = io.imread("C:/Users/Administrator/Desktop/图像处理/lena.jpg")

# 生成 Dlib 的图像窗口
win = dlib.image_window()
win.set_image(img)

# 使用detector检测器来检测图像中的人脸
faces = detector(img, 1)
print(type(faces[0]), '\n')

print("人脸数 / faces in all:", len(faces))

for i, d in enumerate(faces):
    print("第", i+1, "个人脸的矩形框坐标:",
          "left:", d.left(), '\t', "right:", d.right(), '\t', "top:", d.top(),'\t',  "bottom:", d.bottom())

# 绘制矩阵轮廓
win.add_overlay(faces)

# 保持图像
dlib.hit_enter_to_continue()

 4.2 运行结果

python人脸识别(二)

python人脸识别(二)