Exemple #1
0
 public Form1()
 {
     InitializeComponent();
     form2 = new Form2();
     form2.Show();
     imagePath.Text = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Alu.bmp");
 }
Exemple #2
0
 private void SetImagePath()
 {
     if (imagePath.Text == "")
     {
         imagePath.Text = System.IO.Path.GetFullPath(System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), @"pcb\pcb03-01.png"));
     }
 }
Exemple #3
0
        private void GetNextImage(VisionImage dest)
        {
            VisionImage nextImage;

            // Load an image or return to the previous image
            if (imageNumber >= images.Count)
            {
                nextImage = new VisionImage();
                nextImage.ReadFile(System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), @"Parts\Parts0" + imageNumber + ".png"));
                images.Add(nextImage);
            }
            else
            {
                nextImage = images[imageNumber];
                // Clear any overlays.
                nextImage.Overlays.Default.Clear();
            }
            // Copy the image to the destination image
            Algorithms.Copy(nextImage, dest);

            // Advance the image number to the next image
            imageNumber++;
            if (imageNumber > 4)
            {
                imageNumber = 0;
            }
        }
Exemple #4
0
 private void Form1_Load(object sender, EventArgs e)
 {
     imagePath.Text = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Alu.bmp");
     openFileDialog1.InitialDirectory = ExampleImagesFolder.GetExampleImagesFolder();
     imageViewer1.Roi.MaximumContours = 1;
     imageViewer1.ToolsShown          = ViewerTools.Line | ViewerTools.Pan | ViewerTools.Selection | ViewerTools.ZoomIn | ViewerTools.ZoomOut;
     imageViewer1.ActiveTool          = ViewerTools.Line;
 }
Exemple #5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Initialize the combo box
            imageType.SelectedIndex = 0;

            // Initialize the common dialog's default directory
            openFileDialog1.InitialDirectory = ExampleImagesFolder.GetExampleImagesFolder();
        }
Exemple #6
0
        private void loadTargetButton_Click(object sender, EventArgs e)
        {
            // Load Calibration Grid image.
            uncorrectedImage.ReadFile(System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Distorted coins.png"));
            imageViewer1.Attach(uncorrectedImage);

            measurePartsButton.Enabled = true;
        }
Exemple #7
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Put a default image in the text box.
            imagePath.Text = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Alu.bmp");

            // Initialize combo box.
            operatorBox.SelectedIndex = 0;
        }
Exemple #8
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Setup the default path for the classifier file and load it in.
            classifierPath.Text = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), @"Classification\Parts.clf");
            classifier          = new ParticleClassifierSession(classifierPath.Text);

            // Setup the default path for images
            imagePath.Text = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Classification");
        }
Exemple #9
0
 private void Form1_Load(object sender, EventArgs e)
 {
     polarity.SelectedIndex            = 0;
     interpolationMethod.SelectedIndex = 2;
     smoothing.SelectedIndex           = 0;
     searchMode.SelectedIndex          = 4;
     searchDirection.SelectedIndex     = 0;
     imagePath.Text = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Clamp.png");
 }
Exemple #10
0
        private void loadCalibrationButton_Click(object sender, EventArgs e)
        {
            // Load the calibration grid image.
            calibrationTemplate.ReadFile(System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Calibration grid.tif"));
            imageViewer1.Attach(calibrationTemplate);

            // Update command buttons.
            learnCalibrationButton.Enabled = true;
            measureDistancesButton.Enabled = false;
        }
Exemple #11
0
 private void Form1_Load(object sender, EventArgs e)
 {
     polarity.SelectedIndex            = 0;
     interpolationMethod.SelectedIndex = 2;
     smoothing.SelectedIndex           = 0;
     process.SelectedIndex             = 2;
     imageViewer1.Roi.MaximumContours  = 1;
     imageViewer1.Roi.Color            = Rgb32Value.YellowColor;
     imagePath.Text = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Alu.bmp");
 }
Exemple #12
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Get the image path
            imagePath   = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), @"Pins\");
            imageNumber = 0;

            // Enable the timer
            timer1.Enabled = true;
            timer1.Start();
        }
