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.