Ask Your Question

Revision history [back]

How create cv::face::drawFacemarks ?

Hi! How create cv::face::drawFacemarks ? Here I found an example:

std::vector<Rect> faces;
std::vector<std::vector<Point2f> > landmarks;
facemark->getFaces(img, faces);
facemark->fit(img, faces, landmarks);
for(int j=0;j<rects.size();j++){
    face::drawFacemarks(frame, landmarks[j], Scalar(0,0,255));
}

But I did not understand how to make this example work? Is there a working code with an example? I tried to do so, but the compiler returns errors: std::vector<cv::rect> faces; std::vector<std::vector<cv::point2f> > landmarks; cv::Ptr<cv::face::facemark> facemark = cv::face::createFacemarkLBF(); //cv::Ptr<cv::face::facemark> facemark = cv::face::createFacemarkAAM();

    facemark->getFaces(img, faces);
    facemark->fit(img, faces, landmarks);
    for(int j=0;j<rects.size();j++){
        cv::face::drawFacemarks(frame, landmarks[j], Scalar(0,0,255));
    }
click to hide/show revision 2
None

updated 2019-12-06 10:21:04 -0600

berak gravatar image

How create cv::face::drawFacemarks ?

Hi! How create cv::face::drawFacemarks ? Here I found an example:

std::vector<Rect> faces;
std::vector<std::vector<Point2f> > landmarks;
facemark->getFaces(img, faces);
facemark->fit(img, faces, landmarks);
for(int j=0;j<rects.size();j++){
    face::drawFacemarks(frame, landmarks[j], Scalar(0,0,255));
}

But I did not understand how to make this example work? Is there a working code with an example? I tried to do so, but the compiler returns errors: errors:

     std::vector<cv::rect> std::vector<cv::Rect> faces;
        std::vector<std::vector<cv::point2f> std::vector<std::vector<cv::Point2f> > landmarks;
        cv::Ptr<cv::face::facemark> cv::Ptr<cv::face::Facemark> facemark = cv::face::createFacemarkLBF();
        //cv::Ptr<cv::face::facemark> //cv::Ptr<cv::face::Facemark> facemark = cv::face::createFacemarkAAM();

cv::face::createFacemarkAAM();
    facemark->getFaces(img, faces);
    facemark->fit(img, faces, landmarks);
    for(int j=0;j<rects.size();j++){
        cv::face::drawFacemarks(frame, landmarks[j], Scalar(0,0,255));
    }