This project implements a face recognition system using OpenCV and face_recognition libraries. It allows you to encode and recognize faces from a set of images using a webcam or video feed.
Before running the project, make sure you have the following prerequisites:
- Python 3.x
- OpenCV library (pip install opencv-python)
- face_recognition library (pip install face_recognition)
- Clone this repository to your local machine.
- Install the required dependencies by running pip install -r requirements.txt in your project directory.
- Prepare a folder containing images of faces that you want to recognize. Ensure that each image contains only one face.
- Update the main.py file with the correct camera index and the path to the images folder.
- Run the project by executing python main.py in the project directory.
- The webcam feed will open, and the program will attempt to recognize faces based on the provided images.
The project consists of the following files:
main.py: The main script that captures frames from the camera, detects and recognizes faces. simple_facerec.py: A helper module that provides face encoding, loading of encoding images, and face detection functions. images/: A folder containing the images used for face encoding and recognition.
You can customize the resizing factor used in the face recognition process by adjusting the frame_resizing variable in simple_facerec.py. To recognize more faces, simply add images of the additional faces to the images/ folder and run the project again. Feel free to modify and extend the code to suit your specific requirements.
If you encounter issues with the camera not being found or frames not being read properly, make sure the camera is connected, the correct camera index is used, and the camera drivers are up to date.
This project utilizes the following libraries:
OpenCV: https://opencv.org/ face_recognition: https://github.com/ageitgey/face_recognition
Contributions to this project are welcome. Feel free to submit bug reports, feature requests, or pull requests.
Feel free to contact for any inquiries or feedback