Mask Creator Edit ControlCognex VisionPro 9.20

The Mask Creator tool edit control provides a graphical user interface to the CogMaskCreator tool, which you use to create a runtime mask for any input image. The mask image can be linked to any vision tool that supports image masking and can be fixtured so that it changes orientation to align with the position of desired features in your runtime images.

As you create an image mask you add one or more regions that define areas of Care or Don't Care pixels:

  • Position Care regions around features you want to analyze when you attach the mask image to a vision tool later in the application.
  • Position Don't Care regions around features you want to exclude from analysis later in the application.

The tool returns a result mask that can be linked to the InputImageMask property of another vision tool such as the LineMax tool.

The following figure shows the Mask Creator edit control:

CognexImageProcessing_MaskCreator_MaskCreatorWholeControl

To include the edit control in your custom vision application it must be in your Visual Studio.NET development environment. See the topic Adding Edit Controls to Visual Studio for more information.

This topic contains the following sections.

Control Buttons

CognexImageProcessing_MaskCreator_ButtonBar

The following table describes the function of each button:

ButtonDescriptionFunction
Run Button
RunGenerate the mask image defined by the regions you create.
Electric Button
Electric modeToggle electric mode, where the Mask Creator tool executes automatically when particular configuration parameters change. In electric mode, a lightning bolt appears next to every electric property.

Local Display Button

Local image display

Open or close the local image display window. A Mask Creator tool supports the following image buffers:

  • Current.InputImage: Contains the current image and the mask regions you define
  • LastRun.InputImage: Contains the last image processed by the Mask Creator tool
  • LastRun.OutputMask: Contains a representation of the image mask, where black pixels represent Don't Care values and white pixels represent Care values.
Floating Display Button
Floating image displayOpen a floating image window, which supports the same image buffers as the local image display window.
Open Button
OpenOpen a VisionPro persistence (.vpp) file that contains a set of saved properties for this vision tool object type. VisionPro reports an error if you try to open a .vpp file for another object type.
Save Button
SaveSave the current properties of the vision tool to a VisionPro persistence (.vpp) file. The edit control allows you to choose between saving the vision tool with or without its image buffers and tool results.
Save As Button
Save AsSave the current properties of the vision tool to a new VisionPro persistence (.vpp) file.
Reset Button
ResetReset the vision tool to its default state. The tool gives you a choice between resetting to the default-constructed state, which is appropriate when you are using it in a Visual Studio.NET application, and its template-initialized state, which is appropriate for QuickBuild applications.
Tool Tips Button
Show ToolTipsEnable or disable the display of tooltips for individual items in the edit control.
Help Button
HelpOpen this VisionPro online help file.
Settings Tab

Use the Settings tab to create regions of Care and Don't Care pixels. The following figure shows the Settings tab with multiple regions:

CognexImageProcessing_MaskCreator_SettingsTab

The Settings tab offers the following controls:

ControlDescription

Background Pixel Value

Choose whether the pixel values of the generated mask image are Care or Don't Care.

  • Care pixels represent features that can be analyzed when you attach the mask image to another vision tool.
  • Don't Care pixels represent features that are masked off from analysis when the mask image is attached to a vision tool.

Region Grid

Use the grid in the Settings tab to add regions to this mask image:

CognexImageProcessing_MaskCreator_RegionGrid

For each region, specify an Inside Pixel Value of Care or Don't Care. Separate regions can be defined as Care or Don't Care depending on your application.

Be aware the order of regions as they appear in this grid ultimately determines which image pixels are defined as Care and Don't Care. For example, placing a region of Care pixels over a region of Don't Care pixels makes those image features available for analysis despite the Don't Care region.

See the topic Image Masking for more information.

Region Shape

Select the shape of the region:

Selected Space NameThe default coordinate space for the region. For information, see Coordinate Space Names.
Select ModeAvailable when Region Shape is CogRectangle or CogRectangleAffine. Selects the set of parameters that define the rectangle. If CogRectangleAffine is chosen, note that the angles of rotation and skew can be specified in degrees or radians, although the underlying tool keeps the measurements in radians.
Fit In ImageCenters the region within the mask image and adjust the region's geometric properties so that its default size is based on the image and its Selected Space Name.
Graphics Tab

Enable the Show Output Mask checkbox on the Graphics tab to generate a LastRun.OutputMask buffer to contain the mask image as shown:

CognexImageProcessing_MaskCreator_ShowMaskBuffer

Use the Show Input Image diagnostics to determine whether or not the input image is recorded as part of the diagnostic record, and whether the image is copied to the record or saved in the record as a reference.