- This project is an implementation of opencv + python in an attempt to learn how face and eye detection work
- I have used pre-trained classifiers (previously run on thousands of images) in the form of xml files (which come bundled with cv2 package) to capture facial features and then track them
- Applied geomterical analysis to detect closing of eye with area calculation and distance from facial ends
- Check out the functional demo at https://www.youtube.com/watch?v=EpnMyfZQEjE
Version config:
- Python -
3.7.9
- OpenCV -
4.5.4
Note: Make sure you have a stable/supported version of Python 3+
- Clone this repository into your local machine
- Commands to run:
pip install -r requirements.txt
(only if single python environment, else change pip to pip3)python main.py
(only if single python environment, else change python to python3)
- This program has applications in the following:
- Road accident prevention - detect driver's eyes shutting off
- Social media engagement - control mini-games using eye gestures
- Medical aid - help bed ridden patients (eg. paralyzed) to naviagte useful functional menus
- Education - detect attentiveness of a learner in online classes
- I have tried to implement a gui using tkinter under the file
gui.py
which shows a basic menu implementation which can be linked with the data insights coming from the opencv program to navigate and create an application for medical aid - To better the detecttion and tracking we can tweak the parameters (to smoothen and sharpen at places) in the code as well as perform more training models to create our custom classifiers
- Use other alternatives and approaches like dlib to calculate contours and hulls around the face and use the EAR algorithm to enhance the results
- Have a neural network with layers which enhance the image to generalise for different lighting conditions before applying any opencv in-built functions
For any further queries or collaborations, email at [email protected]
Made with ❤️