Load() public method

Load the FaceRecognizer from the file
public Load ( String fileName ) : void
fileName String The file where the FaceRecognizer will be loaded from
return void
 public static void InitializeFaceRecognizer()
 {
     _faceRecognizer?.Dispose();
     _faceRecognizer = new LBPHFaceRecognizer(Properties.Settings.Default.RecognitionRadius, Properties.Settings.Default.RecognitionNeighbours, 8, 8, Properties.Settings.Default.RecognitionThreshold);
     if (!File.Exists(Properties.Settings.Default.RecognitionTrainFile))
     {
         try
         {
             Directory.CreateDirectory(Path.GetDirectoryName(Properties.Settings.Default.RecognitionTrainFile));
             File.Create(Properties.Settings.Default.RecognitionTrainFile).Close();
         }
         catch (Exception ex)
         {
             Debug.WriteLine("Could not create recognition file: " + ex);
         }
     }
     else
     {
         try
         {
             _faceRecognizer.Load(Properties.Settings.Default.RecognitionTrainFile);
             _trained = true;
         }
         catch (Exception ex)
         {
             Debug.WriteLine("Could not load recognition file: " + ex);
         }
     }
 }
        public Form1()
        {
            InitializeComponent();
            recognizer = new LBPHFaceRecognizer(1, 8, 8, 9, 65);

            classifier = new CascadeClassifier(haarcascade);
            GPU_classifier = new GpuCascadeClassifier(haarcascade_cuda);

            font = new MCvFont(Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_TRIPLEX, 0.5, 0.5);
            if (File.Exists(@"traningdata.xml"))
            {
                recognizer.Load(@"traningdata.xml");
            }
            else
            {

                foreach (var file in Directory.GetFiles(Application.StartupPath + @"\Traning Faces\"))
                {
                    try { temp = new Image<Gray, Byte>(file); }
                    catch { continue; }
                    temp._EqualizeHist();

                    var detectedFaces = classifier.DetectMultiScale(temp, 1.1, 15, new Size(24, 24), Size.Empty);
                    if (detectedFaces.Length == 0)
                    {
                        continue;
                    }

                    temp.ROI = detectedFaces[0];
                    temp = temp.Copy();
                    temp = temp.Resize(100, 100, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
                    imagesList.Add(temp);
                    imagesLabels.Add(Path.GetFileNameWithoutExtension(file));
                }
                for (int i = 0; i < imagesList.Count; i++)
                {
                    imagesLabels_indices.Add(i);
                }

                try { recognizer.Train(imagesList.ToArray(), imagesLabels_indices.ToArray()); }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    Environment.Exit(0);
                }
            }
        }
        public void loadRecognizer(string fileName)
        {
            // Reinitialize the recognizer and load in the file
            recognizer = new LBPHFaceRecognizer(1, 8, 8, 9, 100);
            recognizer.Load(fileName);

            string directory = Path.GetDirectoryName(fileName);

            // Purge all existing name labels
            namesList.Clear();

            if (File.Exists(directory + "/TrainedLabels.xml"))
            {
                // Read the file into memory
                FileStream fileStream = File.OpenRead(directory + "/TrainedLabels.xml");
                long fileLength = fileStream.Length;
                byte[] xmlBytes = new byte[fileLength];
                fileStream.Read(xmlBytes, 0, (int)fileLength);
                fileStream.Close();

                MemoryStream xmlStream = new MemoryStream(xmlBytes);

                using (XmlReader xmlReader = XmlTextReader.Create(xmlStream))
                {
                    while (xmlReader.Read())
                    {
                        if (xmlReader.IsStartElement())
                        {
                            switch (xmlReader.Name)
                            {
                                case "NAME":
                                    if (xmlReader.Read())
                                    {
                                        namesList.Add(xmlReader.Value.Trim());
                                    }
                                    break;
                            }
                        }
                    }
                }
            }
            trainStatus = true;
        }
        /// <summary>
        /// Loads the trained Eigen Recogniser from specified location
        /// </summary>
        /// <param name="filename"></param>
        public void Load_Eigen_Recogniser(string filename)
        {
            //Lets get the recogniser type from the file extension
            string ext = Path.GetExtension(filename);
            switch (ext)
            {
                case (".LBPH"):
                    Recognizer_Type = "EMGU.CV.LBPHFaceRecognizer";
                    recognizer = new LBPHFaceRecognizer(1, 8, 8, 8, 100);//50
                    break;
                case (".FFR"):
                    Recognizer_Type = "EMGU.CV.FisherFaceRecognizer";
                    recognizer = new FisherFaceRecognizer(0, 3500);//4000
                    break;
                case (".EFR"):
                    Recognizer_Type = "EMGU.CV.EigenFaceRecognizer";
                    recognizer = new EigenFaceRecognizer(80, double.PositiveInfinity);
                    break;
            }

            //introduce error checking
            recognizer.Load(filename);

            //Now load the labels
            string direct = Path.GetDirectoryName(filename);
            Names_List.Clear();
            if (File.Exists(direct + "/Labels.xml"))
            {
                FileStream filestream = File.OpenRead(direct + "/Labels.xml");
                long filelength = filestream.Length;
                byte[] xmlBytes = new byte[filelength];
                filestream.Read(xmlBytes, 0, (int)filelength);
                filestream.Close();

                MemoryStream xmlStream = new MemoryStream(xmlBytes);

                using (XmlReader xmlreader = XmlTextReader.Create(xmlStream))
                {
                    while (xmlreader.Read())
                    {
                        if (xmlreader.IsStartElement())
                        {
                            switch (xmlreader.Name)
                            {
                                case "NAME":
                                    if (xmlreader.Read())
                                    {
                                        Names_List.Add(xmlreader.Value.Trim());
                                    }
                                    break;
                            }
                        }
                    }
                }
                ContTrain = NumLabels;
            }
            _IsTrained = true;

        }