Analyzing emotions in videos
Earlier, we looked at analyzing emotions in images. We can do the same analysis with videos as well.
To be able to do this, we can modify the existing example for the Video API.
Start by adding Microsoft.ProjectOxford.Emotion
as a NuGet client package.
Next we add Emotion
to the AvailableOperations
enum. In the VideoOperations
class, add a new case for this value, in CreateVideoOperationSettings
. Return null, as we do not need any video-operation settings for this.
Add a private member to VideoOperations
:
private EmotionServiceClient _emotionServiceClient;
Initialize this in the constructor, using the API key you registered earlier.
In the VideoOperationResultEventArgs
, add a new property called EmotionResult
. This should be of the type VideoAggregateRecognitionResult
.
Back in the VideoOperations
class, copy the GetVideoOperationResultAsync
function. Rename it to GetVideoEmotionResultAsync
, and change the accepted parameter to VideoEmotionRecognitionOperation...