The following procedure provides a basic methodology for using the EdgeLocator step to locate an edge:
Draw the search region, if needed. To do so interactively,
select this step in the flowchart and click on the
Define a region () toolbar button in the
Project toolbar. See the
Search regions section in
Chapter 2: Building a project for more information.
You can tweak the search region's location by specifying its center's coordinates (CenterX and CenterY), size (Height and Width), and Angle (search direction), from the Configuration pane's Search region... button. You can also link the values for the coordinates and size to results from another step to position your search region relative to a previously determined location.
To adjust the edge polarity, smoothing, and number of sub-regions, perform the following:
In the Configuration pane, set the Polarity of the edge. A dark to bright transition (positive) indicates an expected rise in grayscale values at the edge in the search direction, whereas a bright to dark transition (negative) indicates an expected decrease in grayscale values at the edge. If you set the polarity to Any, the edge with the sharpest contrast will be located.
Set the Edge Fit. Select Best for the strongest edge and Closest for the edge closest to the beginning of the search box that has at least the minimum edge strength entered. The default minimum edge strength is 10.
To even out rough edges and remove noise from the image, adjust the value for the Filter Smooth property. Smoothing values can range between 0 (no smoothing) to 100 (very smooth). The default value is 50.
If required, increase the Number of sub-regions used to locate an edge in the search region. The EdgeLocator step will find and fit a line to points marking the strongest pixel intensity transition for each sub-region. Increasing the number of sub-regions is useful if the edge is not straight or if its angle varies by 15 degrees or less from the search region's angle. You cannot have fewer than 3 sub-regions (default).
If the position of an edge is in the right place, however the line is skewed, you should use the edge markers found in the Measurement step, which has more controls available to better identify edges in the presence of noise and unwanted edges. The following images illustrate some examples of situations where you should use the EdgeLocator step, and where you should use the edge markers in the Measurement step. The first image features minimal noise and a clear, simple edge optimally found using the EdgeLocator step. The other images demonstrate an image with more noise. In this case, some noise pixels are interpreted as subedges, and skew the resulting edge marker. To reduce or prevent this from happening, the Measurement step provides maximum sub-position distance controls to limit the effect of outliers.
If the edge angle is expected to vary by more than 15 degrees from the search region angle, it is sometimes necessary to adjust the angular range of the search region. To do so, perform the following:
Enable AngleMode by performing either of the following:
Click on AngleMode in the Angles section of the Quick Access pane, then set AngleMode to Enabled in the Configuration pane.
Select AngleMode in the Properties pane, then set AngleMode to Enabled in the Properties pane.
When AngleMode is set to Enabled, in the Configuration pane you can set the DeltaPositive and DeltaNegative to search for the edge within a range of angles. The angle range is set relative to the current angle of the search region; for example, if the search angle is currently 45 degrees, setting a DeltaPositive and DeltaNegative to 15 will yield a search between 30 and 60 degrees. The default value for both DeltaPositive and DeltaNegative is 180.
Although the default value for DeltaPositive and DeltaNegative is 180 degrees, the search range should be restricted to the actual expected angle variation to get more accurate results and minimize the step's execution time.
You can also adjust the CoarseAngle and FineAngle, if necessary. The CoarseAngle is the increment, in degrees, which the EdgeLocator step will use to find the approximate location of an edge within the search range. The default for the CoarseAngle is 5 degrees. Once the approximate location of the edge is found, FineAngle is used as the increment, in degrees, to fine-tune the search and accurately identify the strongest edge. FineAngle is set to Disable by default.
Note, when FineAngle is set to Disable, the resulting angle granularity is equal to the coarse angle; for FineAngle to have any effect, its value must be less than the CoarseAngle.
When enabling angle mode, the angle range, coarse angle, and fine angle will increase the step's execution time by the following factor: