Пример #1
0
        private void AddEmotions(Microsoft.Azure.CognitiveServices.Vision.Face.Models.Emotion detectedEmotions)
        {
            emotions = new Emotion[8];

            var properties = detectedEmotions.GetType().GetProperties().ToList();

            properties.ForEach(property => {
                var index                  = properties.IndexOf(property);
                emotions[index].name       = property.Name;
                emotions[index].confidence = (double)property.GetValue(detectedEmotions, null);
            });
        }
Пример #2
0
        private void AddEmotions(Microsoft.Azure.CognitiveServices.Vision.Face.Models.Emotion detectedEmotions)
        {
            emotions = new List <Emotion>(8);

            var properties = detectedEmotions.GetType().GetProperties().ToList();

            properties.ForEach(property =>
            {
                var index = properties.IndexOf(property);
                emotions.Add(new Emotion {
                    Id         = Guid.NewGuid().ToString(),
                    Name       = property.Name,
                    Confidence = (double)property.GetValue(detectedEmotions, null),
                    ImageId    = Id
                });
            });
        }