예제 #1
0
        private static void GeneratePerson(string person)
        {
            if (Directory.Exists(PathHelper.PersonTrainPath(person)))
            {
                return;
            }

            Directory.CreateDirectory(PathHelper.PersonTrainPath(person));
            Dictionary <string, int> timestamps = TimeStampReader.GetTimeStamps(person);
            Dictionary <string, int> emotions   = ImageDisplay.GetEmotionDictionary();

            if (timestamps == null)
            {
                return;
            }

            foreach (var item in timestamps)
            {
                if (item.Key.StartsWith("sample"))
                {
                    DirectoryInfo taskDirectory = new DirectoryInfo(PathHelper.FrontalSamplesPath(person));
                    var           taskFiles     = taskDirectory.GetFiles("*.jpeg").Where(p => p.Name.StartsWith(item.Value + "_"));
                    if (taskFiles.Count() > 0)
                    {
                        var first = taskFiles.ToArray()[0];
                        File.Copy(first.FullName, PathHelper.PersonTrainPath(person) + emotions[item.Key] + "_" + item.Value + ".jpeg");
                    }
                }
            }
        }
예제 #2
0
        public void RemoveSample(object sender, RoutedEventArgs e)
        {
            TrainSampleGenerator.RemoveImage(person, currentEmotion, frame);

            emoteDictionary = TimeStampReader.GetTimeStamps(person);
            frameModifier   = 0;
            DisplayEmotion( );
        }
예제 #3
0
 private void ShowPerson()
 {
     personLabel.Content  = person;
     currentEmotion       = "sampleNormal";
     emotionLabel.Content = currentEmotion.Replace("sample", "");
     CleanWindow();
     sampleNormal.Background = Brushes.LightSkyBlue;
     emoteDictionary         = TimeStampReader.GetTimeStamps(person);
     frameModifier           = 0;
     if (emoteDictionary == null)
     {
         personLabel.Content = person + " NOPERSON";
         frameLabel.Content  = "NOPERSON";
         Display.Source      = null;
         validPerson         = false;
     }
     else
     {
         validPerson = true;
         DisplayEmotion();
     }
 }