gaze  0.1.0
Perform gaze tracking with common webcams.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
Public Member Functions | List of all members
gaze::pipeline::FaceLandmarks Class Referencefinal

Uses dlibs pretrained models to detect face landmarks. More...

#include "gaze/pipeline_steps/face_landmarks.h"

Inheritance diagram for gaze::pipeline::FaceLandmarks:
gaze::PipelineStep gaze::gui::Visualizeable< widget_type > gaze::gui::VisualizeableBase

Public Member Functions

void process (util::Data &data) override
 
void visualize (util::Data &data) override
 
- Public Member Functions inherited from gaze::PipelineStep
 PipelineStep ()
 
std::string get_name ()
 
virtual ~PipelineStep ()=default
 
- Public Member Functions inherited from gaze::gui::Visualizeable< widget_type >
std::shared_ptr< dlib::drawable > init (dlib::drawable_window &parent, int width, int height, std::string text="No visualization.") final
 
void remove_widget () override
 
- Public Member Functions inherited from gaze::gui::VisualizeableBase
virtual ~VisualizeableBase ()=default
 

Additional Inherited Members

- Protected Attributes inherited from gaze::PipelineStep
int number
 
std::string name
 
- Protected Attributes inherited from gaze::gui::Visualizeable< widget_type >
std::shared_ptr< widget_type > widget
 

Detailed Description

Uses dlibs pretrained models to detect face landmarks.

///

Todo:
shoeffner: Write documentation for FaceLandmarks.

Definition at line 22 of file face_landmarks.h.

Member Function Documentation

void gaze::pipeline::FaceLandmarks::process ( util::Data data)
overridevirtual

Detects face landmarks inside the source image.

Updates both eyes and face bounding boxes of data.

Parameters
dataThe data object to be updated.
Returns
via data the modified data object.

Implements gaze::PipelineStep.

Definition at line 32 of file face_landmarks.cpp.

References gaze::util::Data::image, gaze::util::Data::landmarks, and std::vector< _Tp, _Alloc >::size().

Referenced by visualize().

32  {
33  std::vector<dlib::rectangle> faces = this->face_detector(data.image);
34  if (faces.size() > 0) {
35  data.landmarks = this->shape_predictor(data.image, faces[0]);
36  }
37 }
size_type size() const noexcept
void gaze::pipeline::FaceLandmarks::visualize ( util::Data data)
overridevirtual
Parameters
dataThe data object to be updated.

Implements gaze::gui::VisualizeableBase.

Definition at line 39 of file face_landmarks.cpp.

References gaze::util::Data::image, gaze::util::Data::landmarks, process(), and gaze::gui::Visualizeable< widget_type >::widget.

39  {
40  this->widget->clear_overlay();
41 
42  // Reprocess the data in case multiple pipeline steps
43  // interfered - this is good for comparisons.
44  this->process(data);
45 
46  if (data.landmarks.get_rect().is_empty()) {
47  this->widget->set_image(data.image);
48  return;
49  }
50 
51  this->widget->set_image(data.image);
52  this->widget->add_overlay(dlib::image_display::overlay_rect(
53  data.landmarks.get_rect(),
54  dlib::rgb_pixel(0, 0, 255)));
55  this->widget->add_overlay(dlib::render_face_detections(data.landmarks));
56 }
std::shared_ptr< widget_type > widget
void process(util::Data &data) override

The documentation for this class was generated from the following files: