Reader small image

You're reading from  Learning Microsoft Cognitive Services

Product typeBook
Published inMar 2017
Reading LevelIntermediate
PublisherPackt
ISBN-139781786467843
Edition1st Edition
Languages
Right arrow
Author (1)
Leif Larsen
Leif Larsen
author image
Leif Larsen

Leif Larsen is a software engineer based in Norway. After earning a degree in computer engineering, he went on to work with the design and configuration of industrial control systems, for the most part, in the oil and gas industry. Over the last few years, he has worked as a developer, developing and maintaining geographical information systems, working with .NET technology. Today, he is working with a start-up, developing a brand new SaaS product. In his spare time, he develops mobile apps and explores new technologies to keep up with the high-paced tech world. You can find out more about him by checking out his blog, "Leif Larsen", and following him on Twitter (@leif_larsen) and LinkedIn (lhlarsen).
Read more about Leif Larsen

Right arrow

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...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Learning Microsoft Cognitive Services
Published in: Mar 2017Publisher: PacktISBN-13: 9781786467843

Author (1)

author image
Leif Larsen

Leif Larsen is a software engineer based in Norway. After earning a degree in computer engineering, he went on to work with the design and configuration of industrial control systems, for the most part, in the oil and gas industry. Over the last few years, he has worked as a developer, developing and maintaining geographical information systems, working with .NET technology. Today, he is working with a start-up, developing a brand new SaaS product. In his spare time, he develops mobile apps and explores new technologies to keep up with the high-paced tech world. You can find out more about him by checking out his blog, "Leif Larsen", and following him on Twitter (@leif_larsen) and LinkedIn (lhlarsen).
Read more about Leif Larsen