I think someone asked this earlier this summer. There are several patents covering this. Look them up and they will tell you the whole algorithm. That's what they have to do in order for their patent to be granted.
You can also try by looking around here: http://iris.usc.edu/Vision-Notes/bibliography/contentspeople.html#Face%20Recognition,%20Detection,%20Tracking,%20Gesture%20Recognition,%20Fingerprints,%20Biometrics It has sections like:
21.3.6 Facial Expressions and Emotion Analysis and Description
220.127.116.11 Face Expression Recognition and Analysis, Facial Expression Analysis, Facial Expressions 18.104.22.168.1 Three-Dimensional Face Expression Recognition and Analysis 22.214.171.124.2 Face Action Units for Expressions and Motion Analysis 126.96.36.199.3 Face Expression Recognition from a Single Image 188.8.131.52 Emotion Recognition from Face Images 184.108.40.206.1 Emotion Recognition, from Other Than Faces 220.127.116.11 Facial Expressions, Overviews, Surveys, Data