コード例 #1
0
ファイル: Form1.cs プロジェクト: ehlymana/ViolaJonesDetector
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || (!radioButton1.Checked && !radioButton2.Checked))
            {
                return;
            }
            var watch = System.Diagnostics.Stopwatch.StartNew();

            if (radioButton1.Checked)
            {
                ViolaJonesDetekcija.TreningLica(textBox1.Text, progressBar1);
            }
            else
            {
                ViolaJonesDetekcija.TreningNeLica(textBox1.Text, progressBar1);
            }
            watch.Stop();
            var trajanje = watch.ElapsedMilliseconds;

            trajanje    /= 1000;
            label12.Text = "Trajanje treninga: " + trajanje.ToString() + " sekundi";
        }
コード例 #2
0
 private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
 {
     if (treningLica)
     {
         ViolaJonesDetekcija.TreningLica(textBox1.Text, backgroundWorker1);
     }
     else if (treningNeLica)
     {
         ViolaJonesDetekcija.TreningNeLica(textBox1.Text, backgroundWorker1);
     }
     else if (detekcija)
     {
         rezultatDetekcije = ViolaJonesDetekcija.Detekcija(new Bitmap(pictureBox1.Image), backgroundWorker1);
     }
     else if (detekcijaDirektorij)
     {
         ViolaJonesDetekcija.DetekcijaIzvjestaj(textBox2.Text, backgroundWorker1);
     }
     else if (poboljsanje)
     {
         ViolaJonesDetekcija.IzvrsiPoboljsanje(radioButton4.Checked, new Bitmap(pictureBox1.Image), lice, backgroundWorker1);
     }
 }