/// <summary> /// Load a XML file for eye detection /// </summary> private void LoadHaarCascadeEye() { OpenFileDialog ofd = new OpenFileDialog { Title = GenDefString.HaarCascadeOfdTitle, InitialDirectory = Directory.GetCurrentDirectory(), DefaultExt = GenDefString.HaarCascadeOfdDefaultExt, Filter = GenDefString.HaarCascadeOfdFilter, Multiselect = false }; if (ofd.ShowDialog() == true) { try { HaarCascadeEyePathString = Path.GetFullPath(ofd.FileName); FileStorage fs = new FileStorage(HaarCascadeEyePathString, FileStorage.Mode.Read); FileNode fn = fs.GetFirstTopLevelNode(); validEyeClassifierLoaded = Eye.Read(fn); } catch (Exception e) { HaarCascadeEyePathString = GenDefString.HaarCascadePathStringEmpty; validEyeClassifierLoaded = false; System.Windows.MessageBox.Show(GenDefString.InvalidCascadeClassifierXMLLoaded + "\n error: " + e.Message); } } }