Emotion API

Analyze faces to detect a range of feelings and personalize your app's responses.

Recognize emotions in images

The Emotion API takes a facial expression in an image as an input, and returns the confidence across a set of emotions for each face in the image, as well as bounding box for the face, using the Face API. If a user has already called the Face API, they can submit the face rectangle as an optional input.

The emotions detected are anger, contempt, disgust, fear, happiness, neutral, sadness, and surprise. These emotions are understood to be cross-culturally and universally communicated with particular facial expressions.

See it in action

Anger 0.00000
Contempt 0.00000
Disgust 0.00000
Fear 0.00000
Happiness 1.00000
Neurtral 0.00000
Sadness 0.00000
Surprise 0.00000
Anger 0.00245
Contempt 0.00055
Disgust 0.00633
Fear 0.00012
Happiness 0.95892
Neurtral 0.02225
Sadness 0.00898
Surprise 0.00039
Anger 0.00001
Contempt 0.00000
Disgust 0.00000
Fear 0.00000
Happiness 0.99999
Neurtral 0.00000
Sadness 0.00000
Surprise 0.00000
Anger 0.00000
Contempt 0.00000
Disgust 0.00000
Fear 0.00000
Happiness 0.99999
Neurtral 0.00000
Sadness 0.00000
Surprise 0.00000
Detection result:
4 faces detected

JSON:
[ { "FaceRectangle": { "Top": 114, "Left": 212, "Width": 65, "Height": 65 }, "Scores": { "Anger": 1.0570484E-08, "Contempt": 1.52679547E-09, "Disgust": 1.60232943E-07, "Fear": 6.00660363E-12, "Happiness": 0.9999998, "Neutral": 9.449728E-09, "Sadness": 1.23025981E-08, "Surprise": 9.91396E-10 } }, { "FaceRectangle": { "Top": 141, "Left": 331, "Width": 52, "Height": 52 }, "Scores": { "Anger": 0.002451766, "Contempt": 0.0005512201, "Disgust": 0.0063303886, "Fear": 0.000122375583, "Happiness": 0.9589189, "Neutral": 0.0222537462, "Sadness": 0.008983561, "Surprise": 0.000388026354 } }, { "FaceRectangle": { "Top": 110, "Left": 70, "Width": 51, "Height": 51 }, "Scores": { "Anger": 5.382089E-06, "Contempt": 3.84402554E-08, "Disgust": 8.22284051E-07, "Fear": 1.46369352E-08, "Happiness": 0.999993265, "Neutral": 9.765083E-08, "Sadness": 9.01927848E-08, "Surprise": 2.7211172E-07 } }, { "FaceRectangle": { "Top": 116, "Left": 459, "Width": 45, "Height": 45 }, "Scores": { "Anger": 3.95796542E-06, "Contempt": 2.44360656E-08, "Disgust": 3.291685E-07, "Fear": 1.935065E-09, "Happiness": 0.9999912, "Neutral": 2.461666E-06, "Sadness": 1.96641076E-06, "Surprise": 8.561949E-08 } } ]

By uploading data for this demo you agree that Microsoft may store it and use it to improve Microsoft services, such as making this API better. To help protect your privacy, we take steps to de-identify your data and keep it secure. We won’t publish your data or let other people use it.

Want to build this?

Recognize emotions in video

The Emotion API for Video recognizes the facial expressions of people in a video, and returns a summary of their emotions. You can use this API to track how a person or a crowd responds to your content over time. The emotions detected are anger, contempt, disgust, fear, happiness, neutral, sadness, and surprise.

Recognize emotions in near real-time by extracting frames of a video and then sending those frames to the API calls of your choice. Get results faster and quickly start coding using our sample on GitHub.

Learn more
See it in action

Want to build this?

Check out the other Cognitive Services APIs

Computer Vision API

Distill actionable information from images

Content Moderator

Automated image, text, and video moderation

Video API PREVIEW

Intelligent video processing

Video Indexer PREVIEW

Unlock video insights

Face API

Detect, analyze, organize, and tag faces in photos

Emotion API PREVIEW

Personalize user experiences with emotion recognition

Custom Vision Service PREVIEW

Easily customize your own state-of-the-art computer vision models for your unique use case.

Language Understanding Intelligent Service PREVIEW

Teach your apps to understand commands from your users

Bing Spell Check API

Detect and correct spelling mistakes in your app

Web Language Model API PREVIEW

Use the power of predictive language models trained on web-scale data

Translator Speech API

Easily conduct real-time speech translation with a simple REST API call

Text Analytics API PREVIEW

Easily evaluate sentiment and topics to understand what users want

Translator Text API

Easily conduct machine translation with a simple REST API call

Linguistic Analysis API PREVIEW

Simplify complex language concepts and parse text with the Linguistic Analysis API.

Custom Speech Service PREVIEW

Overcome speech recognition barriers like speaking style, background noise, and vocabulary

Bing Speech API

Convert speech to text and back again to understand user intent

Speaker Recognition API PREVIEW

Use speech to identify and authenticate individual speakers

Recommendations API PREVIEW

Predict and recommend items your customers want

Knowledge Exploration Service PREVIEW

Enable interactive search experiences over structured data via natural language inputs

Entity Linking Intelligence Service API PREVIEW

Power your app's data links with named entity recognition and disambiguation.

Academic Knowledge API PREVIEW

Tap into the wealth of academic content in the Microsoft Academic Graph

QnA Maker API PREVIEW

Distill information into conversational, easy-to-navigate answers.

Custom Decision Service PREVIEW

A cloud-based, contextual decision-making API that sharpens with experience

Project Prague

Gesture based controls

Project Nanjing

Isochrones Calculations

Project Johannesburg

Route logistics

Project Cuzco

Event associated with Wikipedia Entries

Project Abu Dhabi

Distance Matrix

Project Wollongong

Location insights

Ready to supercharge your app?