【问题标题】:DLIB's Upper and lower eye lid detection accuracy is not correct for closed eyeDLIB 的上下眼睑检测精度对于闭眼不正确
【发布时间】:2020-01-14 03:08:50
【问题描述】:

我们正在使用 DLIB 进行人脸检测,它被扩展为检测眼睛是睁着还是闭着。

效果非常好,但是对于某些图像完全闭眼,它没有给出正确的分数。

例如正确的图像

如您所见,RED 点已正确放置。

检测不正确如下图

您可以看到以蓝色绘制的点的位置不正确。 理想情况下,上下眼睑之间的距离应为零。

但事实并非如此。 我们搜索了是否可以进行任何调整,但没有运气。

替代解决方案可以是,在 dlib 处理后应用一些过滤器来检测 Iris 等,但为此寻找更好的解决方案。

【问题讨论】:

    标签: c# image-processing dlib face eye-detection


    【解决方案1】:

    您可以做的改进很少。首先,您需要使用灰框进行更好的跟踪:

    # Load frames from the camera
    while True:
        _, frame = cap.read()
        # Use gray frame for better tracking
        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    

    您可以做的第二个改进是创建一个新的面部标志(眼睛的顶部中心和眼睛的底部中心),您可以使用简单数学来做到这一点:

    # Create new facial landmarks
    def midpoint(p1, p2):
        return int((p1.x + p2.x)/2), int((p1.y + p2.y)/2)
    

    那么你应该有位于每只眼睛顶部和底部中心的点。你可能会问:那有什么帮助呢?好吧,您可以使用这些点并在它们之间画一条线,如下所示:

    # Draw line between different facial landmarks
    ver_line = cv2.line(frame, center_top, center_bottom, (0, 255, 0), 2)
    

    然后用水平线做同样的事情:

    # Draw line between different facial landmarks
    hor_line = cv2.line(frame, left_point, right_point, (0, 255, 0), 2)
    

    然后计算水平和垂直线的长度,并取其比值:

    # Calculating length of the lines
    hor_line_lenght = hypot(
        (left_point[0] - right_point[0]), (left_point[1] - right_point[1]))
    ver_line_lenght = hypot(
        (center_top[0] - center_bottom[0]), (center_top[1] - center_bottom[1]))
    ratio = hor_line_lenght/ver_line_lenght
    return ratio
    

    【讨论】:

    • 感谢您的回复和建议。我们尝试了灰度,但 Dlib 的输出相同。关于比率,当 dlib 检测到正确的点时,这将很有帮助,以防眼睛闭合。
    猜你喜欢
    • 1970-01-01
    • 2019-04-20
    • 2023-04-02
    • 2020-03-05
    • 2019-03-14
    • 1970-01-01
    • 2019-11-10
    • 2017-05-11
    • 2015-05-02
    相关资源
    最近更新 更多