Realtime Face/Edge Detection

Realtime Face/Edge Detection

View on Github ~~>
computer vision
machine learning

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:

  1. Detect Faces (No recognition)
  2. Add User to Recognizer
  3. Retrain Faces
  4. Recognize Faces
  5. Detect Edges
  6. 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

References

© 2024 Joshua Gracie
Thanks for stopping by! Don't forget to check out my LinkedIn 💼 and TryHackMe