public emgu_add(form_main fr) { f = new form_main(); f = fr; InitializeComponent(); //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(e.ToString()); MessageBox.Show("Nothing in binary database, please add at least a face(Simply train the prototype with the Add Face Button).", "Triained faces load", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
//lets overload our main method so as to transfer data between our forms public register_camera(form_main fr) { InitializeComponent(); f = new form_main(); f = fr; }