render_face.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2019 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 
6 #include <dlib/image_processing/full_object_detection.h>
7 #include <dlib/gui_widgets.h>
8 #include <vector>
9 #include "markup_68.h"
10 
11 
12 /*
13  Return lines rendering facial landmarks for a 68-point detection, that can
14  easily be used with dlib::image_window::add_overlay().
15 
16  Based on dlib::render_face_detections(), made a little simpler.
17 */
18 std::vector< dlib::image_window::overlay_line > render_face(
19  dlib::full_object_detection const & face,
20  dlib::rgb_pixel const & color
21 )
22 {
23  typedef dlib::image_window::overlay_line overlay_line;
24  std::vector< overlay_line > lines;
25 
26  // Around Chin. Ear to Ear
27  for( unsigned long i = markup_68::JAW_FROM; i < markup_68::JAW_TO; ++i )
28  lines.push_back( overlay_line( face.part( i ), face.part( i + 1 ), color ) );
29 
30  // Nose
31  for( unsigned long i = markup_68::NOSE_RIDGE_FROM; i < markup_68::NOSE_RIDGE_TO; ++i )
32  lines.push_back( overlay_line( face.part( i ), face.part( i + 1 ), color ) );
33  lines.push_back( overlay_line( face.part( markup_68::NOSE_TIP ), face.part( markup_68::NOSE_BOTTOM_FROM ), color ) );
34  lines.push_back( overlay_line( face.part( markup_68::NOSE_TIP ), face.part( markup_68::NOSE_BOTTOM_TO ), color ) );
35 
36  // Left eyebrow
38  lines.push_back( overlay_line( face.part( i ), face.part( i + 1 ), color ) );
39 
40  // Right eyebrow
41  for( unsigned long i = markup_68::LEFT_EYEBROW_FROM; i < markup_68::LEFT_EYEBROW_TO; ++i )
42  lines.push_back( overlay_line( face.part( i ), face.part( i + 1 ), color ) );
43 
44  // Right eye
45  for( unsigned long i = markup_68::RIGHT_EYE_FROM; i < markup_68::RIGHT_EYE_TO; ++i )
46  lines.push_back( overlay_line( face.part( i ), face.part( i + 1 ), color ) );
47  lines.push_back( overlay_line( face.part( markup_68::RIGHT_EYE_FROM ), face.part( markup_68::RIGHT_EYE_TO ), color ) );
48 
49  // Left eye
50  for( unsigned long i = markup_68::LEFT_EYE_FROM; i < markup_68::LEFT_EYE_TO; ++i )
51  lines.push_back( overlay_line( face.part( i ), face.part( i + 1 ), color ) );
52  lines.push_back( overlay_line( face.part( markup_68::LEFT_EYE_FROM ), face.part( markup_68::LEFT_EYE_TO ), color ) );
53 
54  // Lips inside part
55  for( unsigned long i = markup_68::MOUTH_INNER_FROM; i < markup_68::MOUTH_INNER_TO; ++i )
56  lines.push_back( overlay_line( face.part( i ), face.part( i + 1 ), color ) );
57  lines.push_back( overlay_line( face.part( markup_68::MOUTH_INNER_FROM ), face.part( markup_68::MOUTH_INNER_TO ), color ) );
58 
59  return lines;
60 }
std::vector< dlib::image_window::overlay_line > render_face(dlib::full_object_detection const &face, dlib::rgb_pixel const &color)
Definition: render_face.h:18
GLuint color
int i
std::array< float, 3 > color
Definition: model-views.h:449
GLenum GLuint GLint GLenum face
Definition: glext.h:3377


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:39