예제 #1
0
        public FrmP()
        {
            InitializeComponent();
            button2.Enabled = false;
            con.Open();
            bind();
            //Load haarcascades for face detection
            face = new HaarCascade("haarcascade_frontalface_default.xml");
            //eye = new HaarCascade("haarcascade_eye.xml");
            try
            {
                //Load of previus trainned faces and labels for each image
                string   Labelsinfo = File.ReadAllText(Application.StartupPath + "/TrainedFaces/TrainedLabels.txt");
                string[] Labels     = Labelsinfo.Split('%');
                NumLabels = Convert.ToInt16(Labels[0]);
                ContTrain = NumLabels;
                string LoadFaces;

                for (int tf = 1; tf < NumLabels + 1; tf++)
                {
                    LoadFaces = "face" + tf + ".bmp";
                    trainingImages.Add(new Image <Gray, byte>(Application.StartupPath + "/TrainedFaces/" + LoadFaces));
                    labels.Add(Labels[tf]);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Nothing in Face database, please add at least a face(Sending To Admin section to Add Face)", "Triained faces load", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                //  FrmP frma = new FrmP();
                // frma.
                // this.Close();
                this.WindowState = FormWindowState.Minimized;
                //  this.Hide();
                Authen frm = new Authen();
                frm.Show();
            }
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Authen frm = new Authen();

            frm.Show();
        }