示例#1
0
        private void btn_convert_videos_Click(object sender, EventArgs e)
        {
            if (tb_videos_path.Text == "")
            {
                MessageBox.Show("Please choose video folder path", "ERROR");
                return;
            }

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

            vidFolder.Load(tb_videos_path.Text);
            if (vidFolder.getCount() == 0)
            {
                MessageBox.Show("Video Folder is empty", "ERROR");
                return;
            }

            if (tb_images_to_save_path.Text == "")
            {
                MessageBox.Show("Please choose folder to save images", "ERROR");
                return;
            }
            if (!Directory.Exists(tb_images_to_save_path.Text))
            {
                MessageBox.Show("Folder for save does not exists", "ERROR");
                return;
            }

            MessageBox.Show("Please wait till the end of conversion");
            foreach (string videopath in vidFolder.videoArray)
            {
                //int fps = 5;
                FFMPEGConverter conv    = new FFMPEGConverter(videopath, tb_images_to_save_path.Text, 5000);
                bool            rewrite = false;
                if (conv.ConvertAll(rewrite) == false)
                {
                    MessageBox.Show("Something went wrong with" + videopath);
                }
            }
            lFoldersToDetectCount.Text = folders_to_detect.Count.ToString();
            images_count_to_detect     = 0;
            foreach (string p in folders_to_detect)
            {
                string[] dirs = Directory.GetFiles(p, "*.jpg");
                images_count_to_detect += dirs.Length;
            }
            lImagesToDetectCount.Text = images_count_to_detect.ToString();
        }
        public static VideoFolder openFolder()
        {
            string[] arr  = new string[0];
            string   path = "";

            if (Properties.Settings.Default.last_path_to_videos != "")
            {
                path = Properties.Settings.Default.last_path_to_videos;
            }
            var dialog = new FolderBrowserDialog();

            dialog.SelectedPath = path;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                path = dialog.SelectedPath;
                Vf   = new VideoFolder();
                Vf.Load(path);
            }
            return(Vf);
        }
示例#3
0
        public MainForm()
        {
            InitializeComponent();

            if ((Properties.Settings.Default.last_path_to_videos != "") && (Directory.Exists(Properties.Settings.Default.last_path_to_videos)))
            {
                vidFolder = new VideoFolder();
                vidFolder.Load(Properties.Settings.Default.last_path_to_videos);
                lVideos_count.Text  = "Found " + vidFolder.getCount();
                tb_videos_path.Text = vidFolder.getPath();
            }
            else
            {
                vidFolder = new VideoFolder();
            }

            if (Properties.Settings.Default.last_path_for_images_to_save != "")
            {
                var path = Properties.Settings.Default.last_path_for_images_to_save;
                tb_images_to_save_path.Text = path;
            }

            if ((Properties.Settings.Default.last_path_for_images_to_detect != "") && (Directory.Exists(Properties.Settings.Default.last_path_for_images_to_detect)))
            {
                path_to_detect_images         = Properties.Settings.Default.last_path_for_images_to_detect;
                tb_images_to_detect_path.Text = path_to_detect_images;
                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();
                images_count_to_detect     = 0;
                foreach (string p in folders_to_detect)
                {
                    string[] dirs = Directory.GetFiles(p, "*.jpg");
                    images_count_to_detect += dirs.Length;
                }
                lImagesToDetectCount.Text = images_count_to_detect.ToString();
            }

            if (Properties.Settings.Default.last_path_to_cascades != "")
            {
                path_to_cascades = Properties.Settings.Default.last_path_to_cascades;
                if (path_to_cascades.Length != 0)
                {
                    xmlFolder = new XmlFolder();
                    xmlFolder.Load(path_to_cascades);
                    tb_cascade_path.Text = path_to_cascades;
                    if (xmlFolder.GetCount() > 0)
                    {
                        lCascadeLoaded.Text = "Loaded " + xmlFolder.GetCount().ToString();
                    }
                    else
                    {
                        lCascadeLoaded.Text = "Not Exists";
                    }
                    tb_cascade_path.Text = Properties.Settings.Default.last_path_to_cascades;
                }
                else
                {
                    lCascadeLoaded.Text = "Not loaded";
                }
            }
            else
            {
                xmlFolder = new XmlFolder();
            }

            if (Properties.Settings.Default.last_path_for_detected_images_to_save != "")
            {
                var path = Properties.Settings.Default.last_path_for_detected_images_to_save;
                tb_detected_images_to_save_path.Text = path;
            }

            if ((Properties.Settings.Default.last_path_to_learn_pictures != "") && (Directory.Exists(Properties.Settings.Default.last_path_to_learn_pictures)))
            {
                trainFolder = new ImageFolder();
                trainFolder.Load(Properties.Settings.Default.last_path_to_learn_pictures);
                lLearn_count.Text       = "Found " + trainFolder.GetCount();
                tb_train_imgs_path.Text = trainFolder.GetPath();
            }

            if ((Properties.Settings.Default.last_path_to_test_pictures != "") && (Directory.Exists(Properties.Settings.Default.last_path_to_test_pictures)))
            {
                testFolder = new ImageFolder();
                testFolder.Load(Properties.Settings.Default.last_path_to_test_pictures);
                lTest_count.Text       = "Found " + testFolder.GetCount();
                tb_test_imgs_path.Text = testFolder.GetPath();
            }

            if ((Properties.Settings.Default.last_path_to_pictures != "") && (Directory.Exists(Properties.Settings.Default.last_path_to_pictures)))
            {
                recognizeImageFolder = new ImageFolder();
                recognizeImageFolder.Load(Properties.Settings.Default.last_path_to_pictures);
                lImages.Text      = "Found " + recognizeImageFolder.GetCount();
                tb_imgs_path.Text = recognizeImageFolder.GetPath();
            }

            if (Properties.Settings.Default.last_path_to_results_save != "")
            {
                path_to_results_save = Properties.Settings.Default.last_path_to_results_save;
                if (Directory.Exists(path_to_results_save))
                {
                    tb_result_save_path.Text = path_to_results_save;
                }
            }

            if (Properties.Settings.Default.last_path_to_network != "")
            {
                lNetwork.Text = "exists";
                var path = Properties.Settings.Default.last_path_to_network;
                tb_network_path.Text = path;
                network = new CNN(path);
            }
            else
            {
                network = new CNN("");
            }

            //Properties.Settings.Default.is_opened_first_time = true;

            /*if (Properties.Settings.Default.is_opened_first_time)
             * {
             *  MessageBox.Show("Hello new User");
             *  Properties.Settings.Default.is_opened_first_time = false;
             *  Properties.Settings.Default.Save();
             * }*/
        }