Dried eye syndrome

Few days ago I saw this eye blinking detector written in JavaScript using HTML5 and canvas (Firefox 3.5 needed) and I set myself a challenge of writing similar one in AS3 from scratch during my lunch break today.

Actually, it turned out to be much simpler than I had initially thought!

Click image to activate, hold your head still and blink your eyes. Hit space to toggle motion areas visibility.

In case it's not working, move your head closer/further away from the camera.

The SWF has 2.5 kilobytes, no heavy calculations are needed to detect eyes blinking. Here's how it works:

  1. Detect all motion areas (hit space to see them)
  2. Apply blur filter to get rid of the noise
  3. Apply threshold to get 1 bit image
  4. Use blob detection algorithm to find blobs
  5. Reject all blobs that are either too big or too small
  6. Draw bounding boxes around blobs that meet the size criteria

Currently, the code is a mess (or I would rather call it experimental state) so no source codes yet.

But I am planning to improve this a lot, i.e. make it possible to track the head movement and position and maybe even eyes. There is also an AIR app stopping your eyes drying coming out soon, meanwhile make sure you'll read a few tips on that very subject.

10:15 PM | | 2 Comments | Tags: , , ,

Comments

  1. That is scarily good. It's quite good at detecting my finger tips - could the code be adapted to either a virtual piano or (even better) a Minority report style 'swipe' effect.

    Gavin Montague on
  2. Very cool - it does a good job of tracking my eyebrows too!

    subblue on

Adding comments disabled for now.