This application lets you detect landmarks of detected faces in a video.This application first detects faces in a current video frame and then finds their facial landmarks. You just have to pass the video as input.
The facemark API provides the functionality to the user to use their own face detector to be used in face landmark detection.The above code creartes a sample face detector. The above function would be passed to a function pointer in the facemark API.
VideoCapture cap(video);
if(!cap.isOpened()){
cerr<<"Video cannot be loaded. Give correct path"<<endl;
return -1;
}
The above code creates a video capture object and then loads the video. If the video is not loaded properly it prompts the user else the code proceeds.
The above code creates a pointer of the face landmark detection class. The face detector created above has to be passed as function pointer to the facemark pointer created for detecting faces.
vector<Rect> faces;
vector< vector<Point2f> > shapes;
Mat img;
The above code creates a vector to store the detected faces and a vector of vector to store shapes for each face detected in the current frame.