Close

Detecting Eye Blinks in Python

A project log for BlinkToText

BlinkToText is an open source, free, and easy to use software program that converts eye blinks to text.

swaleh-owaisSwaleh Owais 10/07/2017 at 05:120 Comments

I have developed a simple python program that can detect eye blinks. The program uses the cv2 library to handle the image processing. I am using a facial Haar Cascade to detect a face within the videofeed. I then detect eyes using another Haar Cascade within this region of interest.

If the eyes disappear for a certain period of time, then the program assumes that the person blinked. Quickly, I noticed that I unintentionally blink a lot.

Ergo, my program only recognizes a blink if it lasts longer than 1.25 seconds. Thus, unintended blinks are filtered out.

[Figure 1: Detecting Eye Blinks with Python]

The program can also detect winks and differentiate left eye winks from right eye winks. I think this adds an exciting option for customization. Users can use winks as hotkeys to transmit specific data. For example, winking could let the user instantly delete the last transmitted word.

Instead of using a Haar Cascade to detect when an eye is open, I would rather use a Haar Cascade to detect when an eye is closed. Or both. I believe that this would make the program more precise. I am looking into training my own Haar Cascade to serve this function. This is not a vital task because the eye blink detector is already fairly accurate.

Discussions