Exemple #13
0
 private void Form1_Load(object sender, EventArgs e)
 {
     sourceImagePath.Text      = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Iron.tif");
     maskImagePath.Text        = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Mask.tif");
     imageViewer1.ImagePanned += new EventHandler <ImagePannedEventArgs>(imageViewer1_ImagePanned);
     imageViewer1.ImageZoomed += new EventHandler <ImageZoomedEventArgs>(imageViewer1_ImageZoomed);
     imageViewer2.ImagePanned += new EventHandler <ImagePannedEventArgs>(imageViewer2_ImagePanned);
     imageViewer2.ImageZoomed += new EventHandler <ImageZoomedEventArgs>(imageViewer2_ImageZoomed);
     imageViewer1.ToolsShown   = ViewerTools.Pan | ViewerTools.Point | ViewerTools.ZoomIn | ViewerTools.ZoomOut | ViewerTools.Selection;
     imageViewer2.ToolsShown   = ViewerTools.Pan | ViewerTools.Point | ViewerTools.ZoomIn | ViewerTools.ZoomOut | ViewerTools.Selection;
 }
Exemple #14
0
        private void loadCalibrationButton_Click(object sender, EventArgs e)
        {
            // Load Calibration Grid image.
            calibrationTemplate.ReadFile(System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Nonlinear grid.png"));
            imageViewer1.Attach(calibrationTemplate);

            // Update command buttons.
            learnCalibrationButton.Enabled = true;
            loadTargetButton.Enabled       = false;
            measurePartsButton.Enabled     = false;
        }
Exemple #15
0
 private void Form1_Load(object sender, EventArgs e)
 {
     localObjectBox.SelectedIndex      = 1;
     localMethodBox.SelectedIndex      = 0;
     autoObjectBox.SelectedIndex       = 1;
     autoMethodBox.SelectedIndex       = 0;
     tabControl1.SelectedIndex         = 0;
     tabControl1.SelectedIndexChanged += new EventHandler(tabControl1_SelectedIndexChanged);
     imagePath.Text = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "lcd.jpg");
     LoadSelectedImage();
 }
Exemple #16
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Setup the default path for the classifier file and load it in.
            classifierPath.Text = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), @"ColorClassification\Color.clf");
            classifier          = new ColorClassifierSession(classifierPath.Text);

            // Setup the default path for images
            imagePath.Text = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "ColorClassification");

            //Set image type to be color RGB32
            imageViewer1.Image.Type = ImageType.Rgb32;
        }
Exemple #17
0
 private void ReadImage()
 {
     if (imageSelection1.Checked)
     {
         imageViewer1.Image.ReadFile(System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Candy1.png"));
     }
     else
     {
         imageViewer1.Image.ReadFile(System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Candy2.png"));
     }
     DoThreshold();
 }
Exemple #18
0
 private void LoadAVI()
 {
     // Load AVI file from dialog.
     openFileDialog1.InitialDirectory = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), @"AVIs");
     openFileDialog1.Filter           = "AVI files (*.avi)|*.avi||";
     openFileDialog1.FileName         = "";
     openFileDialog1.ShowDialog();
     if (openFileDialog1.FileName != "")
     {
         session = new AviInputSession(openFileDialog1.FileName);
     }
 }
Exemple #19
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Get the image path
            imagePath   = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Parts");
            imageNumber = 0;

            // Read the classifier file
            classifier = new ParticleClassifierSession(System.IO.Path.Combine(imagePath, "Parts.clf"));

            // Enable the timer
            timer1.Enabled = true;
            timer1_Tick(timer1, EventArgs.Empty);
        }
