This repository contains two Python scripts for face recognition and emotion recognition using different approaches.
- OpenCV: An open-source computer vision library used for image and video processing.
- face_recognition: A library for face recognition that uses dlib and deep learning.
-
Install the required Python packages:
pip install -r requirements.txt
-
Prepare a folder named 'Images' in the same directory as the script.
-
Place images of known faces in the 'Images' folder for training.
-
Run the script:
python face_recognition.py
-
The script will capture video from the webcam and recognize known faces.
- OpenCV: An open-source computer vision library used for image and video processing.
- DeepFace: A deep learning facial analysis library that provides pre-trained models for facial emotion detection.
-
Install the required Python packages:
pip install -r requirements.txt
-
Download the Haar cascade XML file (haarcascade_frontalface_default.xml) for face detection from the OpenCV GitHub repository.
-
Run the script:
python emotion_recognition.py
-
The script will capture video from the webcam, detect faces, and display the dominant emotion on each face.
-
Both scripts use live video stream capture (0 - the first webcam). The video source can be modified as needed.
-
Ensure the necessary dependencies are installed before running the scripts.
-
The face recognition script requires a 'Images' folder with images of known faces for training.
-
The emotion recognition script uses Haar-Cascade for face detection and DeepFace for emotion analysis.
-
Press 'Esc' key to exit the video stream in both scripts.
- OpenCV: https://github.com/opencv/opencv
- face_recognition: https://github.com/ageitgey/face_recognition
- DeepFace: https://github.com/serengil/deepface