Exemple #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if ((textBox1.Text.Length == 0) || (textBox2.Text.Length == 0))
            {
                MessageBox.Show("You must enter player or team name", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (textBox1.Text == textBox2.Text)
            {
                MessageBox.Show("Player names can't be same", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            String fnames = @"\^";

            if (Regex.IsMatch(textBox1.Text, fnames) || Regex.IsMatch(textBox2.Text, fnames))
            {
                MessageBox.Show("Player names can't have symbol \"^\" !", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }


            Global.text = AddNames.Ret_names(textBox1.Text, textBox2.Text);

            Image <Bgr, byte> lll = new Image <Bgr, byte>(50, 50, new Bgr(trackBar1.Value, trackBar2.Value, trackBar3.Value));

            Mat ll = lll.Mat;

            CvInvoke.CvtColor(ll, ll, Emgu.CV.CvEnum.ColorConversion.Bgr2Hsv);

            Bgr color = (ll.ToImage <Bgr, byte>())[20, 20];

            Global.colors = new Col(color.Blue, color.Green, color.Red);

            OpenFileDialog opf = new OpenFileDialog
            {
                Filter = "Video files | *.avi; *.mp4; *.mov"
            };

            if (opf.ShowDialog() == DialogResult.OK)
            {
                Global.name = opf;
            }
            else
            {
                return;
            }
            Global.videoFromFile = true;
            Global.cancel        = false;
            this.Close();
        }
Exemple #2
0
        private void button3_Click_1(object sender, EventArgs e)
        {
            if (textBox1.Text.Length == 0 && textBox2.Text.Length == 0)
            {
                MessageBox.Show("You must enter player or team name", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (textBox1.Text == textBox2.Text)
            {
                MessageBox.Show("Player names can't be same", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            String fnames = @"(\w)\^";

            if (Regex.IsMatch(textBox1.Text, fnames) && Regex.IsMatch(textBox2.Text, fnames))
            {
                MessageBox.Show("Player names can't have symbol \"^\" !", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }


            Global.text = AddNames.Ret_names(textBox1.Text, textBox2.Text);

            Image <Bgr, byte> lll = new Image <Bgr, byte>(50, 50, new Bgr(trackBar1.Value, trackBar2.Value, trackBar3.Value));

            Mat ll = lll.Mat;

            CvInvoke.CvtColor(ll, ll, Emgu.CV.CvEnum.ColorConversion.Bgr2Hsv);

            Bgr color = (ll.ToImage <Bgr, byte>())[20, 20];

            Global.colors = new Col(color.Blue, color.Green, color.Red);

            Global.videoFromFile = false;
            Global.cancel        = false;
            this.Close();
        }