【问题标题】:How to manipulate dlib landmark points如何操作 dlib 地标点
【发布时间】:2016-10-29 12:59:49
【问题描述】:

我想知道如何操作/访问 dlib 地标点。我在相机预览上运行代码,目的是检测一些特定的情绪。我想检查例如眼睑之间的距离或嘴唇的位置如何随时间变化等等。

【问题讨论】:

  • 您可以使用嘴唇点的距离获取所有点并估计表达式。为此,您需要从 dlib 研究面部表情,您只能获得地标点。

标签: c++ opencv image-processing face-detection dlib


【解决方案1】:

对于 python api - 试试这个链接 (https://matthewearl.github.io/2015/07/28/switching-eds-with-python/)

对于 C++ - http://dlib.net/train_shape_predictor_ex.cpp.html 示例有用于估计眼距的代码:

double interocular_distance (
    const full_object_detection& det
)
{
    dlib::vector<double,2> l, r;
    double cnt = 0;
    // Find the center of the left eye by averaging the points around 
    // the eye.
    for (unsigned long i = 36; i <= 41; ++i) 
    {
        l += det.part(i);
        ++cnt;
    }
    l /= cnt;

    // Find the center of the right eye by averaging the points around 
    // the eye.
    cnt = 0;
    for (unsigned long i = 42; i <= 47; ++i) 
    {
        r += det.part(i);
        ++cnt;
    }
    r /= cnt;

    // Now return the distance between the centers of the eyes
    return length(l-r);
}

您可以通过同样的方式访问任何面部特征 有关功能编号的更多信息,请参阅dlib/image_processing/render_face_detections.h

【讨论】:

  • 谢谢,我会看看 C++ 选项。 :)
猜你喜欢
  • 2019-02-01
  • 2017-09-21
  • 2017-05-22
  • 2017-12-29
  • 2015-04-19
  • 2017-02-09
  • 2019-04-20
  • 2016-07-18
  • 2020-09-03
相关资源
最近更新 更多