Skip to content

HeleenaRobert/blink-detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📦 Blink Detector

Banner

Python OpenCV License: MIT Platform Status Made by Heleena Robert


✨ Overview

A real-time Eye Blink Detection System that uses facial landmark detection and eye aspect ratio (EAR) to detect user blinks via webcam. Ideal for:

  • Attention monitoring
  • Accessibility tools
  • Human-Computer Interaction (HCI) experiments

The project features live plotting of EAR values, automatic calibration, and blink alerts with optional sound.


🚀 Key Features

  • 🧠 Facial landmark detection using OpenCV
  • 📉 Eye Aspect Ratio (EAR) calculation with real-time visualization
  • 🕵️‍♀️ Blink counter with state transition logic
  • 🎧 Optional audio feedback on blink using pygame
  • 🖥️ Runs on webcam feed in real-time

📁 Folder Structure

Blink-Detector/
│
├── assets/
│   └── banner.png              # Project banner image
│
├── model/
│    ├── res10_300x300_ssd_iter_140000.caffemodel
│    ├── deploy.prototxt
│    └── lbfmodel.yaml          # Download this file from releases
│
├── blink_detector.py           # Main script
│
├── requirements.txt            # Required libraries
├── .gitignore                  # Git ignored files
├── README.md                   
└── LICENSE                     # MIT License

🧪 Requirements

Install required libraries using pip:

pip install -r requirements.txt

You also need to place the following model files in the model/ folder:

  • res10_300x300_ssd_iter_140000.caffemodel
  • deploy.prototxt
  • lbfmodel.yaml

📥 Model Download

Due to GitHub file size limits, the ibfmodel.yaml file is hosted in the Releases section of this repository.

  1. Go to the Releases page of this repo.
  2. Download the ibfmodel.yaml file from the latest release.
  3. Place it inside the models/ folder before running the application.

🎮 How it Works

  1. Connect Webcam 📸

  2. Run the program:

    python blink_detector.py
  3. The first few frames are used for EAR calibration

  4. As EAR drops and rises, the state switches from open ➝ closed ➝ open (indicating a blink)

  5. Real-time EAR graph and blink counter are displayed

  6. Optional sound (click.wav) plays when a blink is detected

Press q anytime to quit the program.


📊 EAR Plot

  • The Eye Aspect Ratio (EAR) is plotted in real-time
  • Blinks are detected using EAR threshold crossing logic
  • Visual and audible feedback help verify detection

🔒 License

This project is licensed under the MIT License.
See the LICENSE file for details.


👩‍💻 Author

Heleena Robert
GitHub

About

Real-time eye blink detection system that uses facial landmark detection and eye aspect ratio (EAR) to detect user blinks via webcam.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages