Face detection = identifying the fact that a face appears in an image, and locating where it is in the image.
Face recognition = matching the face to a known person's identity, or matching multiple face images to each other based on the fact that they are images of the same person.
You say your webcam does (at least) face detection. Your question indicates that you also want to do recognition.
Both these processes require the extraction of high-level invariants in the image. Computation of these invariant feature representations is pretty much at the cutting edge of modern computer vision. Simply hashing pixel values is light-years away from this: the hash of an image will differ by an arbitrary degree as soon as the intensity of even one pixel changes by even one level in even one channel. And of course, a tiny change like that does not change the identity of the face in the image. Even much, much larger changes at the pixel level will not necessarily change the identity - they might be due to rotation of the head, different lighting conditions, beards/sunglasses/hairstyle changes, etc.
If you say that your webcam "detects faces", is that due to face-detection technology supplied by the webcam manufacturer? If so, start with their API documentation. Maybe they have support for face recognition as well? Check that out, and then google "face recognition library" to compare other software approaches to this complex problem.
One option you might decide to explore further is OpenCV, which has Python bindings and which contains tools for both detection (using the CascadeClassifier
object) and recognition (using FaceRecognizer
). Here is a tutorial: http://docs.opencv.org/2.4/modules/contrib/doc/facerec/tutorial/facerec_video_recognition.html
Most "recognition" approaches are supervised in that they require a "training set" to be specified in advance. Maybe your application allows for this: maybe you know in advance who is going to be in the photos and already have pictures of them, each associated with an identity. (For example, Facebook's face recognition is able to exploit the fact that people have previously tagged faces in photos and thereby provided multiple training points for images that are associated with a particular identity.) If not, then you'll have to come up with some scheme of building a training set on-the-fly, and continuously or periodically updating the training. This particular subtype of face recognition problem can be described as "unsupervised face clustering" - i.e. grouping face images together without knowing a-priori the identity of any of them. Facebook also does this to some extent. This is even closer to the cutting edge of the cutting edge, and you'll probably need to delve into the computer-science literature to figure out how it's done. See here, for example: http://bitsearch.blogspot.com/2013/02/unsupervised-face-clustering-with-opencv.html