Hi,
Its not an easy topic.
It's easy to write a program that can recognize frontal upright faces with moderate accuracy (%70 or so) but in your case you need an algorithm that can recognize faces regardless of the pose and illumination. There is no perfect solution to this problem yet.
You can start studying from
here.
There are MATLAB codes for some of the simple face recognition algorithms in the mathworks web site.
In order to recognize faces you need to detect them first. There is a well known method for this, which is explained in a paper written by Viola-Jones. Just google it and you'll learn the details.
There is an implementation of that method in OpenCV. If you want to use MATLAB, there is also a port of it in the mathworks site
here. I used both implementations and they worked great. You just need to find the appropriate xml files which contain the trained classifiers.
Regards...
PS: You should have posted this message to the Digital Signal Processing section, what does this topic have to do with "RF, Microwave, Antennas and Optics"?