1 | initial version |
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();
2 | No.2 Revision |
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();
3 | No.3 Revision |
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();
4 | No.4 Revision |
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();