Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rajanmandanka07/face-recognition
This Face Recognition System allows adding new faces, training a classifier, and real-time face recognition using a webcam. Built with Python and OpenCV.
https://github.com/rajanmandanka07/face-recognition
classifier-training face-recognition haar-cascade-classifier image-processing lbph-face-recognizer numpy opencv-python pillow
Last synced: 7 days ago
JSON representation
This Face Recognition System allows adding new faces, training a classifier, and real-time face recognition using a webcam. Built with Python and OpenCV.
- Host: GitHub
- URL: https://github.com/rajanmandanka07/face-recognition
- Owner: rajanmandanka07
- Created: 2024-08-27T11:11:05.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-08-28T07:42:57.000Z (3 months ago)
- Last Synced: 2024-08-28T12:34:21.707Z (3 months ago)
- Topics: classifier-training, face-recognition, haar-cascade-classifier, image-processing, lbph-face-recognizer, numpy, opencv-python, pillow
- Language: Python
- Homepage:
- Size: 768 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Face Recognition System
This project is a Face Recognition System that allows users to add new faces to a dataset, train a classifier on the dataset, and recognize faces using a pre-trained classifier. It consists of three main Python scripts:
1. `main.py` - The entry point for the system, providing a menu for adding new users, training the classifier, and recognizing faces.
2. `dataset_generator.py` - Handles dataset generation by capturing images from the webcam, preprocessing them, and saving them for training.
3. `face_recognizer.py` - Recognizes faces using the trained classifier and displays the recognized name and confidence level on the screen.## Features
- **Add New User**: Capture images of a new user, add their details (name and ID) to the dataset, and update the classifier.
- **Train Classifier**: Automatically trains the classifier on the new dataset.
- **Recognize Face**: Uses the webcam to detect and recognize faces in real-time, displaying the recognized name on the screen.## Requirements
- Python
- OpenCV
- NumPy
- PIL (Pillow)## Setup and Installation
1. **Clone the repository**:
```bash
git clone https://github.com/yourusername/facerecognition.git
cd facerecognition
2. **Install the required Python packages**:
```bash
pip install opencv-contrib-python numpy pillow
3. **Download the Haar Cascade XML file for face detection**:
- You can download the haarcascade_frontalface_default.xml file from the OpenCv GitHub repository.
- Place the file in the root directory of the project.
4. **Run the program**:
```bash
python main.py## Project Structure
- `main.py`: The main script that provides a command-line interface for adding new users, training the classifier, and recognizing faces.
- `dataset_generator.py`: Handles the dataset generation and training of the classifier.
- `face_recognizer.py`: Performs real-time face recognition using the webcam.
- `user_data.json`: A JSON file that stores user data (name and ID) for recognition purposes.
- `classifier.xml`: The trained classifier file used for face recognition.## Usage
1. **Add New User**:
- Run the script using `python main.py`.
- Choose option `1` to add a new user.
- Enter the name and ID of the user.
- The system will guide you through capturing 30 images of the user's face. Follow the on-screen instructions.
- The images will be saved, and the classifier will be trained automatically.2. **Recognize Face**:
- Run the script using `python main.py`.
- Choose option `2` to recognize a face.
- The system will use the webcam to detect and recognize faces in real-time, displaying the name and confidence level on the screen.3. **Exit**:
- Choose option `3` to exit the program.## JSON Data Storage
- The user data (name and ID) is stored in a `user_data.json` file as key-value pairs. The key is the ID, and the value is the name of the user.
## Important Notes
- Ensure that your webcam is connected and working properly before running the program.
- The system requires good lighting conditions to perform accurate face recognition.
- The confidence level of recognition depends on the quality and number of images in the dataset.## License
This project is licensed under the MIT License.
## Author
- [Rajankumar Mandanka](https://github.com/rajanmandanka07/Face-Recognition.git)
## Acknowledgments
- This project uses the OpenCV library for face detection and recognition.
- The Haar Cascade classifier used in this project is provided by OpenCV.