This repository contains code for implementing facial recognition using Eigenfaces, a classical method in the field of computer vision and pattern recognition. The project was developed as part of the MAT161 Applied Linear Algebra course.
To train and test the Eigenfaces model, a custom dataset of 1600 face images was created. These images were generated uniquely for this project using StyleGAN2, ensuring a diverse and realistic dataset for robust facial recognition.
The Eigenfaces method involves several steps:
- Preprocessing: Images are resized to 100x100 pixels and converted to grayscale.
- Eigenface Calculation: Principal Component Analysis (PCA) is applied to calculate the eigenfaces, which are the principal components of the dataset.
- Face Detection: Faces in new images are detected by measuring the distance between the input image and the mean-subtracted projected image vectors.
- Face Recognition: Faces are recognized by comparing the distance between the projected image vectors of the input image and those of the images in the dataset.
To use this code:
- Ensure you have Python installed along with the necessary libraries listed.
- Generate or use the given dataset of face images.
- Run the provided scripts for dataset generation and Eigenfaces implementation.
Special thanks to the contributors of the following libraries used in this project:
- OpenCV for image processing.
- NumPy for numerical operations.
- matplotlib for visualization.
This project is licensed under the MIT License - see the LICENSE file for details.
For more information, refer to the detailed documentation and comments within the code files. Happy face recognition! 😊🔍