RealTime-Face-Recognition-Using-OpenCV-and-KNNClassifier

Face recognition is a crucial security application. Through this project, a very basic form of face recognition has been implemented using the Haar Cascades Classifier, openCV & K-Nearest Neighbors Algorithm.

Technology Used :

  • Python - The whole code has been written in Python.
  • cv2 - cv2 is the OpenCV module and is used here for reading & writing images & also to input a video stream.
  • Algorithm - K-Nearest Neighbor
  • Classifier - Haar Cascades

Breakdown of the code for KNN classifier

1. Importing libraries
2. Create some data for classification
3. Write the kNN workflow
4. Finally, run knn on the data and observe results

Dependencies :

- Python 3 and OpenCv
- Numpy

How it works!

  • Run generating selfie training face_data_collection.py.The script will open a camera window.Stand in front of the camera until recording of the face is completed.Input the person's name. Press q after having enough samples.
  • The default file where the features are stored is name.npy.
  • Run the Building face_recognition.py file!