InspectEdgeForDefect
The InspectEdgeForDefect function is used to construct an edge model to perform advanced edge analysis on the edges or edge pairs returned by an InspectEdge function. This data is used to construct a best-fit line fit to compare found edges or edge pairs against, detecting defects and gaps, such as the distance from the line fit.
InspectEdgeForDefect Overview
After inserting the function into the spreadsheet, a reference must be made to an Inspect data structure output by an InspectEdge function. Once the reference to the InspectEdge function has been established, the edge model is created by configuring the parameters of the InspectEdgeForDefect function. The edge model involves defining the following:
- The type of line fit - straight or circular.
- The type of edge - single or edge pair.
- The type of edge transition - white to black or vice-versa.
- The edge scoring criteria that will be used to filter unwanted edges.
- The line fit criteria that will be used to filter unwanted edges from the line fit.
- The tolerances for defects and/or gaps to be encountered.
Once the edge model has been established, the function will compare edge candidates against the edge model and report deviations from the model.
InspectEdgeForDefect Inputs
Syntax: InspectEdgeForDefect(InspectEdge,Line Fit,Inspect Edge Pairs,Find Edge Direction,Edge: First,Edge: Second,Edge Scoring.Score Threshold,Edge Scoring.Edge Rules,Edge Scoring.Contrast Upper Bound,Edge Scoring.Pair Size,Advanced Line Fit.Filter Outliers,Advanced Line Fit.Distance Filter,Advanced Line Fit.Furthest Point Filter Distance,Advanced Line Fit.Re-Score,Advanced Line Fit.Re-Fit,Max Humber of Defects/Gaps,Defects.Min Distance,Defects.Max Distance,Defects.Size Enabled,Defects.Min Size,Defects.Max Size,Defects.Area Enabled,Defects.Min Area,Defects.Max Area,Defects.Defect Line Fit Filter,Defects.Sort Criteria,Gaps.Enabled,Gaps.Gap Minimum,Gaps.Gap Maximum,Gaps.Max Displacement,Gaps.Ignore Gap Ends,Gaps.Sort Criteria,Caliper Index,Show)
Parameter | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Specifies a reference to a spreadsheet cell that contains a valid Inspect data structure returned by an InspectEdge function. |
|||||||||||||||||||||||||||||||||||||||||
Specifies the type of line fit to be constructed out of the detected edges.
|
|||||||||||||||||||||||||||||||||||||||||
Specifies whether or not the function should detect edge pairs. Detected edge pairs will be labeled graphically within the image, with the first edge detected being 0, and the second edge being 1.
|
|||||||||||||||||||||||||||||||||||||||||
Specifies the direction in which the function will attempt to detect edges. Dark green arrows are added to graphically illustrate the direction in which the edge will be detected. Fit lines will be labeled graphically within the image, with the first fit line being labeled 0, and the second fit line being 1. Note: If the ROI of the referenced InspectEdge function is bent into a curve, the inspection will be relative to the curve’s center. When the Find Edge Direction parameter is set to Left-to-Right, it inspects towards the curve’s center, and when set to Right-to-Left, it inspects away from the curve’s center.
|
|||||||||||||||||||||||||||||||||||||||||
Specifies the contrast transition of the first edge to be detected, as determined by the Find Edge Direction parameter.
|
|||||||||||||||||||||||||||||||||||||||||
Specifies the contrast transition of the second edge to be detected, as determined by the Find Edge Direction parameter. Note: The Inspect Edge Pairs parameter must be On to enable this selection.
|
|||||||||||||||||||||||||||||||||||||||||
Specifies the edge scoring mode that will be used to determine whether or not an edge meets the established criteria.
|
|||||||||||||||||||||||||||||||||||||||||
Specifies how the function should construct the line fit.
|
|||||||||||||||||||||||||||||||||||||||||
Specifies the maximum number of defects and/or gaps the function should expect to detect (1 to 4096; default = 5). This value is applied to Defects and Gaps individually; e.g. when the setting is 5, the function expects to encounter a maximum of 5 Defects and 5 Gaps. This setting is used to construct the Vision Data Access Result Table in the spreadsheet. |
|||||||||||||||||||||||||||||||||||||||||
Specifies the parameters for determining defects in the edge from the line fit.
|
|||||||||||||||||||||||||||||||||||||||||
Specifies the parameters for determining gaps in the edge.
|
|||||||||||||||||||||||||||||||||||||||||
Specifies the Caliper to be displayed on the image (the Caliper will be outlined in green); default Caliper displayed is 0. |
|||||||||||||||||||||||||||||||||||||||||
Specifies the display mode for the graphic overlay on the image.
|
InspectEdgeForDefect Outputs
Returns |
An Inspect data structure containing the detected defects, extremes and gaps, or #ERR if any of the input parameters are invalid. |
When InspectEdgeForDefect is initially inserted into a cell, a results table is created in the spreadsheet, and the result table corresponds to the type of search being performed. Note: If the value
of the Max Number of Defects/Gaps parameter
is greater than zero, InspectEdgeForDefect will automatically insert a result table
containing a maximum of 10 entries
that correspond to the first 10 defects/gaps/edges/edge pairs in the data structure.
If you wish to display more entries, you can expand the table by copying
the last row and pasting additional rows at the end.
|
InspectEdgeForDefect Vision Data Access Functions
The following Vision Data Access functions are automatically inserted into the spreadsheet to create the InspectEdgeForDefect data structure result table, which is broken into four sections, Summary, Defects, Gaps and Extremes:
All of the formulas for the InspectEdgeForDefect conform to the following:
- Inspect = An Inspect data structure output by an InspectEdgeForDefect function
- Caliper Index = 0 to N (the total number of Calipers is equal to the number of Calipers output by the InspectEdge function that the InspectEdgeForDefect function is referencing)
- Edge Pair Index = 0 or 1
- Edge Index = 0 to N
- Point Index = 0 to 1
If the Inspect Edge Pairs parameter is enabled, additional rows of data for Edge 1 will be automatically inserted into the spreadsheet. When enabled, an index of 0 will return information regarding Edge 0, and an index of 1 returns information regarding Edge 1.
For more information, see InspectEdge.
Spreadsheet Name | Function Name | Description |
---|---|---|
Summary | ||
Defects/Gaps | GetDefectGapCount(Inspect, [Edge Pair Index], [Defect/Gap]) | Returns the number of defects/gaps, depending on which is specified. Defect = 0, Gap = 1. |
Row0/1 | GetFitEdgeRow(Inspect, [Edge Pair Index], [Point Index]) | Returns the row coordinate of the specified point. |
Col0/1 | GetFitEdgeCol(Inspect, [Edge Pair Index], [Point Index]) | Returns the column coordinate of the specified point. |
Center Row | GetFitEdgeCenterRow(Inspect, [Edge Pair Index]) | Inserted when a Circle Line Fit is specified, returns the row coordinate of the center of the circle line fit. |
Center Col | GetFitEdgeCenterCol(Inspect, [Edge Pair Index]) | Inserted when a Circle Line Fit is specified, returns the column coordinate of the center of the circle line fit. |
Radius | GetFitEdgeRadius(Inspect, [Edge Pair Index]) | Inserted when a Circle Line Fit is specified, returns the distance from the center of the circle line fit for the selected Edge Pair. |
Defects/Gaps | ||
Size/Area | GetDefectGapValue(Inspect, [Defect/Gap Index], [Defect/Gap], [Edge Pair Index], [Size/Area/Width]) | Returns the size or area of the defect or gap. Defect = 0, Gap = 1; Size = 0, Area = 1, Width = 2. |
Row | GetDefectGapBoundsRow(Inspect, [Defect/Gap Index], [Defect/Gap], [Edge Pair Index]) | Returns the row coordinate of the defect's bounding rectangle. Defect =0, Gap = 1. |
Col | GetDefectGapBoundsCol(Inspect, [Defect/Gap Index], [Defect/Gap], [Edge Pair Index]) | Returns the column coordinate of the defect's bounding rectangle. Defect =0, Gap = 1. |
High | GetDefectGapBoundsHigh(Inspect, [Defect/Gap Index], [Defect/Gap], [Edge Pair Index]) | Returns the height of the defect's bounding rectangle. Defect =0, Gap = 1. |
Wide | GetDefectGapBoundsWide(Inspect, [Defect/Gap Index], [Defect/Gap], [Edge Pair Index]) | Returns the width of the defect's bounding rectangle. Defect =0, Gap = 1. |
Angle | GetDefectGapBoundsAngle(Inspect, [Defect/Gap Index], [Defect/Gap], [Edge Pair Index]) | Returns the angle of the defect's bounding rectangle. Defect =0, Gap = 1. |
Curve | GetDefectGapBoundsCurve(Inspect, [Defect/Gap Index], [Defect/Gap], [Edge Pair Index]) | Returns the curve of the defect's bounding rectangle. Defect =0, Gap = 1. |
Start/End | GetDefectGapCaliperIndex(Inspect, [Defect/Gap Index], [Defect/Gap], [Edge Pair Index], [Defect Start/End]) | Returns the Caliper in which the defect starts or ends. Defect =0, Gap = 1; Start = 0, End = 1. |
Extremes - Furthest Point 1/2 | ||
Caliper | GetExtremePoints(Inspect, [Edge Pair Index], [Near/Far]) | Returns the index of the Caliper whose edge is furthest from the line fit (Near = 0 and Far = 1). |
Row | GetEdgeRow(Inspect, [Caliper Index], [Edge Index], [Edge Pair Index]) | Returns the row coordinate of the referenced edge. |
Col | GetEdgeCol(Inspect, [Caliper Index], [Edge Index], [Edge Pair Index]) | Returns the column coordinate of the referenced edge. |
Distance | GetEdgeFromFit(Inspect, [Caliper Index], [Edge Pair Index]) | Returns the distance from the referenced Caliper's edge to the line fit. |