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)

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

[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:
    11,3,360,34,430,366,210,137,360,357,34,128,3,153,11,357,11,128,9,366,9,137,285,366,55,137,430,210,285,137,55,366

  • 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:
    360,387,387,399,399,254,254,360,134,160,160,34,34,24,24,134,309,14,14,79,79,86,86,316,316,309,444,11,224,11,55,11,285,11,285,357,55,128,360,285,360,357,34,55,34,128,357,366,128,137,366,378,378,149,149,137,3,9,9,11,3,430,3,210,9,399,9,134,430,366,210,137,430,9,210,9,316,378,86,149,316,366,86,137,309,430,79,210,360,444,444,399,134,224,224,34

3 Likes

- 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