コード例 #1
0
        private void ListVideoEmotionResult(EmotionMeanScores scores)
        {
            if (scores != null)
            {
                EmotionResultDisplayItem[] resultDisplay = new EmotionResultDisplayItem[8];
                resultDisplay[0] = new EmotionResultDisplayItem {
                    Emotion = "Anger", Score = scores.AngerScore, CroppedImage = cropEmotions[0]
                };
                resultDisplay[1] = new EmotionResultDisplayItem {
                    Emotion = "Contempt", Score = scores.ContemptScore, CroppedImage = cropEmotions[1]
                };
                resultDisplay[2] = new EmotionResultDisplayItem {
                    Emotion = "Disgust", Score = scores.DisgustScore, CroppedImage = cropEmotions[2]
                };
                resultDisplay[3] = new EmotionResultDisplayItem {
                    Emotion = "Fear", Score = scores.FearScore, CroppedImage = cropEmotions[3]
                };
                resultDisplay[4] = new EmotionResultDisplayItem {
                    Emotion = "Happiness", Score = scores.HappinessScore, CroppedImage = cropEmotions[4]
                };
                resultDisplay[5] = new EmotionResultDisplayItem {
                    Emotion = "Neutral", Score = scores.NeutralScore, CroppedImage = cropEmotions[5]
                };
                resultDisplay[6] = new EmotionResultDisplayItem {
                    Emotion = "Sadness", Score = scores.SadnessScore, CroppedImage = cropEmotions[6]
                };
                resultDisplay[7] = new EmotionResultDisplayItem {
                    Emotion = "Surprise", Score = scores.SurpriseScore, CroppedImage = cropEmotions[7]
                };

                Array.Sort(resultDisplay, CompareDisplayResults);

                Emotion1 = resultDisplay[0];

                Emotion2 = resultDisplay[1];

                Emotion3 = resultDisplay[2];
            }
        }
コード例 #2
0
        private EmotionResultDisplayItem[] SortEmotionResult(EmotionMeanScores scores)
        {
            EmotionResultDisplayItem[] resultDisplay = null;
            if (scores != null)
            {
                resultDisplay = new EmotionResultDisplayItem[8];

                resultDisplay[0] = new EmotionResultDisplayItem {
                    Emotion = "Anger", Score = scores.AngerScore
                };
                resultDisplay[1] = new EmotionResultDisplayItem {
                    Emotion = "Contempt", Score = scores.ContemptScore
                };
                resultDisplay[2] = new EmotionResultDisplayItem {
                    Emotion = "Disgust", Score = scores.DisgustScore
                };
                resultDisplay[3] = new EmotionResultDisplayItem {
                    Emotion = "Fear", Score = scores.FearScore
                };
                resultDisplay[4] = new EmotionResultDisplayItem {
                    Emotion = "Happiness", Score = scores.HappinessScore
                };
                resultDisplay[5] = new EmotionResultDisplayItem {
                    Emotion = "Neutral", Score = scores.NeutralScore
                };
                resultDisplay[6] = new EmotionResultDisplayItem {
                    Emotion = "Sadness", Score = scores.SadnessScore
                };
                resultDisplay[7] = new EmotionResultDisplayItem {
                    Emotion = "Surprise", Score = scores.SurpriseScore
                };

                Array.Sort(resultDisplay, CompareDisplayResults);
            }
            return(resultDisplay);
        }
コード例 #3
0
 private int CompareDisplayResults(EmotionResultDisplayItem result1, EmotionResultDisplayItem result2)
 {
     return((result1.Score == result2.Score) ? 0 : ((result1.Score < result2.Score) ? 1 : -1));
 }