Face extension, testing (2). Compare two faces. Facial recognition

Hello friends,

in another topic I put several examples made with the Face mesh extension:

now I open a new topic so as not to lengthen the previous one.

1.- Compare two faces.

p299D_EucledianoFace_v4i.aia (2.8 MB)


[Tested on Xiaomi mobile with Android 9]

  • Focus on one face with the Camera and press the "Foto1" button. Focus on another face and press the "Foto2" button. After pressing the "Compare" button, you will get a number, the closer it is to 0, the more the two faces will look alike.

  • This is just a basic and didactic example, I have used my own comparison method, you can use other methods to see its effectiveness.

  • The faces should be with the eyes horizontal and looking at the camera.

  • With the Back Camera the mesh is drawn with a mirror effect.

- My algorithm:

  • I photograph a face, using the Face extension I take various points of the face:

  • I calculate the distance between the eyes (points 399 and 134), I will take this distance as a reference.

  • I calculate the distance between the pairs of points, I reference them to the eye_eye distance and I save each distance in the TinyDB, with tag, 1, 3, 5, 7, 9,...

  • I photograph another face and perform the same process as before, now I save the distances in the same TinyDB with tag 101, 103, 105, 107, 109,...

  • When I press the "Compare" button, the content of similar tags 1-101, 3-103, 5-105,... the differences are cumulatively saved in the error variable.

  • The closer the error variable approaches 0, the more the faces will look alike.

  • The mesh is also drawn on each face, for this I use these points:


- Another method of comparison.

Another method to compare the two faces would be to calculate the distances between pairs of points, calculate their RMS and reference them to the distance between eyes:

1 Like

- Proposal, challenge for Math Master.

With the Back Camera the Mesh is drawn with a mirror effect. Create a mathematical algorithm with App Inventor blocks to draw on the model.

1 Like