Пример #1
0
        private void buttonSaveParameters_Click(object sender, EventArgs e)
        {
            if (IsReadyFaces)
            {
                trainParameters.Eigen.Components = Convert.ToInt32(textBoxEigenComponents.Text);
                trainParameters.Eigen.Treshold   = Convert.ToDouble(textBoxEigenTreshold.Text);

                trainParameters.Fisher.Treshold   = Convert.ToDouble(textBoxFisherTreshold.Text);
                trainParameters.Fisher.Components = Convert.ToInt32(textBoxFisherComponents.Text);

                trainParameters.LBPH.Treshold  = Convert.ToDouble(textBoxLBPHTreshold.Text);
                trainParameters.LBPH.Radius    = Convert.ToInt32(textBoxLBPHRadius.Text);
                trainParameters.LBPH.Neighbors = Convert.ToInt32(textBoxLBPHNeighbors.Text);
                trainParameters.LBPH.GridX     = Convert.ToInt32(textBoxLBPHGridX.Text);
                trainParameters.LBPH.GridY     = Convert.ToInt32(textBoxLBPHGridY.Text);


                classifierRecognize = new Classifier_Train(trainParameters);
                var testResults = new List <RecognizeTestResult>();

                if (checkBoxNoModificate.Checked)
                {
                    testResults.Add(ConductTest(checkBoxNoModificate.Text, delegate(Bitmap bitmap) { return(bitmap); }));
                }
                if (checkBoxDark.Checked)
                {
                    testResults.Add(ConductTest(checkBoxDark.Text, delegate(Bitmap bitmap)
                                                { return(imageBrightness.ChangeBrightness(bitmap, 0.5f)); }));
                }
                if (checkBoxLight.Checked)
                {
                    testResults.Add(ConductTest(checkBoxLight.Text, delegate(Bitmap bitmap)
                                                { return(imageBrightness.ChangeBrightness(bitmap, 2.0f)); }));
                }
                if (checkBoxVeryDark.Checked)
                {
                    testResults.Add(ConductTest(checkBoxVeryDark.Text, delegate(Bitmap bitmap)
                                                { return(imageBrightness.ChangeBrightness(bitmap, 0.05f)); }));
                }
                if (checkBoxVeryLight.Checked)
                {
                    testResults.Add(ConductTest(checkBoxVeryLight.Text, delegate(Bitmap bitmap)
                                                { return(imageBrightness.ChangeBrightness(bitmap, 5.0f)); }));
                }

                if (testResults.Count != 0)
                {
                    HystogramsForm hystogramsForm = new HystogramsForm(testResults);
                    hystogramsForm.Show();
                }
                else
                {
                    MessageBox.Show("Samples no selected");
                }
            }
            else
            {
                MessageBox.Show("Data is empty");
            }
        }
Пример #2
0
        private void btn_kayit_Click(object sender, EventArgs e)
        {
            DialogResult chose = MessageBox.Show("Kaydı Veritabanına Eklemek istiyor musunuz?", "Bilgilendirme Penceresi", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (ogr_ad_soyad.Text != "" && txt_box_Tc.Text != "" && txt_box_Okul_No.Text != "" && txt_box_Fakülte.Text != "" && txt_box_Bölüm.Text != "")
            {
                if (chose == DialogResult.Yes)
                {
                    t_OGR.OGR_BOLUM    = txt_box_Bölüm.Text;
                    t_OGR.OGR_CINSIYET = combo_box_Cinsiyet.Text;
                    t_OGR.OGR_DOGUMT   = dt_time_Dogum_t.Text;
                    t_OGR.OGR_FAKULTE  = txt_box_Fakülte.Text;
                    t_OGR.OGR_ISIM     = ogr_ad_soyad.Text;
                    t_OGR.OGR_OKULNU   = Convert.ToInt64(txt_box_Okul_No.Text);
                    t_OGR.OGR_TC       = Convert.ToInt64(txt_box_Tc.Text);
                    t_KEY.DERS_KODU    = combo_Box_Sinif.Text;
                    t_KEY.OGR_OKULNU   = Convert.ToInt64(txt_box_Tc.Text);
                    bool verify = false;
                    verify = services.AddNewStudents(t_OGR, t_KEY);
                    if (verify == false)
                    {
                        MessageBox.Show("Kayıt Yapılamadı Ağ Bağlantısını Kontrol Edin");
                    }
                    else
                    {
                        for (int i = 0; i < 10; i++)
                        {
                            fotosayisi++;
                            if (!recognition.SaveTrainingData(pic_kucuk_res.Image, ogr_ad_soyad.Text))
                            {
                                MessageBox.Show("Öğrenci Kaydı Yapılamadı");
                            }

                            label11.Text = (fotosayisi.ToString());
                        }
                        recognition = null;
                        train       = null;
                        recognition = new BusinessRecognition("D:\\", "Yüz", "yuz.xml");
                        train       = new Classifier_Train("D:\\", "Yüz", "yuz.xml");
                        MessageBox.Show("Kayıt Başarılı Bir Şekilde Tamamlandı!");
                        fotosayisi   = 0;
                        label11.Text = (fotosayisi.ToString());
                        txt_box_Okul_No.Clear();
                        txt_box_Tc.Clear();
                        ogr_ad_soyad.Clear();
                        txt_box_Bölüm.Clear();
                        txt_box_Fakülte.Clear();
                    }
                }
            }
            else
            {
                MessageBox.Show("Bütün alanları Doldurunuz!");
            }
        }
        //Open training form and pass this
        //private void trainToolStripMenuItem_Click(object sender, EventArgs e)
        //{
        //    //Stop Camera
        //    stop_capture();

        //    //OpenForm
        //    Training_Form TF = new Training_Form(this);
        //    TF.Show();
        //}
        public void retrain()
        {
            Eigen_Recog = new Classifier_Train();
            if (Eigen_Recog.IsTrained)
            {
                message_bar.Text = "Training Data loaded";
            }
            else
            {
                message_bar.Text = "No training data found, please train program using Train menu option";
            }
        }
Пример #4
0
 public void retrain()//重新加载数据
 {
     Eigen_Recog = new Classifier_Train();
     if (Eigen_Recog.IsTrained)
     {
         message_bar.Text = "训练图像数据加载完毕!";
     }
     else
     {
         message_bar.Text = "训练数据无法找到, 请通过训练菜单选项进行训练!";
     }
 }
 public void Retrain()
 {
     classifierRecognize = new Classifier_Train();
     if (classifierRecognize.IsTrained)
     {
         message_bar.Text = "Training Data loaded";
     }
     else
     {
         message_bar.Text = "No training data found, please train program using Train menu option";
     }
 }
 public void retrain()
 {
     Eigen_Recog = new Classifier_Train();
     if (Eigen_Recog.IsTrained)
     {
         message_bar.Text = "现在可以进行识别登录!";
     }
     else
     {
         message_bar.Text = "没有发现存储的用户脸部图像, 请先注册!";
     }
 }
Пример #7
0
 public void retrain()
 {
     Eigen_Recog = new Classifier_Train();
     if (Eigen_Recog.IsTrained)
     {
         labelmessege.Text = "Training Data loaded";
     }
     else
     {
         labelmessege.Text = "No training data found, please train program using Train menu option";
     }
 }
Пример #8
0
        //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
        //-----------------------------------------------------------------------------------------
        public void Retrain()
        {
            Eigen_Recog = new Classifier_Train();

            if (Eigen_Recog.IsTrained)
            {
                txtSysMsg.Text = "Training Data Loaded" + Environment.NewLine + txtSysMsg.Text;
            }
            else
            {
                txtSysMsg.Text = "No Training Data Found !!!" + Environment.NewLine + txtSysMsg.Text;
            }
        }
        public Form1()
        {
            InitializeComponent();

            //Load of previus trainned faces and labels for each image
            itemsRecognition    = new List <ListViewItem>();
            classifierRecognize = new Classifier_Train();

            trainParameters = new TrainParameters();
            if (classifierRecognize.IsTrained)
            {
                message_bar.Text = "Training Data loaded";
            }
            else
            {
                message_bar.Text = "No training data found, please train program using Train menu option";
            }
            Initialise_capture();
        }
Пример #10
0
        private async void button1_Click(object sender, EventArgs e)
        {
            await Task.Run(() =>

            {
                for (int i = 0; i < 10; i++)
                {
                    if (!recognition.SaveTrainingData(pictureBox2.Image, textBox1.Text))
                    {
                        MessageBox.Show("hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    Thread.Sleep(100);
                    label1.Text = (i + 1) + "adet profil";
                }
                recognition = null;
                train       = null;
                recognition = new BusinessRecognition("D:\\", "Faces", "yuz.xml");
                train       = new Classifier_Train("D:\\", "Faces", "yuz.xml");
            });
        }
 public BusinessRecognition(string Dizin, string KlasorAdi, string XmlVeriDosyasi)
 {
     this.Dizin          = Dizin + "/" + KlasorAdi + "/";
     this.XmlVeriDosyasi = XmlVeriDosyasi;
     Eigen_Recog         = new Classifier_Train(Dizin, KlasorAdi, XmlVeriDosyasi);
 }
 public BusinessRecognition(string Dizin, string KlasorAdi)
 {
     this.Dizin  = Dizin + "/" + KlasorAdi + "/";
     Eigen_Recog = new Classifier_Train(Dizin, KlasorAdi);
 }
Пример #13
0
        private async void btn_kayit_Click(object sender, EventArgs e)
        {
            /*  if (TekrarKontrolu(txt_box_Okul_No.Text)==false)
             * {
             *    MessageBox.Show(txt_box_Okul_No.Text + "Öğrenci Zaten Kayıtlı.");
             *    return;
             * }*/
            if (ogr_ad_soyad.Text != "" && txt_box_Tc.Text != "" && txt_box_Okul_No.Text != "" && txt_box_Fakülte.Text != "" && txt_box_Bölüm.Text != "")
            {
                if (combo_Box_Sinif.Text == "BIL102")
                {
                    try
                    {
                        baglanti.Open();
                        string     kayit = "INSERT INTO  BIL_102 (OGRNU,OGR_TCNU,OGRISIM,OGRDOGUMTARIHI,OGRBOLUM,OGRFAK,OGRCIN) values(@OGRNU,@OGR_TCNU,@OGRISIM,@OGRDOGUMTARIHI,@OGRBOLUM,@OGRFAK,@OGRCIN) ";
                        SqlCommand komut = new SqlCommand(kayit, baglanti);
                        komut.Parameters.AddWithValue("@OGRNU", txt_box_Okul_No.Text);
                        komut.Parameters.AddWithValue("@OGR_TCNU", txt_box_Tc.Text);
                        komut.Parameters.AddWithValue("@OGRISIM", ogr_ad_soyad.Text);
                        komut.Parameters.AddWithValue("@OGRDOGUMTARIHI", dt_time_Dogum_t.Text);
                        komut.Parameters.AddWithValue("@OGRBOLUM", txt_box_Bölüm.Text);
                        komut.Parameters.AddWithValue("@OGRFAK", txt_box_Fakülte.Text);
                        komut.Parameters.AddWithValue("@OGRCIN", combo_box_Cinsiyet.Text);
                        komut.ExecuteNonQuery();
                        baglanti.Close();
                    }

                    catch (Exception)
                    {
                        MessageBox.Show("Kayıt yapılamadı!");
                    }
                    for (int i = 0; i < 10; i++)
                    {
                        fotosayisi++;
                        if (!recognition.SaveTrainingData(pic_kucuk_res.Image, ogr_ad_soyad.Text))
                        {
                            MessageBox.Show("Öğrenci Kaydı Yapılamadı");
                        }
                        label11.Text = (fotosayisi.ToString());
                    }
                    recognition = null;
                    train       = null;
                    recognition = new BusinessRecognition("D:\\", "Yüz", "yuz.xml");
                    train       = new Classifier_Train("D:\\", "Yüz", "yuz.xml");
                    MessageBox.Show("Kayıt Başarılı Bir Şekilde Tamamlandı!");
                    fotosayisi   = 0;
                    label11.Text = (fotosayisi.ToString());
                    txt_box_Okul_No.Clear();
                    txt_box_Tc.Clear();
                    ogr_ad_soyad.Clear();
                    txt_box_Bölüm.Clear();
                    txt_box_Fakülte.Clear();
                }
                if (combo_Box_Sinif.Text == "BIL101")
                {
                    try
                    {
                        baglanti.Open();
                        string     kayit = "INSERT INTO  BIL_101 (OGRNU,OGR_TCNU,OGRISIM,OGRDOGUMTARIHI,OGRBOLUM,OGRFAK,OGRCIN) values(@OGRNU,@OGR_TCNU,@OGRISIM,@OGRDOGUMTARIHI,@OGRBOLUM,@OGRFAK,@OGRCIN) ";
                        SqlCommand komut = new SqlCommand(kayit, baglanti);
                        komut.Parameters.AddWithValue("@OGRNU", txt_box_Okul_No.Text);
                        komut.Parameters.AddWithValue("@OGR_TCNU", txt_box_Tc.Text);
                        komut.Parameters.AddWithValue("@OGRISIM", ogr_ad_soyad.Text);
                        komut.Parameters.AddWithValue("@OGRDOGUMTARIHI", dt_time_Dogum_t.Text);
                        komut.Parameters.AddWithValue("@OGRBOLUM", txt_box_Bölüm.Text);
                        komut.Parameters.AddWithValue("@OGRFAK", txt_box_Fakülte.Text);
                        komut.Parameters.AddWithValue("@OGRCIN", combo_box_Cinsiyet.Text);
                        komut.ExecuteNonQuery();
                        baglanti.Close();
                    }

                    catch (Exception)
                    {
                        MessageBox.Show("Kayıt yapılamadı!");
                    }
                    for (int i = 0; i < 10; i++)
                    {
                        fotosayisi++;
                        if (!recognition.SaveTrainingData(pic_kucuk_res.Image, ogr_ad_soyad.Text))
                        {
                            MessageBox.Show("Öğrenci Kaydı Yapılamadı");
                        }

                        label11.Text = (fotosayisi.ToString());
                    }
                    recognition = null;
                    train       = null;
                    recognition = new BusinessRecognition("D:\\", "Yüz", "yuz.xml");
                    train       = new Classifier_Train("D:\\", "Yüz", "yuz.xml");
                    MessageBox.Show("Kayıt Başarılı Bir Şekilde Tamamlandı!");
                    fotosayisi   = 0;
                    label11.Text = (fotosayisi.ToString());
                    txt_box_Okul_No.Clear();
                    txt_box_Tc.Clear();
                    ogr_ad_soyad.Clear();
                    txt_box_Bölüm.Clear();
                    txt_box_Fakülte.Clear();
                }
            }
            else
            {
                MessageBox.Show("Alanlardan hiç birini boş bırakmayınız!");
            }
        }