示例#1
0
 private void imageViewer1_RoiChanged(object sender, NationalInstruments.Vision.WindowsForms.ContoursChangedEventArgs e)
 {
     if (imageViewer1.Roi.Count > 0)
     {
         LineProfile();
     }
 }
示例#2
0
        private void imageViewer1_RoiChanged(object sender, NationalInstruments.Vision.WindowsForms.ContoursChangedEventArgs e)
        {
            // Enable the Test Parts button if at least one region is selected.
            testPartsButton.Enabled = imageViewer1.Roi.Count > 0;

            // Update the target display.
            for (int i = 0; i < imageViewer1.Roi.Count; ++i)
            {
                // Enable the indicators.
                GetExpectedTextBox(i).Enabled  = true;
                GetActualTextBox(i).Enabled    = true;
                GetPassFailLed(i).Enabled      = true;
                GetPassFailLed(i).LedColorMode = PassFailLed.ColorMode.RedGreen;

                // Find the number of edges along the line.  This is the expected
                // number of edges.
                EdgeReport report = Algorithms.EdgeTool(imageViewer1.Image, new Roi(new Shape[] { imageViewer1.Roi[i].Shape }), EdgeProcess.All, new EdgeOptions(EdgePolaritySearchMode.All, 60));
                GetExpectedTextBox(i).Text = report.Edges.Count.ToString();
            }
            for (int i = imageViewer1.Roi.Count; i < 5; ++i)
            {
                // Disable the indicators.
                GetExpectedTextBox(i).Text     = "0";
                GetExpectedTextBox(i).Enabled  = false;
                GetActualTextBox(i).Text       = "0";
                GetActualTextBox(i).Enabled    = false;
                GetPassFailLed(i).Enabled      = false;
                GetPassFailLed(i).LedColorMode = PassFailLed.ColorMode.RedGray;
            }
        }
示例#3
0
 private void imageViewer1_RoiChanged(object sender, NationalInstruments.Vision.WindowsForms.ContoursChangedEventArgs e)
 {
     // If a point is on the viewer, perform the magic wand operation.
     if (imageViewer1.Roi.Count > 0 && imageViewer1.Roi[0].Type == ContourType.Point)
     {
         Algorithms.MagicWand(imageViewer1.Image, imageViewer2.Image, imageViewer1.Roi, (double)toleranceUpDown.Value, connectivity4Button.Checked ? Connectivity.Connectivity4 : Connectivity.Connectivity8);
         MaskToRoiReport report = Algorithms.MaskToRoi(imageViewer2.Image);
         imageViewer1.Roi.Clear();
         foreach (Contour c in report.Roi)
         {
             imageViewer1.Roi.Add(c.Shape);
         }
     }
 }
示例#4
0
        private void imageViewer1_RoiChanged(object sender, NationalInstruments.Vision.WindowsForms.ContoursChangedEventArgs e)
        {
            if (imageViewer1.Roi.Count > 0)
            {
                if (imageViewer1.Roi[0].Type == ContourType.Point)
                {
                    // Get the point from the viewer.
                    PointContour point = (PointContour)imageViewer1.Roi[0].Shape;

                    // Set the mask offset.
                    imageViewerMask.Image.MaskOffset.Initialize(point.X - imageViewerMask.Image.Width / 2, point.Y - imageViewerMask.Height / 2);

                    // Mask the image.
                    Algorithms.Mask(imageViewer1.Image, imageViewer2.Image, imageViewerMask.Image);
                }
            }
        }