Skip to main content

Posts

Showing posts with the label haarcascade

OpenCV : Face Detection

Why do you want to detect face? In general, face detection is used in many areas, such as auto focusing, game, etc. Today, we will make a program to synthesize images on the face by using face detection. First, we need a "haarcascade_frontalface_alt2.xml" file. This is used for face detect algorithm. We can take this file in following url.  https://github.com/opencv/opencv/blob/master/data/haarcascades/haarcascade_frontalface_alt2.xml   And also we need images to synthesize on the face. I made a simple animal head for you.    Now, let's start make face detecting program. The full code is as follows. preprogress.h #ifndef DETACTFACE_PREPROGRASS_H #define DETACTFACE_PREPROGRASS_H #include <opencv2/opencv.hpp> using namespace cv ; using namespace std ; //load specific cascade file void load_cascade ( CascadeClassifier & cascade , string frame ){ string path = "./res/haarcascades/" ; string full_path = path + frame ; CV_...