Can a computer tell if you're in a good mood or ready to rip someone's head off? Sort of.
Artificial intelligence (AI) startups like Affectiva and Emotient are making headway in this area and their technology has already been applied in market research and advertising applications where the difference between a commercial that bores you and one that captivates (or even enrages) you is the difference between success and failure.
Affectiva, for example, offers a cloud based service that reads facial expressions, which it calls (God help us) "Emotion as a Service." Customers include big companies, ad agencies, and market research firms. Last week, the company launched a free test of a mobile software development kit to new prospects.
Gabi Zijderveld, Affectiva's vice president of marketing, claimed it has compiled the world's largest "emotion" repository with data on 3.2 million faces from people in 75 countries. This acts as sort of baseline on emotions, in terms of facial expressions.
For those who wonder if a computer can distinguish between a smile and a grimace, or maybe even a fake smile and the real deal, the company built a classifier to do just that, she said. "You have to look at the whole face, not just the lips pulled up at the sides, but the eyes, the eyebrow furrows, all the characteristics."
It's important to note the difference between what Affectiva does and facial or image recognition. Affectiva's database could not identify a given person out of the 3.2 million faces it has in-house, but it can ascertain by looking at key points on the face if that person is happy, sad, angry. It can, Zijderveld said, even distinguish between a smile and a smirk, something that some humans cannot do.
She also stressed that Affectiva's customers, big companies that run what amounts to online focus groups to gauge reactions to advertisements, is strictly "opt in." Users are typically asked to participate in a survey, hit yes, and then instructed to turn on their web cams to participate, she explained. Zijderveld spoke more on this on the Datacenter Show podcast this week.
Hershey (hsy), the chocolate giant, is working with Affectiva and its partner Wild Blue Technologies on a new in-store device that prompts users to smile in return for a treat.
The "Smile Sampler" is sort of like a vending machine that will be deployed at as-yet-unnamed retailers.
For those who worry about someone collecting an image of them grinning goofily at a machine waiting for a chocolate kiss, there's no need to fret, said Wild Blue president Steven McLean.
"The images are not really photos. They are instantly converted to a map of your face that only the machine can read. It is stored locally and after X amount of time deleted."
Wild Blue also uses facial recognition from another vendor to prevent customers from collecting repeat treats all day. In that case, the Smile Sampler will ask them to come back tomorrow, he said.
Frank Jimenez, Hershey's senior director of insights-driven performance and retail evolution (quite the title!) said the goal is to help retailers bring more customers into lightly travelled center aisles.
Affectiva co-founder and chief strategy officer Rana el Kaliouby said other than the enterprise-focused service, the company's SDK for Apple (aapl), Android and Microsoft (msft) Windows devices lets developers "emotion enable" their applications.
Advertising and marketing applications are obvious uses for this technology but down the road it could also be used to help robots ascertain the moods and emotions of their human associates.
There is tons of intelligence out there in today's computer systems fueled by massive public clouds like Amazon (amzn) Web Services, and big data analytics, but it is "emotional intelligence" that remains lacking, el Kaliouby told Fortune. And that's the gap companies like Affectiva, Emotient, IBM(ibm) with Watson, and others are trying to fill.
For more on artificial intelligence, check out the video below:
Subscribe to Data Sheet, Fortune’s daily newsletter on the business of technology.