Exemple #20
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //Set image type to be U8
            templateImageViewer.Image.Type = ImageType.U8;
            imageViewer.Image.Type         = ImageType.U8;

            // Setup the default path for the classifier file and load it in.
            templatePath.Text = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), @"Geometric Matching\Template.png");
            // Read the template file and load it into the template viewer image
            templateImageViewer.Image.ReadVisionFile(templatePath.Text);
            // Setup the default path for images
            imagePath.Text = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Geometric Matching");
        }
Exemple #21
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Put a default image in the text box.
            imagePath.Text = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Color cubes.jpg");

            // Set the viewer's image type to RGB
            imageViewer1.Image.Type = ImageType.Rgb32;

            // Initialize combo box
            colorSensitivityBox.SelectedIndex = 0;

            // Register for the Paint event
            pictureBox1.Paint += new PaintEventHandler(pictureBox1_Paint);
        }
Exemple #22
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Set the path to the default image.
            imagePath.Text = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Clamp.png");

            imageViewer1.ToolsShown = ViewerTools.Pan | ViewerTools.Rectangle | ViewerTools.RotatedRectangle | ViewerTools.Selection | ViewerTools.ZoomIn | ViewerTools.ZoomOut;

            // Initialize combo boxes.
            polarity.SelectedIndex            = 0;
            interpolationMethod.SelectedIndex = 2;
            smoothing.SelectedIndex           = 0;
            searchMode.SelectedIndex          = 4;
            searchDirection.SelectedIndex     = 0;
        }
Exemple #23
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Get the image path
            imagePath = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), @"Roundcard\");

            // Load the pattern matching template.
            template.ReadVisionFile(System.IO.Path.Combine(imagePath, "template.png"));

            // Initialize the coordinate system data.
            InitializeStageMotionInformation();

            // Enable the timer.
            timer1.Enabled = true;
            timer1.Start();
            timer1_Tick(timer1, EventArgs.Empty);
        }
Exemple #24
0
        private void Form1_Load(object sender, EventArgs e)
        {
            imagePath.Text = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Color cubes.jpg");

            // Set up image buffers
            imageViewer1.Image.Type = ImageType.Rgb32;
            imageViewer2.Image.Type = ImageType.Rgb32;

            // Load in and display the default image.
            imageViewer1.Image.ReadFile(imagePath.Text);
            imageViewer1.ZoomInfo.Initialize(.5, .5);
            imageViewer1.Roi.MaximumContours = 2;

            imageViewer2.Image.ReadFile(System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "CIE Color Space.png"));
            imageViewer2.RefreshImage();
            imageViewer2.Center.Initialize(85, 102);
        }
Exemple #25
0
        private void LoadAvi()
        {
            openFileDialog1.InitialDirectory = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), @"AVIs");
            openFileDialog1.FileName         = "CompressorComparison.avi";
            openFileDialog1.Filter           = "AVI files (*.avi)|*.avi||";
            openFileDialog1.ShowDialog();
            if (openFileDialog1.FileName != "")
            {
                inputSession = new AviInputSession(openFileDialog1.FileName);
            }

            // Create the temp directory.
            try {
                System.IO.Directory.CreateDirectory(System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "AVI Compressor Comparison Example"));
            } catch (Exception) {
            }
        }
Exemple #26
0
        // This function loads the CD image into memory and displays it.
        private void loadImageButton_Click(object sender, EventArgs e)
        {
            // Read the image.
            imageViewer1.Image.ReadFile(System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "CD.jpg"));
            // Update the viewer so the image is loaded before we set the center.
            // We could also set ImmediateUpdates to true to make this happen, but this
            // hurts performance.
            imageViewer1.RefreshImage();
            imageViewer1.Center.Initialize(310, 300);

            // Initialize and display the annulus region of interest.
            imageViewer1.Roi.Clear();
            imageViewer1.Roi.Add(new AnnulusContour(new PointContour(295, -62), 390, 425, 238, 308));

            // Enable the Unwrap Image button.
            unwrapBarcodeButton.Enabled = true;
        }
