private void ParseValues(string line, int lineNumber)
        {
            string[] splitLine = line.Split(';');

            // "correct implementation" needs to validate all entries in splitLines, but we can just assume this simplifcation
            if ((splitLine[1] != "FIND_FAILED") && (splitLine[1] != "FIT_FAILED"))
            {
                CultureInfo culture = new CultureInfo("pt-PT", false);

                VideoEmotionDatasetEntry datasetEntry = new VideoEmotionDatasetEntry
                {
                    Timestamp = (lineNumber - 1) * VideoEmotionDataset.SamplingRate,

                    Neutral   = double.Parse(splitLine.ElementAt(1), culture.NumberFormat),
                    Happy     = double.Parse(splitLine.ElementAt(2), culture.NumberFormat),
                    Sad       = double.Parse(splitLine.ElementAt(3), culture.NumberFormat),
                    Angry     = double.Parse(splitLine.ElementAt(4), culture.NumberFormat),
                    Surprised = double.Parse(splitLine.ElementAt(5), culture.NumberFormat),
                    Scared    = double.Parse(splitLine.ElementAt(6), culture.NumberFormat),
                    Disgusted = double.Parse(splitLine.ElementAt(7), culture.NumberFormat),
                    Contempt  = double.Parse(splitLine.ElementAt(8), culture.NumberFormat),
                    Valence   = double.Parse(splitLine.ElementAt(9), culture.NumberFormat),
                    Arousal   = double.Parse(splitLine.ElementAt(10), culture.NumberFormat)
                };

                Dataset.DataEntries.Add(datasetEntry);
            }
        }
Пример #2
0
        public Tuple <VideoEmotionDatasetEntry, VideoEmotionDatasetEntry> GetPreviousNext(double timestamp)
        {
            VideoEmotionDatasetEntry previous = null;
            VideoEmotionDatasetEntry next     = null;

            foreach (VideoEmotionDatasetEntry dataEntry in DataEntries)
            {
                if (dataEntry.Timestamp <= timestamp)
                {
                    previous = dataEntry;
                }
                else if (dataEntry.Timestamp > timestamp)
                {
                    next = dataEntry;
                    break;
                }
            }

            Tuple <VideoEmotionDatasetEntry, VideoEmotionDatasetEntry> result = new Tuple <VideoEmotionDatasetEntry, VideoEmotionDatasetEntry>(previous, next);

            return(result);
        }