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
188.8.131.52 Face Expression Recognition and Analysis, Facial Expression Analysis, Facial Expressions 184.108.40.206.1 Three-Dimensional Face Expression Recognition and Analysis 220.127.116.11.2 Face Action Units for Expressions and Motion Analysis 18.104.22.168.3 Face Expression Recognition from a Single Image 22.214.171.124 Emotion Recognition from Face Images 126.96.36.199.1 Emotion Recognition, from Other Than Faces 188.8.131.52 Facial Expressions, Overviews, Surveys, Data