Face Emotion
Analyzes eight face emotions in a video stream. These emotions are: Angry, Disgust, Fear, Happy, Sad, Surprise, and Neutral. It also returns most dominant emotion on a face. The event listener continuously gets the data in a JSON object as FaceAI analyzes the face emotions.
Method
To start or stop analyzing face emotions in a video stream.
- Class:
EnxFaceAI
- Method:
public void enableFaceEmotion(boolean enable)
Parameter
enable
: Boolean. Set it to true to enable or start the face emotion analysis. Otherwise, set it to false.
Callback Method
onFaceEmotionData
: This method is received repeatedly with the Face Emotion Analysis report as a JSON object.
JSON Object: Received with Face Emotion Analysis data.
{ output: {dominantEmotion: String,emotion: {Angry: Number,Disgust: Number,Fear: Number,Happy: Number,Neutral: Number,Sad: Number,Surprise: Number}}}
Analysis Data Explanation
output
: Face Emotion ReportdominantEmotion
: Name of Dominant Emotion if present, otherwise it is undefined.emotion
: Filtered (smoothened) values of the probability distribution of emotions. The sum of all the probabilities is always 1, each probability in the distribution has a value between 0 and 1.Angry
: Probability for Angry.Disgust
: Probability for Disgust.Fear
: Probability for Fear.Happy
: Probability for Happy.Sad
: Probability for Sad.Surprise
: Probability for Surprise.Neutral
: Probability for Neutral.
Sample Code
enxFaceAI.enableFaceEmotion(true); // To start analysisenxFaceAI.enableFaceEmotion(false); // To stop analysis// Callback@Overridepublic void onFaceEmotionData(String type, String value) {}