# InspectEdgeTrainBeadPath

The InspectEdgeTrainBeadPath function is used to find the center of an edge-based bead feature, and creates a polyline that traces the path of the detected bead path. The polyline path created by the tool can be used as an input by other InspectEdge Functions, such as the InspectEdgeWidth function, to determine if there are positional defects, width defects or gaps in the bead.

## InspectEdgeTrainBeadPath Overview

A bead path is a continuous pair of edges that define the boundary between two regions of different pixel values (the path does not always have to appear as loop). Typically, a bead path refers to an ink or glue path, or a welded seam, which is defined by its width, or thickness, and its location. The InspectEdgeTrainBeadPath function, in conjunction with the other InspectEdge functions, provides the ability to be applied in bead tracking applications, where the bead path varies from one image to the next, or verifying whether or not a bead path is consistently in the same location.

In the bead tracking application, the InspectEdgeTrainBeadPath function, in conjunction with an InspectEdge function and InspectEdgeWidth function, is capable of verifying that the bead path is consistently laid out in a uniform pattern, neither too thick or thin. The functions create a multi-segmented line that defines a path along the bead, and then determines if there any areas of the bead path which are too thick, thin, or missing altogether.

In the location-based bead tracking application, the same functions are capable of verifying that the bead path is consistently in the same location, with the same thickness, and that there are no positional variations along the path.

Note: To be used in either application, the InspectEdgeTrainBeadPath function must be used as an input to the External Region or Path parameter of the InspectEdge function, and the InspectEdgeWidth function must reference the Inspect data structure output by the InspectEdge function in its InspectEdge parameter.

## InspectEdgeTrainBeadPath Inputs

Parameter | Description
Image | This parameter must reference a spreadsheet cell that contains an Image data structure. By default, this parameter references A0, the cell containing the data structure. This parameter can also reference other Image data structures, such as those returned by the Image Vision Data Access functions or Coordinate Transforms Functions.
Fixture | Defines the Region of Interest (ROI) relative to a Fixture input or the output of the image coordinate system for the Vision Tools function. Setting the ROI relative to a Fixture ensures that if the Fixture is rotated or translated, the ROI is rotated or translated in relation to the Fixture. Note: 2D projections use real world units but fixturing with 2D tools requires input in pixel values. When using a 2D projection from a 3D point cloud as a Fixture, convert the real world units to pixel values using the TransWorldToPixel function. The default setting is (0,0,0), the top leftmost corner of the image.
X (default = 0) | The X-offset, in image coordinates.
Y (default = 0) | The Y-offset, in image coordinates.
Theta (default = 0) | The rotation from the image X-axis, in the image coordinate system. (+/-360 degrees clockwise)
Region | Also known as the Region of Interest (ROI), specifies the region of the image that undergoes edge analysis. It creates a Rectangle Regions Interactive Graphics Mode that can be transformed and rotated. With this parameter selected, click Maximize Region on the toolbar of the property sheet. The region is automatically stretched to cover the entire image. The dashed yellow line indicates the direction in which the edge is found.
X | The X-offset of the origin, in fixture coordinates.
Y | The Y-offset of the origin, in fixture coordinates.
Width | The dimension along the X-axis of the region.
Height | The dimension along the Y-axis of the region.
Angle | The orientation, in fixture coordinates.
Curve | The angular deviation between the x-axis and the opposing boundary line of the region.
Note: The Fixture and Region parameters must be defined within the bounds of the image. Otherwise, the function returns #ERR.
External Region or Path | Specifies Cell References to a spreadsheet cell that contains an Annulus, a Region, an EditAnnulus, an EditMaskedRegion, an EditPolylinePath or an EditRegion function. When this parameter is used, the function ignores the Region and Fixture settings and inspects the image area specified by the referenced region.. Note: If this parameter has been set as a reference to an external region, to use the internal Region of the function, this parameter must be manually set to zero by entering the value 0 in place of the cell reference. Otherwise, the function continues to reference the external region. If this parameter references anEditPolylinePath, the function cannot be used as a reference to the InspectEdgeForDefector InspectEdgePosition functions, which will return #ERR.
Caliper | Specifies the Caliper array within the ROI that will be used to define the size of the detectable defects and/or gaps. The size of the detectable defect or gap is determined by the number of edges that can be detected, which is determined by the number of Calipers placed along the edge. The Calipers are displayed within the ROI as red rectangles, and edges detected within the Caliper are displayed in green, when the InspectEdge cell is highlighted or the Show parameter is set to show all. Note: Depending on the type of defect being examined, Calipers may be positioned to overlap. However, the more Calipers that are applied within the ROI increase the execution time of the function.
Height | Specifies the number of pixels, per Caliper, that are to be analyzed along the direction of the inspection. The valid range is 1 to the image width of the In-Sight vision system. The default value is 5.
Repeat Offset | Specifies the number of pixels between the start of each Caliper. The valid range is 1 to the image width of the In-Sight vision system. The default value is 5. The last Caliper may overlap the end of the Region, unless Fit All Calipers is enabled.
Initial Offset | Specifies an offset for the first Caliper in the Region. The valid range is 0 to the image width of the In-Sight vision system. The default value is 0.
Minimum Contrast | Specifies the minimum greyscale contrast transition (0 to 255; default = 5) to be considered an edge. For each indexed Caliper, an edge response chart is displayed with the image. The values in the chart are automatically scaled to a 0-100 value. Utilize this chart when applying this parameter to properly adjust the value. Example - Minimum Contrast Parameter with Chart
Edge Width | Specifies the pixel distance (1 to the Region width value; default = 3) over which an edge transition takes place. This setting is the approximate size of the pixel operator used to filter the greyscale projections before edges are extracted. Use this setting to filter noise from the image.
Fit All Calipers | Specifies whether or not all of the Calipers are placed within the ROI.
0 = OFF (default) | Specifies that the function strictly adheres to the Caliper Repeat Offset and Initial Offset parameters, and Calipers may overhang the ROI.
1 = ON | Specifies that the function will automatically re-calculate the Caliper Repeat Offset and Initial Offset parameters to ensure that all of the Calipers are placed within the ROI.
Find Edge Direction | Specifies the direction in which the function attempts to detect edges. Dark green arrows are added to graphically illustrate the direction in which the edge is detected. Fit lines are labeled graphically within the image, with the first fit line labeled 0, and the second fit line 1.
0 = Left-to-Right | The function attempts to detect edges from the left of the ROI to the right. Example
1 = Right-to-Left | The function attempts to detect edges from the right of the ROI to the left. Example
3 = Center Outward (default) | The function attempts to detect edges from the center of the ROI to the upper and lower bounds of the ROI (the order of the found edges is in the opposite direction of the "X" arrow on the ROI). Example
2 = Outside In | The function attempts to detect edges from the upper and lower bounds of the ROI to the center of the ROI (the order of the found edges is in the opposite direction of the "X" arrow on the ROI). Example
Edge: First | Specifies the contrast transition of the first edge to be detected, as determined by the Find Edge Direction parameter.
1 = Black-to-White | The edge transitions from black pixels to white pixels.
2 = White-to-Black (default) | The edge transitions from white pixels to black pixels.
3 = Either | The edge can transition from either black-to-white, or white-to-black, and the function determines the proper transition. Specifying the transition improves the performance of the function.
Edge: Second | Specifies the contrast transition of the second edge to be detected, as determined by the Find Edge Direction parameter.
1 = Black-to-White (default) | The edge transitions from black pixels to white pixels.
2 = White-to-Black | The edge transitions from white pixels to black pixels.
3 = Either | The edge can transition from either black-to-white, or white-to-black, and the function determines the proper transition. Specifying the transition improves the performance of the function.
Edge Scoring | Specifies the edge scoring mode used to determine whether or not an edge meets the established criteria.
Score Threshold | Specifies a scoring threshold to filter out edges with scores (1 to 100; default = 10) lower than this value.
Edge Rules | Specifies the type of edge that is most important when calculating the score.
1 = First | The first edge detected receives the highest consideration.
2 = Strongest | The edge with the strongest contrast transition receives the highest consideration.
3 = First Strongest | The first edge detected, with the strongest transition, receives the highest consideration.
4 = Edge Pair Size | The edge pair detected with the size closest to the Pair Size parameter receives the highest consideration.
5 = First Edge Pair Size | The first edge pair detected with the size closest to the Pair Size parameter receives the highest consideration.
6 = Strongest Edge Pair Size | The edge pair detected with the strongest transition and the size closest to the Pair Size parameter receives the highest consideration.
7 = First Strongest Edge Pair Size (default) | The first edge pair, with the strongest transition and the size closest to the Pair Size parameter, receives the highest consideration.
Contrast Upper Bound | Specifies the upper limit of the edge contrast transition (2 to 255; default = 255) to be considered an edge. Edges with an edge contrast transition above this value have the same highest score. Note: The Edge Rules parameter must be set to either Strongest, First Strongest, Strongest Edge Pair Size, or First Strongest Edge Pair Size to enable this parameter.
Pair Size | Specifies the edge pair size at which the highest score is achieved (valid range is 1 to 3 times the image width of the In-Sight vision system; default = 5). When this parameter is enabled, edge pairs detected above or below this value are scored proportionally to this value. For example, if the Pair Size is set to 10, and two edge pair candidates are detected, one with a value of 8 and another with 14, the edge pair with a value of 8 is selected because it is closer to the limit than the second edge pair. Note: The Inspect Edge Pairs parameter must be On, and the Edge Rules parameter must be set to either Edge Pair Size, First Edge Pair Size, Strongest Edge Pair Size, or First Strongest Edge Pair Size to enable this parameter.
Train | Specifies the training mode of the tool.
0 = OFF | Specifies that the function will not train.
1 = ON (default) | Specifies that the function will train.
Caliper Graph Index | Specifies the Caliper displayed on the image (the Caliper is outlined in green). The default Caliper displayed is 0.
Show | Specifies the display mode for InspectEdge graphical overlays on top of the image.
0 = hide all (default) | All graphics are hidden, except when the cell containing the InspectEdgeTrainBeadPath function is highlighted in the spreadsheet.
1 = result graphics only | The trained EditPolylinePath and found edge pair point graph are displayed at all times.
2 = Display result graphics and caliper details | The trained EditPolylinePath and a single Caliper, with its edge candidates, and the Caliper Graph are displayed at all times.
3 = Display result graphics, caliper details and edge candidates | The trained EditPolylinePath and a single Caliper, with its edge candidates, the Caliper Graph and all of the edge candidates for all of the Calipers are displayed at all times.
4 = Display result graphics, all edge candidates and calipers | The trained EditPolylinePath and a single Caliper, with its edge candidates, the Caliper Graph, all of the edge candidates for all of the Calipers and all of the Calipers are displayed at all times.
5 = show all: input, result, and calipers | The input graphics, trained EditPolylinePath, a single Caliper, with its edge candidates, the Caliper Graph, all of the edge candidates for all of the Calipers and all of the Calipers are displayed at all times.

## InspectEdgeTrainBeadPath Outputs

Returns | An Inspect data structure containing the detected edges in the image and the number of Calipers, or #ERR if any of the input parameters are invalid.
Results | The number of Calipers in the ROI.