Exemplo n.º 1
0
        async void btnAnalyzeEmotions_Clicked(object sender, EventArgs e)
        {
            ShowProgress(true);

            if (streamCopy != null)
            {
                streamCopy.Seek(0, SeekOrigin.Begin);

                var emotions = isVideo
                    ? await EmotionsService.GetEmotionsVideo(streamCopy)
                    : await EmotionsService.GetEmotionsPicture(streamCopy);

                if (emotions != null)
                {
                    lblResult.Text = "---Emotions Analysis---";
                    DrawResults(emotions);
                    GetRecommendation(emotions);
                }
                else
                {
                    lblResult.Text = "---No face detected---";
                }
            }
            else
            {
                lblResult.Text = "---No image select---";
            }

            ShowProgress(false);
        }
Exemplo n.º 2
0
        async void PlayButton_Clicked(object sender, EventArgs e)
        {
            if (streamCopy != null)
            {
                streamCopy.Seek(0, SeekOrigin.Begin);
                int index = EmotionsPicker.SelectedIndex;

                var persons = await EmotionsService.Analyze(streamCopy, index);

                if (persons != null)
                {
                    ResultsLabel.Text = "---Emotions Analysis---";
                    ShowResults(persons);
                }
                else
                {
                    ResultsLabel.Text = "---Face was not detected---";
                }
            }
            else
            {
                ResultsLabel.Text = "---Picture has not been taken/selected---";
            }
        }