如何操作dlib地标点 [英] How to manipulate dlib landmark points
问题描述
我不知道如何操作/访问dlib地标点。我在相机预览上运行代码,旨在检测一些特定的情绪。我想检查例如眼睑之间的距离或嘴唇的位置如何随时间变化等。
I wonder how can I manipulate/access the dlib landmark points. I run the code on the camera preview with the intention of detecting some particular emotions. I would like to check how for example the distance between eyelids or how the position of the lips changes in time and so on.
推荐答案
For python api - try this link( https:// matthewearl .github.io / 2015/07/28 / switching-eds-with-python / )
For python api - try this link (https://matthewearl.github.io/2015/07/28/switching-eds-with-python/)
对于C ++ - http://dlib.net/train_shape_predictor_ex.cpp.html 示例具有估计双眼距离的代码:
For C++ - http://dlib.net/train_shape_predictor_ex.cpp.html sample has code for estimating interocular distance:
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
Same way you can access any facial features More info about the feature numbers can be found in dlib/image_processing/render_face_detections.h
这篇关于如何操作dlib地标点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!