Realtime Face/Edge Detection
View on Github ~~>Realtime Face/Edge Detection
Description
Built a real-time face detection/recognition command line program using OpenCV. Also implemented a near real-time canny edge detector using the same system.
Technologies Used
- Python
- OpenCV
- Numpy
- Pandas
Face Detection
Face detection is done using the Haar Cascade Classifier. The classifier is trained on a dataset of faces and is able to detect faces in real time. The classifier is implemented in the face_detection.py
file.
Face Recognition
Face recognition is achieved using a Local Binary Patterns Histograms (LBPH) classifier using images captured from the system and cropped using the face detector. The classifier is implemented in the face_recognition.py
file.
Edge Detection
Edge detection is done using the Canny Edge Detector. The detector is implemented in the edge_detection.py
file.
How to Use
To use the program, first open main.py and adjust settings as desired. From there, run main.py and read given options from the system:
Options:
- Detect Faces (No recognition)
- Add User to Recognizer
- Retrain Faces
- Recognize Faces
- Detect Edges
- Quit
Select option 1 to just detect faces without reconition Select option 2 to add a user’s face to the reconizer Select option 3 to retrain all faces in db.csv Select Option 4 to perform recognition Select option 5 for edge detection Select option 6 to quit
Notes
- Press q during any video capture to end the capture and return to the options menu
- A user may already be in the database file with the same face. If so, remove them from db.csv and delete their dataset folder. Then run option 2
- If there are no users in db.csv, or the trainer.yml file is missing, this will not work
Future Work
- Add a GUI
- Add a database to store user information
- Add a way to remove users from the database
- Add a way to update user information
- Add a way to update user images