Eye/Blink Detection

Hi,

I am looking for some example apps that detect eye blinks in IOS. I am fairly new to SWIFT and trying to learn more about this. Any pointers would be awesome!

-Bruce

I don't know of any example apps that do this out of the box, but this is the approach I would use (although I haven't tried it out!):

  1. Use the Vision framework to detect face landmarks from camera stream in real time (like in this Apple Example Code)

  2. Every frame, you'll get a VNFaceObservation whose landmark property will have leftEye and rightEye properties which are a set a points representing the outline of the eye.

  3. Calculate the aspect ratio of the eye using those points. If aspect ratio is close to zero, user has blinked.
    pasted image 0
    pasted image 0-1