1 #include "gaze/pipeline_steps/face_landmarks.h"
6 #include "dlib/image_processing.h"
7 #include "dlib/image_processing/frontal_face_detector.h"
8 #include "dlib/image_processing/render_face_detections.h"
10 #include "yaml-cpp/yaml.h"
12 #include "gaze/util/config.h"
13 #include "gaze/util/data.h"
20 FaceLandmarks::FaceLandmarks()
21 : face_detector(dlib::get_frontal_face_detector()) {
23 this->
name = config[
"name"] ?
26 std::string landmarks_model(
"shape_predictor_68_face_landmarks.dat");
27 dlib::deserialize(config[
"model"] ?
28 config[
"model"].as<std::string>() :
29 landmarks_model) >> this->shape_predictor;
34 if (faces.
size() > 0) {
40 this->
widget->clear_overlay();
46 if (data.
landmarks.get_rect().is_empty()) {
52 this->
widget->add_overlay(dlib::image_display::overlay_rect(
54 dlib::rgb_pixel(0, 0, 255)));
55 this->
widget->add_overlay(dlib::render_face_detections(data.
landmarks));
void visualize(util::Data &data) override
std::shared_ptr< widget_type > widget
dlib::array2d< dlib::bgr_pixel > image
dlib::full_object_detection landmarks
void process(util::Data &data) override
Wraps the data acquired per frame into a single instance.
size_type size() const noexcept