BuildIt.CognitiveServices.CognitiveServiceClient.VisionEmotionApiRequestAsync C# (CSharp) Method

VisionEmotionApiRequestAsync() public method

Analyze faces to detect a range of feelings and personalize your app's responses.
public VisionEmotionApiRequestAsync ( string subscriptionKey, Stream photoStream ) : Task>
subscriptionKey string
photoStream Stream
return Task>
        public async Task<ResultDto<Emotion[]>> VisionEmotionApiRequestAsync(string subscriptionKey, Stream photoStream)
        {
            var resultDto = new ResultDto<Emotion[]>();
            try
            {
                using (photoStream)
                {
                    var emotionRects = await UploadAndDetectEmotion(subscriptionKey, photoStream);
                    resultDto.Result = emotionRects;
                    resultDto.Success = resultDto.Result != null;
                }
            }
            catch (Exception ex)
            {
                resultDto.ErrorMessage = ex.Message;
                resultDto.Exception = ex;
                Debug.WriteLine($"{ex}");
            }
            return resultDto;
        }