9

Is there is a way to compare two faces (perhaps with OpenCv) and get a score of their likeness? I mean to apply a facial recognition algorithm, but only between 2 faces, not on an entire dataset.

The problem is that, for example, Eigenfaces requires at least 2 training images.

TGnat
  • 3,903
  • 8
  • 35
  • 46
Marco L.
  • 1,489
  • 4
  • 17
  • 25

4 Answers4

3

Yes, you can absolutely use eigenfaces. The training faces have nothing to do, with the two faces you are comparing for facial recognition. Have a training face gallery of say 100 faces. Then to compare your two faces (face_1 and face_2), do an eigenface decomposition of each face with the 100 faces in your training gallery. So for example face_1 = [2 3 1 5...]*[eigFace1 eigface2 eigface3 eigface4...]' and same for face two. That vector I showed above in the example [2 3 1 5...], compare it for each of your two face decompositions in some sort of distance algorithm (whether it be a euclidean distance or some other distance metric). If the distance within a certain threshold then you can say they are the same. Keep in mind, if you are using eigenfaces the pose, lighting conditions, size, and background of all the training images as well as the faces you are trying to compare must all be normalized. The eyes, noses, a mouths must also be as lined up as possible.

rossb83
  • 1,694
  • 4
  • 21
  • 40
  • I perform decomposition - I get array of numbers for first and second photo - what should I do next? How to compare it? – Martin Ch Apr 01 '12 at 00:32
  • Use some distance metric between the two vectors - euclidean, manhattan, something or the other will do. Then check the magnitude of the resulting vector and see if it's in a certain threshold. – niting May 02 '13 at 09:01
1

This article explains the whole face recognition process nicely. With face_recognition library you can identify a person even with only 1 image and then try to recognise that person in another image. This is possible because the neural network is already trained.

root
  • 157
  • 1
  • 3
  • 16
-1

Try to forget, that you compare faces. Find SURF keypoints for both photos, match their descriptors. As score of photo likeness use ratio of number of matched descriptors to number of all descriptors.

Zenn
  • 66
  • 3
  • That sounds interesting. Can you please give code/functions to achieve this using opencv? – syam Jul 28 '14 at 11:46
-1
  • You can use compare function which is from openbr.Its give you matched percentage of two faces.

  • And it gives this values based on min, max, mean, stddev for both genuine and impostor.

Sagar Patel
  • 864
  • 1
  • 11
  • 22