コード例 #1
0
        /// <summary>
        /// Initializes MainWindow and initializes algorithm object
        /// </summary>
        public MainWindow()
        {
            using (var templateImage = new AvlNet.Image())
            {
                try
                {
                    InitializeComponent();

                    AVL.LoadImage(TemplateImagePath, false, templateImage);
                    GasketInspector.Init(templateImage);
                }
                catch (Exception e)
                {
                    startButton.Enabled = false;
                    MessageBox.Show(e.Message);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Performs inspection in 500ms interval.
        /// </summary>
        private void timer_Tick(object sender, EventArgs e)
        {
            using (var currentImage = new AvlNet.Image())
            {
                if (currentImageIndex < ImagePaths.Length)
                {
                    AVL.LoadImage(ImagePaths[currentImageIndex], false, currentImage);
                    GasketInspector.Inspect(currentImage, out circles, out arcs, out segments);

                    if (pictureBox1.Image != null)
                    {
                        pictureBox1.Image.Dispose();
                    }

                    pictureBox1.Image = currentImage.CreateBitmap();
                    ++currentImageIndex;
                }
                else
                {
                    timer.Enabled       = false;
                    startButton.Enabled = true;
                }
            }
        }
コード例 #3
0
 /// <summary>
 /// Cleans resources
 /// </summary>
 private void MainWindow_FormClosed(object sender, FormClosedEventArgs e)
 {
     GasketInspector.ClearResources();
 }