Control your computer mouse and perform actions using just your eyes and head movements! This Python application uses your webcam to track eye movements for cursor control, detect blinks for clicking, and recognize head nods for scrolling.
- π Eye-Controlled Cursor: Move your mouse cursor by looking around the screen
- π Blink to Click: Close your left eye to perform a mouse click
- π Head Nod Scrolling:
- Nod down to scroll down
- Nod up to scroll up
- π― Smooth Movement: Built-in cursor smoothing for precise control
Before running the application, install these dependencies:
pip install opencv-python mediapipe pyautoguiOr use the requirements file:
pip install -r requirements.txtrequirements.txt:
opencv-python
mediapipe
pyautogui
You can also use opencv-contrib-python instead of opencv-python.
# Fork this repo on GitHub, then clone your fork
git clone https://github.com/YOUR-USERNAME/eye-tracking-control.git
cd eye-tracking-controlpip install -r requirements.txtpython eye_tracking_control.py- Move cursor: Look at different parts of your screen
- Click: Blink your left eye
- Scroll down: Nod your head down
- Scroll up: Nod your head up
- Exit: Press
ESCkey
You can adjust these parameters in the code for better performance:
smooth_limit: Number of points averaged for smoother cursor movement (default: 5)nod_threshold: Sensitivity of head nod detection (default: 0.015)- Blink threshold: Adjust the value
0.004for click sensitivity
- Python: 3.7 or higher but lower than 3.12(as mediapipe got depreciated in 3.12 releases)
- Webcam: Required for face tracking
- OS: Windows, macOS, or Linux
- Ensure good lighting for accurate face tracking
- Position yourself at a comfortable distance from the webcam
- The application needs camera permissions to run
- Cursor control may take a moment to calibrate to your movements
- OpenCV: Video capture and image processing
- MediaPipe: Face mesh detection and landmark tracking
- PyAutoGUI: Mouse control automation
MIT License - Feel free to modify and distribute!
Pull requests are welcome! For major changes, please open an issue first to discuss what you'd like to change.