This is a Python script that uses OpenCV to detect eyes and sound an alarm if they are closed for more than a minute. This can be used as a safety feature for drivers or others who need to stay alert and focused.
To run this script, you'll need to have the following installed:
- Python 3.x
- OpenCV (cv2) library for Python
playsoundlibrary for Python
You can download Python from the official website: https://www.python.org/downloads/
To install the OpenCV library, you can run the following command:
pip install opencv-python
To install the playsound library, you can run the following command:
pip install playsound
To run the script, open a terminal or command prompt and navigate to the directory where the script is located. Then, run the following command:
python main.py
This will open up your computer's webcam and start detecting eyes. If the eyes are closed for more than a minute, an alarm will sound.
To exit the script, press the 'q' key on your keyboard.