Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Eye-Controlled Action Trigger using OpenCV & Dlib

This Python project uses your webcam to detect if your eyes are closed, and triggers an action (like a click) when they are. Think of it as a "blink to click" controller — useful for accessibility or creative controls in games, automation, etc.


How It Works

  • Detects your face and eyes using dlib’s 68 facial landmarks
  • Calculates the Eye Aspect Ratio (EAR) to determine eye closure
  • When the EAR drops below a threshold (e.g., 0.234), the script:
    • Triggers a mouse click using pyautogui
    • Prints "Success" in the terminal

Dependencies

Make sure you have the following Python packages installed:

pip install opencv-python dlib scipy pyautogui

You also need the facial landmarks predictor file:

Download this file:
shape_predictor_68_face_landmarks.dat

Place it in the same directory as your Python script.


How to Run

  1. Clone this repository or copy the script into your project folder
  2. Install the dependencies listed above
  3. Make sure your webcam is working
  4. Run the script:
python eye_click.py
  1. Blink your eyes and it will work

Customization

You can modify the behavior of jump() to do whatever you want:

def jump():
    pyautogui.mouseDown()
    time.sleep(0.01)
    print("Click!")
    pyautogui.mouseUp()

Disclaimer

This is a basic eye closure trigger and not a medically certified drowsiness detector.
Use responsibly and tweak the EAR threshold to suit your face & lighting conditions.


About

A program where it detects if eyes are closed or on

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages