Exemplo n.º 1
0
        private void KickoffButton(object sender, RoutedEventArgs e)
        {
            Classes.Clear();
            Regex regex = new Regex("[^0-9.-]+");

            if (!regex.IsMatch(ClassABMeau.Text) && !regex.IsMatch(ClassARMeau.Text) &&
                !regex.IsMatch(ClassAGMeau.Text) &&
                !regex.IsMatch(ClassBBMeau.Text) && !regex.IsMatch(ClassBRMeau.Text) &&
                !regex.IsMatch(ClassBGMeau.Text) &&
                !regex.IsMatch(ClassCBMeau.Text) && !regex.IsMatch(ClassCRMeau.Text) &&
                !regex.IsMatch(ClassCGMeau.Text) &&
                !regex.IsMatch(ClassDBMeau.Text) && !regex.IsMatch(ClassDRMeau.Text) &&
                !regex.IsMatch(ClassDGMeau.Text) &&

                !regex.IsMatch(ClassABSigma.Text) && !regex.IsMatch(ClassARSigma.Text) &&
                !regex.IsMatch(ClassAGSigma.Text) &&
                !regex.IsMatch(ClassBBSigma.Text) && !regex.IsMatch(ClassBRSigma.Text) &&
                !regex.IsMatch(ClassBGSigma.Text) &&
                !regex.IsMatch(ClassCBSigma.Text) && !regex.IsMatch(ClassCRSigma.Text) &&
                !regex.IsMatch(ClassCGSigma.Text) &&
                !regex.IsMatch(ClassDBSigma.Text) && !regex.IsMatch(ClassDRSigma.Text) &&
                !regex.IsMatch(ClassDGSigma.Text) &&
                !regex.IsMatch(Width.Text) && !regex.IsMatch(Height.Text)
                )
            {
                Classes.Add(new RGB
                {
                    RMeau  = int.Parse(ClassARMeau.Text),
                    RSigma = int.Parse(ClassARSigma.Text),
                    GMeau  = int.Parse(ClassAGMeau.Text),
                    GSigma = int.Parse(ClassAGSigma.Text),
                    BMeau  = int.Parse(ClassABMeau.Text),
                    BSigma = int.Parse(ClassABSigma.Text),
                });
                Classes.Add(new RGB
                {
                    RMeau  = int.Parse(ClassBRMeau.Text),
                    RSigma = int.Parse(ClassBRSigma.Text),
                    GMeau  = int.Parse(ClassBGMeau.Text),
                    GSigma = int.Parse(ClassBGSigma.Text),
                    BMeau  = int.Parse(ClassBBMeau.Text),
                    BSigma = int.Parse(ClassBBSigma.Text),
                });
                Classes.Add(new RGB
                {
                    RMeau  = int.Parse(ClassCRMeau.Text),
                    RSigma = int.Parse(ClassCRSigma.Text),
                    GMeau  = int.Parse(ClassCGMeau.Text),
                    GSigma = int.Parse(ClassCGSigma.Text),
                    BMeau  = int.Parse(ClassCBMeau.Text),
                    BSigma = int.Parse(ClassCBSigma.Text),
                });
                Classes.Add(new RGB
                {
                    RMeau  = int.Parse(ClassDRMeau.Text),
                    RSigma = int.Parse(ClassDRSigma.Text),
                    GMeau  = int.Parse(ClassDGMeau.Text),
                    GSigma = int.Parse(ClassDGSigma.Text),
                    BMeau  = int.Parse(ClassDBMeau.Text),
                    BSigma = int.Parse(ClassDBSigma.Text),
                });
                img = TrainModel.GenerateTrainingDataset(ref Classes, uint.Parse(Width.Text), uint.Parse(Height.Text));
                this.ClassesImg.Source = img.Source();
            }
            else
            {
                System.Windows.MessageBox.Show("Make sure that all your inputs are numbers only!");
            }
        }