首页 文章

检测任何非正面的面部标志

提问于
浏览
-1

我使用dlib库进行面部标志检测 . 但是当面部非正面时,dlib的“frontal_face_detector”无法检测到面部 .

有没有其他方法可以检测个人脸部的面部地标?

1 回答

  • 2

    根据我的经验,Dlib的默认面部检测器(例如Python API中的 detector = dlib.get_frontal_face_detector() )在非正面面板上运行良好,甚至可以检测靠近轮廓的面部 .

    根据source code,'s because it'是一个基于HOG的探测器,实际上是由5个不同的HOG滤波器构建的:

    它由5个HOG过滤器构成 . 前视,左视,右视,前视但向左旋转,最后是前视但向右旋转 .

    这是一个检测示例:

    enter image description here

    这是我使用的Python 3代码(使用OpenCV读取/写入图像并绘制矩形):

    import cv2
    import dlib
    
    img = cv2.imread('will.jpg')
    detector = dlib.get_frontal_face_detector()
    dets = detector(img, 1)
    face = dets[0]
    cv2.rectangle(img, (face.left(), face.top()), (face.right(), face.bottom()), (0, 255, 0), 2)
    cv2.imwrite('out.jpg', img)
    

相关问题