Created
March 5, 2019 02:03
-
-
Save treyhuffine/5b0e4f744fd20aa92dcba502b974012b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const string cascade_name = "$OPENCV_ROOT/data/haarcascades/haarcascade_frontalface_default.xml"; | |
CascadeClassifier face_cascade; | |
if (not face_cascade.load(cascade_name)) { | |
cerr << "Cannot load cascade classifier from file: " << cascade_name << endl; | |
return -1; | |
} | |
// ... obtain an image in img | |
vector<Rect> faces; | |
faceDetector(img, faces, face_cascade); | |
// Check if any faces were detected or not | |
if (faces.size() == 0) { | |
cerr << "Cannot detect any faces in the image." << endl; | |
return -1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment