Facial landmark detection in OpenCV
Landmark detection starts with face detection, finding faces in the image and their extents (bounding boxes). Facial detection has long been considered a solved problem, and OpenCV contains one of the first robust face detectors freely available to the public. In fact, OpenCV, in its early days, was majorly known and used for its fast face detection feature, implementing the canonical Viola-Jones boosted cascade classifier algorithm (Viola et al. 2001, 2004), and providing a pre-trained model. While face detection has grown much since those early days, the fastest and easiest method for detecting faces in OpenCV is still to use the bundled cascade classifiers, by means of the cv::CascadeClassifier
class provided in the core
module.
We implement a simple helper function to detect faces with the cascade classifier, shown as follows:
void faceDetector(const Mat& image, std::vector<Rect> &faces, CascadeClassifier &face_cascade) { Mat gray;...