0

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.

Teresa Kozera
  • 232
  • 6
  • 12
  • 1
    You can get all points and estimate expressions using the distance of points of lips. For that you need to study face expression from dlib you can only get landmark points. –  Jul 02 '16 at 09:54

1 Answers1

3

For python api - try this link (https://matthewearl.github.io/2015/07/28/switching-eds-with-python/)

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);
}

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

Evgeniy
  • 2,481
  • 14
  • 24