如何操作 dlib 地标点
How to manipulate dlib landmark points
我想知道如何 manipulate/access dlib 地标点。我 运行 相机预览中的代码旨在检测某些特定情绪。我想检查一下眼皮之间的距离或嘴唇的位置如何随时间变化等。
对于 python api - 试试这个 link (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
我想知道如何 manipulate/access dlib 地标点。我 运行 相机预览中的代码旨在检测某些特定情绪。我想检查一下眼皮之间的距离或嘴唇的位置如何随时间变化等。
对于 python api - 试试这个 link (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