Exemplo n.º 1
0
        private void btnSnap2_Click(object sender, EventArgs e)
        {
            if (!IsDebug())
            {
                if (run)
                {
                    MessageBox.Show("Please stop it and try again!");
                }
                else
                {
                    try
                    {
                        //camera.Snap(imageViewer2.Image);
                    }
                    catch (Exception ex)
                    {
                        txtInformation.AppendText(DateTime.Now.ToString() + ": Manual snap2 error!\r\n");
                        MessageBox.Show(ex.Message + "---Manual snap2 error!");
                    }
                }
            }
            else
            {
                ImagePreviewFileDialog imageDialog = new ImagePreviewFileDialog();

                if (imageDialog.ShowDialog() == DialogResult.OK)
                {
                    FileInformation fileinfo = Algorithms.GetFileInformation(imageDialog.FileName);
                    imageViewer2.Image.Type = fileinfo.ImageType;
                    imageViewer2.Image.ReadFile(imageDialog.FileName);
                }
            }
        }
Exemplo n.º 2
0
        private void LoadImageButton_Click(object sender, EventArgs e)
        {
            ImagePreviewFileDialog imageDialog = new ImagePreviewFileDialog();

            if (imageDialog.ShowDialog() == DialogResult.OK)
            {
                FileInformation fileinfo = Algorithms.GetFileInformation(imageDialog.FileName);
                imageViewer.Image.Type = fileinfo.ImageType;
                imageViewer.Image.ReadFile(imageDialog.FileName);
            }
        }
Exemplo n.º 3
0
        private void browseButton_Click(object sender, EventArgs e)
        {
            ImagePreviewFileDialog dialog = new ImagePreviewFileDialog();

            dialog.FileName = imagePath.Text;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                imagePath.Text = dialog.FileName;
                LoadSelectedImage();
            }
        }
Exemplo n.º 4
0
        private void maskImageButton_Click(object sender, EventArgs e)
        {
            ImagePreviewFileDialog dialog = new ImagePreviewFileDialog();

            dialog.FileName = maskImagePath.Text;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                maskImagePath.Text = dialog.FileName;
                LoadMaskImage();
            }
        }
Exemplo n.º 5
0
        // Click the Browse button to open the file dialog
        private void browseButton_Click(object sender, EventArgs e)
        {
            ImagePreviewFileDialog dialog = new ImagePreviewFileDialog();

            ready              = false;
            dialog.Filter      = "AIPD Images (*.apd;*.aipd)|*.apd;*.aipd|BMP Images (*.bmp)|*.bmp|JPEG Images (*.jpg;*.jpeg)|*.jpg;*.jpeg|PNG Images (*.png)|*.png|TIFF Images (*.tif;*.tiff)|*.tif;*.tiff|All Image Files|*.apd;*.aipd;*.bmp;*.jpg;*.jpeg;*.png;*.tif;*.tiff|All Files (*.*)|*||";
            dialog.FilterIndex = 6;
            dialog.FileName    = imagePath.Text;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                imagePath.Text = dialog.FileName;
                // Load the image
                LoadSelectedImage();
            }
        }
Exemplo n.º 6
0
 private void RightCheck_Click(object sender, EventArgs e)
 {
     if (cboxLocal.Checked)
     {
         ImagePreviewFileDialog imageDialog = new ImagePreviewFileDialog();
         if (imageDialog.ShowDialog() == DialogResult.OK)
         {
             LocalVI = new VisionImage(ImageType.Rgb32);
             LocalVI.ReadFile(imageDialog.FileName);
             InputImage = new Bitmap(Image.FromFile(imageDialog.FileName));
             edit.RightGlueCheck(LocalVI, InputImage, (double)numComspec.Value, (double)numMarkspec.Value);
         }
     }
     else
     {
         edit.ReceiveCmd = "C2";
         Acquire();
     }
 }
Exemplo n.º 7
0
 private void RightPos_Click(object sender, EventArgs e)
 {
     if (cboxLocal.Checked)
     {
         ImagePreviewFileDialog imageDialog = new ImagePreviewFileDialog();
         if (imageDialog.ShowDialog() == DialogResult.OK)
         {
             LocalVI = new VisionImage(ImageType.Rgb32);
             LocalVI.ReadFile(imageDialog.FileName);
             InputImage = new Bitmap(Image.FromFile(imageDialog.FileName));
             edit.RightPosProcess(LocalVI, InputImage);
         }
     }
     else
     {
         edit.ReceiveCmd = "C1";
         Acquire();
     }
 }
Exemplo n.º 8
0
 private bool LoadImagetoImageViewer(ref ImageViewer imageViewer)
 {
     try
     {
         ImagePreviewFileDialog imageDialog = new ImagePreviewFileDialog();
         if (imageDialog.ShowDialog() == DialogResult.OK)
         {
             FileInformation fileinfo = Algorithms.GetFileInformation(imageDialog.FileName);
             imageViewer.Image.Type = fileinfo.ImageType;
             imageViewer.Image.ReadFile(imageDialog.FileName);
             return(true);
         }
     }
     catch (Exception ex)
     {
         logger.ErrorFormat("Load image to imageviewer error! Error message:{0}", ex.Message);
     }
     return(false);
 }
Exemplo n.º 9
0
        // loadButton_Click is called when the Load File button is pressed.
        // The user is asked to load in an image to be used later in classification.
        private void loadButton_Click(object sender, EventArgs e)
        {
            ImagePreviewFileDialog dialog = new ImagePreviewFileDialog();

            // Setup the image dialog
            dialog.InitialDirectory = imagePath.Text;
            dialog.Title            = "Choose an Image to search patterns in";
            // Select the image.
            DialogResult result = dialog.ShowDialog();

            // Load the file and display if not cancelled.
            if (result == DialogResult.OK)
            {
                imagePath.Text = dialog.FileName;
                imageViewer.Image.ReadFile(imagePath.Text);
                imageViewer.Roi.Clear();
                searchButton.Enabled = true;
            }
        }