Face Tracking Extension Testing

This face tracker is based on the FaceExtension extension documented by Juan Antonio Villalpando here:
http://kio4.com/appinventor/299E_extension_Facemesh.htm

Get the extension here:
https://mit-cml.github.io/extensions/data/extensions/edu.mit.appinventor.ai.facemesh.aix

I first tested the http://kio4.com/appinventor/aplicaciones/p299D_puntosFace.aia
app then kept just the blocks that would allow the phone's camera to track my face as I turned the phone left and right. The app tracks 450 points on the face of the user, but for my purposes I chose to track only the bridge of the nose area which is at position 128. I only needed the camera to track my face in the x direction between 0 and 320 on the canvas. Two images were copied from Google Images of a woman with eyes open (the eyes were removed to reveal the transparent background) and closed.
eyesopen

eyesclosed

The closed eyes image overlays the open eyes image to allow a more realistic timed eye blink. The moving eyes are captured frames from an animated gif at Eye Tracking Terminology - Eye Movements - Fast, Accurate, Reliable Eye Tracking
Pursuit_small

I kept only 11 of the 70+ frames in that animated gif using gimp image editor.

The captured frames are swapped out based on the value in x returned for the user's head position returned by the FaceExtension. The end result is the woman's eyes following the user left and right.

Designer:

Blocks:

Here's the FaceFollower app:
FaceFollower.aia (3.3 MB)

I would like to know of a better way to calculate the values returned by the multiples function in this app if you can think of one!

Contact me at Profile - ScottFromScott - MIT App Inventor Community

2 Likes