2

I'm grabbing face images from a camera, and storing each face frame until there are enough images to train the eigenface object in opencv. I'm able to get a mean eigenface, but i'm wondering how i could store this into a database on a server so that later when a person comes back, i could get another mean eigenface, send that to the server and find the closest match. I was thinking of either hashing that eigenface and comparing hashes, but i could just store that mean eigenface itself in the database, but i don't know how i would compare the eigenface on the client with all the eigenfaces in a database without pulling every single record down from the database.

Does anybody have any idea how i might turn the eigenvalues or mean eigenface into a string or number of some kind which i could compare the mean eigenface value with the values in the database on the server?

iedoc
  • 2,156
  • 2
  • 28
  • 52

1 Answers1

5

how i could store this into a database on a server

Does it have to be an actual database server, i.e. MySQL or the sort? Why not store the Eigenface images on disk along with a sidecar file contain meta information of that Eigenface.

I was thinking of either hashing that eigenface and comparing hashes

I would suggest against that. Two images will only have the same hash values if all pixels have identical values (leaving aside the possibility of hash collisions). So any comparison of images is either true or false. Most comparisons would be false, since most new queries won't have an exact match in the database.

but i don't know how i would compare the eigenface on the client with all the eigenfaces in a database without pulling every single record down from the database Does anybody have any idea how i might turn the eigenvalues or mean eigenface into a string or number of some kind which i could compare the mean eigenface value with the values in the database on the server?

The trick is to use an abstract representation of the images, usually called descriptors, and define distance metric on these descriptors to evaluate their similarity, e.g. assume a metric d and the descriptors of two images A and B, DA and DB. Then d(DA, DA) = 0 and d(DA, DB) >= 0.

Given all the descriptors of the Eigenface images in your database and the metric d, you could organize all descriptors in a special data structure, e.g. using a KD-tree, in order to find the nearest neighbours of a new query image (i.e. of that image's descriptor). With this kind of matching it is no longer necessary to compare a new query to all images in the database.

If the distance of a query Q and its 1st nearest neighbour NN1 is sufficiently smaller than the distance between the query Q and its 2nd nearest neighbour NN2, d(DQ, DNN1) < a * d(DQ, DNN2) (a < 1), then Q and NN1 can be considered a match.

This is a very broad topic with an abundance of approaches and opinions. But the outline above is commonly used for similar applications.

These keywords could help your further investigation

  • feature extraction and descriptors (SIFT, SURF, ORB, FREAK, AKAZE, etc.)
  • image descriptors, s.a. https://stackoverflow.com/a/844113
  • keypoint and image matching
  • approximate nearest neighbour
  • face detection and recognition
  • and probably more ...

Generally, literature surveys are a good way to get an overview of what has been done, what works well and what doesn't.

Community
  • 1
  • 1
nils
  • 2,281
  • 1
  • 14
  • 29
  • thank you, i like the keywords section you provided. about the hashes, i was just wondering if its possible to compare to hashes and find how similar they are to each other, or if a hash is entirely changed even if only one bit in whatever you were hashing changed. – iedoc Mar 12 '15 at 17:47
  • i'm sort of new the facial recognition, so this might sound stupid, but would it be logical to sum up all the lengths of all the eigenvectors into an integer, then when comparing against the database records, find the integer closest? i mean i know it wouldn't be perfect, but would it be enough to at least have a decent comparison, say like even 50% of the time? – iedoc Mar 12 '15 at 17:49
  • 50% was just a random number i through out, i was just wondering if it could still decently find a match. i'll just try it out and reply with my findings – iedoc Mar 12 '15 at 17:50
  • 1
    @iedoc I'm afraid it's not quite as simple as that. However, [literature surveys](http://scholar.google.com/scholar?q=face+recognition+survey) are a good way to get an overview of what has been done, what works well and what doesn't. – nils Mar 12 '15 at 20:15
  • Thanks @nils, that's a great spot to do some research – iedoc Mar 13 '15 at 12:12
  • @iedoc Great! I added that link to my answer and hope that it now answers your question satisfyingly. – nils Mar 13 '15 at 12:47