Exemple #27
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Put a default image in the text box.
            imagePath.Text = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), @"pcbcolor\pcbcolor-00.jpg");

            // Initialize combo boxes
            matchMode.SelectedIndex        = 0;
            colorSensitivity.SelectedIndex = 2;
            searchStrategy.SelectedIndex   = 0;
            matchFeatureMode.SelectedIndex = 0;

            // Set up both viewers to load color images.
            imageViewer1.Image.Type = ImageType.Rgb32;
            imageViewer2.Image.Type = ImageType.Rgb32;

            // Choose the color for drawing regions.
            imageViewer1.Roi.Color           = Rgb32Value.YellowColor;
            imageViewer1.Roi.MaximumContours = 1;
        }
Exemple #28
0
        private Dictionary <string, Collection <string> > GetTypesAndFileNames()
        {
            Dictionary <string, Collection <string> > typesAndFileNames = new Dictionary <string, Collection <string> >();
            string basePath = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "2D Barcodes");

            foreach (string type in System.IO.Directory.GetDirectories(basePath))
            {
                typesAndFileNames[System.IO.Path.GetFileName(type)] = new Collection <string>();
                //string dir = System.IO.Path.Combine(basePath, type);
                foreach (string fileName in System.IO.Directory.GetFiles(type))
                {
                    if (fileName.EndsWith(".png"))
                    {
                        typesAndFileNames[System.IO.Path.GetFileName(type)].Add(fileName);
                    }
                }
            }
            return(typesAndFileNames);
        }
Exemple #29
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Get the image path
            imagePath   = System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), @"Blister\");
            imageNumber = 0;

            // Load the template image.
            template.ReadVisionFile(System.IO.Path.Combine(imagePath, "template.png"));

            // Set up the color pattern matching options
            matchOptions.ColorWeight       = 300;
            matchOptions.MinimumMatchScore = 500;
            matchOptions.SearchStrategy    = SearchStrategy.Aggressive;

            // Enable the timer
            timer1.Enabled = true;
            timer1.Start();
            timer1_Tick(timer1, EventArgs.Empty);
        }
Exemple #30
0
        private void measureDistancesButton_Click(object sender, EventArgs e)
        {
            // In a point-based measurement, it is not necessary to correct the image.  The
            // coordinates of the fiducial points can be found and transformed to real-world
            // coordinates.  All point measurements can then be performed on these
            // coordinates.

            // Load the Distortion Target image.
            testImage.ReadFile(System.IO.Path.Combine(ExampleImagesFolder.GetExampleImagesFolder(), "Distortion target.tif"));

            // Copy the calibration information from the calibrated image to the test image.
            Algorithms.CopyCalibrationInformation(calibrationTemplate, testImage);

            // Initialize the two search lines.
            Collection <LineContour> searchLines = new Collection <LineContour>();

            searchLines.Add(new LineContour(new PointContour(150, 250), new PointContour(490, 248.57)));
            searchLines.Add(new LineContour(new PointContour(318, 165), new PointContour(319.62, 340)));

            foreach (Direction d in new Direction[] { Direction.Horizontal, Direction.Vertical })
            {
                // Detect the edges along a line and convert the coordinates of the edge points
                // to real-world coordinates.
                EdgeReport report = Algorithms.EdgeTool(testImage, new Roi(new Shape[] { searchLines[d == Direction.Horizontal ? 0 : 1] }), EdgeProcess.All);
                Collection <PointContour> pixelPoints     = new Collection <PointContour>();
                Collection <PointContour> realWorldPoints = new Collection <PointContour>();
                foreach (EdgeInfo info in report.Edges)
                {
                    pixelPoints.Add(info.Position);
                    realWorldPoints.Add(info.CalibratedPosition);
                }
                Collection <PointContour> realWorldPoints2 = Algorithms.ConvertPixelToRealWorldCoordinates(testImage, pixelPoints).Points;
                MeasureDistortionTarget(testImage, pixelPoints, realWorldPoints, d);
            }

            imageViewer1.Attach(testImage);
        }