First you got to detect the line between the lips. After that you need to compute the arc angle of that line if it is caved towards up or down making the person look sad or happy. To detect a line in an image you can see the DEMO that involves finding the lines of the street's cars' lanes.
Since these are patented methods, they will be explained in the patents. That's the agreement in a patent: you get exclusive right to use it for 20 years, but the public gets to know how it's done (no secrets anymore). Have you searched the patent database: http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=%2Fnetahtml%2FPTO%2Fsearch-adv.htm&r=0&f=S&l=50&d=PTXT&RS=smile&Refine=Refine+Search&Refine=Refine+Search&Query=smile+AND+camera
For just one example, US Patent 8170298: Method for detecting facial expression and repairing smile face of portrait photo
It's probably already in digital cameras. If not yet, then it will be soon.
Play games and win prizes!Learn more