I have made the same program, but in LabVIEW, in this program the face is saved automatically if you select only the face, but of course, it needs to be at the same angle as the saved one... There is a good book that could help you: Dynamic Vision from Images to Face Recognition (Gong, McKenna, Psarrou) or Handbook of Face Recognition (Li, Jain). Greetings.