Real time face recognizer built using python(opencv)
face_taker.py
- Take pictures using the
face_taker.pyscript. After you enter the ID number, the script will save 30 images of your face in theimagesfolder. The ID number represents a single face. The ID MUST be an integer and incremental starting with 1, then 2, 3, ... Note: Make sure your face is centered. The window will collapse when all the 30 pictures are taken.
face_train.py
- The
face_tain.pyscript will train a model to recognize all the faces from the 30 images taken usingface_taker.pyand save the training output in thetraining.ymlfile.
face_recognizer.py
- The
face_recognizer.pyis the main script. You need to append each person's name in the index equal to the ID provided inface_taker.pyscript. The program will recognize the face according to the ID. i.e., If Joe has an id 1, his name should appear in the list as index 1 like such:
names = ['None', 'Joe']. # Don't remove the None
Requirements:
pip install opencv-pythonpip install opencv-contrib-python --upgradeorpip install opencv-contrib-python