Ejemplo n.º 1
0
        public MainWindow()
        {
            //App.splashScreen.AddMessage("Loading components");
            InitializeComponent();
            this.Focusable = true;
            this.Unloaded += MainWindow_Unloaded;
            windowHandle   = new System.Windows.Interop.WindowInteropHelper(this as Window).Handle;
            //windowHandle = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
            r_ui.assign_scroll_bars(scroll_bar_scene, scroll_bar_pool);
            con_ui.assign_scroll_bars(scroll_bar_vertical_connections, scroll_bar_horizontal_connections);
            con_ui.assign_data_grid(connections_datagrid);
            help_win = new help.help_window();
            //help_win.Owner = this;
            MyIni = new ini_parser();
            scene = r_ui._scene;
            BindingOperations.EnableCollectionSynchronization(scene.connections, _syncLock);
            connections_datagrid.ItemsSource = scene.connections;
            this.StateChanged += MainWindow_StateChanged;

            //App.splashScreen.LoadComplete();
            //MyIni.Write("show_startup_help", "1");

            /*System.Diagnostics.Process.Start("dxdiag", "/x dxv.xml");
             * while (!System.IO.File.Exists("dxv.xml"))
             *  Thread.Sleep(1000);
             * System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
             * doc.Load("dxv.xml");
             * System.Xml.XmlNode dxd = doc.SelectSingleNode("//DxDiag");
             * System.Xml.XmlNode dxv = dxd.SelectSingleNode("//DirectXVersion");
             *
             * int a ;
             * a = Convert.ToInt32(dxv.InnerText.Split(' ')[1]);
             * int b = a;*/
        }
Ejemplo n.º 2
0
        void click_once_solution()
        {
            scene = r_ui._scene;

            string [][] local_tasks  = new string [scene.images.Count * 3 - 1][];
            string []   global_tasks = new string [scene.images.Count * 3 - 1];
            for (int i = 0; i < scene.images.Count; i++)
            {
                local_tasks[i] = new string[scene.images[i].Count];
                for (int j = 0; j < scene.images[i].Count; j++)
                {
                    local_tasks[i][j] = "Detecting : " + (i + 1).ToString() + ". cat - " + (j + 1).ToString() + ". image";
                }
                global_tasks[i] = "Detecting " + (i + 1).ToString() + ". category";
            }

            for (int i = 0; i < scene.images.Count; i++)
            {
                local_tasks[scene.images.Count + i] = new string[scene.images[i].Count];
                for (int j = 0; j < scene.images[i].Count; j++)
                {
                    local_tasks[scene.images.Count + i][j] = "Describing : " + (i + 1).ToString() + ". cat - " + (j + 1).ToString() + ". image";
                }
                global_tasks[scene.images.Count + i] = "Describing " + (i + 1).ToString() + ". category";
            }
            for (int i = 0; i < scene.images.Count - 1; i++)
            {
                int count = 0;
                for (int j = i + 1; j < scene.images.Count; j++)
                {
                    count += scene.images[j].Count;
                }
                count *= scene.images[i].Count;
                local_tasks[scene.images.Count * 2 + i] = new string[count];
                int index = 0;
                for (int j = 0; j < scene.images[i].Count; j++)
                {
                    for (int u = i + 1; u < scene.images.Count; u++)
                    {
                        for (int v = 0; v < scene.images[u].Count; v++)
                        {
                            local_tasks[scene.images.Count * 2 + i][index] = "Matching : " + (i + 1).ToString() + ". cat - " + (j + 1).ToString() + ". image <-->" + (u + 1).ToString() + ". cat - " + (v + 1).ToString() + ". image";
                            index++;
                        }
                    }
                }

                global_tasks[scene.images.Count * 2 + i] = "Matching " + (i + 1).ToString() + ". category";
            }


            prog_window = new progress_window(local_tasks, global_tasks, new Task(() => { cancelation_token = true; scene.cancel_matching(); }));
            prog_window.Show();
            calc_thread          = new Thread(new ThreadStart(click_once_solution_thread_start));
            calc_thread.Priority = ThreadPriority.Highest;
            calc_thread.Start();
        }
Ejemplo n.º 3
0
 private void generate_fake_button_click(object sender, RoutedEventArgs e)
 {
     //tab_item_matching.IsEnabled = true;
     scene = r_ui._scene;
     for (int i = 0; i < scene.images.Count; i++)
     {
         for (int j = 0; j < scene.images[i].Count; j++)
         {
             //scene.images[i][j].generate_points();
             scene.images[i][j].generate_false_points();
         }
     }
     //scene.generate_matches(System.Convert.ToInt32(matches_count_tb.Text));
     scene.generate_false_matches(System.Convert.ToInt32(matches_count_tb3.Text));
     scene.create_connections();
 }
Ejemplo n.º 4
0
        private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.OriginalSource is TabControl)
            {
                if ((sender as TabControl).SelectedIndex == 0)
                {
                }
                else if ((sender as TabControl).SelectedIndex == 1)
                {
                }
                else if ((sender as TabControl).SelectedIndex == 2)
                {
                    scene = r_ui._scene;

                    m_ui.update_scene(scene);
                }
                else if ((sender as TabControl).SelectedIndex == 3)
                {
                    scene = r_ui._scene;

                    con_ui.update_scene(scene);
                }
            }
        }
Ejemplo n.º 5
0
        void click_once_solution_thread_start()
        {
            scene.clear_connections();
            System.Collections.Generic.List <int> cat_ind = new List <int>();
            System.Collections.Generic.List <int> im_ind  = new List <int>();
            int img_count = 0;

            for (int i = 0; i < scene.images.Count; i++)
            {
                for (int j = 0; j < scene.images[i].Count; j++)
                {
                    cat_ind.Add(i);
                    im_ind.Add(j);
                    img_count++;
                }
            }
            System.Threading.Tasks.Parallel.For(0, img_count, (i, loopstate) =>
            {
                scene.images[cat_ind[i]][im_ind[i]].build_integral_image();
                scene.images[cat_ind[i]][im_ind[i]].detect_points();

                prog_window.progress();
                if (cancelation_token)
                {
                    loopstate.Stop();
                }
            });
            if (cancelation_token)
            {
                cancel_work();
                return;
            }

            System.Threading.Tasks.Parallel.For(0, img_count, (i, loopstate) =>
            {
                scene.images[cat_ind[i]][im_ind[i]].describe_points();
                scene.images[cat_ind[i]][im_ind[i]].get_render_data();
                prog_window.progress();
                //scene.images[i][j].generate_false_points();
                if (cancelation_token)
                {
                    loopstate.Stop();
                }
            });
            if (cancelation_token)
            {
                cancel_work();
                return;
            }
            scene.progress_callback prog_calb = prog_window.progress;
            scene.generate_matches(prog_calb);
            scene.create_connections();

            Dispatcher.Invoke(new Action(() =>
            {
                r_ui.lock_ui(false);
                scene = r_ui._scene;
                m_ui.update_scene(scene);
                connections_datagrid.Items.Refresh();
                prog_window.Close();
                cancelation_token = false;
                calc_thread.Abort();
                return;
            }), System.Windows.Threading.DispatcherPriority.Render);
            //prog_window.progress();
        }