Esempio n. 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     OpenFileDialog openFileDialog1 = new OpenFileDialog();
     openFileDialog1.Filter = "XML files (*.xml)|*.xml";
     openFileDialog1.FilterIndex = 1;
     openFileDialog1.RestoreDirectory = true;
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         ViewPropertiesOfInputElement_Form edit_form = new ViewPropertiesOfInputElement_Form(openFileDialog1.FileName);
         edit_form.ShowDialog();
         if (edit_form.DialogResult == DialogResult.OK)
         {
             List<Element> e_list = edit_form.getElementList();
             label1.Text += " " + ocr.getResult(e_list);
         }
     }
 }
Esempio n. 2
0
 private void testMultiagentSystem()
 {
     if (ocr == null) return;
     FolderBrowserDialog fbd = new FolderBrowserDialog();
     if (fbd.ShowDialog() == DialogResult.OK)
     {
         DirectoryInfo dir = new DirectoryInfo(fbd.SelectedPath);
         int inputFilesCount = dir.GetFiles().Length;
         int success_recognize = 0;
         Skeleton current_skelet_loaded;//
         for (int i = 0; i < inputFilesCount; i++)
         {
             char expected_result = dir.GetFiles()[i].FullName.ElementAt(dir.GetFiles()[i].FullName.LastIndexOf('.') - 1);
             ViewPropertiesOfInputElement_Form edit_form =
                 new ViewPropertiesOfInputElement_Form(dir.GetFiles()[i].FullName);
             //*
             current_skelet_loaded = ViewProperties_Form.Read_from_xml(dir.GetFiles()[i].FullName);
             List<Element> e_list = new List<Element>();
             for (int j = 0; j < current_skelet_loaded.list_of_cell.Count; j++)
             {
                 e_list.Add(ViewProperties_Form.calcAtributesOfElement(current_skelet_loaded, j));
             }
             string recognize_result = ocr.getResult(e_list);
             if (recognize_result.Equals(expected_result.ToString()))
             {
                 //Console.WriteLine("Успешно распознанный сивол: " + recognize_result);
                 //Console.WriteLine("Количество прочитанных файлов: " + (i + 1) + " из " + inputFilesCount);
                 //Console.WriteLine("Количество успешно распознанных символов: " + ++success_recognize);
                 ++success_recognize;
             }
             // */
             /*
             edit_form.ShowDialog();
             if (edit_form.DialogResult == DialogResult.OK)
             {
                 List<Element> e_list = edit_form.getElementList();
                 string recognize_result = ocr.getResult(e_list);
                 if (recognize_result.Equals(expected_result.ToString()))
                 {
                     Console.WriteLine("Успешно распознанный сивол: " + recognize_result);
                     Console.WriteLine("Количество прочитанных файлов: " + (i + 1) + " из " + inputFilesCount);
                     Console.WriteLine("Количество успешно распознанных символов: " + ++success_recognize);
                 }
             }
             /*
             current_skelet_loaded = ViewProperties_Form.Read_from_xml(dir.GetFiles()[i].FullName);
             List<Element> element_list = new List<Element>();
             for (int j = 0; j < current_skelet_loaded.list_of_cell.Count; j++)
             {
                 element_list.Add(ViewProperties_Form.calcAtributesOfElement(current_skelet_loaded, j));
             }
              */
         }
         Console.WriteLine("Тестирование мультиагентной системы");
         Console.WriteLine("Общее количество тестовых файлов: " + inputFilesCount);
         Console.WriteLine("Количество успешно распознанных файлов: " + success_recognize);
         Console.WriteLine("Результат тетирования в процентах:" +
             Math.Round(success_recognize * 1.0 / inputFilesCount * 100, 2));
     }
 }