5 #include <dlib/image_processing/frontal_face_detector.h> 6 #include <dlib/image_processing/render_face_detections.h> 7 #include <dlib/image_processing.h> 8 #include <dlib/gui_widgets.h> 9 #include "../rs_frame_image.h" 28 return dpt.get_depth_scale();
31 throw std::runtime_error(
"Device does not have a depth sensor" );
35 int main(
int argc,
char * argv[])
try 65 dlib::frontal_face_detector face_bbox_detector = dlib::get_frontal_face_detector();
66 dlib::shape_predictor face_landmark_annotator;
67 dlib::deserialize(
"shape_predictor_68_face_landmarks.dat" ) >> face_landmark_annotator;
90 dlib::rgb_pixel bad_color( 255, 0, 0 );
91 dlib::rgb_pixel good_color( 0, 255, 0 );
93 dlib::image_window win;
94 while( ! win.is_closed() )
97 data = align_to_color.
process( data );
105 std::vector< dlib::rectangle > face_bboxes = face_bbox_detector( image );
106 std::vector< dlib::full_object_detection > faces;
107 for(
auto const &
bbox : face_bboxes )
108 faces.push_back( face_landmark_annotator( image,
bbox ));
112 win.set_image( image );
113 for(
auto const &
face : faces )
115 dlib::rgb_pixel &
color =
117 ? good_color : bad_color;
124 catch( dlib::serialization_error
const &
e )
126 std::cerr <<
"You need dlib's default face landmarking model file to run this example." << std::endl;
127 std::cerr <<
"You can get it from the following URL: " << std::endl;
128 std::cerr <<
" http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2" << std::endl;
129 std::cerr << std::endl <<
e.what() << std::endl;
137 catch (
const std::exception& e)
frameset wait_for_frames(unsigned int timeout_ms=RS2_DEFAULT_TIMEOUT) const
std::vector< dlib::image_window::overlay_line > render_face(dlib::full_object_detection const &face, dlib::rgb_pixel const &color)
std::vector< sensor > query_sensors() const
float get_depth_scale(rs2::device dev)
GLenum GLenum GLsizei void * image
depth_frame get_depth_frame() const
video_frame get_color_frame() const
const std::string & get_failed_args() const
void deserialize(Stream &stream, T &t)
Deserialize an object. Stream here should normally be a rs2rosinternal::serialization::IStream.
frameset process(frameset frames)
int main(int argc, char *argv[])
device get_device() const
bool validate_face(rs2::depth_frame const &frame, float const depth_scale, dlib::full_object_detection const &face)
const std::string & get_failed_function() const
GLenum GLuint GLint GLenum face