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
126.96.36.199 Face Expression Recognition and Analysis, Facial Expression Analysis, Facial Expressions 188.8.131.52.1 Three-Dimensional Face Expression Recognition and Analysis 184.108.40.206.2 Face Action Units for Expressions and Motion Analysis 220.127.116.11.3 Face Expression Recognition from a Single Image 18.104.22.168 Emotion Recognition from Face Images 22.214.171.124.1 Emotion Recognition, from Other Than Faces 126.96.36.199 Facial Expressions, Overviews, Surveys, Data