This is a simple face recognition project using Python OpenCV, made to help some friends at work.
- Python 3.6+ (Anaconda is recommended)
- OpenCV
- Numpy
- Pandas
First of all, navigate to the directory where the project is.
- Run
python take-photos.py
. - Enter an ID and a name.
- Enter a camera ID (the default is 0), if you only have one camera in your PC, just press
ENTER
. - Press the
s
key to take photos of your face (it will only work when your face is detected and there's enough light in the room). - Press the
q
key when you're done.
- Take at least 25 photos of the face of each person.
- Repeat this with at least one different person, otherwise you will get an error.
- Run
python train.py
. - The program will generate the file "classifiers/lbphClassifier.yml"
- This may take some time depending on how many photos you took.
- Run
python recognize.py
- The number under your name is the "Trust Distance", the less the distance (closer to 0), the more reliable is the classification.