This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <opencv2/opencv.hpp> | |
#include <opencv2/core/core_c.h> // needed for IplImage ;( | |
#include <dlib/image_processing.h> | |
#include <dlib/opencv/cv_image.h> | |
// IMPORTANT: | |
// do **not** use namespace cv or dlib, | |
// but prefix everything correctly !!! | |
dlib::shape_predictor sp; | |
dlib::deserialize("shape_predictor_68_face_landmarks.dat") >> sp; | |
cv::Mat img = .... // get grayscale img | |
// or use a Rect from CascadeDetection: | |
dlib::rectangle rec(0,0,img.cols,img.rows); | |
dlib::full_object_detection shape = sp(dlib::cv_image<uchar>(img), rec); | |
for (int k=0; k<shape.num_parts(); k++) { | |
cv::Point landmark(shape.part(idx[k]).x(), | |
shape.part(idx[k]).y()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment