Two Image Add Edit ControlCognex VisionPro

The Two Image Add edit control provides a graphical user interface (GUI) for the CogIPTwoImageAddTool vision tool.

Cognex Image Processing Two Image Add Control add wholecontrol

This tool adds the pixels in two input images to produce a single output image. To run the tool, you supply:

  • Two input images.
  • A pixel overflow mode.
  • Optional region and alignments for each image.

Note: The output image's coordinate space tree is adjusted to preserve the relationship between root space and image features.

The Two Image Add edit control includes the following components:

  • A row of control buttons at the top left.
  • A tool display window that can display the tool's image buffers: Current.InputImageA, Current.InputImageB, LastRun.InputImageA, LastRun.InputImageB, and LastRun.OutputImage. These buffers contain the two images on which the tool will operate (including any input regions), the last two images on which the tool operated, and the image result from adding the input images.
  • A set of tabs organized by function. These functions include parameter settings to run the tool, parameter settings for the region and alignment of each input image, and graphic settings for the tool displays. Pressing the Control + Tab keys scrolls through the set of tabs.
  • A status bar at the bottom left of the control. A green circle indicates that the tool ran successfully; red means the tool ran unsuccessfully. The status bar also displays the time to run the tool and any error codes or messages. The first time that the status bar displays is the raw tool execution time. The second includes the time needed to update the edit control. Controls only update when they are visible.
Control Buttons

The Two Image Add edit control includes buttons common to most VisionPro controls.

Cognex Image Processing Two Image Add Control basictoolbar

The following table describes the buttons at the top left of the edit control.

Table 1. Control buttons
ButtonDescription

Cognex Image Processing Two Image Add Control runbutton

Runs the Two Image Add tool. You must have an image available in the Current.InputImageA and Current.InputImageB buffers (equivalent to InputImageA and InputImageB, respectively). This button invokes the Run method.

Cognex Image Processing Two Image Add Control electricbutton

Toggles electric mode. When selected, the tool runs automatically if certain parameters have changed. When the edit control is in electric mode, these parameters are indicated by electric bolt icons.

Cognex Image Processing Two Image Add Control localdisplaybutton

Opens or closes the local tool display window. This window has a selection box that you use to specify the image buffer you want to view.

Cognex Image Processing Two Image Add Control floatingdisplaybutton

Opens one or more floating tool display windows, providing an additional tool display window. As with the local tool display window, you can specify the tool image buffer to view.

Cognex Image Processing Two Image Add Control openbutton

Loads a VisionPro persistence (.vpp) file, which contains a set of saved properties for this vision tool object type. Loading a persistence file for another object type throws an error and the load is unsuccessful.

For more information about VisionPro persistence features, see the topic Persistence in VisionPro.

Cognex Image Processing Two Image Add Control savebutton

Saves the current properties of the underlying tool to a VisionPro persistence file. You have the option to save either the entire tool or the tool without its images or results.

Cognex Image Processing Two Image Add Control saveasbutton

Saves the current properties of the underlying tool to a new VisionPro persistence file.

Cognex Image Processing Two Image Add Control resetbutton

Resets the underlying tool to a default state.

Cognex Image Processing Two Image Add Control tooltipsbutton

Enables or disables the display of tooltips for individual items in this edit control.

Cognex Image Processing Two Image Add Control helpbutton

Opens this help topic.

Two Image Add Edit Control Buffers

The Two Image Add edit control has five image buffers:

  • The Current.InputImageA and Current.InputImageB buffers show the tool's InputImageA and InputImageB, respectively. If you specify a RegionA or RegionB, these buffers also show region selection graphics.
  • The LastRun.OutputImage buffer shows the OutputImage that results from adding the pixels of the input images.
  • The LastRun.InputImageA and LastRun.InputImageB buffers show the images on which the tool most recently ran. Use the Graphics tab to show input regions, alignment points, and overlap mask graphics.

You can display these image buffers using either the local or floating tool display window.

Settings Tab

You use the Settings tab to select a OverflowMode. The overflow mode determines how the tool handles cases in which adding the two images results in values greater than the maximum pixel value.

Cognex Image Processing Two Image Add Control add settingstab

You can choose from the following modes.

Table 2. Settings Tab Features
Overflow ModeDescription
BoundedLimits the pixel values to low and high values. For 8-bit unsigned images, this is 0 and 255, respectively. This option is equivalent to setting the tool's overflow mode to CogIPTwoImageAddOverflowModeConstants.
WrapWraps any pixel values that overflow from the add operation. This option is equivalent to setting the tool's overflow mode to CogIPTwoImageAddOverflowModeConstants.
ShiftDivides result pixel values by two. This option is equivalent to setting the tool's overflow mode to CogIPTwoImageAddOverflowModeConstants.
Region Tab

You use the Region tab to specify separate regions of interest for each input image.

Cognex Image Processing Two Image Add Control common regiontab

The following table summarizes the Region tab features.

Table 3. Region Tab Features
FeatureDescription

Region Mode

Defines how the tool interprets the input region you specify. Equivalent to setting RegionModeA or RegionModeB properties with the appropriate CogRegionModeConstants enumeration value.

  • Affine Transform specifies that the pixels within a region are affine-transformed into a new, pixel-aligned rectangular image.
  • Bounding Box specifies that the pixels within a pixel-aligned bounding box that encloses a region are processed.

Region Shape

The shape of the input region. This is equivalent to setting either RegionA or RegionB. Selecting "None=Use entire image" means that the tool uses the entire input image. A Two Image Add tool supports the following input region shapes:

The set of region-defining parameters that appear depend on the region shape you use. For more information on using a polygon as an input region, see the topic Using Polygon Input Regions.

SelectedSpaceNameThe coordinate space in which the region is interpreted. 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.

Alignment Tab

The Alignment tab lets you set the x- and y-coordinates in each input image used to align the images when they are added. Coordinates are always specified in the selected space of the corresponding input image.

Cognex Image Processing Two Image Add Control common alignmenttab

Table 4. Alignment Tab Features
FeatureDescription
Use Image AlignmentSpecifies whether the x- and y-coordinates of the alignment points are used to align the first input image with the second image. If unchecked, the tool uses the upper-left corner of each input image or of the transformed regions for alignment. Equivalent to setting the ImageAlignmentEnabled property.

X, Y

Specifies the x- and y-coordinates in each input image with which to align the images to be added. The coordinates are specified in selected coordinated space of each input image. Equivalent to setting the following properties:

Fit in Image A, Fit in Image BPlaces the alignment point in the center of an input image.

Graphics Tab

You use the Graphics tab to choose which diagnostic graphics the tool generates and displays in the LastRun.OutputImage, LastRun.InputImageA, LastRun.InputImageB buffers. The graphic options on this tab are equivalent to setting the LastRunRecordDiagEnable with the appropriate CogIPTwoImageAddLastRunRecordDiagConstants enumeration values.

Cognex Image Processing Two Image Add Control common graphicstab

The Graphics tab offers the following diagnostic graphic options.

Table 5. Graphics Tab Features
Diagnostic GraphicDescription
Show Input ImagesThe Without Copy, With Copy, and None options 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.
Show Region Transformed ImagesShows the pixels that correspond to the selected regions of the input images. This applies only to the Affine Transform (CogRegionModeConstants) region mode.
Show RegionsOutlines the selected regions of the input images.
Show Alignment PointsDraws the alignment points of the input images used to obtain the output image.
Show Overlap MasksShows the overlap mask on either the last-run input images or last-run region transformed images. If you did not specify any regions, then the overlap is displayed on the corresponding input image.