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: -(void)enableFaceEmotion:(BOOL)enable;

Parameter

  • enable : Boolean. Set it to true to enable or start the Face Emotion analysis. Otherwise set it to false.

Delegate Method

  • FaceAI:didFaceEmotionData:value : This method is received repeatedly with 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 Report
    • dominantEmotion : 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

// Start Face Emotion
[FaceAI enableFaceEmotion:true];
- (void)FaceAI:(EnxFaceAI *_Nullable)FaceAI didFaceEmotionData:(NSString *_Nullable)type value:(NSString *_Nullable)value{
}