Face recognition in Video Output
The data can be collected using the video-cam, or from an image already available.
Working Steps
-
OpenCV library along with haarcascade file used for detecting frontal face is used to detect faces in the image/video. The portion of image containing the image is cropped, resized and converted to gray-scale(1D).
-
The array output of the gray-scale image along with the name (which is our label/dependent variable) that the user inputs when the code is executed is our training data. This data is stored as a .npy file.
-
The model is trained using the SVM classifier.
- Clone the project
- Navigate to the src folder
- If you have an image input, run the fetch_face_data(img).py file.
- If you want to take input from webcam, run the fetch_face_data(vid).py file and also press c on your keyboard after the face is detected to collect the numpy data. Then exit by pressing q.
- Run the face_recog.py file.
The model was trained on two different images for the following output.