Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
  • download the pretrained lbf model from here: https://github.com/kurnianggoro/GSOC2017/raw/master/data/lbfmodel.yaml
  • make sure, it's 53.8mb yml (not a html error msg or such)

then use code like this:

Ptr<Facemark> facemark = createFacemarkLBF();
facemark->loadModel("C:\\data\\mdl\\lbfmodel.yaml");  // <-- change path !

CascadeClassifier cascade("C:\\data\\mdl\\haarcascade_frontalface_alt2.xml"); // <-- here, too !
Mat image = imread("david2.jpg");  // your image here !

vector<Rect> faces;
cascade.detectMultiScale(image,faces);

vector<vector<Point2f>> fits;
bool ok = facemark->fit(image, faces, fits);
cout << ok << " " << fits.size() << endl;
for (int i=0; fits.size()>0 && i<68; i++) {
    circle(image, fits[0][i], 3, Scalar(200,0,0), 2);
}
imshow("F",image);
waitKey();
  • download the pretrained lbf model from here: https://github.com/kurnianggoro/GSOC2017/raw/master/data/lbfmodel.yaml
  • make sure, it's 53.8mb yml (not a html error msg or such)

then use code like this:

Ptr<Facemark> facemark = createFacemarkLBF();
facemark->loadModel("C:\\data\\mdl\\lbfmodel.yaml");  // <-- change path !

CascadeClassifier cascade("C:\\data\\mdl\\haarcascade_frontalface_alt2.xml"); // <-- here, too !
Mat image = imread("david2.jpg");  // your image here !

vector<Rect> faces;
cascade.detectMultiScale(image,faces);

vector<vector<Point2f>> fits;
bool ok = facemark->fit(image, faces, fits);
cout << ok << " " << fits.size() << endl;
for (int p=0; p<fits.size(); p++) { // persons
    for (int i=0; fits.size()>0 && i<68; i++) {
{ // points
        circle(image, fits[0][i], fits[p][i], 3, Scalar(200,0,0), 2);
 }
}

imshow("F",image);
waitKey();
  • download the pretrained lbf model from here: https://github.com/kurnianggoro/GSOC2017/raw/master/data/lbfmodel.yaml
  • make sure, it's 53.8mb yml (not a html error msg or such)

then use code like this:

Ptr<Facemark> facemark = createFacemarkLBF();
facemark->loadModel("C:\\data\\mdl\\lbfmodel.yaml");  // <-- change path !

CascadeClassifier cascade("C:\\data\\mdl\\haarcascade_frontalface_alt2.xml"); // <-- here, too !
here,too!
Mat image = imread("david2.jpg");  // your image here !

vector<Rect> faces;
cascade.detectMultiScale(image,faces);

vector<vector<Point2f>> fits;
bool ok = facemark->fit(image, faces, fits);
cout << ok << " " << fits.size() << endl;
for (int p=0; p<fits.size(); p++) { // persons
    for (int i=0; i<68; i++) { // points
        circle(image, fits[p][i], 3, Scalar(200,0,0), 2);
    }
}

imshow("F",image);
waitKey();
  • download the pretrained lbf model from here: https://github.com/kurnianggoro/GSOC2017/raw/master/data/lbfmodel.yaml
  • make sure, it's 53.8mb yml (not a html error msg or such)

then use code like this:

Ptr<Facemark> Ptr<face::Facemark> facemark = createFacemarkLBF();
face::createFacemarkLBF();
facemark->loadModel("C:\\data\\mdl\\lbfmodel.yaml");  // <-- change path !

CascadeClassifier cascade("C:\\data\\mdl\\haarcascade_frontalface_alt2.xml"); // <-- here,too!
Mat image = imread("david2.jpg");  // your image here !

vector<Rect> faces;
cascade.detectMultiScale(image,faces);

vector<vector<Point2f>> fits;
bool ok = facemark->fit(image, faces, fits);
cout << ok << " " << fits.size() << endl;
for (int p=0; p<fits.size(); p++) { // persons
    for (int i=0; i<68; i++) { // points
        circle(image, fits[p][i], 3, Scalar(200,0,0), 2);
    }
}

imshow("F",image);
waitKey();