Beispiel #1
0
 public bool ExportFolder(string path)
 {
     xmlFolder.Load(path);
     files = xmlFolder.GetAll();
     foreach (string f in files)
     {
         ExporttoDB(f);
     }
     return(true);
 }
Beispiel #2
0
        private void btn_Haar_Detect_Click(object sender, EventArgs e)
        {
            if (tb_cascade_path.Text == "")
            {
                MessageBox.Show("Please choose path to folder with at least 1 cascade", "ERROR");
                return;
            }
            if (!Directory.Exists(tb_cascade_path.Text))
            {
                MessageBox.Show("Cascade Folder does not exists", "ERROR");
                return;
            }

            xmlFolder.Load(tb_cascade_path.Text);
            if (xmlFolder.GetCount() == 0)
            {
                MessageBox.Show("Cascade Folder is empty", "ERROR");
                return;
            }
            if (tb_images_to_detect_path.Text == "")
            {
                MessageBox.Show("Please choose path to image folder", "ERROR");
                return;
            }
            if (!Directory.Exists(tb_images_to_detect_path.Text))
            {
                MessageBox.Show("Image Folder does not exist", "ERROR");
                return;
            }
            MessageBox.Show("Please Wait");
            tb_images_to_detect_path.Text = path_to_detect_images;
            folders_to_detect.Clear();
            folders_to_detect.Add(path_to_detect_images);
            foreach (string s in Directory.GetDirectories(path_to_detect_images))
            {
                folders_to_detect.Add(s);
            }
            lFoldersToDetectCount.Text = folders_to_detect.Count.ToString();
            int count = 0;

            foreach (string p in folders_to_detect)
            {
                string[] dirs = Directory.GetFiles(p, "*.jpg");
                count += dirs.Length;
            }
            if (count == 0)
            {
                MessageBox.Show("No images to detect found", "ERROR");
                lImagesToDetectCount.Text = "No images found";
                return;
            }
            lImagesToDetectCount.Text = count.ToString();

            if (!Directory.Exists(tb_detected_images_to_save_path.Text))
            {
                MessageBox.Show("Save Folder does not exist", "ERROR");
                return;
            }

            foreach (string path in folders_to_detect)
            {
                DetectFolder.DetectAll(path, xmlFolder.GetAll(), tb_detected_images_to_save_path.Text);
            }
            MessageBox.Show("Successfull");
        }