Skip to content

Instantly share code, notes, and snippets.

@treyhuffine
Created March 5, 2019 02:05
Show Gist options
  • Save treyhuffine/8b3d8aa8d36b09a6cc03e4ddd0b16ea0 to your computer and use it in GitHub Desktop.
Save treyhuffine/8b3d8aa8d36b09a6cc03e4ddd0b16ea0 to your computer and use it in GitHub Desktop.
vector<Rect> faces;
faceDetector(img, faces, face_cascade);
// Check if faces detected or not
if (faces.size() != 0) {
// We assume a single face so we look at the first only
cv::rectangle(img, faces[0], Scalar(255, 0, 0), 2);
vector<vector<Point2f> > shapes;
if (facemark->fit(img, faces, shapes)) {
// Draw the detected landmarks
drawFacemarks(img, shapes[0], cv::Scalar(0, 0, 255));
}
} else {
cout << "Faces not detected." << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment